Fix the PV check.
[remoteglot] / www / js / jquery-deprecated-sizzle.js
1 /*!
2  * jQuery JavaScript Library v2.1.1 -deprecated,-css/hiddenVisibleSelectors,-effects/animatedSelector
3  * http://jquery.com/
4  *
5  * Includes Sizzle.js
6  * http://sizzlejs.com/
7  *
8  * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
9  * Released under the MIT license
10  * http://jquery.org/license
11  *
12  * Date: 2014-09-28T02:59Z
13  */
14
15 (function( global, factory ) {
16
17         if ( typeof module === "object" && typeof module.exports === "object" ) {
18                 // For CommonJS and CommonJS-like environments where a proper window is present,
19                 // execute the factory and get jQuery
20                 // For environments that do not inherently posses a window with a document
21                 // (such as Node.js), expose a jQuery-making factory as module.exports
22                 // This accentuates the need for the creation of a real window
23                 // e.g. var jQuery = require("jquery")(window);
24                 // See ticket #14549 for more info
25                 module.exports = global.document ?
26                         factory( global, true ) :
27                         function( w ) {
28                                 if ( !w.document ) {
29                                         throw new Error( "jQuery requires a window with a document" );
30                                 }
31                                 return factory( w );
32                         };
33         } else {
34                 factory( global );
35         }
36
37 // Pass this if window is not defined yet
38 }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
39
40 // Can't do this because several apps including ASP.NET trace
41 // the stack via arguments.caller.callee and Firefox dies if
42 // you try to trace through "use strict" call chains. (#13335)
43 // Support: Firefox 18+
44 //
45
46 var arr = [];
47
48 var slice = arr.slice;
49
50 var concat = arr.concat;
51
52 var push = arr.push;
53
54 var indexOf = arr.indexOf;
55
56 var class2type = {};
57
58 var toString = class2type.toString;
59
60 var hasOwn = class2type.hasOwnProperty;
61
62 var support = {};
63
64
65
66 var
67         // Use the correct document accordingly with window argument (sandbox)
68         document = window.document,
69
70         version = "2.1.1 -deprecated,-css/hiddenVisibleSelectors,-effects/animatedSelector",
71
72         // Define a local copy of jQuery
73         jQuery = function( selector, context ) {
74                 // The jQuery object is actually just the init constructor 'enhanced'
75                 // Need init if jQuery is called (just allow error to be thrown if not included)
76                 return new jQuery.fn.init( selector, context );
77         },
78
79         // Support: Android<4.1
80         // Make sure we trim BOM and NBSP
81         rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
82
83         // Matches dashed string for camelizing
84         rmsPrefix = /^-ms-/,
85         rdashAlpha = /-([\da-z])/gi,
86
87         // Used by jQuery.camelCase as callback to replace()
88         fcamelCase = function( all, letter ) {
89                 return letter.toUpperCase();
90         };
91
92 jQuery.fn = jQuery.prototype = {
93         // The current version of jQuery being used
94         jquery: version,
95
96         constructor: jQuery,
97
98         // Start with an empty selector
99         selector: "",
100
101         // The default length of a jQuery object is 0
102         length: 0,
103
104         toArray: function() {
105                 return slice.call( this );
106         },
107
108         // Get the Nth element in the matched element set OR
109         // Get the whole matched element set as a clean array
110         get: function( num ) {
111                 return num != null ?
112
113                         // Return just the one element from the set
114                         ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
115
116                         // Return all the elements in a clean array
117                         slice.call( this );
118         },
119
120         // Take an array of elements and push it onto the stack
121         // (returning the new matched element set)
122         pushStack: function( elems ) {
123
124                 // Build a new jQuery matched element set
125                 var ret = jQuery.merge( this.constructor(), elems );
126
127                 // Add the old object onto the stack (as a reference)
128                 ret.prevObject = this;
129                 ret.context = this.context;
130
131                 // Return the newly-formed element set
132                 return ret;
133         },
134
135         // Execute a callback for every element in the matched set.
136         // (You can seed the arguments with an array of args, but this is
137         // only used internally.)
138         each: function( callback, args ) {
139                 return jQuery.each( this, callback, args );
140         },
141
142         map: function( callback ) {
143                 return this.pushStack( jQuery.map(this, function( elem, i ) {
144                         return callback.call( elem, i, elem );
145                 }));
146         },
147
148         slice: function() {
149                 return this.pushStack( slice.apply( this, arguments ) );
150         },
151
152         first: function() {
153                 return this.eq( 0 );
154         },
155
156         last: function() {
157                 return this.eq( -1 );
158         },
159
160         eq: function( i ) {
161                 var len = this.length,
162                         j = +i + ( i < 0 ? len : 0 );
163                 return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
164         },
165
166         end: function() {
167                 return this.prevObject || this.constructor(null);
168         },
169
170         // For internal use only.
171         // Behaves like an Array's method, not like a jQuery method.
172         push: push,
173         sort: arr.sort,
174         splice: arr.splice
175 };
176
177 jQuery.extend = jQuery.fn.extend = function() {
178         var options, name, src, copy, copyIsArray, clone,
179                 target = arguments[0] || {},
180                 i = 1,
181                 length = arguments.length,
182                 deep = false;
183
184         // Handle a deep copy situation
185         if ( typeof target === "boolean" ) {
186                 deep = target;
187
188                 // skip the boolean and the target
189                 target = arguments[ i ] || {};
190                 i++;
191         }
192
193         // Handle case when target is a string or something (possible in deep copy)
194         if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
195                 target = {};
196         }
197
198         // extend jQuery itself if only one argument is passed
199         if ( i === length ) {
200                 target = this;
201                 i--;
202         }
203
204         for ( ; i < length; i++ ) {
205                 // Only deal with non-null/undefined values
206                 if ( (options = arguments[ i ]) != null ) {
207                         // Extend the base object
208                         for ( name in options ) {
209                                 src = target[ name ];
210                                 copy = options[ name ];
211
212                                 // Prevent never-ending loop
213                                 if ( target === copy ) {
214                                         continue;
215                                 }
216
217                                 // Recurse if we're merging plain objects or arrays
218                                 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
219                                         if ( copyIsArray ) {
220                                                 copyIsArray = false;
221                                                 clone = src && jQuery.isArray(src) ? src : [];
222
223                                         } else {
224                                                 clone = src && jQuery.isPlainObject(src) ? src : {};
225                                         }
226
227                                         // Never move original objects, clone them
228                                         target[ name ] = jQuery.extend( deep, clone, copy );
229
230                                 // Don't bring in undefined values
231                                 } else if ( copy !== undefined ) {
232                                         target[ name ] = copy;
233                                 }
234                         }
235                 }
236         }
237
238         // Return the modified object
239         return target;
240 };
241
242 jQuery.extend({
243         // Unique for each copy of jQuery on the page
244         expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
245
246         // Assume jQuery is ready without the ready module
247         isReady: true,
248
249         error: function( msg ) {
250                 throw new Error( msg );
251         },
252
253         noop: function() {},
254
255         // See test/unit/core.js for details concerning isFunction.
256         // Since version 1.3, DOM methods and functions like alert
257         // aren't supported. They return false on IE (#2968).
258         isFunction: function( obj ) {
259                 return jQuery.type(obj) === "function";
260         },
261
262         isArray: Array.isArray,
263
264         isWindow: function( obj ) {
265                 return obj != null && obj === obj.window;
266         },
267
268         isNumeric: function( obj ) {
269                 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
270                 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
271                 // subtraction forces infinities to NaN
272                 return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0;
273         },
274
275         isPlainObject: function( obj ) {
276                 // Not plain objects:
277                 // - Any object or value whose internal [[Class]] property is not "[object Object]"
278                 // - DOM nodes
279                 // - window
280                 if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
281                         return false;
282                 }
283
284                 if ( obj.constructor &&
285                                 !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
286                         return false;
287                 }
288
289                 // If the function hasn't returned already, we're confident that
290                 // |obj| is a plain object, created by {} or constructed with new Object
291                 return true;
292         },
293
294         isEmptyObject: function( obj ) {
295                 var name;
296                 for ( name in obj ) {
297                         return false;
298                 }
299                 return true;
300         },
301
302         type: function( obj ) {
303                 if ( obj == null ) {
304                         return obj + "";
305                 }
306                 // Support: Android < 4.0, iOS < 6 (functionish RegExp)
307                 return typeof obj === "object" || typeof obj === "function" ?
308                         class2type[ toString.call(obj) ] || "object" :
309                         typeof obj;
310         },
311
312         // Evaluates a script in a global context
313         globalEval: function( code ) {
314                 var script,
315                         indirect = eval;
316
317                 code = jQuery.trim( code );
318
319                 if ( code ) {
320                         // If the code includes a valid, prologue position
321                         // strict mode pragma, execute code by injecting a
322                         // script tag into the document.
323                         if ( code.indexOf("use strict") === 1 ) {
324                                 script = document.createElement("script");
325                                 script.text = code;
326                                 document.head.appendChild( script ).parentNode.removeChild( script );
327                         } else {
328                         // Otherwise, avoid the DOM node creation, insertion
329                         // and removal by using an indirect global eval
330                                 indirect( code );
331                         }
332                 }
333         },
334
335         // Convert dashed to camelCase; used by the css and data modules
336         // Microsoft forgot to hump their vendor prefix (#9572)
337         camelCase: function( string ) {
338                 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
339         },
340
341         nodeName: function( elem, name ) {
342                 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
343         },
344
345         // args is for internal usage only
346         each: function( obj, callback, args ) {
347                 var value,
348                         i = 0,
349                         length = obj.length,
350                         isArray = isArraylike( obj );
351
352                 if ( args ) {
353                         if ( isArray ) {
354                                 for ( ; i < length; i++ ) {
355                                         value = callback.apply( obj[ i ], args );
356
357                                         if ( value === false ) {
358                                                 break;
359                                         }
360                                 }
361                         } else {
362                                 for ( i in obj ) {
363                                         value = callback.apply( obj[ i ], args );
364
365                                         if ( value === false ) {
366                                                 break;
367                                         }
368                                 }
369                         }
370
371                 // A special, fast, case for the most common use of each
372                 } else {
373                         if ( isArray ) {
374                                 for ( ; i < length; i++ ) {
375                                         value = callback.call( obj[ i ], i, obj[ i ] );
376
377                                         if ( value === false ) {
378                                                 break;
379                                         }
380                                 }
381                         } else {
382                                 for ( i in obj ) {
383                                         value = callback.call( obj[ i ], i, obj[ i ] );
384
385                                         if ( value === false ) {
386                                                 break;
387                                         }
388                                 }
389                         }
390                 }
391
392                 return obj;
393         },
394
395         // Support: Android<4.1
396         trim: function( text ) {
397                 return text == null ?
398                         "" :
399                         ( text + "" ).replace( rtrim, "" );
400         },
401
402         // results is for internal usage only
403         makeArray: function( arr, results ) {
404                 var ret = results || [];
405
406                 if ( arr != null ) {
407                         if ( isArraylike( Object(arr) ) ) {
408                                 jQuery.merge( ret,
409                                         typeof arr === "string" ?
410                                         [ arr ] : arr
411                                 );
412                         } else {
413                                 push.call( ret, arr );
414                         }
415                 }
416
417                 return ret;
418         },
419
420         inArray: function( elem, arr, i ) {
421                 return arr == null ? -1 : indexOf.call( arr, elem, i );
422         },
423
424         merge: function( first, second ) {
425                 var len = +second.length,
426                         j = 0,
427                         i = first.length;
428
429                 for ( ; j < len; j++ ) {
430                         first[ i++ ] = second[ j ];
431                 }
432
433                 first.length = i;
434
435                 return first;
436         },
437
438         grep: function( elems, callback, invert ) {
439                 var callbackInverse,
440                         matches = [],
441                         i = 0,
442                         length = elems.length,
443                         callbackExpect = !invert;
444
445                 // Go through the array, only saving the items
446                 // that pass the validator function
447                 for ( ; i < length; i++ ) {
448                         callbackInverse = !callback( elems[ i ], i );
449                         if ( callbackInverse !== callbackExpect ) {
450                                 matches.push( elems[ i ] );
451                         }
452                 }
453
454                 return matches;
455         },
456
457         // arg is for internal usage only
458         map: function( elems, callback, arg ) {
459                 var value,
460                         i = 0,
461                         length = elems.length,
462                         isArray = isArraylike( elems ),
463                         ret = [];
464
465                 // Go through the array, translating each of the items to their new values
466                 if ( isArray ) {
467                         for ( ; i < length; i++ ) {
468                                 value = callback( elems[ i ], i, arg );
469
470                                 if ( value != null ) {
471                                         ret.push( value );
472                                 }
473                         }
474
475                 // Go through every key on the object,
476                 } else {
477                         for ( i in elems ) {
478                                 value = callback( elems[ i ], i, arg );
479
480                                 if ( value != null ) {
481                                         ret.push( value );
482                                 }
483                         }
484                 }
485
486                 // Flatten any nested arrays
487                 return concat.apply( [], ret );
488         },
489
490         // A global GUID counter for objects
491         guid: 1,
492
493         // Bind a function to a context, optionally partially applying any
494         // arguments.
495         proxy: function( fn, context ) {
496                 var tmp, args, proxy;
497
498                 if ( typeof context === "string" ) {
499                         tmp = fn[ context ];
500                         context = fn;
501                         fn = tmp;
502                 }
503
504                 // Quick check to determine if target is callable, in the spec
505                 // this throws a TypeError, but we will just return undefined.
506                 if ( !jQuery.isFunction( fn ) ) {
507                         return undefined;
508                 }
509
510                 // Simulated bind
511                 args = slice.call( arguments, 2 );
512                 proxy = function() {
513                         return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
514                 };
515
516                 // Set the guid of unique handler to the same of original handler, so it can be removed
517                 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
518
519                 return proxy;
520         },
521
522         now: Date.now,
523
524         // jQuery.support is not used in Core but other projects attach their
525         // properties to it so it needs to exist.
526         support: support
527 });
528
529 // Populate the class2type map
530 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
531         class2type[ "[object " + name + "]" ] = name.toLowerCase();
532 });
533
534 function isArraylike( obj ) {
535         var length = obj.length,
536                 type = jQuery.type( obj );
537
538         if ( type === "function" || jQuery.isWindow( obj ) ) {
539                 return false;
540         }
541
542         if ( obj.nodeType === 1 && length ) {
543                 return true;
544         }
545
546         return type === "array" || length === 0 ||
547                 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
548 }
549
550
551 /*
552  * Optional (non-Sizzle) selector module for custom builds.
553  *
554  * Note that this DOES NOT SUPPORT many documented jQuery
555  * features in exchange for its smaller size:
556  *
557  * Attribute not equal selector
558  * Positional selectors (:first; :eq(n); :odd; etc.)
559  * Type selectors (:input; :checkbox; :button; etc.)
560  * State-based selectors (:animated; :visible; :hidden; etc.)
561  * :has(selector)
562  * :not(complex selector)
563  * custom selectors via Sizzle extensions
564  * Leading combinators (e.g., $collection.find("> *"))
565  * Reliable functionality on XML fragments
566  * Requiring all parts of a selector to match elements under context
567  *   (e.g., $div.find("div > *") now matches children of $div)
568  * Matching against non-elements
569  * Reliable sorting of disconnected nodes
570  * querySelectorAll bug fixes (e.g., unreliable :focus on WebKit)
571  *
572  * If any of these are unacceptable tradeoffs, either use Sizzle or
573  * customize this stub for the project's specific needs.
574  */
575
576 var docElem = window.document.documentElement,
577         selector_hasDuplicate,
578         matches = docElem.matches ||
579                 docElem.webkitMatchesSelector ||
580                 docElem.mozMatchesSelector ||
581                 docElem.oMatchesSelector ||
582                 docElem.msMatchesSelector,
583         selector_sortOrder = function( a, b ) {
584                 // Flag for duplicate removal
585                 if ( a === b ) {
586                         selector_hasDuplicate = true;
587                         return 0;
588                 }
589
590                 var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b );
591
592                 if ( compare ) {
593                         // Disconnected nodes
594                         if ( compare & 1 ) {
595
596                                 // Choose the first element that is related to our document
597                                 if ( a === document || jQuery.contains(document, a) ) {
598                                         return -1;
599                                 }
600                                 if ( b === document || jQuery.contains(document, b) ) {
601                                         return 1;
602                                 }
603
604                                 // Maintain original order
605                                 return 0;
606                         }
607
608                         return compare & 4 ? -1 : 1;
609                 }
610
611                 // Not directly comparable, sort on existence of method
612                 return a.compareDocumentPosition ? -1 : 1;
613         };
614
615 jQuery.extend({
616         find: function( selector, context, results, seed ) {
617                 var elem, nodeType,
618                         i = 0;
619
620                 results = results || [];
621                 context = context || document;
622
623                 // Same basic safeguard as Sizzle
624                 if ( !selector || typeof selector !== "string" ) {
625                         return results;
626                 }
627
628                 // Early return if context is not an element or document
629                 if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
630                         return [];
631                 }
632
633                 if ( seed ) {
634                         while ( (elem = seed[i++]) ) {
635                                 if ( jQuery.find.matchesSelector(elem, selector) ) {
636                                         results.push( elem );
637                                 }
638                         }
639                 } else {
640                         jQuery.merge( results, context.querySelectorAll(selector) );
641                 }
642
643                 return results;
644         },
645         unique: function( results ) {
646                 var elem,
647                         duplicates = [],
648                         i = 0,
649                         j = 0;
650
651                 selector_hasDuplicate = false;
652                 results.sort( selector_sortOrder );
653
654                 if ( selector_hasDuplicate ) {
655                         while ( (elem = results[i++]) ) {
656                                 if ( elem === results[ i ] ) {
657                                         j = duplicates.push( i );
658                                 }
659                         }
660                         while ( j-- ) {
661                                 results.splice( duplicates[ j ], 1 );
662                         }
663                 }
664
665                 return results;
666         },
667         text: function( elem ) {
668                 var node,
669                         ret = "",
670                         i = 0,
671                         nodeType = elem.nodeType;
672
673                 if ( !nodeType ) {
674                         // If no nodeType, this is expected to be an array
675                         while ( (node = elem[i++]) ) {
676                                 // Do not traverse comment nodes
677                                 ret += jQuery.text( node );
678                         }
679                 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
680                         // Use textContent for elements
681                         return elem.textContent;
682                 } else if ( nodeType === 3 || nodeType === 4 ) {
683                         return elem.nodeValue;
684                 }
685                 // Do not include comment or processing instruction nodes
686
687                 return ret;
688         },
689         contains: function( a, b ) {
690                 var adown = a.nodeType === 9 ? a.documentElement : a,
691                         bup = b && b.parentNode;
692                 return a === bup || !!( bup && bup.nodeType === 1 && adown.contains(bup) );
693         },
694         isXMLDoc: function( elem ) {
695                 return (elem.ownerDocument || elem).documentElement.nodeName !== "HTML";
696         },
697         expr: {
698                 attrHandle: {},
699                 match: {
700                         bool: /^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$/i,
701                         needsContext: /^[\x20\t\r\n\f]*[>+~]/
702                 }
703         }
704 });
705
706 jQuery.extend( jQuery.find, {
707         matches: function( expr, elements ) {
708                 return jQuery.find( expr, null, null, elements );
709         },
710         matchesSelector: function( elem, expr ) {
711                 return matches.call( elem, expr );
712         },
713         attr: function( elem, name ) {
714                 return elem.getAttribute( name );
715         }
716 });
717
718
719
720 var rneedsContext = jQuery.expr.match.needsContext;
721
722 var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
723
724
725
726 var risSimple = /^.[^:#\[\.,]*$/;
727
728 // Implement the identical functionality for filter and not
729 function winnow( elements, qualifier, not ) {
730         if ( jQuery.isFunction( qualifier ) ) {
731                 return jQuery.grep( elements, function( elem, i ) {
732                         /* jshint -W018 */
733                         return !!qualifier.call( elem, i, elem ) !== not;
734                 });
735
736         }
737
738         if ( qualifier.nodeType ) {
739                 return jQuery.grep( elements, function( elem ) {
740                         return ( elem === qualifier ) !== not;
741                 });
742
743         }
744
745         if ( typeof qualifier === "string" ) {
746                 if ( risSimple.test( qualifier ) ) {
747                         return jQuery.filter( qualifier, elements, not );
748                 }
749
750                 qualifier = jQuery.filter( qualifier, elements );
751         }
752
753         return jQuery.grep( elements, function( elem ) {
754                 return ( indexOf.call( qualifier, elem ) >= 0 ) !== not;
755         });
756 }
757
758 jQuery.filter = function( expr, elems, not ) {
759         var elem = elems[ 0 ];
760
761         if ( not ) {
762                 expr = ":not(" + expr + ")";
763         }
764
765         return elems.length === 1 && elem.nodeType === 1 ?
766                 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
767                 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
768                         return elem.nodeType === 1;
769                 }));
770 };
771
772 jQuery.fn.extend({
773         find: function( selector ) {
774                 var i,
775                         len = this.length,
776                         ret = [],
777                         self = this;
778
779                 if ( typeof selector !== "string" ) {
780                         return this.pushStack( jQuery( selector ).filter(function() {
781                                 for ( i = 0; i < len; i++ ) {
782                                         if ( jQuery.contains( self[ i ], this ) ) {
783                                                 return true;
784                                         }
785                                 }
786                         }) );
787                 }
788
789                 for ( i = 0; i < len; i++ ) {
790                         jQuery.find( selector, self[ i ], ret );
791                 }
792
793                 // Needed because $( selector, context ) becomes $( context ).find( selector )
794                 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
795                 ret.selector = this.selector ? this.selector + " " + selector : selector;
796                 return ret;
797         },
798         filter: function( selector ) {
799                 return this.pushStack( winnow(this, selector || [], false) );
800         },
801         not: function( selector ) {
802                 return this.pushStack( winnow(this, selector || [], true) );
803         },
804         is: function( selector ) {
805                 return !!winnow(
806                         this,
807
808                         // If this is a positional/relative selector, check membership in the returned set
809                         // so $("p:first").is("p:last") won't return true for a doc with two "p".
810                         typeof selector === "string" && rneedsContext.test( selector ) ?
811                                 jQuery( selector ) :
812                                 selector || [],
813                         false
814                 ).length;
815         }
816 });
817
818
819 // Initialize a jQuery object
820
821
822 // A central reference to the root jQuery(document)
823 var rootjQuery,
824
825         // A simple way to check for HTML strings
826         // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
827         // Strict HTML recognition (#11290: must start with <)
828         rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
829
830         init = jQuery.fn.init = function( selector, context ) {
831                 var match, elem;
832
833                 // HANDLE: $(""), $(null), $(undefined), $(false)
834                 if ( !selector ) {
835                         return this;
836                 }
837
838                 // Handle HTML strings
839                 if ( typeof selector === "string" ) {
840                         if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) {
841                                 // Assume that strings that start and end with <> are HTML and skip the regex check
842                                 match = [ null, selector, null ];
843
844                         } else {
845                                 match = rquickExpr.exec( selector );
846                         }
847
848                         // Match html or make sure no context is specified for #id
849                         if ( match && (match[1] || !context) ) {
850
851                                 // HANDLE: $(html) -> $(array)
852                                 if ( match[1] ) {
853                                         context = context instanceof jQuery ? context[0] : context;
854
855                                         // scripts is true for back-compat
856                                         // Intentionally let the error be thrown if parseHTML is not present
857                                         jQuery.merge( this, jQuery.parseHTML(
858                                                 match[1],
859                                                 context && context.nodeType ? context.ownerDocument || context : document,
860                                                 true
861                                         ) );
862
863                                         // HANDLE: $(html, props)
864                                         if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
865                                                 for ( match in context ) {
866                                                         // Properties of context are called as methods if possible
867                                                         if ( jQuery.isFunction( this[ match ] ) ) {
868                                                                 this[ match ]( context[ match ] );
869
870                                                         // ...and otherwise set as attributes
871                                                         } else {
872                                                                 this.attr( match, context[ match ] );
873                                                         }
874                                                 }
875                                         }
876
877                                         return this;
878
879                                 // HANDLE: $(#id)
880                                 } else {
881                                         elem = document.getElementById( match[2] );
882
883                                         // Check parentNode to catch when Blackberry 4.6 returns
884                                         // nodes that are no longer in the document #6963
885                                         if ( elem && elem.parentNode ) {
886                                                 // Inject the element directly into the jQuery object
887                                                 this.length = 1;
888                                                 this[0] = elem;
889                                         }
890
891                                         this.context = document;
892                                         this.selector = selector;
893                                         return this;
894                                 }
895
896                         // HANDLE: $(expr, $(...))
897                         } else if ( !context || context.jquery ) {
898                                 return ( context || rootjQuery ).find( selector );
899
900                         // HANDLE: $(expr, context)
901                         // (which is just equivalent to: $(context).find(expr)
902                         } else {
903                                 return this.constructor( context ).find( selector );
904                         }
905
906                 // HANDLE: $(DOMElement)
907                 } else if ( selector.nodeType ) {
908                         this.context = this[0] = selector;
909                         this.length = 1;
910                         return this;
911
912                 // HANDLE: $(function)
913                 // Shortcut for document ready
914                 } else if ( jQuery.isFunction( selector ) ) {
915                         return typeof rootjQuery.ready !== "undefined" ?
916                                 rootjQuery.ready( selector ) :
917                                 // Execute immediately if ready is not present
918                                 selector( jQuery );
919                 }
920
921                 if ( selector.selector !== undefined ) {
922                         this.selector = selector.selector;
923                         this.context = selector.context;
924                 }
925
926                 return jQuery.makeArray( selector, this );
927         };
928
929 // Give the init function the jQuery prototype for later instantiation
930 init.prototype = jQuery.fn;
931
932 // Initialize central reference
933 rootjQuery = jQuery( document );
934
935
936 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
937         // methods guaranteed to produce a unique set when starting from a unique set
938         guaranteedUnique = {
939                 children: true,
940                 contents: true,
941                 next: true,
942                 prev: true
943         };
944
945 jQuery.extend({
946         dir: function( elem, dir, until ) {
947                 var matched = [],
948                         truncate = until !== undefined;
949
950                 while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
951                         if ( elem.nodeType === 1 ) {
952                                 if ( truncate && jQuery( elem ).is( until ) ) {
953                                         break;
954                                 }
955                                 matched.push( elem );
956                         }
957                 }
958                 return matched;
959         },
960
961         sibling: function( n, elem ) {
962                 var matched = [];
963
964                 for ( ; n; n = n.nextSibling ) {
965                         if ( n.nodeType === 1 && n !== elem ) {
966                                 matched.push( n );
967                         }
968                 }
969
970                 return matched;
971         }
972 });
973
974 jQuery.fn.extend({
975         has: function( target ) {
976                 var targets = jQuery( target, this ),
977                         l = targets.length;
978
979                 return this.filter(function() {
980                         var i = 0;
981                         for ( ; i < l; i++ ) {
982                                 if ( jQuery.contains( this, targets[i] ) ) {
983                                         return true;
984                                 }
985                         }
986                 });
987         },
988
989         closest: function( selectors, context ) {
990                 var cur,
991                         i = 0,
992                         l = this.length,
993                         matched = [],
994                         pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
995                                 jQuery( selectors, context || this.context ) :
996                                 0;
997
998                 for ( ; i < l; i++ ) {
999                         for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
1000                                 // Always skip document fragments
1001                                 if ( cur.nodeType < 11 && (pos ?
1002                                         pos.index(cur) > -1 :
1003
1004                                         // Don't pass non-elements to Sizzle
1005                                         cur.nodeType === 1 &&
1006                                                 jQuery.find.matchesSelector(cur, selectors)) ) {
1007
1008                                         matched.push( cur );
1009                                         break;
1010                                 }
1011                         }
1012                 }
1013
1014                 return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
1015         },
1016
1017         // Determine the position of an element within
1018         // the matched set of elements
1019         index: function( elem ) {
1020
1021                 // No argument, return index in parent
1022                 if ( !elem ) {
1023                         return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
1024                 }
1025
1026                 // index in selector
1027                 if ( typeof elem === "string" ) {
1028                         return indexOf.call( jQuery( elem ), this[ 0 ] );
1029                 }
1030
1031                 // Locate the position of the desired element
1032                 return indexOf.call( this,
1033
1034                         // If it receives a jQuery object, the first element is used
1035                         elem.jquery ? elem[ 0 ] : elem
1036                 );
1037         },
1038
1039         add: function( selector, context ) {
1040                 return this.pushStack(
1041                         jQuery.unique(
1042                                 jQuery.merge( this.get(), jQuery( selector, context ) )
1043                         )
1044                 );
1045         },
1046
1047         addBack: function( selector ) {
1048                 return this.add( selector == null ?
1049                         this.prevObject : this.prevObject.filter(selector)
1050                 );
1051         }
1052 });
1053
1054 function sibling( cur, dir ) {
1055         while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
1056         return cur;
1057 }
1058
1059 jQuery.each({
1060         parent: function( elem ) {
1061                 var parent = elem.parentNode;
1062                 return parent && parent.nodeType !== 11 ? parent : null;
1063         },
1064         parents: function( elem ) {
1065                 return jQuery.dir( elem, "parentNode" );
1066         },
1067         parentsUntil: function( elem, i, until ) {
1068                 return jQuery.dir( elem, "parentNode", until );
1069         },
1070         next: function( elem ) {
1071                 return sibling( elem, "nextSibling" );
1072         },
1073         prev: function( elem ) {
1074                 return sibling( elem, "previousSibling" );
1075         },
1076         nextAll: function( elem ) {
1077                 return jQuery.dir( elem, "nextSibling" );
1078         },
1079         prevAll: function( elem ) {
1080                 return jQuery.dir( elem, "previousSibling" );
1081         },
1082         nextUntil: function( elem, i, until ) {
1083                 return jQuery.dir( elem, "nextSibling", until );
1084         },
1085         prevUntil: function( elem, i, until ) {
1086                 return jQuery.dir( elem, "previousSibling", until );
1087         },
1088         siblings: function( elem ) {
1089                 return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
1090         },
1091         children: function( elem ) {
1092                 return jQuery.sibling( elem.firstChild );
1093         },
1094         contents: function( elem ) {
1095                 return elem.contentDocument || jQuery.merge( [], elem.childNodes );
1096         }
1097 }, function( name, fn ) {
1098         jQuery.fn[ name ] = function( until, selector ) {
1099                 var matched = jQuery.map( this, fn, until );
1100
1101                 if ( name.slice( -5 ) !== "Until" ) {
1102                         selector = until;
1103                 }
1104
1105                 if ( selector && typeof selector === "string" ) {
1106                         matched = jQuery.filter( selector, matched );
1107                 }
1108
1109                 if ( this.length > 1 ) {
1110                         // Remove duplicates
1111                         if ( !guaranteedUnique[ name ] ) {
1112                                 jQuery.unique( matched );
1113                         }
1114
1115                         // Reverse order for parents* and prev-derivatives
1116                         if ( rparentsprev.test( name ) ) {
1117                                 matched.reverse();
1118                         }
1119                 }
1120
1121                 return this.pushStack( matched );
1122         };
1123 });
1124 var rnotwhite = (/\S+/g);
1125
1126
1127
1128 // String to Object options format cache
1129 var optionsCache = {};
1130
1131 // Convert String-formatted options into Object-formatted ones and store in cache
1132 function createOptions( options ) {
1133         var object = optionsCache[ options ] = {};
1134         jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
1135                 object[ flag ] = true;
1136         });
1137         return object;
1138 }
1139
1140 /*
1141  * Create a callback list using the following parameters:
1142  *
1143  *      options: an optional list of space-separated options that will change how
1144  *                      the callback list behaves or a more traditional option object
1145  *
1146  * By default a callback list will act like an event callback list and can be
1147  * "fired" multiple times.
1148  *
1149  * Possible options:
1150  *
1151  *      once:                   will ensure the callback list can only be fired once (like a Deferred)
1152  *
1153  *      memory:                 will keep track of previous values and will call any callback added
1154  *                                      after the list has been fired right away with the latest "memorized"
1155  *                                      values (like a Deferred)
1156  *
1157  *      unique:                 will ensure a callback can only be added once (no duplicate in the list)
1158  *
1159  *      stopOnFalse:    interrupt callings when a callback returns false
1160  *
1161  */
1162 jQuery.Callbacks = function( options ) {
1163
1164         // Convert options from String-formatted to Object-formatted if needed
1165         // (we check in cache first)
1166         options = typeof options === "string" ?
1167                 ( optionsCache[ options ] || createOptions( options ) ) :
1168                 jQuery.extend( {}, options );
1169
1170         var // Last fire value (for non-forgettable lists)
1171                 memory,
1172                 // Flag to know if list was already fired
1173                 fired,
1174                 // Flag to know if list is currently firing
1175                 firing,
1176                 // First callback to fire (used internally by add and fireWith)
1177                 firingStart,
1178                 // End of the loop when firing
1179                 firingLength,
1180                 // Index of currently firing callback (modified by remove if needed)
1181                 firingIndex,
1182                 // Actual callback list
1183                 list = [],
1184                 // Stack of fire calls for repeatable lists
1185                 stack = !options.once && [],
1186                 // Fire callbacks
1187                 fire = function( data ) {
1188                         memory = options.memory && data;
1189                         fired = true;
1190                         firingIndex = firingStart || 0;
1191                         firingStart = 0;
1192                         firingLength = list.length;
1193                         firing = true;
1194                         for ( ; list && firingIndex < firingLength; firingIndex++ ) {
1195                                 if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
1196                                         memory = false; // To prevent further calls using add
1197                                         break;
1198                                 }
1199                         }
1200                         firing = false;
1201                         if ( list ) {
1202                                 if ( stack ) {
1203                                         if ( stack.length ) {
1204                                                 fire( stack.shift() );
1205                                         }
1206                                 } else if ( memory ) {
1207                                         list = [];
1208                                 } else {
1209                                         self.disable();
1210                                 }
1211                         }
1212                 },
1213                 // Actual Callbacks object
1214                 self = {
1215                         // Add a callback or a collection of callbacks to the list
1216                         add: function() {
1217                                 if ( list ) {
1218                                         // First, we save the current length
1219                                         var start = list.length;
1220                                         (function add( args ) {
1221                                                 jQuery.each( args, function( _, arg ) {
1222                                                         var type = jQuery.type( arg );
1223                                                         if ( type === "function" ) {
1224                                                                 if ( !options.unique || !self.has( arg ) ) {
1225                                                                         list.push( arg );
1226                                                                 }
1227                                                         } else if ( arg && arg.length && type !== "string" ) {
1228                                                                 // Inspect recursively
1229                                                                 add( arg );
1230                                                         }
1231                                                 });
1232                                         })( arguments );
1233                                         // Do we need to add the callbacks to the
1234                                         // current firing batch?
1235                                         if ( firing ) {
1236                                                 firingLength = list.length;
1237                                         // With memory, if we're not firing then
1238                                         // we should call right away
1239                                         } else if ( memory ) {
1240                                                 firingStart = start;
1241                                                 fire( memory );
1242                                         }
1243                                 }
1244                                 return this;
1245                         },
1246                         // Remove a callback from the list
1247                         remove: function() {
1248                                 if ( list ) {
1249                                         jQuery.each( arguments, function( _, arg ) {
1250                                                 var index;
1251                                                 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
1252                                                         list.splice( index, 1 );
1253                                                         // Handle firing indexes
1254                                                         if ( firing ) {
1255                                                                 if ( index <= firingLength ) {
1256                                                                         firingLength--;
1257                                                                 }
1258                                                                 if ( index <= firingIndex ) {
1259                                                                         firingIndex--;
1260                                                                 }
1261                                                         }
1262                                                 }
1263                                         });
1264                                 }
1265                                 return this;
1266                         },
1267                         // Check if a given callback is in the list.
1268                         // If no argument is given, return whether or not list has callbacks attached.
1269                         has: function( fn ) {
1270                                 return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
1271                         },
1272                         // Remove all callbacks from the list
1273                         empty: function() {
1274                                 list = [];
1275                                 firingLength = 0;
1276                                 return this;
1277                         },
1278                         // Have the list do nothing anymore
1279                         disable: function() {
1280                                 list = stack = memory = undefined;
1281                                 return this;
1282                         },
1283                         // Is it disabled?
1284                         disabled: function() {
1285                                 return !list;
1286                         },
1287                         // Lock the list in its current state
1288                         lock: function() {
1289                                 stack = undefined;
1290                                 if ( !memory ) {
1291                                         self.disable();
1292                                 }
1293                                 return this;
1294                         },
1295                         // Is it locked?
1296                         locked: function() {
1297                                 return !stack;
1298                         },
1299                         // Call all callbacks with the given context and arguments
1300                         fireWith: function( context, args ) {
1301                                 if ( list && ( !fired || stack ) ) {
1302                                         args = args || [];
1303                                         args = [ context, args.slice ? args.slice() : args ];
1304                                         if ( firing ) {
1305                                                 stack.push( args );
1306                                         } else {
1307                                                 fire( args );
1308                                         }
1309                                 }
1310                                 return this;
1311                         },
1312                         // Call all the callbacks with the given arguments
1313                         fire: function() {
1314                                 self.fireWith( this, arguments );
1315                                 return this;
1316                         },
1317                         // To know if the callbacks have already been called at least once
1318                         fired: function() {
1319                                 return !!fired;
1320                         }
1321                 };
1322
1323         return self;
1324 };
1325
1326
1327 jQuery.extend({
1328
1329         Deferred: function( func ) {
1330                 var tuples = [
1331                                 // action, add listener, listener list, final state
1332                                 [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
1333                                 [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
1334                                 [ "notify", "progress", jQuery.Callbacks("memory") ]
1335                         ],
1336                         state = "pending",
1337                         promise = {
1338                                 state: function() {
1339                                         return state;
1340                                 },
1341                                 always: function() {
1342                                         deferred.done( arguments ).fail( arguments );
1343                                         return this;
1344                                 },
1345                                 then: function( /* fnDone, fnFail, fnProgress */ ) {
1346                                         var fns = arguments;
1347                                         return jQuery.Deferred(function( newDefer ) {
1348                                                 jQuery.each( tuples, function( i, tuple ) {
1349                                                         var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
1350                                                         // deferred[ done | fail | progress ] for forwarding actions to newDefer
1351                                                         deferred[ tuple[1] ](function() {
1352                                                                 var returned = fn && fn.apply( this, arguments );
1353                                                                 if ( returned && jQuery.isFunction( returned.promise ) ) {
1354                                                                         returned.promise()
1355                                                                                 .done( newDefer.resolve )
1356                                                                                 .fail( newDefer.reject )
1357                                                                                 .progress( newDefer.notify );
1358                                                                 } else {
1359                                                                         newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
1360                                                                 }
1361                                                         });
1362                                                 });
1363                                                 fns = null;
1364                                         }).promise();
1365                                 },
1366                                 // Get a promise for this deferred
1367                                 // If obj is provided, the promise aspect is added to the object
1368                                 promise: function( obj ) {
1369                                         return obj != null ? jQuery.extend( obj, promise ) : promise;
1370                                 }
1371                         },
1372                         deferred = {};
1373
1374                 // Keep pipe for back-compat
1375                 promise.pipe = promise.then;
1376
1377                 // Add list-specific methods
1378                 jQuery.each( tuples, function( i, tuple ) {
1379                         var list = tuple[ 2 ],
1380                                 stateString = tuple[ 3 ];
1381
1382                         // promise[ done | fail | progress ] = list.add
1383                         promise[ tuple[1] ] = list.add;
1384
1385                         // Handle state
1386                         if ( stateString ) {
1387                                 list.add(function() {
1388                                         // state = [ resolved | rejected ]
1389                                         state = stateString;
1390
1391                                 // [ reject_list | resolve_list ].disable; progress_list.lock
1392                                 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
1393                         }
1394
1395                         // deferred[ resolve | reject | notify ]
1396                         deferred[ tuple[0] ] = function() {
1397                                 deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
1398                                 return this;
1399                         };
1400                         deferred[ tuple[0] + "With" ] = list.fireWith;
1401                 });
1402
1403                 // Make the deferred a promise
1404                 promise.promise( deferred );
1405
1406                 // Call given func if any
1407                 if ( func ) {
1408                         func.call( deferred, deferred );
1409                 }
1410
1411                 // All done!
1412                 return deferred;
1413         },
1414
1415         // Deferred helper
1416         when: function( subordinate /* , ..., subordinateN */ ) {
1417                 var i = 0,
1418                         resolveValues = slice.call( arguments ),
1419                         length = resolveValues.length,
1420
1421                         // the count of uncompleted subordinates
1422                         remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
1423
1424                         // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
1425                         deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
1426
1427                         // Update function for both resolve and progress values
1428                         updateFunc = function( i, contexts, values ) {
1429                                 return function( value ) {
1430                                         contexts[ i ] = this;
1431                                         values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
1432                                         if ( values === progressValues ) {
1433                                                 deferred.notifyWith( contexts, values );
1434                                         } else if ( !( --remaining ) ) {
1435                                                 deferred.resolveWith( contexts, values );
1436                                         }
1437                                 };
1438                         },
1439
1440                         progressValues, progressContexts, resolveContexts;
1441
1442                 // add listeners to Deferred subordinates; treat others as resolved
1443                 if ( length > 1 ) {
1444                         progressValues = new Array( length );
1445                         progressContexts = new Array( length );
1446                         resolveContexts = new Array( length );
1447                         for ( ; i < length; i++ ) {
1448                                 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
1449                                         resolveValues[ i ].promise()
1450                                                 .done( updateFunc( i, resolveContexts, resolveValues ) )
1451                                                 .fail( deferred.reject )
1452                                                 .progress( updateFunc( i, progressContexts, progressValues ) );
1453                                 } else {
1454                                         --remaining;
1455                                 }
1456                         }
1457                 }
1458
1459                 // if we're not waiting on anything, resolve the master
1460                 if ( !remaining ) {
1461                         deferred.resolveWith( resolveContexts, resolveValues );
1462                 }
1463
1464                 return deferred.promise();
1465         }
1466 });
1467
1468
1469 // The deferred used on DOM ready
1470 var readyList;
1471
1472 jQuery.fn.ready = function( fn ) {
1473         // Add the callback
1474         jQuery.ready.promise().done( fn );
1475
1476         return this;
1477 };
1478
1479 jQuery.extend({
1480         // Is the DOM ready to be used? Set to true once it occurs.
1481         isReady: false,
1482
1483         // A counter to track how many items to wait for before
1484         // the ready event fires. See #6781
1485         readyWait: 1,
1486
1487         // Hold (or release) the ready event
1488         holdReady: function( hold ) {
1489                 if ( hold ) {
1490                         jQuery.readyWait++;
1491                 } else {
1492                         jQuery.ready( true );
1493                 }
1494         },
1495
1496         // Handle when the DOM is ready
1497         ready: function( wait ) {
1498
1499                 // Abort if there are pending holds or we're already ready
1500                 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
1501                         return;
1502                 }
1503
1504                 // Remember that the DOM is ready
1505                 jQuery.isReady = true;
1506
1507                 // If a normal DOM Ready event fired, decrement, and wait if need be
1508                 if ( wait !== true && --jQuery.readyWait > 0 ) {
1509                         return;
1510                 }
1511
1512                 // If there are functions bound, to execute
1513                 readyList.resolveWith( document, [ jQuery ] );
1514
1515                 // Trigger any bound ready events
1516                 if ( jQuery.fn.triggerHandler ) {
1517                         jQuery( document ).triggerHandler( "ready" );
1518                         jQuery( document ).off( "ready" );
1519                 }
1520         }
1521 });
1522
1523 /**
1524  * The ready event handler and self cleanup method
1525  */
1526 function completed() {
1527         document.removeEventListener( "DOMContentLoaded", completed, false );
1528         window.removeEventListener( "load", completed, false );
1529         jQuery.ready();
1530 }
1531
1532 jQuery.ready.promise = function( obj ) {
1533         if ( !readyList ) {
1534
1535                 readyList = jQuery.Deferred();
1536
1537                 // Catch cases where $(document).ready() is called after the browser event has already occurred.
1538                 // we once tried to use readyState "interactive" here, but it caused issues like the one
1539                 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
1540                 if ( document.readyState === "complete" ) {
1541                         // Handle it asynchronously to allow scripts the opportunity to delay ready
1542                         setTimeout( jQuery.ready );
1543
1544                 } else {
1545
1546                         // Use the handy event callback
1547                         document.addEventListener( "DOMContentLoaded", completed, false );
1548
1549                         // A fallback to window.onload, that will always work
1550                         window.addEventListener( "load", completed, false );
1551                 }
1552         }
1553         return readyList.promise( obj );
1554 };
1555
1556 // Kick off the DOM ready check even if the user does not
1557 jQuery.ready.promise();
1558
1559
1560
1561
1562 // Multifunctional method to get and set values of a collection
1563 // The value/s can optionally be executed if it's a function
1564 var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
1565         var i = 0,
1566                 len = elems.length,
1567                 bulk = key == null;
1568
1569         // Sets many values
1570         if ( jQuery.type( key ) === "object" ) {
1571                 chainable = true;
1572                 for ( i in key ) {
1573                         jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
1574                 }
1575
1576         // Sets one value
1577         } else if ( value !== undefined ) {
1578                 chainable = true;
1579
1580                 if ( !jQuery.isFunction( value ) ) {
1581                         raw = true;
1582                 }
1583
1584                 if ( bulk ) {
1585                         // Bulk operations run against the entire set
1586                         if ( raw ) {
1587                                 fn.call( elems, value );
1588                                 fn = null;
1589
1590                         // ...except when executing function values
1591                         } else {
1592                                 bulk = fn;
1593                                 fn = function( elem, key, value ) {
1594                                         return bulk.call( jQuery( elem ), value );
1595                                 };
1596                         }
1597                 }
1598
1599                 if ( fn ) {
1600                         for ( ; i < len; i++ ) {
1601                                 fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
1602                         }
1603                 }
1604         }
1605
1606         return chainable ?
1607                 elems :
1608
1609                 // Gets
1610                 bulk ?
1611                         fn.call( elems ) :
1612                         len ? fn( elems[0], key ) : emptyGet;
1613 };
1614
1615
1616 /**
1617  * Determines whether an object can have data
1618  */
1619 jQuery.acceptData = function( owner ) {
1620         // Accepts only:
1621         //  - Node
1622         //    - Node.ELEMENT_NODE
1623         //    - Node.DOCUMENT_NODE
1624         //  - Object
1625         //    - Any
1626         /* jshint -W018 */
1627         return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
1628 };
1629
1630
1631 function Data() {
1632         // Support: Android < 4,
1633         // Old WebKit does not have Object.preventExtensions/freeze method,
1634         // return new empty object instead with no [[set]] accessor
1635         Object.defineProperty( this.cache = {}, 0, {
1636                 get: function() {
1637                         return {};
1638                 }
1639         });
1640
1641         this.expando = jQuery.expando + Math.random();
1642 }
1643
1644 Data.uid = 1;
1645 Data.accepts = jQuery.acceptData;
1646
1647 Data.prototype = {
1648         key: function( owner ) {
1649                 // We can accept data for non-element nodes in modern browsers,
1650                 // but we should not, see #8335.
1651                 // Always return the key for a frozen object.
1652                 if ( !Data.accepts( owner ) ) {
1653                         return 0;
1654                 }
1655
1656                 var descriptor = {},
1657                         // Check if the owner object already has a cache key
1658                         unlock = owner[ this.expando ];
1659
1660                 // If not, create one
1661                 if ( !unlock ) {
1662                         unlock = Data.uid++;
1663
1664                         // Secure it in a non-enumerable, non-writable property
1665                         try {
1666                                 descriptor[ this.expando ] = { value: unlock };
1667                                 Object.defineProperties( owner, descriptor );
1668
1669                         // Support: Android < 4
1670                         // Fallback to a less secure definition
1671                         } catch ( e ) {
1672                                 descriptor[ this.expando ] = unlock;
1673                                 jQuery.extend( owner, descriptor );
1674                         }
1675                 }
1676
1677                 // Ensure the cache object
1678                 if ( !this.cache[ unlock ] ) {
1679                         this.cache[ unlock ] = {};
1680                 }
1681
1682                 return unlock;
1683         },
1684         set: function( owner, data, value ) {
1685                 var prop,
1686                         // There may be an unlock assigned to this node,
1687                         // if there is no entry for this "owner", create one inline
1688                         // and set the unlock as though an owner entry had always existed
1689                         unlock = this.key( owner ),
1690                         cache = this.cache[ unlock ];
1691
1692                 // Handle: [ owner, key, value ] args
1693                 if ( typeof data === "string" ) {
1694                         cache[ data ] = value;
1695
1696                 // Handle: [ owner, { properties } ] args
1697                 } else {
1698                         // Fresh assignments by object are shallow copied
1699                         if ( jQuery.isEmptyObject( cache ) ) {
1700                                 jQuery.extend( this.cache[ unlock ], data );
1701                         // Otherwise, copy the properties one-by-one to the cache object
1702                         } else {
1703                                 for ( prop in data ) {
1704                                         cache[ prop ] = data[ prop ];
1705                                 }
1706                         }
1707                 }
1708                 return cache;
1709         },
1710         get: function( owner, key ) {
1711                 // Either a valid cache is found, or will be created.
1712                 // New caches will be created and the unlock returned,
1713                 // allowing direct access to the newly created
1714                 // empty data object. A valid owner object must be provided.
1715                 var cache = this.cache[ this.key( owner ) ];
1716
1717                 return key === undefined ?
1718                         cache : cache[ key ];
1719         },
1720         access: function( owner, key, value ) {
1721                 var stored;
1722                 // In cases where either:
1723                 //
1724                 //   1. No key was specified
1725                 //   2. A string key was specified, but no value provided
1726                 //
1727                 // Take the "read" path and allow the get method to determine
1728                 // which value to return, respectively either:
1729                 //
1730                 //   1. The entire cache object
1731                 //   2. The data stored at the key
1732                 //
1733                 if ( key === undefined ||
1734                                 ((key && typeof key === "string") && value === undefined) ) {
1735
1736                         stored = this.get( owner, key );
1737
1738                         return stored !== undefined ?
1739                                 stored : this.get( owner, jQuery.camelCase(key) );
1740                 }
1741
1742                 // [*]When the key is not a string, or both a key and value
1743                 // are specified, set or extend (existing objects) with either:
1744                 //
1745                 //   1. An object of properties
1746                 //   2. A key and value
1747                 //
1748                 this.set( owner, key, value );
1749
1750                 // Since the "set" path can have two possible entry points
1751                 // return the expected data based on which path was taken[*]
1752                 return value !== undefined ? value : key;
1753         },
1754         remove: function( owner, key ) {
1755                 var i, name, camel,
1756                         unlock = this.key( owner ),
1757                         cache = this.cache[ unlock ];
1758
1759                 if ( key === undefined ) {
1760                         this.cache[ unlock ] = {};
1761
1762                 } else {
1763                         // Support array or space separated string of keys
1764                         if ( jQuery.isArray( key ) ) {
1765                                 // If "name" is an array of keys...
1766                                 // When data is initially created, via ("key", "val") signature,
1767                                 // keys will be converted to camelCase.
1768                                 // Since there is no way to tell _how_ a key was added, remove
1769                                 // both plain key and camelCase key. #12786
1770                                 // This will only penalize the array argument path.
1771                                 name = key.concat( key.map( jQuery.camelCase ) );
1772                         } else {
1773                                 camel = jQuery.camelCase( key );
1774                                 // Try the string as a key before any manipulation
1775                                 if ( key in cache ) {
1776                                         name = [ key, camel ];
1777                                 } else {
1778                                         // If a key with the spaces exists, use it.
1779                                         // Otherwise, create an array by matching non-whitespace
1780                                         name = camel;
1781                                         name = name in cache ?
1782                                                 [ name ] : ( name.match( rnotwhite ) || [] );
1783                                 }
1784                         }
1785
1786                         i = name.length;
1787                         while ( i-- ) {
1788                                 delete cache[ name[ i ] ];
1789                         }
1790                 }
1791         },
1792         hasData: function( owner ) {
1793                 return !jQuery.isEmptyObject(
1794                         this.cache[ owner[ this.expando ] ] || {}
1795                 );
1796         },
1797         discard: function( owner ) {
1798                 if ( owner[ this.expando ] ) {
1799                         delete this.cache[ owner[ this.expando ] ];
1800                 }
1801         }
1802 };
1803 var data_priv = new Data();
1804
1805 var data_user = new Data();
1806
1807
1808
1809 /*
1810         Implementation Summary
1811
1812         1. Enforce API surface and semantic compatibility with 1.9.x branch
1813         2. Improve the module's maintainability by reducing the storage
1814                 paths to a single mechanism.
1815         3. Use the same single mechanism to support "private" and "user" data.
1816         4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
1817         5. Avoid exposing implementation details on user objects (eg. expando properties)
1818         6. Provide a clear path for implementation upgrade to WeakMap in 2014
1819 */
1820 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
1821         rmultiDash = /([A-Z])/g;
1822
1823 function dataAttr( elem, key, data ) {
1824         var name;
1825
1826         // If nothing was found internally, try to fetch any
1827         // data from the HTML5 data-* attribute
1828         if ( data === undefined && elem.nodeType === 1 ) {
1829                 name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
1830                 data = elem.getAttribute( name );
1831
1832                 if ( typeof data === "string" ) {
1833                         try {
1834                                 data = data === "true" ? true :
1835                                         data === "false" ? false :
1836                                         data === "null" ? null :
1837                                         // Only convert to a number if it doesn't change the string
1838                                         +data + "" === data ? +data :
1839                                         rbrace.test( data ) ? jQuery.parseJSON( data ) :
1840                                         data;
1841                         } catch( e ) {}
1842
1843                         // Make sure we set the data so it isn't changed later
1844                         data_user.set( elem, key, data );
1845                 } else {
1846                         data = undefined;
1847                 }
1848         }
1849         return data;
1850 }
1851
1852 jQuery.extend({
1853         hasData: function( elem ) {
1854                 return data_user.hasData( elem ) || data_priv.hasData( elem );
1855         },
1856
1857         data: function( elem, name, data ) {
1858                 return data_user.access( elem, name, data );
1859         },
1860
1861         removeData: function( elem, name ) {
1862                 data_user.remove( elem, name );
1863         },
1864
1865         // TODO: Now that all calls to _data and _removeData have been replaced
1866         // with direct calls to data_priv methods, these can be deprecated.
1867         _data: function( elem, name, data ) {
1868                 return data_priv.access( elem, name, data );
1869         },
1870
1871         _removeData: function( elem, name ) {
1872                 data_priv.remove( elem, name );
1873         }
1874 });
1875
1876 jQuery.fn.extend({
1877         data: function( key, value ) {
1878                 var i, name, data,
1879                         elem = this[ 0 ],
1880                         attrs = elem && elem.attributes;
1881
1882                 // Gets all values
1883                 if ( key === undefined ) {
1884                         if ( this.length ) {
1885                                 data = data_user.get( elem );
1886
1887                                 if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
1888                                         i = attrs.length;
1889                                         while ( i-- ) {
1890
1891                                                 // Support: IE11+
1892                                                 // The attrs elements can be null (#14894)
1893                                                 if ( attrs[ i ] ) {
1894                                                         name = attrs[ i ].name;
1895                                                         if ( name.indexOf( "data-" ) === 0 ) {
1896                                                                 name = jQuery.camelCase( name.slice(5) );
1897                                                                 dataAttr( elem, name, data[ name ] );
1898                                                         }
1899                                                 }
1900                                         }
1901                                         data_priv.set( elem, "hasDataAttrs", true );
1902                                 }
1903                         }
1904
1905                         return data;
1906                 }
1907
1908                 // Sets multiple values
1909                 if ( typeof key === "object" ) {
1910                         return this.each(function() {
1911                                 data_user.set( this, key );
1912                         });
1913                 }
1914
1915                 return access( this, function( value ) {
1916                         var data,
1917                                 camelKey = jQuery.camelCase( key );
1918
1919                         // The calling jQuery object (element matches) is not empty
1920                         // (and therefore has an element appears at this[ 0 ]) and the
1921                         // `value` parameter was not undefined. An empty jQuery object
1922                         // will result in `undefined` for elem = this[ 0 ] which will
1923                         // throw an exception if an attempt to read a data cache is made.
1924                         if ( elem && value === undefined ) {
1925                                 // Attempt to get data from the cache
1926                                 // with the key as-is
1927                                 data = data_user.get( elem, key );
1928                                 if ( data !== undefined ) {
1929                                         return data;
1930                                 }
1931
1932                                 // Attempt to get data from the cache
1933                                 // with the key camelized
1934                                 data = data_user.get( elem, camelKey );
1935                                 if ( data !== undefined ) {
1936                                         return data;
1937                                 }
1938
1939                                 // Attempt to "discover" the data in
1940                                 // HTML5 custom data-* attrs
1941                                 data = dataAttr( elem, camelKey, undefined );
1942                                 if ( data !== undefined ) {
1943                                         return data;
1944                                 }
1945
1946                                 // We tried really hard, but the data doesn't exist.
1947                                 return;
1948                         }
1949
1950                         // Set the data...
1951                         this.each(function() {
1952                                 // First, attempt to store a copy or reference of any
1953                                 // data that might've been store with a camelCased key.
1954                                 var data = data_user.get( this, camelKey );
1955
1956                                 // For HTML5 data-* attribute interop, we have to
1957                                 // store property names with dashes in a camelCase form.
1958                                 // This might not apply to all properties...*
1959                                 data_user.set( this, camelKey, value );
1960
1961                                 // *... In the case of properties that might _actually_
1962                                 // have dashes, we need to also store a copy of that
1963                                 // unchanged property.
1964                                 if ( key.indexOf("-") !== -1 && data !== undefined ) {
1965                                         data_user.set( this, key, value );
1966                                 }
1967                         });
1968                 }, null, value, arguments.length > 1, null, true );
1969         },
1970
1971         removeData: function( key ) {
1972                 return this.each(function() {
1973                         data_user.remove( this, key );
1974                 });
1975         }
1976 });
1977
1978
1979 jQuery.extend({
1980         queue: function( elem, type, data ) {
1981                 var queue;
1982
1983                 if ( elem ) {
1984                         type = ( type || "fx" ) + "queue";
1985                         queue = data_priv.get( elem, type );
1986
1987                         // Speed up dequeue by getting out quickly if this is just a lookup
1988                         if ( data ) {
1989                                 if ( !queue || jQuery.isArray( data ) ) {
1990                                         queue = data_priv.access( elem, type, jQuery.makeArray(data) );
1991                                 } else {
1992                                         queue.push( data );
1993                                 }
1994                         }
1995                         return queue || [];
1996                 }
1997         },
1998
1999         dequeue: function( elem, type ) {
2000                 type = type || "fx";
2001
2002                 var queue = jQuery.queue( elem, type ),
2003                         startLength = queue.length,
2004                         fn = queue.shift(),
2005                         hooks = jQuery._queueHooks( elem, type ),
2006                         next = function() {
2007                                 jQuery.dequeue( elem, type );
2008                         };
2009
2010                 // If the fx queue is dequeued, always remove the progress sentinel
2011                 if ( fn === "inprogress" ) {
2012                         fn = queue.shift();
2013                         startLength--;
2014                 }
2015
2016                 if ( fn ) {
2017
2018                         // Add a progress sentinel to prevent the fx queue from being
2019                         // automatically dequeued
2020                         if ( type === "fx" ) {
2021                                 queue.unshift( "inprogress" );
2022                         }
2023
2024                         // clear up the last queue stop function
2025                         delete hooks.stop;
2026                         fn.call( elem, next, hooks );
2027                 }
2028
2029                 if ( !startLength && hooks ) {
2030                         hooks.empty.fire();
2031                 }
2032         },
2033
2034         // not intended for public consumption - generates a queueHooks object, or returns the current one
2035         _queueHooks: function( elem, type ) {
2036                 var key = type + "queueHooks";
2037                 return data_priv.get( elem, key ) || data_priv.access( elem, key, {
2038                         empty: jQuery.Callbacks("once memory").add(function() {
2039                                 data_priv.remove( elem, [ type + "queue", key ] );
2040                         })
2041                 });
2042         }
2043 });
2044
2045 jQuery.fn.extend({
2046         queue: function( type, data ) {
2047                 var setter = 2;
2048
2049                 if ( typeof type !== "string" ) {
2050                         data = type;
2051                         type = "fx";
2052                         setter--;
2053                 }
2054
2055                 if ( arguments.length < setter ) {
2056                         return jQuery.queue( this[0], type );
2057                 }
2058
2059                 return data === undefined ?
2060                         this :
2061                         this.each(function() {
2062                                 var queue = jQuery.queue( this, type, data );
2063
2064                                 // ensure a hooks for this queue
2065                                 jQuery._queueHooks( this, type );
2066
2067                                 if ( type === "fx" && queue[0] !== "inprogress" ) {
2068                                         jQuery.dequeue( this, type );
2069                                 }
2070                         });
2071         },
2072         dequeue: function( type ) {
2073                 return this.each(function() {
2074                         jQuery.dequeue( this, type );
2075                 });
2076         },
2077         clearQueue: function( type ) {
2078                 return this.queue( type || "fx", [] );
2079         },
2080         // Get a promise resolved when queues of a certain type
2081         // are emptied (fx is the type by default)
2082         promise: function( type, obj ) {
2083                 var tmp,
2084                         count = 1,
2085                         defer = jQuery.Deferred(),
2086                         elements = this,
2087                         i = this.length,
2088                         resolve = function() {
2089                                 if ( !( --count ) ) {
2090                                         defer.resolveWith( elements, [ elements ] );
2091                                 }
2092                         };
2093
2094                 if ( typeof type !== "string" ) {
2095                         obj = type;
2096                         type = undefined;
2097                 }
2098                 type = type || "fx";
2099
2100                 while ( i-- ) {
2101                         tmp = data_priv.get( elements[ i ], type + "queueHooks" );
2102                         if ( tmp && tmp.empty ) {
2103                                 count++;
2104                                 tmp.empty.add( resolve );
2105                         }
2106                 }
2107                 resolve();
2108                 return defer.promise( obj );
2109         }
2110 });
2111 var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
2112
2113 var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
2114
2115 var isHidden = function( elem, el ) {
2116                 // isHidden might be called from jQuery#filter function;
2117                 // in that case, element will be second argument
2118                 elem = el || elem;
2119                 return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
2120         };
2121
2122 var rcheckableType = (/^(?:checkbox|radio)$/i);
2123
2124
2125
2126 (function() {
2127         var fragment = document.createDocumentFragment(),
2128                 div = fragment.appendChild( document.createElement( "div" ) ),
2129                 input = document.createElement( "input" );
2130
2131         // #11217 - WebKit loses check when the name is after the checked attribute
2132         // Support: Windows Web Apps (WWA)
2133         // `name` and `type` need .setAttribute for WWA
2134         input.setAttribute( "type", "radio" );
2135         input.setAttribute( "checked", "checked" );
2136         input.setAttribute( "name", "t" );
2137
2138         div.appendChild( input );
2139
2140         // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
2141         // old WebKit doesn't clone checked state correctly in fragments
2142         support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
2143
2144         // Make sure textarea (and checkbox) defaultValue is properly cloned
2145         // Support: IE9-IE11+
2146         div.innerHTML = "<textarea>x</textarea>";
2147         support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
2148 })();
2149 var strundefined = typeof undefined;
2150
2151
2152
2153 support.focusinBubbles = "onfocusin" in window;
2154
2155
2156 var
2157         rkeyEvent = /^key/,
2158         rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
2159         rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
2160         rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
2161
2162 function returnTrue() {
2163         return true;
2164 }
2165
2166 function returnFalse() {
2167         return false;
2168 }
2169
2170 function safeActiveElement() {
2171         try {
2172                 return document.activeElement;
2173         } catch ( err ) { }
2174 }
2175
2176 /*
2177  * Helper functions for managing events -- not part of the public interface.
2178  * Props to Dean Edwards' addEvent library for many of the ideas.
2179  */
2180 jQuery.event = {
2181
2182         global: {},
2183
2184         add: function( elem, types, handler, data, selector ) {
2185
2186                 var handleObjIn, eventHandle, tmp,
2187                         events, t, handleObj,
2188                         special, handlers, type, namespaces, origType,
2189                         elemData = data_priv.get( elem );
2190
2191                 // Don't attach events to noData or text/comment nodes (but allow plain objects)
2192                 if ( !elemData ) {
2193                         return;
2194                 }
2195
2196                 // Caller can pass in an object of custom data in lieu of the handler
2197                 if ( handler.handler ) {
2198                         handleObjIn = handler;
2199                         handler = handleObjIn.handler;
2200                         selector = handleObjIn.selector;
2201                 }
2202
2203                 // Make sure that the handler has a unique ID, used to find/remove it later
2204                 if ( !handler.guid ) {
2205                         handler.guid = jQuery.guid++;
2206                 }
2207
2208                 // Init the element's event structure and main handler, if this is the first
2209                 if ( !(events = elemData.events) ) {
2210                         events = elemData.events = {};
2211                 }
2212                 if ( !(eventHandle = elemData.handle) ) {
2213                         eventHandle = elemData.handle = function( e ) {
2214                                 // Discard the second event of a jQuery.event.trigger() and
2215                                 // when an event is called after a page has unloaded
2216                                 return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
2217                                         jQuery.event.dispatch.apply( elem, arguments ) : undefined;
2218                         };
2219                 }
2220
2221                 // Handle multiple events separated by a space
2222                 types = ( types || "" ).match( rnotwhite ) || [ "" ];
2223                 t = types.length;
2224                 while ( t-- ) {
2225                         tmp = rtypenamespace.exec( types[t] ) || [];
2226                         type = origType = tmp[1];
2227                         namespaces = ( tmp[2] || "" ).split( "." ).sort();
2228
2229                         // There *must* be a type, no attaching namespace-only handlers
2230                         if ( !type ) {
2231                                 continue;
2232                         }
2233
2234                         // If event changes its type, use the special event handlers for the changed type
2235                         special = jQuery.event.special[ type ] || {};
2236
2237                         // If selector defined, determine special event api type, otherwise given type
2238                         type = ( selector ? special.delegateType : special.bindType ) || type;
2239
2240                         // Update special based on newly reset type
2241                         special = jQuery.event.special[ type ] || {};
2242
2243                         // handleObj is passed to all event handlers
2244                         handleObj = jQuery.extend({
2245                                 type: type,
2246                                 origType: origType,
2247                                 data: data,
2248                                 handler: handler,
2249                                 guid: handler.guid,
2250                                 selector: selector,
2251                                 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
2252                                 namespace: namespaces.join(".")
2253                         }, handleObjIn );
2254
2255                         // Init the event handler queue if we're the first
2256                         if ( !(handlers = events[ type ]) ) {
2257                                 handlers = events[ type ] = [];
2258                                 handlers.delegateCount = 0;
2259
2260                                 // Only use addEventListener if the special events handler returns false
2261                                 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
2262                                         if ( elem.addEventListener ) {
2263                                                 elem.addEventListener( type, eventHandle, false );
2264                                         }
2265                                 }
2266                         }
2267
2268                         if ( special.add ) {
2269                                 special.add.call( elem, handleObj );
2270
2271                                 if ( !handleObj.handler.guid ) {
2272                                         handleObj.handler.guid = handler.guid;
2273                                 }
2274                         }
2275
2276                         // Add to the element's handler list, delegates in front
2277                         if ( selector ) {
2278                                 handlers.splice( handlers.delegateCount++, 0, handleObj );
2279                         } else {
2280                                 handlers.push( handleObj );
2281                         }
2282
2283                         // Keep track of which events have ever been used, for event optimization
2284                         jQuery.event.global[ type ] = true;
2285                 }
2286
2287         },
2288
2289         // Detach an event or set of events from an element
2290         remove: function( elem, types, handler, selector, mappedTypes ) {
2291
2292                 var j, origCount, tmp,
2293                         events, t, handleObj,
2294                         special, handlers, type, namespaces, origType,
2295                         elemData = data_priv.hasData( elem ) && data_priv.get( elem );
2296
2297                 if ( !elemData || !(events = elemData.events) ) {
2298                         return;
2299                 }
2300
2301                 // Once for each type.namespace in types; type may be omitted
2302                 types = ( types || "" ).match( rnotwhite ) || [ "" ];
2303                 t = types.length;
2304                 while ( t-- ) {
2305                         tmp = rtypenamespace.exec( types[t] ) || [];
2306                         type = origType = tmp[1];
2307                         namespaces = ( tmp[2] || "" ).split( "." ).sort();
2308
2309                         // Unbind all events (on this namespace, if provided) for the element
2310                         if ( !type ) {
2311                                 for ( type in events ) {
2312                                         jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
2313                                 }
2314                                 continue;
2315                         }
2316
2317                         special = jQuery.event.special[ type ] || {};
2318                         type = ( selector ? special.delegateType : special.bindType ) || type;
2319                         handlers = events[ type ] || [];
2320                         tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
2321
2322                         // Remove matching events
2323                         origCount = j = handlers.length;
2324                         while ( j-- ) {
2325                                 handleObj = handlers[ j ];
2326
2327                                 if ( ( mappedTypes || origType === handleObj.origType ) &&
2328                                         ( !handler || handler.guid === handleObj.guid ) &&
2329                                         ( !tmp || tmp.test( handleObj.namespace ) ) &&
2330                                         ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
2331                                         handlers.splice( j, 1 );
2332
2333                                         if ( handleObj.selector ) {
2334                                                 handlers.delegateCount--;
2335                                         }
2336                                         if ( special.remove ) {
2337                                                 special.remove.call( elem, handleObj );
2338                                         }
2339                                 }
2340                         }
2341
2342                         // Remove generic event handler if we removed something and no more handlers exist
2343                         // (avoids potential for endless recursion during removal of special event handlers)
2344                         if ( origCount && !handlers.length ) {
2345                                 if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
2346                                         jQuery.removeEvent( elem, type, elemData.handle );
2347                                 }
2348
2349                                 delete events[ type ];
2350                         }
2351                 }
2352
2353                 // Remove the expando if it's no longer used
2354                 if ( jQuery.isEmptyObject( events ) ) {
2355                         delete elemData.handle;
2356                         data_priv.remove( elem, "events" );
2357                 }
2358         },
2359
2360         trigger: function( event, data, elem, onlyHandlers ) {
2361
2362                 var i, cur, tmp, bubbleType, ontype, handle, special,
2363                         eventPath = [ elem || document ],
2364                         type = hasOwn.call( event, "type" ) ? event.type : event,
2365                         namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
2366
2367                 cur = tmp = elem = elem || document;
2368
2369                 // Don't do events on text and comment nodes
2370                 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
2371                         return;
2372                 }
2373
2374                 // focus/blur morphs to focusin/out; ensure we're not firing them right now
2375                 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
2376                         return;
2377                 }
2378
2379                 if ( type.indexOf(".") >= 0 ) {
2380                         // Namespaced trigger; create a regexp to match event type in handle()
2381                         namespaces = type.split(".");
2382                         type = namespaces.shift();
2383                         namespaces.sort();
2384                 }
2385                 ontype = type.indexOf(":") < 0 && "on" + type;
2386
2387                 // Caller can pass in a jQuery.Event object, Object, or just an event type string
2388                 event = event[ jQuery.expando ] ?
2389                         event :
2390                         new jQuery.Event( type, typeof event === "object" && event );
2391
2392                 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
2393                 event.isTrigger = onlyHandlers ? 2 : 3;
2394                 event.namespace = namespaces.join(".");
2395                 event.namespace_re = event.namespace ?
2396                         new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
2397                         null;
2398
2399                 // Clean up the event in case it is being reused
2400                 event.result = undefined;
2401                 if ( !event.target ) {
2402                         event.target = elem;
2403                 }
2404
2405                 // Clone any incoming data and prepend the event, creating the handler arg list
2406                 data = data == null ?
2407                         [ event ] :
2408                         jQuery.makeArray( data, [ event ] );
2409
2410                 // Allow special events to draw outside the lines
2411                 special = jQuery.event.special[ type ] || {};
2412                 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
2413                         return;
2414                 }
2415
2416                 // Determine event propagation path in advance, per W3C events spec (#9951)
2417                 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
2418                 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
2419
2420                         bubbleType = special.delegateType || type;
2421                         if ( !rfocusMorph.test( bubbleType + type ) ) {
2422                                 cur = cur.parentNode;
2423                         }
2424                         for ( ; cur; cur = cur.parentNode ) {
2425                                 eventPath.push( cur );
2426                                 tmp = cur;
2427                         }
2428
2429                         // Only add window if we got to document (e.g., not plain obj or detached DOM)
2430                         if ( tmp === (elem.ownerDocument || document) ) {
2431                                 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
2432                         }
2433                 }
2434
2435                 // Fire handlers on the event path
2436                 i = 0;
2437                 while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
2438
2439                         event.type = i > 1 ?
2440                                 bubbleType :
2441                                 special.bindType || type;
2442
2443                         // jQuery handler
2444                         handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
2445                         if ( handle ) {
2446                                 handle.apply( cur, data );
2447                         }
2448
2449                         // Native handler
2450                         handle = ontype && cur[ ontype ];
2451                         if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
2452                                 event.result = handle.apply( cur, data );
2453                                 if ( event.result === false ) {
2454                                         event.preventDefault();
2455                                 }
2456                         }
2457                 }
2458                 event.type = type;
2459
2460                 // If nobody prevented the default action, do it now
2461                 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
2462
2463                         if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
2464                                 jQuery.acceptData( elem ) ) {
2465
2466                                 // Call a native DOM method on the target with the same name name as the event.
2467                                 // Don't do default actions on window, that's where global variables be (#6170)
2468                                 if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
2469
2470                                         // Don't re-trigger an onFOO event when we call its FOO() method
2471                                         tmp = elem[ ontype ];
2472
2473                                         if ( tmp ) {
2474                                                 elem[ ontype ] = null;
2475                                         }
2476
2477                                         // Prevent re-triggering of the same event, since we already bubbled it above
2478                                         jQuery.event.triggered = type;
2479                                         elem[ type ]();
2480                                         jQuery.event.triggered = undefined;
2481
2482                                         if ( tmp ) {
2483                                                 elem[ ontype ] = tmp;
2484                                         }
2485                                 }
2486                         }
2487                 }
2488
2489                 return event.result;
2490         },
2491
2492         dispatch: function( event ) {
2493
2494                 // Make a writable jQuery.Event from the native event object
2495                 event = jQuery.event.fix( event );
2496
2497                 var i, j, ret, matched, handleObj,
2498                         handlerQueue = [],
2499                         args = slice.call( arguments ),
2500                         handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
2501                         special = jQuery.event.special[ event.type ] || {};
2502
2503                 // Use the fix-ed jQuery.Event rather than the (read-only) native event
2504                 args[0] = event;
2505                 event.delegateTarget = this;
2506
2507                 // Call the preDispatch hook for the mapped type, and let it bail if desired
2508                 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
2509                         return;
2510                 }
2511
2512                 // Determine handlers
2513                 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
2514
2515                 // Run delegates first; they may want to stop propagation beneath us
2516                 i = 0;
2517                 while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
2518                         event.currentTarget = matched.elem;
2519
2520                         j = 0;
2521                         while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
2522
2523                                 // Triggered event must either 1) have no namespace, or
2524                                 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
2525                                 if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
2526
2527                                         event.handleObj = handleObj;
2528                                         event.data = handleObj.data;
2529
2530                                         ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
2531                                                         .apply( matched.elem, args );
2532
2533                                         if ( ret !== undefined ) {
2534                                                 if ( (event.result = ret) === false ) {
2535                                                         event.preventDefault();
2536                                                         event.stopPropagation();
2537                                                 }
2538                                         }
2539                                 }
2540                         }
2541                 }
2542
2543                 // Call the postDispatch hook for the mapped type
2544                 if ( special.postDispatch ) {
2545                         special.postDispatch.call( this, event );
2546                 }
2547
2548                 return event.result;
2549         },
2550
2551         handlers: function( event, handlers ) {
2552                 var i, matches, sel, handleObj,
2553                         handlerQueue = [],
2554                         delegateCount = handlers.delegateCount,
2555                         cur = event.target;
2556
2557                 // Find delegate handlers
2558                 // Black-hole SVG <use> instance trees (#13180)
2559                 // Avoid non-left-click bubbling in Firefox (#3861)
2560                 if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
2561
2562                         for ( ; cur !== this; cur = cur.parentNode || this ) {
2563
2564                                 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
2565                                 if ( cur.disabled !== true || event.type !== "click" ) {
2566                                         matches = [];
2567                                         for ( i = 0; i < delegateCount; i++ ) {
2568                                                 handleObj = handlers[ i ];
2569
2570                                                 // Don't conflict with Object.prototype properties (#13203)
2571                                                 sel = handleObj.selector + " ";
2572
2573                                                 if ( matches[ sel ] === undefined ) {
2574                                                         matches[ sel ] = handleObj.needsContext ?
2575                                                                 jQuery( sel, this ).index( cur ) >= 0 :
2576                                                                 jQuery.find( sel, this, null, [ cur ] ).length;
2577                                                 }
2578                                                 if ( matches[ sel ] ) {
2579                                                         matches.push( handleObj );
2580                                                 }
2581                                         }
2582                                         if ( matches.length ) {
2583                                                 handlerQueue.push({ elem: cur, handlers: matches });
2584                                         }
2585                                 }
2586                         }
2587                 }
2588
2589                 // Add the remaining (directly-bound) handlers
2590                 if ( delegateCount < handlers.length ) {
2591                         handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
2592                 }
2593
2594                 return handlerQueue;
2595         },
2596
2597         // Includes some event props shared by KeyEvent and MouseEvent
2598         props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
2599
2600         fixHooks: {},
2601
2602         keyHooks: {
2603                 props: "char charCode key keyCode".split(" "),
2604                 filter: function( event, original ) {
2605
2606                         // Add which for key events
2607                         if ( event.which == null ) {
2608                                 event.which = original.charCode != null ? original.charCode : original.keyCode;
2609                         }
2610
2611                         return event;
2612                 }
2613         },
2614
2615         mouseHooks: {
2616                 props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
2617                 filter: function( event, original ) {
2618                         var eventDoc, doc, body,
2619                                 button = original.button;
2620
2621                         // Calculate pageX/Y if missing and clientX/Y available
2622                         if ( event.pageX == null && original.clientX != null ) {
2623                                 eventDoc = event.target.ownerDocument || document;
2624                                 doc = eventDoc.documentElement;
2625                                 body = eventDoc.body;
2626
2627                                 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
2628                                 event.pageY = original.clientY + ( doc && doc.scrollTop  || body && body.scrollTop  || 0 ) - ( doc && doc.clientTop  || body && body.clientTop  || 0 );
2629                         }
2630
2631                         // Add which for click: 1 === left; 2 === middle; 3 === right
2632                         // Note: button is not normalized, so don't use it
2633                         if ( !event.which && button !== undefined ) {
2634                                 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
2635                         }
2636
2637                         return event;
2638                 }
2639         },
2640
2641         fix: function( event ) {
2642                 if ( event[ jQuery.expando ] ) {
2643                         return event;
2644                 }
2645
2646                 // Create a writable copy of the event object and normalize some properties
2647                 var i, prop, copy,
2648                         type = event.type,
2649                         originalEvent = event,
2650                         fixHook = this.fixHooks[ type ];
2651
2652                 if ( !fixHook ) {
2653                         this.fixHooks[ type ] = fixHook =
2654                                 rmouseEvent.test( type ) ? this.mouseHooks :
2655                                 rkeyEvent.test( type ) ? this.keyHooks :
2656                                 {};
2657                 }
2658                 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
2659
2660                 event = new jQuery.Event( originalEvent );
2661
2662                 i = copy.length;
2663                 while ( i-- ) {
2664                         prop = copy[ i ];
2665                         event[ prop ] = originalEvent[ prop ];
2666                 }
2667
2668                 // Support: Cordova 2.5 (WebKit) (#13255)
2669                 // All events should have a target; Cordova deviceready doesn't
2670                 if ( !event.target ) {
2671                         event.target = document;
2672                 }
2673
2674                 // Support: Safari 6.0+, Chrome < 28
2675                 // Target should not be a text node (#504, #13143)
2676                 if ( event.target.nodeType === 3 ) {
2677                         event.target = event.target.parentNode;
2678                 }
2679
2680                 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
2681         },
2682
2683         special: {
2684                 load: {
2685                         // Prevent triggered image.load events from bubbling to window.load
2686                         noBubble: true
2687                 },
2688                 focus: {
2689                         // Fire native event if possible so blur/focus sequence is correct
2690                         trigger: function() {
2691                                 if ( this !== safeActiveElement() && this.focus ) {
2692                                         this.focus();
2693                                         return false;
2694                                 }
2695                         },
2696                         delegateType: "focusin"
2697                 },
2698                 blur: {
2699                         trigger: function() {
2700                                 if ( this === safeActiveElement() && this.blur ) {
2701                                         this.blur();
2702                                         return false;
2703                                 }
2704                         },
2705                         delegateType: "focusout"
2706                 },
2707                 click: {
2708                         // For checkbox, fire native event so checked state will be right
2709                         trigger: function() {
2710                                 if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
2711                                         this.click();
2712                                         return false;
2713                                 }
2714                         },
2715
2716                         // For cross-browser consistency, don't fire native .click() on links
2717                         _default: function( event ) {
2718                                 return jQuery.nodeName( event.target, "a" );
2719                         }
2720                 },
2721
2722                 beforeunload: {
2723                         postDispatch: function( event ) {
2724
2725                                 // Support: Firefox 20+
2726                                 // Firefox doesn't alert if the returnValue field is not set.
2727                                 if ( event.result !== undefined && event.originalEvent ) {
2728                                         event.originalEvent.returnValue = event.result;
2729                                 }
2730                         }
2731                 }
2732         },
2733
2734         simulate: function( type, elem, event, bubble ) {
2735                 // Piggyback on a donor event to simulate a different one.
2736                 // Fake originalEvent to avoid donor's stopPropagation, but if the
2737                 // simulated event prevents default then we do the same on the donor.
2738                 var e = jQuery.extend(
2739                         new jQuery.Event(),
2740                         event,
2741                         {
2742                                 type: type,
2743                                 isSimulated: true,
2744                                 originalEvent: {}
2745                         }
2746                 );
2747                 if ( bubble ) {
2748                         jQuery.event.trigger( e, null, elem );
2749                 } else {
2750                         jQuery.event.dispatch.call( elem, e );
2751                 }
2752                 if ( e.isDefaultPrevented() ) {
2753                         event.preventDefault();
2754                 }
2755         }
2756 };
2757
2758 jQuery.removeEvent = function( elem, type, handle ) {
2759         if ( elem.removeEventListener ) {
2760                 elem.removeEventListener( type, handle, false );
2761         }
2762 };
2763
2764 jQuery.Event = function( src, props ) {
2765         // Allow instantiation without the 'new' keyword
2766         if ( !(this instanceof jQuery.Event) ) {
2767                 return new jQuery.Event( src, props );
2768         }
2769
2770         // Event object
2771         if ( src && src.type ) {
2772                 this.originalEvent = src;
2773                 this.type = src.type;
2774
2775                 // Events bubbling up the document may have been marked as prevented
2776                 // by a handler lower down the tree; reflect the correct value.
2777                 this.isDefaultPrevented = src.defaultPrevented ||
2778                                 src.defaultPrevented === undefined &&
2779                                 // Support: Android < 4.0
2780                                 src.returnValue === false ?
2781                         returnTrue :
2782                         returnFalse;
2783
2784         // Event type
2785         } else {
2786                 this.type = src;
2787         }
2788
2789         // Put explicitly provided properties onto the event object
2790         if ( props ) {
2791                 jQuery.extend( this, props );
2792         }
2793
2794         // Create a timestamp if incoming event doesn't have one
2795         this.timeStamp = src && src.timeStamp || jQuery.now();
2796
2797         // Mark it as fixed
2798         this[ jQuery.expando ] = true;
2799 };
2800
2801 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
2802 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
2803 jQuery.Event.prototype = {
2804         isDefaultPrevented: returnFalse,
2805         isPropagationStopped: returnFalse,
2806         isImmediatePropagationStopped: returnFalse,
2807
2808         preventDefault: function() {
2809                 var e = this.originalEvent;
2810
2811                 this.isDefaultPrevented = returnTrue;
2812
2813                 if ( e && e.preventDefault ) {
2814                         e.preventDefault();
2815                 }
2816         },
2817         stopPropagation: function() {
2818                 var e = this.originalEvent;
2819
2820                 this.isPropagationStopped = returnTrue;
2821
2822                 if ( e && e.stopPropagation ) {
2823                         e.stopPropagation();
2824                 }
2825         },
2826         stopImmediatePropagation: function() {
2827                 var e = this.originalEvent;
2828
2829                 this.isImmediatePropagationStopped = returnTrue;
2830
2831                 if ( e && e.stopImmediatePropagation ) {
2832                         e.stopImmediatePropagation();
2833                 }
2834
2835                 this.stopPropagation();
2836         }
2837 };
2838
2839 // Create mouseenter/leave events using mouseover/out and event-time checks
2840 // Support: Chrome 15+
2841 jQuery.each({
2842         mouseenter: "mouseover",
2843         mouseleave: "mouseout",
2844         pointerenter: "pointerover",
2845         pointerleave: "pointerout"
2846 }, function( orig, fix ) {
2847         jQuery.event.special[ orig ] = {
2848                 delegateType: fix,
2849                 bindType: fix,
2850
2851                 handle: function( event ) {
2852                         var ret,
2853                                 target = this,
2854                                 related = event.relatedTarget,
2855                                 handleObj = event.handleObj;
2856
2857                         // For mousenter/leave call the handler if related is outside the target.
2858                         // NB: No relatedTarget if the mouse left/entered the browser window
2859                         if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
2860                                 event.type = handleObj.origType;
2861                                 ret = handleObj.handler.apply( this, arguments );
2862                                 event.type = fix;
2863                         }
2864                         return ret;
2865                 }
2866         };
2867 });
2868
2869 // Create "bubbling" focus and blur events
2870 // Support: Firefox, Chrome, Safari
2871 if ( !support.focusinBubbles ) {
2872         jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
2873
2874                 // Attach a single capturing handler on the document while someone wants focusin/focusout
2875                 var handler = function( event ) {
2876                                 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
2877                         };
2878
2879                 jQuery.event.special[ fix ] = {
2880                         setup: function() {
2881                                 var doc = this.ownerDocument || this,
2882                                         attaches = data_priv.access( doc, fix );
2883
2884                                 if ( !attaches ) {