· 9 years ago · Jul 15, 2017, 04:12 PM
1/*!
2 * jQuery JavaScript Library v3.2.1
3 * https://jquery.com/
4 *
5 * Includes Sizzle.js
6 * https://sizzlejs.com/
7 *
8 * Copyright JS Foundation and other contributors
9 * Released under the MIT license
10 * https://jquery.org/license
11 *
12 * Date: 2017-03-20T18:59Z
13 */
14
15( function( global, factory ) {
16
17 "use strict";
18
19 if ( typeof module === "object" && typeof module.exports === "object" ) {
20
21 // For CommonJS and CommonJS-like environments where a proper `window`
22 // is present, execute the factory and get jQuery.
23 // For environments that do not have a `window` with a `document`
24 // (such as Node.js), expose a factory as module.exports.
25 // This accentuates the need for the creation of a real `window`.
26 // e.g. var jQuery = require("jquery")(window);
27 // See ticket #14549 for more info.
28 module.exports = global.document ?
29 factory( global, true ) :
30 function( w ) {
31 if ( !w.document ) {
32 throw new Error( "jQuery requires a window with a document" );
33 }
34 return factory( w );
35 };
36 } else {
37 factory( global );
38 }
39
40// Pass this if window is not defined yet
41} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
42
43// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
44// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
45// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
46// enough that all such attempts are guarded in a try block.
47"use strict";
48
49var arr = [];
50
51var document = window.document;
52
53var getProto = Object.getPrototypeOf;
54
55var slice = arr.slice;
56
57var concat = arr.concat;
58
59var push = arr.push;
60
61var indexOf = arr.indexOf;
62
63var class2type = {};
64
65var toString = class2type.toString;
66
67var hasOwn = class2type.hasOwnProperty;
68
69var fnToString = hasOwn.toString;
70
71var ObjectFunctionString = fnToString.call( Object );
72
73var support = {};
74
75
76
77 function DOMEval( code, doc ) {
78 doc = doc || document;
79
80 var script = doc.createElement( "script" );
81
82 script.text = code;
83 doc.head.appendChild( script ).parentNode.removeChild( script );
84 }
85/* global Symbol */
86// Defining this global in .eslintrc.json would create a danger of using the global
87// unguarded in another place, it seems safer to define global only for this module
88
89
90
91var
92 version = "3.2.1",
93
94 // Define a local copy of jQuery
95 jQuery = function( selector, context ) {
96
97 // The jQuery object is actually just the init constructor 'enhanced'
98 // Need init if jQuery is called (just allow error to be thrown if not included)
99 return new jQuery.fn.init( selector, context );
100 },
101
102 // Support: Android <=4.0 only
103 // Make sure we trim BOM and NBSP
104 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
105
106 // Matches dashed string for camelizing
107 rmsPrefix = /^-ms-/,
108 rdashAlpha = /-([a-z])/g,
109
110 // Used by jQuery.camelCase as callback to replace()
111 fcamelCase = function( all, letter ) {
112 return letter.toUpperCase();
113 };
114
115jQuery.fn = jQuery.prototype = {
116
117 // The current version of jQuery being used
118 jquery: version,
119
120 constructor: jQuery,
121
122 // The default length of a jQuery object is 0
123 length: 0,
124
125 toArray: function() {
126 return slice.call( this );
127 },
128
129 // Get the Nth element in the matched element set OR
130 // Get the whole matched element set as a clean array
131 get: function( num ) {
132
133 // Return all the elements in a clean array
134 if ( num == null ) {
135 return slice.call( this );
136 }
137
138 // Return just the one element from the set
139 return num < 0 ? this[ num + this.length ] : this[ num ];
140 },
141
142 // Take an array of elements and push it onto the stack
143 // (returning the new matched element set)
144 pushStack: function( elems ) {
145
146 // Build a new jQuery matched element set
147 var ret = jQuery.merge( this.constructor(), elems );
148
149 // Add the old object onto the stack (as a reference)
150 ret.prevObject = this;
151
152 // Return the newly-formed element set
153 return ret;
154 },
155
156 // Execute a callback for every element in the matched set.
157 each: function( callback ) {
158 return jQuery.each( this, callback );
159 },
160
161 map: function( callback ) {
162 return this.pushStack( jQuery.map( this, function( elem, i ) {
163 return callback.call( elem, i, elem );
164 } ) );
165 },
166
167 slice: function() {
168 return this.pushStack( slice.apply( this, arguments ) );
169 },
170
171 first: function() {
172 return this.eq( 0 );
173 },
174
175 last: function() {
176 return this.eq( -1 );
177 },
178
179 eq: function( i ) {
180 var len = this.length,
181 j = +i + ( i < 0 ? len : 0 );
182 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
183 },
184
185 end: function() {
186 return this.prevObject || this.constructor();
187 },
188
189 // For internal use only.
190 // Behaves like an Array's method, not like a jQuery method.
191 push: push,
192 sort: arr.sort,
193 splice: arr.splice
194};
195
196jQuery.extend = jQuery.fn.extend = function() {
197 var options, name, src, copy, copyIsArray, clone,
198 target = arguments[ 0 ] || {},
199 i = 1,
200 length = arguments.length,
201 deep = false;
202
203 // Handle a deep copy situation
204 if ( typeof target === "boolean" ) {
205 deep = target;
206
207 // Skip the boolean and the target
208 target = arguments[ i ] || {};
209 i++;
210 }
211
212 // Handle case when target is a string or something (possible in deep copy)
213 if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
214 target = {};
215 }
216
217 // Extend jQuery itself if only one argument is passed
218 if ( i === length ) {
219 target = this;
220 i--;
221 }
222
223 for ( ; i < length; i++ ) {
224
225 // Only deal with non-null/undefined values
226 if ( ( options = arguments[ i ] ) != null ) {
227
228 // Extend the base object
229 for ( name in options ) {
230 src = target[ name ];
231 copy = options[ name ];
232
233 // Prevent never-ending loop
234 if ( target === copy ) {
235 continue;
236 }
237
238 // Recurse if we're merging plain objects or arrays
239 if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
240 ( copyIsArray = Array.isArray( copy ) ) ) ) {
241
242 if ( copyIsArray ) {
243 copyIsArray = false;
244 clone = src && Array.isArray( src ) ? src : [];
245
246 } else {
247 clone = src && jQuery.isPlainObject( src ) ? src : {};
248 }
249
250 // Never move original objects, clone them
251 target[ name ] = jQuery.extend( deep, clone, copy );
252
253 // Don't bring in undefined values
254 } else if ( copy !== undefined ) {
255 target[ name ] = copy;
256 }
257 }
258 }
259 }
260
261 // Return the modified object
262 return target;
263};
264
265jQuery.extend( {
266
267 // Unique for each copy of jQuery on the page
268 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
269
270 // Assume jQuery is ready without the ready module
271 isReady: true,
272
273 error: function( msg ) {
274 throw new Error( msg );
275 },
276
277 noop: function() {},
278
279 isFunction: function( obj ) {
280 return jQuery.type( obj ) === "function";
281 },
282
283 isWindow: function( obj ) {
284 return obj != null && obj === obj.window;
285 },
286
287 isNumeric: function( obj ) {
288
289 // As of jQuery 3.0, isNumeric is limited to
290 // strings and numbers (primitives or objects)
291 // that can be coerced to finite numbers (gh-2662)
292 var type = jQuery.type( obj );
293 return ( type === "number" || type === "string" ) &&
294
295 // parseFloat NaNs numeric-cast false positives ("")
296 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
297 // subtraction forces infinities to NaN
298 !isNaN( obj - parseFloat( obj ) );
299 },
300
301 isPlainObject: function( obj ) {
302 var proto, Ctor;
303
304 // Detect obvious negatives
305 // Use toString instead of jQuery.type to catch host objects
306 if ( !obj || toString.call( obj ) !== "[object Object]" ) {
307 return false;
308 }
309
310 proto = getProto( obj );
311
312 // Objects with no prototype (e.g., `Object.create( null )`) are plain
313 if ( !proto ) {
314 return true;
315 }
316
317 // Objects with prototype are plain iff they were constructed by a global Object function
318 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
319 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
320 },
321
322 isEmptyObject: function( obj ) {
323
324 /* eslint-disable no-unused-vars */
325 // See https://github.com/eslint/eslint/issues/6125
326 var name;
327
328 for ( name in obj ) {
329 return false;
330 }
331 return true;
332 },
333
334 type: function( obj ) {
335 if ( obj == null ) {
336 return obj + "";
337 }
338
339 // Support: Android <=2.3 only (functionish RegExp)
340 return typeof obj === "object" || typeof obj === "function" ?
341 class2type[ toString.call( obj ) ] || "object" :
342 typeof obj;
343 },
344
345 // Evaluates a script in a global context
346 globalEval: function( code ) {
347 DOMEval( code );
348 },
349
350 // Convert dashed to camelCase; used by the css and data modules
351 // Support: IE <=9 - 11, Edge 12 - 13
352 // Microsoft forgot to hump their vendor prefix (#9572)
353 camelCase: function( string ) {
354 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
355 },
356
357 each: function( obj, callback ) {
358 var length, i = 0;
359
360 if ( isArrayLike( obj ) ) {
361 length = obj.length;
362 for ( ; i < length; i++ ) {
363 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
364 break;
365 }
366 }
367 } else {
368 for ( i in obj ) {
369 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
370 break;
371 }
372 }
373 }
374
375 return obj;
376 },
377
378 // Support: Android <=4.0 only
379 trim: function( text ) {
380 return text == null ?
381 "" :
382 ( text + "" ).replace( rtrim, "" );
383 },
384
385 // results is for internal usage only
386 makeArray: function( arr, results ) {
387 var ret = results || [];
388
389 if ( arr != null ) {
390 if ( isArrayLike( Object( arr ) ) ) {
391 jQuery.merge( ret,
392 typeof arr === "string" ?
393 [ arr ] : arr
394 );
395 } else {
396 push.call( ret, arr );
397 }
398 }
399
400 return ret;
401 },
402
403 inArray: function( elem, arr, i ) {
404 return arr == null ? -1 : indexOf.call( arr, elem, i );
405 },
406
407 // Support: Android <=4.0 only, PhantomJS 1 only
408 // push.apply(_, arraylike) throws on ancient WebKit
409 merge: function( first, second ) {
410 var len = +second.length,
411 j = 0,
412 i = first.length;
413
414 for ( ; j < len; j++ ) {
415 first[ i++ ] = second[ j ];
416 }
417
418 first.length = i;
419
420 return first;
421 },
422
423 grep: function( elems, callback, invert ) {
424 var callbackInverse,
425 matches = [],
426 i = 0,
427 length = elems.length,
428 callbackExpect = !invert;
429
430 // Go through the array, only saving the items
431 // that pass the validator function
432 for ( ; i < length; i++ ) {
433 callbackInverse = !callback( elems[ i ], i );
434 if ( callbackInverse !== callbackExpect ) {
435 matches.push( elems[ i ] );
436 }
437 }
438
439 return matches;
440 },
441
442 // arg is for internal usage only
443 map: function( elems, callback, arg ) {
444 var length, value,
445 i = 0,
446 ret = [];
447
448 // Go through the array, translating each of the items to their new values
449 if ( isArrayLike( elems ) ) {
450 length = elems.length;
451 for ( ; i < length; i++ ) {
452 value = callback( elems[ i ], i, arg );
453
454 if ( value != null ) {
455 ret.push( value );
456 }
457 }
458
459 // Go through every key on the object,
460 } else {
461 for ( i in elems ) {
462 value = callback( elems[ i ], i, arg );
463
464 if ( value != null ) {
465 ret.push( value );
466 }
467 }
468 }
469
470 // Flatten any nested arrays
471 return concat.apply( [], ret );
472 },
473
474 // A global GUID counter for objects
475 guid: 1,
476
477 // Bind a function to a context, optionally partially applying any
478 // arguments.
479 proxy: function( fn, context ) {
480 var tmp, args, proxy;
481
482 if ( typeof context === "string" ) {
483 tmp = fn[ context ];
484 context = fn;
485 fn = tmp;
486 }
487
488 // Quick check to determine if target is callable, in the spec
489 // this throws a TypeError, but we will just return undefined.
490 if ( !jQuery.isFunction( fn ) ) {
491 return undefined;
492 }
493
494 // Simulated bind
495 args = slice.call( arguments, 2 );
496 proxy = function() {
497 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
498 };
499
500 // Set the guid of unique handler to the same of original handler, so it can be removed
501 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
502
503 return proxy;
504 },
505
506 now: Date.now,
507
508 // jQuery.support is not used in Core but other projects attach their
509 // properties to it so it needs to exist.
510 support: support
511} );
512
513if ( typeof Symbol === "function" ) {
514 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
515}
516
517// Populate the class2type map
518jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
519function( i, name ) {
520 class2type[ "[object " + name + "]" ] = name.toLowerCase();
521} );
522
523function isArrayLike( obj ) {
524
525 // Support: real iOS 8.2 only (not reproducible in simulator)
526 // `in` check used to prevent JIT error (gh-2145)
527 // hasOwn isn't used here due to false negatives
528 // regarding Nodelist length in IE
529 var length = !!obj && "length" in obj && obj.length,
530 type = jQuery.type( obj );
531
532 if ( type === "function" || jQuery.isWindow( obj ) ) {
533 return false;
534 }
535
536 return type === "array" || length === 0 ||
537 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
538}
539var Sizzle =
540/*!
541 * Sizzle CSS Selector Engine v2.3.3
542 * https://sizzlejs.com/
543 *
544 * Copyright jQuery Foundation and other contributors
545 * Released under the MIT license
546 * http://jquery.org/license
547 *
548 * Date: 2016-08-08
549 */
550(function( window ) {
551
552var i,
553 support,
554 Expr,
555 getText,
556 isXML,
557 tokenize,
558 compile,
559 select,
560 outermostContext,
561 sortInput,
562 hasDuplicate,
563
564 // Local document vars
565 setDocument,
566 document,
567 docElem,
568 documentIsHTML,
569 rbuggyQSA,
570 rbuggyMatches,
571 matches,
572 contains,
573
574 // Instance-specific data
575 expando = "sizzle" + 1 * new Date(),
576 preferredDoc = window.document,
577 dirruns = 0,
578 done = 0,
579 classCache = createCache(),
580 tokenCache = createCache(),
581 compilerCache = createCache(),
582 sortOrder = function( a, b ) {
583 if ( a === b ) {
584 hasDuplicate = true;
585 }
586 return 0;
587 },
588
589 // Instance methods
590 hasOwn = ({}).hasOwnProperty,
591 arr = [],
592 pop = arr.pop,
593 push_native = arr.push,
594 push = arr.push,
595 slice = arr.slice,
596 // Use a stripped-down indexOf as it's faster than native
597 // https://jsperf.com/thor-indexof-vs-for/5
598 indexOf = function( list, elem ) {
599 var i = 0,
600 len = list.length;
601 for ( ; i < len; i++ ) {
602 if ( list[i] === elem ) {
603 return i;
604 }
605 }
606 return -1;
607 },
608
609 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
610
611 // Regular expressions
612
613 // http://www.w3.org/TR/css3-selectors/#whitespace
614 whitespace = "[\\x20\\t\\r\\n\\f]",
615
616 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
617 identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
618
619 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
620 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
621 // Operator (capture 2)
622 "*([*^$|!~]?=)" + whitespace +
623 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
624 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
625 "*\\]",
626
627 pseudos = ":(" + identifier + ")(?:\\((" +
628 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
629 // 1. quoted (capture 3; capture 4 or capture 5)
630 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
631 // 2. simple (capture 6)
632 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
633 // 3. anything else (capture 2)
634 ".*" +
635 ")\\)|)",
636
637 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
638 rwhitespace = new RegExp( whitespace + "+", "g" ),
639 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
640
641 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
642 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
643
644 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
645
646 rpseudo = new RegExp( pseudos ),
647 ridentifier = new RegExp( "^" + identifier + "$" ),
648
649 matchExpr = {
650 "ID": new RegExp( "^#(" + identifier + ")" ),
651 "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
652 "TAG": new RegExp( "^(" + identifier + "|[*])" ),
653 "ATTR": new RegExp( "^" + attributes ),
654 "PSEUDO": new RegExp( "^" + pseudos ),
655 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
656 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
657 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
658 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
659 // For use in libraries implementing .is()
660 // We use this for POS matching in `select`
661 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
662 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
663 },
664
665 rinputs = /^(?:input|select|textarea|button)$/i,
666 rheader = /^h\d$/i,
667
668 rnative = /^[^{]+\{\s*\[native \w/,
669
670 // Easily-parseable/retrievable ID or TAG or CLASS selectors
671 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
672
673 rsibling = /[+~]/,
674
675 // CSS escapes
676 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
677 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
678 funescape = function( _, escaped, escapedWhitespace ) {
679 var high = "0x" + escaped - 0x10000;
680 // NaN means non-codepoint
681 // Support: Firefox<24
682 // Workaround erroneous numeric interpretation of +"0x"
683 return high !== high || escapedWhitespace ?
684 escaped :
685 high < 0 ?
686 // BMP codepoint
687 String.fromCharCode( high + 0x10000 ) :
688 // Supplemental Plane codepoint (surrogate pair)
689 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
690 },
691
692 // CSS string/identifier serialization
693 // https://drafts.csswg.org/cssom/#common-serializing-idioms
694 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
695 fcssescape = function( ch, asCodePoint ) {
696 if ( asCodePoint ) {
697
698 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
699 if ( ch === "\0" ) {
700 return "\uFFFD";
701 }
702
703 // Control characters and (dependent upon position) numbers get escaped as code points
704 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
705 }
706
707 // Other potentially-special ASCII characters get backslash-escaped
708 return "\\" + ch;
709 },
710
711 // Used for iframes
712 // See setDocument()
713 // Removing the function wrapper causes a "Permission Denied"
714 // error in IE
715 unloadHandler = function() {
716 setDocument();
717 },
718
719 disabledAncestor = addCombinator(
720 function( elem ) {
721 return elem.disabled === true && ("form" in elem || "label" in elem);
722 },
723 { dir: "parentNode", next: "legend" }
724 );
725
726// Optimize for push.apply( _, NodeList )
727try {
728 push.apply(
729 (arr = slice.call( preferredDoc.childNodes )),
730 preferredDoc.childNodes
731 );
732 // Support: Android<4.0
733 // Detect silently failing push.apply
734 arr[ preferredDoc.childNodes.length ].nodeType;
735} catch ( e ) {
736 push = { apply: arr.length ?
737
738 // Leverage slice if possible
739 function( target, els ) {
740 push_native.apply( target, slice.call(els) );
741 } :
742
743 // Support: IE<9
744 // Otherwise append directly
745 function( target, els ) {
746 var j = target.length,
747 i = 0;
748 // Can't trust NodeList.length
749 while ( (target[j++] = els[i++]) ) {}
750 target.length = j - 1;
751 }
752 };
753}
754
755function Sizzle( selector, context, results, seed ) {
756 var m, i, elem, nid, match, groups, newSelector,
757 newContext = context && context.ownerDocument,
758
759 // nodeType defaults to 9, since context defaults to document
760 nodeType = context ? context.nodeType : 9;
761
762 results = results || [];
763
764 // Return early from calls with invalid selector or context
765 if ( typeof selector !== "string" || !selector ||
766 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
767
768 return results;
769 }
770
771 // Try to shortcut find operations (as opposed to filters) in HTML documents
772 if ( !seed ) {
773
774 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
775 setDocument( context );
776 }
777 context = context || document;
778
779 if ( documentIsHTML ) {
780
781 // If the selector is sufficiently simple, try using a "get*By*" DOM method
782 // (excepting DocumentFragment context, where the methods don't exist)
783 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
784
785 // ID selector
786 if ( (m = match[1]) ) {
787
788 // Document context
789 if ( nodeType === 9 ) {
790 if ( (elem = context.getElementById( m )) ) {
791
792 // Support: IE, Opera, Webkit
793 // TODO: identify versions
794 // getElementById can match elements by name instead of ID
795 if ( elem.id === m ) {
796 results.push( elem );
797 return results;
798 }
799 } else {
800 return results;
801 }
802
803 // Element context
804 } else {
805
806 // Support: IE, Opera, Webkit
807 // TODO: identify versions
808 // getElementById can match elements by name instead of ID
809 if ( newContext && (elem = newContext.getElementById( m )) &&
810 contains( context, elem ) &&
811 elem.id === m ) {
812
813 results.push( elem );
814 return results;
815 }
816 }
817
818 // Type selector
819 } else if ( match[2] ) {
820 push.apply( results, context.getElementsByTagName( selector ) );
821 return results;
822
823 // Class selector
824 } else if ( (m = match[3]) && support.getElementsByClassName &&
825 context.getElementsByClassName ) {
826
827 push.apply( results, context.getElementsByClassName( m ) );
828 return results;
829 }
830 }
831
832 // Take advantage of querySelectorAll
833 if ( support.qsa &&
834 !compilerCache[ selector + " " ] &&
835 (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
836
837 if ( nodeType !== 1 ) {
838 newContext = context;
839 newSelector = selector;
840
841 // qSA looks outside Element context, which is not what we want
842 // Thanks to Andrew Dupont for this workaround technique
843 // Support: IE <=8
844 // Exclude object elements
845 } else if ( context.nodeName.toLowerCase() !== "object" ) {
846
847 // Capture the context ID, setting it first if necessary
848 if ( (nid = context.getAttribute( "id" )) ) {
849 nid = nid.replace( rcssescape, fcssescape );
850 } else {
851 context.setAttribute( "id", (nid = expando) );
852 }
853
854 // Prefix every selector in the list
855 groups = tokenize( selector );
856 i = groups.length;
857 while ( i-- ) {
858 groups[i] = "#" + nid + " " + toSelector( groups[i] );
859 }
860 newSelector = groups.join( "," );
861
862 // Expand context for sibling selectors
863 newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
864 context;
865 }
866
867 if ( newSelector ) {
868 try {
869 push.apply( results,
870 newContext.querySelectorAll( newSelector )
871 );
872 return results;
873 } catch ( qsaError ) {
874 } finally {
875 if ( nid === expando ) {
876 context.removeAttribute( "id" );
877 }
878 }
879 }
880 }
881 }
882 }
883
884 // All others
885 return select( selector.replace( rtrim, "$1" ), context, results, seed );
886}
887
888/**
889 * Create key-value caches of limited size
890 * @returns {function(string, object)} Returns the Object data after storing it on itself with
891 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
892 * deleting the oldest entry
893 */
894function createCache() {
895 var keys = [];
896
897 function cache( key, value ) {
898 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
899 if ( keys.push( key + " " ) > Expr.cacheLength ) {
900 // Only keep the most recent entries
901 delete cache[ keys.shift() ];
902 }
903 return (cache[ key + " " ] = value);
904 }
905 return cache;
906}
907
908/**
909 * Mark a function for special use by Sizzle
910 * @param {Function} fn The function to mark
911 */
912function markFunction( fn ) {
913 fn[ expando ] = true;
914 return fn;
915}
916
917/**
918 * Support testing using an element
919 * @param {Function} fn Passed the created element and returns a boolean result
920 */
921function assert( fn ) {
922 var el = document.createElement("fieldset");
923
924 try {
925 return !!fn( el );
926 } catch (e) {
927 return false;
928 } finally {
929 // Remove from its parent by default
930 if ( el.parentNode ) {
931 el.parentNode.removeChild( el );
932 }
933 // release memory in IE
934 el = null;
935 }
936}
937
938/**
939 * Adds the same handler for all of the specified attrs
940 * @param {String} attrs Pipe-separated list of attributes
941 * @param {Function} handler The method that will be applied
942 */
943function addHandle( attrs, handler ) {
944 var arr = attrs.split("|"),
945 i = arr.length;
946
947 while ( i-- ) {
948 Expr.attrHandle[ arr[i] ] = handler;
949 }
950}
951
952/**
953 * Checks document order of two siblings
954 * @param {Element} a
955 * @param {Element} b
956 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
957 */
958function siblingCheck( a, b ) {
959 var cur = b && a,
960 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
961 a.sourceIndex - b.sourceIndex;
962
963 // Use IE sourceIndex if available on both nodes
964 if ( diff ) {
965 return diff;
966 }
967
968 // Check if b follows a
969 if ( cur ) {
970 while ( (cur = cur.nextSibling) ) {
971 if ( cur === b ) {
972 return -1;
973 }
974 }
975 }
976
977 return a ? 1 : -1;
978}
979
980/**
981 * Returns a function to use in pseudos for input types
982 * @param {String} type
983 */
984function createInputPseudo( type ) {
985 return function( elem ) {
986 var name = elem.nodeName.toLowerCase();
987 return name === "input" && elem.type === type;
988 };
989}
990
991/**
992 * Returns a function to use in pseudos for buttons
993 * @param {String} type
994 */
995function createButtonPseudo( type ) {
996 return function( elem ) {
997 var name = elem.nodeName.toLowerCase();
998 return (name === "input" || name === "button") && elem.type === type;
999 };
1000}
1001
1002/**
1003 * Returns a function to use in pseudos for :enabled/:disabled
1004 * @param {Boolean} disabled true for :disabled; false for :enabled
1005 */
1006function createDisabledPseudo( disabled ) {
1007
1008 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
1009 return function( elem ) {
1010
1011 // Only certain elements can match :enabled or :disabled
1012 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
1013 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
1014 if ( "form" in elem ) {
1015
1016 // Check for inherited disabledness on relevant non-disabled elements:
1017 // * listed form-associated elements in a disabled fieldset
1018 // https://html.spec.whatwg.org/multipage/forms.html#category-listed
1019 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
1020 // * option elements in a disabled optgroup
1021 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
1022 // All such elements have a "form" property.
1023 if ( elem.parentNode && elem.disabled === false ) {
1024
1025 // Option elements defer to a parent optgroup if present
1026 if ( "label" in elem ) {
1027 if ( "label" in elem.parentNode ) {
1028 return elem.parentNode.disabled === disabled;
1029 } else {
1030 return elem.disabled === disabled;
1031 }
1032 }
1033
1034 // Support: IE 6 - 11
1035 // Use the isDisabled shortcut property to check for disabled fieldset ancestors
1036 return elem.isDisabled === disabled ||
1037
1038 // Where there is no isDisabled, check manually
1039 /* jshint -W018 */
1040 elem.isDisabled !== !disabled &&
1041 disabledAncestor( elem ) === disabled;
1042 }
1043
1044 return elem.disabled === disabled;
1045
1046 // Try to winnow out elements that can't be disabled before trusting the disabled property.
1047 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
1048 // even exist on them, let alone have a boolean value.
1049 } else if ( "label" in elem ) {
1050 return elem.disabled === disabled;
1051 }
1052
1053 // Remaining elements are neither :enabled nor :disabled
1054 return false;
1055 };
1056}
1057
1058/**
1059 * Returns a function to use in pseudos for positionals
1060 * @param {Function} fn
1061 */
1062function createPositionalPseudo( fn ) {
1063 return markFunction(function( argument ) {
1064 argument = +argument;
1065 return markFunction(function( seed, matches ) {
1066 var j,
1067 matchIndexes = fn( [], seed.length, argument ),
1068 i = matchIndexes.length;
1069
1070 // Match elements found at the specified indexes
1071 while ( i-- ) {
1072 if ( seed[ (j = matchIndexes[i]) ] ) {
1073 seed[j] = !(matches[j] = seed[j]);
1074 }
1075 }
1076 });
1077 });
1078}
1079
1080/**
1081 * Checks a node for validity as a Sizzle context
1082 * @param {Element|Object=} context
1083 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1084 */
1085function testContext( context ) {
1086 return context && typeof context.getElementsByTagName !== "undefined" && context;
1087}
1088
1089// Expose support vars for convenience
1090support = Sizzle.support = {};
1091
1092/**
1093 * Detects XML nodes
1094 * @param {Element|Object} elem An element or a document
1095 * @returns {Boolean} True iff elem is a non-HTML XML node
1096 */
1097isXML = Sizzle.isXML = function( elem ) {
1098 // documentElement is verified for cases where it doesn't yet exist
1099 // (such as loading iframes in IE - #4833)
1100 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
1101 return documentElement ? documentElement.nodeName !== "HTML" : false;
1102};
1103
1104/**
1105 * Sets document-related variables once based on the current document
1106 * @param {Element|Object} [doc] An element or document object to use to set the document
1107 * @returns {Object} Returns the current document
1108 */
1109setDocument = Sizzle.setDocument = function( node ) {
1110 var hasCompare, subWindow,
1111 doc = node ? node.ownerDocument || node : preferredDoc;
1112
1113 // Return early if doc is invalid or already selected
1114 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
1115 return document;
1116 }
1117
1118 // Update global variables
1119 document = doc;
1120 docElem = document.documentElement;
1121 documentIsHTML = !isXML( document );
1122
1123 // Support: IE 9-11, Edge
1124 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
1125 if ( preferredDoc !== document &&
1126 (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
1127
1128 // Support: IE 11, Edge
1129 if ( subWindow.addEventListener ) {
1130 subWindow.addEventListener( "unload", unloadHandler, false );
1131
1132 // Support: IE 9 - 10 only
1133 } else if ( subWindow.attachEvent ) {
1134 subWindow.attachEvent( "onunload", unloadHandler );
1135 }
1136 }
1137
1138 /* Attributes
1139 ---------------------------------------------------------------------- */
1140
1141 // Support: IE<8
1142 // Verify that getAttribute really returns attributes and not properties
1143 // (excepting IE8 booleans)
1144 support.attributes = assert(function( el ) {
1145 el.className = "i";
1146 return !el.getAttribute("className");
1147 });
1148
1149 /* getElement(s)By*
1150 ---------------------------------------------------------------------- */
1151
1152 // Check if getElementsByTagName("*") returns only elements
1153 support.getElementsByTagName = assert(function( el ) {
1154 el.appendChild( document.createComment("") );
1155 return !el.getElementsByTagName("*").length;
1156 });
1157
1158 // Support: IE<9
1159 support.getElementsByClassName = rnative.test( document.getElementsByClassName );
1160
1161 // Support: IE<10
1162 // Check if getElementById returns elements by name
1163 // The broken getElementById methods don't pick up programmatically-set names,
1164 // so use a roundabout getElementsByName test
1165 support.getById = assert(function( el ) {
1166 docElem.appendChild( el ).id = expando;
1167 return !document.getElementsByName || !document.getElementsByName( expando ).length;
1168 });
1169
1170 // ID filter and find
1171 if ( support.getById ) {
1172 Expr.filter["ID"] = function( id ) {
1173 var attrId = id.replace( runescape, funescape );
1174 return function( elem ) {
1175 return elem.getAttribute("id") === attrId;
1176 };
1177 };
1178 Expr.find["ID"] = function( id, context ) {
1179 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1180 var elem = context.getElementById( id );
1181 return elem ? [ elem ] : [];
1182 }
1183 };
1184 } else {
1185 Expr.filter["ID"] = function( id ) {
1186 var attrId = id.replace( runescape, funescape );
1187 return function( elem ) {
1188 var node = typeof elem.getAttributeNode !== "undefined" &&
1189 elem.getAttributeNode("id");
1190 return node && node.value === attrId;
1191 };
1192 };
1193
1194 // Support: IE 6 - 7 only
1195 // getElementById is not reliable as a find shortcut
1196 Expr.find["ID"] = function( id, context ) {
1197 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1198 var node, i, elems,
1199 elem = context.getElementById( id );
1200
1201 if ( elem ) {
1202
1203 // Verify the id attribute
1204 node = elem.getAttributeNode("id");
1205 if ( node && node.value === id ) {
1206 return [ elem ];
1207 }
1208
1209 // Fall back on getElementsByName
1210 elems = context.getElementsByName( id );
1211 i = 0;
1212 while ( (elem = elems[i++]) ) {
1213 node = elem.getAttributeNode("id");
1214 if ( node && node.value === id ) {
1215 return [ elem ];
1216 }
1217 }
1218 }
1219
1220 return [];
1221 }
1222 };
1223 }
1224
1225 // Tag
1226 Expr.find["TAG"] = support.getElementsByTagName ?
1227 function( tag, context ) {
1228 if ( typeof context.getElementsByTagName !== "undefined" ) {
1229 return context.getElementsByTagName( tag );
1230
1231 // DocumentFragment nodes don't have gEBTN
1232 } else if ( support.qsa ) {
1233 return context.querySelectorAll( tag );
1234 }
1235 } :
1236
1237 function( tag, context ) {
1238 var elem,
1239 tmp = [],
1240 i = 0,
1241 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1242 results = context.getElementsByTagName( tag );
1243
1244 // Filter out possible comments
1245 if ( tag === "*" ) {
1246 while ( (elem = results[i++]) ) {
1247 if ( elem.nodeType === 1 ) {
1248 tmp.push( elem );
1249 }
1250 }
1251
1252 return tmp;
1253 }
1254 return results;
1255 };
1256
1257 // Class
1258 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1259 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1260 return context.getElementsByClassName( className );
1261 }
1262 };
1263
1264 /* QSA/matchesSelector
1265 ---------------------------------------------------------------------- */
1266
1267 // QSA and matchesSelector support
1268
1269 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1270 rbuggyMatches = [];
1271
1272 // qSa(:focus) reports false when true (Chrome 21)
1273 // We allow this because of a bug in IE8/9 that throws an error
1274 // whenever `document.activeElement` is accessed on an iframe
1275 // So, we allow :focus to pass through QSA all the time to avoid the IE error
1276 // See https://bugs.jquery.com/ticket/13378
1277 rbuggyQSA = [];
1278
1279 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
1280 // Build QSA regex
1281 // Regex strategy adopted from Diego Perini
1282 assert(function( el ) {
1283 // Select is set to empty string on purpose
1284 // This is to test IE's treatment of not explicitly
1285 // setting a boolean content attribute,
1286 // since its presence should be enough
1287 // https://bugs.jquery.com/ticket/12359
1288 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
1289 "<select id='" + expando + "-\r\\' msallowcapture=''>" +
1290 "<option selected=''></option></select>";
1291
1292 // Support: IE8, Opera 11-12.16
1293 // Nothing should be selected when empty strings follow ^= or $= or *=
1294 // The test attribute must be unknown in Opera but "safe" for WinRT
1295 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1296 if ( el.querySelectorAll("[msallowcapture^='']").length ) {
1297 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1298 }
1299
1300 // Support: IE8
1301 // Boolean attributes and "value" are not treated correctly
1302 if ( !el.querySelectorAll("[selected]").length ) {
1303 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1304 }
1305
1306 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
1307 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1308 rbuggyQSA.push("~=");
1309 }
1310
1311 // Webkit/Opera - :checked should return selected option elements
1312 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1313 // IE8 throws error here and will not see later tests
1314 if ( !el.querySelectorAll(":checked").length ) {
1315 rbuggyQSA.push(":checked");
1316 }
1317
1318 // Support: Safari 8+, iOS 8+
1319 // https://bugs.webkit.org/show_bug.cgi?id=136851
1320 // In-page `selector#id sibling-combinator selector` fails
1321 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1322 rbuggyQSA.push(".#.+[+~]");
1323 }
1324 });
1325
1326 assert(function( el ) {
1327 el.innerHTML = "<a href='' disabled='disabled'></a>" +
1328 "<select disabled='disabled'><option/></select>";
1329
1330 // Support: Windows 8 Native Apps
1331 // The type and name attributes are restricted during .innerHTML assignment
1332 var input = document.createElement("input");
1333 input.setAttribute( "type", "hidden" );
1334 el.appendChild( input ).setAttribute( "name", "D" );
1335
1336 // Support: IE8
1337 // Enforce case-sensitivity of name attribute
1338 if ( el.querySelectorAll("[name=d]").length ) {
1339 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1340 }
1341
1342 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1343 // IE8 throws error here and will not see later tests
1344 if ( el.querySelectorAll(":enabled").length !== 2 ) {
1345 rbuggyQSA.push( ":enabled", ":disabled" );
1346 }
1347
1348 // Support: IE9-11+
1349 // IE's :disabled selector does not pick up the children of disabled fieldsets
1350 docElem.appendChild( el ).disabled = true;
1351 if ( el.querySelectorAll(":disabled").length !== 2 ) {
1352 rbuggyQSA.push( ":enabled", ":disabled" );
1353 }
1354
1355 // Opera 10-11 does not throw on post-comma invalid pseudos
1356 el.querySelectorAll("*,:x");
1357 rbuggyQSA.push(",.*:");
1358 });
1359 }
1360
1361 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
1362 docElem.webkitMatchesSelector ||
1363 docElem.mozMatchesSelector ||
1364 docElem.oMatchesSelector ||
1365 docElem.msMatchesSelector) )) ) {
1366
1367 assert(function( el ) {
1368 // Check to see if it's possible to do matchesSelector
1369 // on a disconnected node (IE 9)
1370 support.disconnectedMatch = matches.call( el, "*" );
1371
1372 // This should fail with an exception
1373 // Gecko does not error, returns false instead
1374 matches.call( el, "[s!='']:x" );
1375 rbuggyMatches.push( "!=", pseudos );
1376 });
1377 }
1378
1379 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1380 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
1381
1382 /* Contains
1383 ---------------------------------------------------------------------- */
1384 hasCompare = rnative.test( docElem.compareDocumentPosition );
1385
1386 // Element contains another
1387 // Purposefully self-exclusive
1388 // As in, an element does not contain itself
1389 contains = hasCompare || rnative.test( docElem.contains ) ?
1390 function( a, b ) {
1391 var adown = a.nodeType === 9 ? a.documentElement : a,
1392 bup = b && b.parentNode;
1393 return a === bup || !!( bup && bup.nodeType === 1 && (
1394 adown.contains ?
1395 adown.contains( bup ) :
1396 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1397 ));
1398 } :
1399 function( a, b ) {
1400 if ( b ) {
1401 while ( (b = b.parentNode) ) {
1402 if ( b === a ) {
1403 return true;
1404 }
1405 }
1406 }
1407 return false;
1408 };
1409
1410 /* Sorting
1411 ---------------------------------------------------------------------- */
1412
1413 // Document order sorting
1414 sortOrder = hasCompare ?
1415 function( a, b ) {
1416
1417 // Flag for duplicate removal
1418 if ( a === b ) {
1419 hasDuplicate = true;
1420 return 0;
1421 }
1422
1423 // Sort on method existence if only one input has compareDocumentPosition
1424 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
1425 if ( compare ) {
1426 return compare;
1427 }
1428
1429 // Calculate position if both inputs belong to the same document
1430 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
1431 a.compareDocumentPosition( b ) :
1432
1433 // Otherwise we know they are disconnected
1434 1;
1435
1436 // Disconnected nodes
1437 if ( compare & 1 ||
1438 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
1439
1440 // Choose the first element that is related to our preferred document
1441 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
1442 return -1;
1443 }
1444 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
1445 return 1;
1446 }
1447
1448 // Maintain original order
1449 return sortInput ?
1450 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1451 0;
1452 }
1453
1454 return compare & 4 ? -1 : 1;
1455 } :
1456 function( a, b ) {
1457 // Exit early if the nodes are identical
1458 if ( a === b ) {
1459 hasDuplicate = true;
1460 return 0;
1461 }
1462
1463 var cur,
1464 i = 0,
1465 aup = a.parentNode,
1466 bup = b.parentNode,
1467 ap = [ a ],
1468 bp = [ b ];
1469
1470 // Parentless nodes are either documents or disconnected
1471 if ( !aup || !bup ) {
1472 return a === document ? -1 :
1473 b === document ? 1 :
1474 aup ? -1 :
1475 bup ? 1 :
1476 sortInput ?
1477 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1478 0;
1479
1480 // If the nodes are siblings, we can do a quick check
1481 } else if ( aup === bup ) {
1482 return siblingCheck( a, b );
1483 }
1484
1485 // Otherwise we need full lists of their ancestors for comparison
1486 cur = a;
1487 while ( (cur = cur.parentNode) ) {
1488 ap.unshift( cur );
1489 }
1490 cur = b;
1491 while ( (cur = cur.parentNode) ) {
1492 bp.unshift( cur );
1493 }
1494
1495 // Walk down the tree looking for a discrepancy
1496 while ( ap[i] === bp[i] ) {
1497 i++;
1498 }
1499
1500 return i ?
1501 // Do a sibling check if the nodes have a common ancestor
1502 siblingCheck( ap[i], bp[i] ) :
1503
1504 // Otherwise nodes in our document sort first
1505 ap[i] === preferredDoc ? -1 :
1506 bp[i] === preferredDoc ? 1 :
1507 0;
1508 };
1509
1510 return document;
1511};
1512
1513Sizzle.matches = function( expr, elements ) {
1514 return Sizzle( expr, null, null, elements );
1515};
1516
1517Sizzle.matchesSelector = function( elem, expr ) {
1518 // Set document vars if needed
1519 if ( ( elem.ownerDocument || elem ) !== document ) {
1520 setDocument( elem );
1521 }
1522
1523 // Make sure that attribute selectors are quoted
1524 expr = expr.replace( rattributeQuotes, "='$1']" );
1525
1526 if ( support.matchesSelector && documentIsHTML &&
1527 !compilerCache[ expr + " " ] &&
1528 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1529 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1530
1531 try {
1532 var ret = matches.call( elem, expr );
1533
1534 // IE 9's matchesSelector returns false on disconnected nodes
1535 if ( ret || support.disconnectedMatch ||
1536 // As well, disconnected nodes are said to be in a document
1537 // fragment in IE 9
1538 elem.document && elem.document.nodeType !== 11 ) {
1539 return ret;
1540 }
1541 } catch (e) {}
1542 }
1543
1544 return Sizzle( expr, document, null, [ elem ] ).length > 0;
1545};
1546
1547Sizzle.contains = function( context, elem ) {
1548 // Set document vars if needed
1549 if ( ( context.ownerDocument || context ) !== document ) {
1550 setDocument( context );
1551 }
1552 return contains( context, elem );
1553};
1554
1555Sizzle.attr = function( elem, name ) {
1556 // Set document vars if needed
1557 if ( ( elem.ownerDocument || elem ) !== document ) {
1558 setDocument( elem );
1559 }
1560
1561 var fn = Expr.attrHandle[ name.toLowerCase() ],
1562 // Don't get fooled by Object.prototype properties (jQuery #13807)
1563 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1564 fn( elem, name, !documentIsHTML ) :
1565 undefined;
1566
1567 return val !== undefined ?
1568 val :
1569 support.attributes || !documentIsHTML ?
1570 elem.getAttribute( name ) :
1571 (val = elem.getAttributeNode(name)) && val.specified ?
1572 val.value :
1573 null;
1574};
1575
1576Sizzle.escape = function( sel ) {
1577 return (sel + "").replace( rcssescape, fcssescape );
1578};
1579
1580Sizzle.error = function( msg ) {
1581 throw new Error( "Syntax error, unrecognized expression: " + msg );
1582};
1583
1584/**
1585 * Document sorting and removing duplicates
1586 * @param {ArrayLike} results
1587 */
1588Sizzle.uniqueSort = function( results ) {
1589 var elem,
1590 duplicates = [],
1591 j = 0,
1592 i = 0;
1593
1594 // Unless we *know* we can detect duplicates, assume their presence
1595 hasDuplicate = !support.detectDuplicates;
1596 sortInput = !support.sortStable && results.slice( 0 );
1597 results.sort( sortOrder );
1598
1599 if ( hasDuplicate ) {
1600 while ( (elem = results[i++]) ) {
1601 if ( elem === results[ i ] ) {
1602 j = duplicates.push( i );
1603 }
1604 }
1605 while ( j-- ) {
1606 results.splice( duplicates[ j ], 1 );
1607 }
1608 }
1609
1610 // Clear input after sorting to release objects
1611 // See https://github.com/jquery/sizzle/pull/225
1612 sortInput = null;
1613
1614 return results;
1615};
1616
1617/**
1618 * Utility function for retrieving the text value of an array of DOM nodes
1619 * @param {Array|Element} elem
1620 */
1621getText = Sizzle.getText = function( elem ) {
1622 var node,
1623 ret = "",
1624 i = 0,
1625 nodeType = elem.nodeType;
1626
1627 if ( !nodeType ) {
1628 // If no nodeType, this is expected to be an array
1629 while ( (node = elem[i++]) ) {
1630 // Do not traverse comment nodes
1631 ret += getText( node );
1632 }
1633 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1634 // Use textContent for elements
1635 // innerText usage removed for consistency of new lines (jQuery #11153)
1636 if ( typeof elem.textContent === "string" ) {
1637 return elem.textContent;
1638 } else {
1639 // Traverse its children
1640 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1641 ret += getText( elem );
1642 }
1643 }
1644 } else if ( nodeType === 3 || nodeType === 4 ) {
1645 return elem.nodeValue;
1646 }
1647 // Do not include comment or processing instruction nodes
1648
1649 return ret;
1650};
1651
1652Expr = Sizzle.selectors = {
1653
1654 // Can be adjusted by the user
1655 cacheLength: 50,
1656
1657 createPseudo: markFunction,
1658
1659 match: matchExpr,
1660
1661 attrHandle: {},
1662
1663 find: {},
1664
1665 relative: {
1666 ">": { dir: "parentNode", first: true },
1667 " ": { dir: "parentNode" },
1668 "+": { dir: "previousSibling", first: true },
1669 "~": { dir: "previousSibling" }
1670 },
1671
1672 preFilter: {
1673 "ATTR": function( match ) {
1674 match[1] = match[1].replace( runescape, funescape );
1675
1676 // Move the given value to match[3] whether quoted or unquoted
1677 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
1678
1679 if ( match[2] === "~=" ) {
1680 match[3] = " " + match[3] + " ";
1681 }
1682
1683 return match.slice( 0, 4 );
1684 },
1685
1686 "CHILD": function( match ) {
1687 /* matches from matchExpr["CHILD"]
1688 1 type (only|nth|...)
1689 2 what (child|of-type)
1690 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1691 4 xn-component of xn+y argument ([+-]?\d*n|)
1692 5 sign of xn-component
1693 6 x of xn-component
1694 7 sign of y-component
1695 8 y of y-component
1696 */
1697 match[1] = match[1].toLowerCase();
1698
1699 if ( match[1].slice( 0, 3 ) === "nth" ) {
1700 // nth-* requires argument
1701 if ( !match[3] ) {
1702 Sizzle.error( match[0] );
1703 }
1704
1705 // numeric x and y parameters for Expr.filter.CHILD
1706 // remember that false/true cast respectively to 0/1
1707 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
1708 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
1709
1710 // other types prohibit arguments
1711 } else if ( match[3] ) {
1712 Sizzle.error( match[0] );
1713 }
1714
1715 return match;
1716 },
1717
1718 "PSEUDO": function( match ) {
1719 var excess,
1720 unquoted = !match[6] && match[2];
1721
1722 if ( matchExpr["CHILD"].test( match[0] ) ) {
1723 return null;
1724 }
1725
1726 // Accept quoted arguments as-is
1727 if ( match[3] ) {
1728 match[2] = match[4] || match[5] || "";
1729
1730 // Strip excess characters from unquoted arguments
1731 } else if ( unquoted && rpseudo.test( unquoted ) &&
1732 // Get excess from tokenize (recursively)
1733 (excess = tokenize( unquoted, true )) &&
1734 // advance to the next closing parenthesis
1735 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
1736
1737 // excess is a negative index
1738 match[0] = match[0].slice( 0, excess );
1739 match[2] = unquoted.slice( 0, excess );
1740 }
1741
1742 // Return only captures needed by the pseudo filter method (type and argument)
1743 return match.slice( 0, 3 );
1744 }
1745 },
1746
1747 filter: {
1748
1749 "TAG": function( nodeNameSelector ) {
1750 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1751 return nodeNameSelector === "*" ?
1752 function() { return true; } :
1753 function( elem ) {
1754 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1755 };
1756 },
1757
1758 "CLASS": function( className ) {
1759 var pattern = classCache[ className + " " ];
1760
1761 return pattern ||
1762 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
1763 classCache( className, function( elem ) {
1764 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
1765 });
1766 },
1767
1768 "ATTR": function( name, operator, check ) {
1769 return function( elem ) {
1770 var result = Sizzle.attr( elem, name );
1771
1772 if ( result == null ) {
1773 return operator === "!=";
1774 }
1775 if ( !operator ) {
1776 return true;
1777 }
1778
1779 result += "";
1780
1781 return operator === "=" ? result === check :
1782 operator === "!=" ? result !== check :
1783 operator === "^=" ? check && result.indexOf( check ) === 0 :
1784 operator === "*=" ? check && result.indexOf( check ) > -1 :
1785 operator === "$=" ? check && result.slice( -check.length ) === check :
1786 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1787 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1788 false;
1789 };
1790 },
1791
1792 "CHILD": function( type, what, argument, first, last ) {
1793 var simple = type.slice( 0, 3 ) !== "nth",
1794 forward = type.slice( -4 ) !== "last",
1795 ofType = what === "of-type";
1796
1797 return first === 1 && last === 0 ?
1798
1799 // Shortcut for :nth-*(n)
1800 function( elem ) {
1801 return !!elem.parentNode;
1802 } :
1803
1804 function( elem, context, xml ) {
1805 var cache, uniqueCache, outerCache, node, nodeIndex, start,
1806 dir = simple !== forward ? "nextSibling" : "previousSibling",
1807 parent = elem.parentNode,
1808 name = ofType && elem.nodeName.toLowerCase(),
1809 useCache = !xml && !ofType,
1810 diff = false;
1811
1812 if ( parent ) {
1813
1814 // :(first|last|only)-(child|of-type)
1815 if ( simple ) {
1816 while ( dir ) {
1817 node = elem;
1818 while ( (node = node[ dir ]) ) {
1819 if ( ofType ?
1820 node.nodeName.toLowerCase() === name :
1821 node.nodeType === 1 ) {
1822
1823 return false;
1824 }
1825 }
1826 // Reverse direction for :only-* (if we haven't yet done so)
1827 start = dir = type === "only" && !start && "nextSibling";
1828 }
1829 return true;
1830 }
1831
1832 start = [ forward ? parent.firstChild : parent.lastChild ];
1833
1834 // non-xml :nth-child(...) stores cache data on `parent`
1835 if ( forward && useCache ) {
1836
1837 // Seek `elem` from a previously-cached index
1838
1839 // ...in a gzip-friendly way
1840 node = parent;
1841 outerCache = node[ expando ] || (node[ expando ] = {});
1842
1843 // Support: IE <9 only
1844 // Defend against cloned attroperties (jQuery gh-1709)
1845 uniqueCache = outerCache[ node.uniqueID ] ||
1846 (outerCache[ node.uniqueID ] = {});
1847
1848 cache = uniqueCache[ type ] || [];
1849 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1850 diff = nodeIndex && cache[ 2 ];
1851 node = nodeIndex && parent.childNodes[ nodeIndex ];
1852
1853 while ( (node = ++nodeIndex && node && node[ dir ] ||
1854
1855 // Fallback to seeking `elem` from the start
1856 (diff = nodeIndex = 0) || start.pop()) ) {
1857
1858 // When found, cache indexes on `parent` and break
1859 if ( node.nodeType === 1 && ++diff && node === elem ) {
1860 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
1861 break;
1862 }
1863 }
1864
1865 } else {
1866 // Use previously-cached element index if available
1867 if ( useCache ) {
1868 // ...in a gzip-friendly way
1869 node = elem;
1870 outerCache = node[ expando ] || (node[ expando ] = {});
1871
1872 // Support: IE <9 only
1873 // Defend against cloned attroperties (jQuery gh-1709)
1874 uniqueCache = outerCache[ node.uniqueID ] ||
1875 (outerCache[ node.uniqueID ] = {});
1876
1877 cache = uniqueCache[ type ] || [];
1878 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1879 diff = nodeIndex;
1880 }
1881
1882 // xml :nth-child(...)
1883 // or :nth-last-child(...) or :nth(-last)?-of-type(...)
1884 if ( diff === false ) {
1885 // Use the same loop as above to seek `elem` from the start
1886 while ( (node = ++nodeIndex && node && node[ dir ] ||
1887 (diff = nodeIndex = 0) || start.pop()) ) {
1888
1889 if ( ( ofType ?
1890 node.nodeName.toLowerCase() === name :
1891 node.nodeType === 1 ) &&
1892 ++diff ) {
1893
1894 // Cache the index of each encountered element
1895 if ( useCache ) {
1896 outerCache = node[ expando ] || (node[ expando ] = {});
1897
1898 // Support: IE <9 only
1899 // Defend against cloned attroperties (jQuery gh-1709)
1900 uniqueCache = outerCache[ node.uniqueID ] ||
1901 (outerCache[ node.uniqueID ] = {});
1902
1903 uniqueCache[ type ] = [ dirruns, diff ];
1904 }
1905
1906 if ( node === elem ) {
1907 break;
1908 }
1909 }
1910 }
1911 }
1912 }
1913
1914 // Incorporate the offset, then check against cycle size
1915 diff -= last;
1916 return diff === first || ( diff % first === 0 && diff / first >= 0 );
1917 }
1918 };
1919 },
1920
1921 "PSEUDO": function( pseudo, argument ) {
1922 // pseudo-class names are case-insensitive
1923 // http://www.w3.org/TR/selectors/#pseudo-classes
1924 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
1925 // Remember that setFilters inherits from pseudos
1926 var args,
1927 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
1928 Sizzle.error( "unsupported pseudo: " + pseudo );
1929
1930 // The user may use createPseudo to indicate that
1931 // arguments are needed to create the filter function
1932 // just as Sizzle does
1933 if ( fn[ expando ] ) {
1934 return fn( argument );
1935 }
1936
1937 // But maintain support for old signatures
1938 if ( fn.length > 1 ) {
1939 args = [ pseudo, pseudo, "", argument ];
1940 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1941 markFunction(function( seed, matches ) {
1942 var idx,
1943 matched = fn( seed, argument ),
1944 i = matched.length;
1945 while ( i-- ) {
1946 idx = indexOf( seed, matched[i] );
1947 seed[ idx ] = !( matches[ idx ] = matched[i] );
1948 }
1949 }) :
1950 function( elem ) {
1951 return fn( elem, 0, args );
1952 };
1953 }
1954
1955 return fn;
1956 }
1957 },
1958
1959 pseudos: {
1960 // Potentially complex pseudos
1961 "not": markFunction(function( selector ) {
1962 // Trim the selector passed to compile
1963 // to avoid treating leading and trailing
1964 // spaces as combinators
1965 var input = [],
1966 results = [],
1967 matcher = compile( selector.replace( rtrim, "$1" ) );
1968
1969 return matcher[ expando ] ?
1970 markFunction(function( seed, matches, context, xml ) {
1971 var elem,
1972 unmatched = matcher( seed, null, xml, [] ),
1973 i = seed.length;
1974
1975 // Match elements unmatched by `matcher`
1976 while ( i-- ) {
1977 if ( (elem = unmatched[i]) ) {
1978 seed[i] = !(matches[i] = elem);
1979 }
1980 }
1981 }) :
1982 function( elem, context, xml ) {
1983 input[0] = elem;
1984 matcher( input, null, xml, results );
1985 // Don't keep the element (issue #299)
1986 input[0] = null;
1987 return !results.pop();
1988 };
1989 }),
1990
1991 "has": markFunction(function( selector ) {
1992 return function( elem ) {
1993 return Sizzle( selector, elem ).length > 0;
1994 };
1995 }),
1996
1997 "contains": markFunction(function( text ) {
1998 text = text.replace( runescape, funescape );
1999 return function( elem ) {
2000 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
2001 };
2002 }),
2003
2004 // "Whether an element is represented by a :lang() selector
2005 // is based solely on the element's language value
2006 // being equal to the identifier C,
2007 // or beginning with the identifier C immediately followed by "-".
2008 // The matching of C against the element's language value is performed case-insensitively.
2009 // The identifier C does not have to be a valid language name."
2010 // http://www.w3.org/TR/selectors/#lang-pseudo
2011 "lang": markFunction( function( lang ) {
2012 // lang value must be a valid identifier
2013 if ( !ridentifier.test(lang || "") ) {
2014 Sizzle.error( "unsupported lang: " + lang );
2015 }
2016 lang = lang.replace( runescape, funescape ).toLowerCase();
2017 return function( elem ) {
2018 var elemLang;
2019 do {
2020 if ( (elemLang = documentIsHTML ?
2021 elem.lang :
2022 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
2023
2024 elemLang = elemLang.toLowerCase();
2025 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
2026 }
2027 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
2028 return false;
2029 };
2030 }),
2031
2032 // Miscellaneous
2033 "target": function( elem ) {
2034 var hash = window.location && window.location.hash;
2035 return hash && hash.slice( 1 ) === elem.id;
2036 },
2037
2038 "root": function( elem ) {
2039 return elem === docElem;
2040 },
2041
2042 "focus": function( elem ) {
2043 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
2044 },
2045
2046 // Boolean properties
2047 "enabled": createDisabledPseudo( false ),
2048 "disabled": createDisabledPseudo( true ),
2049
2050 "checked": function( elem ) {
2051 // In CSS3, :checked should return both checked and selected elements
2052 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
2053 var nodeName = elem.nodeName.toLowerCase();
2054 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
2055 },
2056
2057 "selected": function( elem ) {
2058 // Accessing this property makes selected-by-default
2059 // options in Safari work properly
2060 if ( elem.parentNode ) {
2061 elem.parentNode.selectedIndex;
2062 }
2063
2064 return elem.selected === true;
2065 },
2066
2067 // Contents
2068 "empty": function( elem ) {
2069 // http://www.w3.org/TR/selectors/#empty-pseudo
2070 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
2071 // but not by others (comment: 8; processing instruction: 7; etc.)
2072 // nodeType < 6 works because attributes (2) do not appear as children
2073 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
2074 if ( elem.nodeType < 6 ) {
2075 return false;
2076 }
2077 }
2078 return true;
2079 },
2080
2081 "parent": function( elem ) {
2082 return !Expr.pseudos["empty"]( elem );
2083 },
2084
2085 // Element/input types
2086 "header": function( elem ) {
2087 return rheader.test( elem.nodeName );
2088 },
2089
2090 "input": function( elem ) {
2091 return rinputs.test( elem.nodeName );
2092 },
2093
2094 "button": function( elem ) {
2095 var name = elem.nodeName.toLowerCase();
2096 return name === "input" && elem.type === "button" || name === "button";
2097 },
2098
2099 "text": function( elem ) {
2100 var attr;
2101 return elem.nodeName.toLowerCase() === "input" &&
2102 elem.type === "text" &&
2103
2104 // Support: IE<8
2105 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
2106 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
2107 },
2108
2109 // Position-in-collection
2110 "first": createPositionalPseudo(function() {
2111 return [ 0 ];
2112 }),
2113
2114 "last": createPositionalPseudo(function( matchIndexes, length ) {
2115 return [ length - 1 ];
2116 }),
2117
2118 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
2119 return [ argument < 0 ? argument + length : argument ];
2120 }),
2121
2122 "even": createPositionalPseudo(function( matchIndexes, length ) {
2123 var i = 0;
2124 for ( ; i < length; i += 2 ) {
2125 matchIndexes.push( i );
2126 }
2127 return matchIndexes;
2128 }),
2129
2130 "odd": createPositionalPseudo(function( matchIndexes, length ) {
2131 var i = 1;
2132 for ( ; i < length; i += 2 ) {
2133 matchIndexes.push( i );
2134 }
2135 return matchIndexes;
2136 }),
2137
2138 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2139 var i = argument < 0 ? argument + length : argument;
2140 for ( ; --i >= 0; ) {
2141 matchIndexes.push( i );
2142 }
2143 return matchIndexes;
2144 }),
2145
2146 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2147 var i = argument < 0 ? argument + length : argument;
2148 for ( ; ++i < length; ) {
2149 matchIndexes.push( i );
2150 }
2151 return matchIndexes;
2152 })
2153 }
2154};
2155
2156Expr.pseudos["nth"] = Expr.pseudos["eq"];
2157
2158// Add button/input type pseudos
2159for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2160 Expr.pseudos[ i ] = createInputPseudo( i );
2161}
2162for ( i in { submit: true, reset: true } ) {
2163 Expr.pseudos[ i ] = createButtonPseudo( i );
2164}
2165
2166// Easy API for creating new setFilters
2167function setFilters() {}
2168setFilters.prototype = Expr.filters = Expr.pseudos;
2169Expr.setFilters = new setFilters();
2170
2171tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2172 var matched, match, tokens, type,
2173 soFar, groups, preFilters,
2174 cached = tokenCache[ selector + " " ];
2175
2176 if ( cached ) {
2177 return parseOnly ? 0 : cached.slice( 0 );
2178 }
2179
2180 soFar = selector;
2181 groups = [];
2182 preFilters = Expr.preFilter;
2183
2184 while ( soFar ) {
2185
2186 // Comma and first run
2187 if ( !matched || (match = rcomma.exec( soFar )) ) {
2188 if ( match ) {
2189 // Don't consume trailing commas as valid
2190 soFar = soFar.slice( match[0].length ) || soFar;
2191 }
2192 groups.push( (tokens = []) );
2193 }
2194
2195 matched = false;
2196
2197 // Combinators
2198 if ( (match = rcombinators.exec( soFar )) ) {
2199 matched = match.shift();
2200 tokens.push({
2201 value: matched,
2202 // Cast descendant combinators to space
2203 type: match[0].replace( rtrim, " " )
2204 });
2205 soFar = soFar.slice( matched.length );
2206 }
2207
2208 // Filters
2209 for ( type in Expr.filter ) {
2210 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2211 (match = preFilters[ type ]( match ))) ) {
2212 matched = match.shift();
2213 tokens.push({
2214 value: matched,
2215 type: type,
2216 matches: match
2217 });
2218 soFar = soFar.slice( matched.length );
2219 }
2220 }
2221
2222 if ( !matched ) {
2223 break;
2224 }
2225 }
2226
2227 // Return the length of the invalid excess
2228 // if we're just parsing
2229 // Otherwise, throw an error or return tokens
2230 return parseOnly ?
2231 soFar.length :
2232 soFar ?
2233 Sizzle.error( selector ) :
2234 // Cache the tokens
2235 tokenCache( selector, groups ).slice( 0 );
2236};
2237
2238function toSelector( tokens ) {
2239 var i = 0,
2240 len = tokens.length,
2241 selector = "";
2242 for ( ; i < len; i++ ) {
2243 selector += tokens[i].value;
2244 }
2245 return selector;
2246}
2247
2248function addCombinator( matcher, combinator, base ) {
2249 var dir = combinator.dir,
2250 skip = combinator.next,
2251 key = skip || dir,
2252 checkNonElements = base && key === "parentNode",
2253 doneName = done++;
2254
2255 return combinator.first ?
2256 // Check against closest ancestor/preceding element
2257 function( elem, context, xml ) {
2258 while ( (elem = elem[ dir ]) ) {
2259 if ( elem.nodeType === 1 || checkNonElements ) {
2260 return matcher( elem, context, xml );
2261 }
2262 }
2263 return false;
2264 } :
2265
2266 // Check against all ancestor/preceding elements
2267 function( elem, context, xml ) {
2268 var oldCache, uniqueCache, outerCache,
2269 newCache = [ dirruns, doneName ];
2270
2271 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
2272 if ( xml ) {
2273 while ( (elem = elem[ dir ]) ) {
2274 if ( elem.nodeType === 1 || checkNonElements ) {
2275 if ( matcher( elem, context, xml ) ) {
2276 return true;
2277 }
2278 }
2279 }
2280 } else {
2281 while ( (elem = elem[ dir ]) ) {
2282 if ( elem.nodeType === 1 || checkNonElements ) {
2283 outerCache = elem[ expando ] || (elem[ expando ] = {});
2284
2285 // Support: IE <9 only
2286 // Defend against cloned attroperties (jQuery gh-1709)
2287 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
2288
2289 if ( skip && skip === elem.nodeName.toLowerCase() ) {
2290 elem = elem[ dir ] || elem;
2291 } else if ( (oldCache = uniqueCache[ key ]) &&
2292 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2293
2294 // Assign to newCache so results back-propagate to previous elements
2295 return (newCache[ 2 ] = oldCache[ 2 ]);
2296 } else {
2297 // Reuse newcache so results back-propagate to previous elements
2298 uniqueCache[ key ] = newCache;
2299
2300 // A match means we're done; a fail means we have to keep checking
2301 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
2302 return true;
2303 }
2304 }
2305 }
2306 }
2307 }
2308 return false;
2309 };
2310}
2311
2312function elementMatcher( matchers ) {
2313 return matchers.length > 1 ?
2314 function( elem, context, xml ) {
2315 var i = matchers.length;
2316 while ( i-- ) {
2317 if ( !matchers[i]( elem, context, xml ) ) {
2318 return false;
2319 }
2320 }
2321 return true;
2322 } :
2323 matchers[0];
2324}
2325
2326function multipleContexts( selector, contexts, results ) {
2327 var i = 0,
2328 len = contexts.length;
2329 for ( ; i < len; i++ ) {
2330 Sizzle( selector, contexts[i], results );
2331 }
2332 return results;
2333}
2334
2335function condense( unmatched, map, filter, context, xml ) {
2336 var elem,
2337 newUnmatched = [],
2338 i = 0,
2339 len = unmatched.length,
2340 mapped = map != null;
2341
2342 for ( ; i < len; i++ ) {
2343 if ( (elem = unmatched[i]) ) {
2344 if ( !filter || filter( elem, context, xml ) ) {
2345 newUnmatched.push( elem );
2346 if ( mapped ) {
2347 map.push( i );
2348 }
2349 }
2350 }
2351 }
2352
2353 return newUnmatched;
2354}
2355
2356function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2357 if ( postFilter && !postFilter[ expando ] ) {
2358 postFilter = setMatcher( postFilter );
2359 }
2360 if ( postFinder && !postFinder[ expando ] ) {
2361 postFinder = setMatcher( postFinder, postSelector );
2362 }
2363 return markFunction(function( seed, results, context, xml ) {
2364 var temp, i, elem,
2365 preMap = [],
2366 postMap = [],
2367 preexisting = results.length,
2368
2369 // Get initial elements from seed or context
2370 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2371
2372 // Prefilter to get matcher input, preserving a map for seed-results synchronization
2373 matcherIn = preFilter && ( seed || !selector ) ?
2374 condense( elems, preMap, preFilter, context, xml ) :
2375 elems,
2376
2377 matcherOut = matcher ?
2378 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2379 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2380
2381 // ...intermediate processing is necessary
2382 [] :
2383
2384 // ...otherwise use results directly
2385 results :
2386 matcherIn;
2387
2388 // Find primary matches
2389 if ( matcher ) {
2390 matcher( matcherIn, matcherOut, context, xml );
2391 }
2392
2393 // Apply postFilter
2394 if ( postFilter ) {
2395 temp = condense( matcherOut, postMap );
2396 postFilter( temp, [], context, xml );
2397
2398 // Un-match failing elements by moving them back to matcherIn
2399 i = temp.length;
2400 while ( i-- ) {
2401 if ( (elem = temp[i]) ) {
2402 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2403 }
2404 }
2405 }
2406
2407 if ( seed ) {
2408 if ( postFinder || preFilter ) {
2409 if ( postFinder ) {
2410 // Get the final matcherOut by condensing this intermediate into postFinder contexts
2411 temp = [];
2412 i = matcherOut.length;
2413 while ( i-- ) {
2414 if ( (elem = matcherOut[i]) ) {
2415 // Restore matcherIn since elem is not yet a final match
2416 temp.push( (matcherIn[i] = elem) );
2417 }
2418 }
2419 postFinder( null, (matcherOut = []), temp, xml );
2420 }
2421
2422 // Move matched elements from seed to results to keep them synchronized
2423 i = matcherOut.length;
2424 while ( i-- ) {
2425 if ( (elem = matcherOut[i]) &&
2426 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
2427
2428 seed[temp] = !(results[temp] = elem);
2429 }
2430 }
2431 }
2432
2433 // Add elements to results, through postFinder if defined
2434 } else {
2435 matcherOut = condense(
2436 matcherOut === results ?
2437 matcherOut.splice( preexisting, matcherOut.length ) :
2438 matcherOut
2439 );
2440 if ( postFinder ) {
2441 postFinder( null, results, matcherOut, xml );
2442 } else {
2443 push.apply( results, matcherOut );
2444 }
2445 }
2446 });
2447}
2448
2449function matcherFromTokens( tokens ) {
2450 var checkContext, matcher, j,
2451 len = tokens.length,
2452 leadingRelative = Expr.relative[ tokens[0].type ],
2453 implicitRelative = leadingRelative || Expr.relative[" "],
2454 i = leadingRelative ? 1 : 0,
2455
2456 // The foundational matcher ensures that elements are reachable from top-level context(s)
2457 matchContext = addCombinator( function( elem ) {
2458 return elem === checkContext;
2459 }, implicitRelative, true ),
2460 matchAnyContext = addCombinator( function( elem ) {
2461 return indexOf( checkContext, elem ) > -1;
2462 }, implicitRelative, true ),
2463 matchers = [ function( elem, context, xml ) {
2464 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2465 (checkContext = context).nodeType ?
2466 matchContext( elem, context, xml ) :
2467 matchAnyContext( elem, context, xml ) );
2468 // Avoid hanging onto element (issue #299)
2469 checkContext = null;
2470 return ret;
2471 } ];
2472
2473 for ( ; i < len; i++ ) {
2474 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2475 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
2476 } else {
2477 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
2478
2479 // Return special upon seeing a positional matcher
2480 if ( matcher[ expando ] ) {
2481 // Find the next relative operator (if any) for proper handling
2482 j = ++i;
2483 for ( ; j < len; j++ ) {
2484 if ( Expr.relative[ tokens[j].type ] ) {
2485 break;
2486 }
2487 }
2488 return setMatcher(
2489 i > 1 && elementMatcher( matchers ),
2490 i > 1 && toSelector(
2491 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2492 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
2493 ).replace( rtrim, "$1" ),
2494 matcher,
2495 i < j && matcherFromTokens( tokens.slice( i, j ) ),
2496 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2497 j < len && toSelector( tokens )
2498 );
2499 }
2500 matchers.push( matcher );
2501 }
2502 }
2503
2504 return elementMatcher( matchers );
2505}
2506
2507function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2508 var bySet = setMatchers.length > 0,
2509 byElement = elementMatchers.length > 0,
2510 superMatcher = function( seed, context, xml, results, outermost ) {
2511 var elem, j, matcher,
2512 matchedCount = 0,
2513 i = "0",
2514 unmatched = seed && [],
2515 setMatched = [],
2516 contextBackup = outermostContext,
2517 // We must always have either seed elements or outermost context
2518 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
2519 // Use integer dirruns iff this is the outermost matcher
2520 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
2521 len = elems.length;
2522
2523 if ( outermost ) {
2524 outermostContext = context === document || context || outermost;
2525 }
2526
2527 // Add elements passing elementMatchers directly to results
2528 // Support: IE<9, Safari
2529 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2530 for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
2531 if ( byElement && elem ) {
2532 j = 0;
2533 if ( !context && elem.ownerDocument !== document ) {
2534 setDocument( elem );
2535 xml = !documentIsHTML;
2536 }
2537 while ( (matcher = elementMatchers[j++]) ) {
2538 if ( matcher( elem, context || document, xml) ) {
2539 results.push( elem );
2540 break;
2541 }
2542 }
2543 if ( outermost ) {
2544 dirruns = dirrunsUnique;
2545 }
2546 }
2547
2548 // Track unmatched elements for set filters
2549 if ( bySet ) {
2550 // They will have gone through all possible matchers
2551 if ( (elem = !matcher && elem) ) {
2552 matchedCount--;
2553 }
2554
2555 // Lengthen the array for every element, matched or not
2556 if ( seed ) {
2557 unmatched.push( elem );
2558 }
2559 }
2560 }
2561
2562 // `i` is now the count of elements visited above, and adding it to `matchedCount`
2563 // makes the latter nonnegative.
2564 matchedCount += i;
2565
2566 // Apply set filters to unmatched elements
2567 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
2568 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
2569 // no element matchers and no seed.
2570 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
2571 // case, which will result in a "00" `matchedCount` that differs from `i` but is also
2572 // numerically zero.
2573 if ( bySet && i !== matchedCount ) {
2574 j = 0;
2575 while ( (matcher = setMatchers[j++]) ) {
2576 matcher( unmatched, setMatched, context, xml );
2577 }
2578
2579 if ( seed ) {
2580 // Reintegrate element matches to eliminate the need for sorting
2581 if ( matchedCount > 0 ) {
2582 while ( i-- ) {
2583 if ( !(unmatched[i] || setMatched[i]) ) {
2584 setMatched[i] = pop.call( results );
2585 }
2586 }
2587 }
2588
2589 // Discard index placeholder values to get only actual matches
2590 setMatched = condense( setMatched );
2591 }
2592
2593 // Add matches to results
2594 push.apply( results, setMatched );
2595
2596 // Seedless set matches succeeding multiple successful matchers stipulate sorting
2597 if ( outermost && !seed && setMatched.length > 0 &&
2598 ( matchedCount + setMatchers.length ) > 1 ) {
2599
2600 Sizzle.uniqueSort( results );
2601 }
2602 }
2603
2604 // Override manipulation of globals by nested matchers
2605 if ( outermost ) {
2606 dirruns = dirrunsUnique;
2607 outermostContext = contextBackup;
2608 }
2609
2610 return unmatched;
2611 };
2612
2613 return bySet ?
2614 markFunction( superMatcher ) :
2615 superMatcher;
2616}
2617
2618compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2619 var i,
2620 setMatchers = [],
2621 elementMatchers = [],
2622 cached = compilerCache[ selector + " " ];
2623
2624 if ( !cached ) {
2625 // Generate a function of recursive functions that can be used to check each element
2626 if ( !match ) {
2627 match = tokenize( selector );
2628 }
2629 i = match.length;
2630 while ( i-- ) {
2631 cached = matcherFromTokens( match[i] );
2632 if ( cached[ expando ] ) {
2633 setMatchers.push( cached );
2634 } else {
2635 elementMatchers.push( cached );
2636 }
2637 }
2638
2639 // Cache the compiled function
2640 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2641
2642 // Save selector and tokenization
2643 cached.selector = selector;
2644 }
2645 return cached;
2646};
2647
2648/**
2649 * A low-level selection function that works with Sizzle's compiled
2650 * selector functions
2651 * @param {String|Function} selector A selector or a pre-compiled
2652 * selector function built with Sizzle.compile
2653 * @param {Element} context
2654 * @param {Array} [results]
2655 * @param {Array} [seed] A set of elements to match against
2656 */
2657select = Sizzle.select = function( selector, context, results, seed ) {
2658 var i, tokens, token, type, find,
2659 compiled = typeof selector === "function" && selector,
2660 match = !seed && tokenize( (selector = compiled.selector || selector) );
2661
2662 results = results || [];
2663
2664 // Try to minimize operations if there is only one selector in the list and no seed
2665 // (the latter of which guarantees us context)
2666 if ( match.length === 1 ) {
2667
2668 // Reduce context if the leading compound selector is an ID
2669 tokens = match[0] = match[0].slice( 0 );
2670 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
2671 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
2672
2673 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
2674 if ( !context ) {
2675 return results;
2676
2677 // Precompiled matchers will still verify ancestry, so step up a level
2678 } else if ( compiled ) {
2679 context = context.parentNode;
2680 }
2681
2682 selector = selector.slice( tokens.shift().value.length );
2683 }
2684
2685 // Fetch a seed set for right-to-left matching
2686 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2687 while ( i-- ) {
2688 token = tokens[i];
2689
2690 // Abort if we hit a combinator
2691 if ( Expr.relative[ (type = token.type) ] ) {
2692 break;
2693 }
2694 if ( (find = Expr.find[ type ]) ) {
2695 // Search, expanding context for leading sibling combinators
2696 if ( (seed = find(
2697 token.matches[0].replace( runescape, funescape ),
2698 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
2699 )) ) {
2700
2701 // If seed is empty or no tokens remain, we can return early
2702 tokens.splice( i, 1 );
2703 selector = seed.length && toSelector( tokens );
2704 if ( !selector ) {
2705 push.apply( results, seed );
2706 return results;
2707 }
2708
2709 break;
2710 }
2711 }
2712 }
2713 }
2714
2715 // Compile and execute a filtering function if one is not provided
2716 // Provide `match` to avoid retokenization if we modified the selector above
2717 ( compiled || compile( selector, match ) )(
2718 seed,
2719 context,
2720 !documentIsHTML,
2721 results,
2722 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2723 );
2724 return results;
2725};
2726
2727// One-time assignments
2728
2729// Sort stability
2730support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
2731
2732// Support: Chrome 14-35+
2733// Always assume duplicates if they aren't passed to the comparison function
2734support.detectDuplicates = !!hasDuplicate;
2735
2736// Initialize against the default document
2737setDocument();
2738
2739// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2740// Detached nodes confoundingly follow *each other*
2741support.sortDetached = assert(function( el ) {
2742 // Should return 1, but returns 4 (following)
2743 return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
2744});
2745
2746// Support: IE<8
2747// Prevent attribute/property "interpolation"
2748// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2749if ( !assert(function( el ) {
2750 el.innerHTML = "<a href='#'></a>";
2751 return el.firstChild.getAttribute("href") === "#" ;
2752}) ) {
2753 addHandle( "type|href|height|width", function( elem, name, isXML ) {
2754 if ( !isXML ) {
2755 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2756 }
2757 });
2758}
2759
2760// Support: IE<9
2761// Use defaultValue in place of getAttribute("value")
2762if ( !support.attributes || !assert(function( el ) {
2763 el.innerHTML = "<input/>";
2764 el.firstChild.setAttribute( "value", "" );
2765 return el.firstChild.getAttribute( "value" ) === "";
2766}) ) {
2767 addHandle( "value", function( elem, name, isXML ) {
2768 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2769 return elem.defaultValue;
2770 }
2771 });
2772}
2773
2774// Support: IE<9
2775// Use getAttributeNode to fetch booleans when getAttribute lies
2776if ( !assert(function( el ) {
2777 return el.getAttribute("disabled") == null;
2778}) ) {
2779 addHandle( booleans, function( elem, name, isXML ) {
2780 var val;
2781 if ( !isXML ) {
2782 return elem[ name ] === true ? name.toLowerCase() :
2783 (val = elem.getAttributeNode( name )) && val.specified ?
2784 val.value :
2785 null;
2786 }
2787 });
2788}
2789
2790return Sizzle;
2791
2792})( window );
2793
2794
2795
2796jQuery.find = Sizzle;
2797jQuery.expr = Sizzle.selectors;
2798
2799// Deprecated
2800jQuery.expr[ ":" ] = jQuery.expr.pseudos;
2801jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
2802jQuery.text = Sizzle.getText;
2803jQuery.isXMLDoc = Sizzle.isXML;
2804jQuery.contains = Sizzle.contains;
2805jQuery.escapeSelector = Sizzle.escape;
2806
2807
2808
2809
2810var dir = function( elem, dir, until ) {
2811 var matched = [],
2812 truncate = until !== undefined;
2813
2814 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
2815 if ( elem.nodeType === 1 ) {
2816 if ( truncate && jQuery( elem ).is( until ) ) {
2817 break;
2818 }
2819 matched.push( elem );
2820 }
2821 }
2822 return matched;
2823};
2824
2825
2826var siblings = function( n, elem ) {
2827 var matched = [];
2828
2829 for ( ; n; n = n.nextSibling ) {
2830 if ( n.nodeType === 1 && n !== elem ) {
2831 matched.push( n );
2832 }
2833 }
2834
2835 return matched;
2836};
2837
2838
2839var rneedsContext = jQuery.expr.match.needsContext;
2840
2841
2842
2843function nodeName( elem, name ) {
2844
2845 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
2846
2847};
2848var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
2849
2850
2851
2852var risSimple = /^.[^:#\[\.,]*$/;
2853
2854// Implement the identical functionality for filter and not
2855function winnow( elements, qualifier, not ) {
2856 if ( jQuery.isFunction( qualifier ) ) {
2857 return jQuery.grep( elements, function( elem, i ) {
2858 return !!qualifier.call( elem, i, elem ) !== not;
2859 } );
2860 }
2861
2862 // Single element
2863 if ( qualifier.nodeType ) {
2864 return jQuery.grep( elements, function( elem ) {
2865 return ( elem === qualifier ) !== not;
2866 } );
2867 }
2868
2869 // Arraylike of elements (jQuery, arguments, Array)
2870 if ( typeof qualifier !== "string" ) {
2871 return jQuery.grep( elements, function( elem ) {
2872 return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
2873 } );
2874 }
2875
2876 // Simple selector that can be filtered directly, removing non-Elements
2877 if ( risSimple.test( qualifier ) ) {
2878 return jQuery.filter( qualifier, elements, not );
2879 }
2880
2881 // Complex selector, compare the two sets, removing non-Elements
2882 qualifier = jQuery.filter( qualifier, elements );
2883 return jQuery.grep( elements, function( elem ) {
2884 return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
2885 } );
2886}
2887
2888jQuery.filter = function( expr, elems, not ) {
2889 var elem = elems[ 0 ];
2890
2891 if ( not ) {
2892 expr = ":not(" + expr + ")";
2893 }
2894
2895 if ( elems.length === 1 && elem.nodeType === 1 ) {
2896 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
2897 }
2898
2899 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
2900 return elem.nodeType === 1;
2901 } ) );
2902};
2903
2904jQuery.fn.extend( {
2905 find: function( selector ) {
2906 var i, ret,
2907 len = this.length,
2908 self = this;
2909
2910 if ( typeof selector !== "string" ) {
2911 return this.pushStack( jQuery( selector ).filter( function() {
2912 for ( i = 0; i < len; i++ ) {
2913 if ( jQuery.contains( self[ i ], this ) ) {
2914 return true;
2915 }
2916 }
2917 } ) );
2918 }
2919
2920 ret = this.pushStack( [] );
2921
2922 for ( i = 0; i < len; i++ ) {
2923 jQuery.find( selector, self[ i ], ret );
2924 }
2925
2926 return len > 1 ? jQuery.uniqueSort( ret ) : ret;
2927 },
2928 filter: function( selector ) {
2929 return this.pushStack( winnow( this, selector || [], false ) );
2930 },
2931 not: function( selector ) {
2932 return this.pushStack( winnow( this, selector || [], true ) );
2933 },
2934 is: function( selector ) {
2935 return !!winnow(
2936 this,
2937
2938 // If this is a positional/relative selector, check membership in the returned set
2939 // so $("p:first").is("p:last") won't return true for a doc with two "p".
2940 typeof selector === "string" && rneedsContext.test( selector ) ?
2941 jQuery( selector ) :
2942 selector || [],
2943 false
2944 ).length;
2945 }
2946} );
2947
2948
2949// Initialize a jQuery object
2950
2951
2952// A central reference to the root jQuery(document)
2953var rootjQuery,
2954
2955 // A simple way to check for HTML strings
2956 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
2957 // Strict HTML recognition (#11290: must start with <)
2958 // Shortcut simple #id case for speed
2959 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
2960
2961 init = jQuery.fn.init = function( selector, context, root ) {
2962 var match, elem;
2963
2964 // HANDLE: $(""), $(null), $(undefined), $(false)
2965 if ( !selector ) {
2966 return this;
2967 }
2968
2969 // Method init() accepts an alternate rootjQuery
2970 // so migrate can support jQuery.sub (gh-2101)
2971 root = root || rootjQuery;
2972
2973 // Handle HTML strings
2974 if ( typeof selector === "string" ) {
2975 if ( selector[ 0 ] === "<" &&
2976 selector[ selector.length - 1 ] === ">" &&
2977 selector.length >= 3 ) {
2978
2979 // Assume that strings that start and end with <> are HTML and skip the regex check
2980 match = [ null, selector, null ];
2981
2982 } else {
2983 match = rquickExpr.exec( selector );
2984 }
2985
2986 // Match html or make sure no context is specified for #id
2987 if ( match && ( match[ 1 ] || !context ) ) {
2988
2989 // HANDLE: $(html) -> $(array)
2990 if ( match[ 1 ] ) {
2991 context = context instanceof jQuery ? context[ 0 ] : context;
2992
2993 // Option to run scripts is true for back-compat
2994 // Intentionally let the error be thrown if parseHTML is not present
2995 jQuery.merge( this, jQuery.parseHTML(
2996 match[ 1 ],
2997 context && context.nodeType ? context.ownerDocument || context : document,
2998 true
2999 ) );
3000
3001 // HANDLE: $(html, props)
3002 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
3003 for ( match in context ) {
3004
3005 // Properties of context are called as methods if possible
3006 if ( jQuery.isFunction( this[ match ] ) ) {
3007 this[ match ]( context[ match ] );
3008
3009 // ...and otherwise set as attributes
3010 } else {
3011 this.attr( match, context[ match ] );
3012 }
3013 }
3014 }
3015
3016 return this;
3017
3018 // HANDLE: $(#id)
3019 } else {
3020 elem = document.getElementById( match[ 2 ] );
3021
3022 if ( elem ) {
3023
3024 // Inject the element directly into the jQuery object
3025 this[ 0 ] = elem;
3026 this.length = 1;
3027 }
3028 return this;
3029 }
3030
3031 // HANDLE: $(expr, $(...))
3032 } else if ( !context || context.jquery ) {
3033 return ( context || root ).find( selector );
3034
3035 // HANDLE: $(expr, context)
3036 // (which is just equivalent to: $(context).find(expr)
3037 } else {
3038 return this.constructor( context ).find( selector );
3039 }
3040
3041 // HANDLE: $(DOMElement)
3042 } else if ( selector.nodeType ) {
3043 this[ 0 ] = selector;
3044 this.length = 1;
3045 return this;
3046
3047 // HANDLE: $(function)
3048 // Shortcut for document ready
3049 } else if ( jQuery.isFunction( selector ) ) {
3050 return root.ready !== undefined ?
3051 root.ready( selector ) :
3052
3053 // Execute immediately if ready is not present
3054 selector( jQuery );
3055 }
3056
3057 return jQuery.makeArray( selector, this );
3058 };
3059
3060// Give the init function the jQuery prototype for later instantiation
3061init.prototype = jQuery.fn;
3062
3063// Initialize central reference
3064rootjQuery = jQuery( document );
3065
3066
3067var rparentsprev = /^(?:parents|prev(?:Until|All))/,
3068
3069 // Methods guaranteed to produce a unique set when starting from a unique set
3070 guaranteedUnique = {
3071 children: true,
3072 contents: true,
3073 next: true,
3074 prev: true
3075 };
3076
3077jQuery.fn.extend( {
3078 has: function( target ) {
3079 var targets = jQuery( target, this ),
3080 l = targets.length;
3081
3082 return this.filter( function() {
3083 var i = 0;
3084 for ( ; i < l; i++ ) {
3085 if ( jQuery.contains( this, targets[ i ] ) ) {
3086 return true;
3087 }
3088 }
3089 } );
3090 },
3091
3092 closest: function( selectors, context ) {
3093 var cur,
3094 i = 0,
3095 l = this.length,
3096 matched = [],
3097 targets = typeof selectors !== "string" && jQuery( selectors );
3098
3099 // Positional selectors never match, since there's no _selection_ context
3100 if ( !rneedsContext.test( selectors ) ) {
3101 for ( ; i < l; i++ ) {
3102 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
3103
3104 // Always skip document fragments
3105 if ( cur.nodeType < 11 && ( targets ?
3106 targets.index( cur ) > -1 :
3107
3108 // Don't pass non-elements to Sizzle
3109 cur.nodeType === 1 &&
3110 jQuery.find.matchesSelector( cur, selectors ) ) ) {
3111
3112 matched.push( cur );
3113 break;
3114 }
3115 }
3116 }
3117 }
3118
3119 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
3120 },
3121
3122 // Determine the position of an element within the set
3123 index: function( elem ) {
3124
3125 // No argument, return index in parent
3126 if ( !elem ) {
3127 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
3128 }
3129
3130 // Index in selector
3131 if ( typeof elem === "string" ) {
3132 return indexOf.call( jQuery( elem ), this[ 0 ] );
3133 }
3134
3135 // Locate the position of the desired element
3136 return indexOf.call( this,
3137
3138 // If it receives a jQuery object, the first element is used
3139 elem.jquery ? elem[ 0 ] : elem
3140 );
3141 },
3142
3143 add: function( selector, context ) {
3144 return this.pushStack(
3145 jQuery.uniqueSort(
3146 jQuery.merge( this.get(), jQuery( selector, context ) )
3147 )
3148 );
3149 },
3150
3151 addBack: function( selector ) {
3152 return this.add( selector == null ?
3153 this.prevObject : this.prevObject.filter( selector )
3154 );
3155 }
3156} );
3157
3158function sibling( cur, dir ) {
3159 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
3160 return cur;
3161}
3162
3163jQuery.each( {
3164 parent: function( elem ) {
3165 var parent = elem.parentNode;
3166 return parent && parent.nodeType !== 11 ? parent : null;
3167 },
3168 parents: function( elem ) {
3169 return dir( elem, "parentNode" );
3170 },
3171 parentsUntil: function( elem, i, until ) {
3172 return dir( elem, "parentNode", until );
3173 },
3174 next: function( elem ) {
3175 return sibling( elem, "nextSibling" );
3176 },
3177 prev: function( elem ) {
3178 return sibling( elem, "previousSibling" );
3179 },
3180 nextAll: function( elem ) {
3181 return dir( elem, "nextSibling" );
3182 },
3183 prevAll: function( elem ) {
3184 return dir( elem, "previousSibling" );
3185 },
3186 nextUntil: function( elem, i, until ) {
3187 return dir( elem, "nextSibling", until );
3188 },
3189 prevUntil: function( elem, i, until ) {
3190 return dir( elem, "previousSibling", until );
3191 },
3192 siblings: function( elem ) {
3193 return siblings( ( elem.parentNode || {} ).firstChild, elem );
3194 },
3195 children: function( elem ) {
3196 return siblings( elem.firstChild );
3197 },
3198 contents: function( elem ) {
3199 if ( nodeName( elem, "iframe" ) ) {
3200 return elem.contentDocument;
3201 }
3202
3203 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
3204 // Treat the template element as a regular one in browsers that
3205 // don't support it.
3206 if ( nodeName( elem, "template" ) ) {
3207 elem = elem.content || elem;
3208 }
3209
3210 return jQuery.merge( [], elem.childNodes );
3211 }
3212}, function( name, fn ) {
3213 jQuery.fn[ name ] = function( until, selector ) {
3214 var matched = jQuery.map( this, fn, until );
3215
3216 if ( name.slice( -5 ) !== "Until" ) {
3217 selector = until;
3218 }
3219
3220 if ( selector && typeof selector === "string" ) {
3221 matched = jQuery.filter( selector, matched );
3222 }
3223
3224 if ( this.length > 1 ) {
3225
3226 // Remove duplicates
3227 if ( !guaranteedUnique[ name ] ) {
3228 jQuery.uniqueSort( matched );
3229 }
3230
3231 // Reverse order for parents* and prev-derivatives
3232 if ( rparentsprev.test( name ) ) {
3233 matched.reverse();
3234 }
3235 }
3236
3237 return this.pushStack( matched );
3238 };
3239} );
3240var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
3241
3242
3243
3244// Convert String-formatted options into Object-formatted ones
3245function createOptions( options ) {
3246 var object = {};
3247 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
3248 object[ flag ] = true;
3249 } );
3250 return object;
3251}
3252
3253/*
3254 * Create a callback list using the following parameters:
3255 *
3256 * options: an optional list of space-separated options that will change how
3257 * the callback list behaves or a more traditional option object
3258 *
3259 * By default a callback list will act like an event callback list and can be
3260 * "fired" multiple times.
3261 *
3262 * Possible options:
3263 *
3264 * once: will ensure the callback list can only be fired once (like a Deferred)
3265 *
3266 * memory: will keep track of previous values and will call any callback added
3267 * after the list has been fired right away with the latest "memorized"
3268 * values (like a Deferred)
3269 *
3270 * unique: will ensure a callback can only be added once (no duplicate in the list)
3271 *
3272 * stopOnFalse: interrupt callings when a callback returns false
3273 *
3274 */
3275jQuery.Callbacks = function( options ) {
3276
3277 // Convert options from String-formatted to Object-formatted if needed
3278 // (we check in cache first)
3279 options = typeof options === "string" ?
3280 createOptions( options ) :
3281 jQuery.extend( {}, options );
3282
3283 var // Flag to know if list is currently firing
3284 firing,
3285
3286 // Last fire value for non-forgettable lists
3287 memory,
3288
3289 // Flag to know if list was already fired
3290 fired,
3291
3292 // Flag to prevent firing
3293 locked,
3294
3295 // Actual callback list
3296 list = [],
3297
3298 // Queue of execution data for repeatable lists
3299 queue = [],
3300
3301 // Index of currently firing callback (modified by add/remove as needed)
3302 firingIndex = -1,
3303
3304 // Fire callbacks
3305 fire = function() {
3306
3307 // Enforce single-firing
3308 locked = locked || options.once;
3309
3310 // Execute callbacks for all pending executions,
3311 // respecting firingIndex overrides and runtime changes
3312 fired = firing = true;
3313 for ( ; queue.length; firingIndex = -1 ) {
3314 memory = queue.shift();
3315 while ( ++firingIndex < list.length ) {
3316
3317 // Run callback and check for early termination
3318 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
3319 options.stopOnFalse ) {
3320
3321 // Jump to end and forget the data so .add doesn't re-fire
3322 firingIndex = list.length;
3323 memory = false;
3324 }
3325 }
3326 }
3327
3328 // Forget the data if we're done with it
3329 if ( !options.memory ) {
3330 memory = false;
3331 }
3332
3333 firing = false;
3334
3335 // Clean up if we're done firing for good
3336 if ( locked ) {
3337
3338 // Keep an empty list if we have data for future add calls
3339 if ( memory ) {
3340 list = [];
3341
3342 // Otherwise, this object is spent
3343 } else {
3344 list = "";
3345 }
3346 }
3347 },
3348
3349 // Actual Callbacks object
3350 self = {
3351
3352 // Add a callback or a collection of callbacks to the list
3353 add: function() {
3354 if ( list ) {
3355
3356 // If we have memory from a past run, we should fire after adding
3357 if ( memory && !firing ) {
3358 firingIndex = list.length - 1;
3359 queue.push( memory );
3360 }
3361
3362 ( function add( args ) {
3363 jQuery.each( args, function( _, arg ) {
3364 if ( jQuery.isFunction( arg ) ) {
3365 if ( !options.unique || !self.has( arg ) ) {
3366 list.push( arg );
3367 }
3368 } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
3369
3370 // Inspect recursively
3371 add( arg );
3372 }
3373 } );
3374 } )( arguments );
3375
3376 if ( memory && !firing ) {
3377 fire();
3378 }
3379 }
3380 return this;
3381 },
3382
3383 // Remove a callback from the list
3384 remove: function() {
3385 jQuery.each( arguments, function( _, arg ) {
3386 var index;
3387 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
3388 list.splice( index, 1 );
3389
3390 // Handle firing indexes
3391 if ( index <= firingIndex ) {
3392 firingIndex--;
3393 }
3394 }
3395 } );
3396 return this;
3397 },
3398
3399 // Check if a given callback is in the list.
3400 // If no argument is given, return whether or not list has callbacks attached.
3401 has: function( fn ) {
3402 return fn ?
3403 jQuery.inArray( fn, list ) > -1 :
3404 list.length > 0;
3405 },
3406
3407 // Remove all callbacks from the list
3408 empty: function() {
3409 if ( list ) {
3410 list = [];
3411 }
3412 return this;
3413 },
3414
3415 // Disable .fire and .add
3416 // Abort any current/pending executions
3417 // Clear all callbacks and values
3418 disable: function() {
3419 locked = queue = [];
3420 list = memory = "";
3421 return this;
3422 },
3423 disabled: function() {
3424 return !list;
3425 },
3426
3427 // Disable .fire
3428 // Also disable .add unless we have memory (since it would have no effect)
3429 // Abort any pending executions
3430 lock: function() {
3431 locked = queue = [];
3432 if ( !memory && !firing ) {
3433 list = memory = "";
3434 }
3435 return this;
3436 },
3437 locked: function() {
3438 return !!locked;
3439 },
3440
3441 // Call all callbacks with the given context and arguments
3442 fireWith: function( context, args ) {
3443 if ( !locked ) {
3444 args = args || [];
3445 args = [ context, args.slice ? args.slice() : args ];
3446 queue.push( args );
3447 if ( !firing ) {
3448 fire();
3449 }
3450 }
3451 return this;
3452 },
3453
3454 // Call all the callbacks with the given arguments
3455 fire: function() {
3456 self.fireWith( this, arguments );
3457 return this;
3458 },
3459
3460 // To know if the callbacks have already been called at least once
3461 fired: function() {
3462 return !!fired;
3463 }
3464 };
3465
3466 return self;
3467};
3468
3469
3470function Identity( v ) {
3471 return v;
3472}
3473function Thrower( ex ) {
3474 throw ex;
3475}
3476
3477function adoptValue( value, resolve, reject, noValue ) {
3478 var method;
3479
3480 try {
3481
3482 // Check for promise aspect first to privilege synchronous behavior
3483 if ( value && jQuery.isFunction( ( method = value.promise ) ) ) {
3484 method.call( value ).done( resolve ).fail( reject );
3485
3486 // Other thenables
3487 } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) {
3488 method.call( value, resolve, reject );
3489
3490 // Other non-thenables
3491 } else {
3492
3493 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
3494 // * false: [ value ].slice( 0 ) => resolve( value )
3495 // * true: [ value ].slice( 1 ) => resolve()
3496 resolve.apply( undefined, [ value ].slice( noValue ) );
3497 }
3498
3499 // For Promises/A+, convert exceptions into rejections
3500 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
3501 // Deferred#then to conditionally suppress rejection.
3502 } catch ( value ) {
3503
3504 // Support: Android 4.0 only
3505 // Strict mode functions invoked without .call/.apply get global-object context
3506 reject.apply( undefined, [ value ] );
3507 }
3508}
3509
3510jQuery.extend( {
3511
3512 Deferred: function( func ) {
3513 var tuples = [
3514
3515 // action, add listener, callbacks,
3516 // ... .then handlers, argument index, [final state]
3517 [ "notify", "progress", jQuery.Callbacks( "memory" ),
3518 jQuery.Callbacks( "memory" ), 2 ],
3519 [ "resolve", "done", jQuery.Callbacks( "once memory" ),
3520 jQuery.Callbacks( "once memory" ), 0, "resolved" ],
3521 [ "reject", "fail", jQuery.Callbacks( "once memory" ),
3522 jQuery.Callbacks( "once memory" ), 1, "rejected" ]
3523 ],
3524 state = "pending",
3525 promise = {
3526 state: function() {
3527 return state;
3528 },
3529 always: function() {
3530 deferred.done( arguments ).fail( arguments );
3531 return this;
3532 },
3533 "catch": function( fn ) {
3534 return promise.then( null, fn );
3535 },
3536
3537 // Keep pipe for back-compat
3538 pipe: function( /* fnDone, fnFail, fnProgress */ ) {
3539 var fns = arguments;
3540
3541 return jQuery.Deferred( function( newDefer ) {
3542 jQuery.each( tuples, function( i, tuple ) {
3543
3544 // Map tuples (progress, done, fail) to arguments (done, fail, progress)
3545 var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
3546
3547 // deferred.progress(function() { bind to newDefer or newDefer.notify })
3548 // deferred.done(function() { bind to newDefer or newDefer.resolve })
3549 // deferred.fail(function() { bind to newDefer or newDefer.reject })
3550 deferred[ tuple[ 1 ] ]( function() {
3551 var returned = fn && fn.apply( this, arguments );
3552 if ( returned && jQuery.isFunction( returned.promise ) ) {
3553 returned.promise()
3554 .progress( newDefer.notify )
3555 .done( newDefer.resolve )
3556 .fail( newDefer.reject );
3557 } else {
3558 newDefer[ tuple[ 0 ] + "With" ](
3559 this,
3560 fn ? [ returned ] : arguments
3561 );
3562 }
3563 } );
3564 } );
3565 fns = null;
3566 } ).promise();
3567 },
3568 then: function( onFulfilled, onRejected, onProgress ) {
3569 var maxDepth = 0;
3570 function resolve( depth, deferred, handler, special ) {
3571 return function() {
3572 var that = this,
3573 args = arguments,
3574 mightThrow = function() {
3575 var returned, then;
3576
3577 // Support: Promises/A+ section 2.3.3.3.3
3578 // https://promisesaplus.com/#point-59
3579 // Ignore double-resolution attempts
3580 if ( depth < maxDepth ) {
3581 return;
3582 }
3583
3584 returned = handler.apply( that, args );
3585
3586 // Support: Promises/A+ section 2.3.1
3587 // https://promisesaplus.com/#point-48
3588 if ( returned === deferred.promise() ) {
3589 throw new TypeError( "Thenable self-resolution" );
3590 }
3591
3592 // Support: Promises/A+ sections 2.3.3.1, 3.5
3593 // https://promisesaplus.com/#point-54
3594 // https://promisesaplus.com/#point-75
3595 // Retrieve `then` only once
3596 then = returned &&
3597
3598 // Support: Promises/A+ section 2.3.4
3599 // https://promisesaplus.com/#point-64
3600 // Only check objects and functions for thenability
3601 ( typeof returned === "object" ||
3602 typeof returned === "function" ) &&
3603 returned.then;
3604
3605 // Handle a returned thenable
3606 if ( jQuery.isFunction( then ) ) {
3607
3608 // Special processors (notify) just wait for resolution
3609 if ( special ) {
3610 then.call(
3611 returned,
3612 resolve( maxDepth, deferred, Identity, special ),
3613 resolve( maxDepth, deferred, Thrower, special )
3614 );
3615
3616 // Normal processors (resolve) also hook into progress
3617 } else {
3618
3619 // ...and disregard older resolution values
3620 maxDepth++;
3621
3622 then.call(
3623 returned,
3624 resolve( maxDepth, deferred, Identity, special ),
3625 resolve( maxDepth, deferred, Thrower, special ),
3626 resolve( maxDepth, deferred, Identity,
3627 deferred.notifyWith )
3628 );
3629 }
3630
3631 // Handle all other returned values
3632 } else {
3633
3634 // Only substitute handlers pass on context
3635 // and multiple values (non-spec behavior)
3636 if ( handler !== Identity ) {
3637 that = undefined;
3638 args = [ returned ];
3639 }
3640
3641 // Process the value(s)
3642 // Default process is resolve
3643 ( special || deferred.resolveWith )( that, args );
3644 }
3645 },
3646
3647 // Only normal processors (resolve) catch and reject exceptions
3648 process = special ?
3649 mightThrow :
3650 function() {
3651 try {
3652 mightThrow();
3653 } catch ( e ) {
3654
3655 if ( jQuery.Deferred.exceptionHook ) {
3656 jQuery.Deferred.exceptionHook( e,
3657 process.stackTrace );
3658 }
3659
3660 // Support: Promises/A+ section 2.3.3.3.4.1
3661 // https://promisesaplus.com/#point-61
3662 // Ignore post-resolution exceptions
3663 if ( depth + 1 >= maxDepth ) {
3664
3665 // Only substitute handlers pass on context
3666 // and multiple values (non-spec behavior)
3667 if ( handler !== Thrower ) {
3668 that = undefined;
3669 args = [ e ];
3670 }
3671
3672 deferred.rejectWith( that, args );
3673 }
3674 }
3675 };
3676
3677 // Support: Promises/A+ section 2.3.3.3.1
3678 // https://promisesaplus.com/#point-57
3679 // Re-resolve promises immediately to dodge false rejection from
3680 // subsequent errors
3681 if ( depth ) {
3682 process();
3683 } else {
3684
3685 // Call an optional hook to record the stack, in case of exception
3686 // since it's otherwise lost when execution goes async
3687 if ( jQuery.Deferred.getStackHook ) {
3688 process.stackTrace = jQuery.Deferred.getStackHook();
3689 }
3690 window.setTimeout( process );
3691 }
3692 };
3693 }
3694
3695 return jQuery.Deferred( function( newDefer ) {
3696
3697 // progress_handlers.add( ... )
3698 tuples[ 0 ][ 3 ].add(
3699 resolve(
3700 0,
3701 newDefer,
3702 jQuery.isFunction( onProgress ) ?
3703 onProgress :
3704 Identity,
3705 newDefer.notifyWith
3706 )
3707 );
3708
3709 // fulfilled_handlers.add( ... )
3710 tuples[ 1 ][ 3 ].add(
3711 resolve(
3712 0,
3713 newDefer,
3714 jQuery.isFunction( onFulfilled ) ?
3715 onFulfilled :
3716 Identity
3717 )
3718 );
3719
3720 // rejected_handlers.add( ... )
3721 tuples[ 2 ][ 3 ].add(
3722 resolve(
3723 0,
3724 newDefer,
3725 jQuery.isFunction( onRejected ) ?
3726 onRejected :
3727 Thrower
3728 )
3729 );
3730 } ).promise();
3731 },
3732
3733 // Get a promise for this deferred
3734 // If obj is provided, the promise aspect is added to the object
3735 promise: function( obj ) {
3736 return obj != null ? jQuery.extend( obj, promise ) : promise;
3737 }
3738 },
3739 deferred = {};
3740
3741 // Add list-specific methods
3742 jQuery.each( tuples, function( i, tuple ) {
3743 var list = tuple[ 2 ],
3744 stateString = tuple[ 5 ];
3745
3746 // promise.progress = list.add
3747 // promise.done = list.add
3748 // promise.fail = list.add
3749 promise[ tuple[ 1 ] ] = list.add;
3750
3751 // Handle state
3752 if ( stateString ) {
3753 list.add(
3754 function() {
3755
3756 // state = "resolved" (i.e., fulfilled)
3757 // state = "rejected"
3758 state = stateString;
3759 },
3760
3761 // rejected_callbacks.disable
3762 // fulfilled_callbacks.disable
3763 tuples[ 3 - i ][ 2 ].disable,
3764
3765 // progress_callbacks.lock
3766 tuples[ 0 ][ 2 ].lock
3767 );
3768 }
3769
3770 // progress_handlers.fire
3771 // fulfilled_handlers.fire
3772 // rejected_handlers.fire
3773 list.add( tuple[ 3 ].fire );
3774
3775 // deferred.notify = function() { deferred.notifyWith(...) }
3776 // deferred.resolve = function() { deferred.resolveWith(...) }
3777 // deferred.reject = function() { deferred.rejectWith(...) }
3778 deferred[ tuple[ 0 ] ] = function() {
3779 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
3780 return this;
3781 };
3782
3783 // deferred.notifyWith = list.fireWith
3784 // deferred.resolveWith = list.fireWith
3785 // deferred.rejectWith = list.fireWith
3786 deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
3787 } );
3788
3789 // Make the deferred a promise
3790 promise.promise( deferred );
3791
3792 // Call given func if any
3793 if ( func ) {
3794 func.call( deferred, deferred );
3795 }
3796
3797 // All done!
3798 return deferred;
3799 },
3800
3801 // Deferred helper
3802 when: function( singleValue ) {
3803 var
3804
3805 // count of uncompleted subordinates
3806 remaining = arguments.length,
3807
3808 // count of unprocessed arguments
3809 i = remaining,
3810
3811 // subordinate fulfillment data
3812 resolveContexts = Array( i ),
3813 resolveValues = slice.call( arguments ),
3814
3815 // the master Deferred
3816 master = jQuery.Deferred(),
3817
3818 // subordinate callback factory
3819 updateFunc = function( i ) {
3820 return function( value ) {
3821 resolveContexts[ i ] = this;
3822 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
3823 if ( !( --remaining ) ) {
3824 master.resolveWith( resolveContexts, resolveValues );
3825 }
3826 };
3827 };
3828
3829 // Single- and empty arguments are adopted like Promise.resolve
3830 if ( remaining <= 1 ) {
3831 adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
3832 !remaining );
3833
3834 // Use .then() to unwrap secondary thenables (cf. gh-3000)
3835 if ( master.state() === "pending" ||
3836 jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
3837
3838 return master.then();
3839 }
3840 }
3841
3842 // Multiple arguments are aggregated like Promise.all array elements
3843 while ( i-- ) {
3844 adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
3845 }
3846
3847 return master.promise();
3848 }
3849} );
3850
3851
3852// These usually indicate a programmer mistake during development,
3853// warn about them ASAP rather than swallowing them by default.
3854var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
3855
3856jQuery.Deferred.exceptionHook = function( error, stack ) {
3857
3858 // Support: IE 8 - 9 only
3859 // Console exists when dev tools are open, which can happen at any time
3860 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
3861 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
3862 }
3863};
3864
3865
3866
3867
3868jQuery.readyException = function( error ) {
3869 window.setTimeout( function() {
3870 throw error;
3871 } );
3872};
3873
3874
3875
3876
3877// The deferred used on DOM ready
3878var readyList = jQuery.Deferred();
3879
3880jQuery.fn.ready = function( fn ) {
3881
3882 readyList
3883 .then( fn )
3884
3885 // Wrap jQuery.readyException in a function so that the lookup
3886 // happens at the time of error handling instead of callback
3887 // registration.
3888 .catch( function( error ) {
3889 jQuery.readyException( error );
3890 } );
3891
3892 return this;
3893};
3894
3895jQuery.extend( {
3896
3897 // Is the DOM ready to be used? Set to true once it occurs.
3898 isReady: false,
3899
3900 // A counter to track how many items to wait for before
3901 // the ready event fires. See #6781
3902 readyWait: 1,
3903
3904 // Handle when the DOM is ready
3905 ready: function( wait ) {
3906
3907 // Abort if there are pending holds or we're already ready
3908 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
3909 return;
3910 }
3911
3912 // Remember that the DOM is ready
3913 jQuery.isReady = true;
3914
3915 // If a normal DOM Ready event fired, decrement, and wait if need be
3916 if ( wait !== true && --jQuery.readyWait > 0 ) {
3917 return;
3918 }
3919
3920 // If there are functions bound, to execute
3921 readyList.resolveWith( document, [ jQuery ] );
3922 }
3923} );
3924
3925jQuery.ready.then = readyList.then;
3926
3927// The ready event handler and self cleanup method
3928function completed() {
3929 document.removeEventListener( "DOMContentLoaded", completed );
3930 window.removeEventListener( "load", completed );
3931 jQuery.ready();
3932}
3933
3934// Catch cases where $(document).ready() is called
3935// after the browser event has already occurred.
3936// Support: IE <=9 - 10 only
3937// Older IE sometimes signals "interactive" too soon
3938if ( document.readyState === "complete" ||
3939 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
3940
3941 // Handle it asynchronously to allow scripts the opportunity to delay ready
3942 window.setTimeout( jQuery.ready );
3943
3944} else {
3945
3946 // Use the handy event callback
3947 document.addEventListener( "DOMContentLoaded", completed );
3948
3949 // A fallback to window.onload, that will always work
3950 window.addEventListener( "load", completed );
3951}
3952
3953
3954
3955
3956// Multifunctional method to get and set values of a collection
3957// The value/s can optionally be executed if it's a function
3958var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
3959 var i = 0,
3960 len = elems.length,
3961 bulk = key == null;
3962
3963 // Sets many values
3964 if ( jQuery.type( key ) === "object" ) {
3965 chainable = true;
3966 for ( i in key ) {
3967 access( elems, fn, i, key[ i ], true, emptyGet, raw );
3968 }
3969
3970 // Sets one value
3971 } else if ( value !== undefined ) {
3972 chainable = true;
3973
3974 if ( !jQuery.isFunction( value ) ) {
3975 raw = true;
3976 }
3977
3978 if ( bulk ) {
3979
3980 // Bulk operations run against the entire set
3981 if ( raw ) {
3982 fn.call( elems, value );
3983 fn = null;
3984
3985 // ...except when executing function values
3986 } else {
3987 bulk = fn;
3988 fn = function( elem, key, value ) {
3989 return bulk.call( jQuery( elem ), value );
3990 };
3991 }
3992 }
3993
3994 if ( fn ) {
3995 for ( ; i < len; i++ ) {
3996 fn(
3997 elems[ i ], key, raw ?
3998 value :
3999 value.call( elems[ i ], i, fn( elems[ i ], key ) )
4000 );
4001 }
4002 }
4003 }
4004
4005 if ( chainable ) {
4006 return elems;
4007 }
4008
4009 // Gets
4010 if ( bulk ) {
4011 return fn.call( elems );
4012 }
4013
4014 return len ? fn( elems[ 0 ], key ) : emptyGet;
4015};
4016var acceptData = function( owner ) {
4017
4018 // Accepts only:
4019 // - Node
4020 // - Node.ELEMENT_NODE
4021 // - Node.DOCUMENT_NODE
4022 // - Object
4023 // - Any
4024 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
4025};
4026
4027
4028
4029
4030function Data() {
4031 this.expando = jQuery.expando + Data.uid++;
4032}
4033
4034Data.uid = 1;
4035
4036Data.prototype = {
4037
4038 cache: function( owner ) {
4039
4040 // Check if the owner object already has a cache
4041 var value = owner[ this.expando ];
4042
4043 // If not, create one
4044 if ( !value ) {
4045 value = {};
4046
4047 // We can accept data for non-element nodes in modern browsers,
4048 // but we should not, see #8335.
4049 // Always return an empty object.
4050 if ( acceptData( owner ) ) {
4051
4052 // If it is a node unlikely to be stringify-ed or looped over
4053 // use plain assignment
4054 if ( owner.nodeType ) {
4055 owner[ this.expando ] = value;
4056
4057 // Otherwise secure it in a non-enumerable property
4058 // configurable must be true to allow the property to be
4059 // deleted when data is removed
4060 } else {
4061 Object.defineProperty( owner, this.expando, {
4062 value: value,
4063 configurable: true
4064 } );
4065 }
4066 }
4067 }
4068
4069 return value;
4070 },
4071 set: function( owner, data, value ) {
4072 var prop,
4073 cache = this.cache( owner );
4074
4075 // Handle: [ owner, key, value ] args
4076 // Always use camelCase key (gh-2257)
4077 if ( typeof data === "string" ) {
4078 cache[ jQuery.camelCase( data ) ] = value;
4079
4080 // Handle: [ owner, { properties } ] args
4081 } else {
4082
4083 // Copy the properties one-by-one to the cache object
4084 for ( prop in data ) {
4085 cache[ jQuery.camelCase( prop ) ] = data[ prop ];
4086 }
4087 }
4088 return cache;
4089 },
4090 get: function( owner, key ) {
4091 return key === undefined ?
4092 this.cache( owner ) :
4093
4094 // Always use camelCase key (gh-2257)
4095 owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ];
4096 },
4097 access: function( owner, key, value ) {
4098
4099 // In cases where either:
4100 //
4101 // 1. No key was specified
4102 // 2. A string key was specified, but no value provided
4103 //
4104 // Take the "read" path and allow the get method to determine
4105 // which value to return, respectively either:
4106 //
4107 // 1. The entire cache object
4108 // 2. The data stored at the key
4109 //
4110 if ( key === undefined ||
4111 ( ( key && typeof key === "string" ) && value === undefined ) ) {
4112
4113 return this.get( owner, key );
4114 }
4115
4116 // When the key is not a string, or both a key and value
4117 // are specified, set or extend (existing objects) with either:
4118 //
4119 // 1. An object of properties
4120 // 2. A key and value
4121 //
4122 this.set( owner, key, value );
4123
4124 // Since the "set" path can have two possible entry points
4125 // return the expected data based on which path was taken[*]
4126 return value !== undefined ? value : key;
4127 },
4128 remove: function( owner, key ) {
4129 var i,
4130 cache = owner[ this.expando ];
4131
4132 if ( cache === undefined ) {
4133 return;
4134 }
4135
4136 if ( key !== undefined ) {
4137
4138 // Support array or space separated string of keys
4139 if ( Array.isArray( key ) ) {
4140
4141 // If key is an array of keys...
4142 // We always set camelCase keys, so remove that.
4143 key = key.map( jQuery.camelCase );
4144 } else {
4145 key = jQuery.camelCase( key );
4146
4147 // If a key with the spaces exists, use it.
4148 // Otherwise, create an array by matching non-whitespace
4149 key = key in cache ?
4150 [ key ] :
4151 ( key.match( rnothtmlwhite ) || [] );
4152 }
4153
4154 i = key.length;
4155
4156 while ( i-- ) {
4157 delete cache[ key[ i ] ];
4158 }
4159 }
4160
4161 // Remove the expando if there's no more data
4162 if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
4163
4164 // Support: Chrome <=35 - 45
4165 // Webkit & Blink performance suffers when deleting properties
4166 // from DOM nodes, so set to undefined instead
4167 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
4168 if ( owner.nodeType ) {
4169 owner[ this.expando ] = undefined;
4170 } else {
4171 delete owner[ this.expando ];
4172 }
4173 }
4174 },
4175 hasData: function( owner ) {
4176 var cache = owner[ this.expando ];
4177 return cache !== undefined && !jQuery.isEmptyObject( cache );
4178 }
4179};
4180var dataPriv = new Data();
4181
4182var dataUser = new Data();
4183
4184
4185
4186// Implementation Summary
4187//
4188// 1. Enforce API surface and semantic compatibility with 1.9.x branch
4189// 2. Improve the module's maintainability by reducing the storage
4190// paths to a single mechanism.
4191// 3. Use the same single mechanism to support "private" and "user" data.
4192// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
4193// 5. Avoid exposing implementation details on user objects (eg. expando properties)
4194// 6. Provide a clear path for implementation upgrade to WeakMap in 2014
4195
4196var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
4197 rmultiDash = /[A-Z]/g;
4198
4199function getData( data ) {
4200 if ( data === "true" ) {
4201 return true;
4202 }
4203
4204 if ( data === "false" ) {
4205 return false;
4206 }
4207
4208 if ( data === "null" ) {
4209 return null;
4210 }
4211
4212 // Only convert to a number if it doesn't change the string
4213 if ( data === +data + "" ) {
4214 return +data;
4215 }
4216
4217 if ( rbrace.test( data ) ) {
4218 return JSON.parse( data );
4219 }
4220
4221 return data;
4222}
4223
4224function dataAttr( elem, key, data ) {
4225 var name;
4226
4227 // If nothing was found internally, try to fetch any
4228 // data from the HTML5 data-* attribute
4229 if ( data === undefined && elem.nodeType === 1 ) {
4230 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
4231 data = elem.getAttribute( name );
4232
4233 if ( typeof data === "string" ) {
4234 try {
4235 data = getData( data );
4236 } catch ( e ) {}
4237
4238 // Make sure we set the data so it isn't changed later
4239 dataUser.set( elem, key, data );
4240 } else {
4241 data = undefined;
4242 }
4243 }
4244 return data;
4245}
4246
4247jQuery.extend( {
4248 hasData: function( elem ) {
4249 return dataUser.hasData( elem ) || dataPriv.hasData( elem );
4250 },
4251
4252 data: function( elem, name, data ) {
4253 return dataUser.access( elem, name, data );
4254 },
4255
4256 removeData: function( elem, name ) {
4257 dataUser.remove( elem, name );
4258 },
4259
4260 // TODO: Now that all calls to _data and _removeData have been replaced
4261 // with direct calls to dataPriv methods, these can be deprecated.
4262 _data: function( elem, name, data ) {
4263 return dataPriv.access( elem, name, data );
4264 },
4265
4266 _removeData: function( elem, name ) {
4267 dataPriv.remove( elem, name );
4268 }
4269} );
4270
4271jQuery.fn.extend( {
4272 data: function( key, value ) {
4273 var i, name, data,
4274 elem = this[ 0 ],
4275 attrs = elem && elem.attributes;
4276
4277 // Gets all values
4278 if ( key === undefined ) {
4279 if ( this.length ) {
4280 data = dataUser.get( elem );
4281
4282 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
4283 i = attrs.length;
4284 while ( i-- ) {
4285
4286 // Support: IE 11 only
4287 // The attrs elements can be null (#14894)
4288 if ( attrs[ i ] ) {
4289 name = attrs[ i ].name;
4290 if ( name.indexOf( "data-" ) === 0 ) {
4291 name = jQuery.camelCase( name.slice( 5 ) );
4292 dataAttr( elem, name, data[ name ] );
4293 }
4294 }
4295 }
4296 dataPriv.set( elem, "hasDataAttrs", true );
4297 }
4298 }
4299
4300 return data;
4301 }
4302
4303 // Sets multiple values
4304 if ( typeof key === "object" ) {
4305 return this.each( function() {
4306 dataUser.set( this, key );
4307 } );
4308 }
4309
4310 return access( this, function( value ) {
4311 var data;
4312
4313 // The calling jQuery object (element matches) is not empty
4314 // (and therefore has an element appears at this[ 0 ]) and the
4315 // `value` parameter was not undefined. An empty jQuery object
4316 // will result in `undefined` for elem = this[ 0 ] which will
4317 // throw an exception if an attempt to read a data cache is made.
4318 if ( elem && value === undefined ) {
4319
4320 // Attempt to get data from the cache
4321 // The key will always be camelCased in Data
4322 data = dataUser.get( elem, key );
4323 if ( data !== undefined ) {
4324 return data;
4325 }
4326
4327 // Attempt to "discover" the data in
4328 // HTML5 custom data-* attrs
4329 data = dataAttr( elem, key );
4330 if ( data !== undefined ) {
4331 return data;
4332 }
4333
4334 // We tried really hard, but the data doesn't exist.
4335 return;
4336 }
4337
4338 // Set the data...
4339 this.each( function() {
4340
4341 // We always store the camelCased key
4342 dataUser.set( this, key, value );
4343 } );
4344 }, null, value, arguments.length > 1, null, true );
4345 },
4346
4347 removeData: function( key ) {
4348 return this.each( function() {
4349 dataUser.remove( this, key );
4350 } );
4351 }
4352} );
4353
4354
4355jQuery.extend( {
4356 queue: function( elem, type, data ) {
4357 var queue;
4358
4359 if ( elem ) {
4360 type = ( type || "fx" ) + "queue";
4361 queue = dataPriv.get( elem, type );
4362
4363 // Speed up dequeue by getting out quickly if this is just a lookup
4364 if ( data ) {
4365 if ( !queue || Array.isArray( data ) ) {
4366 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
4367 } else {
4368 queue.push( data );
4369 }
4370 }
4371 return queue || [];
4372 }
4373 },
4374
4375 dequeue: function( elem, type ) {
4376 type = type || "fx";
4377
4378 var queue = jQuery.queue( elem, type ),
4379 startLength = queue.length,
4380 fn = queue.shift(),
4381 hooks = jQuery._queueHooks( elem, type ),
4382 next = function() {
4383 jQuery.dequeue( elem, type );
4384 };
4385
4386 // If the fx queue is dequeued, always remove the progress sentinel
4387 if ( fn === "inprogress" ) {
4388 fn = queue.shift();
4389 startLength--;
4390 }
4391
4392 if ( fn ) {
4393
4394 // Add a progress sentinel to prevent the fx queue from being
4395 // automatically dequeued
4396 if ( type === "fx" ) {
4397 queue.unshift( "inprogress" );
4398 }
4399
4400 // Clear up the last queue stop function
4401 delete hooks.stop;
4402 fn.call( elem, next, hooks );
4403 }
4404
4405 if ( !startLength && hooks ) {
4406 hooks.empty.fire();
4407 }
4408 },
4409
4410 // Not public - generate a queueHooks object, or return the current one
4411 _queueHooks: function( elem, type ) {
4412 var key = type + "queueHooks";
4413 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
4414 empty: jQuery.Callbacks( "once memory" ).add( function() {
4415 dataPriv.remove( elem, [ type + "queue", key ] );
4416 } )
4417 } );
4418 }
4419} );
4420
4421jQuery.fn.extend( {
4422 queue: function( type, data ) {
4423 var setter = 2;
4424
4425 if ( typeof type !== "string" ) {
4426 data = type;
4427 type = "fx";
4428 setter--;
4429 }
4430
4431 if ( arguments.length < setter ) {
4432 return jQuery.queue( this[ 0 ], type );
4433 }
4434
4435 return data === undefined ?
4436 this :
4437 this.each( function() {
4438 var queue = jQuery.queue( this, type, data );
4439
4440 // Ensure a hooks for this queue
4441 jQuery._queueHooks( this, type );
4442
4443 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
4444 jQuery.dequeue( this, type );
4445 }
4446 } );
4447 },
4448 dequeue: function( type ) {
4449 return this.each( function() {
4450 jQuery.dequeue( this, type );
4451 } );
4452 },
4453 clearQueue: function( type ) {
4454 return this.queue( type || "fx", [] );
4455 },
4456
4457 // Get a promise resolved when queues of a certain type
4458 // are emptied (fx is the type by default)
4459 promise: function( type, obj ) {
4460 var tmp,
4461 count = 1,
4462 defer = jQuery.Deferred(),
4463 elements = this,
4464 i = this.length,
4465 resolve = function() {
4466 if ( !( --count ) ) {
4467 defer.resolveWith( elements, [ elements ] );
4468 }
4469 };
4470
4471 if ( typeof type !== "string" ) {
4472 obj = type;
4473 type = undefined;
4474 }
4475 type = type || "fx";
4476
4477 while ( i-- ) {
4478 tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
4479 if ( tmp && tmp.empty ) {
4480 count++;
4481 tmp.empty.add( resolve );
4482 }
4483 }
4484 resolve();
4485 return defer.promise( obj );
4486 }
4487} );
4488var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
4489
4490var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
4491
4492
4493var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
4494
4495var isHiddenWithinTree = function( elem, el ) {
4496
4497 // isHiddenWithinTree might be called from jQuery#filter function;
4498 // in that case, element will be second argument
4499 elem = el || elem;
4500
4501 // Inline style trumps all
4502 return elem.style.display === "none" ||
4503 elem.style.display === "" &&
4504
4505 // Otherwise, check computed style
4506 // Support: Firefox <=43 - 45
4507 // Disconnected elements can have computed display: none, so first confirm that elem is
4508 // in the document.
4509 jQuery.contains( elem.ownerDocument, elem ) &&
4510
4511 jQuery.css( elem, "display" ) === "none";
4512 };
4513
4514var swap = function( elem, options, callback, args ) {
4515 var ret, name,
4516 old = {};
4517
4518 // Remember the old values, and insert the new ones
4519 for ( name in options ) {
4520 old[ name ] = elem.style[ name ];
4521 elem.style[ name ] = options[ name ];
4522 }
4523
4524 ret = callback.apply( elem, args || [] );
4525
4526 // Revert the old values
4527 for ( name in options ) {
4528 elem.style[ name ] = old[ name ];
4529 }
4530
4531 return ret;
4532};
4533
4534
4535
4536
4537function adjustCSS( elem, prop, valueParts, tween ) {
4538 var adjusted,
4539 scale = 1,
4540 maxIterations = 20,
4541 currentValue = tween ?
4542 function() {
4543 return tween.cur();
4544 } :
4545 function() {
4546 return jQuery.css( elem, prop, "" );
4547 },
4548 initial = currentValue(),
4549 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
4550
4551 // Starting value computation is required for potential unit mismatches
4552 initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
4553 rcssNum.exec( jQuery.css( elem, prop ) );
4554
4555 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
4556
4557 // Trust units reported by jQuery.css
4558 unit = unit || initialInUnit[ 3 ];
4559
4560 // Make sure we update the tween properties later on
4561 valueParts = valueParts || [];
4562
4563 // Iteratively approximate from a nonzero starting point
4564 initialInUnit = +initial || 1;
4565
4566 do {
4567
4568 // If previous iteration zeroed out, double until we get *something*.
4569 // Use string for doubling so we don't accidentally see scale as unchanged below
4570 scale = scale || ".5";
4571
4572 // Adjust and apply
4573 initialInUnit = initialInUnit / scale;
4574 jQuery.style( elem, prop, initialInUnit + unit );
4575
4576 // Update scale, tolerating zero or NaN from tween.cur()
4577 // Break the loop if scale is unchanged or perfect, or if we've just had enough.
4578 } while (
4579 scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
4580 );
4581 }
4582
4583 if ( valueParts ) {
4584 initialInUnit = +initialInUnit || +initial || 0;
4585
4586 // Apply relative offset (+=/-=) if specified
4587 adjusted = valueParts[ 1 ] ?
4588 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
4589 +valueParts[ 2 ];
4590 if ( tween ) {
4591 tween.unit = unit;
4592 tween.start = initialInUnit;
4593 tween.end = adjusted;
4594 }
4595 }
4596 return adjusted;
4597}
4598
4599
4600var defaultDisplayMap = {};
4601
4602function getDefaultDisplay( elem ) {
4603 var temp,
4604 doc = elem.ownerDocument,
4605 nodeName = elem.nodeName,
4606 display = defaultDisplayMap[ nodeName ];
4607
4608 if ( display ) {
4609 return display;
4610 }
4611
4612 temp = doc.body.appendChild( doc.createElement( nodeName ) );
4613 display = jQuery.css( temp, "display" );
4614
4615 temp.parentNode.removeChild( temp );
4616
4617 if ( display === "none" ) {
4618 display = "block";
4619 }
4620 defaultDisplayMap[ nodeName ] = display;
4621
4622 return display;
4623}
4624
4625function showHide( elements, show ) {
4626 var display, elem,
4627 values = [],
4628 index = 0,
4629 length = elements.length;
4630
4631 // Determine new display value for elements that need to change
4632 for ( ; index < length; index++ ) {
4633 elem = elements[ index ];
4634 if ( !elem.style ) {
4635 continue;
4636 }
4637
4638 display = elem.style.display;
4639 if ( show ) {
4640
4641 // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
4642 // check is required in this first loop unless we have a nonempty display value (either
4643 // inline or about-to-be-restored)
4644 if ( display === "none" ) {
4645 values[ index ] = dataPriv.get( elem, "display" ) || null;
4646 if ( !values[ index ] ) {
4647 elem.style.display = "";
4648 }
4649 }
4650 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
4651 values[ index ] = getDefaultDisplay( elem );
4652 }
4653 } else {
4654 if ( display !== "none" ) {
4655 values[ index ] = "none";
4656
4657 // Remember what we're overwriting
4658 dataPriv.set( elem, "display", display );
4659 }
4660 }
4661 }
4662
4663 // Set the display of the elements in a second loop to avoid constant reflow
4664 for ( index = 0; index < length; index++ ) {
4665 if ( values[ index ] != null ) {
4666 elements[ index ].style.display = values[ index ];
4667 }
4668 }
4669
4670 return elements;
4671}
4672
4673jQuery.fn.extend( {
4674 show: function() {
4675 return showHide( this, true );
4676 },
4677 hide: function() {
4678 return showHide( this );
4679 },
4680 toggle: function( state ) {
4681 if ( typeof state === "boolean" ) {
4682 return state ? this.show() : this.hide();
4683 }
4684
4685 return this.each( function() {
4686 if ( isHiddenWithinTree( this ) ) {
4687 jQuery( this ).show();
4688 } else {
4689 jQuery( this ).hide();
4690 }
4691 } );
4692 }
4693} );
4694var rcheckableType = ( /^(?:checkbox|radio)$/i );
4695
4696var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
4697
4698var rscriptType = ( /^$|\/(?:java|ecma)script/i );
4699
4700
4701
4702// We have to close these tags to support XHTML (#13200)
4703var wrapMap = {
4704
4705 // Support: IE <=9 only
4706 option: [ 1, "<select multiple='multiple'>", "</select>" ],
4707
4708 // XHTML parsers do not magically insert elements in the
4709 // same way that tag soup parsers do. So we cannot shorten
4710 // this by omitting <tbody> or other required elements.
4711 thead: [ 1, "<table>", "</table>" ],
4712 col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
4713 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
4714 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
4715
4716 _default: [ 0, "", "" ]
4717};
4718
4719// Support: IE <=9 only
4720wrapMap.optgroup = wrapMap.option;
4721
4722wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
4723wrapMap.th = wrapMap.td;
4724
4725
4726function getAll( context, tag ) {
4727
4728 // Support: IE <=9 - 11 only
4729 // Use typeof to avoid zero-argument method invocation on host objects (#15151)
4730 var ret;
4731
4732 if ( typeof context.getElementsByTagName !== "undefined" ) {
4733 ret = context.getElementsByTagName( tag || "*" );
4734
4735 } else if ( typeof context.querySelectorAll !== "undefined" ) {
4736 ret = context.querySelectorAll( tag || "*" );
4737
4738 } else {
4739 ret = [];
4740 }
4741
4742 if ( tag === undefined || tag && nodeName( context, tag ) ) {
4743 return jQuery.merge( [ context ], ret );
4744 }
4745
4746 return ret;
4747}
4748
4749
4750// Mark scripts as having already been evaluated
4751function setGlobalEval( elems, refElements ) {
4752 var i = 0,
4753 l = elems.length;
4754
4755 for ( ; i < l; i++ ) {
4756 dataPriv.set(
4757 elems[ i ],
4758 "globalEval",
4759 !refElements || dataPriv.get( refElements[ i ], "globalEval" )
4760 );
4761 }
4762}
4763
4764
4765var rhtml = /<|&#?\w+;/;
4766
4767function buildFragment( elems, context, scripts, selection, ignored ) {
4768 var elem, tmp, tag, wrap, contains, j,
4769 fragment = context.createDocumentFragment(),
4770 nodes = [],
4771 i = 0,
4772 l = elems.length;
4773
4774 for ( ; i < l; i++ ) {
4775 elem = elems[ i ];
4776
4777 if ( elem || elem === 0 ) {
4778
4779 // Add nodes directly
4780 if ( jQuery.type( elem ) === "object" ) {
4781
4782 // Support: Android <=4.0 only, PhantomJS 1 only
4783 // push.apply(_, arraylike) throws on ancient WebKit
4784 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
4785
4786 // Convert non-html into a text node
4787 } else if ( !rhtml.test( elem ) ) {
4788 nodes.push( context.createTextNode( elem ) );
4789
4790 // Convert html into DOM nodes
4791 } else {
4792 tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
4793
4794 // Deserialize a standard representation
4795 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
4796 wrap = wrapMap[ tag ] || wrapMap._default;
4797 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
4798
4799 // Descend through wrappers to the right content
4800 j = wrap[ 0 ];
4801 while ( j-- ) {
4802 tmp = tmp.lastChild;
4803 }
4804
4805 // Support: Android <=4.0 only, PhantomJS 1 only
4806 // push.apply(_, arraylike) throws on ancient WebKit
4807 jQuery.merge( nodes, tmp.childNodes );
4808
4809 // Remember the top-level container
4810 tmp = fragment.firstChild;
4811
4812 // Ensure the created nodes are orphaned (#12392)
4813 tmp.textContent = "";
4814 }
4815 }
4816 }
4817
4818 // Remove wrapper from fragment
4819 fragment.textContent = "";
4820
4821 i = 0;
4822 while ( ( elem = nodes[ i++ ] ) ) {
4823
4824 // Skip elements already in the context collection (trac-4087)
4825 if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
4826 if ( ignored ) {
4827 ignored.push( elem );
4828 }
4829 continue;
4830 }
4831
4832 contains = jQuery.contains( elem.ownerDocument, elem );
4833
4834 // Append to fragment
4835 tmp = getAll( fragment.appendChild( elem ), "script" );
4836
4837 // Preserve script evaluation history
4838 if ( contains ) {
4839 setGlobalEval( tmp );
4840 }
4841
4842 // Capture executables
4843 if ( scripts ) {
4844 j = 0;
4845 while ( ( elem = tmp[ j++ ] ) ) {
4846 if ( rscriptType.test( elem.type || "" ) ) {
4847 scripts.push( elem );
4848 }
4849 }
4850 }
4851 }
4852
4853 return fragment;
4854}
4855
4856
4857( function() {
4858 var fragment = document.createDocumentFragment(),
4859 div = fragment.appendChild( document.createElement( "div" ) ),
4860 input = document.createElement( "input" );
4861
4862 // Support: Android 4.0 - 4.3 only
4863 // Check state lost if the name is set (#11217)
4864 // Support: Windows Web Apps (WWA)
4865 // `name` and `type` must use .setAttribute for WWA (#14901)
4866 input.setAttribute( "type", "radio" );
4867 input.setAttribute( "checked", "checked" );
4868 input.setAttribute( "name", "t" );
4869
4870 div.appendChild( input );
4871
4872 // Support: Android <=4.1 only
4873 // Older WebKit doesn't clone checked state correctly in fragments
4874 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
4875
4876 // Support: IE <=11 only
4877 // Make sure textarea (and checkbox) defaultValue is properly cloned
4878 div.innerHTML = "<textarea>x</textarea>";
4879 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
4880} )();
4881var documentElement = document.documentElement;
4882
4883
4884
4885var
4886 rkeyEvent = /^key/,
4887 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
4888 rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
4889
4890function returnTrue() {
4891 return true;
4892}
4893
4894function returnFalse() {
4895 return false;
4896}
4897
4898// Support: IE <=9 only
4899// See #13393 for more info
4900function safeActiveElement() {
4901 try {
4902 return document.activeElement;
4903 } catch ( err ) { }
4904}
4905
4906function on( elem, types, selector, data, fn, one ) {
4907 var origFn, type;
4908
4909 // Types can be a map of types/handlers
4910 if ( typeof types === "object" ) {
4911
4912 // ( types-Object, selector, data )
4913 if ( typeof selector !== "string" ) {
4914
4915 // ( types-Object, data )
4916 data = data || selector;
4917 selector = undefined;
4918 }
4919 for ( type in types ) {
4920 on( elem, type, selector, data, types[ type ], one );
4921 }
4922 return elem;
4923 }
4924
4925 if ( data == null && fn == null ) {
4926
4927 // ( types, fn )
4928 fn = selector;
4929 data = selector = undefined;
4930 } else if ( fn == null ) {
4931 if ( typeof selector === "string" ) {
4932
4933 // ( types, selector, fn )
4934 fn = data;
4935 data = undefined;
4936 } else {
4937
4938 // ( types, data, fn )
4939 fn = data;
4940 data = selector;
4941 selector = undefined;
4942 }
4943 }
4944 if ( fn === false ) {
4945 fn = returnFalse;
4946 } else if ( !fn ) {
4947 return elem;
4948 }
4949
4950 if ( one === 1 ) {
4951 origFn = fn;
4952 fn = function( event ) {
4953
4954 // Can use an empty set, since event contains the info
4955 jQuery().off( event );
4956 return origFn.apply( this, arguments );
4957 };
4958
4959 // Use same guid so caller can remove using origFn
4960 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
4961 }
4962 return elem.each( function() {
4963 jQuery.event.add( this, types, fn, data, selector );
4964 } );
4965}
4966
4967/*
4968 * Helper functions for managing events -- not part of the public interface.
4969 * Props to Dean Edwards' addEvent library for many of the ideas.
4970 */
4971jQuery.event = {
4972
4973 global: {},
4974
4975 add: function( elem, types, handler, data, selector ) {
4976
4977 var handleObjIn, eventHandle, tmp,
4978 events, t, handleObj,
4979 special, handlers, type, namespaces, origType,
4980 elemData = dataPriv.get( elem );
4981
4982 // Don't attach events to noData or text/comment nodes (but allow plain objects)
4983 if ( !elemData ) {
4984 return;
4985 }
4986
4987 // Caller can pass in an object of custom data in lieu of the handler
4988 if ( handler.handler ) {
4989 handleObjIn = handler;
4990 handler = handleObjIn.handler;
4991 selector = handleObjIn.selector;
4992 }
4993
4994 // Ensure that invalid selectors throw exceptions at attach time
4995 // Evaluate against documentElement in case elem is a non-element node (e.g., document)
4996 if ( selector ) {
4997 jQuery.find.matchesSelector( documentElement, selector );
4998 }
4999
5000 // Make sure that the handler has a unique ID, used to find/remove it later
5001 if ( !handler.guid ) {
5002 handler.guid = jQuery.guid++;
5003 }
5004
5005 // Init the element's event structure and main handler, if this is the first
5006 if ( !( events = elemData.events ) ) {
5007 events = elemData.events = {};
5008 }
5009 if ( !( eventHandle = elemData.handle ) ) {
5010 eventHandle = elemData.handle = function( e ) {
5011
5012 // Discard the second event of a jQuery.event.trigger() and
5013 // when an event is called after a page has unloaded
5014 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
5015 jQuery.event.dispatch.apply( elem, arguments ) : undefined;
5016 };
5017 }
5018
5019 // Handle multiple events separated by a space
5020 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
5021 t = types.length;
5022 while ( t-- ) {
5023 tmp = rtypenamespace.exec( types[ t ] ) || [];
5024 type = origType = tmp[ 1 ];
5025 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
5026
5027 // There *must* be a type, no attaching namespace-only handlers
5028 if ( !type ) {
5029 continue;
5030 }
5031
5032 // If event changes its type, use the special event handlers for the changed type
5033 special = jQuery.event.special[ type ] || {};
5034
5035 // If selector defined, determine special event api type, otherwise given type
5036 type = ( selector ? special.delegateType : special.bindType ) || type;
5037
5038 // Update special based on newly reset type
5039 special = jQuery.event.special[ type ] || {};
5040
5041 // handleObj is passed to all event handlers
5042 handleObj = jQuery.extend( {
5043 type: type,
5044 origType: origType,
5045 data: data,
5046 handler: handler,
5047 guid: handler.guid,
5048 selector: selector,
5049 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
5050 namespace: namespaces.join( "." )
5051 }, handleObjIn );
5052
5053 // Init the event handler queue if we're the first
5054 if ( !( handlers = events[ type ] ) ) {
5055 handlers = events[ type ] = [];
5056 handlers.delegateCount = 0;
5057
5058 // Only use addEventListener if the special events handler returns false
5059 if ( !special.setup ||
5060 special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
5061
5062 if ( elem.addEventListener ) {
5063 elem.addEventListener( type, eventHandle );
5064 }
5065 }
5066 }
5067
5068 if ( special.add ) {
5069 special.add.call( elem, handleObj );
5070
5071 if ( !handleObj.handler.guid ) {
5072 handleObj.handler.guid = handler.guid;
5073 }
5074 }
5075
5076 // Add to the element's handler list, delegates in front
5077 if ( selector ) {
5078 handlers.splice( handlers.delegateCount++, 0, handleObj );
5079 } else {
5080 handlers.push( handleObj );
5081 }
5082
5083 // Keep track of which events have ever been used, for event optimization
5084 jQuery.event.global[ type ] = true;
5085 }
5086
5087 },
5088
5089 // Detach an event or set of events from an element
5090 remove: function( elem, types, handler, selector, mappedTypes ) {
5091
5092 var j, origCount, tmp,
5093 events, t, handleObj,
5094 special, handlers, type, namespaces, origType,
5095 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
5096
5097 if ( !elemData || !( events = elemData.events ) ) {
5098 return;
5099 }
5100
5101 // Once for each type.namespace in types; type may be omitted
5102 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
5103 t = types.length;
5104 while ( t-- ) {
5105 tmp = rtypenamespace.exec( types[ t ] ) || [];
5106 type = origType = tmp[ 1 ];
5107 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
5108
5109 // Unbind all events (on this namespace, if provided) for the element
5110 if ( !type ) {
5111 for ( type in events ) {
5112 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
5113 }
5114 continue;
5115 }
5116
5117 special = jQuery.event.special[ type ] || {};
5118 type = ( selector ? special.delegateType : special.bindType ) || type;
5119 handlers = events[ type ] || [];
5120 tmp = tmp[ 2 ] &&
5121 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
5122
5123 // Remove matching events
5124 origCount = j = handlers.length;
5125 while ( j-- ) {
5126 handleObj = handlers[ j ];
5127
5128 if ( ( mappedTypes || origType === handleObj.origType ) &&
5129 ( !handler || handler.guid === handleObj.guid ) &&
5130 ( !tmp || tmp.test( handleObj.namespace ) ) &&
5131 ( !selector || selector === handleObj.selector ||
5132 selector === "**" && handleObj.selector ) ) {
5133 handlers.splice( j, 1 );
5134
5135 if ( handleObj.selector ) {
5136 handlers.delegateCount--;
5137 }
5138 if ( special.remove ) {
5139 special.remove.call( elem, handleObj );
5140 }
5141 }
5142 }
5143
5144 // Remove generic event handler if we removed something and no more handlers exist
5145 // (avoids potential for endless recursion during removal of special event handlers)
5146 if ( origCount && !handlers.length ) {
5147 if ( !special.teardown ||
5148 special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
5149
5150 jQuery.removeEvent( elem, type, elemData.handle );
5151 }
5152
5153 delete events[ type ];
5154 }
5155 }
5156
5157 // Remove data and the expando if it's no longer used
5158 if ( jQuery.isEmptyObject( events ) ) {
5159 dataPriv.remove( elem, "handle events" );
5160 }
5161 },
5162
5163 dispatch: function( nativeEvent ) {
5164
5165 // Make a writable jQuery.Event from the native event object
5166 var event = jQuery.event.fix( nativeEvent );
5167
5168 var i, j, ret, matched, handleObj, handlerQueue,
5169 args = new Array( arguments.length ),
5170 handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
5171 special = jQuery.event.special[ event.type ] || {};
5172
5173 // Use the fix-ed jQuery.Event rather than the (read-only) native event
5174 args[ 0 ] = event;
5175
5176 for ( i = 1; i < arguments.length; i++ ) {
5177 args[ i ] = arguments[ i ];
5178 }
5179
5180 event.delegateTarget = this;
5181
5182 // Call the preDispatch hook for the mapped type, and let it bail if desired
5183 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
5184 return;
5185 }
5186
5187 // Determine handlers
5188 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
5189
5190 // Run delegates first; they may want to stop propagation beneath us
5191 i = 0;
5192 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
5193 event.currentTarget = matched.elem;
5194
5195 j = 0;
5196 while ( ( handleObj = matched.handlers[ j++ ] ) &&
5197 !event.isImmediatePropagationStopped() ) {
5198
5199 // Triggered event must either 1) have no namespace, or 2) have namespace(s)
5200 // a subset or equal to those in the bound event (both can have no namespace).
5201 if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
5202
5203 event.handleObj = handleObj;
5204 event.data = handleObj.data;
5205
5206 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
5207 handleObj.handler ).apply( matched.elem, args );
5208
5209 if ( ret !== undefined ) {
5210 if ( ( event.result = ret ) === false ) {
5211 event.preventDefault();
5212 event.stopPropagation();
5213 }
5214 }
5215 }
5216 }
5217 }
5218
5219 // Call the postDispatch hook for the mapped type
5220 if ( special.postDispatch ) {
5221 special.postDispatch.call( this, event );
5222 }
5223
5224 return event.result;
5225 },
5226
5227 handlers: function( event, handlers ) {
5228 var i, handleObj, sel, matchedHandlers, matchedSelectors,
5229 handlerQueue = [],
5230 delegateCount = handlers.delegateCount,
5231 cur = event.target;
5232
5233 // Find delegate handlers
5234 if ( delegateCount &&
5235
5236 // Support: IE <=9
5237 // Black-hole SVG <use> instance trees (trac-13180)
5238 cur.nodeType &&
5239
5240 // Support: Firefox <=42
5241 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
5242 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
5243 // Support: IE 11 only
5244 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
5245 !( event.type === "click" && event.button >= 1 ) ) {
5246
5247 for ( ; cur !== this; cur = cur.parentNode || this ) {
5248
5249 // Don't check non-elements (#13208)
5250 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
5251 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
5252 matchedHandlers = [];
5253 matchedSelectors = {};
5254 for ( i = 0; i < delegateCount; i++ ) {
5255 handleObj = handlers[ i ];
5256
5257 // Don't conflict with Object.prototype properties (#13203)
5258 sel = handleObj.selector + " ";
5259
5260 if ( matchedSelectors[ sel ] === undefined ) {
5261 matchedSelectors[ sel ] = handleObj.needsContext ?
5262 jQuery( sel, this ).index( cur ) > -1 :
5263 jQuery.find( sel, this, null, [ cur ] ).length;
5264 }
5265 if ( matchedSelectors[ sel ] ) {
5266 matchedHandlers.push( handleObj );
5267 }
5268 }
5269 if ( matchedHandlers.length ) {
5270 handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
5271 }
5272 }
5273 }
5274 }
5275
5276 // Add the remaining (directly-bound) handlers
5277 cur = this;
5278 if ( delegateCount < handlers.length ) {
5279 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
5280 }
5281
5282 return handlerQueue;
5283 },
5284
5285 addProp: function( name, hook ) {
5286 Object.defineProperty( jQuery.Event.prototype, name, {
5287 enumerable: true,
5288 configurable: true,
5289
5290 get: jQuery.isFunction( hook ) ?
5291 function() {
5292 if ( this.originalEvent ) {
5293 return hook( this.originalEvent );
5294 }
5295 } :
5296 function() {
5297 if ( this.originalEvent ) {
5298 return this.originalEvent[ name ];
5299 }
5300 },
5301
5302 set: function( value ) {
5303 Object.defineProperty( this, name, {
5304 enumerable: true,
5305 configurable: true,
5306 writable: true,
5307 value: value
5308 } );
5309 }
5310 } );
5311 },
5312
5313 fix: function( originalEvent ) {
5314 return originalEvent[ jQuery.expando ] ?
5315 originalEvent :
5316 new jQuery.Event( originalEvent );
5317 },
5318
5319 special: {
5320 load: {
5321
5322 // Prevent triggered image.load events from bubbling to window.load
5323 noBubble: true
5324 },
5325 focus: {
5326
5327 // Fire native event if possible so blur/focus sequence is correct
5328 trigger: function() {
5329 if ( this !== safeActiveElement() && this.focus ) {
5330 this.focus();
5331 return false;
5332 }
5333 },
5334 delegateType: "focusin"
5335 },
5336 blur: {
5337 trigger: function() {
5338 if ( this === safeActiveElement() && this.blur ) {
5339 this.blur();
5340 return false;
5341 }
5342 },
5343 delegateType: "focusout"
5344 },
5345 click: {
5346
5347 // For checkbox, fire native event so checked state will be right
5348 trigger: function() {
5349 if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
5350 this.click();
5351 return false;
5352 }
5353 },
5354
5355 // For cross-browser consistency, don't fire native .click() on links
5356 _default: function( event ) {
5357 return nodeName( event.target, "a" );
5358 }
5359 },
5360
5361 beforeunload: {
5362 postDispatch: function( event ) {
5363
5364 // Support: Firefox 20+
5365 // Firefox doesn't alert if the returnValue field is not set.
5366 if ( event.result !== undefined && event.originalEvent ) {
5367 event.originalEvent.returnValue = event.result;
5368 }
5369 }
5370 }
5371 }
5372};
5373
5374jQuery.removeEvent = function( elem, type, handle ) {
5375
5376 // This "if" is needed for plain objects
5377 if ( elem.removeEventListener ) {
5378 elem.removeEventListener( type, handle );
5379 }
5380};
5381
5382jQuery.Event = function( src, props ) {
5383
5384 // Allow instantiation without the 'new' keyword
5385 if ( !( this instanceof jQuery.Event ) ) {
5386 return new jQuery.Event( src, props );
5387 }
5388
5389 // Event object
5390 if ( src && src.type ) {
5391 this.originalEvent = src;
5392 this.type = src.type;
5393
5394 // Events bubbling up the document may have been marked as prevented
5395 // by a handler lower down the tree; reflect the correct value.
5396 this.isDefaultPrevented = src.defaultPrevented ||
5397 src.defaultPrevented === undefined &&
5398
5399 // Support: Android <=2.3 only
5400 src.returnValue === false ?
5401 returnTrue :
5402 returnFalse;
5403
5404 // Create target properties
5405 // Support: Safari <=6 - 7 only
5406 // Target should not be a text node (#504, #13143)
5407 this.target = ( src.target && src.target.nodeType === 3 ) ?
5408 src.target.parentNode :
5409 src.target;
5410
5411 this.currentTarget = src.currentTarget;
5412 this.relatedTarget = src.relatedTarget;
5413
5414 // Event type
5415 } else {
5416 this.type = src;
5417 }
5418
5419 // Put explicitly provided properties onto the event object
5420 if ( props ) {
5421 jQuery.extend( this, props );
5422 }
5423
5424 // Create a timestamp if incoming event doesn't have one
5425 this.timeStamp = src && src.timeStamp || jQuery.now();
5426
5427 // Mark it as fixed
5428 this[ jQuery.expando ] = true;
5429};
5430
5431// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
5432// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
5433jQuery.Event.prototype = {
5434 constructor: jQuery.Event,
5435 isDefaultPrevented: returnFalse,
5436 isPropagationStopped: returnFalse,
5437 isImmediatePropagationStopped: returnFalse,
5438 isSimulated: false,
5439
5440 preventDefault: function() {
5441 var e = this.originalEvent;
5442
5443 this.isDefaultPrevented = returnTrue;
5444
5445 if ( e && !this.isSimulated ) {
5446 e.preventDefault();
5447 }
5448 },
5449 stopPropagation: function() {
5450 var e = this.originalEvent;
5451
5452 this.isPropagationStopped = returnTrue;
5453
5454 if ( e && !this.isSimulated ) {
5455 e.stopPropagation();
5456 }
5457 },
5458 stopImmediatePropagation: function() {
5459 var e = this.originalEvent;
5460
5461 this.isImmediatePropagationStopped = returnTrue;
5462
5463 if ( e && !this.isSimulated ) {
5464 e.stopImmediatePropagation();
5465 }
5466
5467 this.stopPropagation();
5468 }
5469};
5470
5471// Includes all common event props including KeyEvent and MouseEvent specific props
5472jQuery.each( {
5473 altKey: true,
5474 bubbles: true,
5475 cancelable: true,
5476 changedTouches: true,
5477 ctrlKey: true,
5478 detail: true,
5479 eventPhase: true,
5480 metaKey: true,
5481 pageX: true,
5482 pageY: true,
5483 shiftKey: true,
5484 view: true,
5485 "char": true,
5486 charCode: true,
5487 key: true,
5488 keyCode: true,
5489 button: true,
5490 buttons: true,
5491 clientX: true,
5492 clientY: true,
5493 offsetX: true,
5494 offsetY: true,
5495 pointerId: true,
5496 pointerType: true,
5497 screenX: true,
5498 screenY: true,
5499 targetTouches: true,
5500 toElement: true,
5501 touches: true,
5502
5503 which: function( event ) {
5504 var button = event.button;
5505
5506 // Add which for key events
5507 if ( event.which == null && rkeyEvent.test( event.type ) ) {
5508 return event.charCode != null ? event.charCode : event.keyCode;
5509 }
5510
5511 // Add which for click: 1 === left; 2 === middle; 3 === right
5512 if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
5513 if ( button & 1 ) {
5514 return 1;
5515 }
5516
5517 if ( button & 2 ) {
5518 return 3;
5519 }
5520
5521 if ( button & 4 ) {
5522 return 2;
5523 }
5524
5525 return 0;
5526 }
5527
5528 return event.which;
5529 }
5530}, jQuery.event.addProp );
5531
5532// Create mouseenter/leave events using mouseover/out and event-time checks
5533// so that event delegation works in jQuery.
5534// Do the same for pointerenter/pointerleave and pointerover/pointerout
5535//
5536// Support: Safari 7 only
5537// Safari sends mouseenter too often; see:
5538// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
5539// for the description of the bug (it existed in older Chrome versions as well).
5540jQuery.each( {
5541 mouseenter: "mouseover",
5542 mouseleave: "mouseout",
5543 pointerenter: "pointerover",
5544 pointerleave: "pointerout"
5545}, function( orig, fix ) {
5546 jQuery.event.special[ orig ] = {
5547 delegateType: fix,
5548 bindType: fix,
5549
5550 handle: function( event ) {
5551 var ret,
5552 target = this,
5553 related = event.relatedTarget,
5554 handleObj = event.handleObj;
5555
5556 // For mouseenter/leave call the handler if related is outside the target.
5557 // NB: No relatedTarget if the mouse left/entered the browser window
5558 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
5559 event.type = handleObj.origType;
5560 ret = handleObj.handler.apply( this, arguments );
5561 event.type = fix;
5562 }
5563 return ret;
5564 }
5565 };
5566} );
5567
5568jQuery.fn.extend( {
5569
5570 on: function( types, selector, data, fn ) {
5571 return on( this, types, selector, data, fn );
5572 },
5573 one: function( types, selector, data, fn ) {
5574 return on( this, types, selector, data, fn, 1 );
5575 },
5576 off: function( types, selector, fn ) {
5577 var handleObj, type;
5578 if ( types && types.preventDefault && types.handleObj ) {
5579
5580 // ( event ) dispatched jQuery.Event
5581 handleObj = types.handleObj;
5582 jQuery( types.delegateTarget ).off(
5583 handleObj.namespace ?
5584 handleObj.origType + "." + handleObj.namespace :
5585 handleObj.origType,
5586 handleObj.selector,
5587 handleObj.handler
5588 );
5589 return this;
5590 }
5591 if ( typeof types === "object" ) {
5592
5593 // ( types-object [, selector] )
5594 for ( type in types ) {
5595 this.off( type, selector, types[ type ] );
5596 }
5597 return this;
5598 }
5599 if ( selector === false || typeof selector === "function" ) {
5600
5601 // ( types [, fn] )
5602 fn = selector;
5603 selector = undefined;
5604 }
5605 if ( fn === false ) {
5606 fn = returnFalse;
5607 }
5608 return this.each( function() {
5609 jQuery.event.remove( this, types, fn, selector );
5610 } );
5611 }
5612} );
5613
5614
5615var
5616
5617 /* eslint-disable max-len */
5618
5619 // See https://github.com/eslint/eslint/issues/3229
5620 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
5621
5622 /* eslint-enable */
5623
5624 // Support: IE <=10 - 11, Edge 12 - 13
5625 // In IE/Edge using regex groups here causes severe slowdowns.
5626 // See https://connect.microsoft.com/IE/feedback/details/1736512/
5627 rnoInnerhtml = /<script|<style|<link/i,
5628
5629 // checked="checked" or checked
5630 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5631 rscriptTypeMasked = /^true\/(.*)/,
5632 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
5633
5634// Prefer a tbody over its parent table for containing new rows
5635function manipulationTarget( elem, content ) {
5636 if ( nodeName( elem, "table" ) &&
5637 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
5638
5639 return jQuery( ">tbody", elem )[ 0 ] || elem;
5640 }
5641
5642 return elem;
5643}
5644
5645// Replace/restore the type attribute of script elements for safe DOM manipulation
5646function disableScript( elem ) {
5647 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
5648 return elem;
5649}
5650function restoreScript( elem ) {
5651 var match = rscriptTypeMasked.exec( elem.type );
5652
5653 if ( match ) {
5654 elem.type = match[ 1 ];
5655 } else {
5656 elem.removeAttribute( "type" );
5657 }
5658
5659 return elem;
5660}
5661
5662function cloneCopyEvent( src, dest ) {
5663 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
5664
5665 if ( dest.nodeType !== 1 ) {
5666 return;
5667 }
5668
5669 // 1. Copy private data: events, handlers, etc.
5670 if ( dataPriv.hasData( src ) ) {
5671 pdataOld = dataPriv.access( src );
5672 pdataCur = dataPriv.set( dest, pdataOld );
5673 events = pdataOld.events;
5674
5675 if ( events ) {
5676 delete pdataCur.handle;
5677 pdataCur.events = {};
5678
5679 for ( type in events ) {
5680 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
5681 jQuery.event.add( dest, type, events[ type ][ i ] );
5682 }
5683 }
5684 }
5685 }
5686
5687 // 2. Copy user data
5688 if ( dataUser.hasData( src ) ) {
5689 udataOld = dataUser.access( src );
5690 udataCur = jQuery.extend( {}, udataOld );
5691
5692 dataUser.set( dest, udataCur );
5693 }
5694}
5695
5696// Fix IE bugs, see support tests
5697function fixInput( src, dest ) {
5698 var nodeName = dest.nodeName.toLowerCase();
5699
5700 // Fails to persist the checked state of a cloned checkbox or radio button.
5701 if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
5702 dest.checked = src.checked;
5703
5704 // Fails to return the selected option to the default selected state when cloning options
5705 } else if ( nodeName === "input" || nodeName === "textarea" ) {
5706 dest.defaultValue = src.defaultValue;
5707 }
5708}
5709
5710function domManip( collection, args, callback, ignored ) {
5711
5712 // Flatten any nested arrays
5713 args = concat.apply( [], args );
5714
5715 var fragment, first, scripts, hasScripts, node, doc,
5716 i = 0,
5717 l = collection.length,
5718 iNoClone = l - 1,
5719 value = args[ 0 ],
5720 isFunction = jQuery.isFunction( value );
5721
5722 // We can't cloneNode fragments that contain checked, in WebKit
5723 if ( isFunction ||
5724 ( l > 1 && typeof value === "string" &&
5725 !support.checkClone && rchecked.test( value ) ) ) {
5726 return collection.each( function( index ) {
5727 var self = collection.eq( index );
5728 if ( isFunction ) {
5729 args[ 0 ] = value.call( this, index, self.html() );
5730 }
5731 domManip( self, args, callback, ignored );
5732 } );
5733 }
5734
5735 if ( l ) {
5736 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
5737 first = fragment.firstChild;
5738
5739 if ( fragment.childNodes.length === 1 ) {
5740 fragment = first;
5741 }
5742
5743 // Require either new content or an interest in ignored elements to invoke the callback
5744 if ( first || ignored ) {
5745 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
5746 hasScripts = scripts.length;
5747
5748 // Use the original fragment for the last item
5749 // instead of the first because it can end up
5750 // being emptied incorrectly in certain situations (#8070).
5751 for ( ; i < l; i++ ) {
5752 node = fragment;
5753
5754 if ( i !== iNoClone ) {
5755 node = jQuery.clone( node, true, true );
5756
5757 // Keep references to cloned scripts for later restoration
5758 if ( hasScripts ) {
5759
5760 // Support: Android <=4.0 only, PhantomJS 1 only
5761 // push.apply(_, arraylike) throws on ancient WebKit
5762 jQuery.merge( scripts, getAll( node, "script" ) );
5763 }
5764 }
5765
5766 callback.call( collection[ i ], node, i );
5767 }
5768
5769 if ( hasScripts ) {
5770 doc = scripts[ scripts.length - 1 ].ownerDocument;
5771
5772 // Reenable scripts
5773 jQuery.map( scripts, restoreScript );
5774
5775 // Evaluate executable scripts on first document insertion
5776 for ( i = 0; i < hasScripts; i++ ) {
5777 node = scripts[ i ];
5778 if ( rscriptType.test( node.type || "" ) &&
5779 !dataPriv.access( node, "globalEval" ) &&
5780 jQuery.contains( doc, node ) ) {
5781
5782 if ( node.src ) {
5783
5784 // Optional AJAX dependency, but won't run scripts if not present
5785 if ( jQuery._evalUrl ) {
5786 jQuery._evalUrl( node.src );
5787 }
5788 } else {
5789 DOMEval( node.textContent.replace( rcleanScript, "" ), doc );
5790 }
5791 }
5792 }
5793 }
5794 }
5795 }
5796
5797 return collection;
5798}
5799
5800function remove( elem, selector, keepData ) {
5801 var node,
5802 nodes = selector ? jQuery.filter( selector, elem ) : elem,
5803 i = 0;
5804
5805 for ( ; ( node = nodes[ i ] ) != null; i++ ) {
5806 if ( !keepData && node.nodeType === 1 ) {
5807 jQuery.cleanData( getAll( node ) );
5808 }
5809
5810 if ( node.parentNode ) {
5811 if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
5812 setGlobalEval( getAll( node, "script" ) );
5813 }
5814 node.parentNode.removeChild( node );
5815 }
5816 }
5817
5818 return elem;
5819}
5820
5821jQuery.extend( {
5822 htmlPrefilter: function( html ) {
5823 return html.replace( rxhtmlTag, "<$1></$2>" );
5824 },
5825
5826 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5827 var i, l, srcElements, destElements,
5828 clone = elem.cloneNode( true ),
5829 inPage = jQuery.contains( elem.ownerDocument, elem );
5830
5831 // Fix IE cloning issues
5832 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
5833 !jQuery.isXMLDoc( elem ) ) {
5834
5835 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
5836 destElements = getAll( clone );
5837 srcElements = getAll( elem );
5838
5839 for ( i = 0, l = srcElements.length; i < l; i++ ) {
5840 fixInput( srcElements[ i ], destElements[ i ] );
5841 }
5842 }
5843
5844 // Copy the events from the original to the clone
5845 if ( dataAndEvents ) {
5846 if ( deepDataAndEvents ) {
5847 srcElements = srcElements || getAll( elem );
5848 destElements = destElements || getAll( clone );
5849
5850 for ( i = 0, l = srcElements.length; i < l; i++ ) {
5851 cloneCopyEvent( srcElements[ i ], destElements[ i ] );
5852 }
5853 } else {
5854 cloneCopyEvent( elem, clone );
5855 }
5856 }
5857
5858 // Preserve script evaluation history
5859 destElements = getAll( clone, "script" );
5860 if ( destElements.length > 0 ) {
5861 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
5862 }
5863
5864 // Return the cloned set
5865 return clone;
5866 },
5867
5868 cleanData: function( elems ) {
5869 var data, elem, type,
5870 special = jQuery.event.special,
5871 i = 0;
5872
5873 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
5874 if ( acceptData( elem ) ) {
5875 if ( ( data = elem[ dataPriv.expando ] ) ) {
5876 if ( data.events ) {
5877 for ( type in data.events ) {
5878 if ( special[ type ] ) {
5879 jQuery.event.remove( elem, type );
5880
5881 // This is a shortcut to avoid jQuery.event.remove's overhead
5882 } else {
5883 jQuery.removeEvent( elem, type, data.handle );
5884 }
5885 }
5886 }
5887
5888 // Support: Chrome <=35 - 45+
5889 // Assign undefined instead of using delete, see Data#remove
5890 elem[ dataPriv.expando ] = undefined;
5891 }
5892 if ( elem[ dataUser.expando ] ) {
5893
5894 // Support: Chrome <=35 - 45+
5895 // Assign undefined instead of using delete, see Data#remove
5896 elem[ dataUser.expando ] = undefined;
5897 }
5898 }
5899 }
5900 }
5901} );
5902
5903jQuery.fn.extend( {
5904 detach: function( selector ) {
5905 return remove( this, selector, true );
5906 },
5907
5908 remove: function( selector ) {
5909 return remove( this, selector );
5910 },
5911
5912 text: function( value ) {
5913 return access( this, function( value ) {
5914 return value === undefined ?
5915 jQuery.text( this ) :
5916 this.empty().each( function() {
5917 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5918 this.textContent = value;
5919 }
5920 } );
5921 }, null, value, arguments.length );
5922 },
5923
5924 append: function() {
5925 return domManip( this, arguments, function( elem ) {
5926 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5927 var target = manipulationTarget( this, elem );
5928 target.appendChild( elem );
5929 }
5930 } );
5931 },
5932
5933 prepend: function() {
5934 return domManip( this, arguments, function( elem ) {
5935 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5936 var target = manipulationTarget( this, elem );
5937 target.insertBefore( elem, target.firstChild );
5938 }
5939 } );
5940 },
5941
5942 before: function() {
5943 return domManip( this, arguments, function( elem ) {
5944 if ( this.parentNode ) {
5945 this.parentNode.insertBefore( elem, this );
5946 }
5947 } );
5948 },
5949
5950 after: function() {
5951 return domManip( this, arguments, function( elem ) {
5952 if ( this.parentNode ) {
5953 this.parentNode.insertBefore( elem, this.nextSibling );
5954 }
5955 } );
5956 },
5957
5958 empty: function() {
5959 var elem,
5960 i = 0;
5961
5962 for ( ; ( elem = this[ i ] ) != null; i++ ) {
5963 if ( elem.nodeType === 1 ) {
5964
5965 // Prevent memory leaks
5966 jQuery.cleanData( getAll( elem, false ) );
5967
5968 // Remove any remaining nodes
5969 elem.textContent = "";
5970 }
5971 }
5972
5973 return this;
5974 },
5975
5976 clone: function( dataAndEvents, deepDataAndEvents ) {
5977 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
5978 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
5979
5980 return this.map( function() {
5981 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
5982 } );
5983 },
5984
5985 html: function( value ) {
5986 return access( this, function( value ) {
5987 var elem = this[ 0 ] || {},
5988 i = 0,
5989 l = this.length;
5990
5991 if ( value === undefined && elem.nodeType === 1 ) {
5992 return elem.innerHTML;
5993 }
5994
5995 // See if we can take a shortcut and just use innerHTML
5996 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
5997 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
5998
5999 value = jQuery.htmlPrefilter( value );
6000
6001 try {
6002 for ( ; i < l; i++ ) {
6003 elem = this[ i ] || {};
6004
6005 // Remove element nodes and prevent memory leaks
6006 if ( elem.nodeType === 1 ) {
6007 jQuery.cleanData( getAll( elem, false ) );
6008 elem.innerHTML = value;
6009 }
6010 }
6011
6012 elem = 0;
6013
6014 // If using innerHTML throws an exception, use the fallback method
6015 } catch ( e ) {}
6016 }
6017
6018 if ( elem ) {
6019 this.empty().append( value );
6020 }
6021 }, null, value, arguments.length );
6022 },
6023
6024 replaceWith: function() {
6025 var ignored = [];
6026
6027 // Make the changes, replacing each non-ignored context element with the new content
6028 return domManip( this, arguments, function( elem ) {
6029 var parent = this.parentNode;
6030
6031 if ( jQuery.inArray( this, ignored ) < 0 ) {
6032 jQuery.cleanData( getAll( this ) );
6033 if ( parent ) {
6034 parent.replaceChild( elem, this );
6035 }
6036 }
6037
6038 // Force callback invocation
6039 }, ignored );
6040 }
6041} );
6042
6043jQuery.each( {
6044 appendTo: "append",
6045 prependTo: "prepend",
6046 insertBefore: "before",
6047 insertAfter: "after",
6048 replaceAll: "replaceWith"
6049}, function( name, original ) {
6050 jQuery.fn[ name ] = function( selector ) {
6051 var elems,
6052 ret = [],
6053 insert = jQuery( selector ),
6054 last = insert.length - 1,
6055 i = 0;
6056
6057 for ( ; i <= last; i++ ) {
6058 elems = i === last ? this : this.clone( true );
6059 jQuery( insert[ i ] )[ original ]( elems );
6060
6061 // Support: Android <=4.0 only, PhantomJS 1 only
6062 // .get() because push.apply(_, arraylike) throws on ancient WebKit
6063 push.apply( ret, elems.get() );
6064 }
6065
6066 return this.pushStack( ret );
6067 };
6068} );
6069var rmargin = ( /^margin/ );
6070
6071var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
6072
6073var getStyles = function( elem ) {
6074
6075 // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
6076 // IE throws on elements created in popups
6077 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
6078 var view = elem.ownerDocument.defaultView;
6079
6080 if ( !view || !view.opener ) {
6081 view = window;
6082 }
6083
6084 return view.getComputedStyle( elem );
6085 };
6086
6087
6088
6089( function() {
6090
6091 // Executing both pixelPosition & boxSizingReliable tests require only one layout
6092 // so they're executed at the same time to save the second computation.
6093 function computeStyleTests() {
6094
6095 // This is a singleton, we need to execute it only once
6096 if ( !div ) {
6097 return;
6098 }
6099
6100 div.style.cssText =
6101 "box-sizing:border-box;" +
6102 "position:relative;display:block;" +
6103 "margin:auto;border:1px;padding:1px;" +
6104 "top:1%;width:50%";
6105 div.innerHTML = "";
6106 documentElement.appendChild( container );
6107
6108 var divStyle = window.getComputedStyle( div );
6109 pixelPositionVal = divStyle.top !== "1%";
6110
6111 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
6112 reliableMarginLeftVal = divStyle.marginLeft === "2px";
6113 boxSizingReliableVal = divStyle.width === "4px";
6114
6115 // Support: Android 4.0 - 4.3 only
6116 // Some styles come back with percentage values, even though they shouldn't
6117 div.style.marginRight = "50%";
6118 pixelMarginRightVal = divStyle.marginRight === "4px";
6119
6120 documentElement.removeChild( container );
6121
6122 // Nullify the div so it wouldn't be stored in the memory and
6123 // it will also be a sign that checks already performed
6124 div = null;
6125 }
6126
6127 var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
6128 container = document.createElement( "div" ),
6129 div = document.createElement( "div" );
6130
6131 // Finish early in limited (non-browser) environments
6132 if ( !div.style ) {
6133 return;
6134 }
6135
6136 // Support: IE <=9 - 11 only
6137 // Style of cloned element affects source element cloned (#8908)
6138 div.style.backgroundClip = "content-box";
6139 div.cloneNode( true ).style.backgroundClip = "";
6140 support.clearCloneStyle = div.style.backgroundClip === "content-box";
6141
6142 container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
6143 "padding:0;margin-top:1px;position:absolute";
6144 container.appendChild( div );
6145
6146 jQuery.extend( support, {
6147 pixelPosition: function() {
6148 computeStyleTests();
6149 return pixelPositionVal;
6150 },
6151 boxSizingReliable: function() {
6152 computeStyleTests();
6153 return boxSizingReliableVal;
6154 },
6155 pixelMarginRight: function() {
6156 computeStyleTests();
6157 return pixelMarginRightVal;
6158 },
6159 reliableMarginLeft: function() {
6160 computeStyleTests();
6161 return reliableMarginLeftVal;
6162 }
6163 } );
6164} )();
6165
6166
6167function curCSS( elem, name, computed ) {
6168 var width, minWidth, maxWidth, ret,
6169
6170 // Support: Firefox 51+
6171 // Retrieving style before computed somehow
6172 // fixes an issue with getting wrong values
6173 // on detached elements
6174 style = elem.style;
6175
6176 computed = computed || getStyles( elem );
6177
6178 // getPropertyValue is needed for:
6179 // .css('filter') (IE 9 only, #12537)
6180 // .css('--customProperty) (#3144)
6181 if ( computed ) {
6182 ret = computed.getPropertyValue( name ) || computed[ name ];
6183
6184 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
6185 ret = jQuery.style( elem, name );
6186 }
6187
6188 // A tribute to the "awesome hack by Dean Edwards"
6189 // Android Browser returns percentage for some values,
6190 // but width seems to be reliably pixels.
6191 // This is against the CSSOM draft spec:
6192 // https://drafts.csswg.org/cssom/#resolved-values
6193 if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
6194
6195 // Remember the original values
6196 width = style.width;
6197 minWidth = style.minWidth;
6198 maxWidth = style.maxWidth;
6199
6200 // Put in the new values to get a computed value out
6201 style.minWidth = style.maxWidth = style.width = ret;
6202 ret = computed.width;
6203
6204 // Revert the changed values
6205 style.width = width;
6206 style.minWidth = minWidth;
6207 style.maxWidth = maxWidth;
6208 }
6209 }
6210
6211 return ret !== undefined ?
6212
6213 // Support: IE <=9 - 11 only
6214 // IE returns zIndex value as an integer.
6215 ret + "" :
6216 ret;
6217}
6218
6219
6220function addGetHookIf( conditionFn, hookFn ) {
6221
6222 // Define the hook, we'll check on the first run if it's really needed.
6223 return {
6224 get: function() {
6225 if ( conditionFn() ) {
6226
6227 // Hook not needed (or it's not possible to use it due
6228 // to missing dependency), remove it.
6229 delete this.get;
6230 return;
6231 }
6232
6233 // Hook needed; redefine it so that the support test is not executed again.
6234 return ( this.get = hookFn ).apply( this, arguments );
6235 }
6236 };
6237}
6238
6239
6240var
6241
6242 // Swappable if display is none or starts with table
6243 // except "table", "table-cell", or "table-caption"
6244 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
6245 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
6246 rcustomProp = /^--/,
6247 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6248 cssNormalTransform = {
6249 letterSpacing: "0",
6250 fontWeight: "400"
6251 },
6252
6253 cssPrefixes = [ "Webkit", "Moz", "ms" ],
6254 emptyStyle = document.createElement( "div" ).style;
6255
6256// Return a css property mapped to a potentially vendor prefixed property
6257function vendorPropName( name ) {
6258
6259 // Shortcut for names that are not vendor prefixed
6260 if ( name in emptyStyle ) {
6261 return name;
6262 }
6263
6264 // Check for vendor prefixed names
6265 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
6266 i = cssPrefixes.length;
6267
6268 while ( i-- ) {
6269 name = cssPrefixes[ i ] + capName;
6270 if ( name in emptyStyle ) {
6271 return name;
6272 }
6273 }
6274}
6275
6276// Return a property mapped along what jQuery.cssProps suggests or to
6277// a vendor prefixed property.
6278function finalPropName( name ) {
6279 var ret = jQuery.cssProps[ name ];
6280 if ( !ret ) {
6281 ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
6282 }
6283 return ret;
6284}
6285
6286function setPositiveNumber( elem, value, subtract ) {
6287
6288 // Any relative (+/-) values have already been
6289 // normalized at this point
6290 var matches = rcssNum.exec( value );
6291 return matches ?
6292
6293 // Guard against undefined "subtract", e.g., when used as in cssHooks
6294 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
6295 value;
6296}
6297
6298function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
6299 var i,
6300 val = 0;
6301
6302 // If we already have the right measurement, avoid augmentation
6303 if ( extra === ( isBorderBox ? "border" : "content" ) ) {
6304 i = 4;
6305
6306 // Otherwise initialize for horizontal or vertical properties
6307 } else {
6308 i = name === "width" ? 1 : 0;
6309 }
6310
6311 for ( ; i < 4; i += 2 ) {
6312
6313 // Both box models exclude margin, so add it if we want it
6314 if ( extra === "margin" ) {
6315 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
6316 }
6317
6318 if ( isBorderBox ) {
6319
6320 // border-box includes padding, so remove it if we want content
6321 if ( extra === "content" ) {
6322 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6323 }
6324
6325 // At this point, extra isn't border nor margin, so remove border
6326 if ( extra !== "margin" ) {
6327 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6328 }
6329 } else {
6330
6331 // At this point, extra isn't content, so add padding
6332 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6333
6334 // At this point, extra isn't content nor padding, so add border
6335 if ( extra !== "padding" ) {
6336 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6337 }
6338 }
6339 }
6340
6341 return val;
6342}
6343
6344function getWidthOrHeight( elem, name, extra ) {
6345
6346 // Start with computed style
6347 var valueIsBorderBox,
6348 styles = getStyles( elem ),
6349 val = curCSS( elem, name, styles ),
6350 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
6351
6352 // Computed unit is not pixels. Stop here and return.
6353 if ( rnumnonpx.test( val ) ) {
6354 return val;
6355 }
6356
6357 // Check for style in case a browser which returns unreliable values
6358 // for getComputedStyle silently falls back to the reliable elem.style
6359 valueIsBorderBox = isBorderBox &&
6360 ( support.boxSizingReliable() || val === elem.style[ name ] );
6361
6362 // Fall back to offsetWidth/Height when value is "auto"
6363 // This happens for inline elements with no explicit setting (gh-3571)
6364 if ( val === "auto" ) {
6365 val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ];
6366 }
6367
6368 // Normalize "", auto, and prepare for extra
6369 val = parseFloat( val ) || 0;
6370
6371 // Use the active box-sizing model to add/subtract irrelevant styles
6372 return ( val +
6373 augmentWidthOrHeight(
6374 elem,
6375 name,
6376 extra || ( isBorderBox ? "border" : "content" ),
6377 valueIsBorderBox,
6378 styles
6379 )
6380 ) + "px";
6381}
6382
6383jQuery.extend( {
6384
6385 // Add in style property hooks for overriding the default
6386 // behavior of getting and setting a style property
6387 cssHooks: {
6388 opacity: {
6389 get: function( elem, computed ) {
6390 if ( computed ) {
6391
6392 // We should always get a number back from opacity
6393 var ret = curCSS( elem, "opacity" );
6394 return ret === "" ? "1" : ret;
6395 }
6396 }
6397 }
6398 },
6399
6400 // Don't automatically add "px" to these possibly-unitless properties
6401 cssNumber: {
6402 "animationIterationCount": true,
6403 "columnCount": true,
6404 "fillOpacity": true,
6405 "flexGrow": true,
6406 "flexShrink": true,
6407 "fontWeight": true,
6408 "lineHeight": true,
6409 "opacity": true,
6410 "order": true,
6411 "orphans": true,
6412 "widows": true,
6413 "zIndex": true,
6414 "zoom": true
6415 },
6416
6417 // Add in properties whose names you wish to fix before
6418 // setting or getting the value
6419 cssProps: {
6420 "float": "cssFloat"
6421 },
6422
6423 // Get and set the style property on a DOM Node
6424 style: function( elem, name, value, extra ) {
6425
6426 // Don't set styles on text and comment nodes
6427 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
6428 return;
6429 }
6430
6431 // Make sure that we're working with the right name
6432 var ret, type, hooks,
6433 origName = jQuery.camelCase( name ),
6434 isCustomProp = rcustomProp.test( name ),
6435 style = elem.style;
6436
6437 // Make sure that we're working with the right name. We don't
6438 // want to query the value if it is a CSS custom property
6439 // since they are user-defined.
6440 if ( !isCustomProp ) {
6441 name = finalPropName( origName );
6442 }
6443
6444 // Gets hook for the prefixed version, then unprefixed version
6445 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6446
6447 // Check if we're setting a value
6448 if ( value !== undefined ) {
6449 type = typeof value;
6450
6451 // Convert "+=" or "-=" to relative numbers (#7345)
6452 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
6453 value = adjustCSS( elem, name, ret );
6454
6455 // Fixes bug #9237
6456 type = "number";
6457 }
6458
6459 // Make sure that null and NaN values aren't set (#7116)
6460 if ( value == null || value !== value ) {
6461 return;
6462 }
6463
6464 // If a number was passed in, add the unit (except for certain CSS properties)
6465 if ( type === "number" ) {
6466 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
6467 }
6468
6469 // background-* props affect original clone's values
6470 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
6471 style[ name ] = "inherit";
6472 }
6473
6474 // If a hook was provided, use that value, otherwise just set the specified value
6475 if ( !hooks || !( "set" in hooks ) ||
6476 ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
6477
6478 if ( isCustomProp ) {
6479 style.setProperty( name, value );
6480 } else {
6481 style[ name ] = value;
6482 }
6483 }
6484
6485 } else {
6486
6487 // If a hook was provided get the non-computed value from there
6488 if ( hooks && "get" in hooks &&
6489 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
6490
6491 return ret;
6492 }
6493
6494 // Otherwise just get the value from the style object
6495 return style[ name ];
6496 }
6497 },
6498
6499 css: function( elem, name, extra, styles ) {
6500 var val, num, hooks,
6501 origName = jQuery.camelCase( name ),
6502 isCustomProp = rcustomProp.test( name );
6503
6504 // Make sure that we're working with the right name. We don't
6505 // want to modify the value if it is a CSS custom property
6506 // since they are user-defined.
6507 if ( !isCustomProp ) {
6508 name = finalPropName( origName );
6509 }
6510
6511 // Try prefixed name followed by the unprefixed name
6512 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6513
6514 // If a hook was provided get the computed value from there
6515 if ( hooks && "get" in hooks ) {
6516 val = hooks.get( elem, true, extra );
6517 }
6518
6519 // Otherwise, if a way to get the computed value exists, use that
6520 if ( val === undefined ) {
6521 val = curCSS( elem, name, styles );
6522 }
6523
6524 // Convert "normal" to computed value
6525 if ( val === "normal" && name in cssNormalTransform ) {
6526 val = cssNormalTransform[ name ];
6527 }
6528
6529 // Make numeric if forced or a qualifier was provided and val looks numeric
6530 if ( extra === "" || extra ) {
6531 num = parseFloat( val );
6532 return extra === true || isFinite( num ) ? num || 0 : val;
6533 }
6534
6535 return val;
6536 }
6537} );
6538
6539jQuery.each( [ "height", "width" ], function( i, name ) {
6540 jQuery.cssHooks[ name ] = {
6541 get: function( elem, computed, extra ) {
6542 if ( computed ) {
6543
6544 // Certain elements can have dimension info if we invisibly show them
6545 // but it must have a current display style that would benefit
6546 return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
6547
6548 // Support: Safari 8+
6549 // Table columns in Safari have non-zero offsetWidth & zero
6550 // getBoundingClientRect().width unless display is changed.
6551 // Support: IE <=11 only
6552 // Running getBoundingClientRect on a disconnected node
6553 // in IE throws an error.
6554 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
6555 swap( elem, cssShow, function() {
6556 return getWidthOrHeight( elem, name, extra );
6557 } ) :
6558 getWidthOrHeight( elem, name, extra );
6559 }
6560 },
6561
6562 set: function( elem, value, extra ) {
6563 var matches,
6564 styles = extra && getStyles( elem ),
6565 subtract = extra && augmentWidthOrHeight(
6566 elem,
6567 name,
6568 extra,
6569 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6570 styles
6571 );
6572
6573 // Convert to pixels if value adjustment is needed
6574 if ( subtract && ( matches = rcssNum.exec( value ) ) &&
6575 ( matches[ 3 ] || "px" ) !== "px" ) {
6576
6577 elem.style[ name ] = value;
6578 value = jQuery.css( elem, name );
6579 }
6580
6581 return setPositiveNumber( elem, value, subtract );
6582 }
6583 };
6584} );
6585
6586jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
6587 function( elem, computed ) {
6588 if ( computed ) {
6589 return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
6590 elem.getBoundingClientRect().left -
6591 swap( elem, { marginLeft: 0 }, function() {
6592 return elem.getBoundingClientRect().left;
6593 } )
6594 ) + "px";
6595 }
6596 }
6597);
6598
6599// These hooks are used by animate to expand properties
6600jQuery.each( {
6601 margin: "",
6602 padding: "",
6603 border: "Width"
6604}, function( prefix, suffix ) {
6605 jQuery.cssHooks[ prefix + suffix ] = {
6606 expand: function( value ) {
6607 var i = 0,
6608 expanded = {},
6609
6610 // Assumes a single number if not a string
6611 parts = typeof value === "string" ? value.split( " " ) : [ value ];
6612
6613 for ( ; i < 4; i++ ) {
6614 expanded[ prefix + cssExpand[ i ] + suffix ] =
6615 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
6616 }
6617
6618 return expanded;
6619 }
6620 };
6621
6622 if ( !rmargin.test( prefix ) ) {
6623 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
6624 }
6625} );
6626
6627jQuery.fn.extend( {
6628 css: function( name, value ) {
6629 return access( this, function( elem, name, value ) {
6630 var styles, len,
6631 map = {},
6632 i = 0;
6633
6634 if ( Array.isArray( name ) ) {
6635 styles = getStyles( elem );
6636 len = name.length;
6637
6638 for ( ; i < len; i++ ) {
6639 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
6640 }
6641
6642 return map;
6643 }
6644
6645 return value !== undefined ?
6646 jQuery.style( elem, name, value ) :
6647 jQuery.css( elem, name );
6648 }, name, value, arguments.length > 1 );
6649 }
6650} );
6651
6652
6653function Tween( elem, options, prop, end, easing ) {
6654 return new Tween.prototype.init( elem, options, prop, end, easing );
6655}
6656jQuery.Tween = Tween;
6657
6658Tween.prototype = {
6659 constructor: Tween,
6660 init: function( elem, options, prop, end, easing, unit ) {
6661 this.elem = elem;
6662 this.prop = prop;
6663 this.easing = easing || jQuery.easing._default;
6664 this.options = options;
6665 this.start = this.now = this.cur();
6666 this.end = end;
6667 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
6668 },
6669 cur: function() {
6670 var hooks = Tween.propHooks[ this.prop ];
6671
6672 return hooks && hooks.get ?
6673 hooks.get( this ) :
6674 Tween.propHooks._default.get( this );
6675 },
6676 run: function( percent ) {
6677 var eased,
6678 hooks = Tween.propHooks[ this.prop ];
6679
6680 if ( this.options.duration ) {
6681 this.pos = eased = jQuery.easing[ this.easing ](
6682 percent, this.options.duration * percent, 0, 1, this.options.duration
6683 );
6684 } else {
6685 this.pos = eased = percent;
6686 }
6687 this.now = ( this.end - this.start ) * eased + this.start;
6688
6689 if ( this.options.step ) {
6690 this.options.step.call( this.elem, this.now, this );
6691 }
6692
6693 if ( hooks && hooks.set ) {
6694 hooks.set( this );
6695 } else {
6696 Tween.propHooks._default.set( this );
6697 }
6698 return this;
6699 }
6700};
6701
6702Tween.prototype.init.prototype = Tween.prototype;
6703
6704Tween.propHooks = {
6705 _default: {
6706 get: function( tween ) {
6707 var result;
6708
6709 // Use a property on the element directly when it is not a DOM element,
6710 // or when there is no matching style property that exists.
6711 if ( tween.elem.nodeType !== 1 ||
6712 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
6713 return tween.elem[ tween.prop ];
6714 }
6715
6716 // Passing an empty string as a 3rd parameter to .css will automatically
6717 // attempt a parseFloat and fallback to a string if the parse fails.
6718 // Simple values such as "10px" are parsed to Float;
6719 // complex values such as "rotate(1rad)" are returned as-is.
6720 result = jQuery.css( tween.elem, tween.prop, "" );
6721
6722 // Empty strings, null, undefined and "auto" are converted to 0.
6723 return !result || result === "auto" ? 0 : result;
6724 },
6725 set: function( tween ) {
6726
6727 // Use step hook for back compat.
6728 // Use cssHook if its there.
6729 // Use .style if available and use plain properties where available.
6730 if ( jQuery.fx.step[ tween.prop ] ) {
6731 jQuery.fx.step[ tween.prop ]( tween );
6732 } else if ( tween.elem.nodeType === 1 &&
6733 ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
6734 jQuery.cssHooks[ tween.prop ] ) ) {
6735 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
6736 } else {
6737 tween.elem[ tween.prop ] = tween.now;
6738 }
6739 }
6740 }
6741};
6742
6743// Support: IE <=9 only
6744// Panic based approach to setting things on disconnected nodes
6745Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
6746 set: function( tween ) {
6747 if ( tween.elem.nodeType && tween.elem.parentNode ) {
6748 tween.elem[ tween.prop ] = tween.now;
6749 }
6750 }
6751};
6752
6753jQuery.easing = {
6754 linear: function( p ) {
6755 return p;
6756 },
6757 swing: function( p ) {
6758 return 0.5 - Math.cos( p * Math.PI ) / 2;
6759 },
6760 _default: "swing"
6761};
6762
6763jQuery.fx = Tween.prototype.init;
6764
6765// Back compat <1.8 extension point
6766jQuery.fx.step = {};
6767
6768
6769
6770
6771var
6772 fxNow, inProgress,
6773 rfxtypes = /^(?:toggle|show|hide)$/,
6774 rrun = /queueHooks$/;
6775
6776function schedule() {
6777 if ( inProgress ) {
6778 if ( document.hidden === false && window.requestAnimationFrame ) {
6779 window.requestAnimationFrame( schedule );
6780 } else {
6781 window.setTimeout( schedule, jQuery.fx.interval );
6782 }
6783
6784 jQuery.fx.tick();
6785 }
6786}
6787
6788// Animations created synchronously will run synchronously
6789function createFxNow() {
6790 window.setTimeout( function() {
6791 fxNow = undefined;
6792 } );
6793 return ( fxNow = jQuery.now() );
6794}
6795
6796// Generate parameters to create a standard animation
6797function genFx( type, includeWidth ) {
6798 var which,
6799 i = 0,
6800 attrs = { height: type };
6801
6802 // If we include width, step value is 1 to do all cssExpand values,
6803 // otherwise step value is 2 to skip over Left and Right
6804 includeWidth = includeWidth ? 1 : 0;
6805 for ( ; i < 4; i += 2 - includeWidth ) {
6806 which = cssExpand[ i ];
6807 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
6808 }
6809
6810 if ( includeWidth ) {
6811 attrs.opacity = attrs.width = type;
6812 }
6813
6814 return attrs;
6815}
6816
6817function createTween( value, prop, animation ) {
6818 var tween,
6819 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
6820 index = 0,
6821 length = collection.length;
6822 for ( ; index < length; index++ ) {
6823 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
6824
6825 // We're done with this property
6826 return tween;
6827 }
6828 }
6829}
6830
6831function defaultPrefilter( elem, props, opts ) {
6832 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
6833 isBox = "width" in props || "height" in props,
6834 anim = this,
6835 orig = {},
6836 style = elem.style,
6837 hidden = elem.nodeType && isHiddenWithinTree( elem ),
6838 dataShow = dataPriv.get( elem, "fxshow" );
6839
6840 // Queue-skipping animations hijack the fx hooks
6841 if ( !opts.queue ) {
6842 hooks = jQuery._queueHooks( elem, "fx" );
6843 if ( hooks.unqueued == null ) {
6844 hooks.unqueued = 0;
6845 oldfire = hooks.empty.fire;
6846 hooks.empty.fire = function() {
6847 if ( !hooks.unqueued ) {
6848 oldfire();
6849 }
6850 };
6851 }
6852 hooks.unqueued++;
6853
6854 anim.always( function() {
6855
6856 // Ensure the complete handler is called before this completes
6857 anim.always( function() {
6858 hooks.unqueued--;
6859 if ( !jQuery.queue( elem, "fx" ).length ) {
6860 hooks.empty.fire();
6861 }
6862 } );
6863 } );
6864 }
6865
6866 // Detect show/hide animations
6867 for ( prop in props ) {
6868 value = props[ prop ];
6869 if ( rfxtypes.test( value ) ) {
6870 delete props[ prop ];
6871 toggle = toggle || value === "toggle";
6872 if ( value === ( hidden ? "hide" : "show" ) ) {
6873
6874 // Pretend to be hidden if this is a "show" and
6875 // there is still data from a stopped show/hide
6876 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
6877 hidden = true;
6878
6879 // Ignore all other no-op show/hide data
6880 } else {
6881 continue;
6882 }
6883 }
6884 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
6885 }
6886 }
6887
6888 // Bail out if this is a no-op like .hide().hide()
6889 propTween = !jQuery.isEmptyObject( props );
6890 if ( !propTween && jQuery.isEmptyObject( orig ) ) {
6891 return;
6892 }
6893
6894 // Restrict "overflow" and "display" styles during box animations
6895 if ( isBox && elem.nodeType === 1 ) {
6896
6897 // Support: IE <=9 - 11, Edge 12 - 13
6898 // Record all 3 overflow attributes because IE does not infer the shorthand
6899 // from identically-valued overflowX and overflowY
6900 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
6901
6902 // Identify a display type, preferring old show/hide data over the CSS cascade
6903 restoreDisplay = dataShow && dataShow.display;
6904 if ( restoreDisplay == null ) {
6905 restoreDisplay = dataPriv.get( elem, "display" );
6906 }
6907 display = jQuery.css( elem, "display" );
6908 if ( display === "none" ) {
6909 if ( restoreDisplay ) {
6910 display = restoreDisplay;
6911 } else {
6912
6913 // Get nonempty value(s) by temporarily forcing visibility
6914 showHide( [ elem ], true );
6915 restoreDisplay = elem.style.display || restoreDisplay;
6916 display = jQuery.css( elem, "display" );
6917 showHide( [ elem ] );
6918 }
6919 }
6920
6921 // Animate inline elements as inline-block
6922 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
6923 if ( jQuery.css( elem, "float" ) === "none" ) {
6924
6925 // Restore the original display value at the end of pure show/hide animations
6926 if ( !propTween ) {
6927 anim.done( function() {
6928 style.display = restoreDisplay;
6929 } );
6930 if ( restoreDisplay == null ) {
6931 display = style.display;
6932 restoreDisplay = display === "none" ? "" : display;
6933 }
6934 }
6935 style.display = "inline-block";
6936 }
6937 }
6938 }
6939
6940 if ( opts.overflow ) {
6941 style.overflow = "hidden";
6942 anim.always( function() {
6943 style.overflow = opts.overflow[ 0 ];
6944 style.overflowX = opts.overflow[ 1 ];
6945 style.overflowY = opts.overflow[ 2 ];
6946 } );
6947 }
6948
6949 // Implement show/hide animations
6950 propTween = false;
6951 for ( prop in orig ) {
6952
6953 // General show/hide setup for this element animation
6954 if ( !propTween ) {
6955 if ( dataShow ) {
6956 if ( "hidden" in dataShow ) {
6957 hidden = dataShow.hidden;
6958 }
6959 } else {
6960 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
6961 }
6962
6963 // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
6964 if ( toggle ) {
6965 dataShow.hidden = !hidden;
6966 }
6967
6968 // Show elements before animating them
6969 if ( hidden ) {
6970 showHide( [ elem ], true );
6971 }
6972
6973 /* eslint-disable no-loop-func */
6974
6975 anim.done( function() {
6976
6977 /* eslint-enable no-loop-func */
6978
6979 // The final step of a "hide" animation is actually hiding the element
6980 if ( !hidden ) {
6981 showHide( [ elem ] );
6982 }
6983 dataPriv.remove( elem, "fxshow" );
6984 for ( prop in orig ) {
6985 jQuery.style( elem, prop, orig[ prop ] );
6986 }
6987 } );
6988 }
6989
6990 // Per-property setup
6991 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
6992 if ( !( prop in dataShow ) ) {
6993 dataShow[ prop ] = propTween.start;
6994 if ( hidden ) {
6995 propTween.end = propTween.start;
6996 propTween.start = 0;
6997 }
6998 }
6999 }
7000}
7001
7002function propFilter( props, specialEasing ) {
7003 var index, name, easing, value, hooks;
7004
7005 // camelCase, specialEasing and expand cssHook pass
7006 for ( index in props ) {
7007 name = jQuery.camelCase( index );
7008 easing = specialEasing[ name ];
7009 value = props[ index ];
7010 if ( Array.isArray( value ) ) {
7011 easing = value[ 1 ];
7012 value = props[ index ] = value[ 0 ];
7013 }
7014
7015 if ( index !== name ) {
7016 props[ name ] = value;
7017 delete props[ index ];
7018 }
7019
7020 hooks = jQuery.cssHooks[ name ];
7021 if ( hooks && "expand" in hooks ) {
7022 value = hooks.expand( value );
7023 delete props[ name ];
7024
7025 // Not quite $.extend, this won't overwrite existing keys.
7026 // Reusing 'index' because we have the correct "name"
7027 for ( index in value ) {
7028 if ( !( index in props ) ) {
7029 props[ index ] = value[ index ];
7030 specialEasing[ index ] = easing;
7031 }
7032 }
7033 } else {
7034 specialEasing[ name ] = easing;
7035 }
7036 }
7037}
7038
7039function Animation( elem, properties, options ) {
7040 var result,
7041 stopped,
7042 index = 0,
7043 length = Animation.prefilters.length,
7044 deferred = jQuery.Deferred().always( function() {
7045
7046 // Don't match elem in the :animated selector
7047 delete tick.elem;
7048 } ),
7049 tick = function() {
7050 if ( stopped ) {
7051 return false;
7052 }
7053 var currentTime = fxNow || createFxNow(),
7054 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
7055
7056 // Support: Android 2.3 only
7057 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
7058 temp = remaining / animation.duration || 0,
7059 percent = 1 - temp,
7060 index = 0,
7061 length = animation.tweens.length;
7062
7063 for ( ; index < length; index++ ) {
7064 animation.tweens[ index ].run( percent );
7065 }
7066
7067 deferred.notifyWith( elem, [ animation, percent, remaining ] );
7068
7069 // If there's more to do, yield
7070 if ( percent < 1 && length ) {
7071 return remaining;
7072 }
7073
7074 // If this was an empty animation, synthesize a final progress notification
7075 if ( !length ) {
7076 deferred.notifyWith( elem, [ animation, 1, 0 ] );
7077 }
7078
7079 // Resolve the animation and report its conclusion
7080 deferred.resolveWith( elem, [ animation ] );
7081 return false;
7082 },
7083 animation = deferred.promise( {
7084 elem: elem,
7085 props: jQuery.extend( {}, properties ),
7086 opts: jQuery.extend( true, {
7087 specialEasing: {},
7088 easing: jQuery.easing._default
7089 }, options ),
7090 originalProperties: properties,
7091 originalOptions: options,
7092 startTime: fxNow || createFxNow(),
7093 duration: options.duration,
7094 tweens: [],
7095 createTween: function( prop, end ) {
7096 var tween = jQuery.Tween( elem, animation.opts, prop, end,
7097 animation.opts.specialEasing[ prop ] || animation.opts.easing );
7098 animation.tweens.push( tween );
7099 return tween;
7100 },
7101 stop: function( gotoEnd ) {
7102 var index = 0,
7103
7104 // If we are going to the end, we want to run all the tweens
7105 // otherwise we skip this part
7106 length = gotoEnd ? animation.tweens.length : 0;
7107 if ( stopped ) {
7108 return this;
7109 }
7110 stopped = true;
7111 for ( ; index < length; index++ ) {
7112 animation.tweens[ index ].run( 1 );
7113 }
7114
7115 // Resolve when we played the last frame; otherwise, reject
7116 if ( gotoEnd ) {
7117 deferred.notifyWith( elem, [ animation, 1, 0 ] );
7118 deferred.resolveWith( elem, [ animation, gotoEnd ] );
7119 } else {
7120 deferred.rejectWith( elem, [ animation, gotoEnd ] );
7121 }
7122 return this;
7123 }
7124 } ),
7125 props = animation.props;
7126
7127 propFilter( props, animation.opts.specialEasing );
7128
7129 for ( ; index < length; index++ ) {
7130 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
7131 if ( result ) {
7132 if ( jQuery.isFunction( result.stop ) ) {
7133 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
7134 jQuery.proxy( result.stop, result );
7135 }
7136 return result;
7137 }
7138 }
7139
7140 jQuery.map( props, createTween, animation );
7141
7142 if ( jQuery.isFunction( animation.opts.start ) ) {
7143 animation.opts.start.call( elem, animation );
7144 }
7145
7146 // Attach callbacks from options
7147 animation
7148 .progress( animation.opts.progress )
7149 .done( animation.opts.done, animation.opts.complete )
7150 .fail( animation.opts.fail )
7151 .always( animation.opts.always );
7152
7153 jQuery.fx.timer(
7154 jQuery.extend( tick, {
7155 elem: elem,
7156 anim: animation,
7157 queue: animation.opts.queue
7158 } )
7159 );
7160
7161 return animation;
7162}
7163
7164jQuery.Animation = jQuery.extend( Animation, {
7165
7166 tweeners: {
7167 "*": [ function( prop, value ) {
7168 var tween = this.createTween( prop, value );
7169 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
7170 return tween;
7171 } ]
7172 },
7173
7174 tweener: function( props, callback ) {
7175 if ( jQuery.isFunction( props ) ) {
7176 callback = props;
7177 props = [ "*" ];
7178 } else {
7179 props = props.match( rnothtmlwhite );
7180 }
7181
7182 var prop,
7183 index = 0,
7184 length = props.length;
7185
7186 for ( ; index < length; index++ ) {
7187 prop = props[ index ];
7188 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
7189 Animation.tweeners[ prop ].unshift( callback );
7190 }
7191 },
7192
7193 prefilters: [ defaultPrefilter ],
7194
7195 prefilter: function( callback, prepend ) {
7196 if ( prepend ) {
7197 Animation.prefilters.unshift( callback );
7198 } else {
7199 Animation.prefilters.push( callback );
7200 }
7201 }
7202} );
7203
7204jQuery.speed = function( speed, easing, fn ) {
7205 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
7206 complete: fn || !fn && easing ||
7207 jQuery.isFunction( speed ) && speed,
7208 duration: speed,
7209 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
7210 };
7211
7212 // Go to the end state if fx are off
7213 if ( jQuery.fx.off ) {
7214 opt.duration = 0;
7215
7216 } else {
7217 if ( typeof opt.duration !== "number" ) {
7218 if ( opt.duration in jQuery.fx.speeds ) {
7219 opt.duration = jQuery.fx.speeds[ opt.duration ];
7220
7221 } else {
7222 opt.duration = jQuery.fx.speeds._default;
7223 }
7224 }
7225 }
7226
7227 // Normalize opt.queue - true/undefined/null -> "fx"
7228 if ( opt.queue == null || opt.queue === true ) {
7229 opt.queue = "fx";
7230 }
7231
7232 // Queueing
7233 opt.old = opt.complete;
7234
7235 opt.complete = function() {
7236 if ( jQuery.isFunction( opt.old ) ) {
7237 opt.old.call( this );
7238 }
7239
7240 if ( opt.queue ) {
7241 jQuery.dequeue( this, opt.queue );
7242 }
7243 };
7244
7245 return opt;
7246};
7247
7248jQuery.fn.extend( {
7249 fadeTo: function( speed, to, easing, callback ) {
7250
7251 // Show any hidden elements after setting opacity to 0
7252 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
7253
7254 // Animate to the value specified
7255 .end().animate( { opacity: to }, speed, easing, callback );
7256 },
7257 animate: function( prop, speed, easing, callback ) {
7258 var empty = jQuery.isEmptyObject( prop ),
7259 optall = jQuery.speed( speed, easing, callback ),
7260 doAnimation = function() {
7261
7262 // Operate on a copy of prop so per-property easing won't be lost
7263 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
7264
7265 // Empty animations, or finishing resolves immediately
7266 if ( empty || dataPriv.get( this, "finish" ) ) {
7267 anim.stop( true );
7268 }
7269 };
7270 doAnimation.finish = doAnimation;
7271
7272 return empty || optall.queue === false ?
7273 this.each( doAnimation ) :
7274 this.queue( optall.queue, doAnimation );
7275 },
7276 stop: function( type, clearQueue, gotoEnd ) {
7277 var stopQueue = function( hooks ) {
7278 var stop = hooks.stop;
7279 delete hooks.stop;
7280 stop( gotoEnd );
7281 };
7282
7283 if ( typeof type !== "string" ) {
7284 gotoEnd = clearQueue;
7285 clearQueue = type;
7286 type = undefined;
7287 }
7288 if ( clearQueue && type !== false ) {
7289 this.queue( type || "fx", [] );
7290 }
7291
7292 return this.each( function() {
7293 var dequeue = true,
7294 index = type != null && type + "queueHooks",
7295 timers = jQuery.timers,
7296 data = dataPriv.get( this );
7297
7298 if ( index ) {
7299 if ( data[ index ] && data[ index ].stop ) {
7300 stopQueue( data[ index ] );
7301 }
7302 } else {
7303 for ( index in data ) {
7304 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
7305 stopQueue( data[ index ] );
7306 }
7307 }
7308 }
7309
7310 for ( index = timers.length; index--; ) {
7311 if ( timers[ index ].elem === this &&
7312 ( type == null || timers[ index ].queue === type ) ) {
7313
7314 timers[ index ].anim.stop( gotoEnd );
7315 dequeue = false;
7316 timers.splice( index, 1 );
7317 }
7318 }
7319
7320 // Start the next in the queue if the last step wasn't forced.
7321 // Timers currently will call their complete callbacks, which
7322 // will dequeue but only if they were gotoEnd.
7323 if ( dequeue || !gotoEnd ) {
7324 jQuery.dequeue( this, type );
7325 }
7326 } );
7327 },
7328 finish: function( type ) {
7329 if ( type !== false ) {
7330 type = type || "fx";
7331 }
7332 return this.each( function() {
7333 var index,
7334 data = dataPriv.get( this ),
7335 queue = data[ type + "queue" ],
7336 hooks = data[ type + "queueHooks" ],
7337 timers = jQuery.timers,
7338 length = queue ? queue.length : 0;
7339
7340 // Enable finishing flag on private data
7341 data.finish = true;
7342
7343 // Empty the queue first
7344 jQuery.queue( this, type, [] );
7345
7346 if ( hooks && hooks.stop ) {
7347 hooks.stop.call( this, true );
7348 }
7349
7350 // Look for any active animations, and finish them
7351 for ( index = timers.length; index--; ) {
7352 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
7353 timers[ index ].anim.stop( true );
7354 timers.splice( index, 1 );
7355 }
7356 }
7357
7358 // Look for any animations in the old queue and finish them
7359 for ( index = 0; index < length; index++ ) {
7360 if ( queue[ index ] && queue[ index ].finish ) {
7361 queue[ index ].finish.call( this );
7362 }
7363 }
7364
7365 // Turn off finishing flag
7366 delete data.finish;
7367 } );
7368 }
7369} );
7370
7371jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
7372 var cssFn = jQuery.fn[ name ];
7373 jQuery.fn[ name ] = function( speed, easing, callback ) {
7374 return speed == null || typeof speed === "boolean" ?
7375 cssFn.apply( this, arguments ) :
7376 this.animate( genFx( name, true ), speed, easing, callback );
7377 };
7378} );
7379
7380// Generate shortcuts for custom animations
7381jQuery.each( {
7382 slideDown: genFx( "show" ),
7383 slideUp: genFx( "hide" ),
7384 slideToggle: genFx( "toggle" ),
7385 fadeIn: { opacity: "show" },
7386 fadeOut: { opacity: "hide" },
7387 fadeToggle: { opacity: "toggle" }
7388}, function( name, props ) {
7389 jQuery.fn[ name ] = function( speed, easing, callback ) {
7390 return this.animate( props, speed, easing, callback );
7391 };
7392} );
7393
7394jQuery.timers = [];
7395jQuery.fx.tick = function() {
7396 var timer,
7397 i = 0,
7398 timers = jQuery.timers;
7399
7400 fxNow = jQuery.now();
7401
7402 for ( ; i < timers.length; i++ ) {
7403 timer = timers[ i ];
7404
7405 // Run the timer and safely remove it when done (allowing for external removal)
7406 if ( !timer() && timers[ i ] === timer ) {
7407 timers.splice( i--, 1 );
7408 }
7409 }
7410
7411 if ( !timers.length ) {
7412 jQuery.fx.stop();
7413 }
7414 fxNow = undefined;
7415};
7416
7417jQuery.fx.timer = function( timer ) {
7418 jQuery.timers.push( timer );
7419 jQuery.fx.start();
7420};
7421
7422jQuery.fx.interval = 13;
7423jQuery.fx.start = function() {
7424 if ( inProgress ) {
7425 return;
7426 }
7427
7428 inProgress = true;
7429 schedule();
7430};
7431
7432jQuery.fx.stop = function() {
7433 inProgress = null;
7434};
7435
7436jQuery.fx.speeds = {
7437 slow: 600,
7438 fast: 200,
7439
7440 // Default speed
7441 _default: 400
7442};
7443
7444
7445// Based off of the plugin by Clint Helfers, with permission.
7446// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
7447jQuery.fn.delay = function( time, type ) {
7448 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
7449 type = type || "fx";
7450
7451 return this.queue( type, function( next, hooks ) {
7452 var timeout = window.setTimeout( next, time );
7453 hooks.stop = function() {
7454 window.clearTimeout( timeout );
7455 };
7456 } );
7457};
7458
7459
7460( function() {
7461 var input = document.createElement( "input" ),
7462 select = document.createElement( "select" ),
7463 opt = select.appendChild( document.createElement( "option" ) );
7464
7465 input.type = "checkbox";
7466
7467 // Support: Android <=4.3 only
7468 // Default value for a checkbox should be "on"
7469 support.checkOn = input.value !== "";
7470
7471 // Support: IE <=11 only
7472 // Must access selectedIndex to make default options select
7473 support.optSelected = opt.selected;
7474
7475 // Support: IE <=11 only
7476 // An input loses its value after becoming a radio
7477 input = document.createElement( "input" );
7478 input.value = "t";
7479 input.type = "radio";
7480 support.radioValue = input.value === "t";
7481} )();
7482
7483
7484var boolHook,
7485 attrHandle = jQuery.expr.attrHandle;
7486
7487jQuery.fn.extend( {
7488 attr: function( name, value ) {
7489 return access( this, jQuery.attr, name, value, arguments.length > 1 );
7490 },
7491
7492 removeAttr: function( name ) {
7493 return this.each( function() {
7494 jQuery.removeAttr( this, name );
7495 } );
7496 }
7497} );
7498
7499jQuery.extend( {
7500 attr: function( elem, name, value ) {
7501 var ret, hooks,
7502 nType = elem.nodeType;
7503
7504 // Don't get/set attributes on text, comment and attribute nodes
7505 if ( nType === 3 || nType === 8 || nType === 2 ) {
7506 return;
7507 }
7508
7509 // Fallback to prop when attributes are not supported
7510 if ( typeof elem.getAttribute === "undefined" ) {
7511 return jQuery.prop( elem, name, value );
7512 }
7513
7514 // Attribute hooks are determined by the lowercase version
7515 // Grab necessary hook if one is defined
7516 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7517 hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
7518 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
7519 }
7520
7521 if ( value !== undefined ) {
7522 if ( value === null ) {
7523 jQuery.removeAttr( elem, name );
7524 return;
7525 }
7526
7527 if ( hooks && "set" in hooks &&
7528 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
7529 return ret;
7530 }
7531
7532 elem.setAttribute( name, value + "" );
7533 return value;
7534 }
7535
7536 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
7537 return ret;
7538 }
7539
7540 ret = jQuery.find.attr( elem, name );
7541
7542 // Non-existent attributes return null, we normalize to undefined
7543 return ret == null ? undefined : ret;
7544 },
7545
7546 attrHooks: {
7547 type: {
7548 set: function( elem, value ) {
7549 if ( !support.radioValue && value === "radio" &&
7550 nodeName( elem, "input" ) ) {
7551 var val = elem.value;
7552 elem.setAttribute( "type", value );
7553 if ( val ) {
7554 elem.value = val;
7555 }
7556 return value;
7557 }
7558 }
7559 }
7560 },
7561
7562 removeAttr: function( elem, value ) {
7563 var name,
7564 i = 0,
7565
7566 // Attribute names can contain non-HTML whitespace characters
7567 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
7568 attrNames = value && value.match( rnothtmlwhite );
7569
7570 if ( attrNames && elem.nodeType === 1 ) {
7571 while ( ( name = attrNames[ i++ ] ) ) {
7572 elem.removeAttribute( name );
7573 }
7574 }
7575 }
7576} );
7577
7578// Hooks for boolean attributes
7579boolHook = {
7580 set: function( elem, value, name ) {
7581 if ( value === false ) {
7582
7583 // Remove boolean attributes when set to false
7584 jQuery.removeAttr( elem, name );
7585 } else {
7586 elem.setAttribute( name, name );
7587 }
7588 return name;
7589 }
7590};
7591
7592jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
7593 var getter = attrHandle[ name ] || jQuery.find.attr;
7594
7595 attrHandle[ name ] = function( elem, name, isXML ) {
7596 var ret, handle,
7597 lowercaseName = name.toLowerCase();
7598
7599 if ( !isXML ) {
7600
7601 // Avoid an infinite loop by temporarily removing this function from the getter
7602 handle = attrHandle[ lowercaseName ];
7603 attrHandle[ lowercaseName ] = ret;
7604 ret = getter( elem, name, isXML ) != null ?
7605 lowercaseName :
7606 null;
7607 attrHandle[ lowercaseName ] = handle;
7608 }
7609 return ret;
7610 };
7611} );
7612
7613
7614
7615
7616var rfocusable = /^(?:input|select|textarea|button)$/i,
7617 rclickable = /^(?:a|area)$/i;
7618
7619jQuery.fn.extend( {
7620 prop: function( name, value ) {
7621 return access( this, jQuery.prop, name, value, arguments.length > 1 );
7622 },
7623
7624 removeProp: function( name ) {
7625 return this.each( function() {
7626 delete this[ jQuery.propFix[ name ] || name ];
7627 } );
7628 }
7629} );
7630
7631jQuery.extend( {
7632 prop: function( elem, name, value ) {
7633 var ret, hooks,
7634 nType = elem.nodeType;
7635
7636 // Don't get/set properties on text, comment and attribute nodes
7637 if ( nType === 3 || nType === 8 || nType === 2 ) {
7638 return;
7639 }
7640
7641 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7642
7643 // Fix name and attach hooks
7644 name = jQuery.propFix[ name ] || name;
7645 hooks = jQuery.propHooks[ name ];
7646 }
7647
7648 if ( value !== undefined ) {
7649 if ( hooks && "set" in hooks &&
7650 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
7651 return ret;
7652 }
7653
7654 return ( elem[ name ] = value );
7655 }
7656
7657 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
7658 return ret;
7659 }
7660
7661 return elem[ name ];
7662 },
7663
7664 propHooks: {
7665 tabIndex: {
7666 get: function( elem ) {
7667
7668 // Support: IE <=9 - 11 only
7669 // elem.tabIndex doesn't always return the
7670 // correct value when it hasn't been explicitly set
7671 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
7672 // Use proper attribute retrieval(#12072)
7673 var tabindex = jQuery.find.attr( elem, "tabindex" );
7674
7675 if ( tabindex ) {
7676 return parseInt( tabindex, 10 );
7677 }
7678
7679 if (
7680 rfocusable.test( elem.nodeName ) ||
7681 rclickable.test( elem.nodeName ) &&
7682 elem.href
7683 ) {
7684 return 0;
7685 }
7686
7687 return -1;
7688 }
7689 }
7690 },
7691
7692 propFix: {
7693 "for": "htmlFor",
7694 "class": "className"
7695 }
7696} );
7697
7698// Support: IE <=11 only
7699// Accessing the selectedIndex property
7700// forces the browser to respect setting selected
7701// on the option
7702// The getter ensures a default option is selected
7703// when in an optgroup
7704// eslint rule "no-unused-expressions" is disabled for this code
7705// since it considers such accessions noop
7706if ( !support.optSelected ) {
7707 jQuery.propHooks.selected = {
7708 get: function( elem ) {
7709
7710 /* eslint no-unused-expressions: "off" */
7711
7712 var parent = elem.parentNode;
7713 if ( parent && parent.parentNode ) {
7714 parent.parentNode.selectedIndex;
7715 }
7716 return null;
7717 },
7718 set: function( elem ) {
7719
7720 /* eslint no-unused-expressions: "off" */
7721
7722 var parent = elem.parentNode;
7723 if ( parent ) {
7724 parent.selectedIndex;
7725
7726 if ( parent.parentNode ) {
7727 parent.parentNode.selectedIndex;
7728 }
7729 }
7730 }
7731 };
7732}
7733
7734jQuery.each( [
7735 "tabIndex",
7736 "readOnly",
7737 "maxLength",
7738 "cellSpacing",
7739 "cellPadding",
7740 "rowSpan",
7741 "colSpan",
7742 "useMap",
7743 "frameBorder",
7744 "contentEditable"
7745], function() {
7746 jQuery.propFix[ this.toLowerCase() ] = this;
7747} );
7748
7749
7750
7751
7752 // Strip and collapse whitespace according to HTML spec
7753 // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
7754 function stripAndCollapse( value ) {
7755 var tokens = value.match( rnothtmlwhite ) || [];
7756 return tokens.join( " " );
7757 }
7758
7759
7760function getClass( elem ) {
7761 return elem.getAttribute && elem.getAttribute( "class" ) || "";
7762}
7763
7764jQuery.fn.extend( {
7765 addClass: function( value ) {
7766 var classes, elem, cur, curValue, clazz, j, finalValue,
7767 i = 0;
7768
7769 if ( jQuery.isFunction( value ) ) {
7770 return this.each( function( j ) {
7771 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
7772 } );
7773 }
7774
7775 if ( typeof value === "string" && value ) {
7776 classes = value.match( rnothtmlwhite ) || [];
7777
7778 while ( ( elem = this[ i++ ] ) ) {
7779 curValue = getClass( elem );
7780 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
7781
7782 if ( cur ) {
7783 j = 0;
7784 while ( ( clazz = classes[ j++ ] ) ) {
7785 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
7786 cur += clazz + " ";
7787 }
7788 }
7789
7790 // Only assign if different to avoid unneeded rendering.
7791 finalValue = stripAndCollapse( cur );
7792 if ( curValue !== finalValue ) {
7793 elem.setAttribute( "class", finalValue );
7794 }
7795 }
7796 }
7797 }
7798
7799 return this;
7800 },
7801
7802 removeClass: function( value ) {
7803 var classes, elem, cur, curValue, clazz, j, finalValue,
7804 i = 0;
7805
7806 if ( jQuery.isFunction( value ) ) {
7807 return this.each( function( j ) {
7808 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
7809 } );
7810 }
7811
7812 if ( !arguments.length ) {
7813 return this.attr( "class", "" );
7814 }
7815
7816 if ( typeof value === "string" && value ) {
7817 classes = value.match( rnothtmlwhite ) || [];
7818
7819 while ( ( elem = this[ i++ ] ) ) {
7820 curValue = getClass( elem );
7821
7822 // This expression is here for better compressibility (see addClass)
7823 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
7824
7825 if ( cur ) {
7826 j = 0;
7827 while ( ( clazz = classes[ j++ ] ) ) {
7828
7829 // Remove *all* instances
7830 while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
7831 cur = cur.replace( " " + clazz + " ", " " );
7832 }
7833 }
7834
7835 // Only assign if different to avoid unneeded rendering.
7836 finalValue = stripAndCollapse( cur );
7837 if ( curValue !== finalValue ) {
7838 elem.setAttribute( "class", finalValue );
7839 }
7840 }
7841 }
7842 }
7843
7844 return this;
7845 },
7846
7847 toggleClass: function( value, stateVal ) {
7848 var type = typeof value;
7849
7850 if ( typeof stateVal === "boolean" && type === "string" ) {
7851 return stateVal ? this.addClass( value ) : this.removeClass( value );
7852 }
7853
7854 if ( jQuery.isFunction( value ) ) {
7855 return this.each( function( i ) {
7856 jQuery( this ).toggleClass(
7857 value.call( this, i, getClass( this ), stateVal ),
7858 stateVal
7859 );
7860 } );
7861 }
7862
7863 return this.each( function() {
7864 var className, i, self, classNames;
7865
7866 if ( type === "string" ) {
7867
7868 // Toggle individual class names
7869 i = 0;
7870 self = jQuery( this );
7871 classNames = value.match( rnothtmlwhite ) || [];
7872
7873 while ( ( className = classNames[ i++ ] ) ) {
7874
7875 // Check each className given, space separated list
7876 if ( self.hasClass( className ) ) {
7877 self.removeClass( className );
7878 } else {
7879 self.addClass( className );
7880 }
7881 }
7882
7883 // Toggle whole class name
7884 } else if ( value === undefined || type === "boolean" ) {
7885 className = getClass( this );
7886 if ( className ) {
7887
7888 // Store className if set
7889 dataPriv.set( this, "__className__", className );
7890 }
7891
7892 // If the element has a class name or if we're passed `false`,
7893 // then remove the whole classname (if there was one, the above saved it).
7894 // Otherwise bring back whatever was previously saved (if anything),
7895 // falling back to the empty string if nothing was stored.
7896 if ( this.setAttribute ) {
7897 this.setAttribute( "class",
7898 className || value === false ?
7899 "" :
7900 dataPriv.get( this, "__className__" ) || ""
7901 );
7902 }
7903 }
7904 } );
7905 },
7906
7907 hasClass: function( selector ) {
7908 var className, elem,
7909 i = 0;
7910
7911 className = " " + selector + " ";
7912 while ( ( elem = this[ i++ ] ) ) {
7913 if ( elem.nodeType === 1 &&
7914 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
7915 return true;
7916 }
7917 }
7918
7919 return false;
7920 }
7921} );
7922
7923
7924
7925
7926var rreturn = /\r/g;
7927
7928jQuery.fn.extend( {
7929 val: function( value ) {
7930 var hooks, ret, isFunction,
7931 elem = this[ 0 ];
7932
7933 if ( !arguments.length ) {
7934 if ( elem ) {
7935 hooks = jQuery.valHooks[ elem.type ] ||
7936 jQuery.valHooks[ elem.nodeName.toLowerCase() ];
7937
7938 if ( hooks &&
7939 "get" in hooks &&
7940 ( ret = hooks.get( elem, "value" ) ) !== undefined
7941 ) {
7942 return ret;
7943 }
7944
7945 ret = elem.value;
7946
7947 // Handle most common string cases
7948 if ( typeof ret === "string" ) {
7949 return ret.replace( rreturn, "" );
7950 }
7951
7952 // Handle cases where value is null/undef or number
7953 return ret == null ? "" : ret;
7954 }
7955
7956 return;
7957 }
7958
7959 isFunction = jQuery.isFunction( value );
7960
7961 return this.each( function( i ) {
7962 var val;
7963
7964 if ( this.nodeType !== 1 ) {
7965 return;
7966 }
7967
7968 if ( isFunction ) {
7969 val = value.call( this, i, jQuery( this ).val() );
7970 } else {
7971 val = value;
7972 }
7973
7974 // Treat null/undefined as ""; convert numbers to string
7975 if ( val == null ) {
7976 val = "";
7977
7978 } else if ( typeof val === "number" ) {
7979 val += "";
7980
7981 } else if ( Array.isArray( val ) ) {
7982 val = jQuery.map( val, function( value ) {
7983 return value == null ? "" : value + "";
7984 } );
7985 }
7986
7987 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
7988
7989 // If set returns undefined, fall back to normal setting
7990 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
7991 this.value = val;
7992 }
7993 } );
7994 }
7995} );
7996
7997jQuery.extend( {
7998 valHooks: {
7999 option: {
8000 get: function( elem ) {
8001
8002 var val = jQuery.find.attr( elem, "value" );
8003 return val != null ?
8004 val :
8005
8006 // Support: IE <=10 - 11 only
8007 // option.text throws exceptions (#14686, #14858)
8008 // Strip and collapse whitespace
8009 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
8010 stripAndCollapse( jQuery.text( elem ) );
8011 }
8012 },
8013 select: {
8014 get: function( elem ) {
8015 var value, option, i,
8016 options = elem.options,
8017 index = elem.selectedIndex,
8018 one = elem.type === "select-one",
8019 values = one ? null : [],
8020 max = one ? index + 1 : options.length;
8021
8022 if ( index < 0 ) {
8023 i = max;
8024
8025 } else {
8026 i = one ? index : 0;
8027 }
8028
8029 // Loop through all the selected options
8030 for ( ; i < max; i++ ) {
8031 option = options[ i ];
8032
8033 // Support: IE <=9 only
8034 // IE8-9 doesn't update selected after form reset (#2551)
8035 if ( ( option.selected || i === index ) &&
8036
8037 // Don't return options that are disabled or in a disabled optgroup
8038 !option.disabled &&
8039 ( !option.parentNode.disabled ||
8040 !nodeName( option.parentNode, "optgroup" ) ) ) {
8041
8042 // Get the specific value for the option
8043 value = jQuery( option ).val();
8044
8045 // We don't need an array for one selects
8046 if ( one ) {
8047 return value;
8048 }
8049
8050 // Multi-Selects return an array
8051 values.push( value );
8052 }
8053 }
8054
8055 return values;
8056 },
8057
8058 set: function( elem, value ) {
8059 var optionSet, option,
8060 options = elem.options,
8061 values = jQuery.makeArray( value ),
8062 i = options.length;
8063
8064 while ( i-- ) {
8065 option = options[ i ];
8066
8067 /* eslint-disable no-cond-assign */
8068
8069 if ( option.selected =
8070 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
8071 ) {
8072 optionSet = true;
8073 }
8074
8075 /* eslint-enable no-cond-assign */
8076 }
8077
8078 // Force browsers to behave consistently when non-matching value is set
8079 if ( !optionSet ) {
8080 elem.selectedIndex = -1;
8081 }
8082 return values;
8083 }
8084 }
8085 }
8086} );
8087
8088// Radios and checkboxes getter/setter
8089jQuery.each( [ "radio", "checkbox" ], function() {
8090 jQuery.valHooks[ this ] = {
8091 set: function( elem, value ) {
8092 if ( Array.isArray( value ) ) {
8093 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
8094 }
8095 }
8096 };
8097 if ( !support.checkOn ) {
8098 jQuery.valHooks[ this ].get = function( elem ) {
8099 return elem.getAttribute( "value" ) === null ? "on" : elem.value;
8100 };
8101 }
8102} );
8103
8104
8105
8106
8107// Return jQuery for attributes-only inclusion
8108
8109
8110var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
8111
8112jQuery.extend( jQuery.event, {
8113
8114 trigger: function( event, data, elem, onlyHandlers ) {
8115
8116 var i, cur, tmp, bubbleType, ontype, handle, special,
8117 eventPath = [ elem || document ],
8118 type = hasOwn.call( event, "type" ) ? event.type : event,
8119 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
8120
8121 cur = tmp = elem = elem || document;
8122
8123 // Don't do events on text and comment nodes
8124 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
8125 return;
8126 }
8127
8128 // focus/blur morphs to focusin/out; ensure we're not firing them right now
8129 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
8130 return;
8131 }
8132
8133 if ( type.indexOf( "." ) > -1 ) {
8134
8135 // Namespaced trigger; create a regexp to match event type in handle()
8136 namespaces = type.split( "." );
8137 type = namespaces.shift();
8138 namespaces.sort();
8139 }
8140 ontype = type.indexOf( ":" ) < 0 && "on" + type;
8141
8142 // Caller can pass in a jQuery.Event object, Object, or just an event type string
8143 event = event[ jQuery.expando ] ?
8144 event :
8145 new jQuery.Event( type, typeof event === "object" && event );
8146
8147 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
8148 event.isTrigger = onlyHandlers ? 2 : 3;
8149 event.namespace = namespaces.join( "." );
8150 event.rnamespace = event.namespace ?
8151 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
8152 null;
8153
8154 // Clean up the event in case it is being reused
8155 event.result = undefined;
8156 if ( !event.target ) {
8157 event.target = elem;
8158 }
8159
8160 // Clone any incoming data and prepend the event, creating the handler arg list
8161 data = data == null ?
8162 [ event ] :
8163 jQuery.makeArray( data, [ event ] );
8164
8165 // Allow special events to draw outside the lines
8166 special = jQuery.event.special[ type ] || {};
8167 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
8168 return;
8169 }
8170
8171 // Determine event propagation path in advance, per W3C events spec (#9951)
8172 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
8173 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
8174
8175 bubbleType = special.delegateType || type;
8176 if ( !rfocusMorph.test( bubbleType + type ) ) {
8177 cur = cur.parentNode;
8178 }
8179 for ( ; cur; cur = cur.parentNode ) {
8180 eventPath.push( cur );
8181 tmp = cur;
8182 }
8183
8184 // Only add window if we got to document (e.g., not plain obj or detached DOM)
8185 if ( tmp === ( elem.ownerDocument || document ) ) {
8186 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
8187 }
8188 }
8189
8190 // Fire handlers on the event path
8191 i = 0;
8192 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
8193
8194 event.type = i > 1 ?
8195 bubbleType :
8196 special.bindType || type;
8197
8198 // jQuery handler
8199 handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
8200 dataPriv.get( cur, "handle" );
8201 if ( handle ) {
8202 handle.apply( cur, data );
8203 }
8204
8205 // Native handler
8206 handle = ontype && cur[ ontype ];
8207 if ( handle && handle.apply && acceptData( cur ) ) {
8208 event.result = handle.apply( cur, data );
8209 if ( event.result === false ) {
8210 event.preventDefault();
8211 }
8212 }
8213 }
8214 event.type = type;
8215
8216 // If nobody prevented the default action, do it now
8217 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
8218
8219 if ( ( !special._default ||
8220 special._default.apply( eventPath.pop(), data ) === false ) &&
8221 acceptData( elem ) ) {
8222
8223 // Call a native DOM method on the target with the same name as the event.
8224 // Don't do default actions on window, that's where global variables be (#6170)
8225 if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
8226
8227 // Don't re-trigger an onFOO event when we call its FOO() method
8228 tmp = elem[ ontype ];
8229
8230 if ( tmp ) {
8231 elem[ ontype ] = null;
8232 }
8233
8234 // Prevent re-triggering of the same event, since we already bubbled it above
8235 jQuery.event.triggered = type;
8236 elem[ type ]();
8237 jQuery.event.triggered = undefined;
8238
8239 if ( tmp ) {
8240 elem[ ontype ] = tmp;
8241 }
8242 }
8243 }
8244 }
8245
8246 return event.result;
8247 },
8248
8249 // Piggyback on a donor event to simulate a different one
8250 // Used only for `focus(in | out)` events
8251 simulate: function( type, elem, event ) {
8252 var e = jQuery.extend(
8253 new jQuery.Event(),
8254 event,
8255 {
8256 type: type,
8257 isSimulated: true
8258 }
8259 );
8260
8261 jQuery.event.trigger( e, null, elem );
8262 }
8263
8264} );
8265
8266jQuery.fn.extend( {
8267
8268 trigger: function( type, data ) {
8269 return this.each( function() {
8270 jQuery.event.trigger( type, data, this );
8271 } );
8272 },
8273 triggerHandler: function( type, data ) {
8274 var elem = this[ 0 ];
8275 if ( elem ) {
8276 return jQuery.event.trigger( type, data, elem, true );
8277 }
8278 }
8279} );
8280
8281
8282jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
8283 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
8284 "change select submit keydown keypress keyup contextmenu" ).split( " " ),
8285 function( i, name ) {
8286
8287 // Handle event binding
8288 jQuery.fn[ name ] = function( data, fn ) {
8289 return arguments.length > 0 ?
8290 this.on( name, null, data, fn ) :
8291 this.trigger( name );
8292 };
8293} );
8294
8295jQuery.fn.extend( {
8296 hover: function( fnOver, fnOut ) {
8297 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
8298 }
8299} );
8300
8301
8302
8303
8304support.focusin = "onfocusin" in window;
8305
8306
8307// Support: Firefox <=44
8308// Firefox doesn't have focus(in | out) events
8309// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
8310//
8311// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
8312// focus(in | out) events fire after focus & blur events,
8313// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
8314// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
8315if ( !support.focusin ) {
8316 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
8317
8318 // Attach a single capturing handler on the document while someone wants focusin/focusout
8319 var handler = function( event ) {
8320 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
8321 };
8322
8323 jQuery.event.special[ fix ] = {
8324 setup: function() {
8325 var doc = this.ownerDocument || this,
8326 attaches = dataPriv.access( doc, fix );
8327
8328 if ( !attaches ) {
8329 doc.addEventListener( orig, handler, true );
8330 }
8331 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
8332 },
8333 teardown: function() {
8334 var doc = this.ownerDocument || this,
8335 attaches = dataPriv.access( doc, fix ) - 1;
8336
8337 if ( !attaches ) {
8338 doc.removeEventListener( orig, handler, true );
8339 dataPriv.remove( doc, fix );
8340
8341 } else {
8342 dataPriv.access( doc, fix, attaches );
8343 }
8344 }
8345 };
8346 } );
8347}
8348var location = window.location;
8349
8350var nonce = jQuery.now();
8351
8352var rquery = ( /\?/ );
8353
8354
8355
8356// Cross-browser xml parsing
8357jQuery.parseXML = function( data ) {
8358 var xml;
8359 if ( !data || typeof data !== "string" ) {
8360 return null;
8361 }
8362
8363 // Support: IE 9 - 11 only
8364 // IE throws on parseFromString with invalid input.
8365 try {
8366 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
8367 } catch ( e ) {
8368 xml = undefined;
8369 }
8370
8371 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
8372 jQuery.error( "Invalid XML: " + data );
8373 }
8374 return xml;
8375};
8376
8377
8378var
8379 rbracket = /\[\]$/,
8380 rCRLF = /\r?\n/g,
8381 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
8382 rsubmittable = /^(?:input|select|textarea|keygen)/i;
8383
8384function buildParams( prefix, obj, traditional, add ) {
8385 var name;
8386
8387 if ( Array.isArray( obj ) ) {
8388
8389 // Serialize array item.
8390 jQuery.each( obj, function( i, v ) {
8391 if ( traditional || rbracket.test( prefix ) ) {
8392
8393 // Treat each array item as a scalar.
8394 add( prefix, v );
8395
8396 } else {
8397
8398 // Item is non-scalar (array or object), encode its numeric index.
8399 buildParams(
8400 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
8401 v,
8402 traditional,
8403 add
8404 );
8405 }
8406 } );
8407
8408 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
8409
8410 // Serialize object item.
8411 for ( name in obj ) {
8412 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
8413 }
8414
8415 } else {
8416
8417 // Serialize scalar item.
8418 add( prefix, obj );
8419 }
8420}
8421
8422// Serialize an array of form elements or a set of
8423// key/values into a query string
8424jQuery.param = function( a, traditional ) {
8425 var prefix,
8426 s = [],
8427 add = function( key, valueOrFunction ) {
8428
8429 // If value is a function, invoke it and use its return value
8430 var value = jQuery.isFunction( valueOrFunction ) ?
8431 valueOrFunction() :
8432 valueOrFunction;
8433
8434 s[ s.length ] = encodeURIComponent( key ) + "=" +
8435 encodeURIComponent( value == null ? "" : value );
8436 };
8437
8438 // If an array was passed in, assume that it is an array of form elements.
8439 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
8440
8441 // Serialize the form elements
8442 jQuery.each( a, function() {
8443 add( this.name, this.value );
8444 } );
8445
8446 } else {
8447
8448 // If traditional, encode the "old" way (the way 1.3.2 or older
8449 // did it), otherwise encode params recursively.
8450 for ( prefix in a ) {
8451 buildParams( prefix, a[ prefix ], traditional, add );
8452 }
8453 }
8454
8455 // Return the resulting serialization
8456 return s.join( "&" );
8457};
8458
8459jQuery.fn.extend( {
8460 serialize: function() {
8461 return jQuery.param( this.serializeArray() );
8462 },
8463 serializeArray: function() {
8464 return this.map( function() {
8465
8466 // Can add propHook for "elements" to filter or add form elements
8467 var elements = jQuery.prop( this, "elements" );
8468 return elements ? jQuery.makeArray( elements ) : this;
8469 } )
8470 .filter( function() {
8471 var type = this.type;
8472
8473 // Use .is( ":disabled" ) so that fieldset[disabled] works
8474 return this.name && !jQuery( this ).is( ":disabled" ) &&
8475 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
8476 ( this.checked || !rcheckableType.test( type ) );
8477 } )
8478 .map( function( i, elem ) {
8479 var val = jQuery( this ).val();
8480
8481 if ( val == null ) {
8482 return null;
8483 }
8484
8485 if ( Array.isArray( val ) ) {
8486 return jQuery.map( val, function( val ) {
8487 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8488 } );
8489 }
8490
8491 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8492 } ).get();
8493 }
8494} );
8495
8496
8497var
8498 r20 = /%20/g,
8499 rhash = /#.*$/,
8500 rantiCache = /([?&])_=[^&]*/,
8501 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
8502
8503 // #7653, #8125, #8152: local protocol detection
8504 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
8505 rnoContent = /^(?:GET|HEAD)$/,
8506 rprotocol = /^\/\//,
8507
8508 /* Prefilters
8509 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
8510 * 2) These are called:
8511 * - BEFORE asking for a transport
8512 * - AFTER param serialization (s.data is a string if s.processData is true)
8513 * 3) key is the dataType
8514 * 4) the catchall symbol "*" can be used
8515 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
8516 */
8517 prefilters = {},
8518
8519 /* Transports bindings
8520 * 1) key is the dataType
8521 * 2) the catchall symbol "*" can be used
8522 * 3) selection will start with transport dataType and THEN go to "*" if needed
8523 */
8524 transports = {},
8525
8526 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
8527 allTypes = "*/".concat( "*" ),
8528
8529 // Anchor tag for parsing the document origin
8530 originAnchor = document.createElement( "a" );
8531 originAnchor.href = location.href;
8532
8533// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
8534function addToPrefiltersOrTransports( structure ) {
8535
8536 // dataTypeExpression is optional and defaults to "*"
8537 return function( dataTypeExpression, func ) {
8538
8539 if ( typeof dataTypeExpression !== "string" ) {
8540 func = dataTypeExpression;
8541 dataTypeExpression = "*";
8542 }
8543
8544 var dataType,
8545 i = 0,
8546 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
8547
8548 if ( jQuery.isFunction( func ) ) {
8549
8550 // For each dataType in the dataTypeExpression
8551 while ( ( dataType = dataTypes[ i++ ] ) ) {
8552
8553 // Prepend if requested
8554 if ( dataType[ 0 ] === "+" ) {
8555 dataType = dataType.slice( 1 ) || "*";
8556 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
8557
8558 // Otherwise append
8559 } else {
8560 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
8561 }
8562 }
8563 }
8564 };
8565}
8566
8567// Base inspection function for prefilters and transports
8568function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
8569
8570 var inspected = {},
8571 seekingTransport = ( structure === transports );
8572
8573 function inspect( dataType ) {
8574 var selected;
8575 inspected[ dataType ] = true;
8576 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
8577 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
8578 if ( typeof dataTypeOrTransport === "string" &&
8579 !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
8580
8581 options.dataTypes.unshift( dataTypeOrTransport );
8582 inspect( dataTypeOrTransport );
8583 return false;
8584 } else if ( seekingTransport ) {
8585 return !( selected = dataTypeOrTransport );
8586 }
8587 } );
8588 return selected;
8589 }
8590
8591 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
8592}
8593
8594// A special extend for ajax options
8595// that takes "flat" options (not to be deep extended)
8596// Fixes #9887
8597function ajaxExtend( target, src ) {
8598 var key, deep,
8599 flatOptions = jQuery.ajaxSettings.flatOptions || {};
8600
8601 for ( key in src ) {
8602 if ( src[ key ] !== undefined ) {
8603 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
8604 }
8605 }
8606 if ( deep ) {
8607 jQuery.extend( true, target, deep );
8608 }
8609
8610 return target;
8611}
8612
8613/* Handles responses to an ajax request:
8614 * - finds the right dataType (mediates between content-type and expected dataType)
8615 * - returns the corresponding response
8616 */
8617function ajaxHandleResponses( s, jqXHR, responses ) {
8618
8619 var ct, type, finalDataType, firstDataType,
8620 contents = s.contents,
8621 dataTypes = s.dataTypes;
8622
8623 // Remove auto dataType and get content-type in the process
8624 while ( dataTypes[ 0 ] === "*" ) {
8625 dataTypes.shift();
8626 if ( ct === undefined ) {
8627 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
8628 }
8629 }
8630
8631 // Check if we're dealing with a known content-type
8632 if ( ct ) {
8633 for ( type in contents ) {
8634 if ( contents[ type ] && contents[ type ].test( ct ) ) {
8635 dataTypes.unshift( type );
8636 break;
8637 }
8638 }
8639 }
8640
8641 // Check to see if we have a response for the expected dataType
8642 if ( dataTypes[ 0 ] in responses ) {
8643 finalDataType = dataTypes[ 0 ];
8644 } else {
8645
8646 // Try convertible dataTypes
8647 for ( type in responses ) {
8648 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
8649 finalDataType = type;
8650 break;
8651 }
8652 if ( !firstDataType ) {
8653 firstDataType = type;
8654 }
8655 }
8656
8657 // Or just use first one
8658 finalDataType = finalDataType || firstDataType;
8659 }
8660
8661 // If we found a dataType
8662 // We add the dataType to the list if needed
8663 // and return the corresponding response
8664 if ( finalDataType ) {
8665 if ( finalDataType !== dataTypes[ 0 ] ) {
8666 dataTypes.unshift( finalDataType );
8667 }
8668 return responses[ finalDataType ];
8669 }
8670}
8671
8672/* Chain conversions given the request and the original response
8673 * Also sets the responseXXX fields on the jqXHR instance
8674 */
8675function ajaxConvert( s, response, jqXHR, isSuccess ) {
8676 var conv2, current, conv, tmp, prev,
8677 converters = {},
8678
8679 // Work with a copy of dataTypes in case we need to modify it for conversion
8680 dataTypes = s.dataTypes.slice();
8681
8682 // Create converters map with lowercased keys
8683 if ( dataTypes[ 1 ] ) {
8684 for ( conv in s.converters ) {
8685 converters[ conv.toLowerCase() ] = s.converters[ conv ];
8686 }
8687 }
8688
8689 current = dataTypes.shift();
8690
8691 // Convert to each sequential dataType
8692 while ( current ) {
8693
8694 if ( s.responseFields[ current ] ) {
8695 jqXHR[ s.responseFields[ current ] ] = response;
8696 }
8697
8698 // Apply the dataFilter if provided
8699 if ( !prev && isSuccess && s.dataFilter ) {
8700 response = s.dataFilter( response, s.dataType );
8701 }
8702
8703 prev = current;
8704 current = dataTypes.shift();
8705
8706 if ( current ) {
8707
8708 // There's only work to do if current dataType is non-auto
8709 if ( current === "*" ) {
8710
8711 current = prev;
8712
8713 // Convert response if prev dataType is non-auto and differs from current
8714 } else if ( prev !== "*" && prev !== current ) {
8715
8716 // Seek a direct converter
8717 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
8718
8719 // If none found, seek a pair
8720 if ( !conv ) {
8721 for ( conv2 in converters ) {
8722
8723 // If conv2 outputs current
8724 tmp = conv2.split( " " );
8725 if ( tmp[ 1 ] === current ) {
8726
8727 // If prev can be converted to accepted input
8728 conv = converters[ prev + " " + tmp[ 0 ] ] ||
8729 converters[ "* " + tmp[ 0 ] ];
8730 if ( conv ) {
8731
8732 // Condense equivalence converters
8733 if ( conv === true ) {
8734 conv = converters[ conv2 ];
8735
8736 // Otherwise, insert the intermediate dataType
8737 } else if ( converters[ conv2 ] !== true ) {
8738 current = tmp[ 0 ];
8739 dataTypes.unshift( tmp[ 1 ] );
8740 }
8741 break;
8742 }
8743 }
8744 }
8745 }
8746
8747 // Apply converter (if not an equivalence)
8748 if ( conv !== true ) {
8749
8750 // Unless errors are allowed to bubble, catch and return them
8751 if ( conv && s.throws ) {
8752 response = conv( response );
8753 } else {
8754 try {
8755 response = conv( response );
8756 } catch ( e ) {
8757 return {
8758 state: "parsererror",
8759 error: conv ? e : "No conversion from " + prev + " to " + current
8760 };
8761 }
8762 }
8763 }
8764 }
8765 }
8766 }
8767
8768 return { state: "success", data: response };
8769}
8770
8771jQuery.extend( {
8772
8773 // Counter for holding the number of active queries
8774 active: 0,
8775
8776 // Last-Modified header cache for next request
8777 lastModified: {},
8778 etag: {},
8779
8780 ajaxSettings: {
8781 url: location.href,
8782 type: "GET",
8783 isLocal: rlocalProtocol.test( location.protocol ),
8784 global: true,
8785 processData: true,
8786 async: true,
8787 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
8788
8789 /*
8790 timeout: 0,
8791 data: null,
8792 dataType: null,
8793 username: null,
8794 password: null,
8795 cache: null,
8796 throws: false,
8797 traditional: false,
8798 headers: {},
8799 */
8800
8801 accepts: {
8802 "*": allTypes,
8803 text: "text/plain",
8804 html: "text/html",
8805 xml: "application/xml, text/xml",
8806 json: "application/json, text/javascript"
8807 },
8808
8809 contents: {
8810 xml: /\bxml\b/,
8811 html: /\bhtml/,
8812 json: /\bjson\b/
8813 },
8814
8815 responseFields: {
8816 xml: "responseXML",
8817 text: "responseText",
8818 json: "responseJSON"
8819 },
8820
8821 // Data converters
8822 // Keys separate source (or catchall "*") and destination types with a single space
8823 converters: {
8824
8825 // Convert anything to text
8826 "* text": String,
8827
8828 // Text to html (true = no transformation)
8829 "text html": true,
8830
8831 // Evaluate text as a json expression
8832 "text json": JSON.parse,
8833
8834 // Parse text as xml
8835 "text xml": jQuery.parseXML
8836 },
8837
8838 // For options that shouldn't be deep extended:
8839 // you can add your own custom options here if
8840 // and when you create one that shouldn't be
8841 // deep extended (see ajaxExtend)
8842 flatOptions: {
8843 url: true,
8844 context: true
8845 }
8846 },
8847
8848 // Creates a full fledged settings object into target
8849 // with both ajaxSettings and settings fields.
8850 // If target is omitted, writes into ajaxSettings.
8851 ajaxSetup: function( target, settings ) {
8852 return settings ?
8853
8854 // Building a settings object
8855 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
8856
8857 // Extending ajaxSettings
8858 ajaxExtend( jQuery.ajaxSettings, target );
8859 },
8860
8861 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
8862 ajaxTransport: addToPrefiltersOrTransports( transports ),
8863
8864 // Main method
8865 ajax: function( url, options ) {
8866
8867 // If url is an object, simulate pre-1.5 signature
8868 if ( typeof url === "object" ) {
8869 options = url;
8870 url = undefined;
8871 }
8872
8873 // Force options to be an object
8874 options = options || {};
8875
8876 var transport,
8877
8878 // URL without anti-cache param
8879 cacheURL,
8880
8881 // Response headers
8882 responseHeadersString,
8883 responseHeaders,
8884
8885 // timeout handle
8886 timeoutTimer,
8887
8888 // Url cleanup var
8889 urlAnchor,
8890
8891 // Request state (becomes false upon send and true upon completion)
8892 completed,
8893
8894 // To know if global events are to be dispatched
8895 fireGlobals,
8896
8897 // Loop variable
8898 i,
8899
8900 // uncached part of the url
8901 uncached,
8902
8903 // Create the final options object
8904 s = jQuery.ajaxSetup( {}, options ),
8905
8906 // Callbacks context
8907 callbackContext = s.context || s,
8908
8909 // Context for global events is callbackContext if it is a DOM node or jQuery collection
8910 globalEventContext = s.context &&
8911 ( callbackContext.nodeType || callbackContext.jquery ) ?
8912 jQuery( callbackContext ) :
8913 jQuery.event,
8914
8915 // Deferreds
8916 deferred = jQuery.Deferred(),
8917 completeDeferred = jQuery.Callbacks( "once memory" ),
8918
8919 // Status-dependent callbacks
8920 statusCode = s.statusCode || {},
8921
8922 // Headers (they are sent all at once)
8923 requestHeaders = {},
8924 requestHeadersNames = {},
8925
8926 // Default abort message
8927 strAbort = "canceled",
8928
8929 // Fake xhr
8930 jqXHR = {
8931 readyState: 0,
8932
8933 // Builds headers hashtable if needed
8934 getResponseHeader: function( key ) {
8935 var match;
8936 if ( completed ) {
8937 if ( !responseHeaders ) {
8938 responseHeaders = {};
8939 while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
8940 responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
8941 }
8942 }
8943 match = responseHeaders[ key.toLowerCase() ];
8944 }
8945 return match == null ? null : match;
8946 },
8947
8948 // Raw string
8949 getAllResponseHeaders: function() {
8950 return completed ? responseHeadersString : null;
8951 },
8952
8953 // Caches the header
8954 setRequestHeader: function( name, value ) {
8955 if ( completed == null ) {
8956 name = requestHeadersNames[ name.toLowerCase() ] =
8957 requestHeadersNames[ name.toLowerCase() ] || name;
8958 requestHeaders[ name ] = value;
8959 }
8960 return this;
8961 },
8962
8963 // Overrides response content-type header
8964 overrideMimeType: function( type ) {
8965 if ( completed == null ) {
8966 s.mimeType = type;
8967 }
8968 return this;
8969 },
8970
8971 // Status-dependent callbacks
8972 statusCode: function( map ) {
8973 var code;
8974 if ( map ) {
8975 if ( completed ) {
8976
8977 // Execute the appropriate callbacks
8978 jqXHR.always( map[ jqXHR.status ] );
8979 } else {
8980
8981 // Lazy-add the new callbacks in a way that preserves old ones
8982 for ( code in map ) {
8983 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
8984 }
8985 }
8986 }
8987 return this;
8988 },
8989
8990 // Cancel the request
8991 abort: function( statusText ) {
8992 var finalText = statusText || strAbort;
8993 if ( transport ) {
8994 transport.abort( finalText );
8995 }
8996 done( 0, finalText );
8997 return this;
8998 }
8999 };
9000
9001 // Attach deferreds
9002 deferred.promise( jqXHR );
9003
9004 // Add protocol if not provided (prefilters might expect it)
9005 // Handle falsy url in the settings object (#10093: consistency with old signature)
9006 // We also use the url parameter if available
9007 s.url = ( ( url || s.url || location.href ) + "" )
9008 .replace( rprotocol, location.protocol + "//" );
9009
9010 // Alias method option to type as per ticket #12004
9011 s.type = options.method || options.type || s.method || s.type;
9012
9013 // Extract dataTypes list
9014 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
9015
9016 // A cross-domain request is in order when the origin doesn't match the current origin.
9017 if ( s.crossDomain == null ) {
9018 urlAnchor = document.createElement( "a" );
9019
9020 // Support: IE <=8 - 11, Edge 12 - 13
9021 // IE throws exception on accessing the href property if url is malformed,
9022 // e.g. http://example.com:80x/
9023 try {
9024 urlAnchor.href = s.url;
9025
9026 // Support: IE <=8 - 11 only
9027 // Anchor's host property isn't correctly set when s.url is relative
9028 urlAnchor.href = urlAnchor.href;
9029 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
9030 urlAnchor.protocol + "//" + urlAnchor.host;
9031 } catch ( e ) {
9032
9033 // If there is an error parsing the URL, assume it is crossDomain,
9034 // it can be rejected by the transport if it is invalid
9035 s.crossDomain = true;
9036 }
9037 }
9038
9039 // Convert data if not already a string
9040 if ( s.data && s.processData && typeof s.data !== "string" ) {
9041 s.data = jQuery.param( s.data, s.traditional );
9042 }
9043
9044 // Apply prefilters
9045 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
9046
9047 // If request was aborted inside a prefilter, stop there
9048 if ( completed ) {
9049 return jqXHR;
9050 }
9051
9052 // We can fire global events as of now if asked to
9053 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
9054 fireGlobals = jQuery.event && s.global;
9055
9056 // Watch for a new set of requests
9057 if ( fireGlobals && jQuery.active++ === 0 ) {
9058 jQuery.event.trigger( "ajaxStart" );
9059 }
9060
9061 // Uppercase the type
9062 s.type = s.type.toUpperCase();
9063
9064 // Determine if request has content
9065 s.hasContent = !rnoContent.test( s.type );
9066
9067 // Save the URL in case we're toying with the If-Modified-Since
9068 // and/or If-None-Match header later on
9069 // Remove hash to simplify url manipulation
9070 cacheURL = s.url.replace( rhash, "" );
9071
9072 // More options handling for requests with no content
9073 if ( !s.hasContent ) {
9074
9075 // Remember the hash so we can put it back
9076 uncached = s.url.slice( cacheURL.length );
9077
9078 // If data is available, append data to url
9079 if ( s.data ) {
9080 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
9081
9082 // #9682: remove data so that it's not used in an eventual retry
9083 delete s.data;
9084 }
9085
9086 // Add or update anti-cache param if needed
9087 if ( s.cache === false ) {
9088 cacheURL = cacheURL.replace( rantiCache, "$1" );
9089 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
9090 }
9091
9092 // Put hash and anti-cache on the URL that will be requested (gh-1732)
9093 s.url = cacheURL + uncached;
9094
9095 // Change '%20' to '+' if this is encoded form body content (gh-2658)
9096 } else if ( s.data && s.processData &&
9097 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
9098 s.data = s.data.replace( r20, "+" );
9099 }
9100
9101 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9102 if ( s.ifModified ) {
9103 if ( jQuery.lastModified[ cacheURL ] ) {
9104 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
9105 }
9106 if ( jQuery.etag[ cacheURL ] ) {
9107 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
9108 }
9109 }
9110
9111 // Set the correct header, if data is being sent
9112 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
9113 jqXHR.setRequestHeader( "Content-Type", s.contentType );
9114 }
9115
9116 // Set the Accepts header for the server, depending on the dataType
9117 jqXHR.setRequestHeader(
9118 "Accept",
9119 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
9120 s.accepts[ s.dataTypes[ 0 ] ] +
9121 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
9122 s.accepts[ "*" ]
9123 );
9124
9125 // Check for headers option
9126 for ( i in s.headers ) {
9127 jqXHR.setRequestHeader( i, s.headers[ i ] );
9128 }
9129
9130 // Allow custom headers/mimetypes and early abort
9131 if ( s.beforeSend &&
9132 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
9133
9134 // Abort if not done already and return
9135 return jqXHR.abort();
9136 }
9137
9138 // Aborting is no longer a cancellation
9139 strAbort = "abort";
9140
9141 // Install callbacks on deferreds
9142 completeDeferred.add( s.complete );
9143 jqXHR.done( s.success );
9144 jqXHR.fail( s.error );
9145
9146 // Get transport
9147 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
9148
9149 // If no transport, we auto-abort
9150 if ( !transport ) {
9151 done( -1, "No Transport" );
9152 } else {
9153 jqXHR.readyState = 1;
9154
9155 // Send global event
9156 if ( fireGlobals ) {
9157 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
9158 }
9159
9160 // If request was aborted inside ajaxSend, stop there
9161 if ( completed ) {
9162 return jqXHR;
9163 }
9164
9165 // Timeout
9166 if ( s.async && s.timeout > 0 ) {
9167 timeoutTimer = window.setTimeout( function() {
9168 jqXHR.abort( "timeout" );
9169 }, s.timeout );
9170 }
9171
9172 try {
9173 completed = false;
9174 transport.send( requestHeaders, done );
9175 } catch ( e ) {
9176
9177 // Rethrow post-completion exceptions
9178 if ( completed ) {
9179 throw e;
9180 }
9181
9182 // Propagate others as results
9183 done( -1, e );
9184 }
9185 }
9186
9187 // Callback for when everything is done
9188 function done( status, nativeStatusText, responses, headers ) {
9189 var isSuccess, success, error, response, modified,
9190 statusText = nativeStatusText;
9191
9192 // Ignore repeat invocations
9193 if ( completed ) {
9194 return;
9195 }
9196
9197 completed = true;
9198
9199 // Clear timeout if it exists
9200 if ( timeoutTimer ) {
9201 window.clearTimeout( timeoutTimer );
9202 }
9203
9204 // Dereference transport for early garbage collection
9205 // (no matter how long the jqXHR object will be used)
9206 transport = undefined;
9207
9208 // Cache response headers
9209 responseHeadersString = headers || "";
9210
9211 // Set readyState
9212 jqXHR.readyState = status > 0 ? 4 : 0;
9213
9214 // Determine if successful
9215 isSuccess = status >= 200 && status < 300 || status === 304;
9216
9217 // Get response data
9218 if ( responses ) {
9219 response = ajaxHandleResponses( s, jqXHR, responses );
9220 }
9221
9222 // Convert no matter what (that way responseXXX fields are always set)
9223 response = ajaxConvert( s, response, jqXHR, isSuccess );
9224
9225 // If successful, handle type chaining
9226 if ( isSuccess ) {
9227
9228 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9229 if ( s.ifModified ) {
9230 modified = jqXHR.getResponseHeader( "Last-Modified" );
9231 if ( modified ) {
9232 jQuery.lastModified[ cacheURL ] = modified;
9233 }
9234 modified = jqXHR.getResponseHeader( "etag" );
9235 if ( modified ) {
9236 jQuery.etag[ cacheURL ] = modified;
9237 }
9238 }
9239
9240 // if no content
9241 if ( status === 204 || s.type === "HEAD" ) {
9242 statusText = "nocontent";
9243
9244 // if not modified
9245 } else if ( status === 304 ) {
9246 statusText = "notmodified";
9247
9248 // If we have data, let's convert it
9249 } else {
9250 statusText = response.state;
9251 success = response.data;
9252 error = response.error;
9253 isSuccess = !error;
9254 }
9255 } else {
9256
9257 // Extract error from statusText and normalize for non-aborts
9258 error = statusText;
9259 if ( status || !statusText ) {
9260 statusText = "error";
9261 if ( status < 0 ) {
9262 status = 0;
9263 }
9264 }
9265 }
9266
9267 // Set data for the fake xhr object
9268 jqXHR.status = status;
9269 jqXHR.statusText = ( nativeStatusText || statusText ) + "";
9270
9271 // Success/Error
9272 if ( isSuccess ) {
9273 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
9274 } else {
9275 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
9276 }
9277
9278 // Status-dependent callbacks
9279 jqXHR.statusCode( statusCode );
9280 statusCode = undefined;
9281
9282 if ( fireGlobals ) {
9283 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
9284 [ jqXHR, s, isSuccess ? success : error ] );
9285 }
9286
9287 // Complete
9288 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
9289
9290 if ( fireGlobals ) {
9291 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
9292
9293 // Handle the global AJAX counter
9294 if ( !( --jQuery.active ) ) {
9295 jQuery.event.trigger( "ajaxStop" );
9296 }
9297 }
9298 }
9299
9300 return jqXHR;
9301 },
9302
9303 getJSON: function( url, data, callback ) {
9304 return jQuery.get( url, data, callback, "json" );
9305 },
9306
9307 getScript: function( url, callback ) {
9308 return jQuery.get( url, undefined, callback, "script" );
9309 }
9310} );
9311
9312jQuery.each( [ "get", "post" ], function( i, method ) {
9313 jQuery[ method ] = function( url, data, callback, type ) {
9314
9315 // Shift arguments if data argument was omitted
9316 if ( jQuery.isFunction( data ) ) {
9317 type = type || callback;
9318 callback = data;
9319 data = undefined;
9320 }
9321
9322 // The url can be an options object (which then must have .url)
9323 return jQuery.ajax( jQuery.extend( {
9324 url: url,
9325 type: method,
9326 dataType: type,
9327 data: data,
9328 success: callback
9329 }, jQuery.isPlainObject( url ) && url ) );
9330 };
9331} );
9332
9333
9334jQuery._evalUrl = function( url ) {
9335 return jQuery.ajax( {
9336 url: url,
9337
9338 // Make this explicit, since user can override this through ajaxSetup (#11264)
9339 type: "GET",
9340 dataType: "script",
9341 cache: true,
9342 async: false,
9343 global: false,
9344 "throws": true
9345 } );
9346};
9347
9348
9349jQuery.fn.extend( {
9350 wrapAll: function( html ) {
9351 var wrap;
9352
9353 if ( this[ 0 ] ) {
9354 if ( jQuery.isFunction( html ) ) {
9355 html = html.call( this[ 0 ] );
9356 }
9357
9358 // The elements to wrap the target around
9359 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
9360
9361 if ( this[ 0 ].parentNode ) {
9362 wrap.insertBefore( this[ 0 ] );
9363 }
9364
9365 wrap.map( function() {
9366 var elem = this;
9367
9368 while ( elem.firstElementChild ) {
9369 elem = elem.firstElementChild;
9370 }
9371
9372 return elem;
9373 } ).append( this );
9374 }
9375
9376 return this;
9377 },
9378
9379 wrapInner: function( html ) {
9380 if ( jQuery.isFunction( html ) ) {
9381 return this.each( function( i ) {
9382 jQuery( this ).wrapInner( html.call( this, i ) );
9383 } );
9384 }
9385
9386 return this.each( function() {
9387 var self = jQuery( this ),
9388 contents = self.contents();
9389
9390 if ( contents.length ) {
9391 contents.wrapAll( html );
9392
9393 } else {
9394 self.append( html );
9395 }
9396 } );
9397 },
9398
9399 wrap: function( html ) {
9400 var isFunction = jQuery.isFunction( html );
9401
9402 return this.each( function( i ) {
9403 jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
9404 } );
9405 },
9406
9407 unwrap: function( selector ) {
9408 this.parent( selector ).not( "body" ).each( function() {
9409 jQuery( this ).replaceWith( this.childNodes );
9410 } );
9411 return this;
9412 }
9413} );
9414
9415
9416jQuery.expr.pseudos.hidden = function( elem ) {
9417 return !jQuery.expr.pseudos.visible( elem );
9418};
9419jQuery.expr.pseudos.visible = function( elem ) {
9420 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
9421};
9422
9423
9424
9425
9426jQuery.ajaxSettings.xhr = function() {
9427 try {
9428 return new window.XMLHttpRequest();
9429 } catch ( e ) {}
9430};
9431
9432var xhrSuccessStatus = {
9433
9434 // File protocol always yields status code 0, assume 200
9435 0: 200,
9436
9437 // Support: IE <=9 only
9438 // #1450: sometimes IE returns 1223 when it should be 204
9439 1223: 204
9440 },
9441 xhrSupported = jQuery.ajaxSettings.xhr();
9442
9443support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
9444support.ajax = xhrSupported = !!xhrSupported;
9445
9446jQuery.ajaxTransport( function( options ) {
9447 var callback, errorCallback;
9448
9449 // Cross domain only allowed if supported through XMLHttpRequest
9450 if ( support.cors || xhrSupported && !options.crossDomain ) {
9451 return {
9452 send: function( headers, complete ) {
9453 var i,
9454 xhr = options.xhr();
9455
9456 xhr.open(
9457 options.type,
9458 options.url,
9459 options.async,
9460 options.username,
9461 options.password
9462 );
9463
9464 // Apply custom fields if provided
9465 if ( options.xhrFields ) {
9466 for ( i in options.xhrFields ) {
9467 xhr[ i ] = options.xhrFields[ i ];
9468 }
9469 }
9470
9471 // Override mime type if needed
9472 if ( options.mimeType && xhr.overrideMimeType ) {
9473 xhr.overrideMimeType( options.mimeType );
9474 }
9475
9476 // X-Requested-With header
9477 // For cross-domain requests, seeing as conditions for a preflight are
9478 // akin to a jigsaw puzzle, we simply never set it to be sure.
9479 // (it can always be set on a per-request basis or even using ajaxSetup)
9480 // For same-domain requests, won't change header if already provided.
9481 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
9482 headers[ "X-Requested-With" ] = "XMLHttpRequest";
9483 }
9484
9485 // Set headers
9486 for ( i in headers ) {
9487 xhr.setRequestHeader( i, headers[ i ] );
9488 }
9489
9490 // Callback
9491 callback = function( type ) {
9492 return function() {
9493 if ( callback ) {
9494 callback = errorCallback = xhr.onload =
9495 xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
9496
9497 if ( type === "abort" ) {
9498 xhr.abort();
9499 } else if ( type === "error" ) {
9500
9501 // Support: IE <=9 only
9502 // On a manual native abort, IE9 throws
9503 // errors on any property access that is not readyState
9504 if ( typeof xhr.status !== "number" ) {
9505 complete( 0, "error" );
9506 } else {
9507 complete(
9508
9509 // File: protocol always yields status 0; see #8605, #14207
9510 xhr.status,
9511 xhr.statusText
9512 );
9513 }
9514 } else {
9515 complete(
9516 xhrSuccessStatus[ xhr.status ] || xhr.status,
9517 xhr.statusText,
9518
9519 // Support: IE <=9 only
9520 // IE9 has no XHR2 but throws on binary (trac-11426)
9521 // For XHR2 non-text, let the caller handle it (gh-2498)
9522 ( xhr.responseType || "text" ) !== "text" ||
9523 typeof xhr.responseText !== "string" ?
9524 { binary: xhr.response } :
9525 { text: xhr.responseText },
9526 xhr.getAllResponseHeaders()
9527 );
9528 }
9529 }
9530 };
9531 };
9532
9533 // Listen to events
9534 xhr.onload = callback();
9535 errorCallback = xhr.onerror = callback( "error" );
9536
9537 // Support: IE 9 only
9538 // Use onreadystatechange to replace onabort
9539 // to handle uncaught aborts
9540 if ( xhr.onabort !== undefined ) {
9541 xhr.onabort = errorCallback;
9542 } else {
9543 xhr.onreadystatechange = function() {
9544
9545 // Check readyState before timeout as it changes
9546 if ( xhr.readyState === 4 ) {
9547
9548 // Allow onerror to be called first,
9549 // but that will not handle a native abort
9550 // Also, save errorCallback to a variable
9551 // as xhr.onerror cannot be accessed
9552 window.setTimeout( function() {
9553 if ( callback ) {
9554 errorCallback();
9555 }
9556 } );
9557 }
9558 };
9559 }
9560
9561 // Create the abort callback
9562 callback = callback( "abort" );
9563
9564 try {
9565
9566 // Do send the request (this may raise an exception)
9567 xhr.send( options.hasContent && options.data || null );
9568 } catch ( e ) {
9569
9570 // #14683: Only rethrow if this hasn't been notified as an error yet
9571 if ( callback ) {
9572 throw e;
9573 }
9574 }
9575 },
9576
9577 abort: function() {
9578 if ( callback ) {
9579 callback();
9580 }
9581 }
9582 };
9583 }
9584} );
9585
9586
9587
9588
9589// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
9590jQuery.ajaxPrefilter( function( s ) {
9591 if ( s.crossDomain ) {
9592 s.contents.script = false;
9593 }
9594} );
9595
9596// Install script dataType
9597jQuery.ajaxSetup( {
9598 accepts: {
9599 script: "text/javascript, application/javascript, " +
9600 "application/ecmascript, application/x-ecmascript"
9601 },
9602 contents: {
9603 script: /\b(?:java|ecma)script\b/
9604 },
9605 converters: {
9606 "text script": function( text ) {
9607 jQuery.globalEval( text );
9608 return text;
9609 }
9610 }
9611} );
9612
9613// Handle cache's special case and crossDomain
9614jQuery.ajaxPrefilter( "script", function( s ) {
9615 if ( s.cache === undefined ) {
9616 s.cache = false;
9617 }
9618 if ( s.crossDomain ) {
9619 s.type = "GET";
9620 }
9621} );
9622
9623// Bind script tag hack transport
9624jQuery.ajaxTransport( "script", function( s ) {
9625
9626 // This transport only deals with cross domain requests
9627 if ( s.crossDomain ) {
9628 var script, callback;
9629 return {
9630 send: function( _, complete ) {
9631 script = jQuery( "<script>" ).prop( {
9632 charset: s.scriptCharset,
9633 src: s.url
9634 } ).on(
9635 "load error",
9636 callback = function( evt ) {
9637 script.remove();
9638 callback = null;
9639 if ( evt ) {
9640 complete( evt.type === "error" ? 404 : 200, evt.type );
9641 }
9642 }
9643 );
9644
9645 // Use native DOM manipulation to avoid our domManip AJAX trickery
9646 document.head.appendChild( script[ 0 ] );
9647 },
9648 abort: function() {
9649 if ( callback ) {
9650 callback();
9651 }
9652 }
9653 };
9654 }
9655} );
9656
9657
9658
9659
9660var oldCallbacks = [],
9661 rjsonp = /(=)\?(?=&|$)|\?\?/;
9662
9663// Default jsonp settings
9664jQuery.ajaxSetup( {
9665 jsonp: "callback",
9666 jsonpCallback: function() {
9667 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
9668 this[ callback ] = true;
9669 return callback;
9670 }
9671} );
9672
9673// Detect, normalize options and install callbacks for jsonp requests
9674jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
9675
9676 var callbackName, overwritten, responseContainer,
9677 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
9678 "url" :
9679 typeof s.data === "string" &&
9680 ( s.contentType || "" )
9681 .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
9682 rjsonp.test( s.data ) && "data"
9683 );
9684
9685 // Handle iff the expected data type is "jsonp" or we have a parameter to set
9686 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
9687
9688 // Get callback name, remembering preexisting value associated with it
9689 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
9690 s.jsonpCallback() :
9691 s.jsonpCallback;
9692
9693 // Insert callback into url or form data
9694 if ( jsonProp ) {
9695 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
9696 } else if ( s.jsonp !== false ) {
9697 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
9698 }
9699
9700 // Use data converter to retrieve json after script execution
9701 s.converters[ "script json" ] = function() {
9702 if ( !responseContainer ) {
9703 jQuery.error( callbackName + " was not called" );
9704 }
9705 return responseContainer[ 0 ];
9706 };
9707
9708 // Force json dataType
9709 s.dataTypes[ 0 ] = "json";
9710
9711 // Install callback
9712 overwritten = window[ callbackName ];
9713 window[ callbackName ] = function() {
9714 responseContainer = arguments;
9715 };
9716
9717 // Clean-up function (fires after converters)
9718 jqXHR.always( function() {
9719
9720 // If previous value didn't exist - remove it
9721 if ( overwritten === undefined ) {
9722 jQuery( window ).removeProp( callbackName );
9723
9724 // Otherwise restore preexisting value
9725 } else {
9726 window[ callbackName ] = overwritten;
9727 }
9728
9729 // Save back as free
9730 if ( s[ callbackName ] ) {
9731
9732 // Make sure that re-using the options doesn't screw things around
9733 s.jsonpCallback = originalSettings.jsonpCallback;
9734
9735 // Save the callback name for future use
9736 oldCallbacks.push( callbackName );
9737 }
9738
9739 // Call if it was a function and we have a response
9740 if ( responseContainer && jQuery.isFunction( overwritten ) ) {
9741 overwritten( responseContainer[ 0 ] );
9742 }
9743
9744 responseContainer = overwritten = undefined;
9745 } );
9746
9747 // Delegate to script
9748 return "script";
9749 }
9750} );
9751
9752
9753
9754
9755// Support: Safari 8 only
9756// In Safari 8 documents created via document.implementation.createHTMLDocument
9757// collapse sibling forms: the second one becomes a child of the first one.
9758// Because of that, this security measure has to be disabled in Safari 8.
9759// https://bugs.webkit.org/show_bug.cgi?id=137337
9760support.createHTMLDocument = ( function() {
9761 var body = document.implementation.createHTMLDocument( "" ).body;
9762 body.innerHTML = "<form></form><form></form>";
9763 return body.childNodes.length === 2;
9764} )();
9765
9766
9767// Argument "data" should be string of html
9768// context (optional): If specified, the fragment will be created in this context,
9769// defaults to document
9770// keepScripts (optional): If true, will include scripts passed in the html string
9771jQuery.parseHTML = function( data, context, keepScripts ) {
9772 if ( typeof data !== "string" ) {
9773 return [];
9774 }
9775 if ( typeof context === "boolean" ) {
9776 keepScripts = context;
9777 context = false;
9778 }
9779
9780 var base, parsed, scripts;
9781
9782 if ( !context ) {
9783
9784 // Stop scripts or inline event handlers from being executed immediately
9785 // by using document.implementation
9786 if ( support.createHTMLDocument ) {
9787 context = document.implementation.createHTMLDocument( "" );
9788
9789 // Set the base href for the created document
9790 // so any parsed elements with URLs
9791 // are based on the document's URL (gh-2965)
9792 base = context.createElement( "base" );
9793 base.href = document.location.href;
9794 context.head.appendChild( base );
9795 } else {
9796 context = document;
9797 }
9798 }
9799
9800 parsed = rsingleTag.exec( data );
9801 scripts = !keepScripts && [];
9802
9803 // Single tag
9804 if ( parsed ) {
9805 return [ context.createElement( parsed[ 1 ] ) ];
9806 }
9807
9808 parsed = buildFragment( [ data ], context, scripts );
9809
9810 if ( scripts && scripts.length ) {
9811 jQuery( scripts ).remove();
9812 }
9813
9814 return jQuery.merge( [], parsed.childNodes );
9815};
9816
9817
9818/**
9819 * Load a url into a page
9820 */
9821jQuery.fn.load = function( url, params, callback ) {
9822 var selector, type, response,
9823 self = this,
9824 off = url.indexOf( " " );
9825
9826 if ( off > -1 ) {
9827 selector = stripAndCollapse( url.slice( off ) );
9828 url = url.slice( 0, off );
9829 }
9830
9831 // If it's a function
9832 if ( jQuery.isFunction( params ) ) {
9833
9834 // We assume that it's the callback
9835 callback = params;
9836 params = undefined;
9837
9838 // Otherwise, build a param string
9839 } else if ( params && typeof params === "object" ) {
9840 type = "POST";
9841 }
9842
9843 // If we have elements to modify, make the request
9844 if ( self.length > 0 ) {
9845 jQuery.ajax( {
9846 url: url,
9847
9848 // If "type" variable is undefined, then "GET" method will be used.
9849 // Make value of this field explicit since
9850 // user can override it through ajaxSetup method
9851 type: type || "GET",
9852 dataType: "html",
9853 data: params
9854 } ).done( function( responseText ) {
9855
9856 // Save response for use in complete callback
9857 response = arguments;
9858
9859 self.html( selector ?
9860
9861 // If a selector was specified, locate the right elements in a dummy div
9862 // Exclude scripts to avoid IE 'Permission Denied' errors
9863 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
9864
9865 // Otherwise use the full result
9866 responseText );
9867
9868 // If the request succeeds, this function gets "data", "status", "jqXHR"
9869 // but they are ignored because response was set above.
9870 // If it fails, this function gets "jqXHR", "status", "error"
9871 } ).always( callback && function( jqXHR, status ) {
9872 self.each( function() {
9873 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
9874 } );
9875 } );
9876 }
9877
9878 return this;
9879};
9880
9881
9882
9883
9884// Attach a bunch of functions for handling common AJAX events
9885jQuery.each( [
9886 "ajaxStart",
9887 "ajaxStop",
9888 "ajaxComplete",
9889 "ajaxError",
9890 "ajaxSuccess",
9891 "ajaxSend"
9892], function( i, type ) {
9893 jQuery.fn[ type ] = function( fn ) {
9894 return this.on( type, fn );
9895 };
9896} );
9897
9898
9899
9900
9901jQuery.expr.pseudos.animated = function( elem ) {
9902 return jQuery.grep( jQuery.timers, function( fn ) {
9903 return elem === fn.elem;
9904 } ).length;
9905};
9906
9907
9908
9909
9910jQuery.offset = {
9911 setOffset: function( elem, options, i ) {
9912 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
9913 position = jQuery.css( elem, "position" ),
9914 curElem = jQuery( elem ),
9915 props = {};
9916
9917 // Set position first, in-case top/left are set even on static elem
9918 if ( position === "static" ) {
9919 elem.style.position = "relative";
9920 }
9921
9922 curOffset = curElem.offset();
9923 curCSSTop = jQuery.css( elem, "top" );
9924 curCSSLeft = jQuery.css( elem, "left" );
9925 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
9926 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
9927
9928 // Need to be able to calculate position if either
9929 // top or left is auto and position is either absolute or fixed
9930 if ( calculatePosition ) {
9931 curPosition = curElem.position();
9932 curTop = curPosition.top;
9933 curLeft = curPosition.left;
9934
9935 } else {
9936 curTop = parseFloat( curCSSTop ) || 0;
9937 curLeft = parseFloat( curCSSLeft ) || 0;
9938 }
9939
9940 if ( jQuery.isFunction( options ) ) {
9941
9942 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
9943 options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
9944 }
9945
9946 if ( options.top != null ) {
9947 props.top = ( options.top - curOffset.top ) + curTop;
9948 }
9949 if ( options.left != null ) {
9950 props.left = ( options.left - curOffset.left ) + curLeft;
9951 }
9952
9953 if ( "using" in options ) {
9954 options.using.call( elem, props );
9955
9956 } else {
9957 curElem.css( props );
9958 }
9959 }
9960};
9961
9962jQuery.fn.extend( {
9963 offset: function( options ) {
9964
9965 // Preserve chaining for setter
9966 if ( arguments.length ) {
9967 return options === undefined ?
9968 this :
9969 this.each( function( i ) {
9970 jQuery.offset.setOffset( this, options, i );
9971 } );
9972 }
9973
9974 var doc, docElem, rect, win,
9975 elem = this[ 0 ];
9976
9977 if ( !elem ) {
9978 return;
9979 }
9980
9981 // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
9982 // Support: IE <=11 only
9983 // Running getBoundingClientRect on a
9984 // disconnected node in IE throws an error
9985 if ( !elem.getClientRects().length ) {
9986 return { top: 0, left: 0 };
9987 }
9988
9989 rect = elem.getBoundingClientRect();
9990
9991 doc = elem.ownerDocument;
9992 docElem = doc.documentElement;
9993 win = doc.defaultView;
9994
9995 return {
9996 top: rect.top + win.pageYOffset - docElem.clientTop,
9997 left: rect.left + win.pageXOffset - docElem.clientLeft
9998 };
9999 },
10000
10001 position: function() {
10002 if ( !this[ 0 ] ) {
10003 return;
10004 }
10005
10006 var offsetParent, offset,
10007 elem = this[ 0 ],
10008 parentOffset = { top: 0, left: 0 };
10009
10010 // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
10011 // because it is its only offset parent
10012 if ( jQuery.css( elem, "position" ) === "fixed" ) {
10013
10014 // Assume getBoundingClientRect is there when computed position is fixed
10015 offset = elem.getBoundingClientRect();
10016
10017 } else {
10018
10019 // Get *real* offsetParent
10020 offsetParent = this.offsetParent();
10021
10022 // Get correct offsets
10023 offset = this.offset();
10024 if ( !nodeName( offsetParent[ 0 ], "html" ) ) {
10025 parentOffset = offsetParent.offset();
10026 }
10027
10028 // Add offsetParent borders
10029 parentOffset = {
10030 top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ),
10031 left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true )
10032 };
10033 }
10034
10035 // Subtract parent offsets and element margins
10036 return {
10037 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
10038 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
10039 };
10040 },
10041
10042 // This method will return documentElement in the following cases:
10043 // 1) For the element inside the iframe without offsetParent, this method will return
10044 // documentElement of the parent window
10045 // 2) For the hidden or detached element
10046 // 3) For body or html element, i.e. in case of the html node - it will return itself
10047 //
10048 // but those exceptions were never presented as a real life use-cases
10049 // and might be considered as more preferable results.
10050 //
10051 // This logic, however, is not guaranteed and can change at any point in the future
10052 offsetParent: function() {
10053 return this.map( function() {
10054 var offsetParent = this.offsetParent;
10055
10056 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
10057 offsetParent = offsetParent.offsetParent;
10058 }
10059
10060 return offsetParent || documentElement;
10061 } );
10062 }
10063} );
10064
10065// Create scrollLeft and scrollTop methods
10066jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
10067 var top = "pageYOffset" === prop;
10068
10069 jQuery.fn[ method ] = function( val ) {
10070 return access( this, function( elem, method, val ) {
10071
10072 // Coalesce documents and windows
10073 var win;
10074 if ( jQuery.isWindow( elem ) ) {
10075 win = elem;
10076 } else if ( elem.nodeType === 9 ) {
10077 win = elem.defaultView;
10078 }
10079
10080 if ( val === undefined ) {
10081 return win ? win[ prop ] : elem[ method ];
10082 }
10083
10084 if ( win ) {
10085 win.scrollTo(
10086 !top ? val : win.pageXOffset,
10087 top ? val : win.pageYOffset
10088 );
10089
10090 } else {
10091 elem[ method ] = val;
10092 }
10093 }, method, val, arguments.length );
10094 };
10095} );
10096
10097// Support: Safari <=7 - 9.1, Chrome <=37 - 49
10098// Add the top/left cssHooks using jQuery.fn.position
10099// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
10100// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
10101// getComputedStyle returns percent when specified for top/left/bottom/right;
10102// rather than make the css module depend on the offset module, just check for it here
10103jQuery.each( [ "top", "left" ], function( i, prop ) {
10104 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
10105 function( elem, computed ) {
10106 if ( computed ) {
10107 computed = curCSS( elem, prop );
10108
10109 // If curCSS returns percentage, fallback to offset
10110 return rnumnonpx.test( computed ) ?
10111 jQuery( elem ).position()[ prop ] + "px" :
10112 computed;
10113 }
10114 }
10115 );
10116} );
10117
10118
10119// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
10120jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
10121 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
10122 function( defaultExtra, funcName ) {
10123
10124 // Margin is only for outerHeight, outerWidth
10125 jQuery.fn[ funcName ] = function( margin, value ) {
10126 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
10127 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
10128
10129 return access( this, function( elem, type, value ) {
10130 var doc;
10131
10132 if ( jQuery.isWindow( elem ) ) {
10133
10134 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
10135 return funcName.indexOf( "outer" ) === 0 ?
10136 elem[ "inner" + name ] :
10137 elem.document.documentElement[ "client" + name ];
10138 }
10139
10140 // Get document width or height
10141 if ( elem.nodeType === 9 ) {
10142 doc = elem.documentElement;
10143
10144 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
10145 // whichever is greatest
10146 return Math.max(
10147 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
10148 elem.body[ "offset" + name ], doc[ "offset" + name ],
10149 doc[ "client" + name ]
10150 );
10151 }
10152
10153 return value === undefined ?
10154
10155 // Get width or height on the element, requesting but not forcing parseFloat
10156 jQuery.css( elem, type, extra ) :
10157
10158 // Set width or height on the element
10159 jQuery.style( elem, type, value, extra );
10160 }, type, chainable ? margin : undefined, chainable );
10161 };
10162 } );
10163} );
10164
10165
10166jQuery.fn.extend( {
10167
10168 bind: function( types, data, fn ) {
10169 return this.on( types, null, data, fn );
10170 },
10171 unbind: function( types, fn ) {
10172 return this.off( types, null, fn );
10173 },
10174
10175 delegate: function( selector, types, data, fn ) {
10176 return this.on( types, selector, data, fn );
10177 },
10178 undelegate: function( selector, types, fn ) {
10179
10180 // ( namespace ) or ( selector, types [, fn] )
10181 return arguments.length === 1 ?
10182 this.off( selector, "**" ) :
10183 this.off( types, selector || "**", fn );
10184 }
10185} );
10186
10187jQuery.holdReady = function( hold ) {
10188 if ( hold ) {
10189 jQuery.readyWait++;
10190 } else {
10191 jQuery.ready( true );
10192 }
10193};
10194jQuery.isArray = Array.isArray;
10195jQuery.parseJSON = JSON.parse;
10196jQuery.nodeName = nodeName;
10197
10198
10199
10200
10201// Register as a named AMD module, since jQuery can be concatenated with other
10202// files that may use define, but not via a proper concatenation script that
10203// understands anonymous AMD modules. A named AMD is safest and most robust
10204// way to register. Lowercase jquery is used because AMD module names are
10205// derived from file names, and jQuery is normally delivered in a lowercase
10206// file name. Do this after creating the global so that if an AMD module wants
10207// to call noConflict to hide this version of jQuery, it will work.
10208
10209// Note that for maximum portability, libraries that are not jQuery should
10210// declare themselves as anonymous modules, and avoid setting a global if an
10211// AMD loader is present. jQuery is a special case. For more information, see
10212// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
10213
10214if ( typeof define === "function" && define.amd ) {
10215 define( "jquery", [], function() {
10216 return jQuery;
10217 } );
10218}
10219
10220
10221
10222
10223var
10224
10225 // Map over jQuery in case of overwrite
10226 _jQuery = window.jQuery,
10227
10228 // Map over the $ in case of overwrite
10229 _$ = window.$;
10230
10231jQuery.noConflict = function( deep ) {
10232 if ( window.$ === jQuery ) {
10233 window.$ = _$;
10234 }
10235
10236 if ( deep && window.jQuery === jQuery ) {
10237 window.jQuery = _jQuery;
10238 }
10239
10240 return jQuery;
10241};
10242
10243// Expose jQuery and $ identifiers, even in AMD
10244// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
10245// and CommonJS for browser emulators (#13566)
10246if ( !noGlobal ) {
10247 window.jQuery = window.$ = jQuery;
10248}
10249
10250
10251
10252
10253return jQuery;
10254} );
10255
10256/*!
10257 * Scrollspy Plugin
10258 * Author: r3plica
10259 * Licensed under the MIT license
10260 */
10261; (function ($, window, document, undefined) {
10262
10263 "use strict";
10264
10265 // Add our plugin to fn
10266 $.fn.extend({
10267
10268 // Scrollspy is the name of the plugin
10269 scrollspy: function (options) {
10270
10271 // Define our defaults
10272 var defaults = {
10273 namespace: 'scrollspy',
10274 activeClass: 'active',
10275 animate: false,
10276 offset: 0,
10277 container: window
10278 };
10279
10280 // Add any overriden options to a new object
10281 options = $.extend({}, defaults, options);
10282
10283 // Adds two numbers together
10284 var add = function (ex1, ex2) {
10285 return parseInt(ex1, 10) + parseInt(ex2, 10);
10286 }
10287
10288 // Find our elements
10289 var findElements = function (links) {
10290
10291 // Declare our array
10292 var elements = [];
10293
10294 // Loop through the links
10295 for (var i = 0; i < links.length; i++) {
10296
10297 // Get our current link
10298 var link = links[i];
10299
10300 // Get our hash
10301 var hash = $(link).attr("href");
10302
10303 // Store our has as an element
10304 var element = $(hash);
10305
10306 // If we have an element matching the hash
10307 if (element.length > 0) {
10308
10309 // Get our offset
10310 var top = Math.floor(element.offset().top),
10311 bottom = top + Math.floor(element.outerHeight());
10312
10313 // Add to our array
10314 elements.push({ element: element, hash: hash, top: top, bottom: bottom });
10315 }
10316 }
10317
10318 // Return our elements
10319 return elements;
10320 };
10321
10322 // Find our link from a hash
10323 var findLink = function (links, hash) {
10324
10325 // For each link
10326 for (var i = 0; i < links.length; i++) {
10327
10328 // Get our current link
10329 var link = $(links[i]);
10330
10331 // If our hash matches the link href
10332 if (link.attr("href") === hash) {
10333
10334 // Return the link
10335 return link;
10336 }
10337 }
10338 };
10339
10340 // Reset classes on our elements
10341 var resetClasses = function (links) {
10342
10343 // For each link
10344 for (var i = 0; i < links.length; i++) {
10345
10346 // Get our current link
10347 var link = $(links[i]);
10348
10349 // Remove the active class
10350 link.parent().removeClass(options.activeClass);
10351 }
10352 };
10353
10354 // For each scrollspy instance
10355 return this.each(function () {
10356
10357 // Declare our global variables
10358 var element = this,
10359 container = $(options.container);
10360
10361 // Get our objects
10362 var links = $(element).find('a');
10363
10364 // Get our elements
10365 var elements = findElements(links);
10366
10367 // Add a listener to the window
10368 container.bind('scroll.' + options.namespace, function () {
10369
10370 // Get the position and store in an object
10371 var position = {
10372 top: add($(this).scrollTop(), Math.abs(options.offset)),
10373 left: $(this).scrollLeft()
10374 };
10375
10376 // Create a variable for our link
10377 var link;
10378
10379 // Loop through our elements
10380 for (var i = 0; i < elements.length; i++) {
10381
10382 // Get our current item
10383 var current = elements[i];
10384
10385 // If we are within the boundries of our element
10386 if (position.top >= current.top && position.top < current.bottom) {
10387
10388 // get our element
10389 var hash = current.hash;
10390
10391 // Get the link
10392 link = findLink(links, hash);
10393
10394 // If we have a link
10395 if (link) {
10396
10397 // If we have an onChange function
10398 if (options.onChange) {
10399
10400 // Fire our onChange function
10401 options.onChange(current.element, $(element), position);
10402 }
10403
10404 // Reset the classes on all other link
10405 resetClasses(links);
10406
10407 // Add our active link to our parent
10408 link.parent().addClass(options.activeClass);
10409
10410 // break our loop
10411 break;
10412 }
10413 }
10414 }
10415
10416 // If we don't have a link and we have a exit function
10417 if (!link && options.onExit) {
10418
10419 // Fire our onChange function
10420 options.onExit($(element), position);
10421 }
10422 });
10423
10424 });
10425 }
10426 });
10427})(jQuery, window, document, undefined);
10428// SmoothScroll for websites v1.2.1
10429// Licensed under the terms of the MIT license.
10430
10431// People involved
10432// - Balazs Galambosi (maintainer)
10433// - Michael Herf (Pulse Algorithm)
10434
10435(function(){
10436
10437// Scroll Variables (tweakable)
10438var defaultOptions = {
10439
10440 // Scrolling Core
10441 frameRate : 150, // [Hz]
10442 animationTime : 400, // [px]
10443 stepSize : 50, // [px]
10444
10445 // Pulse (less tweakable)
10446 // ratio of "tail" to "acceleration"
10447 pulseAlgorithm : true,
10448 pulseScale : 8,
10449 pulseNormalize : 1,
10450
10451 // Acceleration
10452 accelerationDelta : 20, // 20
10453 accelerationMax : 1, // 1
10454
10455 // Keyboard Settings
10456 keyboardSupport : true, // option
10457 arrowScroll : 50, // [px]
10458
10459 // Other
10460 touchpadSupport : true,
10461 fixedBackground : true,
10462 excluded : ""
10463};
10464
10465var options = defaultOptions;
10466
10467
10468// Other Variables
10469var isExcluded = false;
10470var isFrame = false;
10471var direction = { x: 0, y: 0 };
10472var initDone = false;
10473var root = document.documentElement;
10474var activeElement;
10475var observer;
10476var deltaBuffer = [ 120, 120, 120 ];
10477
10478var key = { left: 37, up: 38, right: 39, down: 40, spacebar: 32,
10479 pageup: 33, pagedown: 34, end: 35, home: 36 };
10480
10481
10482/***********************************************
10483 * SETTINGS
10484 ***********************************************/
10485
10486var options = defaultOptions;
10487
10488
10489/***********************************************
10490 * INITIALIZE
10491 ***********************************************/
10492
10493/**
10494 * Tests if smooth scrolling is allowed. Shuts down everything if not.
10495 */
10496function initTest() {
10497
10498 var disableKeyboard = false;
10499
10500 // disable keyboard support if anything above requested it
10501 if (disableKeyboard) {
10502 removeEvent("keydown", keydown);
10503 }
10504
10505 if (options.keyboardSupport && !disableKeyboard) {
10506 addEvent("keydown", keydown);
10507 }
10508}
10509
10510/**
10511 * Sets up scrolls array, determines if frames are involved.
10512 */
10513function init() {
10514
10515 if (!document.body) return;
10516
10517 var body = document.body;
10518 var html = document.documentElement;
10519 var windowHeight = window.innerHeight;
10520 var scrollHeight = body.scrollHeight;
10521
10522 // check compat mode for root element
10523 root = (document.compatMode.indexOf('CSS') >= 0) ? html : body;
10524 activeElement = body;
10525
10526 initTest();
10527 initDone = true;
10528
10529 // Checks if this script is running in a frame
10530 if (top != self) {
10531 isFrame = true;
10532 }
10533
10534 /**
10535 * This fixes a bug where the areas left and right to
10536 * the content does not trigger the onmousewheel event
10537 * on some pages. e.g.: html, body { height: 100% }
10538 */
10539 else if (scrollHeight > windowHeight &&
10540 (body.offsetHeight <= windowHeight ||
10541 html.offsetHeight <= windowHeight)) {
10542
10543 html.style.height = 'auto';
10544 setTimeout(refresh, 10);
10545
10546 // clearfix
10547 if (root.offsetHeight <= windowHeight) {
10548 var underlay = document.createElement("div");
10549 underlay.style.clear = "both";
10550 body.appendChild(underlay);
10551 }
10552 }
10553
10554 // disable fixed background
10555 if (!options.fixedBackground && !isExcluded) {
10556 body.style.backgroundAttachment = "scroll";
10557 html.style.backgroundAttachment = "scroll";
10558 }
10559}
10560
10561
10562/************************************************
10563 * SCROLLING
10564 ************************************************/
10565
10566var que = [];
10567var pending = false;
10568var lastScroll = +new Date;
10569
10570/**
10571 * Pushes scroll actions to the scrolling queue.
10572 */
10573function scrollArray(elem, left, top, delay) {
10574
10575 delay || (delay = 1000);
10576 directionCheck(left, top);
10577
10578 if (options.accelerationMax != 1) {
10579 var now = +new Date;
10580 var elapsed = now - lastScroll;
10581 if (elapsed < options.accelerationDelta) {
10582 var factor = (1 + (30 / elapsed)) / 2;
10583 if (factor > 1) {
10584 factor = Math.min(factor, options.accelerationMax);
10585 left *= factor;
10586 top *= factor;
10587 }
10588 }
10589 lastScroll = +new Date;
10590 }
10591
10592 // push a scroll command
10593 que.push({
10594 x: left,
10595 y: top,
10596 lastX: (left < 0) ? 0.99 : -0.99,
10597 lastY: (top < 0) ? 0.99 : -0.99,
10598 start: +new Date
10599 });
10600
10601 // don't act if there's a pending queue
10602 if (pending) {
10603 return;
10604 }
10605
10606 var scrollWindow = (elem === document.body);
10607
10608 var step = function (time) {
10609
10610 var now = +new Date;
10611 var scrollX = 0;
10612 var scrollY = 0;
10613
10614 for (var i = 0; i < que.length; i++) {
10615
10616 var item = que[i];
10617 var elapsed = now - item.start;
10618 var finished = (elapsed >= options.animationTime);
10619
10620 // scroll position: [0, 1]
10621 var position = (finished) ? 1 : elapsed / options.animationTime;
10622
10623 // easing [optional]
10624 if (options.pulseAlgorithm) {
10625 position = pulse(position);
10626 }
10627
10628 // only need the difference
10629 var x = (item.x * position - item.lastX) >> 0;
10630 var y = (item.y * position - item.lastY) >> 0;
10631
10632 // add this to the total scrolling
10633 scrollX += x;
10634 scrollY += y;
10635
10636 // update last values
10637 item.lastX += x;
10638 item.lastY += y;
10639
10640 // delete and step back if it's over
10641 if (finished) {
10642 que.splice(i, 1); i--;
10643 }
10644 }
10645
10646 // scroll left and top
10647 if (scrollWindow) {
10648 window.scrollBy(scrollX, scrollY);
10649 }
10650 else {
10651 if (scrollX) elem.scrollLeft += scrollX;
10652 if (scrollY) elem.scrollTop += scrollY;
10653 }
10654
10655 // clean up if there's nothing left to do
10656 if (!left && !top) {
10657 que = [];
10658 }
10659
10660 if (que.length) {
10661 requestFrame(step, elem, (delay / options.frameRate + 1));
10662 } else {
10663 pending = false;
10664 }
10665 };
10666
10667 // start a new queue of actions
10668 requestFrame(step, elem, 0);
10669 pending = true;
10670}
10671
10672
10673/***********************************************
10674 * EVENTS
10675 ***********************************************/
10676
10677/**
10678 * Mouse wheel handler.
10679 * @param {Object} event
10680 */
10681function wheel(event) {
10682
10683 if (!initDone) {
10684 init();
10685 }
10686
10687 var target = event.target;
10688 var overflowing = overflowingAncestor(target);
10689
10690 // use default if there's no overflowing
10691 // element or default action is prevented
10692 if (!overflowing || event.defaultPrevented ||
10693 isNodeName(activeElement, "embed") ||
10694 (isNodeName(target, "embed") && /\.pdf/i.test(target.src))) {
10695 return true;
10696 }
10697
10698 var deltaX = event.wheelDeltaX || 0;
10699 var deltaY = event.wheelDeltaY || 0;
10700
10701 // use wheelDelta if deltaX/Y is not available
10702 if (!deltaX && !deltaY) {
10703 deltaY = event.wheelDelta || 0;
10704 }
10705
10706 // check if it's a touchpad scroll that should be ignored
10707 if (!options.touchpadSupport && isTouchpad(deltaY)) {
10708 return true;
10709 }
10710
10711 // scale by step size
10712 // delta is 120 most of the time
10713 // synaptics seems to send 1 sometimes
10714 if (Math.abs(deltaX) > 1.2) {
10715 deltaX *= options.stepSize / 120;
10716 }
10717 if (Math.abs(deltaY) > 1.2) {
10718 deltaY *= options.stepSize / 120;
10719 }
10720
10721 scrollArray(overflowing, -deltaX, -deltaY);
10722 event.preventDefault();
10723}
10724
10725/**
10726 * Keydown event handler.
10727 * @param {Object} event
10728 */
10729function keydown(event) {
10730
10731 var target = event.target;
10732 var modifier = event.ctrlKey || event.altKey || event.metaKey ||
10733 (event.shiftKey && event.keyCode !== key.spacebar);
10734
10735 // do nothing if user is editing text
10736 // or using a modifier key (except shift)
10737 // or in a dropdown
10738 if ( /input|textarea|select|embed/i.test(target.nodeName) ||
10739 target.isContentEditable ||
10740 event.defaultPrevented ||
10741 modifier ) {
10742 return true;
10743 }
10744 // spacebar should trigger button press
10745 if (isNodeName(target, "button") &&
10746 event.keyCode === key.spacebar) {
10747 return true;
10748 }
10749
10750 var shift, x = 0, y = 0;
10751 var elem = overflowingAncestor(activeElement);
10752 var clientHeight = elem.clientHeight;
10753
10754 if (elem == document.body) {
10755 clientHeight = window.innerHeight;
10756 }
10757
10758 switch (event.keyCode) {
10759 case key.up:
10760 y = -options.arrowScroll;
10761 break;
10762 case key.down:
10763 y = options.arrowScroll;
10764 break;
10765 case key.spacebar: // (+ shift)
10766 shift = event.shiftKey ? 1 : -1;
10767 y = -shift * clientHeight * 0.9;
10768 break;
10769 case key.pageup:
10770 y = -clientHeight * 0.9;
10771 break;
10772 case key.pagedown:
10773 y = clientHeight * 0.9;
10774 break;
10775 case key.home:
10776 y = -elem.scrollTop;
10777 break;
10778 case key.end:
10779 var damt = elem.scrollHeight - elem.scrollTop - clientHeight;
10780 y = (damt > 0) ? damt+10 : 0;
10781 break;
10782 case key.left:
10783 x = -options.arrowScroll;
10784 break;
10785 case key.right:
10786 x = options.arrowScroll;
10787 break;
10788 default:
10789 return true; // a key we don't care about
10790 }
10791
10792 scrollArray(elem, x, y);
10793 event.preventDefault();
10794}
10795
10796/**
10797 * Mousedown event only for updating activeElement
10798 */
10799function mousedown(event) {
10800 activeElement = event.target;
10801}
10802
10803
10804/***********************************************
10805 * OVERFLOW
10806 ***********************************************/
10807
10808var cache = {}; // cleared out every once in while
10809setInterval(function () { cache = {}; }, 10 * 1000);
10810
10811var uniqueID = (function () {
10812 var i = 0;
10813 return function (el) {
10814 return el.uniqueID || (el.uniqueID = i++);
10815 };
10816})();
10817
10818function setCache(elems, overflowing) {
10819 for (var i = elems.length; i--;)
10820 cache[uniqueID(elems[i])] = overflowing;
10821 return overflowing;
10822}
10823
10824function overflowingAncestor(el) {
10825 var elems = [];
10826 var rootScrollHeight = root.scrollHeight;
10827 do {
10828 var cached = cache[uniqueID(el)];
10829 if (cached) {
10830 return setCache(elems, cached);
10831 }
10832 elems.push(el);
10833 if (rootScrollHeight === el.scrollHeight) {
10834 if (!isFrame || root.clientHeight + 10 < rootScrollHeight) {
10835 return setCache(elems, document.body); // scrolling root in WebKit
10836 }
10837 } else if (el.clientHeight + 10 < el.scrollHeight) {
10838 overflow = getComputedStyle(el, "").getPropertyValue("overflow-y");
10839 if (overflow === "scroll" || overflow === "auto") {
10840 return setCache(elems, el);
10841 }
10842 }
10843 } while (el = el.parentNode);
10844}
10845
10846
10847/***********************************************
10848 * HELPERS
10849 ***********************************************/
10850
10851function addEvent(type, fn, bubble) {
10852 window.addEventListener(type, fn, (bubble||false));
10853}
10854
10855function removeEvent(type, fn, bubble) {
10856 window.removeEventListener(type, fn, (bubble||false));
10857}
10858
10859function isNodeName(el, tag) {
10860 return (el.nodeName||"").toLowerCase() === tag.toLowerCase();
10861}
10862
10863function directionCheck(x, y) {
10864 x = (x > 0) ? 1 : -1;
10865 y = (y > 0) ? 1 : -1;
10866 if (direction.x !== x || direction.y !== y) {
10867 direction.x = x;
10868 direction.y = y;
10869 que = [];
10870 lastScroll = 0;
10871 }
10872}
10873
10874var deltaBufferTimer;
10875
10876function isTouchpad(deltaY) {
10877 if (!deltaY) return;
10878 deltaY = Math.abs(deltaY)
10879 deltaBuffer.push(deltaY);
10880 deltaBuffer.shift();
10881 clearTimeout(deltaBufferTimer);
10882
10883 var allEquals = (deltaBuffer[0] == deltaBuffer[1] &&
10884 deltaBuffer[1] == deltaBuffer[2]);
10885 var allDivisable = (isDivisible(deltaBuffer[0], 120) &&
10886 isDivisible(deltaBuffer[1], 120) &&
10887 isDivisible(deltaBuffer[2], 120));
10888 return !(allEquals || allDivisable);
10889}
10890
10891function isDivisible(n, divisor) {
10892 return (Math.floor(n / divisor) == n / divisor);
10893}
10894
10895var requestFrame = (function () {
10896 return window.requestAnimationFrame ||
10897 window.webkitRequestAnimationFrame ||
10898 function (callback, element, delay) {
10899 window.setTimeout(callback, delay || (1000/60));
10900 };
10901})();
10902
10903
10904/***********************************************
10905 * PULSE
10906 ***********************************************/
10907
10908/**
10909 * Viscous fluid with a pulse for part and decay for the rest.
10910 * - Applies a fixed force over an interval (a damped acceleration), and
10911 * - Lets the exponential bleed away the velocity over a longer interval
10912 * - Michael Herf, http://stereopsis.com/stopping/
10913 */
10914function pulse_(x) {
10915 var val, start, expx;
10916 // test
10917 x = x * options.pulseScale;
10918 if (x < 1) { // acceleartion
10919 val = x - (1 - Math.exp(-x));
10920 } else { // tail
10921 // the previous animation ended here:
10922 start = Math.exp(-1);
10923 // simple viscous drag
10924 x -= 1;
10925 expx = 1 - Math.exp(-x);
10926 val = start + (expx * (1 - start));
10927 }
10928 return val * options.pulseNormalize;
10929}
10930
10931function pulse(x) {
10932 if (x >= 1) return 1;
10933 if (x <= 0) return 0;
10934
10935 if (options.pulseNormalize == 1) {
10936 options.pulseNormalize /= pulse_(1);
10937 }
10938 return pulse_(x);
10939}
10940
10941var isChrome = /chrome/i.test(window.navigator.userAgent);
10942var isMouseWheelSupported = 'onmousewheel' in document;
10943
10944if (isMouseWheelSupported && isChrome) {
10945 addEvent("mousedown", mousedown);
10946 addEvent("mousewheel", wheel);
10947 addEvent("load", init);
10948};
10949
10950})();
10951
10952$(function() {
10953
10954 "use strict";
10955
10956
10957 $("#nav").scrollspy();
10958
10959
10960
10961 /* Smooth scroll to sections
10962 ==================================*/
10963 $("[data-toggle=scroll]").on("click", function(e) {
10964 e.preventDefault();
10965
10966 var $this = $(this),
10967 blockId = $this.attr("href"),
10968 scrollOffset = $(blockId).offset().top;
10969
10970 $("html, body").animate({
10971 scrollTop: scrollOffset
10972 });
10973
10974 });
10975
10976
10977
10978 /* Smooth scroll up
10979 ==================================*/
10980 $(document).on("scroll", function() {
10981
10982 var $this = $(this),
10983 scrollTop = $this.scrollTop(),
10984 btn = $("#js-up");
10985
10986 if(scrollTop > 1000) {
10987 btn.addClass("active");
10988
10989 } else {
10990 btn.removeClass("active");
10991 }
10992
10993 });
10994
10995
10996 $("#js-up").on("click", function() {
10997 $("html, body").animate({
10998 scrollTop: 0
10999 });
11000 });
11001
11002});
11003/*!
11004 * The Final Countdown for jQuery v2.2.0 (http://hilios.github.io/jQuery.countdown/)
11005 * Copyright (c) 2016 Edson Hilios
11006 *
11007 * Permission is hereby granted, free of charge, to any person obtaining a copy of
11008 * this software and associated documentation files (the "Software"), to deal in
11009 * the Software without restriction, including without limitation the rights to
11010 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11011 * the Software, and to permit persons to whom the Software is furnished to do so,
11012 * subject to the following conditions:
11013 *
11014 * The above copyright notice and this permission notice shall be included in all
11015 * copies or substantial portions of the Software.
11016 *
11017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11018 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
11019 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
11020 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
11021 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
11022 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11023 */
11024(function(factory) {
11025 "use strict";
11026 if (typeof define === "function" && define.amd) {
11027 define([ "jquery" ], factory);
11028 } else {
11029 factory(jQuery);
11030 }
11031})(function($) {
11032 "use strict";
11033 var instances = [], matchers = [], defaultOptions = {
11034 precision: 100,
11035 elapse: false,
11036 defer: false
11037 };
11038 matchers.push(/^[0-9]*$/.source);
11039 matchers.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/.source);
11040 matchers.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/.source);
11041 matchers = new RegExp(matchers.join("|"));
11042 function parseDateString(dateString) {
11043 if (dateString instanceof Date) {
11044 return dateString;
11045 }
11046 if (String(dateString).match(matchers)) {
11047 if (String(dateString).match(/^[0-9]*$/)) {
11048 dateString = Number(dateString);
11049 }
11050 if (String(dateString).match(/\-/)) {
11051 dateString = String(dateString).replace(/\-/g, "/");
11052 }
11053 return new Date(dateString);
11054 } else {
11055 throw new Error("Couldn't cast `" + dateString + "` to a date object.");
11056 }
11057 }
11058 var DIRECTIVE_KEY_MAP = {
11059 Y: "years",
11060 m: "months",
11061 n: "daysToMonth",
11062 d: "daysToWeek",
11063 w: "weeks",
11064 W: "weeksToMonth",
11065 H: "hours",
11066 M: "minutes",
11067 S: "seconds",
11068 D: "totalDays",
11069 I: "totalHours",
11070 N: "totalMinutes",
11071 T: "totalSeconds"
11072 };
11073 function escapedRegExp(str) {
11074 var sanitize = str.toString().replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
11075 return new RegExp(sanitize);
11076 }
11077 function strftime(offsetObject) {
11078 return function(format) {
11079 var directives = format.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);
11080 if (directives) {
11081 for (var i = 0, len = directives.length; i < len; ++i) {
11082 var directive = directives[i].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/), regexp = escapedRegExp(directive[0]), modifier = directive[1] || "", plural = directive[3] || "", value = null;
11083 directive = directive[2];
11084 if (DIRECTIVE_KEY_MAP.hasOwnProperty(directive)) {
11085 value = DIRECTIVE_KEY_MAP[directive];
11086 value = Number(offsetObject[value]);
11087 }
11088 if (value !== null) {
11089 if (modifier === "!") {
11090 value = pluralize(plural, value);
11091 }
11092 if (modifier === "") {
11093 if (value < 10) {
11094 value = "0" + value.toString();
11095 }
11096 }
11097 format = format.replace(regexp, value.toString());
11098 }
11099 }
11100 }
11101 format = format.replace(/%%/, "%");
11102 return format;
11103 };
11104 }
11105 function pluralize(format, count) {
11106 var plural = "s", singular = "";
11107 if (format) {
11108 format = format.replace(/(:|;|\s)/gi, "").split(/\,/);
11109 if (format.length === 1) {
11110 plural = format[0];
11111 } else {
11112 singular = format[0];
11113 plural = format[1];
11114 }
11115 }
11116 if (Math.abs(count) > 1) {
11117 return plural;
11118 } else {
11119 return singular;
11120 }
11121 }
11122 var Countdown = function(el, finalDate, options) {
11123 this.el = el;
11124 this.$el = $(el);
11125 this.interval = null;
11126 this.offset = {};
11127 this.options = $.extend({}, defaultOptions);
11128 this.instanceNumber = instances.length;
11129 instances.push(this);
11130 this.$el.data("countdown-instance", this.instanceNumber);
11131 if (options) {
11132 if (typeof options === "function") {
11133 this.$el.on("update.countdown", options);
11134 this.$el.on("stoped.countdown", options);
11135 this.$el.on("finish.countdown", options);
11136 } else {
11137 this.options = $.extend({}, defaultOptions, options);
11138 }
11139 }
11140 this.setFinalDate(finalDate);
11141 if (this.options.defer === false) {
11142 this.start();
11143 }
11144 };
11145 $.extend(Countdown.prototype, {
11146 start: function() {
11147 if (this.interval !== null) {
11148 clearInterval(this.interval);
11149 }
11150 var self = this;
11151 this.update();
11152 this.interval = setInterval(function() {
11153 self.update.call(self);
11154 }, this.options.precision);
11155 },
11156 stop: function() {
11157 clearInterval(this.interval);
11158 this.interval = null;
11159 this.dispatchEvent("stoped");
11160 },
11161 toggle: function() {
11162 if (this.interval) {
11163 this.stop();
11164 } else {
11165 this.start();
11166 }
11167 },
11168 pause: function() {
11169 this.stop();
11170 },
11171 resume: function() {
11172 this.start();
11173 },
11174 remove: function() {
11175 this.stop.call(this);
11176 instances[this.instanceNumber] = null;
11177 delete this.$el.data().countdownInstance;
11178 },
11179 setFinalDate: function(value) {
11180 this.finalDate = parseDateString(value);
11181 },
11182 update: function() {
11183 if (this.$el.closest("html").length === 0) {
11184 this.remove();
11185 return;
11186 }
11187 var hasEventsAttached = $._data(this.el, "events") !== undefined, now = new Date(), newTotalSecsLeft;
11188 newTotalSecsLeft = this.finalDate.getTime() - now.getTime();
11189 newTotalSecsLeft = Math.ceil(newTotalSecsLeft / 1e3);
11190 newTotalSecsLeft = !this.options.elapse && newTotalSecsLeft < 0 ? 0 : Math.abs(newTotalSecsLeft);
11191 if (this.totalSecsLeft === newTotalSecsLeft || !hasEventsAttached) {
11192 return;
11193 } else {
11194 this.totalSecsLeft = newTotalSecsLeft;
11195 }
11196 this.elapsed = now >= this.finalDate;
11197 this.offset = {
11198 seconds: this.totalSecsLeft % 60,
11199 minutes: Math.floor(this.totalSecsLeft / 60) % 60,
11200 hours: Math.floor(this.totalSecsLeft / 60 / 60) % 24,
11201 days: Math.floor(this.totalSecsLeft / 60 / 60 / 24) % 7,
11202 daysToWeek: Math.floor(this.totalSecsLeft / 60 / 60 / 24) % 7,
11203 daysToMonth: Math.floor(this.totalSecsLeft / 60 / 60 / 24 % 30.4368),
11204 weeks: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 7),
11205 weeksToMonth: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 7) % 4,
11206 months: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 30.4368),
11207 years: Math.abs(this.finalDate.getFullYear() - now.getFullYear()),
11208 totalDays: Math.floor(this.totalSecsLeft / 60 / 60 / 24),
11209 totalHours: Math.floor(this.totalSecsLeft / 60 / 60),
11210 totalMinutes: Math.floor(this.totalSecsLeft / 60),
11211 totalSeconds: this.totalSecsLeft
11212 };
11213 if (!this.options.elapse && this.totalSecsLeft === 0) {
11214 this.stop();
11215 this.dispatchEvent("finish");
11216 } else {
11217 this.dispatchEvent("update");
11218 }
11219 },
11220 dispatchEvent: function(eventName) {
11221 var event = $.Event(eventName + ".countdown");
11222 event.finalDate = this.finalDate;
11223 event.elapsed = this.elapsed;
11224 event.offset = $.extend({}, this.offset);
11225 event.strftime = strftime(this.offset);
11226 this.$el.trigger(event);
11227 }
11228 });
11229 $.fn.countdown = function() {
11230 var argumentsArray = Array.prototype.slice.call(arguments, 0);
11231 return this.each(function() {
11232 var instanceNumber = $(this).data("countdown-instance");
11233 if (instanceNumber !== undefined) {
11234 var instance = instances[instanceNumber], method = argumentsArray[0];
11235 if (Countdown.prototype.hasOwnProperty(method)) {
11236 instance[method].apply(instance, argumentsArray.slice(1));
11237 } else if (String(method).match(/^[$A-Z_][0-9A-Z_$]*$/i) === null) {
11238 instance.setFinalDate.call(instance, method);
11239 instance.start();
11240 } else {
11241 $.error("Method %s does not exist on jQuery.countdown".replace(/\%s/gi, method));
11242 }
11243 } else {
11244 new Countdown(this, argumentsArray[0], argumentsArray[1]);
11245 }
11246 });
11247 };
11248});
11249
11250$(function() {
11251
11252 /**
11253 * Docs: http://hilios.github.io/jQuery.countdown/examples.html
11254 **/
11255
11256 "use strict";
11257
11258
11259 $('#clock').countdown('2020/04/13 15:59:59')
11260 .on('update.countdown', function(event) {
11261 var format = '%H:%M:%S';
11262 if(event.offset.totalDays > 0) {
11263 format = '%-d day%!d ' + format;
11264 }
11265 if(event.offset.weeks > 0) {
11266 format = '%-w week%!w ' + format;
11267 }
11268 $(this).html(event.strftime(format));
11269 })
11270 .on('finish.countdown', function(event) {
11271 $(this).remove();
11272 $("#offer-expired").show();
11273 $("#limited-offers").hide();
11274 });
11275
11276
11277
11278});
11279/*
11280 _ _ _ _
11281 ___| (_) ___| | __ (_)___
11282/ __| | |/ __| |/ / | / __|
11283\__ \ | | (__| < _ | \__ \
11284|___/_|_|\___|_|\_(_)/ |___/
11285 |__/
11286
11287 Version: 1.6.0
11288 Author: Ken Wheeler
11289 Website: http://kenwheeler.github.io
11290 Docs: http://kenwheeler.github.io/slick
11291 Repo: http://github.com/kenwheeler/slick
11292 Issues: http://github.com/kenwheeler/slick/issues
11293
11294 */
11295/* global window, document, define, jQuery, setInterval, clearInterval */
11296(function(factory) {
11297 'use strict';
11298 if (typeof define === 'function' && define.amd) {
11299 define(['jquery'], factory);
11300 } else if (typeof exports !== 'undefined') {
11301 module.exports = factory(require('jquery'));
11302 } else {
11303 factory(jQuery);
11304 }
11305
11306}(function($) {
11307 'use strict';
11308 var Slick = window.Slick || {};
11309
11310 Slick = (function() {
11311
11312 var instanceUid = 0;
11313
11314 function Slick(element, settings) {
11315
11316 var _ = this, dataSettings;
11317
11318 _.defaults = {
11319 accessibility: true,
11320 adaptiveHeight: false,
11321 appendArrows: $(element),
11322 appendDots: $(element),
11323 arrows: true,
11324 asNavFor: null,
11325 prevArrow: '<button type="button" data-role="none" class="slick-prev" aria-label="Previous" tabindex="0" role="button">Previous</button>',
11326 nextArrow: '<button type="button" data-role="none" class="slick-next" aria-label="Next" tabindex="0" role="button">Next</button>',
11327 autoplay: false,
11328 autoplaySpeed: 3000,
11329 centerMode: false,
11330 centerPadding: '50px',
11331 cssEase: 'ease',
11332 customPaging: function(slider, i) {
11333 return $('<button type="button" data-role="none" role="button" tabindex="0" />').text(i + 1);
11334 },
11335 dots: false,
11336 dotsClass: 'slick-dots',
11337 draggable: true,
11338 easing: 'linear',
11339 edgeFriction: 0.35,
11340 fade: false,
11341 focusOnSelect: false,
11342 infinite: true,
11343 initialSlide: 0,
11344 lazyLoad: 'ondemand',
11345 mobileFirst: false,
11346 pauseOnHover: true,
11347 pauseOnFocus: true,
11348 pauseOnDotsHover: false,
11349 respondTo: 'window',
11350 responsive: null,
11351 rows: 1,
11352 rtl: false,
11353 slide: '',
11354 slidesPerRow: 1,
11355 slidesToShow: 1,
11356 slidesToScroll: 1,
11357 speed: 500,
11358 swipe: true,
11359 swipeToSlide: false,
11360 touchMove: true,
11361 touchThreshold: 5,
11362 useCSS: true,
11363 useTransform: true,
11364 variableWidth: false,
11365 vertical: false,
11366 verticalSwiping: false,
11367 waitForAnimate: true,
11368 zIndex: 1000
11369 };
11370
11371 _.initials = {
11372 animating: false,
11373 dragging: false,
11374 autoPlayTimer: null,
11375 currentDirection: 0,
11376 currentLeft: null,
11377 currentSlide: 0,
11378 direction: 1,
11379 $dots: null,
11380 listWidth: null,
11381 listHeight: null,
11382 loadIndex: 0,
11383 $nextArrow: null,
11384 $prevArrow: null,
11385 slideCount: null,
11386 slideWidth: null,
11387 $slideTrack: null,
11388 $slides: null,
11389 sliding: false,
11390 slideOffset: 0,
11391 swipeLeft: null,
11392 $list: null,
11393 touchObject: {},
11394 transformsEnabled: false,
11395 unslicked: false
11396 };
11397
11398 $.extend(_, _.initials);
11399
11400 _.activeBreakpoint = null;
11401 _.animType = null;
11402 _.animProp = null;
11403 _.breakpoints = [];
11404 _.breakpointSettings = [];
11405 _.cssTransitions = false;
11406 _.focussed = false;
11407 _.interrupted = false;
11408 _.hidden = 'hidden';
11409 _.paused = true;
11410 _.positionProp = null;
11411 _.respondTo = null;
11412 _.rowCount = 1;
11413 _.shouldClick = true;
11414 _.$slider = $(element);
11415 _.$slidesCache = null;
11416 _.transformType = null;
11417 _.transitionType = null;
11418 _.visibilityChange = 'visibilitychange';
11419 _.windowWidth = 0;
11420 _.windowTimer = null;
11421
11422 dataSettings = $(element).data('slick') || {};
11423
11424 _.options = $.extend({}, _.defaults, settings, dataSettings);
11425
11426 _.currentSlide = _.options.initialSlide;
11427
11428 _.originalSettings = _.options;
11429
11430 if (typeof document.mozHidden !== 'undefined') {
11431 _.hidden = 'mozHidden';
11432 _.visibilityChange = 'mozvisibilitychange';
11433 } else if (typeof document.webkitHidden !== 'undefined') {
11434 _.hidden = 'webkitHidden';
11435 _.visibilityChange = 'webkitvisibilitychange';
11436 }
11437
11438 _.autoPlay = $.proxy(_.autoPlay, _);
11439 _.autoPlayClear = $.proxy(_.autoPlayClear, _);
11440 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _);
11441 _.changeSlide = $.proxy(_.changeSlide, _);
11442 _.clickHandler = $.proxy(_.clickHandler, _);
11443 _.selectHandler = $.proxy(_.selectHandler, _);
11444 _.setPosition = $.proxy(_.setPosition, _);
11445 _.swipeHandler = $.proxy(_.swipeHandler, _);
11446 _.dragHandler = $.proxy(_.dragHandler, _);
11447 _.keyHandler = $.proxy(_.keyHandler, _);
11448
11449 _.instanceUid = instanceUid++;
11450
11451 // A simple way to check for HTML strings
11452 // Strict HTML recognition (must start with <)
11453 // Extracted from jQuery v1.11 source
11454 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/;
11455
11456
11457 _.registerBreakpoints();
11458 _.init(true);
11459
11460 }
11461
11462 return Slick;
11463
11464 }());
11465
11466 Slick.prototype.activateADA = function() {
11467 var _ = this;
11468
11469 _.$slideTrack.find('.slick-active').attr({
11470 'aria-hidden': 'false'
11471 }).find('a, input, button, select').attr({
11472 'tabindex': '0'
11473 });
11474
11475 };
11476
11477 Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) {
11478
11479 var _ = this;
11480
11481 if (typeof(index) === 'boolean') {
11482 addBefore = index;
11483 index = null;
11484 } else if (index < 0 || (index >= _.slideCount)) {
11485 return false;
11486 }
11487
11488 _.unload();
11489
11490 if (typeof(index) === 'number') {
11491 if (index === 0 && _.$slides.length === 0) {
11492 $(markup).appendTo(_.$slideTrack);
11493 } else if (addBefore) {
11494 $(markup).insertBefore(_.$slides.eq(index));
11495 } else {
11496 $(markup).insertAfter(_.$slides.eq(index));
11497 }
11498 } else {
11499 if (addBefore === true) {
11500 $(markup).prependTo(_.$slideTrack);
11501 } else {
11502 $(markup).appendTo(_.$slideTrack);
11503 }
11504 }
11505
11506 _.$slides = _.$slideTrack.children(this.options.slide);
11507
11508 _.$slideTrack.children(this.options.slide).detach();
11509
11510 _.$slideTrack.append(_.$slides);
11511
11512 _.$slides.each(function(index, element) {
11513 $(element).attr('data-slick-index', index);
11514 });
11515
11516 _.$slidesCache = _.$slides;
11517
11518 _.reinit();
11519
11520 };
11521
11522 Slick.prototype.animateHeight = function() {
11523 var _ = this;
11524 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
11525 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
11526 _.$list.animate({
11527 height: targetHeight
11528 }, _.options.speed);
11529 }
11530 };
11531
11532 Slick.prototype.animateSlide = function(targetLeft, callback) {
11533
11534 var animProps = {},
11535 _ = this;
11536
11537 _.animateHeight();
11538
11539 if (_.options.rtl === true && _.options.vertical === false) {
11540 targetLeft = -targetLeft;
11541 }
11542 if (_.transformsEnabled === false) {
11543 if (_.options.vertical === false) {
11544 _.$slideTrack.animate({
11545 left: targetLeft
11546 }, _.options.speed, _.options.easing, callback);
11547 } else {
11548 _.$slideTrack.animate({
11549 top: targetLeft
11550 }, _.options.speed, _.options.easing, callback);
11551 }
11552
11553 } else {
11554
11555 if (_.cssTransitions === false) {
11556 if (_.options.rtl === true) {
11557 _.currentLeft = -(_.currentLeft);
11558 }
11559 $({
11560 animStart: _.currentLeft
11561 }).animate({
11562 animStart: targetLeft
11563 }, {
11564 duration: _.options.speed,
11565 easing: _.options.easing,
11566 step: function(now) {
11567 now = Math.ceil(now);
11568 if (_.options.vertical === false) {
11569 animProps[_.animType] = 'translate(' +
11570 now + 'px, 0px)';
11571 _.$slideTrack.css(animProps);
11572 } else {
11573 animProps[_.animType] = 'translate(0px,' +
11574 now + 'px)';
11575 _.$slideTrack.css(animProps);
11576 }
11577 },
11578 complete: function() {
11579 if (callback) {
11580 callback.call();
11581 }
11582 }
11583 });
11584
11585 } else {
11586
11587 _.applyTransition();
11588 targetLeft = Math.ceil(targetLeft);
11589
11590 if (_.options.vertical === false) {
11591 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)';
11592 } else {
11593 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)';
11594 }
11595 _.$slideTrack.css(animProps);
11596
11597 if (callback) {
11598 setTimeout(function() {
11599
11600 _.disableTransition();
11601
11602 callback.call();
11603 }, _.options.speed);
11604 }
11605
11606 }
11607
11608 }
11609
11610 };
11611
11612 Slick.prototype.getNavTarget = function() {
11613
11614 var _ = this,
11615 asNavFor = _.options.asNavFor;
11616
11617 if ( asNavFor && asNavFor !== null ) {
11618 asNavFor = $(asNavFor).not(_.$slider);
11619 }
11620
11621 return asNavFor;
11622
11623 };
11624
11625 Slick.prototype.asNavFor = function(index) {
11626
11627 var _ = this,
11628 asNavFor = _.getNavTarget();
11629
11630 if ( asNavFor !== null && typeof asNavFor === 'object' ) {
11631 asNavFor.each(function() {
11632 var target = $(this).slick('getSlick');
11633 if(!target.unslicked) {
11634 target.slideHandler(index, true);
11635 }
11636 });
11637 }
11638
11639 };
11640
11641 Slick.prototype.applyTransition = function(slide) {
11642
11643 var _ = this,
11644 transition = {};
11645
11646 if (_.options.fade === false) {
11647 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase;
11648 } else {
11649 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase;
11650 }
11651
11652 if (_.options.fade === false) {
11653 _.$slideTrack.css(transition);
11654 } else {
11655 _.$slides.eq(slide).css(transition);
11656 }
11657
11658 };
11659
11660 Slick.prototype.autoPlay = function() {
11661
11662 var _ = this;
11663
11664 _.autoPlayClear();
11665
11666 if ( _.slideCount > _.options.slidesToShow ) {
11667 _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed );
11668 }
11669
11670 };
11671
11672 Slick.prototype.autoPlayClear = function() {
11673
11674 var _ = this;
11675
11676 if (_.autoPlayTimer) {
11677 clearInterval(_.autoPlayTimer);
11678 }
11679
11680 };
11681
11682 Slick.prototype.autoPlayIterator = function() {
11683
11684 var _ = this,
11685 slideTo = _.currentSlide + _.options.slidesToScroll;
11686
11687 if ( !_.paused && !_.interrupted && !_.focussed ) {
11688
11689 if ( _.options.infinite === false ) {
11690
11691 if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) {
11692 _.direction = 0;
11693 }
11694
11695 else if ( _.direction === 0 ) {
11696
11697 slideTo = _.currentSlide - _.options.slidesToScroll;
11698
11699 if ( _.currentSlide - 1 === 0 ) {
11700 _.direction = 1;
11701 }
11702
11703 }
11704
11705 }
11706
11707 _.slideHandler( slideTo );
11708
11709 }
11710
11711 };
11712
11713 Slick.prototype.buildArrows = function() {
11714
11715 var _ = this;
11716
11717 if (_.options.arrows === true ) {
11718
11719 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow');
11720 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow');
11721
11722 if( _.slideCount > _.options.slidesToShow ) {
11723
11724 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
11725 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
11726
11727 if (_.htmlExpr.test(_.options.prevArrow)) {
11728 _.$prevArrow.prependTo(_.options.appendArrows);
11729 }
11730
11731 if (_.htmlExpr.test(_.options.nextArrow)) {
11732 _.$nextArrow.appendTo(_.options.appendArrows);
11733 }
11734
11735 if (_.options.infinite !== true) {
11736 _.$prevArrow
11737 .addClass('slick-disabled')
11738 .attr('aria-disabled', 'true');
11739 }
11740
11741 } else {
11742
11743 _.$prevArrow.add( _.$nextArrow )
11744
11745 .addClass('slick-hidden')
11746 .attr({
11747 'aria-disabled': 'true',
11748 'tabindex': '-1'
11749 });
11750
11751 }
11752
11753 }
11754
11755 };
11756
11757 Slick.prototype.buildDots = function() {
11758
11759 var _ = this,
11760 i, dot;
11761
11762 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
11763
11764 _.$slider.addClass('slick-dotted');
11765
11766 dot = $('<ul />').addClass(_.options.dotsClass);
11767
11768 for (i = 0; i <= _.getDotCount(); i += 1) {
11769 dot.append($('<li />').append(_.options.customPaging.call(this, _, i)));
11770 }
11771
11772 _.$dots = dot.appendTo(_.options.appendDots);
11773
11774 _.$dots.find('li').first().addClass('slick-active').attr('aria-hidden', 'false');
11775
11776 }
11777
11778 };
11779
11780 Slick.prototype.buildOut = function() {
11781
11782 var _ = this;
11783
11784 _.$slides =
11785 _.$slider
11786 .children( _.options.slide + ':not(.slick-cloned)')
11787 .addClass('slick-slide');
11788
11789 _.slideCount = _.$slides.length;
11790
11791 _.$slides.each(function(index, element) {
11792 $(element)
11793 .attr('data-slick-index', index)
11794 .data('originalStyling', $(element).attr('style') || '');
11795 });
11796
11797 _.$slider.addClass('slick-slider');
11798
11799 _.$slideTrack = (_.slideCount === 0) ?
11800 $('<div class="slick-track"/>').appendTo(_.$slider) :
11801 _.$slides.wrapAll('<div class="slick-track"/>').parent();
11802
11803 _.$list = _.$slideTrack.wrap(
11804 '<div aria-live="polite" class="slick-list"/>').parent();
11805 _.$slideTrack.css('opacity', 0);
11806
11807 if (_.options.centerMode === true || _.options.swipeToSlide === true) {
11808 _.options.slidesToScroll = 1;
11809 }
11810
11811 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading');
11812
11813 _.setupInfinite();
11814
11815 _.buildArrows();
11816
11817 _.buildDots();
11818
11819 _.updateDots();
11820
11821
11822 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);
11823
11824 if (_.options.draggable === true) {
11825 _.$list.addClass('draggable');
11826 }
11827
11828 };
11829
11830 Slick.prototype.buildRows = function() {
11831
11832 var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection;
11833
11834 newSlides = document.createDocumentFragment();
11835 originalSlides = _.$slider.children();
11836
11837 if(_.options.rows > 1) {
11838
11839 slidesPerSection = _.options.slidesPerRow * _.options.rows;
11840 numOfSlides = Math.ceil(
11841 originalSlides.length / slidesPerSection
11842 );
11843
11844 for(a = 0; a < numOfSlides; a++){
11845 var slide = document.createElement('div');
11846 for(b = 0; b < _.options.rows; b++) {
11847 var row = document.createElement('div');
11848 for(c = 0; c < _.options.slidesPerRow; c++) {
11849 var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c));
11850 if (originalSlides.get(target)) {
11851 row.appendChild(originalSlides.get(target));
11852 }
11853 }
11854 slide.appendChild(row);
11855 }
11856 newSlides.appendChild(slide);
11857 }
11858
11859 _.$slider.empty().append(newSlides);
11860 _.$slider.children().children().children()
11861 .css({
11862 'width':(100 / _.options.slidesPerRow) + '%',
11863 'display': 'inline-block'
11864 });
11865
11866 }
11867
11868 };
11869
11870 Slick.prototype.checkResponsive = function(initial, forceUpdate) {
11871
11872 var _ = this,
11873 breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false;
11874 var sliderWidth = _.$slider.width();
11875 var windowWidth = window.innerWidth || $(window).width();
11876
11877 if (_.respondTo === 'window') {
11878 respondToWidth = windowWidth;
11879 } else if (_.respondTo === 'slider') {
11880 respondToWidth = sliderWidth;
11881 } else if (_.respondTo === 'min') {
11882 respondToWidth = Math.min(windowWidth, sliderWidth);
11883 }
11884
11885 if ( _.options.responsive &&
11886 _.options.responsive.length &&
11887 _.options.responsive !== null) {
11888
11889 targetBreakpoint = null;
11890
11891 for (breakpoint in _.breakpoints) {
11892 if (_.breakpoints.hasOwnProperty(breakpoint)) {
11893 if (_.originalSettings.mobileFirst === false) {
11894 if (respondToWidth < _.breakpoints[breakpoint]) {
11895 targetBreakpoint = _.breakpoints[breakpoint];
11896 }
11897 } else {
11898 if (respondToWidth > _.breakpoints[breakpoint]) {
11899 targetBreakpoint = _.breakpoints[breakpoint];
11900 }
11901 }
11902 }
11903 }
11904
11905 if (targetBreakpoint !== null) {
11906 if (_.activeBreakpoint !== null) {
11907 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) {
11908 _.activeBreakpoint =
11909 targetBreakpoint;
11910 if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
11911 _.unslick(targetBreakpoint);
11912 } else {
11913 _.options = $.extend({}, _.originalSettings,
11914 _.breakpointSettings[
11915 targetBreakpoint]);
11916 if (initial === true) {
11917 _.currentSlide = _.options.initialSlide;
11918 }
11919 _.refresh(initial);
11920 }
11921 triggerBreakpoint = targetBreakpoint;
11922 }
11923 } else {
11924 _.activeBreakpoint = targetBreakpoint;
11925 if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
11926 _.unslick(targetBreakpoint);
11927 } else {
11928 _.options = $.extend({}, _.originalSettings,
11929 _.breakpointSettings[
11930 targetBreakpoint]);
11931 if (initial === true) {
11932 _.currentSlide = _.options.initialSlide;
11933 }
11934 _.refresh(initial);
11935 }
11936 triggerBreakpoint = targetBreakpoint;
11937 }
11938 } else {
11939 if (_.activeBreakpoint !== null) {
11940 _.activeBreakpoint = null;
11941 _.options = _.originalSettings;
11942 if (initial === true) {
11943 _.currentSlide = _.options.initialSlide;
11944 }
11945 _.refresh(initial);
11946 triggerBreakpoint = targetBreakpoint;
11947 }
11948 }
11949
11950 // only trigger breakpoints during an actual break. not on initialize.
11951 if( !initial && triggerBreakpoint !== false ) {
11952 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]);
11953 }
11954 }
11955
11956 };
11957
11958 Slick.prototype.changeSlide = function(event, dontAnimate) {
11959
11960 var _ = this,
11961 $target = $(event.currentTarget),
11962 indexOffset, slideOffset, unevenOffset;
11963
11964 // If target is a link, prevent default action.
11965 if($target.is('a')) {
11966 event.preventDefault();
11967 }
11968
11969 // If target is not the <li> element (ie: a child), find the <li>.
11970 if(!$target.is('li')) {
11971 $target = $target.closest('li');
11972 }
11973
11974 unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0);
11975 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll;
11976
11977 switch (event.data.message) {
11978
11979 case 'previous':
11980 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset;
11981 if (_.slideCount > _.options.slidesToShow) {
11982 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate);
11983 }
11984 break;
11985
11986 case 'next':
11987 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset;
11988 if (_.slideCount > _.options.slidesToShow) {
11989 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate);
11990 }
11991 break;
11992
11993 case 'index':
11994 var index = event.data.index === 0 ? 0 :
11995 event.data.index || $target.index() * _.options.slidesToScroll;
11996
11997 _.slideHandler(_.checkNavigable(index), false, dontAnimate);
11998 $target.children().trigger('focus');
11999 break;
12000
12001 default:
12002 return;
12003 }
12004
12005 };
12006
12007 Slick.prototype.checkNavigable = function(index) {
12008
12009 var _ = this,
12010 navigables, prevNavigable;
12011
12012 navigables = _.getNavigableIndexes();
12013 prevNavigable = 0;
12014 if (index > navigables[navigables.length - 1]) {
12015 index = navigables[navigables.length - 1];
12016 } else {
12017 for (var n in navigables) {
12018 if (index < navigables[n]) {
12019 index = prevNavigable;
12020 break;
12021 }
12022 prevNavigable = navigables[n];
12023 }
12024 }
12025
12026 return index;
12027 };
12028
12029 Slick.prototype.cleanUpEvents = function() {
12030
12031 var _ = this;
12032
12033 if (_.options.dots && _.$dots !== null) {
12034
12035 $('li', _.$dots)
12036 .off('click.slick', _.changeSlide)
12037 .off('mouseenter.slick', $.proxy(_.interrupt, _, true))
12038 .off('mouseleave.slick', $.proxy(_.interrupt, _, false));
12039
12040 }
12041
12042 _.$slider.off('focus.slick blur.slick');
12043
12044 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
12045 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide);
12046 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide);
12047 }
12048
12049 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler);
12050 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler);
12051 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
12052 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler);
12053
12054 _.$list.off('click.slick', _.clickHandler);
12055
12056 $(document).off(_.visibilityChange, _.visibility);
12057
12058 _.cleanUpSlideEvents();
12059
12060 if (_.options.accessibility === true) {
12061 _.$list.off('keydown.slick', _.keyHandler);
12062 }
12063
12064 if (_.options.focusOnSelect === true) {
12065 $(_.$slideTrack).children().off('click.slick', _.selectHandler);
12066 }
12067
12068 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange);
12069
12070 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize);
12071
12072 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault);
12073
12074 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition);
12075 $(document).off('ready.slick.slick-' + _.instanceUid, _.setPosition);
12076
12077 };
12078
12079 Slick.prototype.cleanUpSlideEvents = function() {
12080
12081 var _ = this;
12082
12083 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true));
12084 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false));
12085
12086 };
12087
12088 Slick.prototype.cleanUpRows = function() {
12089
12090 var _ = this, originalSlides;
12091
12092 if(_.options.rows > 1) {
12093 originalSlides = _.$slides.children().children();
12094 originalSlides.removeAttr('style');
12095 _.$slider.empty().append(originalSlides);
12096 }
12097
12098 };
12099
12100 Slick.prototype.clickHandler = function(event) {
12101
12102 var _ = this;
12103
12104 if (_.shouldClick === false) {
12105 event.stopImmediatePropagation();
12106 event.stopPropagation();
12107 event.preventDefault();
12108 }
12109
12110 };
12111
12112 Slick.prototype.destroy = function(refresh) {
12113
12114 var _ = this;
12115
12116 _.autoPlayClear();
12117
12118 _.touchObject = {};
12119
12120 _.cleanUpEvents();
12121
12122 $('.slick-cloned', _.$slider).detach();
12123
12124 if (_.$dots) {
12125 _.$dots.remove();
12126 }
12127
12128
12129 if ( _.$prevArrow && _.$prevArrow.length ) {
12130
12131 _.$prevArrow
12132 .removeClass('slick-disabled slick-arrow slick-hidden')
12133 .removeAttr('aria-hidden aria-disabled tabindex')
12134 .css('display','');
12135
12136 if ( _.htmlExpr.test( _.options.prevArrow )) {
12137 _.$prevArrow.remove();
12138 }
12139 }
12140
12141 if ( _.$nextArrow && _.$nextArrow.length ) {
12142
12143 _.$nextArrow
12144 .removeClass('slick-disabled slick-arrow slick-hidden')
12145 .removeAttr('aria-hidden aria-disabled tabindex')
12146 .css('display','');
12147
12148 if ( _.htmlExpr.test( _.options.nextArrow )) {
12149 _.$nextArrow.remove();
12150 }
12151
12152 }
12153
12154
12155 if (_.$slides) {
12156
12157 _.$slides
12158 .removeClass('slick-slide slick-active slick-center slick-visible slick-current')
12159 .removeAttr('aria-hidden')
12160 .removeAttr('data-slick-index')
12161 .each(function(){
12162 $(this).attr('style', $(this).data('originalStyling'));
12163 });
12164
12165 _.$slideTrack.children(this.options.slide).detach();
12166
12167 _.$slideTrack.detach();
12168
12169 _.$list.detach();
12170
12171 _.$slider.append(_.$slides);
12172 }
12173
12174 _.cleanUpRows();
12175
12176 _.$slider.removeClass('slick-slider');
12177 _.$slider.removeClass('slick-initialized');
12178 _.$slider.removeClass('slick-dotted');
12179
12180 _.unslicked = true;
12181
12182 if(!refresh) {
12183 _.$slider.trigger('destroy', [_]);
12184 }
12185
12186 };
12187
12188 Slick.prototype.disableTransition = function(slide) {
12189
12190 var _ = this,
12191 transition = {};
12192
12193 transition[_.transitionType] = '';
12194
12195 if (_.options.fade === false) {
12196 _.$slideTrack.css(transition);
12197 } else {
12198 _.$slides.eq(slide).css(transition);
12199 }
12200
12201 };
12202
12203 Slick.prototype.fadeSlide = function(slideIndex, callback) {
12204
12205 var _ = this;
12206
12207 if (_.cssTransitions === false) {
12208
12209 _.$slides.eq(slideIndex).css({
12210 zIndex: _.options.zIndex
12211 });
12212
12213 _.$slides.eq(slideIndex).animate({
12214 opacity: 1
12215 }, _.options.speed, _.options.easing, callback);
12216
12217 } else {
12218
12219 _.applyTransition(slideIndex);
12220
12221 _.$slides.eq(slideIndex).css({
12222 opacity: 1,
12223 zIndex: _.options.zIndex
12224 });
12225
12226 if (callback) {
12227 setTimeout(function() {
12228
12229 _.disableTransition(slideIndex);
12230
12231 callback.call();
12232 }, _.options.speed);
12233 }
12234
12235 }
12236
12237 };
12238
12239 Slick.prototype.fadeSlideOut = function(slideIndex) {
12240
12241 var _ = this;
12242
12243 if (_.cssTransitions === false) {
12244
12245 _.$slides.eq(slideIndex).animate({
12246 opacity: 0,
12247 zIndex: _.options.zIndex - 2
12248 }, _.options.speed, _.options.easing);
12249
12250 } else {
12251
12252 _.applyTransition(slideIndex);
12253
12254 _.$slides.eq(slideIndex).css({
12255 opacity: 0,
12256 zIndex: _.options.zIndex - 2
12257 });
12258
12259 }
12260
12261 };
12262
12263 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) {
12264
12265 var _ = this;
12266
12267 if (filter !== null) {
12268
12269 _.$slidesCache = _.$slides;
12270
12271 _.unload();
12272
12273 _.$slideTrack.children(this.options.slide).detach();
12274
12275 _.$slidesCache.filter(filter).appendTo(_.$slideTrack);
12276
12277 _.reinit();
12278
12279 }
12280
12281 };
12282
12283 Slick.prototype.focusHandler = function() {
12284
12285 var _ = this;
12286
12287 _.$slider
12288 .off('focus.slick blur.slick')
12289 .on('focus.slick blur.slick',
12290 '*:not(.slick-arrow)', function(event) {
12291
12292 event.stopImmediatePropagation();
12293 var $sf = $(this);
12294
12295 setTimeout(function() {
12296
12297 if( _.options.pauseOnFocus ) {
12298 _.focussed = $sf.is(':focus');
12299 _.autoPlay();
12300 }
12301
12302 }, 0);
12303
12304 });
12305 };
12306
12307 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() {
12308
12309 var _ = this;
12310 return _.currentSlide;
12311
12312 };
12313
12314 Slick.prototype.getDotCount = function() {
12315
12316 var _ = this;
12317
12318 var breakPoint = 0;
12319 var counter = 0;
12320 var pagerQty = 0;
12321
12322 if (_.options.infinite === true) {
12323 while (breakPoint < _.slideCount) {
12324 ++pagerQty;
12325 breakPoint = counter + _.options.slidesToScroll;
12326 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
12327 }
12328 } else if (_.options.centerMode === true) {
12329 pagerQty = _.slideCount;
12330 } else if(!_.options.asNavFor) {
12331 pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll);
12332 }else {
12333 while (breakPoint < _.slideCount) {
12334 ++pagerQty;
12335 breakPoint = counter + _.options.slidesToScroll;
12336 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
12337 }
12338 }
12339
12340 return pagerQty - 1;
12341
12342 };
12343
12344 Slick.prototype.getLeft = function(slideIndex) {
12345
12346 var _ = this,
12347 targetLeft,
12348 verticalHeight,
12349 verticalOffset = 0,
12350 targetSlide;
12351
12352 _.slideOffset = 0;
12353 verticalHeight = _.$slides.first().outerHeight(true);
12354
12355 if (_.options.infinite === true) {
12356 if (_.slideCount > _.options.slidesToShow) {
12357 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
12358 verticalOffset = (verticalHeight * _.options.slidesToShow) * -1;
12359 }
12360 if (_.slideCount % _.options.slidesToScroll !== 0) {
12361 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
12362 if (slideIndex > _.slideCount) {
12363 _.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1;
12364 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1;
12365 } else {
12366 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1;
12367 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1;
12368 }
12369 }
12370 }
12371 } else {
12372 if (slideIndex + _.options.slidesToShow > _.slideCount) {
12373 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth;
12374 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight;
12375 }
12376 }
12377
12378 if (_.slideCount <= _.options.slidesToShow) {
12379 _.slideOffset = 0;
12380 verticalOffset = 0;
12381 }
12382
12383 if (_.options.centerMode === true && _.options.infinite === true) {
12384 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth;
12385 } else if (_.options.centerMode === true) {
12386 _.slideOffset = 0;
12387 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2);
12388 }
12389
12390 if (_.options.vertical === false) {
12391 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset;
12392 } else {
12393 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset;
12394 }
12395
12396 if (_.options.variableWidth === true) {
12397
12398 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
12399 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
12400 } else {
12401 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow);
12402 }
12403
12404 if (_.options.rtl === true) {
12405 if (targetSlide[0]) {
12406 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1;
12407 } else {
12408 targetLeft = 0;
12409 }
12410 } else {
12411 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
12412 }
12413
12414 if (_.options.centerMode === true) {
12415 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
12416 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
12417 } else {
12418 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1);
12419 }
12420
12421 if (_.options.rtl === true) {
12422 if (targetSlide[0]) {
12423 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1;
12424 } else {
12425 targetLeft = 0;
12426 }
12427 } else {
12428 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
12429 }
12430
12431 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2;
12432 }
12433 }
12434
12435 return targetLeft;
12436
12437 };
12438
12439 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) {
12440
12441 var _ = this;
12442
12443 return _.options[option];
12444
12445 };
12446
12447 Slick.prototype.getNavigableIndexes = function() {
12448
12449 var _ = this,
12450 breakPoint = 0,
12451 counter = 0,
12452 indexes = [],
12453 max;
12454
12455 if (_.options.infinite === false) {
12456 max = _.slideCount;
12457 } else {
12458 breakPoint = _.options.slidesToScroll * -1;
12459 counter = _.options.slidesToScroll * -1;
12460 max = _.slideCount * 2;
12461 }
12462
12463 while (breakPoint < max) {
12464 indexes.push(breakPoint);
12465 breakPoint = counter + _.options.slidesToScroll;
12466 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
12467 }
12468
12469 return indexes;
12470
12471 };
12472
12473 Slick.prototype.getSlick = function() {
12474
12475 return this;
12476
12477 };
12478
12479 Slick.prototype.getSlideCount = function() {
12480
12481 var _ = this,
12482 slidesTraversed, swipedSlide, centerOffset;
12483
12484 centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0;
12485
12486 if (_.options.swipeToSlide === true) {
12487 _.$slideTrack.find('.slick-slide').each(function(index, slide) {
12488 if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) {
12489 swipedSlide = slide;
12490 return false;
12491 }
12492 });
12493
12494 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1;
12495
12496 return slidesTraversed;
12497
12498 } else {
12499 return _.options.slidesToScroll;
12500 }
12501
12502 };
12503
12504 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) {
12505
12506 var _ = this;
12507
12508 _.changeSlide({
12509 data: {
12510 message: 'index',
12511 index: parseInt(slide)
12512 }
12513 }, dontAnimate);
12514
12515 };
12516
12517 Slick.prototype.init = function(creation) {
12518
12519 var _ = this;
12520
12521 if (!$(_.$slider).hasClass('slick-initialized')) {
12522
12523 $(_.$slider).addClass('slick-initialized');
12524
12525 _.buildRows();
12526 _.buildOut();
12527 _.setProps();
12528 _.startLoad();
12529 _.loadSlider();
12530 _.initializeEvents();
12531 _.updateArrows();
12532 _.updateDots();
12533 _.checkResponsive(true);
12534 _.focusHandler();
12535
12536 }
12537
12538 if (creation) {
12539 _.$slider.trigger('init', [_]);
12540 }
12541
12542 if (_.options.accessibility === true) {
12543 _.initADA();
12544 }
12545
12546 if ( _.options.autoplay ) {
12547
12548 _.paused = false;
12549 _.autoPlay();
12550
12551 }
12552
12553 };
12554
12555 Slick.prototype.initADA = function() {
12556 var _ = this;
12557 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({
12558 'aria-hidden': 'true',
12559 'tabindex': '-1'
12560 }).find('a, input, button, select').attr({
12561 'tabindex': '-1'
12562 });
12563
12564 _.$slideTrack.attr('role', 'listbox');
12565
12566 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) {
12567 $(this).attr({
12568 'role': 'option',
12569 'aria-describedby': 'slick-slide' + _.instanceUid + i + ''
12570 });
12571 });
12572
12573 if (_.$dots !== null) {
12574 _.$dots.attr('role', 'tablist').find('li').each(function(i) {
12575 $(this).attr({
12576 'role': 'presentation',
12577 'aria-selected': 'false',
12578 'aria-controls': 'navigation' + _.instanceUid + i + '',
12579 'id': 'slick-slide' + _.instanceUid + i + ''
12580 });
12581 })
12582 .first().attr('aria-selected', 'true').end()
12583 .find('button').attr('role', 'button').end()
12584 .closest('div').attr('role', 'toolbar');
12585 }
12586 _.activateADA();
12587
12588 };
12589
12590 Slick.prototype.initArrowEvents = function() {
12591
12592 var _ = this;
12593
12594 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
12595 _.$prevArrow
12596 .off('click.slick')
12597 .on('click.slick', {
12598 message: 'previous'
12599 }, _.changeSlide);
12600 _.$nextArrow
12601 .off('click.slick')
12602 .on('click.slick', {
12603 message: 'next'
12604 }, _.changeSlide);
12605 }
12606
12607 };
12608
12609 Slick.prototype.initDotEvents = function() {
12610
12611 var _ = this;
12612
12613 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
12614 $('li', _.$dots).on('click.slick', {
12615 message: 'index'
12616 }, _.changeSlide);
12617 }
12618
12619 if ( _.options.dots === true && _.options.pauseOnDotsHover === true ) {
12620
12621 $('li', _.$dots)
12622 .on('mouseenter.slick', $.proxy(_.interrupt, _, true))
12623 .on('mouseleave.slick', $.proxy(_.interrupt, _, false));
12624
12625 }
12626
12627 };
12628
12629 Slick.prototype.initSlideEvents = function() {
12630
12631 var _ = this;
12632
12633 if ( _.options.pauseOnHover ) {
12634
12635 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true));
12636 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false));
12637
12638 }
12639
12640 };
12641
12642 Slick.prototype.initializeEvents = function() {
12643
12644 var _ = this;
12645
12646 _.initArrowEvents();
12647
12648 _.initDotEvents();
12649 _.initSlideEvents();
12650
12651 _.$list.on('touchstart.slick mousedown.slick', {
12652 action: 'start'
12653 }, _.swipeHandler);
12654 _.$list.on('touchmove.slick mousemove.slick', {
12655 action: 'move'
12656 }, _.swipeHandler);
12657 _.$list.on('touchend.slick mouseup.slick', {
12658 action: 'end'
12659 }, _.swipeHandler);
12660 _.$list.on('touchcancel.slick mouseleave.slick', {
12661 action: 'end'
12662 }, _.swipeHandler);
12663
12664 _.$list.on('click.slick', _.clickHandler);
12665
12666 $(document).on(_.visibilityChange, $.proxy(_.visibility, _));
12667
12668 if (_.options.accessibility === true) {
12669 _.$list.on('keydown.slick', _.keyHandler);
12670 }
12671
12672 if (_.options.focusOnSelect === true) {
12673 $(_.$slideTrack).children().on('click.slick', _.selectHandler);
12674 }
12675
12676 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _));
12677
12678 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _));
12679
12680 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault);
12681
12682 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition);
12683 $(document).on('ready.slick.slick-' + _.instanceUid, _.setPosition);
12684
12685 };
12686
12687 Slick.prototype.initUI = function() {
12688
12689 var _ = this;
12690
12691 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
12692
12693 _.$prevArrow.show();
12694 _.$nextArrow.show();
12695
12696 }
12697
12698 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
12699
12700 _.$dots.show();
12701
12702 }
12703
12704 };
12705
12706 Slick.prototype.keyHandler = function(event) {
12707
12708 var _ = this;
12709 //Dont slide if the cursor is inside the form fields and arrow keys are pressed
12710 if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) {
12711 if (event.keyCode === 37 && _.options.accessibility === true) {
12712 _.changeSlide({
12713 data: {
12714 message: _.options.rtl === true ? 'next' : 'previous'
12715 }
12716 });
12717 } else if (event.keyCode === 39 && _.options.accessibility === true) {
12718 _.changeSlide({
12719 data: {
12720 message: _.options.rtl === true ? 'previous' : 'next'
12721 }
12722 });
12723 }
12724 }
12725
12726 };
12727
12728 Slick.prototype.lazyLoad = function() {
12729
12730 var _ = this,
12731 loadRange, cloneRange, rangeStart, rangeEnd;
12732
12733 function loadImages(imagesScope) {
12734
12735 $('img[data-lazy]', imagesScope).each(function() {
12736
12737 var image = $(this),
12738 imageSource = $(this).attr('data-lazy'),
12739 imageToLoad = document.createElement('img');
12740
12741 imageToLoad.onload = function() {
12742
12743 image
12744 .animate({ opacity: 0 }, 100, function() {
12745 image
12746 .attr('src', imageSource)
12747 .animate({ opacity: 1 }, 200, function() {
12748 image
12749 .removeAttr('data-lazy')
12750 .removeClass('slick-loading');
12751 });
12752 _.$slider.trigger('lazyLoaded', [_, image, imageSource]);
12753 });
12754
12755 };
12756
12757 imageToLoad.onerror = function() {
12758
12759 image
12760 .removeAttr( 'data-lazy' )
12761 .removeClass( 'slick-loading' )
12762 .addClass( 'slick-lazyload-error' );
12763
12764 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]);
12765
12766 };
12767
12768 imageToLoad.src = imageSource;
12769
12770 });
12771
12772 }
12773
12774 if (_.options.centerMode === true) {
12775 if (_.options.infinite === true) {
12776 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1);
12777 rangeEnd = rangeStart + _.options.slidesToShow + 2;
12778 } else {
12779 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1));
12780 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide;
12781 }
12782 } else {
12783 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide;
12784 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow);
12785 if (_.options.fade === true) {
12786 if (rangeStart > 0) rangeStart--;
12787 if (rangeEnd <= _.slideCount) rangeEnd++;
12788 }
12789 }
12790
12791 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd);
12792 loadImages(loadRange);
12793
12794 if (_.slideCount <= _.options.slidesToShow) {
12795 cloneRange = _.$slider.find('.slick-slide');
12796 loadImages(cloneRange);
12797 } else
12798 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
12799 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow);
12800 loadImages(cloneRange);
12801 } else if (_.currentSlide === 0) {
12802 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1);
12803 loadImages(cloneRange);
12804 }
12805
12806 };
12807
12808 Slick.prototype.loadSlider = function() {
12809
12810 var _ = this;
12811
12812 _.setPosition();
12813
12814 _.$slideTrack.css({
12815 opacity: 1
12816 });
12817
12818 _.$slider.removeClass('slick-loading');
12819
12820 _.initUI();
12821
12822 if (_.options.lazyLoad === 'progressive') {
12823 _.progressiveLazyLoad();
12824 }
12825
12826 };
12827
12828 Slick.prototype.next = Slick.prototype.slickNext = function() {
12829
12830 var _ = this;
12831
12832 _.changeSlide({
12833 data: {
12834 message: 'next'
12835 }
12836 });
12837
12838 };
12839
12840 Slick.prototype.orientationChange = function() {
12841
12842 var _ = this;
12843
12844 _.checkResponsive();
12845 _.setPosition();
12846
12847 };
12848
12849 Slick.prototype.pause = Slick.prototype.slickPause = function() {
12850
12851 var _ = this;
12852
12853 _.autoPlayClear();
12854 _.paused = true;
12855
12856 };
12857
12858 Slick.prototype.play = Slick.prototype.slickPlay = function() {
12859
12860 var _ = this;
12861
12862 _.autoPlay();
12863 _.options.autoplay = true;
12864 _.paused = false;
12865 _.focussed = false;
12866 _.interrupted = false;
12867
12868 };
12869
12870 Slick.prototype.postSlide = function(index) {
12871
12872 var _ = this;
12873
12874 if( !_.unslicked ) {
12875
12876 _.$slider.trigger('afterChange', [_, index]);
12877
12878 _.animating = false;
12879
12880 _.setPosition();
12881
12882 _.swipeLeft = null;
12883
12884 if ( _.options.autoplay ) {
12885 _.autoPlay();
12886 }
12887
12888 if (_.options.accessibility === true) {
12889 _.initADA();
12890 }
12891
12892 }
12893
12894 };
12895
12896 Slick.prototype.prev = Slick.prototype.slickPrev = function() {
12897
12898 var _ = this;
12899
12900 _.changeSlide({
12901 data: {
12902 message: 'previous'
12903 }
12904 });
12905
12906 };
12907
12908 Slick.prototype.preventDefault = function(event) {
12909
12910 event.preventDefault();
12911
12912 };
12913
12914 Slick.prototype.progressiveLazyLoad = function( tryCount ) {
12915
12916 tryCount = tryCount || 1;
12917
12918 var _ = this,
12919 $imgsToLoad = $( 'img[data-lazy]', _.$slider ),
12920 image,
12921 imageSource,
12922 imageToLoad;
12923
12924 if ( $imgsToLoad.length ) {
12925
12926 image = $imgsToLoad.first();
12927 imageSource = image.attr('data-lazy');
12928 imageToLoad = document.createElement('img');
12929
12930 imageToLoad.onload = function() {
12931
12932 image
12933 .attr( 'src', imageSource )
12934 .removeAttr('data-lazy')
12935 .removeClass('slick-loading');
12936
12937 if ( _.options.adaptiveHeight === true ) {
12938 _.setPosition();
12939 }
12940
12941 _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]);
12942 _.progressiveLazyLoad();
12943
12944 };
12945
12946 imageToLoad.onerror = function() {
12947
12948 if ( tryCount < 3 ) {
12949
12950 /**
12951 * try to load the image 3 times,
12952 * leave a slight delay so we don't get
12953 * servers blocking the request.
12954 */
12955 setTimeout( function() {
12956 _.progressiveLazyLoad( tryCount + 1 );
12957 }, 500 );
12958
12959 } else {
12960
12961 image
12962 .removeAttr( 'data-lazy' )
12963 .removeClass( 'slick-loading' )
12964 .addClass( 'slick-lazyload-error' );
12965
12966 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]);
12967
12968 _.progressiveLazyLoad();
12969
12970 }
12971
12972 };
12973
12974 imageToLoad.src = imageSource;
12975
12976 } else {
12977
12978 _.$slider.trigger('allImagesLoaded', [ _ ]);
12979
12980 }
12981
12982 };
12983
12984 Slick.prototype.refresh = function( initializing ) {
12985
12986 var _ = this, currentSlide, lastVisibleIndex;
12987
12988 lastVisibleIndex = _.slideCount - _.options.slidesToShow;
12989
12990 // in non-infinite sliders, we don't want to go past the
12991 // last visible index.
12992 if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) {
12993 _.currentSlide = lastVisibleIndex;
12994 }
12995
12996 // if less slides than to show, go to start.
12997 if ( _.slideCount <= _.options.slidesToShow ) {
12998 _.currentSlide = 0;
12999
13000 }
13001
13002 currentSlide = _.currentSlide;
13003
13004 _.destroy(true);
13005
13006 $.extend(_, _.initials, { currentSlide: currentSlide });
13007
13008 _.init();
13009
13010 if( !initializing ) {
13011
13012 _.changeSlide({
13013 data: {
13014 message: 'index',
13015 index: currentSlide
13016 }
13017 }, false);
13018
13019 }
13020
13021 };
13022
13023 Slick.prototype.registerBreakpoints = function() {
13024
13025 var _ = this, breakpoint, currentBreakpoint, l,
13026 responsiveSettings = _.options.responsive || null;
13027
13028 if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) {
13029
13030 _.respondTo = _.options.respondTo || 'window';
13031
13032 for ( breakpoint in responsiveSettings ) {
13033
13034 l = _.breakpoints.length-1;
13035 currentBreakpoint = responsiveSettings[breakpoint].breakpoint;
13036
13037 if (responsiveSettings.hasOwnProperty(breakpoint)) {
13038
13039 // loop through the breakpoints and cut out any existing
13040 // ones with the same breakpoint number, we don't want dupes.
13041 while( l >= 0 ) {
13042 if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) {
13043 _.breakpoints.splice(l,1);
13044 }
13045 l--;
13046 }
13047
13048 _.breakpoints.push(currentBreakpoint);
13049 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings;
13050
13051 }
13052
13053 }
13054
13055 _.breakpoints.sort(function(a, b) {
13056 return ( _.options.mobileFirst ) ? a-b : b-a;
13057 });
13058
13059 }
13060
13061 };
13062
13063 Slick.prototype.reinit = function() {
13064
13065 var _ = this;
13066
13067 _.$slides =
13068 _.$slideTrack
13069 .children(_.options.slide)
13070 .addClass('slick-slide');
13071
13072 _.slideCount = _.$slides.length;
13073
13074 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) {
13075 _.currentSlide = _.currentSlide - _.options.slidesToScroll;
13076 }
13077
13078 if (_.slideCount <= _.options.slidesToShow) {
13079 _.currentSlide = 0;
13080 }
13081
13082 _.registerBreakpoints();
13083
13084 _.setProps();
13085 _.setupInfinite();
13086 _.buildArrows();
13087 _.updateArrows();
13088 _.initArrowEvents();
13089 _.buildDots();
13090 _.updateDots();
13091 _.initDotEvents();
13092 _.cleanUpSlideEvents();
13093 _.initSlideEvents();
13094
13095 _.checkResponsive(false, true);
13096
13097 if (_.options.focusOnSelect === true) {
13098 $(_.$slideTrack).children().on('click.slick', _.selectHandler);
13099 }
13100
13101 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);
13102
13103 _.setPosition();
13104 _.focusHandler();
13105
13106 _.paused = !_.options.autoplay;
13107 _.autoPlay();
13108
13109 _.$slider.trigger('reInit', [_]);
13110
13111 };
13112
13113 Slick.prototype.resize = function() {
13114
13115 var _ = this;
13116
13117 if ($(window).width() !== _.windowWidth) {
13118 clearTimeout(_.windowDelay);
13119 _.windowDelay = window.setTimeout(function() {
13120 _.windowWidth = $(window).width();
13121 _.checkResponsive();
13122 if( !_.unslicked ) { _.setPosition(); }
13123 }, 50);
13124 }
13125 };
13126
13127 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) {
13128
13129 var _ = this;
13130
13131 if (typeof(index) === 'boolean') {
13132 removeBefore = index;
13133 index = removeBefore === true ? 0 : _.slideCount - 1;
13134 } else {
13135 index = removeBefore === true ? --index : index;
13136 }
13137
13138 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) {
13139 return false;
13140 }
13141
13142 _.unload();
13143
13144 if (removeAll === true) {
13145 _.$slideTrack.children().remove();
13146 } else {
13147 _.$slideTrack.children(this.options.slide).eq(index).remove();
13148 }
13149
13150 _.$slides = _.$slideTrack.children(this.options.slide);
13151
13152 _.$slideTrack.children(this.options.slide).detach();
13153
13154 _.$slideTrack.append(_.$slides);
13155
13156 _.$slidesCache = _.$slides;
13157
13158 _.reinit();
13159
13160 };
13161
13162 Slick.prototype.setCSS = function(position) {
13163
13164 var _ = this,
13165 positionProps = {},
13166 x, y;
13167
13168 if (_.options.rtl === true) {
13169 position = -position;
13170 }
13171 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px';
13172 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px';
13173
13174 positionProps[_.positionProp] = position;
13175
13176 if (_.transformsEnabled === false) {
13177 _.$slideTrack.css(positionProps);
13178 } else {
13179 positionProps = {};
13180 if (_.cssTransitions === false) {
13181 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')';
13182 _.$slideTrack.css(positionProps);
13183 } else {
13184 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)';
13185 _.$slideTrack.css(positionProps);
13186 }
13187 }
13188
13189 };
13190
13191 Slick.prototype.setDimensions = function() {
13192
13193 var _ = this;
13194
13195 if (_.options.vertical === false) {
13196 if (_.options.centerMode === true) {
13197 _.$list.css({
13198 padding: ('0px ' + _.options.centerPadding)
13199 });
13200 }
13201 } else {
13202 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow);
13203 if (_.options.centerMode === true) {
13204 _.$list.css({
13205 padding: (_.options.centerPadding + ' 0px')
13206 });
13207 }
13208 }
13209
13210 _.listWidth = _.$list.width();
13211 _.listHeight = _.$list.height();
13212
13213
13214 if (_.options.vertical === false && _.options.variableWidth === false) {
13215 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow);
13216 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length)));
13217
13218 } else if (_.options.variableWidth === true) {
13219 _.$slideTrack.width(5000 * _.slideCount);
13220 } else {
13221 _.slideWidth = Math.ceil(_.listWidth);
13222 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length)));
13223 }
13224
13225 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width();
13226 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset);
13227
13228 };
13229
13230 Slick.prototype.setFade = function() {
13231
13232 var _ = this,
13233 targetLeft;
13234
13235 _.$slides.each(function(index, element) {
13236 targetLeft = (_.slideWidth * index) * -1;
13237 if (_.options.rtl === true) {
13238 $(element).css({
13239 position: 'relative',
13240 right: targetLeft,
13241 top: 0,
13242 zIndex: _.options.zIndex - 2,
13243 opacity: 0
13244 });
13245 } else {
13246 $(element).css({
13247 position: 'relative',
13248 left: targetLeft,
13249 top: 0,
13250 zIndex: _.options.zIndex - 2,
13251 opacity: 0
13252 });
13253 }
13254 });
13255
13256 _.$slides.eq(_.currentSlide).css({
13257 zIndex: _.options.zIndex - 1,
13258 opacity: 1
13259 });
13260
13261 };
13262
13263 Slick.prototype.setHeight = function() {
13264
13265 var _ = this;
13266
13267 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
13268 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
13269 _.$list.css('height', targetHeight);
13270 }
13271
13272 };
13273
13274 Slick.prototype.setOption =
13275 Slick.prototype.slickSetOption = function() {
13276
13277 /**
13278 * accepts arguments in format of:
13279 *
13280 * - for changing a single option's value:
13281 * .slick("setOption", option, value, refresh )
13282 *
13283 * - for changing a set of responsive options:
13284 * .slick("setOption", 'responsive', [{}, ...], refresh )
13285 *
13286 * - for updating multiple values at once (not responsive)
13287 * .slick("setOption", { 'option': value, ... }, refresh )
13288 */
13289
13290 var _ = this, l, item, option, value, refresh = false, type;
13291
13292 if( $.type( arguments[0] ) === 'object' ) {
13293
13294 option = arguments[0];
13295 refresh = arguments[1];
13296 type = 'multiple';
13297
13298 } else if ( $.type( arguments[0] ) === 'string' ) {
13299
13300 option = arguments[0];
13301 value = arguments[1];
13302 refresh = arguments[2];
13303
13304 if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) {
13305
13306 type = 'responsive';
13307
13308 } else if ( typeof arguments[1] !== 'undefined' ) {
13309
13310 type = 'single';
13311
13312 }
13313
13314 }
13315
13316 if ( type === 'single' ) {
13317
13318 _.options[option] = value;
13319
13320
13321 } else if ( type === 'multiple' ) {
13322
13323 $.each( option , function( opt, val ) {
13324
13325 _.options[opt] = val;
13326
13327 });
13328
13329
13330 } else if ( type === 'responsive' ) {
13331
13332 for ( item in value ) {
13333
13334 if( $.type( _.options.responsive ) !== 'array' ) {
13335
13336 _.options.responsive = [ value[item] ];
13337
13338 } else {
13339
13340 l = _.options.responsive.length-1;
13341
13342 // loop through the responsive object and splice out duplicates.
13343 while( l >= 0 ) {
13344
13345 if( _.options.responsive[l].breakpoint === value[item].breakpoint ) {
13346
13347 _.options.responsive.splice(l,1);
13348
13349 }
13350
13351 l--;
13352
13353 }
13354
13355 _.options.responsive.push( value[item] );
13356
13357 }
13358
13359 }
13360
13361 }
13362
13363 if ( refresh ) {
13364
13365 _.unload();
13366 _.reinit();
13367
13368 }
13369
13370 };
13371
13372 Slick.prototype.setPosition = function() {
13373
13374 var _ = this;
13375
13376 _.setDimensions();
13377
13378 _.setHeight();
13379
13380 if (_.options.fade === false) {
13381 _.setCSS(_.getLeft(_.currentSlide));
13382 } else {
13383 _.setFade();
13384 }
13385
13386 _.$slider.trigger('setPosition', [_]);
13387
13388 };
13389
13390 Slick.prototype.setProps = function() {
13391
13392 var _ = this,
13393 bodyStyle = document.body.style;
13394
13395 _.positionProp = _.options.vertical === true ? 'top' : 'left';
13396
13397 if (_.positionProp === 'top') {
13398 _.$slider.addClass('slick-vertical');
13399 } else {
13400 _.$slider.removeClass('slick-vertical');
13401 }
13402
13403 if (bodyStyle.WebkitTransition !== undefined ||
13404 bodyStyle.MozTransition !== undefined ||
13405 bodyStyle.msTransition !== undefined) {
13406 if (_.options.useCSS === true) {
13407 _.cssTransitions = true;
13408 }
13409 }
13410
13411 if ( _.options.fade ) {
13412 if ( typeof _.options.zIndex === 'number' ) {
13413 if( _.options.zIndex < 3 ) {
13414 _.options.zIndex = 3;
13415 }
13416 } else {
13417 _.options.zIndex = _.defaults.zIndex;
13418 }
13419 }
13420
13421 if (bodyStyle.OTransform !== undefined) {
13422 _.animType = 'OTransform';
13423 _.transformType = '-o-transform';
13424 _.transitionType = 'OTransition';
13425 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
13426 }
13427 if (bodyStyle.MozTransform !== undefined) {
13428 _.animType = 'MozTransform';
13429 _.transformType = '-moz-transform';
13430 _.transitionType = 'MozTransition';
13431 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false;
13432 }
13433 if (bodyStyle.webkitTransform !== undefined) {
13434 _.animType = 'webkitTransform';
13435 _.transformType = '-webkit-transform';
13436 _.transitionType = 'webkitTransition';
13437 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
13438 }
13439 if (bodyStyle.msTransform !== undefined) {
13440 _.animType = 'msTransform';
13441 _.transformType = '-ms-transform';
13442 _.transitionType = 'msTransition';
13443 if (bodyStyle.msTransform === undefined) _.animType = false;
13444 }
13445 if (bodyStyle.transform !== undefined && _.animType !== false) {
13446 _.animType = 'transform';
13447 _.transformType = 'transform';
13448 _.transitionType = 'transition';
13449 }
13450 _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false);
13451 };
13452
13453
13454 Slick.prototype.setSlideClasses = function(index) {
13455
13456 var _ = this,
13457 centerOffset, allSlides, indexOffset, remainder;
13458
13459 allSlides = _.$slider
13460 .find('.slick-slide')
13461 .removeClass('slick-active slick-center slick-current')
13462 .attr('aria-hidden', 'true');
13463
13464 _.$slides
13465 .eq(index)
13466 .addClass('slick-current');
13467
13468 if (_.options.centerMode === true) {
13469
13470 centerOffset = Math.floor(_.options.slidesToShow / 2);
13471
13472 if (_.options.infinite === true) {
13473
13474 if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {
13475
13476 _.$slides
13477 .slice(index - centerOffset, index + centerOffset + 1)
13478 .addClass('slick-active')
13479 .attr('aria-hidden', 'false');
13480
13481 } else {
13482
13483 indexOffset = _.options.slidesToShow + index;
13484 allSlides
13485 .slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2)
13486 .addClass('slick-active')
13487 .attr('aria-hidden', 'false');
13488
13489 }
13490
13491 if (index === 0) {
13492
13493 allSlides
13494 .eq(allSlides.length - 1 - _.options.slidesToShow)
13495 .addClass('slick-center');
13496
13497 } else if (index === _.slideCount - 1) {
13498
13499 allSlides
13500 .eq(_.options.slidesToShow)
13501 .addClass('slick-center');
13502
13503 }
13504
13505 }
13506
13507 _.$slides
13508 .eq(index)
13509 .addClass('slick-center');
13510
13511 } else {
13512
13513 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) {
13514
13515 _.$slides
13516 .slice(index, index + _.options.slidesToShow)
13517 .addClass('slick-active')
13518 .attr('aria-hidden', 'false');
13519
13520 } else if (allSlides.length <= _.options.slidesToShow) {
13521
13522 allSlides
13523 .addClass('slick-active')
13524 .attr('aria-hidden', 'false');
13525
13526 } else {
13527
13528 remainder = _.slideCount % _.options.slidesToShow;
13529 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index;
13530
13531 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) {
13532
13533 allSlides
13534 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder)
13535 .addClass('slick-active')
13536 .attr('aria-hidden', 'false');
13537
13538 } else {
13539
13540 allSlides
13541 .slice(indexOffset, indexOffset + _.options.slidesToShow)
13542 .addClass('slick-active')
13543 .attr('aria-hidden', 'false');
13544
13545 }
13546
13547 }
13548
13549 }
13550
13551 if (_.options.lazyLoad === 'ondemand') {
13552 _.lazyLoad();
13553 }
13554
13555 };
13556
13557 Slick.prototype.setupInfinite = function() {
13558
13559 var _ = this,
13560 i, slideIndex, infiniteCount;
13561
13562 if (_.options.fade === true) {
13563 _.options.centerMode = false;
13564 }
13565
13566 if (_.options.infinite === true && _.options.fade === false) {
13567
13568 slideIndex = null;
13569
13570 if (_.slideCount > _.options.slidesToShow) {
13571
13572 if (_.options.centerMode === true) {
13573 infiniteCount = _.options.slidesToShow + 1;
13574 } else {
13575 infiniteCount = _.options.slidesToShow;
13576 }
13577
13578 for (i = _.slideCount; i > (_.slideCount -
13579 infiniteCount); i -= 1) {
13580 slideIndex = i - 1;
13581 $(_.$slides[slideIndex]).clone(true).attr('id', '')
13582 .attr('data-slick-index', slideIndex - _.slideCount)
13583 .prependTo(_.$slideTrack).addClass('slick-cloned');
13584 }
13585 for (i = 0; i < infiniteCount; i += 1) {
13586 slideIndex = i;
13587 $(_.$slides[slideIndex]).clone(true).attr('id', '')
13588 .attr('data-slick-index', slideIndex + _.slideCount)
13589 .appendTo(_.$slideTrack).addClass('slick-cloned');
13590 }
13591 _.$slideTrack.find('.slick-cloned').find('[id]').each(function() {
13592 $(this).attr('id', '');
13593 });
13594
13595 }
13596
13597 }
13598
13599 };
13600
13601 Slick.prototype.interrupt = function( toggle ) {
13602
13603 var _ = this;
13604
13605 if( !toggle ) {
13606 _.autoPlay();
13607 }
13608 _.interrupted = toggle;
13609
13610 };
13611
13612 Slick.prototype.selectHandler = function(event) {
13613
13614 var _ = this;
13615
13616 var targetElement =
13617 $(event.target).is('.slick-slide') ?
13618 $(event.target) :
13619 $(event.target).parents('.slick-slide');
13620
13621 var index = parseInt(targetElement.attr('data-slick-index'));
13622
13623 if (!index) index = 0;
13624
13625 if (_.slideCount <= _.options.slidesToShow) {
13626
13627 _.setSlideClasses(index);
13628 _.asNavFor(index);
13629 return;
13630
13631 }
13632
13633 _.slideHandler(index);
13634
13635 };
13636
13637 Slick.prototype.slideHandler = function(index, sync, dontAnimate) {
13638
13639 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null,
13640 _ = this, navTarget;
13641
13642 sync = sync || false;
13643
13644 if (_.animating === true && _.options.waitForAnimate === true) {
13645 return;
13646 }
13647
13648 if (_.options.fade === true && _.currentSlide === index) {
13649 return;
13650 }
13651
13652 if (_.slideCount <= _.options.slidesToShow) {
13653 return;
13654 }
13655
13656 if (sync === false) {
13657 _.asNavFor(index);
13658 }
13659
13660 targetSlide = index;
13661 targetLeft = _.getLeft(targetSlide);
13662 slideLeft = _.getLeft(_.currentSlide);
13663
13664 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft;
13665
13666 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) {
13667 if (_.options.fade === false) {
13668 targetSlide = _.currentSlide;
13669 if (dontAnimate !== true) {
13670 _.animateSlide(slideLeft, function() {
13671 _.postSlide(targetSlide);
13672 });
13673 } else {
13674 _.postSlide(targetSlide);
13675 }
13676 }
13677 return;
13678 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) {
13679 if (_.options.fade === false) {
13680 targetSlide = _.currentSlide;
13681 if (dontAnimate !== true) {
13682 _.animateSlide(slideLeft, function() {
13683 _.postSlide(targetSlide);
13684 });
13685 } else {
13686 _.postSlide(targetSlide);
13687 }
13688 }
13689 return;
13690 }
13691
13692 if ( _.options.autoplay ) {
13693 clearInterval(_.autoPlayTimer);
13694 }
13695
13696 if (targetSlide < 0) {
13697 if (_.slideCount % _.options.slidesToScroll !== 0) {
13698 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll);
13699 } else {
13700 animSlide = _.slideCount + targetSlide;
13701 }
13702 } else if (targetSlide >= _.slideCount) {
13703 if (_.slideCount % _.options.slidesToScroll !== 0) {
13704 animSlide = 0;
13705 } else {
13706 animSlide = targetSlide - _.slideCount;
13707 }
13708 } else {
13709 animSlide = targetSlide;
13710 }
13711
13712 _.animating = true;
13713
13714 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]);
13715
13716 oldSlide = _.currentSlide;
13717 _.currentSlide = animSlide;
13718
13719 _.setSlideClasses(_.currentSlide);
13720
13721 if ( _.options.asNavFor ) {
13722
13723 navTarget = _.getNavTarget();
13724 navTarget = navTarget.slick('getSlick');
13725
13726 if ( navTarget.slideCount <= navTarget.options.slidesToShow ) {
13727 navTarget.setSlideClasses(_.currentSlide);
13728 }
13729
13730 }
13731
13732 _.updateDots();
13733 _.updateArrows();
13734
13735 if (_.options.fade === true) {
13736 if (dontAnimate !== true) {
13737
13738 _.fadeSlideOut(oldSlide);
13739
13740 _.fadeSlide(animSlide, function() {
13741 _.postSlide(animSlide);
13742 });
13743
13744 } else {
13745 _.postSlide(animSlide);
13746 }
13747 _.animateHeight();
13748 return;
13749 }
13750
13751 if (dontAnimate !== true) {
13752 _.animateSlide(targetLeft, function() {
13753 _.postSlide(animSlide);
13754 });
13755 } else {
13756 _.postSlide(animSlide);
13757 }
13758
13759 };
13760
13761 Slick.prototype.startLoad = function() {
13762
13763 var _ = this;
13764
13765 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
13766
13767 _.$prevArrow.hide();
13768 _.$nextArrow.hide();
13769
13770 }
13771
13772 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
13773
13774 _.$dots.hide();
13775
13776 }
13777
13778 _.$slider.addClass('slick-loading');
13779
13780 };
13781
13782 Slick.prototype.swipeDirection = function() {
13783
13784 var xDist, yDist, r, swipeAngle, _ = this;
13785
13786 xDist = _.touchObject.startX - _.touchObject.curX;
13787 yDist = _.touchObject.startY - _.touchObject.curY;
13788 r = Math.atan2(yDist, xDist);
13789
13790 swipeAngle = Math.round(r * 180 / Math.PI);
13791 if (swipeAngle < 0) {
13792 swipeAngle = 360 - Math.abs(swipeAngle);
13793 }
13794
13795 if ((swipeAngle <= 45) && (swipeAngle >= 0)) {
13796 return (_.options.rtl === false ? 'left' : 'right');
13797 }
13798 if ((swipeAngle <= 360) && (swipeAngle >= 315)) {
13799 return (_.options.rtl === false ? 'left' : 'right');
13800 }
13801 if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
13802 return (_.options.rtl === false ? 'right' : 'left');
13803 }
13804 if (_.options.verticalSwiping === true) {
13805 if ((swipeAngle >= 35) && (swipeAngle <= 135)) {
13806 return 'down';
13807 } else {
13808 return 'up';
13809 }
13810 }
13811
13812 return 'vertical';
13813
13814 };
13815
13816 Slick.prototype.swipeEnd = function(event) {
13817
13818 var _ = this,
13819 slideCount,
13820 direction;
13821
13822 _.dragging = false;
13823 _.interrupted = false;
13824 _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true;
13825
13826 if ( _.touchObject.curX === undefined ) {
13827 return false;
13828 }
13829
13830 if ( _.touchObject.edgeHit === true ) {
13831 _.$slider.trigger('edge', [_, _.swipeDirection() ]);
13832 }
13833
13834 if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) {
13835
13836 direction = _.swipeDirection();
13837
13838 switch ( direction ) {
13839
13840 case 'left':
13841 case 'down':
13842
13843 slideCount =
13844 _.options.swipeToSlide ?
13845 _.checkNavigable( _.currentSlide + _.getSlideCount() ) :
13846 _.currentSlide + _.getSlideCount();
13847
13848 _.currentDirection = 0;
13849
13850 break;
13851
13852 case 'right':
13853 case 'up':
13854
13855 slideCount =
13856 _.options.swipeToSlide ?
13857 _.checkNavigable( _.currentSlide - _.getSlideCount() ) :
13858 _.currentSlide - _.getSlideCount();
13859
13860 _.currentDirection = 1;
13861
13862 break;
13863
13864 default:
13865
13866
13867 }
13868
13869 if( direction != 'vertical' ) {
13870
13871 _.slideHandler( slideCount );
13872 _.touchObject = {};
13873 _.$slider.trigger('swipe', [_, direction ]);
13874
13875 }
13876
13877 } else {
13878
13879 if ( _.touchObject.startX !== _.touchObject.curX ) {
13880
13881 _.slideHandler( _.currentSlide );
13882 _.touchObject = {};
13883
13884 }
13885
13886 }
13887
13888 };
13889
13890 Slick.prototype.swipeHandler = function(event) {
13891
13892 var _ = this;
13893
13894 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) {
13895 return;
13896 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) {
13897 return;
13898 }
13899
13900 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ?
13901 event.originalEvent.touches.length : 1;
13902
13903 _.touchObject.minSwipe = _.listWidth / _.options
13904 .touchThreshold;
13905
13906 if (_.options.verticalSwiping === true) {
13907 _.touchObject.minSwipe = _.listHeight / _.options
13908 .touchThreshold;
13909 }
13910
13911 switch (event.data.action) {
13912
13913 case 'start':
13914 _.swipeStart(event);
13915 break;
13916
13917 case 'move':
13918 _.swipeMove(event);
13919 break;
13920
13921 case 'end':
13922 _.swipeEnd(event);
13923 break;
13924
13925 }
13926
13927 };
13928
13929 Slick.prototype.swipeMove = function(event) {
13930
13931 var _ = this,
13932 edgeWasHit = false,
13933 curLeft, swipeDirection, swipeLength, positionOffset, touches;
13934
13935 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null;
13936
13937 if (!_.dragging || touches && touches.length !== 1) {
13938 return false;
13939 }
13940
13941 curLeft = _.getLeft(_.currentSlide);
13942
13943 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX;
13944 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY;
13945
13946 _.touchObject.swipeLength = Math.round(Math.sqrt(
13947 Math.pow(_.touchObject.curX - _.touchObject.startX, 2)));
13948
13949 if (_.options.verticalSwiping === true) {
13950 _.touchObject.swipeLength = Math.round(Math.sqrt(
13951 Math.pow(_.touchObject.curY - _.touchObject.startY, 2)));
13952 }
13953
13954 swipeDirection = _.swipeDirection();
13955
13956 if (swipeDirection === 'vertical') {
13957 return;
13958 }
13959
13960 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) {
13961 event.preventDefault();
13962 }
13963
13964 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1);
13965 if (_.options.verticalSwiping === true) {
13966 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1;
13967 }
13968
13969
13970 swipeLength = _.touchObject.swipeLength;
13971
13972 _.touchObject.edgeHit = false;
13973
13974 if (_.options.infinite === false) {
13975 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) {
13976 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction;
13977 _.touchObject.edgeHit = true;
13978 }
13979 }
13980
13981 if (_.options.vertical === false) {
13982 _.swipeLeft = curLeft + swipeLength * positionOffset;
13983 } else {
13984 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset;
13985 }
13986 if (_.options.verticalSwiping === true) {
13987 _.swipeLeft = curLeft + swipeLength * positionOffset;
13988 }
13989
13990 if (_.options.fade === true || _.options.touchMove === false) {
13991 return false;
13992 }
13993
13994 if (_.animating === true) {
13995 _.swipeLeft = null;
13996 return false;
13997 }
13998
13999 _.setCSS(_.swipeLeft);
14000
14001 };
14002
14003 Slick.prototype.swipeStart = function(event) {
14004
14005 var _ = this,
14006 touches;
14007
14008 _.interrupted = true;
14009
14010 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) {
14011 _.touchObject = {};
14012 return false;
14013 }
14014
14015 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) {
14016 touches = event.originalEvent.touches[0];
14017 }
14018
14019 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX;
14020 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY;
14021
14022 _.dragging = true;
14023
14024 };
14025
14026 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() {
14027
14028 var _ = this;
14029
14030 if (_.$slidesCache !== null) {
14031
14032 _.unload();
14033
14034 _.$slideTrack.children(this.options.slide).detach();
14035
14036 _.$slidesCache.appendTo(_.$slideTrack);
14037
14038 _.reinit();
14039
14040 }
14041
14042 };
14043
14044 Slick.prototype.unload = function() {
14045
14046 var _ = this;
14047
14048 $('.slick-cloned', _.$slider).remove();
14049
14050 if (_.$dots) {
14051 _.$dots.remove();
14052 }
14053
14054 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) {
14055 _.$prevArrow.remove();
14056 }
14057
14058 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) {
14059 _.$nextArrow.remove();
14060 }
14061
14062 _.$slides
14063 .removeClass('slick-slide slick-active slick-visible slick-current')
14064 .attr('aria-hidden', 'true')
14065 .css('width', '');
14066
14067 };
14068
14069 Slick.prototype.unslick = function(fromBreakpoint) {
14070
14071 var _ = this;
14072 _.$slider.trigger('unslick', [_, fromBreakpoint]);
14073 _.destroy();
14074
14075 };
14076
14077 Slick.prototype.updateArrows = function() {
14078
14079 var _ = this,
14080 centerOffset;
14081
14082 centerOffset = Math.floor(_.options.slidesToShow / 2);
14083
14084 if ( _.options.arrows === true &&
14085 _.slideCount > _.options.slidesToShow &&
14086 !_.options.infinite ) {
14087
14088 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
14089 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
14090
14091 if (_.currentSlide === 0) {
14092
14093 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
14094 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
14095
14096 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) {
14097
14098 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
14099 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
14100
14101 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) {
14102
14103 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
14104 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
14105
14106 }
14107
14108 }
14109
14110 };
14111
14112 Slick.prototype.updateDots = function() {
14113
14114 var _ = this;
14115
14116 if (_.$dots !== null) {
14117
14118 _.$dots
14119 .find('li')
14120 .removeClass('slick-active')
14121 .attr('aria-hidden', 'true');
14122
14123 _.$dots
14124 .find('li')
14125 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll))
14126 .addClass('slick-active')
14127 .attr('aria-hidden', 'false');
14128
14129 }
14130
14131 };
14132
14133 Slick.prototype.visibility = function() {
14134
14135 var _ = this;
14136
14137 if ( _.options.autoplay ) {
14138
14139 if ( document[_.hidden] ) {
14140
14141 _.interrupted = true;
14142
14143 } else {
14144
14145 _.interrupted = false;
14146
14147 }
14148
14149 }
14150
14151 };
14152
14153 $.fn.slick = function() {
14154 var _ = this,
14155 opt = arguments[0],
14156 args = Array.prototype.slice.call(arguments, 1),
14157 l = _.length,
14158 i,
14159 ret;
14160 for (i = 0; i < l; i++) {
14161 if (typeof opt == 'object' || typeof opt == 'undefined')
14162 _[i].slick = new Slick(_[i], opt);
14163 else
14164 ret = _[i].slick[opt].apply(_[i].slick, args);
14165 if (typeof ret != 'undefined') return ret;
14166 }
14167 return _;
14168 };
14169
14170}));
14171
14172$(function() {
14173
14174 "use strict";
14175
14176 /**
14177 * Slick.js
14178 * Docs: https://github.com/kenwheeler/slick
14179 */
14180
14181 var reviews = $("#reviews_slider");
14182
14183 if(reviews.length) {
14184 reviews.slick({
14185 infinite: true,
14186 slidesToShow: 1,
14187 slidesToScroll: 1,
14188 autoplay: true,
14189 autoplaySpeed: 4000,
14190 dots: false
14191 });
14192 }
14193
14194});
14195(function() {
14196 var MutationObserver, Util, WeakMap, getComputedStyle, getComputedStyleRX,
14197 bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
14198 indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
14199
14200 Util = (function() {
14201 function Util() {}
14202
14203 Util.prototype.extend = function(custom, defaults) {
14204 var key, value;
14205 for (key in defaults) {
14206 value = defaults[key];
14207 if (custom[key] == null) {
14208 custom[key] = value;
14209 }
14210 }
14211 return custom;
14212 };
14213
14214 Util.prototype.isMobile = function(agent) {
14215 return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(agent);
14216 };
14217
14218 Util.prototype.createEvent = function(event, bubble, cancel, detail) {
14219 var customEvent;
14220 if (bubble == null) {
14221 bubble = false;
14222 }
14223 if (cancel == null) {
14224 cancel = false;
14225 }
14226 if (detail == null) {
14227 detail = null;
14228 }
14229 if (document.createEvent != null) {
14230 customEvent = document.createEvent('CustomEvent');
14231 customEvent.initCustomEvent(event, bubble, cancel, detail);
14232 } else if (document.createEventObject != null) {
14233 customEvent = document.createEventObject();
14234 customEvent.eventType = event;
14235 } else {
14236 customEvent.eventName = event;
14237 }
14238 return customEvent;
14239 };
14240
14241 Util.prototype.emitEvent = function(elem, event) {
14242 if (elem.dispatchEvent != null) {
14243 return elem.dispatchEvent(event);
14244 } else if (event in (elem != null)) {
14245 return elem[event]();
14246 } else if (("on" + event) in (elem != null)) {
14247 return elem["on" + event]();
14248 }
14249 };
14250
14251 Util.prototype.addEvent = function(elem, event, fn) {
14252 if (elem.addEventListener != null) {
14253 return elem.addEventListener(event, fn, false);
14254 } else if (elem.attachEvent != null) {
14255 return elem.attachEvent("on" + event, fn);
14256 } else {
14257 return elem[event] = fn;
14258 }
14259 };
14260
14261 Util.prototype.removeEvent = function(elem, event, fn) {
14262 if (elem.removeEventListener != null) {
14263 return elem.removeEventListener(event, fn, false);
14264 } else if (elem.detachEvent != null) {
14265 return elem.detachEvent("on" + event, fn);
14266 } else {
14267 return delete elem[event];
14268 }
14269 };
14270
14271 Util.prototype.innerHeight = function() {
14272 if ('innerHeight' in window) {
14273 return window.innerHeight;
14274 } else {
14275 return document.documentElement.clientHeight;
14276 }
14277 };
14278
14279 return Util;
14280
14281 })();
14282
14283 WeakMap = this.WeakMap || this.MozWeakMap || (WeakMap = (function() {
14284 function WeakMap() {
14285 this.keys = [];
14286 this.values = [];
14287 }
14288
14289 WeakMap.prototype.get = function(key) {
14290 var i, item, j, len, ref;
14291 ref = this.keys;
14292 for (i = j = 0, len = ref.length; j < len; i = ++j) {
14293 item = ref[i];
14294 if (item === key) {
14295 return this.values[i];
14296 }
14297 }
14298 };
14299
14300 WeakMap.prototype.set = function(key, value) {
14301 var i, item, j, len, ref;
14302 ref = this.keys;
14303 for (i = j = 0, len = ref.length; j < len; i = ++j) {
14304 item = ref[i];
14305 if (item === key) {
14306 this.values[i] = value;
14307 return;
14308 }
14309 }
14310 this.keys.push(key);
14311 return this.values.push(value);
14312 };
14313
14314 return WeakMap;
14315
14316 })());
14317
14318 MutationObserver = this.MutationObserver || this.WebkitMutationObserver || this.MozMutationObserver || (MutationObserver = (function() {
14319 function MutationObserver() {
14320 if (typeof console !== "undefined" && console !== null) {
14321 console.warn('MutationObserver is not supported by your browser.');
14322 }
14323 if (typeof console !== "undefined" && console !== null) {
14324 console.warn('WOW.js cannot detect dom mutations, please call .sync() after loading new content.');
14325 }
14326 }
14327
14328 MutationObserver.notSupported = true;
14329
14330 MutationObserver.prototype.observe = function() {};
14331
14332 return MutationObserver;
14333
14334 })());
14335
14336 getComputedStyle = this.getComputedStyle || function(el, pseudo) {
14337 this.getPropertyValue = function(prop) {
14338 var ref;
14339 if (prop === 'float') {
14340 prop = 'styleFloat';
14341 }
14342 if (getComputedStyleRX.test(prop)) {
14343 prop.replace(getComputedStyleRX, function(_, _char) {
14344 return _char.toUpperCase();
14345 });
14346 }
14347 return ((ref = el.currentStyle) != null ? ref[prop] : void 0) || null;
14348 };
14349 return this;
14350 };
14351
14352 getComputedStyleRX = /(\-([a-z]){1})/g;
14353
14354 this.WOW = (function() {
14355 WOW.prototype.defaults = {
14356 boxClass: 'wow',
14357 animateClass: 'animated',
14358 offset: 0,
14359 mobile: true,
14360 live: true,
14361 callback: null
14362 };
14363
14364 function WOW(options) {
14365 if (options == null) {
14366 options = {};
14367 }
14368 this.scrollCallback = bind(this.scrollCallback, this);
14369 this.scrollHandler = bind(this.scrollHandler, this);
14370 this.resetAnimation = bind(this.resetAnimation, this);
14371 this.start = bind(this.start, this);
14372 this.scrolled = true;
14373 this.config = this.util().extend(options, this.defaults);
14374 this.animationNameCache = new WeakMap();
14375 this.wowEvent = this.util().createEvent(this.config.boxClass);
14376 }
14377
14378 WOW.prototype.init = function() {
14379 var ref;
14380 this.element = window.document.documentElement;
14381 if ((ref = document.readyState) === "interactive" || ref === "complete") {
14382 this.start();
14383 } else {
14384 this.util().addEvent(document, 'DOMContentLoaded', this.start);
14385 }
14386 return this.finished = [];
14387 };
14388
14389 WOW.prototype.start = function() {
14390 var box, j, len, ref;
14391 this.stopped = false;
14392 this.boxes = (function() {
14393 var j, len, ref, results;
14394 ref = this.element.querySelectorAll("." + this.config.boxClass);
14395 results = [];
14396 for (j = 0, len = ref.length; j < len; j++) {
14397 box = ref[j];
14398 results.push(box);
14399 }
14400 return results;
14401 }).call(this);
14402 this.all = (function() {
14403 var j, len, ref, results;
14404 ref = this.boxes;
14405 results = [];
14406 for (j = 0, len = ref.length; j < len; j++) {
14407 box = ref[j];
14408 results.push(box);
14409 }
14410 return results;
14411 }).call(this);
14412 if (this.boxes.length) {
14413 if (this.disabled()) {
14414 this.resetStyle();
14415 } else {
14416 ref = this.boxes;
14417 for (j = 0, len = ref.length; j < len; j++) {
14418 box = ref[j];
14419 this.applyStyle(box, true);
14420 }
14421 }
14422 }
14423 if (!this.disabled()) {
14424 this.util().addEvent(window, 'scroll', this.scrollHandler);
14425 this.util().addEvent(window, 'resize', this.scrollHandler);
14426 this.interval = setInterval(this.scrollCallback, 50);
14427 }
14428 if (this.config.live) {
14429 return new MutationObserver((function(_this) {
14430 return function(records) {
14431 var k, len1, node, record, results;
14432 results = [];
14433 for (k = 0, len1 = records.length; k < len1; k++) {
14434 record = records[k];
14435 results.push((function() {
14436 var l, len2, ref1, results1;
14437 ref1 = record.addedNodes || [];
14438 results1 = [];
14439 for (l = 0, len2 = ref1.length; l < len2; l++) {
14440 node = ref1[l];
14441 results1.push(this.doSync(node));
14442 }
14443 return results1;
14444 }).call(_this));
14445 }
14446 return results;
14447 };
14448 })(this)).observe(document.body, {
14449 childList: true,
14450 subtree: true
14451 });
14452 }
14453 };
14454
14455 WOW.prototype.stop = function() {
14456 this.stopped = true;
14457 this.util().removeEvent(window, 'scroll', this.scrollHandler);
14458 this.util().removeEvent(window, 'resize', this.scrollHandler);
14459 if (this.interval != null) {
14460 return clearInterval(this.interval);
14461 }
14462 };
14463
14464 WOW.prototype.sync = function(element) {
14465 if (MutationObserver.notSupported) {
14466 return this.doSync(this.element);
14467 }
14468 };
14469
14470 WOW.prototype.doSync = function(element) {
14471 var box, j, len, ref, results;
14472 if (element == null) {
14473 element = this.element;
14474 }
14475 if (element.nodeType !== 1) {
14476 return;
14477 }
14478 element = element.parentNode || element;
14479 ref = element.querySelectorAll("." + this.config.boxClass);
14480 results = [];
14481 for (j = 0, len = ref.length; j < len; j++) {
14482 box = ref[j];
14483 if (indexOf.call(this.all, box) < 0) {
14484 this.boxes.push(box);
14485 this.all.push(box);
14486 if (this.stopped || this.disabled()) {
14487 this.resetStyle();
14488 } else {
14489 this.applyStyle(box, true);
14490 }
14491 results.push(this.scrolled = true);
14492 } else {
14493 results.push(void 0);
14494 }
14495 }
14496 return results;
14497 };
14498
14499 WOW.prototype.show = function(box) {
14500 this.applyStyle(box);
14501 box.className = box.className + " " + this.config.animateClass;
14502 if (this.config.callback != null) {
14503 this.config.callback(box);
14504 }
14505 this.util().emitEvent(box, this.wowEvent);
14506 this.util().addEvent(box, 'animationend', this.resetAnimation);
14507 this.util().addEvent(box, 'oanimationend', this.resetAnimation);
14508 this.util().addEvent(box, 'webkitAnimationEnd', this.resetAnimation);
14509 this.util().addEvent(box, 'MSAnimationEnd', this.resetAnimation);
14510 return box;
14511 };
14512
14513 WOW.prototype.applyStyle = function(box, hidden) {
14514 var delay, duration, iteration;
14515 duration = box.getAttribute('data-wow-duration');
14516 delay = box.getAttribute('data-wow-delay');
14517 iteration = box.getAttribute('data-wow-iteration');
14518 return this.animate((function(_this) {
14519 return function() {
14520 return _this.customStyle(box, hidden, duration, delay, iteration);
14521 };
14522 })(this));
14523 };
14524
14525 WOW.prototype.animate = (function() {
14526 if ('requestAnimationFrame' in window) {
14527 return function(callback) {
14528 return window.requestAnimationFrame(callback);
14529 };
14530 } else {
14531 return function(callback) {
14532 return callback();
14533 };
14534 }
14535 })();
14536
14537 WOW.prototype.resetStyle = function() {
14538 var box, j, len, ref, results;
14539 ref = this.boxes;
14540 results = [];
14541 for (j = 0, len = ref.length; j < len; j++) {
14542 box = ref[j];
14543 results.push(box.style.visibility = 'visible');
14544 }
14545 return results;
14546 };
14547
14548 WOW.prototype.resetAnimation = function(event) {
14549 var target;
14550 if (event.type.toLowerCase().indexOf('animationend') >= 0) {
14551 target = event.target || event.srcElement;
14552 return target.className = target.className.replace(this.config.animateClass, '').trim();
14553 }
14554 };
14555
14556 WOW.prototype.customStyle = function(box, hidden, duration, delay, iteration) {
14557 if (hidden) {
14558 this.cacheAnimationName(box);
14559 }
14560 box.style.visibility = hidden ? 'hidden' : 'visible';
14561 if (duration) {
14562 this.vendorSet(box.style, {
14563 animationDuration: duration
14564 });
14565 }
14566 if (delay) {
14567 this.vendorSet(box.style, {
14568 animationDelay: delay
14569 });
14570 }
14571 if (iteration) {
14572 this.vendorSet(box.style, {
14573 animationIterationCount: iteration
14574 });
14575 }
14576 this.vendorSet(box.style, {
14577 animationName: hidden ? 'none' : this.cachedAnimationName(box)
14578 });
14579 return box;
14580 };
14581
14582 WOW.prototype.vendors = ["moz", "webkit"];
14583
14584 WOW.prototype.vendorSet = function(elem, properties) {
14585 var name, results, value, vendor;
14586 results = [];
14587 for (name in properties) {
14588 value = properties[name];
14589 elem["" + name] = value;
14590 results.push((function() {
14591 var j, len, ref, results1;
14592 ref = this.vendors;
14593 results1 = [];
14594 for (j = 0, len = ref.length; j < len; j++) {
14595 vendor = ref[j];
14596 results1.push(elem["" + vendor + (name.charAt(0).toUpperCase()) + (name.substr(1))] = value);
14597 }
14598 return results1;
14599 }).call(this));
14600 }
14601 return results;
14602 };
14603
14604 WOW.prototype.vendorCSS = function(elem, property) {
14605 var j, len, ref, result, style, vendor;
14606 style = getComputedStyle(elem);
14607 result = style.getPropertyCSSValue(property);
14608 ref = this.vendors;
14609 for (j = 0, len = ref.length; j < len; j++) {
14610 vendor = ref[j];
14611 result = result || style.getPropertyCSSValue("-" + vendor + "-" + property);
14612 }
14613 return result;
14614 };
14615
14616 WOW.prototype.animationName = function(box) {
14617 var animationName;
14618 try {
14619 animationName = this.vendorCSS(box, 'animation-name').cssText;
14620 } catch (_error) {
14621 animationName = getComputedStyle(box).getPropertyValue('animation-name');
14622 }
14623 if (animationName === 'none') {
14624 return '';
14625 } else {
14626 return animationName;
14627 }
14628 };
14629
14630 WOW.prototype.cacheAnimationName = function(box) {
14631 return this.animationNameCache.set(box, this.animationName(box));
14632 };
14633
14634 WOW.prototype.cachedAnimationName = function(box) {
14635 return this.animationNameCache.get(box);
14636 };
14637
14638 WOW.prototype.scrollHandler = function() {
14639 return this.scrolled = true;
14640 };
14641
14642 WOW.prototype.scrollCallback = function() {
14643 var box;
14644 if (this.scrolled) {
14645 this.scrolled = false;
14646 this.boxes = (function() {
14647 var j, len, ref, results;
14648 ref = this.boxes;
14649 results = [];
14650 for (j = 0, len = ref.length; j < len; j++) {
14651 box = ref[j];
14652 if (!(box)) {
14653 continue;
14654 }
14655 if (this.isVisible(box)) {
14656 this.show(box);
14657 continue;
14658 }
14659 results.push(box);
14660 }
14661 return results;
14662 }).call(this);
14663 if (!(this.boxes.length || this.config.live)) {
14664 return this.stop();
14665 }
14666 }
14667 };
14668
14669 WOW.prototype.offsetTop = function(element) {
14670 var top;
14671 while (element.offsetTop === void 0) {
14672 element = element.parentNode;
14673 }
14674 top = element.offsetTop;
14675 while (element = element.offsetParent) {
14676 top += element.offsetTop;
14677 }
14678 return top;
14679 };
14680
14681 WOW.prototype.isVisible = function(box) {
14682 var bottom, offset, top, viewBottom, viewTop;
14683 offset = box.getAttribute('data-wow-offset') || this.config.offset;
14684 viewTop = window.pageYOffset;
14685 viewBottom = viewTop + Math.min(this.element.clientHeight, this.util().innerHeight()) - offset;
14686 top = this.offsetTop(box);
14687 bottom = top + box.clientHeight;
14688 return top <= viewBottom && bottom >= viewTop;
14689 };
14690
14691 WOW.prototype.util = function() {
14692 return this._util != null ? this._util : this._util = new Util();
14693 };
14694
14695 WOW.prototype.disabled = function() {
14696 return !this.config.mobile && this.util().isMobile(navigator.userAgent);
14697 };
14698
14699 return WOW;
14700
14701 })();
14702
14703}).call(this);
14704
14705$(function() {
14706
14707 "use strict";
14708
14709 /**
14710 * Wow.js
14711 * Docs: https://github.com/matthieua/WOW
14712 */
14713
14714 var wow = new WOW({
14715 offset: 100, // distance to the element when triggering the animation (default is 0)
14716 mobile: false // trigger animations on mobile devices (default is true)
14717 });
14718 wow.init();
14719
14720});
14721$(function() {
14722
14723 "use strict";
14724
14725 $(".alert__button").on("click", function(e) {
14726 e.preventDefault();
14727
14728 var $this = $(this),
14729 alert = $this.parents(".alert");
14730
14731 /**
14732 * Remove alert from DOM
14733 */
14734 alert.fadeOut("fast", function(){
14735 $(this).remove();
14736 });
14737 });
14738
14739});
14740$(function() {
14741
14742 "use strict";
14743
14744 var nav = $("#nav");
14745
14746 $("#burger").on("click", function() {
14747 nav.slideToggle();
14748 });
14749
14750 $("#burger").on("click", function(event) {
14751 event.stopPropagation();
14752 });
14753
14754 $("body").on("click", function() {
14755 var docWidth = $(document).width() + 15;
14756
14757 if(docWidth < 992) {
14758 nav.slideUp();
14759 }
14760 });
14761
14762 $(window).on("resize", function() {
14763 nav.removeAttr("style");
14764 });
14765
14766});
14767
14768 /* For the sticky navigation */
14769 $('.js--section-intro').waypoint(function(direction) {
14770 if (direction == "down") {
14771 $('nav').addClass('sticky');
14772 } else {
14773 $('nav').removeClass('sticky');
14774 }
14775 }, {
14776 offset: '60px;'
14777});