Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

8783 рядки
230KB

  1. /*!
  2. * jQuery JavaScript Library v3.6.0 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/Tween,-effects/animatedSelector
  3. * https://jquery.com/
  4. *
  5. * Includes Sizzle.js
  6. * https://sizzlejs.com/
  7. *
  8. * Copyright OpenJS Foundation and other contributors
  9. * Released under the MIT license
  10. * https://jquery.org/license
  11. *
  12. * Date: 2021-03-02T17:08Z
  13. */
  14. ( function( global, factory ) {
  15. "use strict";
  16. if ( typeof module === "object" && typeof module.exports === "object" ) {
  17. // For CommonJS and CommonJS-like environments where a proper `window`
  18. // is present, execute the factory and get jQuery.
  19. // For environments that do not have a `window` with a `document`
  20. // (such as Node.js), expose a factory as module.exports.
  21. // This accentuates the need for the creation of a real `window`.
  22. // e.g. var jQuery = require("jquery")(window);
  23. // See ticket #14549 for more info.
  24. module.exports = global.document ?
  25. factory( global, true ) :
  26. function( w ) {
  27. if ( !w.document ) {
  28. throw new Error( "jQuery requires a window with a document" );
  29. }
  30. return factory( w );
  31. };
  32. } else {
  33. factory( global );
  34. }
  35. // Pass this if window is not defined yet
  36. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  37. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  38. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  39. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  40. // enough that all such attempts are guarded in a try block.
  41. "use strict";
  42. var arr = [];
  43. var getProto = Object.getPrototypeOf;
  44. var slice = arr.slice;
  45. var flat = arr.flat ? function( array ) {
  46. return arr.flat.call( array );
  47. } : function( array ) {
  48. return arr.concat.apply( [], array );
  49. };
  50. var push = arr.push;
  51. var indexOf = arr.indexOf;
  52. var class2type = {};
  53. var toString = class2type.toString;
  54. var hasOwn = class2type.hasOwnProperty;
  55. var fnToString = hasOwn.toString;
  56. var ObjectFunctionString = fnToString.call( Object );
  57. var support = {};
  58. var isFunction = function isFunction( obj ) {
  59. // Support: Chrome <=57, Firefox <=52
  60. // In some browsers, typeof returns "function" for HTML <object> elements
  61. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  62. // We don't want to classify *any* DOM node as a function.
  63. // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5
  64. // Plus for old WebKit, typeof returns "function" for HTML collections
  65. // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756)
  66. return typeof obj === "function" && typeof obj.nodeType !== "number" &&
  67. typeof obj.item !== "function";
  68. };
  69. var isWindow = function isWindow( obj ) {
  70. return obj != null && obj === obj.window;
  71. };
  72. var document = window.document;
  73. var preservedScriptAttributes = {
  74. type: true,
  75. src: true,
  76. nonce: true,
  77. noModule: true
  78. };
  79. function DOMEval( code, node, doc ) {
  80. doc = doc || document;
  81. var i, val,
  82. script = doc.createElement( "script" );
  83. script.text = code;
  84. if ( node ) {
  85. for ( i in preservedScriptAttributes ) {
  86. // Support: Firefox 64+, Edge 18+
  87. // Some browsers don't support the "nonce" property on scripts.
  88. // On the other hand, just using `getAttribute` is not enough as
  89. // the `nonce` attribute is reset to an empty string whenever it
  90. // becomes browsing-context connected.
  91. // See https://github.com/whatwg/html/issues/2369
  92. // See https://html.spec.whatwg.org/#nonce-attributes
  93. // The `node.getAttribute` check was added for the sake of
  94. // `jQuery.globalEval` so that it can fake a nonce-containing node
  95. // via an object.
  96. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  97. if ( val ) {
  98. script.setAttribute( i, val );
  99. }
  100. }
  101. }
  102. doc.head.appendChild( script ).parentNode.removeChild( script );
  103. }
  104. function toType( obj ) {
  105. if ( obj == null ) {
  106. return obj + "";
  107. }
  108. // Support: Android <=2.3 only (functionish RegExp)
  109. return typeof obj === "object" || typeof obj === "function" ?
  110. class2type[ toString.call( obj ) ] || "object" :
  111. typeof obj;
  112. }
  113. /* global Symbol */
  114. // Defining this global in .eslintrc.json would create a danger of using the global
  115. // unguarded in another place, it seems safer to define global only for this module
  116. var
  117. version = "3.6.0 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/Tween,-effects/animatedSelector",
  118. // Define a local copy of jQuery
  119. jQuery = function( selector, context ) {
  120. // The jQuery object is actually just the init constructor 'enhanced'
  121. // Need init if jQuery is called (just allow error to be thrown if not included)
  122. return new jQuery.fn.init( selector, context );
  123. };
  124. jQuery.fn = jQuery.prototype = {
  125. // The current version of jQuery being used
  126. jquery: version,
  127. constructor: jQuery,
  128. // The default length of a jQuery object is 0
  129. length: 0,
  130. toArray: function() {
  131. return slice.call( this );
  132. },
  133. // Get the Nth element in the matched element set OR
  134. // Get the whole matched element set as a clean array
  135. get: function( num ) {
  136. // Return all the elements in a clean array
  137. if ( num == null ) {
  138. return slice.call( this );
  139. }
  140. // Return just the one element from the set
  141. return num < 0 ? this[ num + this.length ] : this[ num ];
  142. },
  143. // Take an array of elements and push it onto the stack
  144. // (returning the new matched element set)
  145. pushStack: function( elems ) {
  146. // Build a new jQuery matched element set
  147. var ret = jQuery.merge( this.constructor(), elems );
  148. // Add the old object onto the stack (as a reference)
  149. ret.prevObject = this;
  150. // Return the newly-formed element set
  151. return ret;
  152. },
  153. // Execute a callback for every element in the matched set.
  154. each: function( callback ) {
  155. return jQuery.each( this, callback );
  156. },
  157. map: function( callback ) {
  158. return this.pushStack( jQuery.map( this, function( elem, i ) {
  159. return callback.call( elem, i, elem );
  160. } ) );
  161. },
  162. slice: function() {
  163. return this.pushStack( slice.apply( this, arguments ) );
  164. },
  165. first: function() {
  166. return this.eq( 0 );
  167. },
  168. last: function() {
  169. return this.eq( -1 );
  170. },
  171. even: function() {
  172. return this.pushStack( jQuery.grep( this, function( _elem, i ) {
  173. return ( i + 1 ) % 2;
  174. } ) );
  175. },
  176. odd: function() {
  177. return this.pushStack( jQuery.grep( this, function( _elem, i ) {
  178. return i % 2;
  179. } ) );
  180. },
  181. eq: function( i ) {
  182. var len = this.length,
  183. j = +i + ( i < 0 ? len : 0 );
  184. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  185. },
  186. end: function() {
  187. return this.prevObject || this.constructor();
  188. },
  189. // For internal use only.
  190. // Behaves like an Array's method, not like a jQuery method.
  191. push: push,
  192. sort: arr.sort,
  193. splice: arr.splice
  194. };
  195. jQuery.extend = jQuery.fn.extend = function() {
  196. var options, name, src, copy, copyIsArray, clone,
  197. target = arguments[ 0 ] || {},
  198. i = 1,
  199. length = arguments.length,
  200. deep = false;
  201. // Handle a deep copy situation
  202. if ( typeof target === "boolean" ) {
  203. deep = target;
  204. // Skip the boolean and the target
  205. target = arguments[ i ] || {};
  206. i++;
  207. }
  208. // Handle case when target is a string or something (possible in deep copy)
  209. if ( typeof target !== "object" && !isFunction( target ) ) {
  210. target = {};
  211. }
  212. // Extend jQuery itself if only one argument is passed
  213. if ( i === length ) {
  214. target = this;
  215. i--;
  216. }
  217. for ( ; i < length; i++ ) {
  218. // Only deal with non-null/undefined values
  219. if ( ( options = arguments[ i ] ) != null ) {
  220. // Extend the base object
  221. for ( name in options ) {
  222. copy = options[ name ];
  223. // Prevent Object.prototype pollution
  224. // Prevent never-ending loop
  225. if ( name === "__proto__" || target === copy ) {
  226. continue;
  227. }
  228. // Recurse if we're merging plain objects or arrays
  229. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  230. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  231. src = target[ name ];
  232. // Ensure proper type for the source value
  233. if ( copyIsArray && !Array.isArray( src ) ) {
  234. clone = [];
  235. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  236. clone = {};
  237. } else {
  238. clone = src;
  239. }
  240. copyIsArray = false;
  241. // Never move original objects, clone them
  242. target[ name ] = jQuery.extend( deep, clone, copy );
  243. // Don't bring in undefined values
  244. } else if ( copy !== undefined ) {
  245. target[ name ] = copy;
  246. }
  247. }
  248. }
  249. }
  250. // Return the modified object
  251. return target;
  252. };
  253. jQuery.extend( {
  254. // Unique for each copy of jQuery on the page
  255. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  256. // Assume jQuery is ready without the ready module
  257. isReady: true,
  258. error: function( msg ) {
  259. throw new Error( msg );
  260. },
  261. noop: function() {},
  262. isPlainObject: function( obj ) {
  263. var proto, Ctor;
  264. // Detect obvious negatives
  265. // Use toString instead of jQuery.type to catch host objects
  266. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  267. return false;
  268. }
  269. proto = getProto( obj );
  270. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  271. if ( !proto ) {
  272. return true;
  273. }
  274. // Objects with prototype are plain iff they were constructed by a global Object function
  275. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  276. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  277. },
  278. isEmptyObject: function( obj ) {
  279. var name;
  280. for ( name in obj ) {
  281. return false;
  282. }
  283. return true;
  284. },
  285. // Evaluates a script in a provided context; falls back to the global one
  286. // if not specified.
  287. globalEval: function( code, options, doc ) {
  288. DOMEval( code, { nonce: options && options.nonce }, doc );
  289. },
  290. each: function( obj, callback ) {
  291. var length, i = 0;
  292. if ( isArrayLike( obj ) ) {
  293. length = obj.length;
  294. for ( ; i < length; i++ ) {
  295. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  296. break;
  297. }
  298. }
  299. } else {
  300. for ( i in obj ) {
  301. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  302. break;
  303. }
  304. }
  305. }
  306. return obj;
  307. },
  308. // results is for internal usage only
  309. makeArray: function( arr, results ) {
  310. var ret = results || [];
  311. if ( arr != null ) {
  312. if ( isArrayLike( Object( arr ) ) ) {
  313. jQuery.merge( ret,
  314. typeof arr === "string" ?
  315. [ arr ] : arr
  316. );
  317. } else {
  318. push.call( ret, arr );
  319. }
  320. }
  321. return ret;
  322. },
  323. inArray: function( elem, arr, i ) {
  324. return arr == null ? -1 : indexOf.call( arr, elem, i );
  325. },
  326. // Support: Android <=4.0 only, PhantomJS 1 only
  327. // push.apply(_, arraylike) throws on ancient WebKit
  328. merge: function( first, second ) {
  329. var len = +second.length,
  330. j = 0,
  331. i = first.length;
  332. for ( ; j < len; j++ ) {
  333. first[ i++ ] = second[ j ];
  334. }
  335. first.length = i;
  336. return first;
  337. },
  338. grep: function( elems, callback, invert ) {
  339. var callbackInverse,
  340. matches = [],
  341. i = 0,
  342. length = elems.length,
  343. callbackExpect = !invert;
  344. // Go through the array, only saving the items
  345. // that pass the validator function
  346. for ( ; i < length; i++ ) {
  347. callbackInverse = !callback( elems[ i ], i );
  348. if ( callbackInverse !== callbackExpect ) {
  349. matches.push( elems[ i ] );
  350. }
  351. }
  352. return matches;
  353. },
  354. // arg is for internal usage only
  355. map: function( elems, callback, arg ) {
  356. var length, value,
  357. i = 0,
  358. ret = [];
  359. // Go through the array, translating each of the items to their new values
  360. if ( isArrayLike( elems ) ) {
  361. length = elems.length;
  362. for ( ; i < length; i++ ) {
  363. value = callback( elems[ i ], i, arg );
  364. if ( value != null ) {
  365. ret.push( value );
  366. }
  367. }
  368. // Go through every key on the object,
  369. } else {
  370. for ( i in elems ) {
  371. value = callback( elems[ i ], i, arg );
  372. if ( value != null ) {
  373. ret.push( value );
  374. }
  375. }
  376. }
  377. // Flatten any nested arrays
  378. return flat( ret );
  379. },
  380. // A global GUID counter for objects
  381. guid: 1,
  382. // jQuery.support is not used in Core but other projects attach their
  383. // properties to it so it needs to exist.
  384. support: support
  385. } );
  386. if ( typeof Symbol === "function" ) {
  387. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  388. }
  389. // Populate the class2type map
  390. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  391. function( _i, name ) {
  392. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  393. } );
  394. function isArrayLike( obj ) {
  395. // Support: real iOS 8.2 only (not reproducible in simulator)
  396. // `in` check used to prevent JIT error (gh-2145)
  397. // hasOwn isn't used here due to false negatives
  398. // regarding Nodelist length in IE
  399. var length = !!obj && "length" in obj && obj.length,
  400. type = toType( obj );
  401. if ( isFunction( obj ) || isWindow( obj ) ) {
  402. return false;
  403. }
  404. return type === "array" || length === 0 ||
  405. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  406. }
  407. var Sizzle =
  408. /*!
  409. * Sizzle CSS Selector Engine v2.3.6
  410. * https://sizzlejs.com/
  411. *
  412. * Copyright JS Foundation and other contributors
  413. * Released under the MIT license
  414. * https://js.foundation/
  415. *
  416. * Date: 2021-02-16
  417. */
  418. ( function( window ) {
  419. var i,
  420. support,
  421. Expr,
  422. getText,
  423. isXML,
  424. tokenize,
  425. compile,
  426. select,
  427. outermostContext,
  428. sortInput,
  429. hasDuplicate,
  430. // Local document vars
  431. setDocument,
  432. document,
  433. docElem,
  434. documentIsHTML,
  435. rbuggyQSA,
  436. rbuggyMatches,
  437. matches,
  438. contains,
  439. // Instance-specific data
  440. expando = "sizzle" + 1 * new Date(),
  441. preferredDoc = window.document,
  442. dirruns = 0,
  443. done = 0,
  444. classCache = createCache(),
  445. tokenCache = createCache(),
  446. compilerCache = createCache(),
  447. nonnativeSelectorCache = createCache(),
  448. sortOrder = function( a, b ) {
  449. if ( a === b ) {
  450. hasDuplicate = true;
  451. }
  452. return 0;
  453. },
  454. // Instance methods
  455. hasOwn = ( {} ).hasOwnProperty,
  456. arr = [],
  457. pop = arr.pop,
  458. pushNative = arr.push,
  459. push = arr.push,
  460. slice = arr.slice,
  461. // Use a stripped-down indexOf as it's faster than native
  462. // https://jsperf.com/thor-indexof-vs-for/5
  463. indexOf = function( list, elem ) {
  464. var i = 0,
  465. len = list.length;
  466. for ( ; i < len; i++ ) {
  467. if ( list[ i ] === elem ) {
  468. return i;
  469. }
  470. }
  471. return -1;
  472. },
  473. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" +
  474. "ismap|loop|multiple|open|readonly|required|scoped",
  475. // Regular expressions
  476. // http://www.w3.org/TR/css3-selectors/#whitespace
  477. whitespace = "[\\x20\\t\\r\\n\\f]",
  478. // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
  479. identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
  480. "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
  481. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  482. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  483. // Operator (capture 2)
  484. "*([*^$|!~]?=)" + whitespace +
  485. // "Attribute values must be CSS identifiers [capture 5]
  486. // or strings [capture 3 or capture 4]"
  487. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
  488. whitespace + "*\\]",
  489. pseudos = ":(" + identifier + ")(?:\\((" +
  490. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  491. // 1. quoted (capture 3; capture 4 or capture 5)
  492. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  493. // 2. simple (capture 6)
  494. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  495. // 3. anything else (capture 2)
  496. ".*" +
  497. ")\\)|)",
  498. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  499. rwhitespace = new RegExp( whitespace + "+", "g" ),
  500. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" +
  501. whitespace + "+$", "g" ),
  502. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  503. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace +
  504. "*" ),
  505. rdescend = new RegExp( whitespace + "|>" ),
  506. rpseudo = new RegExp( pseudos ),
  507. ridentifier = new RegExp( "^" + identifier + "$" ),
  508. matchExpr = {
  509. "ID": new RegExp( "^#(" + identifier + ")" ),
  510. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  511. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  512. "ATTR": new RegExp( "^" + attributes ),
  513. "PSEUDO": new RegExp( "^" + pseudos ),
  514. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
  515. whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
  516. whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  517. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  518. // For use in libraries implementing .is()
  519. // We use this for POS matching in `select`
  520. "needsContext": new RegExp( "^" + whitespace +
  521. "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
  522. "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  523. },
  524. rhtml = /HTML$/i,
  525. rinputs = /^(?:input|select|textarea|button)$/i,
  526. rheader = /^h\d$/i,
  527. rnative = /^[^{]+\{\s*\[native \w/,
  528. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  529. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  530. rsibling = /[+~]/,
  531. // CSS escapes
  532. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  533. runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ),
  534. funescape = function( escape, nonHex ) {
  535. var high = "0x" + escape.slice( 1 ) - 0x10000;
  536. return nonHex ?
  537. // Strip the backslash prefix from a non-hex escape sequence
  538. nonHex :
  539. // Replace a hexadecimal escape sequence with the encoded Unicode code point
  540. // Support: IE <=11+
  541. // For values outside the Basic Multilingual Plane (BMP), manually construct a
  542. // surrogate pair
  543. high < 0 ?
  544. String.fromCharCode( high + 0x10000 ) :
  545. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  546. },
  547. // CSS string/identifier serialization
  548. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  549. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  550. fcssescape = function( ch, asCodePoint ) {
  551. if ( asCodePoint ) {
  552. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  553. if ( ch === "\0" ) {
  554. return "\uFFFD";
  555. }
  556. // Control characters and (dependent upon position) numbers get escaped as code points
  557. return ch.slice( 0, -1 ) + "\\" +
  558. ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  559. }
  560. // Other potentially-special ASCII characters get backslash-escaped
  561. return "\\" + ch;
  562. },
  563. // Used for iframes
  564. // See setDocument()
  565. // Removing the function wrapper causes a "Permission Denied"
  566. // error in IE
  567. unloadHandler = function() {
  568. setDocument();
  569. },
  570. inDisabledFieldset = addCombinator(
  571. function( elem ) {
  572. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  573. },
  574. { dir: "parentNode", next: "legend" }
  575. );
  576. // Optimize for push.apply( _, NodeList )
  577. try {
  578. push.apply(
  579. ( arr = slice.call( preferredDoc.childNodes ) ),
  580. preferredDoc.childNodes
  581. );
  582. // Support: Android<4.0
  583. // Detect silently failing push.apply
  584. // eslint-disable-next-line no-unused-expressions
  585. arr[ preferredDoc.childNodes.length ].nodeType;
  586. } catch ( e ) {
  587. push = { apply: arr.length ?
  588. // Leverage slice if possible
  589. function( target, els ) {
  590. pushNative.apply( target, slice.call( els ) );
  591. } :
  592. // Support: IE<9
  593. // Otherwise append directly
  594. function( target, els ) {
  595. var j = target.length,
  596. i = 0;
  597. // Can't trust NodeList.length
  598. while ( ( target[ j++ ] = els[ i++ ] ) ) {}
  599. target.length = j - 1;
  600. }
  601. };
  602. }
  603. function Sizzle( selector, context, results, seed ) {
  604. var m, i, elem, nid, match, groups, newSelector,
  605. newContext = context && context.ownerDocument,
  606. // nodeType defaults to 9, since context defaults to document
  607. nodeType = context ? context.nodeType : 9;
  608. results = results || [];
  609. // Return early from calls with invalid selector or context
  610. if ( typeof selector !== "string" || !selector ||
  611. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  612. return results;
  613. }
  614. // Try to shortcut find operations (as opposed to filters) in HTML documents
  615. if ( !seed ) {
  616. setDocument( context );
  617. context = context || document;
  618. if ( documentIsHTML ) {
  619. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  620. // (excepting DocumentFragment context, where the methods don't exist)
  621. if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
  622. // ID selector
  623. if ( ( m = match[ 1 ] ) ) {
  624. // Document context
  625. if ( nodeType === 9 ) {
  626. if ( ( elem = context.getElementById( m ) ) ) {
  627. // Support: IE, Opera, Webkit
  628. // TODO: identify versions
  629. // getElementById can match elements by name instead of ID
  630. if ( elem.id === m ) {
  631. results.push( elem );
  632. return results;
  633. }
  634. } else {
  635. return results;
  636. }
  637. // Element context
  638. } else {
  639. // Support: IE, Opera, Webkit
  640. // TODO: identify versions
  641. // getElementById can match elements by name instead of ID
  642. if ( newContext && ( elem = newContext.getElementById( m ) ) &&
  643. contains( context, elem ) &&
  644. elem.id === m ) {
  645. results.push( elem );
  646. return results;
  647. }
  648. }
  649. // Type selector
  650. } else if ( match[ 2 ] ) {
  651. push.apply( results, context.getElementsByTagName( selector ) );
  652. return results;
  653. // Class selector
  654. } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName &&
  655. context.getElementsByClassName ) {
  656. push.apply( results, context.getElementsByClassName( m ) );
  657. return results;
  658. }
  659. }
  660. // Take advantage of querySelectorAll
  661. if ( support.qsa &&
  662. !nonnativeSelectorCache[ selector + " " ] &&
  663. ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
  664. // Support: IE 8 only
  665. // Exclude object elements
  666. ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) {
  667. newSelector = selector;
  668. newContext = context;
  669. // qSA considers elements outside a scoping root when evaluating child or
  670. // descendant combinators, which is not what we want.
  671. // In such cases, we work around the behavior by prefixing every selector in the
  672. // list with an ID selector referencing the scope context.
  673. // The technique has to be used as well when a leading combinator is used
  674. // as such selectors are not recognized by querySelectorAll.
  675. // Thanks to Andrew Dupont for this technique.
  676. if ( nodeType === 1 &&
  677. ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {
  678. // Expand context for sibling selectors
  679. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  680. context;
  681. // We can use :scope instead of the ID hack if the browser
  682. // supports it & if we're not changing the context.
  683. if ( newContext !== context || !support.scope ) {
  684. // Capture the context ID, setting it first if necessary
  685. if ( ( nid = context.getAttribute( "id" ) ) ) {
  686. nid = nid.replace( rcssescape, fcssescape );
  687. } else {
  688. context.setAttribute( "id", ( nid = expando ) );
  689. }
  690. }
  691. // Prefix every selector in the list
  692. groups = tokenize( selector );
  693. i = groups.length;
  694. while ( i-- ) {
  695. groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
  696. toSelector( groups[ i ] );
  697. }
  698. newSelector = groups.join( "," );
  699. }
  700. try {
  701. push.apply( results,
  702. newContext.querySelectorAll( newSelector )
  703. );
  704. return results;
  705. } catch ( qsaError ) {
  706. nonnativeSelectorCache( selector, true );
  707. } finally {
  708. if ( nid === expando ) {
  709. context.removeAttribute( "id" );
  710. }
  711. }
  712. }
  713. }
  714. }
  715. // All others
  716. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  717. }
  718. /**
  719. * Create key-value caches of limited size
  720. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  721. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  722. * deleting the oldest entry
  723. */
  724. function createCache() {
  725. var keys = [];
  726. function cache( key, value ) {
  727. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  728. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  729. // Only keep the most recent entries
  730. delete cache[ keys.shift() ];
  731. }
  732. return ( cache[ key + " " ] = value );
  733. }
  734. return cache;
  735. }
  736. /**
  737. * Mark a function for special use by Sizzle
  738. * @param {Function} fn The function to mark
  739. */
  740. function markFunction( fn ) {
  741. fn[ expando ] = true;
  742. return fn;
  743. }
  744. /**
  745. * Support testing using an element
  746. * @param {Function} fn Passed the created element and returns a boolean result
  747. */
  748. function assert( fn ) {
  749. var el = document.createElement( "fieldset" );
  750. try {
  751. return !!fn( el );
  752. } catch ( e ) {
  753. return false;
  754. } finally {
  755. // Remove from its parent by default
  756. if ( el.parentNode ) {
  757. el.parentNode.removeChild( el );
  758. }
  759. // release memory in IE
  760. el = null;
  761. }
  762. }
  763. /**
  764. * Adds the same handler for all of the specified attrs
  765. * @param {String} attrs Pipe-separated list of attributes
  766. * @param {Function} handler The method that will be applied
  767. */
  768. function addHandle( attrs, handler ) {
  769. var arr = attrs.split( "|" ),
  770. i = arr.length;
  771. while ( i-- ) {
  772. Expr.attrHandle[ arr[ i ] ] = handler;
  773. }
  774. }
  775. /**
  776. * Checks document order of two siblings
  777. * @param {Element} a
  778. * @param {Element} b
  779. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  780. */
  781. function siblingCheck( a, b ) {
  782. var cur = b && a,
  783. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  784. a.sourceIndex - b.sourceIndex;
  785. // Use IE sourceIndex if available on both nodes
  786. if ( diff ) {
  787. return diff;
  788. }
  789. // Check if b follows a
  790. if ( cur ) {
  791. while ( ( cur = cur.nextSibling ) ) {
  792. if ( cur === b ) {
  793. return -1;
  794. }
  795. }
  796. }
  797. return a ? 1 : -1;
  798. }
  799. /**
  800. * Returns a function to use in pseudos for input types
  801. * @param {String} type
  802. */
  803. function createInputPseudo( type ) {
  804. return function( elem ) {
  805. var name = elem.nodeName.toLowerCase();
  806. return name === "input" && elem.type === type;
  807. };
  808. }
  809. /**
  810. * Returns a function to use in pseudos for buttons
  811. * @param {String} type
  812. */
  813. function createButtonPseudo( type ) {
  814. return function( elem ) {
  815. var name = elem.nodeName.toLowerCase();
  816. return ( name === "input" || name === "button" ) && elem.type === type;
  817. };
  818. }
  819. /**
  820. * Returns a function to use in pseudos for :enabled/:disabled
  821. * @param {Boolean} disabled true for :disabled; false for :enabled
  822. */
  823. function createDisabledPseudo( disabled ) {
  824. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  825. return function( elem ) {
  826. // Only certain elements can match :enabled or :disabled
  827. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  828. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  829. if ( "form" in elem ) {
  830. // Check for inherited disabledness on relevant non-disabled elements:
  831. // * listed form-associated elements in a disabled fieldset
  832. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  833. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  834. // * option elements in a disabled optgroup
  835. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  836. // All such elements have a "form" property.
  837. if ( elem.parentNode && elem.disabled === false ) {
  838. // Option elements defer to a parent optgroup if present
  839. if ( "label" in elem ) {
  840. if ( "label" in elem.parentNode ) {
  841. return elem.parentNode.disabled === disabled;
  842. } else {
  843. return elem.disabled === disabled;
  844. }
  845. }
  846. // Support: IE 6 - 11
  847. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  848. return elem.isDisabled === disabled ||
  849. // Where there is no isDisabled, check manually
  850. /* jshint -W018 */
  851. elem.isDisabled !== !disabled &&
  852. inDisabledFieldset( elem ) === disabled;
  853. }
  854. return elem.disabled === disabled;
  855. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  856. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  857. // even exist on them, let alone have a boolean value.
  858. } else if ( "label" in elem ) {
  859. return elem.disabled === disabled;
  860. }
  861. // Remaining elements are neither :enabled nor :disabled
  862. return false;
  863. };
  864. }
  865. /**
  866. * Returns a function to use in pseudos for positionals
  867. * @param {Function} fn
  868. */
  869. function createPositionalPseudo( fn ) {
  870. return markFunction( function( argument ) {
  871. argument = +argument;
  872. return markFunction( function( seed, matches ) {
  873. var j,
  874. matchIndexes = fn( [], seed.length, argument ),
  875. i = matchIndexes.length;
  876. // Match elements found at the specified indexes
  877. while ( i-- ) {
  878. if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
  879. seed[ j ] = !( matches[ j ] = seed[ j ] );
  880. }
  881. }
  882. } );
  883. } );
  884. }
  885. /**
  886. * Checks a node for validity as a Sizzle context
  887. * @param {Element|Object=} context
  888. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  889. */
  890. function testContext( context ) {
  891. return context && typeof context.getElementsByTagName !== "undefined" && context;
  892. }
  893. // Expose support vars for convenience
  894. support = Sizzle.support = {};
  895. /**
  896. * Detects XML nodes
  897. * @param {Element|Object} elem An element or a document
  898. * @returns {Boolean} True iff elem is a non-HTML XML node
  899. */
  900. isXML = Sizzle.isXML = function( elem ) {
  901. var namespace = elem && elem.namespaceURI,
  902. docElem = elem && ( elem.ownerDocument || elem ).documentElement;
  903. // Support: IE <=8
  904. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  905. // https://bugs.jquery.com/ticket/4833
  906. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  907. };
  908. /**
  909. * Sets document-related variables once based on the current document
  910. * @param {Element|Object} [doc] An element or document object to use to set the document
  911. * @returns {Object} Returns the current document
  912. */
  913. setDocument = Sizzle.setDocument = function( node ) {
  914. var hasCompare, subWindow,
  915. doc = node ? node.ownerDocument || node : preferredDoc;
  916. // Return early if doc is invalid or already selected
  917. // Support: IE 11+, Edge 17 - 18+
  918. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  919. // two documents; shallow comparisons work.
  920. // eslint-disable-next-line eqeqeq
  921. if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) {
  922. return document;
  923. }
  924. // Update global variables
  925. document = doc;
  926. docElem = document.documentElement;
  927. documentIsHTML = !isXML( document );
  928. // Support: IE 9 - 11+, Edge 12 - 18+
  929. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  930. // Support: IE 11+, Edge 17 - 18+
  931. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  932. // two documents; shallow comparisons work.
  933. // eslint-disable-next-line eqeqeq
  934. if ( preferredDoc != document &&
  935. ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
  936. // Support: IE 11, Edge
  937. if ( subWindow.addEventListener ) {
  938. subWindow.addEventListener( "unload", unloadHandler, false );
  939. // Support: IE 9 - 10 only
  940. } else if ( subWindow.attachEvent ) {
  941. subWindow.attachEvent( "onunload", unloadHandler );
  942. }
  943. }
  944. // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
  945. // Safari 4 - 5 only, Opera <=11.6 - 12.x only
  946. // IE/Edge & older browsers don't support the :scope pseudo-class.
  947. // Support: Safari 6.0 only
  948. // Safari 6.0 supports :scope but it's an alias of :root there.
  949. support.scope = assert( function( el ) {
  950. docElem.appendChild( el ).appendChild( document.createElement( "div" ) );
  951. return typeof el.querySelectorAll !== "undefined" &&
  952. !el.querySelectorAll( ":scope fieldset div" ).length;
  953. } );
  954. /* Attributes
  955. ---------------------------------------------------------------------- */
  956. // Support: IE<8
  957. // Verify that getAttribute really returns attributes and not properties
  958. // (excepting IE8 booleans)
  959. support.attributes = assert( function( el ) {
  960. el.className = "i";
  961. return !el.getAttribute( "className" );
  962. } );
  963. /* getElement(s)By*
  964. ---------------------------------------------------------------------- */
  965. // Check if getElementsByTagName("*") returns only elements
  966. support.getElementsByTagName = assert( function( el ) {
  967. el.appendChild( document.createComment( "" ) );
  968. return !el.getElementsByTagName( "*" ).length;
  969. } );
  970. // Support: IE<9
  971. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  972. // Support: IE<10
  973. // Check if getElementById returns elements by name
  974. // The broken getElementById methods don't pick up programmatically-set names,
  975. // so use a roundabout getElementsByName test
  976. support.getById = assert( function( el ) {
  977. docElem.appendChild( el ).id = expando;
  978. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  979. } );
  980. // ID filter and find
  981. if ( support.getById ) {
  982. Expr.filter[ "ID" ] = function( id ) {
  983. var attrId = id.replace( runescape, funescape );
  984. return function( elem ) {
  985. return elem.getAttribute( "id" ) === attrId;
  986. };
  987. };
  988. Expr.find[ "ID" ] = function( id, context ) {
  989. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  990. var elem = context.getElementById( id );
  991. return elem ? [ elem ] : [];
  992. }
  993. };
  994. } else {
  995. Expr.filter[ "ID" ] = function( id ) {
  996. var attrId = id.replace( runescape, funescape );
  997. return function( elem ) {
  998. var node = typeof elem.getAttributeNode !== "undefined" &&
  999. elem.getAttributeNode( "id" );
  1000. return node && node.value === attrId;
  1001. };
  1002. };
  1003. // Support: IE 6 - 7 only
  1004. // getElementById is not reliable as a find shortcut
  1005. Expr.find[ "ID" ] = function( id, context ) {
  1006. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  1007. var node, i, elems,
  1008. elem = context.getElementById( id );
  1009. if ( elem ) {
  1010. // Verify the id attribute
  1011. node = elem.getAttributeNode( "id" );
  1012. if ( node && node.value === id ) {
  1013. return [ elem ];
  1014. }
  1015. // Fall back on getElementsByName
  1016. elems = context.getElementsByName( id );
  1017. i = 0;
  1018. while ( ( elem = elems[ i++ ] ) ) {
  1019. node = elem.getAttributeNode( "id" );
  1020. if ( node && node.value === id ) {
  1021. return [ elem ];
  1022. }
  1023. }
  1024. }
  1025. return [];
  1026. }
  1027. };
  1028. }
  1029. // Tag
  1030. Expr.find[ "TAG" ] = support.getElementsByTagName ?
  1031. function( tag, context ) {
  1032. if ( typeof context.getElementsByTagName !== "undefined" ) {
  1033. return context.getElementsByTagName( tag );
  1034. // DocumentFragment nodes don't have gEBTN
  1035. } else if ( support.qsa ) {
  1036. return context.querySelectorAll( tag );
  1037. }
  1038. } :
  1039. function( tag, context ) {
  1040. var elem,
  1041. tmp = [],
  1042. i = 0,
  1043. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  1044. results = context.getElementsByTagName( tag );
  1045. // Filter out possible comments
  1046. if ( tag === "*" ) {
  1047. while ( ( elem = results[ i++ ] ) ) {
  1048. if ( elem.nodeType === 1 ) {
  1049. tmp.push( elem );
  1050. }
  1051. }
  1052. return tmp;
  1053. }
  1054. return results;
  1055. };
  1056. // Class
  1057. Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) {
  1058. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  1059. return context.getElementsByClassName( className );
  1060. }
  1061. };
  1062. /* QSA/matchesSelector
  1063. ---------------------------------------------------------------------- */
  1064. // QSA and matchesSelector support
  1065. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  1066. rbuggyMatches = [];
  1067. // qSa(:focus) reports false when true (Chrome 21)
  1068. // We allow this because of a bug in IE8/9 that throws an error
  1069. // whenever `document.activeElement` is accessed on an iframe
  1070. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  1071. // See https://bugs.jquery.com/ticket/13378
  1072. rbuggyQSA = [];
  1073. if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {
  1074. // Build QSA regex
  1075. // Regex strategy adopted from Diego Perini
  1076. assert( function( el ) {
  1077. var input;
  1078. // Select is set to empty string on purpose
  1079. // This is to test IE's treatment of not explicitly
  1080. // setting a boolean content attribute,
  1081. // since its presence should be enough
  1082. // https://bugs.jquery.com/ticket/12359
  1083. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  1084. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  1085. "<option selected=''></option></select>";
  1086. // Support: IE8, Opera 11-12.16
  1087. // Nothing should be selected when empty strings follow ^= or $= or *=
  1088. // The test attribute must be unknown in Opera but "safe" for WinRT
  1089. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  1090. if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) {
  1091. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  1092. }
  1093. // Support: IE8
  1094. // Boolean attributes and "value" are not treated correctly
  1095. if ( !el.querySelectorAll( "[selected]" ).length ) {
  1096. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1097. }
  1098. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  1099. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1100. rbuggyQSA.push( "~=" );
  1101. }
  1102. // Support: IE 11+, Edge 15 - 18+
  1103. // IE 11/Edge don't find elements on a `[name='']` query in some cases.
  1104. // Adding a temporary attribute to the document before the selection works
  1105. // around the issue.
  1106. // Interestingly, IE 10 & older don't seem to have the issue.
  1107. input = document.createElement( "input" );
  1108. input.setAttribute( "name", "" );
  1109. el.appendChild( input );
  1110. if ( !el.querySelectorAll( "[name='']" ).length ) {
  1111. rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
  1112. whitespace + "*(?:''|\"\")" );
  1113. }
  1114. // Webkit/Opera - :checked should return selected option elements
  1115. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1116. // IE8 throws error here and will not see later tests
  1117. if ( !el.querySelectorAll( ":checked" ).length ) {
  1118. rbuggyQSA.push( ":checked" );
  1119. }
  1120. // Support: Safari 8+, iOS 8+
  1121. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1122. // In-page `selector#id sibling-combinator selector` fails
  1123. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1124. rbuggyQSA.push( ".#.+[+~]" );
  1125. }
  1126. // Support: Firefox <=3.6 - 5 only
  1127. // Old Firefox doesn't throw on a badly-escaped identifier.
  1128. el.querySelectorAll( "\\\f" );
  1129. rbuggyQSA.push( "[\\r\\n\\f]" );
  1130. } );
  1131. assert( function( el ) {
  1132. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  1133. "<select disabled='disabled'><option/></select>";
  1134. // Support: Windows 8 Native Apps
  1135. // The type and name attributes are restricted during .innerHTML assignment
  1136. var input = document.createElement( "input" );
  1137. input.setAttribute( "type", "hidden" );
  1138. el.appendChild( input ).setAttribute( "name", "D" );
  1139. // Support: IE8
  1140. // Enforce case-sensitivity of name attribute
  1141. if ( el.querySelectorAll( "[name=d]" ).length ) {
  1142. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  1143. }
  1144. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1145. // IE8 throws error here and will not see later tests
  1146. if ( el.querySelectorAll( ":enabled" ).length !== 2 ) {
  1147. rbuggyQSA.push( ":enabled", ":disabled" );
  1148. }
  1149. // Support: IE9-11+
  1150. // IE's :disabled selector does not pick up the children of disabled fieldsets
  1151. docElem.appendChild( el ).disabled = true;
  1152. if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
  1153. rbuggyQSA.push( ":enabled", ":disabled" );
  1154. }
  1155. // Support: Opera 10 - 11 only
  1156. // Opera 10-11 does not throw on post-comma invalid pseudos
  1157. el.querySelectorAll( "*,:x" );
  1158. rbuggyQSA.push( ",.*:" );
  1159. } );
  1160. }
  1161. if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
  1162. docElem.webkitMatchesSelector ||
  1163. docElem.mozMatchesSelector ||
  1164. docElem.oMatchesSelector ||
  1165. docElem.msMatchesSelector ) ) ) ) {
  1166. assert( function( el ) {
  1167. // Check to see if it's possible to do matchesSelector
  1168. // on a disconnected node (IE 9)
  1169. support.disconnectedMatch = matches.call( el, "*" );
  1170. // This should fail with an exception
  1171. // Gecko does not error, returns false instead
  1172. matches.call( el, "[s!='']:x" );
  1173. rbuggyMatches.push( "!=", pseudos );
  1174. } );
  1175. }
  1176. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
  1177. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) );
  1178. /* Contains
  1179. ---------------------------------------------------------------------- */
  1180. hasCompare = rnative.test( docElem.compareDocumentPosition );
  1181. // Element contains another
  1182. // Purposefully self-exclusive
  1183. // As in, an element does not contain itself
  1184. contains = hasCompare || rnative.test( docElem.contains ) ?
  1185. function( a, b ) {
  1186. var adown = a.nodeType === 9 ? a.documentElement : a,
  1187. bup = b && b.parentNode;
  1188. return a === bup || !!( bup && bup.nodeType === 1 && (
  1189. adown.contains ?
  1190. adown.contains( bup ) :
  1191. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  1192. ) );
  1193. } :
  1194. function( a, b ) {
  1195. if ( b ) {
  1196. while ( ( b = b.parentNode ) ) {
  1197. if ( b === a ) {
  1198. return true;
  1199. }
  1200. }
  1201. }
  1202. return false;
  1203. };
  1204. /* Sorting
  1205. ---------------------------------------------------------------------- */
  1206. // Document order sorting
  1207. sortOrder = hasCompare ?
  1208. function( a, b ) {
  1209. // Flag for duplicate removal
  1210. if ( a === b ) {
  1211. hasDuplicate = true;
  1212. return 0;
  1213. }
  1214. // Sort on method existence if only one input has compareDocumentPosition
  1215. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1216. if ( compare ) {
  1217. return compare;
  1218. }
  1219. // Calculate position if both inputs belong to the same document
  1220. // Support: IE 11+, Edge 17 - 18+
  1221. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1222. // two documents; shallow comparisons work.
  1223. // eslint-disable-next-line eqeqeq
  1224. compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
  1225. a.compareDocumentPosition( b ) :
  1226. // Otherwise we know they are disconnected
  1227. 1;
  1228. // Disconnected nodes
  1229. if ( compare & 1 ||
  1230. ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {
  1231. // Choose the first element that is related to our preferred document
  1232. // Support: IE 11+, Edge 17 - 18+
  1233. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1234. // two documents; shallow comparisons work.
  1235. // eslint-disable-next-line eqeqeq
  1236. if ( a == document || a.ownerDocument == preferredDoc &&
  1237. contains( preferredDoc, a ) ) {
  1238. return -1;
  1239. }
  1240. // Support: IE 11+, Edge 17 - 18+
  1241. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1242. // two documents; shallow comparisons work.
  1243. // eslint-disable-next-line eqeqeq
  1244. if ( b == document || b.ownerDocument == preferredDoc &&
  1245. contains( preferredDoc, b ) ) {
  1246. return 1;
  1247. }
  1248. // Maintain original order
  1249. return sortInput ?
  1250. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1251. 0;
  1252. }
  1253. return compare & 4 ? -1 : 1;
  1254. } :
  1255. function( a, b ) {
  1256. // Exit early if the nodes are identical
  1257. if ( a === b ) {
  1258. hasDuplicate = true;
  1259. return 0;
  1260. }
  1261. var cur,
  1262. i = 0,
  1263. aup = a.parentNode,
  1264. bup = b.parentNode,
  1265. ap = [ a ],
  1266. bp = [ b ];
  1267. // Parentless nodes are either documents or disconnected
  1268. if ( !aup || !bup ) {
  1269. // Support: IE 11+, Edge 17 - 18+
  1270. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1271. // two documents; shallow comparisons work.
  1272. /* eslint-disable eqeqeq */
  1273. return a == document ? -1 :
  1274. b == document ? 1 :
  1275. /* eslint-enable eqeqeq */
  1276. aup ? -1 :
  1277. bup ? 1 :
  1278. sortInput ?
  1279. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1280. 0;
  1281. // If the nodes are siblings, we can do a quick check
  1282. } else if ( aup === bup ) {
  1283. return siblingCheck( a, b );
  1284. }
  1285. // Otherwise we need full lists of their ancestors for comparison
  1286. cur = a;
  1287. while ( ( cur = cur.parentNode ) ) {
  1288. ap.unshift( cur );
  1289. }
  1290. cur = b;
  1291. while ( ( cur = cur.parentNode ) ) {
  1292. bp.unshift( cur );
  1293. }
  1294. // Walk down the tree looking for a discrepancy
  1295. while ( ap[ i ] === bp[ i ] ) {
  1296. i++;
  1297. }
  1298. return i ?
  1299. // Do a sibling check if the nodes have a common ancestor
  1300. siblingCheck( ap[ i ], bp[ i ] ) :
  1301. // Otherwise nodes in our document sort first
  1302. // Support: IE 11+, Edge 17 - 18+
  1303. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1304. // two documents; shallow comparisons work.
  1305. /* eslint-disable eqeqeq */
  1306. ap[ i ] == preferredDoc ? -1 :
  1307. bp[ i ] == preferredDoc ? 1 :
  1308. /* eslint-enable eqeqeq */
  1309. 0;
  1310. };
  1311. return document;
  1312. };
  1313. Sizzle.matches = function( expr, elements ) {
  1314. return Sizzle( expr, null, null, elements );
  1315. };
  1316. Sizzle.matchesSelector = function( elem, expr ) {
  1317. setDocument( elem );
  1318. if ( support.matchesSelector && documentIsHTML &&
  1319. !nonnativeSelectorCache[ expr + " " ] &&
  1320. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  1321. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  1322. try {
  1323. var ret = matches.call( elem, expr );
  1324. // IE 9's matchesSelector returns false on disconnected nodes
  1325. if ( ret || support.disconnectedMatch ||
  1326. // As well, disconnected nodes are said to be in a document
  1327. // fragment in IE 9
  1328. elem.document && elem.document.nodeType !== 11 ) {
  1329. return ret;
  1330. }
  1331. } catch ( e ) {
  1332. nonnativeSelectorCache( expr, true );
  1333. }
  1334. }
  1335. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  1336. };
  1337. Sizzle.contains = function( context, elem ) {
  1338. // Set document vars if needed
  1339. // Support: IE 11+, Edge 17 - 18+
  1340. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1341. // two documents; shallow comparisons work.
  1342. // eslint-disable-next-line eqeqeq
  1343. if ( ( context.ownerDocument || context ) != document ) {
  1344. setDocument( context );
  1345. }
  1346. return contains( context, elem );
  1347. };
  1348. Sizzle.attr = function( elem, name ) {
  1349. // Set document vars if needed
  1350. // Support: IE 11+, Edge 17 - 18+
  1351. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1352. // two documents; shallow comparisons work.
  1353. // eslint-disable-next-line eqeqeq
  1354. if ( ( elem.ownerDocument || elem ) != document ) {
  1355. setDocument( elem );
  1356. }
  1357. var fn = Expr.attrHandle[ name.toLowerCase() ],
  1358. // Don't get fooled by Object.prototype properties (jQuery #13807)
  1359. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  1360. fn( elem, name, !documentIsHTML ) :
  1361. undefined;
  1362. return val !== undefined ?
  1363. val :
  1364. support.attributes || !documentIsHTML ?
  1365. elem.getAttribute( name ) :
  1366. ( val = elem.getAttributeNode( name ) ) && val.specified ?
  1367. val.value :
  1368. null;
  1369. };
  1370. Sizzle.escape = function( sel ) {
  1371. return ( sel + "" ).replace( rcssescape, fcssescape );
  1372. };
  1373. Sizzle.error = function( msg ) {
  1374. throw new Error( "Syntax error, unrecognized expression: " + msg );
  1375. };
  1376. /**
  1377. * Document sorting and removing duplicates
  1378. * @param {ArrayLike} results
  1379. */
  1380. Sizzle.uniqueSort = function( results ) {
  1381. var elem,
  1382. duplicates = [],
  1383. j = 0,
  1384. i = 0;
  1385. // Unless we *know* we can detect duplicates, assume their presence
  1386. hasDuplicate = !support.detectDuplicates;
  1387. sortInput = !support.sortStable && results.slice( 0 );
  1388. results.sort( sortOrder );
  1389. if ( hasDuplicate ) {
  1390. while ( ( elem = results[ i++ ] ) ) {
  1391. if ( elem === results[ i ] ) {
  1392. j = duplicates.push( i );
  1393. }
  1394. }
  1395. while ( j-- ) {
  1396. results.splice( duplicates[ j ], 1 );
  1397. }
  1398. }
  1399. // Clear input after sorting to release objects
  1400. // See https://github.com/jquery/sizzle/pull/225
  1401. sortInput = null;
  1402. return results;
  1403. };
  1404. /**
  1405. * Utility function for retrieving the text value of an array of DOM nodes
  1406. * @param {Array|Element} elem
  1407. */
  1408. getText = Sizzle.getText = function( elem ) {
  1409. var node,
  1410. ret = "",
  1411. i = 0,
  1412. nodeType = elem.nodeType;
  1413. if ( !nodeType ) {
  1414. // If no nodeType, this is expected to be an array
  1415. while ( ( node = elem[ i++ ] ) ) {
  1416. // Do not traverse comment nodes
  1417. ret += getText( node );
  1418. }
  1419. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  1420. // Use textContent for elements
  1421. // innerText usage removed for consistency of new lines (jQuery #11153)
  1422. if ( typeof elem.textContent === "string" ) {
  1423. return elem.textContent;
  1424. } else {
  1425. // Traverse its children
  1426. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1427. ret += getText( elem );
  1428. }
  1429. }
  1430. } else if ( nodeType === 3 || nodeType === 4 ) {
  1431. return elem.nodeValue;
  1432. }
  1433. // Do not include comment or processing instruction nodes
  1434. return ret;
  1435. };
  1436. Expr = Sizzle.selectors = {
  1437. // Can be adjusted by the user
  1438. cacheLength: 50,
  1439. createPseudo: markFunction,
  1440. match: matchExpr,
  1441. attrHandle: {},
  1442. find: {},
  1443. relative: {
  1444. ">": { dir: "parentNode", first: true },
  1445. " ": { dir: "parentNode" },
  1446. "+": { dir: "previousSibling", first: true },
  1447. "~": { dir: "previousSibling" }
  1448. },
  1449. preFilter: {
  1450. "ATTR": function( match ) {
  1451. match[ 1 ] = match[ 1 ].replace( runescape, funescape );
  1452. // Move the given value to match[3] whether quoted or unquoted
  1453. match[ 3 ] = ( match[ 3 ] || match[ 4 ] ||
  1454. match[ 5 ] || "" ).replace( runescape, funescape );
  1455. if ( match[ 2 ] === "~=" ) {
  1456. match[ 3 ] = " " + match[ 3 ] + " ";
  1457. }
  1458. return match.slice( 0, 4 );
  1459. },
  1460. "CHILD": function( match ) {
  1461. /* matches from matchExpr["CHILD"]
  1462. 1 type (only|nth|...)
  1463. 2 what (child|of-type)
  1464. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  1465. 4 xn-component of xn+y argument ([+-]?\d*n|)
  1466. 5 sign of xn-component
  1467. 6 x of xn-component
  1468. 7 sign of y-component
  1469. 8 y of y-component
  1470. */
  1471. match[ 1 ] = match[ 1 ].toLowerCase();
  1472. if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
  1473. // nth-* requires argument
  1474. if ( !match[ 3 ] ) {
  1475. Sizzle.error( match[ 0 ] );
  1476. }
  1477. // numeric x and y parameters for Expr.filter.CHILD
  1478. // remember that false/true cast respectively to 0/1
  1479. match[ 4 ] = +( match[ 4 ] ?
  1480. match[ 5 ] + ( match[ 6 ] || 1 ) :
  1481. 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) );
  1482. match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
  1483. // other types prohibit arguments
  1484. } else if ( match[ 3 ] ) {
  1485. Sizzle.error( match[ 0 ] );
  1486. }
  1487. return match;
  1488. },
  1489. "PSEUDO": function( match ) {
  1490. var excess,
  1491. unquoted = !match[ 6 ] && match[ 2 ];
  1492. if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) {
  1493. return null;
  1494. }
  1495. // Accept quoted arguments as-is
  1496. if ( match[ 3 ] ) {
  1497. match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
  1498. // Strip excess characters from unquoted arguments
  1499. } else if ( unquoted && rpseudo.test( unquoted ) &&
  1500. // Get excess from tokenize (recursively)
  1501. ( excess = tokenize( unquoted, true ) ) &&
  1502. // advance to the next closing parenthesis
  1503. ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
  1504. // excess is a negative index
  1505. match[ 0 ] = match[ 0 ].slice( 0, excess );
  1506. match[ 2 ] = unquoted.slice( 0, excess );
  1507. }
  1508. // Return only captures needed by the pseudo filter method (type and argument)
  1509. return match.slice( 0, 3 );
  1510. }
  1511. },
  1512. filter: {
  1513. "TAG": function( nodeNameSelector ) {
  1514. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  1515. return nodeNameSelector === "*" ?
  1516. function() {
  1517. return true;
  1518. } :
  1519. function( elem ) {
  1520. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  1521. };
  1522. },
  1523. "CLASS": function( className ) {
  1524. var pattern = classCache[ className + " " ];
  1525. return pattern ||
  1526. ( pattern = new RegExp( "(^|" + whitespace +
  1527. ")" + className + "(" + whitespace + "|$)" ) ) && classCache(
  1528. className, function( elem ) {
  1529. return pattern.test(
  1530. typeof elem.className === "string" && elem.className ||
  1531. typeof elem.getAttribute !== "undefined" &&
  1532. elem.getAttribute( "class" ) ||
  1533. ""
  1534. );
  1535. } );
  1536. },
  1537. "ATTR": function( name, operator, check ) {
  1538. return function( elem ) {
  1539. var result = Sizzle.attr( elem, name );
  1540. if ( result == null ) {
  1541. return operator === "!=";
  1542. }
  1543. if ( !operator ) {
  1544. return true;
  1545. }
  1546. result += "";
  1547. /* eslint-disable max-len */
  1548. return operator === "=" ? result === check :
  1549. operator === "!=" ? result !== check :
  1550. operator === "^=" ? check && result.indexOf( check ) === 0 :
  1551. operator === "*=" ? check && result.indexOf( check ) > -1 :
  1552. operator === "$=" ? check && result.slice( -check.length ) === check :
  1553. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  1554. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  1555. false;
  1556. /* eslint-enable max-len */
  1557. };
  1558. },
  1559. "CHILD": function( type, what, _argument, first, last ) {
  1560. var simple = type.slice( 0, 3 ) !== "nth",
  1561. forward = type.slice( -4 ) !== "last",
  1562. ofType = what === "of-type";
  1563. return first === 1 && last === 0 ?
  1564. // Shortcut for :nth-*(n)
  1565. function( elem ) {
  1566. return !!elem.parentNode;
  1567. } :
  1568. function( elem, _context, xml ) {
  1569. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  1570. dir = simple !== forward ? "nextSibling" : "previousSibling",
  1571. parent = elem.parentNode,
  1572. name = ofType && elem.nodeName.toLowerCase(),
  1573. useCache = !xml && !ofType,
  1574. diff = false;
  1575. if ( parent ) {
  1576. // :(first|last|only)-(child|of-type)
  1577. if ( simple ) {
  1578. while ( dir ) {
  1579. node = elem;
  1580. while ( ( node = node[ dir ] ) ) {
  1581. if ( ofType ?
  1582. node.nodeName.toLowerCase() === name :
  1583. node.nodeType === 1 ) {
  1584. return false;
  1585. }
  1586. }
  1587. // Reverse direction for :only-* (if we haven't yet done so)
  1588. start = dir = type === "only" && !start && "nextSibling";
  1589. }
  1590. return true;
  1591. }
  1592. start = [ forward ? parent.firstChild : parent.lastChild ];
  1593. // non-xml :nth-child(...) stores cache data on `parent`
  1594. if ( forward && useCache ) {
  1595. // Seek `elem` from a previously-cached index
  1596. // ...in a gzip-friendly way
  1597. node = parent;
  1598. outerCache = node[ expando ] || ( node[ expando ] = {} );
  1599. // Support: IE <9 only
  1600. // Defend against cloned attroperties (jQuery gh-1709)
  1601. uniqueCache = outerCache[ node.uniqueID ] ||
  1602. ( outerCache[ node.uniqueID ] = {} );
  1603. cache = uniqueCache[ type ] || [];
  1604. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1605. diff = nodeIndex && cache[ 2 ];
  1606. node = nodeIndex && parent.childNodes[ nodeIndex ];
  1607. while ( ( node = ++nodeIndex && node && node[ dir ] ||
  1608. // Fallback to seeking `elem` from the start
  1609. ( diff = nodeIndex = 0 ) || start.pop() ) ) {
  1610. // When found, cache indexes on `parent` and break
  1611. if ( node.nodeType === 1 && ++diff && node === elem ) {
  1612. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  1613. break;
  1614. }
  1615. }
  1616. } else {
  1617. // Use previously-cached element index if available
  1618. if ( useCache ) {
  1619. // ...in a gzip-friendly way
  1620. node = elem;
  1621. outerCache = node[ expando ] || ( node[ expando ] = {} );
  1622. // Support: IE <9 only
  1623. // Defend against cloned attroperties (jQuery gh-1709)
  1624. uniqueCache = outerCache[ node.uniqueID ] ||
  1625. ( outerCache[ node.uniqueID ] = {} );
  1626. cache = uniqueCache[ type ] || [];
  1627. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1628. diff = nodeIndex;
  1629. }
  1630. // xml :nth-child(...)
  1631. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  1632. if ( diff === false ) {
  1633. // Use the same loop as above to seek `elem` from the start
  1634. while ( ( node = ++nodeIndex && node && node[ dir ] ||
  1635. ( diff = nodeIndex = 0 ) || start.pop() ) ) {
  1636. if ( ( ofType ?
  1637. node.nodeName.toLowerCase() === name :
  1638. node.nodeType === 1 ) &&
  1639. ++diff ) {
  1640. // Cache the index of each encountered element
  1641. if ( useCache ) {
  1642. outerCache = node[ expando ] ||
  1643. ( node[ expando ] = {} );
  1644. // Support: IE <9 only
  1645. // Defend against cloned attroperties (jQuery gh-1709)
  1646. uniqueCache = outerCache[ node.uniqueID ] ||
  1647. ( outerCache[ node.uniqueID ] = {} );
  1648. uniqueCache[ type ] = [ dirruns, diff ];
  1649. }
  1650. if ( node === elem ) {
  1651. break;
  1652. }
  1653. }
  1654. }
  1655. }
  1656. }
  1657. // Incorporate the offset, then check against cycle size
  1658. diff -= last;
  1659. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  1660. }
  1661. };
  1662. },
  1663. "PSEUDO": function( pseudo, argument ) {
  1664. // pseudo-class names are case-insensitive
  1665. // http://www.w3.org/TR/selectors/#pseudo-classes
  1666. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  1667. // Remember that setFilters inherits from pseudos
  1668. var args,
  1669. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  1670. Sizzle.error( "unsupported pseudo: " + pseudo );
  1671. // The user may use createPseudo to indicate that
  1672. // arguments are needed to create the filter function
  1673. // just as Sizzle does
  1674. if ( fn[ expando ] ) {
  1675. return fn( argument );
  1676. }
  1677. // But maintain support for old signatures
  1678. if ( fn.length > 1 ) {
  1679. args = [ pseudo, pseudo, "", argument ];
  1680. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  1681. markFunction( function( seed, matches ) {
  1682. var idx,
  1683. matched = fn( seed, argument ),
  1684. i = matched.length;
  1685. while ( i-- ) {
  1686. idx = indexOf( seed, matched[ i ] );
  1687. seed[ idx ] = !( matches[ idx ] = matched[ i ] );
  1688. }
  1689. } ) :
  1690. function( elem ) {
  1691. return fn( elem, 0, args );
  1692. };
  1693. }
  1694. return fn;
  1695. }
  1696. },
  1697. pseudos: {
  1698. // Potentially complex pseudos
  1699. "not": markFunction( function( selector ) {
  1700. // Trim the selector passed to compile
  1701. // to avoid treating leading and trailing
  1702. // spaces as combinators
  1703. var input = [],
  1704. results = [],
  1705. matcher = compile( selector.replace( rtrim, "$1" ) );
  1706. return matcher[ expando ] ?
  1707. markFunction( function( seed, matches, _context, xml ) {
  1708. var elem,
  1709. unmatched = matcher( seed, null, xml, [] ),
  1710. i = seed.length;
  1711. // Match elements unmatched by `matcher`
  1712. while ( i-- ) {
  1713. if ( ( elem = unmatched[ i ] ) ) {
  1714. seed[ i ] = !( matches[ i ] = elem );
  1715. }
  1716. }
  1717. } ) :
  1718. function( elem, _context, xml ) {
  1719. input[ 0 ] = elem;
  1720. matcher( input, null, xml, results );
  1721. // Don't keep the element (issue #299)
  1722. input[ 0 ] = null;
  1723. return !results.pop();
  1724. };
  1725. } ),
  1726. "has": markFunction( function( selector ) {
  1727. return function( elem ) {
  1728. return Sizzle( selector, elem ).length > 0;
  1729. };
  1730. } ),
  1731. "contains": markFunction( function( text ) {
  1732. text = text.replace( runescape, funescape );
  1733. return function( elem ) {
  1734. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  1735. };
  1736. } ),
  1737. // "Whether an element is represented by a :lang() selector
  1738. // is based solely on the element's language value
  1739. // being equal to the identifier C,
  1740. // or beginning with the identifier C immediately followed by "-".
  1741. // The matching of C against the element's language value is performed case-insensitively.
  1742. // The identifier C does not have to be a valid language name."
  1743. // http://www.w3.org/TR/selectors/#lang-pseudo
  1744. "lang": markFunction( function( lang ) {
  1745. // lang value must be a valid identifier
  1746. if ( !ridentifier.test( lang || "" ) ) {
  1747. Sizzle.error( "unsupported lang: " + lang );
  1748. }
  1749. lang = lang.replace( runescape, funescape ).toLowerCase();
  1750. return function( elem ) {
  1751. var elemLang;
  1752. do {
  1753. if ( ( elemLang = documentIsHTML ?
  1754. elem.lang :
  1755. elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
  1756. elemLang = elemLang.toLowerCase();
  1757. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  1758. }
  1759. } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
  1760. return false;
  1761. };
  1762. } ),
  1763. // Miscellaneous
  1764. "target": function( elem ) {
  1765. var hash = window.location && window.location.hash;
  1766. return hash && hash.slice( 1 ) === elem.id;
  1767. },
  1768. "root": function( elem ) {
  1769. return elem === docElem;
  1770. },
  1771. "focus": function( elem ) {
  1772. return elem === document.activeElement &&
  1773. ( !document.hasFocus || document.hasFocus() ) &&
  1774. !!( elem.type || elem.href || ~elem.tabIndex );
  1775. },
  1776. // Boolean properties
  1777. "enabled": createDisabledPseudo( false ),
  1778. "disabled": createDisabledPseudo( true ),
  1779. "checked": function( elem ) {
  1780. // In CSS3, :checked should return both checked and selected elements
  1781. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1782. var nodeName = elem.nodeName.toLowerCase();
  1783. return ( nodeName === "input" && !!elem.checked ) ||
  1784. ( nodeName === "option" && !!elem.selected );
  1785. },
  1786. "selected": function( elem ) {
  1787. // Accessing this property makes selected-by-default
  1788. // options in Safari work properly
  1789. if ( elem.parentNode ) {
  1790. // eslint-disable-next-line no-unused-expressions
  1791. elem.parentNode.selectedIndex;
  1792. }
  1793. return elem.selected === true;
  1794. },
  1795. // Contents
  1796. "empty": function( elem ) {
  1797. // http://www.w3.org/TR/selectors/#empty-pseudo
  1798. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  1799. // but not by others (comment: 8; processing instruction: 7; etc.)
  1800. // nodeType < 6 works because attributes (2) do not appear as children
  1801. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1802. if ( elem.nodeType < 6 ) {
  1803. return false;
  1804. }
  1805. }
  1806. return true;
  1807. },
  1808. "parent": function( elem ) {
  1809. return !Expr.pseudos[ "empty" ]( elem );
  1810. },
  1811. // Element/input types
  1812. "header": function( elem ) {
  1813. return rheader.test( elem.nodeName );
  1814. },
  1815. "input": function( elem ) {
  1816. return rinputs.test( elem.nodeName );
  1817. },
  1818. "button": function( elem ) {
  1819. var name = elem.nodeName.toLowerCase();
  1820. return name === "input" && elem.type === "button" || name === "button";
  1821. },
  1822. "text": function( elem ) {
  1823. var attr;
  1824. return elem.nodeName.toLowerCase() === "input" &&
  1825. elem.type === "text" &&
  1826. // Support: IE<8
  1827. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  1828. ( ( attr = elem.getAttribute( "type" ) ) == null ||
  1829. attr.toLowerCase() === "text" );
  1830. },
  1831. // Position-in-collection
  1832. "first": createPositionalPseudo( function() {
  1833. return [ 0 ];
  1834. } ),
  1835. "last": createPositionalPseudo( function( _matchIndexes, length ) {
  1836. return [ length - 1 ];
  1837. } ),
  1838. "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) {
  1839. return [ argument < 0 ? argument + length : argument ];
  1840. } ),
  1841. "even": createPositionalPseudo( function( matchIndexes, length ) {
  1842. var i = 0;
  1843. for ( ; i < length; i += 2 ) {
  1844. matchIndexes.push( i );
  1845. }
  1846. return matchIndexes;
  1847. } ),
  1848. "odd": createPositionalPseudo( function( matchIndexes, length ) {
  1849. var i = 1;
  1850. for ( ; i < length; i += 2 ) {
  1851. matchIndexes.push( i );
  1852. }
  1853. return matchIndexes;
  1854. } ),
  1855. "lt": createPositionalPseudo( function( matchIndexes, length, argument ) {
  1856. var i = argument < 0 ?
  1857. argument + length :
  1858. argument > length ?
  1859. length :
  1860. argument;
  1861. for ( ; --i >= 0; ) {
  1862. matchIndexes.push( i );
  1863. }
  1864. return matchIndexes;
  1865. } ),
  1866. "gt": createPositionalPseudo( function( matchIndexes, length, argument ) {
  1867. var i = argument < 0 ? argument + length : argument;
  1868. for ( ; ++i < length; ) {
  1869. matchIndexes.push( i );
  1870. }
  1871. return matchIndexes;
  1872. } )
  1873. }
  1874. };
  1875. Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ];
  1876. // Add button/input type pseudos
  1877. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  1878. Expr.pseudos[ i ] = createInputPseudo( i );
  1879. }
  1880. for ( i in { submit: true, reset: true } ) {
  1881. Expr.pseudos[ i ] = createButtonPseudo( i );
  1882. }
  1883. // Easy API for creating new setFilters
  1884. function setFilters() {}
  1885. setFilters.prototype = Expr.filters = Expr.pseudos;
  1886. Expr.setFilters = new setFilters();
  1887. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  1888. var matched, match, tokens, type,
  1889. soFar, groups, preFilters,
  1890. cached = tokenCache[ selector + " " ];
  1891. if ( cached ) {
  1892. return parseOnly ? 0 : cached.slice( 0 );
  1893. }
  1894. soFar = selector;
  1895. groups = [];
  1896. preFilters = Expr.preFilter;
  1897. while ( soFar ) {
  1898. // Comma and first run
  1899. if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
  1900. if ( match ) {
  1901. // Don't consume trailing commas as valid
  1902. soFar = soFar.slice( match[ 0 ].length ) || soFar;
  1903. }
  1904. groups.push( ( tokens = [] ) );
  1905. }
  1906. matched = false;
  1907. // Combinators
  1908. if ( ( match = rcombinators.exec( soFar ) ) ) {
  1909. matched = match.shift();
  1910. tokens.push( {
  1911. value: matched,
  1912. // Cast descendant combinators to space
  1913. type: match[ 0 ].replace( rtrim, " " )
  1914. } );
  1915. soFar = soFar.slice( matched.length );
  1916. }
  1917. // Filters
  1918. for ( type in Expr.filter ) {
  1919. if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
  1920. ( match = preFilters[ type ]( match ) ) ) ) {
  1921. matched = match.shift();
  1922. tokens.push( {
  1923. value: matched,
  1924. type: type,
  1925. matches: match
  1926. } );
  1927. soFar = soFar.slice( matched.length );
  1928. }
  1929. }
  1930. if ( !matched ) {
  1931. break;
  1932. }
  1933. }
  1934. // Return the length of the invalid excess
  1935. // if we're just parsing
  1936. // Otherwise, throw an error or return tokens
  1937. return parseOnly ?
  1938. soFar.length :
  1939. soFar ?
  1940. Sizzle.error( selector ) :
  1941. // Cache the tokens
  1942. tokenCache( selector, groups ).slice( 0 );
  1943. };
  1944. function toSelector( tokens ) {
  1945. var i = 0,
  1946. len = tokens.length,
  1947. selector = "";
  1948. for ( ; i < len; i++ ) {
  1949. selector += tokens[ i ].value;
  1950. }
  1951. return selector;
  1952. }
  1953. function addCombinator( matcher, combinator, base ) {
  1954. var dir = combinator.dir,
  1955. skip = combinator.next,
  1956. key = skip || dir,
  1957. checkNonElements = base && key === "parentNode",
  1958. doneName = done++;
  1959. return combinator.first ?
  1960. // Check against closest ancestor/preceding element
  1961. function( elem, context, xml ) {
  1962. while ( ( elem = elem[ dir ] ) ) {
  1963. if ( elem.nodeType === 1 || checkNonElements ) {
  1964. return matcher( elem, context, xml );
  1965. }
  1966. }
  1967. return false;
  1968. } :
  1969. // Check against all ancestor/preceding elements
  1970. function( elem, context, xml ) {
  1971. var oldCache, uniqueCache, outerCache,
  1972. newCache = [ dirruns, doneName ];
  1973. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  1974. if ( xml ) {
  1975. while ( ( elem = elem[ dir ] ) ) {
  1976. if ( elem.nodeType === 1 || checkNonElements ) {
  1977. if ( matcher( elem, context, xml ) ) {
  1978. return true;
  1979. }
  1980. }
  1981. }
  1982. } else {
  1983. while ( ( elem = elem[ dir ] ) ) {
  1984. if ( elem.nodeType === 1 || checkNonElements ) {
  1985. outerCache = elem[ expando ] || ( elem[ expando ] = {} );
  1986. // Support: IE <9 only
  1987. // Defend against cloned attroperties (jQuery gh-1709)
  1988. uniqueCache = outerCache[ elem.uniqueID ] ||
  1989. ( outerCache[ elem.uniqueID ] = {} );
  1990. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  1991. elem = elem[ dir ] || elem;
  1992. } else if ( ( oldCache = uniqueCache[ key ] ) &&
  1993. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  1994. // Assign to newCache so results back-propagate to previous elements
  1995. return ( newCache[ 2 ] = oldCache[ 2 ] );
  1996. } else {
  1997. // Reuse newcache so results back-propagate to previous elements
  1998. uniqueCache[ key ] = newCache;
  1999. // A match means we're done; a fail means we have to keep checking
  2000. if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
  2001. return true;
  2002. }
  2003. }
  2004. }
  2005. }
  2006. }
  2007. return false;
  2008. };
  2009. }
  2010. function elementMatcher( matchers ) {
  2011. return matchers.length > 1 ?
  2012. function( elem, context, xml ) {
  2013. var i = matchers.length;
  2014. while ( i-- ) {
  2015. if ( !matchers[ i ]( elem, context, xml ) ) {
  2016. return false;
  2017. }
  2018. }
  2019. return true;
  2020. } :
  2021. matchers[ 0 ];
  2022. }
  2023. function multipleContexts( selector, contexts, results ) {
  2024. var i = 0,
  2025. len = contexts.length;
  2026. for ( ; i < len; i++ ) {
  2027. Sizzle( selector, contexts[ i ], results );
  2028. }
  2029. return results;
  2030. }
  2031. function condense( unmatched, map, filter, context, xml ) {
  2032. var elem,
  2033. newUnmatched = [],
  2034. i = 0,
  2035. len = unmatched.length,
  2036. mapped = map != null;
  2037. for ( ; i < len; i++ ) {
  2038. if ( ( elem = unmatched[ i ] ) ) {
  2039. if ( !filter || filter( elem, context, xml ) ) {
  2040. newUnmatched.push( elem );
  2041. if ( mapped ) {
  2042. map.push( i );
  2043. }
  2044. }
  2045. }
  2046. }
  2047. return newUnmatched;
  2048. }
  2049. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  2050. if ( postFilter && !postFilter[ expando ] ) {
  2051. postFilter = setMatcher( postFilter );
  2052. }
  2053. if ( postFinder && !postFinder[ expando ] ) {
  2054. postFinder = setMatcher( postFinder, postSelector );
  2055. }
  2056. return markFunction( function( seed, results, context, xml ) {
  2057. var temp, i, elem,
  2058. preMap = [],
  2059. postMap = [],
  2060. preexisting = results.length,
  2061. // Get initial elements from seed or context
  2062. elems = seed || multipleContexts(
  2063. selector || "*",
  2064. context.nodeType ? [ context ] : context,
  2065. []
  2066. ),
  2067. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  2068. matcherIn = preFilter && ( seed || !selector ) ?
  2069. condense( elems, preMap, preFilter, context, xml ) :
  2070. elems,
  2071. matcherOut = matcher ?
  2072. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  2073. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  2074. // ...intermediate processing is necessary
  2075. [] :
  2076. // ...otherwise use results directly
  2077. results :
  2078. matcherIn;
  2079. // Find primary matches
  2080. if ( matcher ) {
  2081. matcher( matcherIn, matcherOut, context, xml );
  2082. }
  2083. // Apply postFilter
  2084. if ( postFilter ) {
  2085. temp = condense( matcherOut, postMap );
  2086. postFilter( temp, [], context, xml );
  2087. // Un-match failing elements by moving them back to matcherIn
  2088. i = temp.length;
  2089. while ( i-- ) {
  2090. if ( ( elem = temp[ i ] ) ) {
  2091. matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
  2092. }
  2093. }
  2094. }
  2095. if ( seed ) {
  2096. if ( postFinder || preFilter ) {
  2097. if ( postFinder ) {
  2098. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  2099. temp = [];
  2100. i = matcherOut.length;
  2101. while ( i-- ) {
  2102. if ( ( elem = matcherOut[ i ] ) ) {
  2103. // Restore matcherIn since elem is not yet a final match
  2104. temp.push( ( matcherIn[ i ] = elem ) );
  2105. }
  2106. }
  2107. postFinder( null, ( matcherOut = [] ), temp, xml );
  2108. }
  2109. // Move matched elements from seed to results to keep them synchronized
  2110. i = matcherOut.length;
  2111. while ( i-- ) {
  2112. if ( ( elem = matcherOut[ i ] ) &&
  2113. ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) {
  2114. seed[ temp ] = !( results[ temp ] = elem );
  2115. }
  2116. }
  2117. }
  2118. // Add elements to results, through postFinder if defined
  2119. } else {
  2120. matcherOut = condense(
  2121. matcherOut === results ?
  2122. matcherOut.splice( preexisting, matcherOut.length ) :
  2123. matcherOut
  2124. );
  2125. if ( postFinder ) {
  2126. postFinder( null, results, matcherOut, xml );
  2127. } else {
  2128. push.apply( results, matcherOut );
  2129. }
  2130. }
  2131. } );
  2132. }
  2133. function matcherFromTokens( tokens ) {
  2134. var checkContext, matcher, j,
  2135. len = tokens.length,
  2136. leadingRelative = Expr.relative[ tokens[ 0 ].type ],
  2137. implicitRelative = leadingRelative || Expr.relative[ " " ],
  2138. i = leadingRelative ? 1 : 0,
  2139. // The foundational matcher ensures that elements are reachable from top-level context(s)
  2140. matchContext = addCombinator( function( elem ) {
  2141. return elem === checkContext;
  2142. }, implicitRelative, true ),
  2143. matchAnyContext = addCombinator( function( elem ) {
  2144. return indexOf( checkContext, elem ) > -1;
  2145. }, implicitRelative, true ),
  2146. matchers = [ function( elem, context, xml ) {
  2147. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  2148. ( checkContext = context ).nodeType ?
  2149. matchContext( elem, context, xml ) :
  2150. matchAnyContext( elem, context, xml ) );
  2151. // Avoid hanging onto element (issue #299)
  2152. checkContext = null;
  2153. return ret;
  2154. } ];
  2155. for ( ; i < len; i++ ) {
  2156. if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
  2157. matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
  2158. } else {
  2159. matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
  2160. // Return special upon seeing a positional matcher
  2161. if ( matcher[ expando ] ) {
  2162. // Find the next relative operator (if any) for proper handling
  2163. j = ++i;
  2164. for ( ; j < len; j++ ) {
  2165. if ( Expr.relative[ tokens[ j ].type ] ) {
  2166. break;
  2167. }
  2168. }
  2169. return setMatcher(
  2170. i > 1 && elementMatcher( matchers ),
  2171. i > 1 && toSelector(
  2172. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  2173. tokens
  2174. .slice( 0, i - 1 )
  2175. .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
  2176. ).replace( rtrim, "$1" ),
  2177. matcher,
  2178. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  2179. j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
  2180. j < len && toSelector( tokens )
  2181. );
  2182. }
  2183. matchers.push( matcher );
  2184. }
  2185. }
  2186. return elementMatcher( matchers );
  2187. }
  2188. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  2189. var bySet = setMatchers.length > 0,
  2190. byElement = elementMatchers.length > 0,
  2191. superMatcher = function( seed, context, xml, results, outermost ) {
  2192. var elem, j, matcher,
  2193. matchedCount = 0,
  2194. i = "0",
  2195. unmatched = seed && [],
  2196. setMatched = [],
  2197. contextBackup = outermostContext,
  2198. // We must always have either seed elements or outermost context
  2199. elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ),
  2200. // Use integer dirruns iff this is the outermost matcher
  2201. dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
  2202. len = elems.length;
  2203. if ( outermost ) {
  2204. // Support: IE 11+, Edge 17 - 18+
  2205. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  2206. // two documents; shallow comparisons work.
  2207. // eslint-disable-next-line eqeqeq
  2208. outermostContext = context == document || context || outermost;
  2209. }
  2210. // Add elements passing elementMatchers directly to results
  2211. // Support: IE<9, Safari
  2212. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  2213. for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
  2214. if ( byElement && elem ) {
  2215. j = 0;
  2216. // Support: IE 11+, Edge 17 - 18+
  2217. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  2218. // two documents; shallow comparisons work.
  2219. // eslint-disable-next-line eqeqeq
  2220. if ( !context && elem.ownerDocument != document ) {
  2221. setDocument( elem );
  2222. xml = !documentIsHTML;
  2223. }
  2224. while ( ( matcher = elementMatchers[ j++ ] ) ) {
  2225. if ( matcher( elem, context || document, xml ) ) {
  2226. results.push( elem );
  2227. break;
  2228. }
  2229. }
  2230. if ( outermost ) {
  2231. dirruns = dirrunsUnique;
  2232. }
  2233. }
  2234. // Track unmatched elements for set filters
  2235. if ( bySet ) {
  2236. // They will have gone through all possible matchers
  2237. if ( ( elem = !matcher && elem ) ) {
  2238. matchedCount--;
  2239. }
  2240. // Lengthen the array for every element, matched or not
  2241. if ( seed ) {
  2242. unmatched.push( elem );
  2243. }
  2244. }
  2245. }
  2246. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  2247. // makes the latter nonnegative.
  2248. matchedCount += i;
  2249. // Apply set filters to unmatched elements
  2250. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  2251. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  2252. // no element matchers and no seed.
  2253. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  2254. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  2255. // numerically zero.
  2256. if ( bySet && i !== matchedCount ) {
  2257. j = 0;
  2258. while ( ( matcher = setMatchers[ j++ ] ) ) {
  2259. matcher( unmatched, setMatched, context, xml );
  2260. }
  2261. if ( seed ) {
  2262. // Reintegrate element matches to eliminate the need for sorting
  2263. if ( matchedCount > 0 ) {
  2264. while ( i-- ) {
  2265. if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
  2266. setMatched[ i ] = pop.call( results );
  2267. }
  2268. }
  2269. }
  2270. // Discard index placeholder values to get only actual matches
  2271. setMatched = condense( setMatched );
  2272. }
  2273. // Add matches to results
  2274. push.apply( results, setMatched );
  2275. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2276. if ( outermost && !seed && setMatched.length > 0 &&
  2277. ( matchedCount + setMatchers.length ) > 1 ) {
  2278. Sizzle.uniqueSort( results );
  2279. }
  2280. }
  2281. // Override manipulation of globals by nested matchers
  2282. if ( outermost ) {
  2283. dirruns = dirrunsUnique;
  2284. outermostContext = contextBackup;
  2285. }
  2286. return unmatched;
  2287. };
  2288. return bySet ?
  2289. markFunction( superMatcher ) :
  2290. superMatcher;
  2291. }
  2292. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  2293. var i,
  2294. setMatchers = [],
  2295. elementMatchers = [],
  2296. cached = compilerCache[ selector + " " ];
  2297. if ( !cached ) {
  2298. // Generate a function of recursive functions that can be used to check each element
  2299. if ( !match ) {
  2300. match = tokenize( selector );
  2301. }
  2302. i = match.length;
  2303. while ( i-- ) {
  2304. cached = matcherFromTokens( match[ i ] );
  2305. if ( cached[ expando ] ) {
  2306. setMatchers.push( cached );
  2307. } else {
  2308. elementMatchers.push( cached );
  2309. }
  2310. }
  2311. // Cache the compiled function
  2312. cached = compilerCache(
  2313. selector,
  2314. matcherFromGroupMatchers( elementMatchers, setMatchers )
  2315. );
  2316. // Save selector and tokenization
  2317. cached.selector = selector;
  2318. }
  2319. return cached;
  2320. };
  2321. /**
  2322. * A low-level selection function that works with Sizzle's compiled
  2323. * selector functions
  2324. * @param {String|Function} selector A selector or a pre-compiled
  2325. * selector function built with Sizzle.compile
  2326. * @param {Element} context
  2327. * @param {Array} [results]
  2328. * @param {Array} [seed] A set of elements to match against
  2329. */
  2330. select = Sizzle.select = function( selector, context, results, seed ) {
  2331. var i, tokens, token, type, find,
  2332. compiled = typeof selector === "function" && selector,
  2333. match = !seed && tokenize( ( selector = compiled.selector || selector ) );
  2334. results = results || [];
  2335. // Try to minimize operations if there is only one selector in the list and no seed
  2336. // (the latter of which guarantees us context)
  2337. if ( match.length === 1 ) {
  2338. // Reduce context if the leading compound selector is an ID
  2339. tokens = match[ 0 ] = match[ 0 ].slice( 0 );
  2340. if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
  2341. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
  2342. context = ( Expr.find[ "ID" ]( token.matches[ 0 ]
  2343. .replace( runescape, funescape ), context ) || [] )[ 0 ];
  2344. if ( !context ) {
  2345. return results;
  2346. // Precompiled matchers will still verify ancestry, so step up a level
  2347. } else if ( compiled ) {
  2348. context = context.parentNode;
  2349. }
  2350. selector = selector.slice( tokens.shift().value.length );
  2351. }
  2352. // Fetch a seed set for right-to-left matching
  2353. i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length;
  2354. while ( i-- ) {
  2355. token = tokens[ i ];
  2356. // Abort if we hit a combinator
  2357. if ( Expr.relative[ ( type = token.type ) ] ) {
  2358. break;
  2359. }
  2360. if ( ( find = Expr.find[ type ] ) ) {
  2361. // Search, expanding context for leading sibling combinators
  2362. if ( ( seed = find(
  2363. token.matches[ 0 ].replace( runescape, funescape ),
  2364. rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) ||
  2365. context
  2366. ) ) ) {
  2367. // If seed is empty or no tokens remain, we can return early
  2368. tokens.splice( i, 1 );
  2369. selector = seed.length && toSelector( tokens );
  2370. if ( !selector ) {
  2371. push.apply( results, seed );
  2372. return results;
  2373. }
  2374. break;
  2375. }
  2376. }
  2377. }
  2378. }
  2379. // Compile and execute a filtering function if one is not provided
  2380. // Provide `match` to avoid retokenization if we modified the selector above
  2381. ( compiled || compile( selector, match ) )(
  2382. seed,
  2383. context,
  2384. !documentIsHTML,
  2385. results,
  2386. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  2387. );
  2388. return results;
  2389. };
  2390. // One-time assignments
  2391. // Sort stability
  2392. support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
  2393. // Support: Chrome 14-35+
  2394. // Always assume duplicates if they aren't passed to the comparison function
  2395. support.detectDuplicates = !!hasDuplicate;
  2396. // Initialize against the default document
  2397. setDocument();
  2398. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  2399. // Detached nodes confoundingly follow *each other*
  2400. support.sortDetached = assert( function( el ) {
  2401. // Should return 1, but returns 4 (following)
  2402. return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
  2403. } );
  2404. // Support: IE<8
  2405. // Prevent attribute/property "interpolation"
  2406. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  2407. if ( !assert( function( el ) {
  2408. el.innerHTML = "<a href='#'></a>";
  2409. return el.firstChild.getAttribute( "href" ) === "#";
  2410. } ) ) {
  2411. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  2412. if ( !isXML ) {
  2413. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  2414. }
  2415. } );
  2416. }
  2417. // Support: IE<9
  2418. // Use defaultValue in place of getAttribute("value")
  2419. if ( !support.attributes || !assert( function( el ) {
  2420. el.innerHTML = "<input/>";
  2421. el.firstChild.setAttribute( "value", "" );
  2422. return el.firstChild.getAttribute( "value" ) === "";
  2423. } ) ) {
  2424. addHandle( "value", function( elem, _name, isXML ) {
  2425. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  2426. return elem.defaultValue;
  2427. }
  2428. } );
  2429. }
  2430. // Support: IE<9
  2431. // Use getAttributeNode to fetch booleans when getAttribute lies
  2432. if ( !assert( function( el ) {
  2433. return el.getAttribute( "disabled" ) == null;
  2434. } ) ) {
  2435. addHandle( booleans, function( elem, name, isXML ) {
  2436. var val;
  2437. if ( !isXML ) {
  2438. return elem[ name ] === true ? name.toLowerCase() :
  2439. ( val = elem.getAttributeNode( name ) ) && val.specified ?
  2440. val.value :
  2441. null;
  2442. }
  2443. } );
  2444. }
  2445. return Sizzle;
  2446. } )( window );
  2447. jQuery.find = Sizzle;
  2448. jQuery.expr = Sizzle.selectors;
  2449. // Deprecated
  2450. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  2451. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  2452. jQuery.text = Sizzle.getText;
  2453. jQuery.isXMLDoc = Sizzle.isXML;
  2454. jQuery.contains = Sizzle.contains;
  2455. jQuery.escapeSelector = Sizzle.escape;
  2456. var dir = function( elem, dir, until ) {
  2457. var matched = [],
  2458. truncate = until !== undefined;
  2459. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  2460. if ( elem.nodeType === 1 ) {
  2461. if ( truncate && jQuery( elem ).is( until ) ) {
  2462. break;
  2463. }
  2464. matched.push( elem );
  2465. }
  2466. }
  2467. return matched;
  2468. };
  2469. var siblings = function( n, elem ) {
  2470. var matched = [];
  2471. for ( ; n; n = n.nextSibling ) {
  2472. if ( n.nodeType === 1 && n !== elem ) {
  2473. matched.push( n );
  2474. }
  2475. }
  2476. return matched;
  2477. };
  2478. var rneedsContext = jQuery.expr.match.needsContext;
  2479. function nodeName( elem, name ) {
  2480. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  2481. }
  2482. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  2483. // Implement the identical functionality for filter and not
  2484. function winnow( elements, qualifier, not ) {
  2485. if ( isFunction( qualifier ) ) {
  2486. return jQuery.grep( elements, function( elem, i ) {
  2487. return !!qualifier.call( elem, i, elem ) !== not;
  2488. } );
  2489. }
  2490. // Single element
  2491. if ( qualifier.nodeType ) {
  2492. return jQuery.grep( elements, function( elem ) {
  2493. return ( elem === qualifier ) !== not;
  2494. } );
  2495. }
  2496. // Arraylike of elements (jQuery, arguments, Array)
  2497. if ( typeof qualifier !== "string" ) {
  2498. return jQuery.grep( elements, function( elem ) {
  2499. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  2500. } );
  2501. }
  2502. // Filtered directly for both simple and complex selectors
  2503. return jQuery.filter( qualifier, elements, not );
  2504. }
  2505. jQuery.filter = function( expr, elems, not ) {
  2506. var elem = elems[ 0 ];
  2507. if ( not ) {
  2508. expr = ":not(" + expr + ")";
  2509. }
  2510. if ( elems.length === 1 && elem.nodeType === 1 ) {
  2511. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  2512. }
  2513. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  2514. return elem.nodeType === 1;
  2515. } ) );
  2516. };
  2517. jQuery.fn.extend( {
  2518. find: function( selector ) {
  2519. var i, ret,
  2520. len = this.length,
  2521. self = this;
  2522. if ( typeof selector !== "string" ) {
  2523. return this.pushStack( jQuery( selector ).filter( function() {
  2524. for ( i = 0; i < len; i++ ) {
  2525. if ( jQuery.contains( self[ i ], this ) ) {
  2526. return true;
  2527. }
  2528. }
  2529. } ) );
  2530. }
  2531. ret = this.pushStack( [] );
  2532. for ( i = 0; i < len; i++ ) {
  2533. jQuery.find( selector, self[ i ], ret );
  2534. }
  2535. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  2536. },
  2537. filter: function( selector ) {
  2538. return this.pushStack( winnow( this, selector || [], false ) );
  2539. },
  2540. not: function( selector ) {
  2541. return this.pushStack( winnow( this, selector || [], true ) );
  2542. },
  2543. is: function( selector ) {
  2544. return !!winnow(
  2545. this,
  2546. // If this is a positional/relative selector, check membership in the returned set
  2547. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  2548. typeof selector === "string" && rneedsContext.test( selector ) ?
  2549. jQuery( selector ) :
  2550. selector || [],
  2551. false
  2552. ).length;
  2553. }
  2554. } );
  2555. // Initialize a jQuery object
  2556. // A central reference to the root jQuery(document)
  2557. var rootjQuery,
  2558. // A simple way to check for HTML strings
  2559. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  2560. // Strict HTML recognition (#11290: must start with <)
  2561. // Shortcut simple #id case for speed
  2562. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  2563. init = jQuery.fn.init = function( selector, context, root ) {
  2564. var match, elem;
  2565. // HANDLE: $(""), $(null), $(undefined), $(false)
  2566. if ( !selector ) {
  2567. return this;
  2568. }
  2569. // Method init() accepts an alternate rootjQuery
  2570. // so migrate can support jQuery.sub (gh-2101)
  2571. root = root || rootjQuery;
  2572. // Handle HTML strings
  2573. if ( typeof selector === "string" ) {
  2574. if ( selector[ 0 ] === "<" &&
  2575. selector[ selector.length - 1 ] === ">" &&
  2576. selector.length >= 3 ) {
  2577. // Assume that strings that start and end with <> are HTML and skip the regex check
  2578. match = [ null, selector, null ];
  2579. } else {
  2580. match = rquickExpr.exec( selector );
  2581. }
  2582. // Match html or make sure no context is specified for #id
  2583. if ( match && ( match[ 1 ] || !context ) ) {
  2584. // HANDLE: $(html) -> $(array)
  2585. if ( match[ 1 ] ) {
  2586. context = context instanceof jQuery ? context[ 0 ] : context;
  2587. // Option to run scripts is true for back-compat
  2588. // Intentionally let the error be thrown if parseHTML is not present
  2589. jQuery.merge( this, jQuery.parseHTML(
  2590. match[ 1 ],
  2591. context && context.nodeType ? context.ownerDocument || context : document,
  2592. true
  2593. ) );
  2594. // HANDLE: $(html, props)
  2595. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  2596. for ( match in context ) {
  2597. // Properties of context are called as methods if possible
  2598. if ( isFunction( this[ match ] ) ) {
  2599. this[ match ]( context[ match ] );
  2600. // ...and otherwise set as attributes
  2601. } else {
  2602. this.attr( match, context[ match ] );
  2603. }
  2604. }
  2605. }
  2606. return this;
  2607. // HANDLE: $(#id)
  2608. } else {
  2609. elem = document.getElementById( match[ 2 ] );
  2610. if ( elem ) {
  2611. // Inject the element directly into the jQuery object
  2612. this[ 0 ] = elem;
  2613. this.length = 1;
  2614. }
  2615. return this;
  2616. }
  2617. // HANDLE: $(expr, $(...))
  2618. } else if ( !context || context.jquery ) {
  2619. return ( context || root ).find( selector );
  2620. // HANDLE: $(expr, context)
  2621. // (which is just equivalent to: $(context).find(expr)
  2622. } else {
  2623. return this.constructor( context ).find( selector );
  2624. }
  2625. // HANDLE: $(DOMElement)
  2626. } else if ( selector.nodeType ) {
  2627. this[ 0 ] = selector;
  2628. this.length = 1;
  2629. return this;
  2630. // HANDLE: $(function)
  2631. // Shortcut for document ready
  2632. } else if ( isFunction( selector ) ) {
  2633. return root.ready !== undefined ?
  2634. root.ready( selector ) :
  2635. // Execute immediately if ready is not present
  2636. selector( jQuery );
  2637. }
  2638. return jQuery.makeArray( selector, this );
  2639. };
  2640. // Give the init function the jQuery prototype for later instantiation
  2641. init.prototype = jQuery.fn;
  2642. // Initialize central reference
  2643. rootjQuery = jQuery( document );
  2644. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  2645. // Methods guaranteed to produce a unique set when starting from a unique set
  2646. guaranteedUnique = {
  2647. children: true,
  2648. contents: true,
  2649. next: true,
  2650. prev: true
  2651. };
  2652. jQuery.fn.extend( {
  2653. has: function( target ) {
  2654. var targets = jQuery( target, this ),
  2655. l = targets.length;
  2656. return this.filter( function() {
  2657. var i = 0;
  2658. for ( ; i < l; i++ ) {
  2659. if ( jQuery.contains( this, targets[ i ] ) ) {
  2660. return true;
  2661. }
  2662. }
  2663. } );
  2664. },
  2665. closest: function( selectors, context ) {
  2666. var cur,
  2667. i = 0,
  2668. l = this.length,
  2669. matched = [],
  2670. targets = typeof selectors !== "string" && jQuery( selectors );
  2671. // Positional selectors never match, since there's no _selection_ context
  2672. if ( !rneedsContext.test( selectors ) ) {
  2673. for ( ; i < l; i++ ) {
  2674. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  2675. // Always skip document fragments
  2676. if ( cur.nodeType < 11 && ( targets ?
  2677. targets.index( cur ) > -1 :
  2678. // Don't pass non-elements to Sizzle
  2679. cur.nodeType === 1 &&
  2680. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  2681. matched.push( cur );
  2682. break;
  2683. }
  2684. }
  2685. }
  2686. }
  2687. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  2688. },
  2689. // Determine the position of an element within the set
  2690. index: function( elem ) {
  2691. // No argument, return index in parent
  2692. if ( !elem ) {
  2693. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  2694. }
  2695. // Index in selector
  2696. if ( typeof elem === "string" ) {
  2697. return indexOf.call( jQuery( elem ), this[ 0 ] );
  2698. }
  2699. // Locate the position of the desired element
  2700. return indexOf.call( this,
  2701. // If it receives a jQuery object, the first element is used
  2702. elem.jquery ? elem[ 0 ] : elem
  2703. );
  2704. },
  2705. add: function( selector, context ) {
  2706. return this.pushStack(
  2707. jQuery.uniqueSort(
  2708. jQuery.merge( this.get(), jQuery( selector, context ) )
  2709. )
  2710. );
  2711. },
  2712. addBack: function( selector ) {
  2713. return this.add( selector == null ?
  2714. this.prevObject : this.prevObject.filter( selector )
  2715. );
  2716. }
  2717. } );
  2718. function sibling( cur, dir ) {
  2719. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  2720. return cur;
  2721. }
  2722. jQuery.each( {
  2723. parent: function( elem ) {
  2724. var parent = elem.parentNode;
  2725. return parent && parent.nodeType !== 11 ? parent : null;
  2726. },
  2727. parents: function( elem ) {
  2728. return dir( elem, "parentNode" );
  2729. },
  2730. parentsUntil: function( elem, _i, until ) {
  2731. return dir( elem, "parentNode", until );
  2732. },
  2733. next: function( elem ) {
  2734. return sibling( elem, "nextSibling" );
  2735. },
  2736. prev: function( elem ) {
  2737. return sibling( elem, "previousSibling" );
  2738. },
  2739. nextAll: function( elem ) {
  2740. return dir( elem, "nextSibling" );
  2741. },
  2742. prevAll: function( elem ) {
  2743. return dir( elem, "previousSibling" );
  2744. },
  2745. nextUntil: function( elem, _i, until ) {
  2746. return dir( elem, "nextSibling", until );
  2747. },
  2748. prevUntil: function( elem, _i, until ) {
  2749. return dir( elem, "previousSibling", until );
  2750. },
  2751. siblings: function( elem ) {
  2752. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  2753. },
  2754. children: function( elem ) {
  2755. return siblings( elem.firstChild );
  2756. },
  2757. contents: function( elem ) {
  2758. if ( elem.contentDocument != null &&
  2759. // Support: IE 11+
  2760. // <object> elements with no `data` attribute has an object
  2761. // `contentDocument` with a `null` prototype.
  2762. getProto( elem.contentDocument ) ) {
  2763. return elem.contentDocument;
  2764. }
  2765. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  2766. // Treat the template element as a regular one in browsers that
  2767. // don't support it.
  2768. if ( nodeName( elem, "template" ) ) {
  2769. elem = elem.content || elem;
  2770. }
  2771. return jQuery.merge( [], elem.childNodes );
  2772. }
  2773. }, function( name, fn ) {
  2774. jQuery.fn[ name ] = function( until, selector ) {
  2775. var matched = jQuery.map( this, fn, until );
  2776. if ( name.slice( -5 ) !== "Until" ) {
  2777. selector = until;
  2778. }
  2779. if ( selector && typeof selector === "string" ) {
  2780. matched = jQuery.filter( selector, matched );
  2781. }
  2782. if ( this.length > 1 ) {
  2783. // Remove duplicates
  2784. if ( !guaranteedUnique[ name ] ) {
  2785. jQuery.uniqueSort( matched );
  2786. }
  2787. // Reverse order for parents* and prev-derivatives
  2788. if ( rparentsprev.test( name ) ) {
  2789. matched.reverse();
  2790. }
  2791. }
  2792. return this.pushStack( matched );
  2793. };
  2794. } );
  2795. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  2796. // Convert String-formatted options into Object-formatted ones
  2797. function createOptions( options ) {
  2798. var object = {};
  2799. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  2800. object[ flag ] = true;
  2801. } );
  2802. return object;
  2803. }
  2804. /*
  2805. * Create a callback list using the following parameters:
  2806. *
  2807. * options: an optional list of space-separated options that will change how
  2808. * the callback list behaves or a more traditional option object
  2809. *
  2810. * By default a callback list will act like an event callback list and can be
  2811. * "fired" multiple times.
  2812. *
  2813. * Possible options:
  2814. *
  2815. * once: will ensure the callback list can only be fired once (like a Deferred)
  2816. *
  2817. * memory: will keep track of previous values and will call any callback added
  2818. * after the list has been fired right away with the latest "memorized"
  2819. * values (like a Deferred)
  2820. *
  2821. * unique: will ensure a callback can only be added once (no duplicate in the list)
  2822. *
  2823. * stopOnFalse: interrupt callings when a callback returns false
  2824. *
  2825. */
  2826. jQuery.Callbacks = function( options ) {
  2827. // Convert options from String-formatted to Object-formatted if needed
  2828. // (we check in cache first)
  2829. options = typeof options === "string" ?
  2830. createOptions( options ) :
  2831. jQuery.extend( {}, options );
  2832. var // Flag to know if list is currently firing
  2833. firing,
  2834. // Last fire value for non-forgettable lists
  2835. memory,
  2836. // Flag to know if list was already fired
  2837. fired,
  2838. // Flag to prevent firing
  2839. locked,
  2840. // Actual callback list
  2841. list = [],
  2842. // Queue of execution data for repeatable lists
  2843. queue = [],
  2844. // Index of currently firing callback (modified by add/remove as needed)
  2845. firingIndex = -1,
  2846. // Fire callbacks
  2847. fire = function() {
  2848. // Enforce single-firing
  2849. locked = locked || options.once;
  2850. // Execute callbacks for all pending executions,
  2851. // respecting firingIndex overrides and runtime changes
  2852. fired = firing = true;
  2853. for ( ; queue.length; firingIndex = -1 ) {
  2854. memory = queue.shift();
  2855. while ( ++firingIndex < list.length ) {
  2856. // Run callback and check for early termination
  2857. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  2858. options.stopOnFalse ) {
  2859. // Jump to end and forget the data so .add doesn't re-fire
  2860. firingIndex = list.length;
  2861. memory = false;
  2862. }
  2863. }
  2864. }
  2865. // Forget the data if we're done with it
  2866. if ( !options.memory ) {
  2867. memory = false;
  2868. }
  2869. firing = false;
  2870. // Clean up if we're done firing for good
  2871. if ( locked ) {
  2872. // Keep an empty list if we have data for future add calls
  2873. if ( memory ) {
  2874. list = [];
  2875. // Otherwise, this object is spent
  2876. } else {
  2877. list = "";
  2878. }
  2879. }
  2880. },
  2881. // Actual Callbacks object
  2882. self = {
  2883. // Add a callback or a collection of callbacks to the list
  2884. add: function() {
  2885. if ( list ) {
  2886. // If we have memory from a past run, we should fire after adding
  2887. if ( memory && !firing ) {
  2888. firingIndex = list.length - 1;
  2889. queue.push( memory );
  2890. }
  2891. ( function add( args ) {
  2892. jQuery.each( args, function( _, arg ) {
  2893. if ( isFunction( arg ) ) {
  2894. if ( !options.unique || !self.has( arg ) ) {
  2895. list.push( arg );
  2896. }
  2897. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  2898. // Inspect recursively
  2899. add( arg );
  2900. }
  2901. } );
  2902. } )( arguments );
  2903. if ( memory && !firing ) {
  2904. fire();
  2905. }
  2906. }
  2907. return this;
  2908. },
  2909. // Remove a callback from the list
  2910. remove: function() {
  2911. jQuery.each( arguments, function( _, arg ) {
  2912. var index;
  2913. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  2914. list.splice( index, 1 );
  2915. // Handle firing indexes
  2916. if ( index <= firingIndex ) {
  2917. firingIndex--;
  2918. }
  2919. }
  2920. } );
  2921. return this;
  2922. },
  2923. // Check if a given callback is in the list.
  2924. // If no argument is given, return whether or not list has callbacks attached.
  2925. has: function( fn ) {
  2926. return fn ?
  2927. jQuery.inArray( fn, list ) > -1 :
  2928. list.length > 0;
  2929. },
  2930. // Remove all callbacks from the list
  2931. empty: function() {
  2932. if ( list ) {
  2933. list = [];
  2934. }
  2935. return this;
  2936. },
  2937. // Disable .fire and .add
  2938. // Abort any current/pending executions
  2939. // Clear all callbacks and values
  2940. disable: function() {
  2941. locked = queue = [];
  2942. list = memory = "";
  2943. return this;
  2944. },
  2945. disabled: function() {
  2946. return !list;
  2947. },
  2948. // Disable .fire
  2949. // Also disable .add unless we have memory (since it would have no effect)
  2950. // Abort any pending executions
  2951. lock: function() {
  2952. locked = queue = [];
  2953. if ( !memory && !firing ) {
  2954. list = memory = "";
  2955. }
  2956. return this;
  2957. },
  2958. locked: function() {
  2959. return !!locked;
  2960. },
  2961. // Call all callbacks with the given context and arguments
  2962. fireWith: function( context, args ) {
  2963. if ( !locked ) {
  2964. args = args || [];
  2965. args = [ context, args.slice ? args.slice() : args ];
  2966. queue.push( args );
  2967. if ( !firing ) {
  2968. fire();
  2969. }
  2970. }
  2971. return this;
  2972. },
  2973. // Call all the callbacks with the given arguments
  2974. fire: function() {
  2975. self.fireWith( this, arguments );
  2976. return this;
  2977. },
  2978. // To know if the callbacks have already been called at least once
  2979. fired: function() {
  2980. return !!fired;
  2981. }
  2982. };
  2983. return self;
  2984. };
  2985. function Identity( v ) {
  2986. return v;
  2987. }
  2988. function Thrower( ex ) {
  2989. throw ex;
  2990. }
  2991. function adoptValue( value, resolve, reject, noValue ) {
  2992. var method;
  2993. try {
  2994. // Check for promise aspect first to privilege synchronous behavior
  2995. if ( value && isFunction( ( method = value.promise ) ) ) {
  2996. method.call( value ).done( resolve ).fail( reject );
  2997. // Other thenables
  2998. } else if ( value && isFunction( ( method = value.then ) ) ) {
  2999. method.call( value, resolve, reject );
  3000. // Other non-thenables
  3001. } else {
  3002. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  3003. // * false: [ value ].slice( 0 ) => resolve( value )
  3004. // * true: [ value ].slice( 1 ) => resolve()
  3005. resolve.apply( undefined, [ value ].slice( noValue ) );
  3006. }
  3007. // For Promises/A+, convert exceptions into rejections
  3008. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  3009. // Deferred#then to conditionally suppress rejection.
  3010. } catch ( value ) {
  3011. // Support: Android 4.0 only
  3012. // Strict mode functions invoked without .call/.apply get global-object context
  3013. reject.apply( undefined, [ value ] );
  3014. }
  3015. }
  3016. jQuery.extend( {
  3017. Deferred: function( func ) {
  3018. var tuples = [
  3019. // action, add listener, callbacks,
  3020. // ... .then handlers, argument index, [final state]
  3021. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  3022. jQuery.Callbacks( "memory" ), 2 ],
  3023. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  3024. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  3025. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  3026. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  3027. ],
  3028. state = "pending",
  3029. promise = {
  3030. state: function() {
  3031. return state;
  3032. },
  3033. always: function() {
  3034. deferred.done( arguments ).fail( arguments );
  3035. return this;
  3036. },
  3037. "catch": function( fn ) {
  3038. return promise.then( null, fn );
  3039. },
  3040. // Keep pipe for back-compat
  3041. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  3042. var fns = arguments;
  3043. return jQuery.Deferred( function( newDefer ) {
  3044. jQuery.each( tuples, function( _i, tuple ) {
  3045. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  3046. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  3047. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  3048. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  3049. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  3050. deferred[ tuple[ 1 ] ]( function() {
  3051. var returned = fn && fn.apply( this, arguments );
  3052. if ( returned && isFunction( returned.promise ) ) {
  3053. returned.promise()
  3054. .progress( newDefer.notify )
  3055. .done( newDefer.resolve )
  3056. .fail( newDefer.reject );
  3057. } else {
  3058. newDefer[ tuple[ 0 ] + "With" ](
  3059. this,
  3060. fn ? [ returned ] : arguments
  3061. );
  3062. }
  3063. } );
  3064. } );
  3065. fns = null;
  3066. } ).promise();
  3067. },
  3068. then: function( onFulfilled, onRejected, onProgress ) {
  3069. var maxDepth = 0;
  3070. function resolve( depth, deferred, handler, special ) {
  3071. return function() {
  3072. var that = this,
  3073. args = arguments,
  3074. mightThrow = function() {
  3075. var returned, then;
  3076. // Support: Promises/A+ section 2.3.3.3.3
  3077. // https://promisesaplus.com/#point-59
  3078. // Ignore double-resolution attempts
  3079. if ( depth < maxDepth ) {
  3080. return;
  3081. }
  3082. returned = handler.apply( that, args );
  3083. // Support: Promises/A+ section 2.3.1
  3084. // https://promisesaplus.com/#point-48
  3085. if ( returned === deferred.promise() ) {
  3086. throw new TypeError( "Thenable self-resolution" );
  3087. }
  3088. // Support: Promises/A+ sections 2.3.3.1, 3.5
  3089. // https://promisesaplus.com/#point-54
  3090. // https://promisesaplus.com/#point-75
  3091. // Retrieve `then` only once
  3092. then = returned &&
  3093. // Support: Promises/A+ section 2.3.4
  3094. // https://promisesaplus.com/#point-64
  3095. // Only check objects and functions for thenability
  3096. ( typeof returned === "object" ||
  3097. typeof returned === "function" ) &&
  3098. returned.then;
  3099. // Handle a returned thenable
  3100. if ( isFunction( then ) ) {
  3101. // Special processors (notify) just wait for resolution
  3102. if ( special ) {
  3103. then.call(
  3104. returned,
  3105. resolve( maxDepth, deferred, Identity, special ),
  3106. resolve( maxDepth, deferred, Thrower, special )
  3107. );
  3108. // Normal processors (resolve) also hook into progress
  3109. } else {
  3110. // ...and disregard older resolution values
  3111. maxDepth++;
  3112. then.call(
  3113. returned,
  3114. resolve( maxDepth, deferred, Identity, special ),
  3115. resolve( maxDepth, deferred, Thrower, special ),
  3116. resolve( maxDepth, deferred, Identity,
  3117. deferred.notifyWith )
  3118. );
  3119. }
  3120. // Handle all other returned values
  3121. } else {
  3122. // Only substitute handlers pass on context
  3123. // and multiple values (non-spec behavior)
  3124. if ( handler !== Identity ) {
  3125. that = undefined;
  3126. args = [ returned ];
  3127. }
  3128. // Process the value(s)
  3129. // Default process is resolve
  3130. ( special || deferred.resolveWith )( that, args );
  3131. }
  3132. },
  3133. // Only normal processors (resolve) catch and reject exceptions
  3134. process = special ?
  3135. mightThrow :
  3136. function() {
  3137. try {
  3138. mightThrow();
  3139. } catch ( e ) {
  3140. if ( jQuery.Deferred.exceptionHook ) {
  3141. jQuery.Deferred.exceptionHook( e,
  3142. process.stackTrace );
  3143. }
  3144. // Support: Promises/A+ section 2.3.3.3.4.1
  3145. // https://promisesaplus.com/#point-61
  3146. // Ignore post-resolution exceptions
  3147. if ( depth + 1 >= maxDepth ) {
  3148. // Only substitute handlers pass on context
  3149. // and multiple values (non-spec behavior)
  3150. if ( handler !== Thrower ) {
  3151. that = undefined;
  3152. args = [ e ];
  3153. }
  3154. deferred.rejectWith( that, args );
  3155. }
  3156. }
  3157. };
  3158. // Support: Promises/A+ section 2.3.3.3.1
  3159. // https://promisesaplus.com/#point-57
  3160. // Re-resolve promises immediately to dodge false rejection from
  3161. // subsequent errors
  3162. if ( depth ) {
  3163. process();
  3164. } else {
  3165. // Call an optional hook to record the stack, in case of exception
  3166. // since it's otherwise lost when execution goes async
  3167. if ( jQuery.Deferred.getStackHook ) {
  3168. process.stackTrace = jQuery.Deferred.getStackHook();
  3169. }
  3170. window.setTimeout( process );
  3171. }
  3172. };
  3173. }
  3174. return jQuery.Deferred( function( newDefer ) {
  3175. // progress_handlers.add( ... )
  3176. tuples[ 0 ][ 3 ].add(
  3177. resolve(
  3178. 0,
  3179. newDefer,
  3180. isFunction( onProgress ) ?
  3181. onProgress :
  3182. Identity,
  3183. newDefer.notifyWith
  3184. )
  3185. );
  3186. // fulfilled_handlers.add( ... )
  3187. tuples[ 1 ][ 3 ].add(
  3188. resolve(
  3189. 0,
  3190. newDefer,
  3191. isFunction( onFulfilled ) ?
  3192. onFulfilled :
  3193. Identity
  3194. )
  3195. );
  3196. // rejected_handlers.add( ... )
  3197. tuples[ 2 ][ 3 ].add(
  3198. resolve(
  3199. 0,
  3200. newDefer,
  3201. isFunction( onRejected ) ?
  3202. onRejected :
  3203. Thrower
  3204. )
  3205. );
  3206. } ).promise();
  3207. },
  3208. // Get a promise for this deferred
  3209. // If obj is provided, the promise aspect is added to the object
  3210. promise: function( obj ) {
  3211. return obj != null ? jQuery.extend( obj, promise ) : promise;
  3212. }
  3213. },
  3214. deferred = {};
  3215. // Add list-specific methods
  3216. jQuery.each( tuples, function( i, tuple ) {
  3217. var list = tuple[ 2 ],
  3218. stateString = tuple[ 5 ];
  3219. // promise.progress = list.add
  3220. // promise.done = list.add
  3221. // promise.fail = list.add
  3222. promise[ tuple[ 1 ] ] = list.add;
  3223. // Handle state
  3224. if ( stateString ) {
  3225. list.add(
  3226. function() {
  3227. // state = "resolved" (i.e., fulfilled)
  3228. // state = "rejected"
  3229. state = stateString;
  3230. },
  3231. // rejected_callbacks.disable
  3232. // fulfilled_callbacks.disable
  3233. tuples[ 3 - i ][ 2 ].disable,
  3234. // rejected_handlers.disable
  3235. // fulfilled_handlers.disable
  3236. tuples[ 3 - i ][ 3 ].disable,
  3237. // progress_callbacks.lock
  3238. tuples[ 0 ][ 2 ].lock,
  3239. // progress_handlers.lock
  3240. tuples[ 0 ][ 3 ].lock
  3241. );
  3242. }
  3243. // progress_handlers.fire
  3244. // fulfilled_handlers.fire
  3245. // rejected_handlers.fire
  3246. list.add( tuple[ 3 ].fire );
  3247. // deferred.notify = function() { deferred.notifyWith(...) }
  3248. // deferred.resolve = function() { deferred.resolveWith(...) }
  3249. // deferred.reject = function() { deferred.rejectWith(...) }
  3250. deferred[ tuple[ 0 ] ] = function() {
  3251. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  3252. return this;
  3253. };
  3254. // deferred.notifyWith = list.fireWith
  3255. // deferred.resolveWith = list.fireWith
  3256. // deferred.rejectWith = list.fireWith
  3257. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  3258. } );
  3259. // Make the deferred a promise
  3260. promise.promise( deferred );
  3261. // Call given func if any
  3262. if ( func ) {
  3263. func.call( deferred, deferred );
  3264. }
  3265. // All done!
  3266. return deferred;
  3267. },
  3268. // Deferred helper
  3269. when: function( singleValue ) {
  3270. var
  3271. // count of uncompleted subordinates
  3272. remaining = arguments.length,
  3273. // count of unprocessed arguments
  3274. i = remaining,
  3275. // subordinate fulfillment data
  3276. resolveContexts = Array( i ),
  3277. resolveValues = slice.call( arguments ),
  3278. // the primary Deferred
  3279. primary = jQuery.Deferred(),
  3280. // subordinate callback factory
  3281. updateFunc = function( i ) {
  3282. return function( value ) {
  3283. resolveContexts[ i ] = this;
  3284. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  3285. if ( !( --remaining ) ) {
  3286. primary.resolveWith( resolveContexts, resolveValues );
  3287. }
  3288. };
  3289. };
  3290. // Single- and empty arguments are adopted like Promise.resolve
  3291. if ( remaining <= 1 ) {
  3292. adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject,
  3293. !remaining );
  3294. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  3295. if ( primary.state() === "pending" ||
  3296. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  3297. return primary.then();
  3298. }
  3299. }
  3300. // Multiple arguments are aggregated like Promise.all array elements
  3301. while ( i-- ) {
  3302. adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject );
  3303. }
  3304. return primary.promise();
  3305. }
  3306. } );
  3307. // These usually indicate a programmer mistake during development,
  3308. // warn about them ASAP rather than swallowing them by default.
  3309. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  3310. jQuery.Deferred.exceptionHook = function( error, stack ) {
  3311. // Support: IE 8 - 9 only
  3312. // Console exists when dev tools are open, which can happen at any time
  3313. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  3314. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  3315. }
  3316. };
  3317. jQuery.readyException = function( error ) {
  3318. window.setTimeout( function() {
  3319. throw error;
  3320. } );
  3321. };
  3322. // The deferred used on DOM ready
  3323. var readyList = jQuery.Deferred();
  3324. jQuery.fn.ready = function( fn ) {
  3325. readyList
  3326. .then( fn )
  3327. // Wrap jQuery.readyException in a function so that the lookup
  3328. // happens at the time of error handling instead of callback
  3329. // registration.
  3330. .catch( function( error ) {
  3331. jQuery.readyException( error );
  3332. } );
  3333. return this;
  3334. };
  3335. jQuery.extend( {
  3336. // Is the DOM ready to be used? Set to true once it occurs.
  3337. isReady: false,
  3338. // A counter to track how many items to wait for before
  3339. // the ready event fires. See #6781
  3340. readyWait: 1,
  3341. // Handle when the DOM is ready
  3342. ready: function( wait ) {
  3343. // Abort if there are pending holds or we're already ready
  3344. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  3345. return;
  3346. }
  3347. // Remember that the DOM is ready
  3348. jQuery.isReady = true;
  3349. // If a normal DOM Ready event fired, decrement, and wait if need be
  3350. if ( wait !== true && --jQuery.readyWait > 0 ) {
  3351. return;
  3352. }
  3353. // If there are functions bound, to execute
  3354. readyList.resolveWith( document, [ jQuery ] );
  3355. }
  3356. } );
  3357. jQuery.ready.then = readyList.then;
  3358. // The ready event handler and self cleanup method
  3359. function completed() {
  3360. document.removeEventListener( "DOMContentLoaded", completed );
  3361. window.removeEventListener( "load", completed );
  3362. jQuery.ready();
  3363. }
  3364. // Catch cases where $(document).ready() is called
  3365. // after the browser event has already occurred.
  3366. // Support: IE <=9 - 10 only
  3367. // Older IE sometimes signals "interactive" too soon
  3368. if ( document.readyState === "complete" ||
  3369. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  3370. // Handle it asynchronously to allow scripts the opportunity to delay ready
  3371. window.setTimeout( jQuery.ready );
  3372. } else {
  3373. // Use the handy event callback
  3374. document.addEventListener( "DOMContentLoaded", completed );
  3375. // A fallback to window.onload, that will always work
  3376. window.addEventListener( "load", completed );
  3377. }
  3378. // Multifunctional method to get and set values of a collection
  3379. // The value/s can optionally be executed if it's a function
  3380. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  3381. var i = 0,
  3382. len = elems.length,
  3383. bulk = key == null;
  3384. // Sets many values
  3385. if ( toType( key ) === "object" ) {
  3386. chainable = true;
  3387. for ( i in key ) {
  3388. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  3389. }
  3390. // Sets one value
  3391. } else if ( value !== undefined ) {
  3392. chainable = true;
  3393. if ( !isFunction( value ) ) {
  3394. raw = true;
  3395. }
  3396. if ( bulk ) {
  3397. // Bulk operations run against the entire set
  3398. if ( raw ) {
  3399. fn.call( elems, value );
  3400. fn = null;
  3401. // ...except when executing function values
  3402. } else {
  3403. bulk = fn;
  3404. fn = function( elem, _key, value ) {
  3405. return bulk.call( jQuery( elem ), value );
  3406. };
  3407. }
  3408. }
  3409. if ( fn ) {
  3410. for ( ; i < len; i++ ) {
  3411. fn(
  3412. elems[ i ], key, raw ?
  3413. value :
  3414. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  3415. );
  3416. }
  3417. }
  3418. }
  3419. if ( chainable ) {
  3420. return elems;
  3421. }
  3422. // Gets
  3423. if ( bulk ) {
  3424. return fn.call( elems );
  3425. }
  3426. return len ? fn( elems[ 0 ], key ) : emptyGet;
  3427. };
  3428. // Matches dashed string for camelizing
  3429. var rmsPrefix = /^-ms-/,
  3430. rdashAlpha = /-([a-z])/g;
  3431. // Used by camelCase as callback to replace()
  3432. function fcamelCase( _all, letter ) {
  3433. return letter.toUpperCase();
  3434. }
  3435. // Convert dashed to camelCase; used by the css and data modules
  3436. // Support: IE <=9 - 11, Edge 12 - 15
  3437. // Microsoft forgot to hump their vendor prefix (#9572)
  3438. function camelCase( string ) {
  3439. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  3440. }
  3441. var acceptData = function( owner ) {
  3442. // Accepts only:
  3443. // - Node
  3444. // - Node.ELEMENT_NODE
  3445. // - Node.DOCUMENT_NODE
  3446. // - Object
  3447. // - Any
  3448. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  3449. };
  3450. function Data() {
  3451. this.expando = jQuery.expando + Data.uid++;
  3452. }
  3453. Data.uid = 1;
  3454. Data.prototype = {
  3455. cache: function( owner ) {
  3456. // Check if the owner object already has a cache
  3457. var value = owner[ this.expando ];
  3458. // If not, create one
  3459. if ( !value ) {
  3460. value = {};
  3461. // We can accept data for non-element nodes in modern browsers,
  3462. // but we should not, see #8335.
  3463. // Always return an empty object.
  3464. if ( acceptData( owner ) ) {
  3465. // If it is a node unlikely to be stringify-ed or looped over
  3466. // use plain assignment
  3467. if ( owner.nodeType ) {
  3468. owner[ this.expando ] = value;
  3469. // Otherwise secure it in a non-enumerable property
  3470. // configurable must be true to allow the property to be
  3471. // deleted when data is removed
  3472. } else {
  3473. Object.defineProperty( owner, this.expando, {
  3474. value: value,
  3475. configurable: true
  3476. } );
  3477. }
  3478. }
  3479. }
  3480. return value;
  3481. },
  3482. set: function( owner, data, value ) {
  3483. var prop,
  3484. cache = this.cache( owner );
  3485. // Handle: [ owner, key, value ] args
  3486. // Always use camelCase key (gh-2257)
  3487. if ( typeof data === "string" ) {
  3488. cache[ camelCase( data ) ] = value;
  3489. // Handle: [ owner, { properties } ] args
  3490. } else {
  3491. // Copy the properties one-by-one to the cache object
  3492. for ( prop in data ) {
  3493. cache[ camelCase( prop ) ] = data[ prop ];
  3494. }
  3495. }
  3496. return cache;
  3497. },
  3498. get: function( owner, key ) {
  3499. return key === undefined ?
  3500. this.cache( owner ) :
  3501. // Always use camelCase key (gh-2257)
  3502. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  3503. },
  3504. access: function( owner, key, value ) {
  3505. // In cases where either:
  3506. //
  3507. // 1. No key was specified
  3508. // 2. A string key was specified, but no value provided
  3509. //
  3510. // Take the "read" path and allow the get method to determine
  3511. // which value to return, respectively either:
  3512. //
  3513. // 1. The entire cache object
  3514. // 2. The data stored at the key
  3515. //
  3516. if ( key === undefined ||
  3517. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  3518. return this.get( owner, key );
  3519. }
  3520. // When the key is not a string, or both a key and value
  3521. // are specified, set or extend (existing objects) with either:
  3522. //
  3523. // 1. An object of properties
  3524. // 2. A key and value
  3525. //
  3526. this.set( owner, key, value );
  3527. // Since the "set" path can have two possible entry points
  3528. // return the expected data based on which path was taken[*]
  3529. return value !== undefined ? value : key;
  3530. },
  3531. remove: function( owner, key ) {
  3532. var i,
  3533. cache = owner[ this.expando ];
  3534. if ( cache === undefined ) {
  3535. return;
  3536. }
  3537. if ( key !== undefined ) {
  3538. // Support array or space separated string of keys
  3539. if ( Array.isArray( key ) ) {
  3540. // If key is an array of keys...
  3541. // We always set camelCase keys, so remove that.
  3542. key = key.map( camelCase );
  3543. } else {
  3544. key = camelCase( key );
  3545. // If a key with the spaces exists, use it.
  3546. // Otherwise, create an array by matching non-whitespace
  3547. key = key in cache ?
  3548. [ key ] :
  3549. ( key.match( rnothtmlwhite ) || [] );
  3550. }
  3551. i = key.length;
  3552. while ( i-- ) {
  3553. delete cache[ key[ i ] ];
  3554. }
  3555. }
  3556. // Remove the expando if there's no more data
  3557. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  3558. // Support: Chrome <=35 - 45
  3559. // Webkit & Blink performance suffers when deleting properties
  3560. // from DOM nodes, so set to undefined instead
  3561. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  3562. if ( owner.nodeType ) {
  3563. owner[ this.expando ] = undefined;
  3564. } else {
  3565. delete owner[ this.expando ];
  3566. }
  3567. }
  3568. },
  3569. hasData: function( owner ) {
  3570. var cache = owner[ this.expando ];
  3571. return cache !== undefined && !jQuery.isEmptyObject( cache );
  3572. }
  3573. };
  3574. var dataPriv = new Data();
  3575. var dataUser = new Data();
  3576. // Implementation Summary
  3577. //
  3578. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  3579. // 2. Improve the module's maintainability by reducing the storage
  3580. // paths to a single mechanism.
  3581. // 3. Use the same single mechanism to support "private" and "user" data.
  3582. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  3583. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  3584. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  3585. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  3586. rmultiDash = /[A-Z]/g;
  3587. function getData( data ) {
  3588. if ( data === "true" ) {
  3589. return true;
  3590. }
  3591. if ( data === "false" ) {
  3592. return false;
  3593. }
  3594. if ( data === "null" ) {
  3595. return null;
  3596. }
  3597. // Only convert to a number if it doesn't change the string
  3598. if ( data === +data + "" ) {
  3599. return +data;
  3600. }
  3601. if ( rbrace.test( data ) ) {
  3602. return JSON.parse( data );
  3603. }
  3604. return data;
  3605. }
  3606. function dataAttr( elem, key, data ) {
  3607. var name;
  3608. // If nothing was found internally, try to fetch any
  3609. // data from the HTML5 data-* attribute
  3610. if ( data === undefined && elem.nodeType === 1 ) {
  3611. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  3612. data = elem.getAttribute( name );
  3613. if ( typeof data === "string" ) {
  3614. try {
  3615. data = getData( data );
  3616. } catch ( e ) {}
  3617. // Make sure we set the data so it isn't changed later
  3618. dataUser.set( elem, key, data );
  3619. } else {
  3620. data = undefined;
  3621. }
  3622. }
  3623. return data;
  3624. }
  3625. jQuery.extend( {
  3626. hasData: function( elem ) {
  3627. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  3628. },
  3629. data: function( elem, name, data ) {
  3630. return dataUser.access( elem, name, data );
  3631. },
  3632. removeData: function( elem, name ) {
  3633. dataUser.remove( elem, name );
  3634. },
  3635. // TODO: Now that all calls to _data and _removeData have been replaced
  3636. // with direct calls to dataPriv methods, these can be deprecated.
  3637. _data: function( elem, name, data ) {
  3638. return dataPriv.access( elem, name, data );
  3639. },
  3640. _removeData: function( elem, name ) {
  3641. dataPriv.remove( elem, name );
  3642. }
  3643. } );
  3644. jQuery.fn.extend( {
  3645. data: function( key, value ) {
  3646. var i, name, data,
  3647. elem = this[ 0 ],
  3648. attrs = elem && elem.attributes;
  3649. // Gets all values
  3650. if ( key === undefined ) {
  3651. if ( this.length ) {
  3652. data = dataUser.get( elem );
  3653. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  3654. i = attrs.length;
  3655. while ( i-- ) {
  3656. // Support: IE 11 only
  3657. // The attrs elements can be null (#14894)
  3658. if ( attrs[ i ] ) {
  3659. name = attrs[ i ].name;
  3660. if ( name.indexOf( "data-" ) === 0 ) {
  3661. name = camelCase( name.slice( 5 ) );
  3662. dataAttr( elem, name, data[ name ] );
  3663. }
  3664. }
  3665. }
  3666. dataPriv.set( elem, "hasDataAttrs", true );
  3667. }
  3668. }
  3669. return data;
  3670. }
  3671. // Sets multiple values
  3672. if ( typeof key === "object" ) {
  3673. return this.each( function() {
  3674. dataUser.set( this, key );
  3675. } );
  3676. }
  3677. return access( this, function( value ) {
  3678. var data;
  3679. // The calling jQuery object (element matches) is not empty
  3680. // (and therefore has an element appears at this[ 0 ]) and the
  3681. // `value` parameter was not undefined. An empty jQuery object
  3682. // will result in `undefined` for elem = this[ 0 ] which will
  3683. // throw an exception if an attempt to read a data cache is made.
  3684. if ( elem && value === undefined ) {
  3685. // Attempt to get data from the cache
  3686. // The key will always be camelCased in Data
  3687. data = dataUser.get( elem, key );
  3688. if ( data !== undefined ) {
  3689. return data;
  3690. }
  3691. // Attempt to "discover" the data in
  3692. // HTML5 custom data-* attrs
  3693. data = dataAttr( elem, key );
  3694. if ( data !== undefined ) {
  3695. return data;
  3696. }
  3697. // We tried really hard, but the data doesn't exist.
  3698. return;
  3699. }
  3700. // Set the data...
  3701. this.each( function() {
  3702. // We always store the camelCased key
  3703. dataUser.set( this, key, value );
  3704. } );
  3705. }, null, value, arguments.length > 1, null, true );
  3706. },
  3707. removeData: function( key ) {
  3708. return this.each( function() {
  3709. dataUser.remove( this, key );
  3710. } );
  3711. }
  3712. } );
  3713. jQuery.extend( {
  3714. queue: function( elem, type, data ) {
  3715. var queue;
  3716. if ( elem ) {
  3717. type = ( type || "fx" ) + "queue";
  3718. queue = dataPriv.get( elem, type );
  3719. // Speed up dequeue by getting out quickly if this is just a lookup
  3720. if ( data ) {
  3721. if ( !queue || Array.isArray( data ) ) {
  3722. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  3723. } else {
  3724. queue.push( data );
  3725. }
  3726. }
  3727. return queue || [];
  3728. }
  3729. },
  3730. dequeue: function( elem, type ) {
  3731. type = type || "fx";
  3732. var queue = jQuery.queue( elem, type ),
  3733. startLength = queue.length,
  3734. fn = queue.shift(),
  3735. hooks = jQuery._queueHooks( elem, type ),
  3736. next = function() {
  3737. jQuery.dequeue( elem, type );
  3738. };
  3739. // If the fx queue is dequeued, always remove the progress sentinel
  3740. if ( fn === "inprogress" ) {
  3741. fn = queue.shift();
  3742. startLength--;
  3743. }
  3744. if ( fn ) {
  3745. // Add a progress sentinel to prevent the fx queue from being
  3746. // automatically dequeued
  3747. if ( type === "fx" ) {
  3748. queue.unshift( "inprogress" );
  3749. }
  3750. // Clear up the last queue stop function
  3751. delete hooks.stop;
  3752. fn.call( elem, next, hooks );
  3753. }
  3754. if ( !startLength && hooks ) {
  3755. hooks.empty.fire();
  3756. }
  3757. },
  3758. // Not public - generate a queueHooks object, or return the current one
  3759. _queueHooks: function( elem, type ) {
  3760. var key = type + "queueHooks";
  3761. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  3762. empty: jQuery.Callbacks( "once memory" ).add( function() {
  3763. dataPriv.remove( elem, [ type + "queue", key ] );
  3764. } )
  3765. } );
  3766. }
  3767. } );
  3768. jQuery.fn.extend( {
  3769. queue: function( type, data ) {
  3770. var setter = 2;
  3771. if ( typeof type !== "string" ) {
  3772. data = type;
  3773. type = "fx";
  3774. setter--;
  3775. }
  3776. if ( arguments.length < setter ) {
  3777. return jQuery.queue( this[ 0 ], type );
  3778. }
  3779. return data === undefined ?
  3780. this :
  3781. this.each( function() {
  3782. var queue = jQuery.queue( this, type, data );
  3783. // Ensure a hooks for this queue
  3784. jQuery._queueHooks( this, type );
  3785. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  3786. jQuery.dequeue( this, type );
  3787. }
  3788. } );
  3789. },
  3790. dequeue: function( type ) {
  3791. return this.each( function() {
  3792. jQuery.dequeue( this, type );
  3793. } );
  3794. },
  3795. clearQueue: function( type ) {
  3796. return this.queue( type || "fx", [] );
  3797. },
  3798. // Get a promise resolved when queues of a certain type
  3799. // are emptied (fx is the type by default)
  3800. promise: function( type, obj ) {
  3801. var tmp,
  3802. count = 1,
  3803. defer = jQuery.Deferred(),
  3804. elements = this,
  3805. i = this.length,
  3806. resolve = function() {
  3807. if ( !( --count ) ) {
  3808. defer.resolveWith( elements, [ elements ] );
  3809. }
  3810. };
  3811. if ( typeof type !== "string" ) {
  3812. obj = type;
  3813. type = undefined;
  3814. }
  3815. type = type || "fx";
  3816. while ( i-- ) {
  3817. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  3818. if ( tmp && tmp.empty ) {
  3819. count++;
  3820. tmp.empty.add( resolve );
  3821. }
  3822. }
  3823. resolve();
  3824. return defer.promise( obj );
  3825. }
  3826. } );
  3827. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  3828. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  3829. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  3830. var documentElement = document.documentElement;
  3831. var isAttached = function( elem ) {
  3832. return jQuery.contains( elem.ownerDocument, elem );
  3833. },
  3834. composed = { composed: true };
  3835. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  3836. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  3837. // Support: iOS 10.0-10.2 only
  3838. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  3839. // leading to errors. We need to check for `getRootNode`.
  3840. if ( documentElement.getRootNode ) {
  3841. isAttached = function( elem ) {
  3842. return jQuery.contains( elem.ownerDocument, elem ) ||
  3843. elem.getRootNode( composed ) === elem.ownerDocument;
  3844. };
  3845. }
  3846. var isHiddenWithinTree = function( elem, el ) {
  3847. // isHiddenWithinTree might be called from jQuery#filter function;
  3848. // in that case, element will be second argument
  3849. elem = el || elem;
  3850. // Inline style trumps all
  3851. return elem.style.display === "none" ||
  3852. elem.style.display === "" &&
  3853. // Otherwise, check computed style
  3854. // Support: Firefox <=43 - 45
  3855. // Disconnected elements can have computed display: none, so first confirm that elem is
  3856. // in the document.
  3857. isAttached( elem ) &&
  3858. jQuery.css( elem, "display" ) === "none";
  3859. };
  3860. function adjustCSS( elem, prop, valueParts, tween ) {
  3861. var adjusted, scale,
  3862. maxIterations = 20,
  3863. currentValue = tween ?
  3864. function() {
  3865. return tween.cur();
  3866. } :
  3867. function() {
  3868. return jQuery.css( elem, prop, "" );
  3869. },
  3870. initial = currentValue(),
  3871. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  3872. // Starting value computation is required for potential unit mismatches
  3873. initialInUnit = elem.nodeType &&
  3874. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  3875. rcssNum.exec( jQuery.css( elem, prop ) );
  3876. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  3877. // Support: Firefox <=54
  3878. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  3879. initial = initial / 2;
  3880. // Trust units reported by jQuery.css
  3881. unit = unit || initialInUnit[ 3 ];
  3882. // Iteratively approximate from a nonzero starting point
  3883. initialInUnit = +initial || 1;
  3884. while ( maxIterations-- ) {
  3885. // Evaluate and update our best guess (doubling guesses that zero out).
  3886. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  3887. jQuery.style( elem, prop, initialInUnit + unit );
  3888. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  3889. maxIterations = 0;
  3890. }
  3891. initialInUnit = initialInUnit / scale;
  3892. }
  3893. initialInUnit = initialInUnit * 2;
  3894. jQuery.style( elem, prop, initialInUnit + unit );
  3895. // Make sure we update the tween properties later on
  3896. valueParts = valueParts || [];
  3897. }
  3898. if ( valueParts ) {
  3899. initialInUnit = +initialInUnit || +initial || 0;
  3900. // Apply relative offset (+=/-=) if specified
  3901. adjusted = valueParts[ 1 ] ?
  3902. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  3903. +valueParts[ 2 ];
  3904. if ( tween ) {
  3905. tween.unit = unit;
  3906. tween.start = initialInUnit;
  3907. tween.end = adjusted;
  3908. }
  3909. }
  3910. return adjusted;
  3911. }
  3912. var defaultDisplayMap = {};
  3913. function getDefaultDisplay( elem ) {
  3914. var temp,
  3915. doc = elem.ownerDocument,
  3916. nodeName = elem.nodeName,
  3917. display = defaultDisplayMap[ nodeName ];
  3918. if ( display ) {
  3919. return display;
  3920. }
  3921. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  3922. display = jQuery.css( temp, "display" );
  3923. temp.parentNode.removeChild( temp );
  3924. if ( display === "none" ) {
  3925. display = "block";
  3926. }
  3927. defaultDisplayMap[ nodeName ] = display;
  3928. return display;
  3929. }
  3930. function showHide( elements, show ) {
  3931. var display, elem,
  3932. values = [],
  3933. index = 0,
  3934. length = elements.length;
  3935. // Determine new display value for elements that need to change
  3936. for ( ; index < length; index++ ) {
  3937. elem = elements[ index ];
  3938. if ( !elem.style ) {
  3939. continue;
  3940. }
  3941. display = elem.style.display;
  3942. if ( show ) {
  3943. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  3944. // check is required in this first loop unless we have a nonempty display value (either
  3945. // inline or about-to-be-restored)
  3946. if ( display === "none" ) {
  3947. values[ index ] = dataPriv.get( elem, "display" ) || null;
  3948. if ( !values[ index ] ) {
  3949. elem.style.display = "";
  3950. }
  3951. }
  3952. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  3953. values[ index ] = getDefaultDisplay( elem );
  3954. }
  3955. } else {
  3956. if ( display !== "none" ) {
  3957. values[ index ] = "none";
  3958. // Remember what we're overwriting
  3959. dataPriv.set( elem, "display", display );
  3960. }
  3961. }
  3962. }
  3963. // Set the display of the elements in a second loop to avoid constant reflow
  3964. for ( index = 0; index < length; index++ ) {
  3965. if ( values[ index ] != null ) {
  3966. elements[ index ].style.display = values[ index ];
  3967. }
  3968. }
  3969. return elements;
  3970. }
  3971. jQuery.fn.extend( {
  3972. show: function() {
  3973. return showHide( this, true );
  3974. },
  3975. hide: function() {
  3976. return showHide( this );
  3977. },
  3978. toggle: function( state ) {
  3979. if ( typeof state === "boolean" ) {
  3980. return state ? this.show() : this.hide();
  3981. }
  3982. return this.each( function() {
  3983. if ( isHiddenWithinTree( this ) ) {
  3984. jQuery( this ).show();
  3985. } else {
  3986. jQuery( this ).hide();
  3987. }
  3988. } );
  3989. }
  3990. } );
  3991. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  3992. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  3993. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  3994. ( function() {
  3995. var fragment = document.createDocumentFragment(),
  3996. div = fragment.appendChild( document.createElement( "div" ) ),
  3997. input = document.createElement( "input" );
  3998. // Support: Android 4.0 - 4.3 only
  3999. // Check state lost if the name is set (#11217)
  4000. // Support: Windows Web Apps (WWA)
  4001. // `name` and `type` must use .setAttribute for WWA (#14901)
  4002. input.setAttribute( "type", "radio" );
  4003. input.setAttribute( "checked", "checked" );
  4004. input.setAttribute( "name", "t" );
  4005. div.appendChild( input );
  4006. // Support: Android <=4.1 only
  4007. // Older WebKit doesn't clone checked state correctly in fragments
  4008. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  4009. // Support: IE <=11 only
  4010. // Make sure textarea (and checkbox) defaultValue is properly cloned
  4011. div.innerHTML = "<textarea>x</textarea>";
  4012. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  4013. // Support: IE <=9 only
  4014. // IE <=9 replaces <option> tags with their contents when inserted outside of
  4015. // the select element.
  4016. div.innerHTML = "<option></option>";
  4017. support.option = !!div.lastChild;
  4018. } )();
  4019. // We have to close these tags to support XHTML (#13200)
  4020. var wrapMap = {
  4021. // XHTML parsers do not magically insert elements in the
  4022. // same way that tag soup parsers do. So we cannot shorten
  4023. // this by omitting <tbody> or other required elements.
  4024. thead: [ 1, "<table>", "</table>" ],
  4025. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  4026. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  4027. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  4028. _default: [ 0, "", "" ]
  4029. };
  4030. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  4031. wrapMap.th = wrapMap.td;
  4032. // Support: IE <=9 only
  4033. if ( !support.option ) {
  4034. wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
  4035. }
  4036. function getAll( context, tag ) {
  4037. // Support: IE <=9 - 11 only
  4038. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  4039. var ret;
  4040. if ( typeof context.getElementsByTagName !== "undefined" ) {
  4041. ret = context.getElementsByTagName( tag || "*" );
  4042. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  4043. ret = context.querySelectorAll( tag || "*" );
  4044. } else {
  4045. ret = [];
  4046. }
  4047. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  4048. return jQuery.merge( [ context ], ret );
  4049. }
  4050. return ret;
  4051. }
  4052. // Mark scripts as having already been evaluated
  4053. function setGlobalEval( elems, refElements ) {
  4054. var i = 0,
  4055. l = elems.length;
  4056. for ( ; i < l; i++ ) {
  4057. dataPriv.set(
  4058. elems[ i ],
  4059. "globalEval",
  4060. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  4061. );
  4062. }
  4063. }
  4064. var rhtml = /<|&#?\w+;/;
  4065. function buildFragment( elems, context, scripts, selection, ignored ) {
  4066. var elem, tmp, tag, wrap, attached, j,
  4067. fragment = context.createDocumentFragment(),
  4068. nodes = [],
  4069. i = 0,
  4070. l = elems.length;
  4071. for ( ; i < l; i++ ) {
  4072. elem = elems[ i ];
  4073. if ( elem || elem === 0 ) {
  4074. // Add nodes directly
  4075. if ( toType( elem ) === "object" ) {
  4076. // Support: Android <=4.0 only, PhantomJS 1 only
  4077. // push.apply(_, arraylike) throws on ancient WebKit
  4078. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  4079. // Convert non-html into a text node
  4080. } else if ( !rhtml.test( elem ) ) {
  4081. nodes.push( context.createTextNode( elem ) );
  4082. // Convert html into DOM nodes
  4083. } else {
  4084. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  4085. // Deserialize a standard representation
  4086. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  4087. wrap = wrapMap[ tag ] || wrapMap._default;
  4088. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  4089. // Descend through wrappers to the right content
  4090. j = wrap[ 0 ];
  4091. while ( j-- ) {
  4092. tmp = tmp.lastChild;
  4093. }
  4094. // Support: Android <=4.0 only, PhantomJS 1 only
  4095. // push.apply(_, arraylike) throws on ancient WebKit
  4096. jQuery.merge( nodes, tmp.childNodes );
  4097. // Remember the top-level container
  4098. tmp = fragment.firstChild;
  4099. // Ensure the created nodes are orphaned (#12392)
  4100. tmp.textContent = "";
  4101. }
  4102. }
  4103. }
  4104. // Remove wrapper from fragment
  4105. fragment.textContent = "";
  4106. i = 0;
  4107. while ( ( elem = nodes[ i++ ] ) ) {
  4108. // Skip elements already in the context collection (trac-4087)
  4109. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  4110. if ( ignored ) {
  4111. ignored.push( elem );
  4112. }
  4113. continue;
  4114. }
  4115. attached = isAttached( elem );
  4116. // Append to fragment
  4117. tmp = getAll( fragment.appendChild( elem ), "script" );
  4118. // Preserve script evaluation history
  4119. if ( attached ) {
  4120. setGlobalEval( tmp );
  4121. }
  4122. // Capture executables
  4123. if ( scripts ) {
  4124. j = 0;
  4125. while ( ( elem = tmp[ j++ ] ) ) {
  4126. if ( rscriptType.test( elem.type || "" ) ) {
  4127. scripts.push( elem );
  4128. }
  4129. }
  4130. }
  4131. }
  4132. return fragment;
  4133. }
  4134. var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  4135. function returnTrue() {
  4136. return true;
  4137. }
  4138. function returnFalse() {
  4139. return false;
  4140. }
  4141. // Support: IE <=9 - 11+
  4142. // focus() and blur() are asynchronous, except when they are no-op.
  4143. // So expect focus to be synchronous when the element is already active,
  4144. // and blur to be synchronous when the element is not already active.
  4145. // (focus and blur are always synchronous in other supported browsers,
  4146. // this just defines when we can count on it).
  4147. function expectSync( elem, type ) {
  4148. return ( elem === safeActiveElement() ) === ( type === "focus" );
  4149. }
  4150. // Support: IE <=9 only
  4151. // Accessing document.activeElement can throw unexpectedly
  4152. // https://bugs.jquery.com/ticket/13393
  4153. function safeActiveElement() {
  4154. try {
  4155. return document.activeElement;
  4156. } catch ( err ) { }
  4157. }
  4158. function on( elem, types, selector, data, fn, one ) {
  4159. var origFn, type;
  4160. // Types can be a map of types/handlers
  4161. if ( typeof types === "object" ) {
  4162. // ( types-Object, selector, data )
  4163. if ( typeof selector !== "string" ) {
  4164. // ( types-Object, data )
  4165. data = data || selector;
  4166. selector = undefined;
  4167. }
  4168. for ( type in types ) {
  4169. on( elem, type, selector, data, types[ type ], one );
  4170. }
  4171. return elem;
  4172. }
  4173. if ( data == null && fn == null ) {
  4174. // ( types, fn )
  4175. fn = selector;
  4176. data = selector = undefined;
  4177. } else if ( fn == null ) {
  4178. if ( typeof selector === "string" ) {
  4179. // ( types, selector, fn )
  4180. fn = data;
  4181. data = undefined;
  4182. } else {
  4183. // ( types, data, fn )
  4184. fn = data;
  4185. data = selector;
  4186. selector = undefined;
  4187. }
  4188. }
  4189. if ( fn === false ) {
  4190. fn = returnFalse;
  4191. } else if ( !fn ) {
  4192. return elem;
  4193. }
  4194. if ( one === 1 ) {
  4195. origFn = fn;
  4196. fn = function( event ) {
  4197. // Can use an empty set, since event contains the info
  4198. jQuery().off( event );
  4199. return origFn.apply( this, arguments );
  4200. };
  4201. // Use same guid so caller can remove using origFn
  4202. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  4203. }
  4204. return elem.each( function() {
  4205. jQuery.event.add( this, types, fn, data, selector );
  4206. } );
  4207. }
  4208. /*
  4209. * Helper functions for managing events -- not part of the public interface.
  4210. * Props to Dean Edwards' addEvent library for many of the ideas.
  4211. */
  4212. jQuery.event = {
  4213. global: {},
  4214. add: function( elem, types, handler, data, selector ) {
  4215. var handleObjIn, eventHandle, tmp,
  4216. events, t, handleObj,
  4217. special, handlers, type, namespaces, origType,
  4218. elemData = dataPriv.get( elem );
  4219. // Only attach events to objects that accept data
  4220. if ( !acceptData( elem ) ) {
  4221. return;
  4222. }
  4223. // Caller can pass in an object of custom data in lieu of the handler
  4224. if ( handler.handler ) {
  4225. handleObjIn = handler;
  4226. handler = handleObjIn.handler;
  4227. selector = handleObjIn.selector;
  4228. }
  4229. // Ensure that invalid selectors throw exceptions at attach time
  4230. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  4231. if ( selector ) {
  4232. jQuery.find.matchesSelector( documentElement, selector );
  4233. }
  4234. // Make sure that the handler has a unique ID, used to find/remove it later
  4235. if ( !handler.guid ) {
  4236. handler.guid = jQuery.guid++;
  4237. }
  4238. // Init the element's event structure and main handler, if this is the first
  4239. if ( !( events = elemData.events ) ) {
  4240. events = elemData.events = Object.create( null );
  4241. }
  4242. if ( !( eventHandle = elemData.handle ) ) {
  4243. eventHandle = elemData.handle = function( e ) {
  4244. // Discard the second event of a jQuery.event.trigger() and
  4245. // when an event is called after a page has unloaded
  4246. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  4247. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  4248. };
  4249. }
  4250. // Handle multiple events separated by a space
  4251. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4252. t = types.length;
  4253. while ( t-- ) {
  4254. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4255. type = origType = tmp[ 1 ];
  4256. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4257. // There *must* be a type, no attaching namespace-only handlers
  4258. if ( !type ) {
  4259. continue;
  4260. }
  4261. // If event changes its type, use the special event handlers for the changed type
  4262. special = jQuery.event.special[ type ] || {};
  4263. // If selector defined, determine special event api type, otherwise given type
  4264. type = ( selector ? special.delegateType : special.bindType ) || type;
  4265. // Update special based on newly reset type
  4266. special = jQuery.event.special[ type ] || {};
  4267. // handleObj is passed to all event handlers
  4268. handleObj = jQuery.extend( {
  4269. type: type,
  4270. origType: origType,
  4271. data: data,
  4272. handler: handler,
  4273. guid: handler.guid,
  4274. selector: selector,
  4275. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  4276. namespace: namespaces.join( "." )
  4277. }, handleObjIn );
  4278. // Init the event handler queue if we're the first
  4279. if ( !( handlers = events[ type ] ) ) {
  4280. handlers = events[ type ] = [];
  4281. handlers.delegateCount = 0;
  4282. // Only use addEventListener if the special events handler returns false
  4283. if ( !special.setup ||
  4284. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  4285. if ( elem.addEventListener ) {
  4286. elem.addEventListener( type, eventHandle );
  4287. }
  4288. }
  4289. }
  4290. if ( special.add ) {
  4291. special.add.call( elem, handleObj );
  4292. if ( !handleObj.handler.guid ) {
  4293. handleObj.handler.guid = handler.guid;
  4294. }
  4295. }
  4296. // Add to the element's handler list, delegates in front
  4297. if ( selector ) {
  4298. handlers.splice( handlers.delegateCount++, 0, handleObj );
  4299. } else {
  4300. handlers.push( handleObj );
  4301. }
  4302. // Keep track of which events have ever been used, for event optimization
  4303. jQuery.event.global[ type ] = true;
  4304. }
  4305. },
  4306. // Detach an event or set of events from an element
  4307. remove: function( elem, types, handler, selector, mappedTypes ) {
  4308. var j, origCount, tmp,
  4309. events, t, handleObj,
  4310. special, handlers, type, namespaces, origType,
  4311. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  4312. if ( !elemData || !( events = elemData.events ) ) {
  4313. return;
  4314. }
  4315. // Once for each type.namespace in types; type may be omitted
  4316. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4317. t = types.length;
  4318. while ( t-- ) {
  4319. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4320. type = origType = tmp[ 1 ];
  4321. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4322. // Unbind all events (on this namespace, if provided) for the element
  4323. if ( !type ) {
  4324. for ( type in events ) {
  4325. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  4326. }
  4327. continue;
  4328. }
  4329. special = jQuery.event.special[ type ] || {};
  4330. type = ( selector ? special.delegateType : special.bindType ) || type;
  4331. handlers = events[ type ] || [];
  4332. tmp = tmp[ 2 ] &&
  4333. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  4334. // Remove matching events
  4335. origCount = j = handlers.length;
  4336. while ( j-- ) {
  4337. handleObj = handlers[ j ];
  4338. if ( ( mappedTypes || origType === handleObj.origType ) &&
  4339. ( !handler || handler.guid === handleObj.guid ) &&
  4340. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  4341. ( !selector || selector === handleObj.selector ||
  4342. selector === "**" && handleObj.selector ) ) {
  4343. handlers.splice( j, 1 );
  4344. if ( handleObj.selector ) {
  4345. handlers.delegateCount--;
  4346. }
  4347. if ( special.remove ) {
  4348. special.remove.call( elem, handleObj );
  4349. }
  4350. }
  4351. }
  4352. // Remove generic event handler if we removed something and no more handlers exist
  4353. // (avoids potential for endless recursion during removal of special event handlers)
  4354. if ( origCount && !handlers.length ) {
  4355. if ( !special.teardown ||
  4356. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  4357. jQuery.removeEvent( elem, type, elemData.handle );
  4358. }
  4359. delete events[ type ];
  4360. }
  4361. }
  4362. // Remove data and the expando if it's no longer used
  4363. if ( jQuery.isEmptyObject( events ) ) {
  4364. dataPriv.remove( elem, "handle events" );
  4365. }
  4366. },
  4367. dispatch: function( nativeEvent ) {
  4368. var i, j, ret, matched, handleObj, handlerQueue,
  4369. args = new Array( arguments.length ),
  4370. // Make a writable jQuery.Event from the native event object
  4371. event = jQuery.event.fix( nativeEvent ),
  4372. handlers = (
  4373. dataPriv.get( this, "events" ) || Object.create( null )
  4374. )[ event.type ] || [],
  4375. special = jQuery.event.special[ event.type ] || {};
  4376. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  4377. args[ 0 ] = event;
  4378. for ( i = 1; i < arguments.length; i++ ) {
  4379. args[ i ] = arguments[ i ];
  4380. }
  4381. event.delegateTarget = this;
  4382. // Call the preDispatch hook for the mapped type, and let it bail if desired
  4383. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  4384. return;
  4385. }
  4386. // Determine handlers
  4387. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  4388. // Run delegates first; they may want to stop propagation beneath us
  4389. i = 0;
  4390. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  4391. event.currentTarget = matched.elem;
  4392. j = 0;
  4393. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  4394. !event.isImmediatePropagationStopped() ) {
  4395. // If the event is namespaced, then each handler is only invoked if it is
  4396. // specially universal or its namespaces are a superset of the event's.
  4397. if ( !event.rnamespace || handleObj.namespace === false ||
  4398. event.rnamespace.test( handleObj.namespace ) ) {
  4399. event.handleObj = handleObj;
  4400. event.data = handleObj.data;
  4401. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  4402. handleObj.handler ).apply( matched.elem, args );
  4403. if ( ret !== undefined ) {
  4404. if ( ( event.result = ret ) === false ) {
  4405. event.preventDefault();
  4406. event.stopPropagation();
  4407. }
  4408. }
  4409. }
  4410. }
  4411. }
  4412. // Call the postDispatch hook for the mapped type
  4413. if ( special.postDispatch ) {
  4414. special.postDispatch.call( this, event );
  4415. }
  4416. return event.result;
  4417. },
  4418. handlers: function( event, handlers ) {
  4419. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  4420. handlerQueue = [],
  4421. delegateCount = handlers.delegateCount,
  4422. cur = event.target;
  4423. // Find delegate handlers
  4424. if ( delegateCount &&
  4425. // Support: IE <=9
  4426. // Black-hole SVG <use> instance trees (trac-13180)
  4427. cur.nodeType &&
  4428. // Support: Firefox <=42
  4429. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  4430. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  4431. // Support: IE 11 only
  4432. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  4433. !( event.type === "click" && event.button >= 1 ) ) {
  4434. for ( ; cur !== this; cur = cur.parentNode || this ) {
  4435. // Don't check non-elements (#13208)
  4436. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  4437. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  4438. matchedHandlers = [];
  4439. matchedSelectors = {};
  4440. for ( i = 0; i < delegateCount; i++ ) {
  4441. handleObj = handlers[ i ];
  4442. // Don't conflict with Object.prototype properties (#13203)
  4443. sel = handleObj.selector + " ";
  4444. if ( matchedSelectors[ sel ] === undefined ) {
  4445. matchedSelectors[ sel ] = handleObj.needsContext ?
  4446. jQuery( sel, this ).index( cur ) > -1 :
  4447. jQuery.find( sel, this, null, [ cur ] ).length;
  4448. }
  4449. if ( matchedSelectors[ sel ] ) {
  4450. matchedHandlers.push( handleObj );
  4451. }
  4452. }
  4453. if ( matchedHandlers.length ) {
  4454. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  4455. }
  4456. }
  4457. }
  4458. }
  4459. // Add the remaining (directly-bound) handlers
  4460. cur = this;
  4461. if ( delegateCount < handlers.length ) {
  4462. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  4463. }
  4464. return handlerQueue;
  4465. },
  4466. addProp: function( name, hook ) {
  4467. Object.defineProperty( jQuery.Event.prototype, name, {
  4468. enumerable: true,
  4469. configurable: true,
  4470. get: isFunction( hook ) ?
  4471. function() {
  4472. if ( this.originalEvent ) {
  4473. return hook( this.originalEvent );
  4474. }
  4475. } :
  4476. function() {
  4477. if ( this.originalEvent ) {
  4478. return this.originalEvent[ name ];
  4479. }
  4480. },
  4481. set: function( value ) {
  4482. Object.defineProperty( this, name, {
  4483. enumerable: true,
  4484. configurable: true,
  4485. writable: true,
  4486. value: value
  4487. } );
  4488. }
  4489. } );
  4490. },
  4491. fix: function( originalEvent ) {
  4492. return originalEvent[ jQuery.expando ] ?
  4493. originalEvent :
  4494. new jQuery.Event( originalEvent );
  4495. },
  4496. special: {
  4497. load: {
  4498. // Prevent triggered image.load events from bubbling to window.load
  4499. noBubble: true
  4500. },
  4501. click: {
  4502. // Utilize native event to ensure correct state for checkable inputs
  4503. setup: function( data ) {
  4504. // For mutual compressibility with _default, replace `this` access with a local var.
  4505. // `|| data` is dead code meant only to preserve the variable through minification.
  4506. var el = this || data;
  4507. // Claim the first handler
  4508. if ( rcheckableType.test( el.type ) &&
  4509. el.click && nodeName( el, "input" ) ) {
  4510. // dataPriv.set( el, "click", ... )
  4511. leverageNative( el, "click", returnTrue );
  4512. }
  4513. // Return false to allow normal processing in the caller
  4514. return false;
  4515. },
  4516. trigger: function( data ) {
  4517. // For mutual compressibility with _default, replace `this` access with a local var.
  4518. // `|| data` is dead code meant only to preserve the variable through minification.
  4519. var el = this || data;
  4520. // Force setup before triggering a click
  4521. if ( rcheckableType.test( el.type ) &&
  4522. el.click && nodeName( el, "input" ) ) {
  4523. leverageNative( el, "click" );
  4524. }
  4525. // Return non-false to allow normal event-path propagation
  4526. return true;
  4527. },
  4528. // For cross-browser consistency, suppress native .click() on links
  4529. // Also prevent it if we're currently inside a leveraged native-event stack
  4530. _default: function( event ) {
  4531. var target = event.target;
  4532. return rcheckableType.test( target.type ) &&
  4533. target.click && nodeName( target, "input" ) &&
  4534. dataPriv.get( target, "click" ) ||
  4535. nodeName( target, "a" );
  4536. }
  4537. },
  4538. beforeunload: {
  4539. postDispatch: function( event ) {
  4540. // Support: Firefox 20+
  4541. // Firefox doesn't alert if the returnValue field is not set.
  4542. if ( event.result !== undefined && event.originalEvent ) {
  4543. event.originalEvent.returnValue = event.result;
  4544. }
  4545. }
  4546. }
  4547. }
  4548. };
  4549. // Ensure the presence of an event listener that handles manually-triggered
  4550. // synthetic events by interrupting progress until reinvoked in response to
  4551. // *native* events that it fires directly, ensuring that state changes have
  4552. // already occurred before other listeners are invoked.
  4553. function leverageNative( el, type, expectSync ) {
  4554. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  4555. if ( !expectSync ) {
  4556. if ( dataPriv.get( el, type ) === undefined ) {
  4557. jQuery.event.add( el, type, returnTrue );
  4558. }
  4559. return;
  4560. }
  4561. // Register the controller as a special universal handler for all event namespaces
  4562. dataPriv.set( el, type, false );
  4563. jQuery.event.add( el, type, {
  4564. namespace: false,
  4565. handler: function( event ) {
  4566. var notAsync, result,
  4567. saved = dataPriv.get( this, type );
  4568. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  4569. // Interrupt processing of the outer synthetic .trigger()ed event
  4570. // Saved data should be false in such cases, but might be a leftover capture object
  4571. // from an async native handler (gh-4350)
  4572. if ( !saved.length ) {
  4573. // Store arguments for use when handling the inner native event
  4574. // There will always be at least one argument (an event object), so this array
  4575. // will not be confused with a leftover capture object.
  4576. saved = slice.call( arguments );
  4577. dataPriv.set( this, type, saved );
  4578. // Trigger the native event and capture its result
  4579. // Support: IE <=9 - 11+
  4580. // focus() and blur() are asynchronous
  4581. notAsync = expectSync( this, type );
  4582. this[ type ]();
  4583. result = dataPriv.get( this, type );
  4584. if ( saved !== result || notAsync ) {
  4585. dataPriv.set( this, type, false );
  4586. } else {
  4587. result = {};
  4588. }
  4589. if ( saved !== result ) {
  4590. // Cancel the outer synthetic event
  4591. event.stopImmediatePropagation();
  4592. event.preventDefault();
  4593. // Support: Chrome 86+
  4594. // In Chrome, if an element having a focusout handler is blurred by
  4595. // clicking outside of it, it invokes the handler synchronously. If
  4596. // that handler calls `.remove()` on the element, the data is cleared,
  4597. // leaving `result` undefined. We need to guard against this.
  4598. return result && result.value;
  4599. }
  4600. // If this is an inner synthetic event for an event with a bubbling surrogate
  4601. // (focus or blur), assume that the surrogate already propagated from triggering the
  4602. // native event and prevent that from happening again here.
  4603. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  4604. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  4605. // less bad than duplication.
  4606. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  4607. event.stopPropagation();
  4608. }
  4609. // If this is a native event triggered above, everything is now in order
  4610. // Fire an inner synthetic event with the original arguments
  4611. } else if ( saved.length ) {
  4612. // ...and capture the result
  4613. dataPriv.set( this, type, {
  4614. value: jQuery.event.trigger(
  4615. // Support: IE <=9 - 11+
  4616. // Extend with the prototype to reset the above stopImmediatePropagation()
  4617. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  4618. saved.slice( 1 ),
  4619. this
  4620. )
  4621. } );
  4622. // Abort handling of the native event
  4623. event.stopImmediatePropagation();
  4624. }
  4625. }
  4626. } );
  4627. }
  4628. jQuery.removeEvent = function( elem, type, handle ) {
  4629. // This "if" is needed for plain objects
  4630. if ( elem.removeEventListener ) {
  4631. elem.removeEventListener( type, handle );
  4632. }
  4633. };
  4634. jQuery.Event = function( src, props ) {
  4635. // Allow instantiation without the 'new' keyword
  4636. if ( !( this instanceof jQuery.Event ) ) {
  4637. return new jQuery.Event( src, props );
  4638. }
  4639. // Event object
  4640. if ( src && src.type ) {
  4641. this.originalEvent = src;
  4642. this.type = src.type;
  4643. // Events bubbling up the document may have been marked as prevented
  4644. // by a handler lower down the tree; reflect the correct value.
  4645. this.isDefaultPrevented = src.defaultPrevented ||
  4646. src.defaultPrevented === undefined &&
  4647. // Support: Android <=2.3 only
  4648. src.returnValue === false ?
  4649. returnTrue :
  4650. returnFalse;
  4651. // Create target properties
  4652. // Support: Safari <=6 - 7 only
  4653. // Target should not be a text node (#504, #13143)
  4654. this.target = ( src.target && src.target.nodeType === 3 ) ?
  4655. src.target.parentNode :
  4656. src.target;
  4657. this.currentTarget = src.currentTarget;
  4658. this.relatedTarget = src.relatedTarget;
  4659. // Event type
  4660. } else {
  4661. this.type = src;
  4662. }
  4663. // Put explicitly provided properties onto the event object
  4664. if ( props ) {
  4665. jQuery.extend( this, props );
  4666. }
  4667. // Create a timestamp if incoming event doesn't have one
  4668. this.timeStamp = src && src.timeStamp || Date.now();
  4669. // Mark it as fixed
  4670. this[ jQuery.expando ] = true;
  4671. };
  4672. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  4673. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  4674. jQuery.Event.prototype = {
  4675. constructor: jQuery.Event,
  4676. isDefaultPrevented: returnFalse,
  4677. isPropagationStopped: returnFalse,
  4678. isImmediatePropagationStopped: returnFalse,
  4679. isSimulated: false,
  4680. preventDefault: function() {
  4681. var e = this.originalEvent;
  4682. this.isDefaultPrevented = returnTrue;
  4683. if ( e && !this.isSimulated ) {
  4684. e.preventDefault();
  4685. }
  4686. },
  4687. stopPropagation: function() {
  4688. var e = this.originalEvent;
  4689. this.isPropagationStopped = returnTrue;
  4690. if ( e && !this.isSimulated ) {
  4691. e.stopPropagation();
  4692. }
  4693. },
  4694. stopImmediatePropagation: function() {
  4695. var e = this.originalEvent;
  4696. this.isImmediatePropagationStopped = returnTrue;
  4697. if ( e && !this.isSimulated ) {
  4698. e.stopImmediatePropagation();
  4699. }
  4700. this.stopPropagation();
  4701. }
  4702. };
  4703. // Includes all common event props including KeyEvent and MouseEvent specific props
  4704. jQuery.each( {
  4705. altKey: true,
  4706. bubbles: true,
  4707. cancelable: true,
  4708. changedTouches: true,
  4709. ctrlKey: true,
  4710. detail: true,
  4711. eventPhase: true,
  4712. metaKey: true,
  4713. pageX: true,
  4714. pageY: true,
  4715. shiftKey: true,
  4716. view: true,
  4717. "char": true,
  4718. code: true,
  4719. charCode: true,
  4720. key: true,
  4721. keyCode: true,
  4722. button: true,
  4723. buttons: true,
  4724. clientX: true,
  4725. clientY: true,
  4726. offsetX: true,
  4727. offsetY: true,
  4728. pointerId: true,
  4729. pointerType: true,
  4730. screenX: true,
  4731. screenY: true,
  4732. targetTouches: true,
  4733. toElement: true,
  4734. touches: true,
  4735. which: true
  4736. }, jQuery.event.addProp );
  4737. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  4738. jQuery.event.special[ type ] = {
  4739. // Utilize native event if possible so blur/focus sequence is correct
  4740. setup: function() {
  4741. // Claim the first handler
  4742. // dataPriv.set( this, "focus", ... )
  4743. // dataPriv.set( this, "blur", ... )
  4744. leverageNative( this, type, expectSync );
  4745. // Return false to allow normal processing in the caller
  4746. return false;
  4747. },
  4748. trigger: function() {
  4749. // Force setup before trigger
  4750. leverageNative( this, type );
  4751. // Return non-false to allow normal event-path propagation
  4752. return true;
  4753. },
  4754. // Suppress native focus or blur as it's already being fired
  4755. // in leverageNative.
  4756. _default: function() {
  4757. return true;
  4758. },
  4759. delegateType: delegateType
  4760. };
  4761. } );
  4762. // Create mouseenter/leave events using mouseover/out and event-time checks
  4763. // so that event delegation works in jQuery.
  4764. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  4765. //
  4766. // Support: Safari 7 only
  4767. // Safari sends mouseenter too often; see:
  4768. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  4769. // for the description of the bug (it existed in older Chrome versions as well).
  4770. jQuery.each( {
  4771. mouseenter: "mouseover",
  4772. mouseleave: "mouseout",
  4773. pointerenter: "pointerover",
  4774. pointerleave: "pointerout"
  4775. }, function( orig, fix ) {
  4776. jQuery.event.special[ orig ] = {
  4777. delegateType: fix,
  4778. bindType: fix,
  4779. handle: function( event ) {
  4780. var ret,
  4781. target = this,
  4782. related = event.relatedTarget,
  4783. handleObj = event.handleObj;
  4784. // For mouseenter/leave call the handler if related is outside the target.
  4785. // NB: No relatedTarget if the mouse left/entered the browser window
  4786. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  4787. event.type = handleObj.origType;
  4788. ret = handleObj.handler.apply( this, arguments );
  4789. event.type = fix;
  4790. }
  4791. return ret;
  4792. }
  4793. };
  4794. } );
  4795. jQuery.fn.extend( {
  4796. on: function( types, selector, data, fn ) {
  4797. return on( this, types, selector, data, fn );
  4798. },
  4799. one: function( types, selector, data, fn ) {
  4800. return on( this, types, selector, data, fn, 1 );
  4801. },
  4802. off: function( types, selector, fn ) {
  4803. var handleObj, type;
  4804. if ( types && types.preventDefault && types.handleObj ) {
  4805. // ( event ) dispatched jQuery.Event
  4806. handleObj = types.handleObj;
  4807. jQuery( types.delegateTarget ).off(
  4808. handleObj.namespace ?
  4809. handleObj.origType + "." + handleObj.namespace :
  4810. handleObj.origType,
  4811. handleObj.selector,
  4812. handleObj.handler
  4813. );
  4814. return this;
  4815. }
  4816. if ( typeof types === "object" ) {
  4817. // ( types-object [, selector] )
  4818. for ( type in types ) {
  4819. this.off( type, selector, types[ type ] );
  4820. }
  4821. return this;
  4822. }
  4823. if ( selector === false || typeof selector === "function" ) {
  4824. // ( types [, fn] )
  4825. fn = selector;
  4826. selector = undefined;
  4827. }
  4828. if ( fn === false ) {
  4829. fn = returnFalse;
  4830. }
  4831. return this.each( function() {
  4832. jQuery.event.remove( this, types, fn, selector );
  4833. } );
  4834. }
  4835. } );
  4836. var
  4837. // Support: IE <=10 - 11, Edge 12 - 13 only
  4838. // In IE/Edge using regex groups here causes severe slowdowns.
  4839. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  4840. rnoInnerhtml = /<script|<style|<link/i,
  4841. // checked="checked" or checked
  4842. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  4843. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  4844. // Prefer a tbody over its parent table for containing new rows
  4845. function manipulationTarget( elem, content ) {
  4846. if ( nodeName( elem, "table" ) &&
  4847. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  4848. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  4849. }
  4850. return elem;
  4851. }
  4852. // Replace/restore the type attribute of script elements for safe DOM manipulation
  4853. function disableScript( elem ) {
  4854. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  4855. return elem;
  4856. }
  4857. function restoreScript( elem ) {
  4858. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  4859. elem.type = elem.type.slice( 5 );
  4860. } else {
  4861. elem.removeAttribute( "type" );
  4862. }
  4863. return elem;
  4864. }
  4865. function cloneCopyEvent( src, dest ) {
  4866. var i, l, type, pdataOld, udataOld, udataCur, events;
  4867. if ( dest.nodeType !== 1 ) {
  4868. return;
  4869. }
  4870. // 1. Copy private data: events, handlers, etc.
  4871. if ( dataPriv.hasData( src ) ) {
  4872. pdataOld = dataPriv.get( src );
  4873. events = pdataOld.events;
  4874. if ( events ) {
  4875. dataPriv.remove( dest, "handle events" );
  4876. for ( type in events ) {
  4877. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  4878. jQuery.event.add( dest, type, events[ type ][ i ] );
  4879. }
  4880. }
  4881. }
  4882. }
  4883. // 2. Copy user data
  4884. if ( dataUser.hasData( src ) ) {
  4885. udataOld = dataUser.access( src );
  4886. udataCur = jQuery.extend( {}, udataOld );
  4887. dataUser.set( dest, udataCur );
  4888. }
  4889. }
  4890. // Fix IE bugs, see support tests
  4891. function fixInput( src, dest ) {
  4892. var nodeName = dest.nodeName.toLowerCase();
  4893. // Fails to persist the checked state of a cloned checkbox or radio button.
  4894. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  4895. dest.checked = src.checked;
  4896. // Fails to return the selected option to the default selected state when cloning options
  4897. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  4898. dest.defaultValue = src.defaultValue;
  4899. }
  4900. }
  4901. function domManip( collection, args, callback, ignored ) {
  4902. // Flatten any nested arrays
  4903. args = flat( args );
  4904. var fragment, first, scripts, hasScripts, node, doc,
  4905. i = 0,
  4906. l = collection.length,
  4907. iNoClone = l - 1,
  4908. value = args[ 0 ],
  4909. valueIsFunction = isFunction( value );
  4910. // We can't cloneNode fragments that contain checked, in WebKit
  4911. if ( valueIsFunction ||
  4912. ( l > 1 && typeof value === "string" &&
  4913. !support.checkClone && rchecked.test( value ) ) ) {
  4914. return collection.each( function( index ) {
  4915. var self = collection.eq( index );
  4916. if ( valueIsFunction ) {
  4917. args[ 0 ] = value.call( this, index, self.html() );
  4918. }
  4919. domManip( self, args, callback, ignored );
  4920. } );
  4921. }
  4922. if ( l ) {
  4923. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  4924. first = fragment.firstChild;
  4925. if ( fragment.childNodes.length === 1 ) {
  4926. fragment = first;
  4927. }
  4928. // Require either new content or an interest in ignored elements to invoke the callback
  4929. if ( first || ignored ) {
  4930. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  4931. hasScripts = scripts.length;
  4932. // Use the original fragment for the last item
  4933. // instead of the first because it can end up
  4934. // being emptied incorrectly in certain situations (#8070).
  4935. for ( ; i < l; i++ ) {
  4936. node = fragment;
  4937. if ( i !== iNoClone ) {
  4938. node = jQuery.clone( node, true, true );
  4939. // Keep references to cloned scripts for later restoration
  4940. if ( hasScripts ) {
  4941. // Support: Android <=4.0 only, PhantomJS 1 only
  4942. // push.apply(_, arraylike) throws on ancient WebKit
  4943. jQuery.merge( scripts, getAll( node, "script" ) );
  4944. }
  4945. }
  4946. callback.call( collection[ i ], node, i );
  4947. }
  4948. if ( hasScripts ) {
  4949. doc = scripts[ scripts.length - 1 ].ownerDocument;
  4950. // Reenable scripts
  4951. jQuery.map( scripts, restoreScript );
  4952. // Evaluate executable scripts on first document insertion
  4953. for ( i = 0; i < hasScripts; i++ ) {
  4954. node = scripts[ i ];
  4955. if ( rscriptType.test( node.type || "" ) &&
  4956. !dataPriv.access( node, "globalEval" ) &&
  4957. jQuery.contains( doc, node ) ) {
  4958. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  4959. // Optional AJAX dependency, but won't run scripts if not present
  4960. if ( jQuery._evalUrl && !node.noModule ) {
  4961. jQuery._evalUrl( node.src, {
  4962. nonce: node.nonce || node.getAttribute( "nonce" )
  4963. }, doc );
  4964. }
  4965. } else {
  4966. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  4967. }
  4968. }
  4969. }
  4970. }
  4971. }
  4972. }
  4973. return collection;
  4974. }
  4975. function remove( elem, selector, keepData ) {
  4976. var node,
  4977. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  4978. i = 0;
  4979. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  4980. if ( !keepData && node.nodeType === 1 ) {
  4981. jQuery.cleanData( getAll( node ) );
  4982. }
  4983. if ( node.parentNode ) {
  4984. if ( keepData && isAttached( node ) ) {
  4985. setGlobalEval( getAll( node, "script" ) );
  4986. }
  4987. node.parentNode.removeChild( node );
  4988. }
  4989. }
  4990. return elem;
  4991. }
  4992. jQuery.extend( {
  4993. htmlPrefilter: function( html ) {
  4994. return html;
  4995. },
  4996. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  4997. var i, l, srcElements, destElements,
  4998. clone = elem.cloneNode( true ),
  4999. inPage = isAttached( elem );
  5000. // Fix IE cloning issues
  5001. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  5002. !jQuery.isXMLDoc( elem ) ) {
  5003. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  5004. destElements = getAll( clone );
  5005. srcElements = getAll( elem );
  5006. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  5007. fixInput( srcElements[ i ], destElements[ i ] );
  5008. }
  5009. }
  5010. // Copy the events from the original to the clone
  5011. if ( dataAndEvents ) {
  5012. if ( deepDataAndEvents ) {
  5013. srcElements = srcElements || getAll( elem );
  5014. destElements = destElements || getAll( clone );
  5015. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  5016. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  5017. }
  5018. } else {
  5019. cloneCopyEvent( elem, clone );
  5020. }
  5021. }
  5022. // Preserve script evaluation history
  5023. destElements = getAll( clone, "script" );
  5024. if ( destElements.length > 0 ) {
  5025. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  5026. }
  5027. // Return the cloned set
  5028. return clone;
  5029. },
  5030. cleanData: function( elems ) {
  5031. var data, elem, type,
  5032. special = jQuery.event.special,
  5033. i = 0;
  5034. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  5035. if ( acceptData( elem ) ) {
  5036. if ( ( data = elem[ dataPriv.expando ] ) ) {
  5037. if ( data.events ) {
  5038. for ( type in data.events ) {
  5039. if ( special[ type ] ) {
  5040. jQuery.event.remove( elem, type );
  5041. // This is a shortcut to avoid jQuery.event.remove's overhead
  5042. } else {
  5043. jQuery.removeEvent( elem, type, data.handle );
  5044. }
  5045. }
  5046. }
  5047. // Support: Chrome <=35 - 45+
  5048. // Assign undefined instead of using delete, see Data#remove
  5049. elem[ dataPriv.expando ] = undefined;
  5050. }
  5051. if ( elem[ dataUser.expando ] ) {
  5052. // Support: Chrome <=35 - 45+
  5053. // Assign undefined instead of using delete, see Data#remove
  5054. elem[ dataUser.expando ] = undefined;
  5055. }
  5056. }
  5057. }
  5058. }
  5059. } );
  5060. jQuery.fn.extend( {
  5061. detach: function( selector ) {
  5062. return remove( this, selector, true );
  5063. },
  5064. remove: function( selector ) {
  5065. return remove( this, selector );
  5066. },
  5067. text: function( value ) {
  5068. return access( this, function( value ) {
  5069. return value === undefined ?
  5070. jQuery.text( this ) :
  5071. this.empty().each( function() {
  5072. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5073. this.textContent = value;
  5074. }
  5075. } );
  5076. }, null, value, arguments.length );
  5077. },
  5078. append: function() {
  5079. return domManip( this, arguments, function( elem ) {
  5080. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5081. var target = manipulationTarget( this, elem );
  5082. target.appendChild( elem );
  5083. }
  5084. } );
  5085. },
  5086. prepend: function() {
  5087. return domManip( this, arguments, function( elem ) {
  5088. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  5089. var target = manipulationTarget( this, elem );
  5090. target.insertBefore( elem, target.firstChild );
  5091. }
  5092. } );
  5093. },
  5094. before: function() {
  5095. return domManip( this, arguments, function( elem ) {
  5096. if ( this.parentNode ) {
  5097. this.parentNode.insertBefore( elem, this );
  5098. }
  5099. } );
  5100. },
  5101. after: function() {
  5102. return domManip( this, arguments, function( elem ) {
  5103. if ( this.parentNode ) {
  5104. this.parentNode.insertBefore( elem, this.nextSibling );
  5105. }
  5106. } );
  5107. },
  5108. empty: function() {
  5109. var elem,
  5110. i = 0;
  5111. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  5112. if ( elem.nodeType === 1 ) {
  5113. // Prevent memory leaks
  5114. jQuery.cleanData( getAll( elem, false ) );
  5115. // Remove any remaining nodes
  5116. elem.textContent = "";
  5117. }
  5118. }
  5119. return this;
  5120. },
  5121. clone: function( dataAndEvents, deepDataAndEvents ) {
  5122. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  5123. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  5124. return this.map( function() {
  5125. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  5126. } );
  5127. },
  5128. html: function( value ) {
  5129. return access( this, function( value ) {
  5130. var elem = this[ 0 ] || {},
  5131. i = 0,
  5132. l = this.length;
  5133. if ( value === undefined && elem.nodeType === 1 ) {
  5134. return elem.innerHTML;
  5135. }
  5136. // See if we can take a shortcut and just use innerHTML
  5137. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  5138. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  5139. value = jQuery.htmlPrefilter( value );
  5140. try {
  5141. for ( ; i < l; i++ ) {
  5142. elem = this[ i ] || {};
  5143. // Remove element nodes and prevent memory leaks
  5144. if ( elem.nodeType === 1 ) {
  5145. jQuery.cleanData( getAll( elem, false ) );
  5146. elem.innerHTML = value;
  5147. }
  5148. }
  5149. elem = 0;
  5150. // If using innerHTML throws an exception, use the fallback method
  5151. } catch ( e ) {}
  5152. }
  5153. if ( elem ) {
  5154. this.empty().append( value );
  5155. }
  5156. }, null, value, arguments.length );
  5157. },
  5158. replaceWith: function() {
  5159. var ignored = [];
  5160. // Make the changes, replacing each non-ignored context element with the new content
  5161. return domManip( this, arguments, function( elem ) {
  5162. var parent = this.parentNode;
  5163. if ( jQuery.inArray( this, ignored ) < 0 ) {
  5164. jQuery.cleanData( getAll( this ) );
  5165. if ( parent ) {
  5166. parent.replaceChild( elem, this );
  5167. }
  5168. }
  5169. // Force callback invocation
  5170. }, ignored );
  5171. }
  5172. } );
  5173. jQuery.each( {
  5174. appendTo: "append",
  5175. prependTo: "prepend",
  5176. insertBefore: "before",
  5177. insertAfter: "after",
  5178. replaceAll: "replaceWith"
  5179. }, function( name, original ) {
  5180. jQuery.fn[ name ] = function( selector ) {
  5181. var elems,
  5182. ret = [],
  5183. insert = jQuery( selector ),
  5184. last = insert.length - 1,
  5185. i = 0;
  5186. for ( ; i <= last; i++ ) {
  5187. elems = i === last ? this : this.clone( true );
  5188. jQuery( insert[ i ] )[ original ]( elems );
  5189. // Support: Android <=4.0 only, PhantomJS 1 only
  5190. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  5191. push.apply( ret, elems.get() );
  5192. }
  5193. return this.pushStack( ret );
  5194. };
  5195. } );
  5196. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  5197. var getStyles = function( elem ) {
  5198. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  5199. // IE throws on elements created in popups
  5200. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  5201. var view = elem.ownerDocument.defaultView;
  5202. if ( !view || !view.opener ) {
  5203. view = window;
  5204. }
  5205. return view.getComputedStyle( elem );
  5206. };
  5207. var swap = function( elem, options, callback ) {
  5208. var ret, name,
  5209. old = {};
  5210. // Remember the old values, and insert the new ones
  5211. for ( name in options ) {
  5212. old[ name ] = elem.style[ name ];
  5213. elem.style[ name ] = options[ name ];
  5214. }
  5215. ret = callback.call( elem );
  5216. // Revert the old values
  5217. for ( name in options ) {
  5218. elem.style[ name ] = old[ name ];
  5219. }
  5220. return ret;
  5221. };
  5222. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  5223. ( function() {
  5224. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  5225. // so they're executed at the same time to save the second computation.
  5226. function computeStyleTests() {
  5227. // This is a singleton, we need to execute it only once
  5228. if ( !div ) {
  5229. return;
  5230. }
  5231. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  5232. "margin-top:1px;padding:0;border:0";
  5233. div.style.cssText =
  5234. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  5235. "margin:auto;border:1px;padding:1px;" +
  5236. "width:60%;top:1%";
  5237. documentElement.appendChild( container ).appendChild( div );
  5238. var divStyle = window.getComputedStyle( div );
  5239. pixelPositionVal = divStyle.top !== "1%";
  5240. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  5241. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  5242. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  5243. // Some styles come back with percentage values, even though they shouldn't
  5244. div.style.right = "60%";
  5245. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  5246. // Support: IE 9 - 11 only
  5247. // Detect misreporting of content dimensions for box-sizing:border-box elements
  5248. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  5249. // Support: IE 9 only
  5250. // Detect overflow:scroll screwiness (gh-3699)
  5251. // Support: Chrome <=64
  5252. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  5253. div.style.position = "absolute";
  5254. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  5255. documentElement.removeChild( container );
  5256. // Nullify the div so it wouldn't be stored in the memory and
  5257. // it will also be a sign that checks already performed
  5258. div = null;
  5259. }
  5260. function roundPixelMeasures( measure ) {
  5261. return Math.round( parseFloat( measure ) );
  5262. }
  5263. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  5264. reliableTrDimensionsVal, reliableMarginLeftVal,
  5265. container = document.createElement( "div" ),
  5266. div = document.createElement( "div" );
  5267. // Finish early in limited (non-browser) environments
  5268. if ( !div.style ) {
  5269. return;
  5270. }
  5271. // Support: IE <=9 - 11 only
  5272. // Style of cloned element affects source element cloned (#8908)
  5273. div.style.backgroundClip = "content-box";
  5274. div.cloneNode( true ).style.backgroundClip = "";
  5275. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  5276. jQuery.extend( support, {
  5277. boxSizingReliable: function() {
  5278. computeStyleTests();
  5279. return boxSizingReliableVal;
  5280. },
  5281. pixelBoxStyles: function() {
  5282. computeStyleTests();
  5283. return pixelBoxStylesVal;
  5284. },
  5285. pixelPosition: function() {
  5286. computeStyleTests();
  5287. return pixelPositionVal;
  5288. },
  5289. reliableMarginLeft: function() {
  5290. computeStyleTests();
  5291. return reliableMarginLeftVal;
  5292. },
  5293. scrollboxSize: function() {
  5294. computeStyleTests();
  5295. return scrollboxSizeVal;
  5296. },
  5297. // Support: IE 9 - 11+, Edge 15 - 18+
  5298. // IE/Edge misreport `getComputedStyle` of table rows with width/height
  5299. // set in CSS while `offset*` properties report correct values.
  5300. // Behavior in IE 9 is more subtle than in newer versions & it passes
  5301. // some versions of this test; make sure not to make it pass there!
  5302. //
  5303. // Support: Firefox 70+
  5304. // Only Firefox includes border widths
  5305. // in computed dimensions. (gh-4529)
  5306. reliableTrDimensions: function() {
  5307. var table, tr, trChild, trStyle;
  5308. if ( reliableTrDimensionsVal == null ) {
  5309. table = document.createElement( "table" );
  5310. tr = document.createElement( "tr" );
  5311. trChild = document.createElement( "div" );
  5312. table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
  5313. tr.style.cssText = "border:1px solid";
  5314. // Support: Chrome 86+
  5315. // Height set through cssText does not get applied.
  5316. // Computed height then comes back as 0.
  5317. tr.style.height = "1px";
  5318. trChild.style.height = "9px";
  5319. // Support: Android 8 Chrome 86+
  5320. // In our bodyBackground.html iframe,
  5321. // display for all div elements is set to "inline",
  5322. // which causes a problem only in Android 8 Chrome 86.
  5323. // Ensuring the div is display: block
  5324. // gets around this issue.
  5325. trChild.style.display = "block";
  5326. documentElement
  5327. .appendChild( table )
  5328. .appendChild( tr )
  5329. .appendChild( trChild );
  5330. trStyle = window.getComputedStyle( tr );
  5331. reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) +
  5332. parseInt( trStyle.borderTopWidth, 10 ) +
  5333. parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight;
  5334. documentElement.removeChild( table );
  5335. }
  5336. return reliableTrDimensionsVal;
  5337. }
  5338. } );
  5339. } )();
  5340. function curCSS( elem, name, computed ) {
  5341. var width, minWidth, maxWidth, ret,
  5342. // Support: Firefox 51+
  5343. // Retrieving style before computed somehow
  5344. // fixes an issue with getting wrong values
  5345. // on detached elements
  5346. style = elem.style;
  5347. computed = computed || getStyles( elem );
  5348. // getPropertyValue is needed for:
  5349. // .css('filter') (IE 9 only, #12537)
  5350. // .css('--customProperty) (#3144)
  5351. if ( computed ) {
  5352. ret = computed.getPropertyValue( name ) || computed[ name ];
  5353. if ( ret === "" && !isAttached( elem ) ) {
  5354. ret = jQuery.style( elem, name );
  5355. }
  5356. // A tribute to the "awesome hack by Dean Edwards"
  5357. // Android Browser returns percentage for some values,
  5358. // but width seems to be reliably pixels.
  5359. // This is against the CSSOM draft spec:
  5360. // https://drafts.csswg.org/cssom/#resolved-values
  5361. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  5362. // Remember the original values
  5363. width = style.width;
  5364. minWidth = style.minWidth;
  5365. maxWidth = style.maxWidth;
  5366. // Put in the new values to get a computed value out
  5367. style.minWidth = style.maxWidth = style.width = ret;
  5368. ret = computed.width;
  5369. // Revert the changed values
  5370. style.width = width;
  5371. style.minWidth = minWidth;
  5372. style.maxWidth = maxWidth;
  5373. }
  5374. }
  5375. return ret !== undefined ?
  5376. // Support: IE <=9 - 11 only
  5377. // IE returns zIndex value as an integer.
  5378. ret + "" :
  5379. ret;
  5380. }
  5381. function addGetHookIf( conditionFn, hookFn ) {
  5382. // Define the hook, we'll check on the first run if it's really needed.
  5383. return {
  5384. get: function() {
  5385. if ( conditionFn() ) {
  5386. // Hook not needed (or it's not possible to use it due
  5387. // to missing dependency), remove it.
  5388. delete this.get;
  5389. return;
  5390. }
  5391. // Hook needed; redefine it so that the support test is not executed again.
  5392. return ( this.get = hookFn ).apply( this, arguments );
  5393. }
  5394. };
  5395. }
  5396. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  5397. emptyStyle = document.createElement( "div" ).style,
  5398. vendorProps = {};
  5399. // Return a vendor-prefixed property or undefined
  5400. function vendorPropName( name ) {
  5401. // Check for vendor prefixed names
  5402. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  5403. i = cssPrefixes.length;
  5404. while ( i-- ) {
  5405. name = cssPrefixes[ i ] + capName;
  5406. if ( name in emptyStyle ) {
  5407. return name;
  5408. }
  5409. }
  5410. }
  5411. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  5412. function finalPropName( name ) {
  5413. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  5414. if ( final ) {
  5415. return final;
  5416. }
  5417. if ( name in emptyStyle ) {
  5418. return name;
  5419. }
  5420. return vendorProps[ name ] = vendorPropName( name ) || name;
  5421. }
  5422. var
  5423. // Swappable if display is none or starts with table
  5424. // except "table", "table-cell", or "table-caption"
  5425. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  5426. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  5427. rcustomProp = /^--/,
  5428. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  5429. cssNormalTransform = {
  5430. letterSpacing: "0",
  5431. fontWeight: "400"
  5432. };
  5433. function setPositiveNumber( _elem, value, subtract ) {
  5434. // Any relative (+/-) values have already been
  5435. // normalized at this point
  5436. var matches = rcssNum.exec( value );
  5437. return matches ?
  5438. // Guard against undefined "subtract", e.g., when used as in cssHooks
  5439. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  5440. value;
  5441. }
  5442. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  5443. var i = dimension === "width" ? 1 : 0,
  5444. extra = 0,
  5445. delta = 0;
  5446. // Adjustment may not be necessary
  5447. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  5448. return 0;
  5449. }
  5450. for ( ; i < 4; i += 2 ) {
  5451. // Both box models exclude margin
  5452. if ( box === "margin" ) {
  5453. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  5454. }
  5455. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  5456. if ( !isBorderBox ) {
  5457. // Add padding
  5458. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5459. // For "border" or "margin", add border
  5460. if ( box !== "padding" ) {
  5461. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5462. // But still keep track of it otherwise
  5463. } else {
  5464. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5465. }
  5466. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  5467. // "padding" or "margin"
  5468. } else {
  5469. // For "content", subtract padding
  5470. if ( box === "content" ) {
  5471. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5472. }
  5473. // For "content" or "padding", subtract border
  5474. if ( box !== "margin" ) {
  5475. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5476. }
  5477. }
  5478. }
  5479. // Account for positive content-box scroll gutter when requested by providing computedVal
  5480. if ( !isBorderBox && computedVal >= 0 ) {
  5481. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  5482. // Assuming integer scroll gutter, subtract the rest and round down
  5483. delta += Math.max( 0, Math.ceil(
  5484. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  5485. computedVal -
  5486. delta -
  5487. extra -
  5488. 0.5
  5489. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  5490. // Use an explicit zero to avoid NaN (gh-3964)
  5491. ) ) || 0;
  5492. }
  5493. return delta;
  5494. }
  5495. function getWidthOrHeight( elem, dimension, extra ) {
  5496. // Start with computed style
  5497. var styles = getStyles( elem ),
  5498. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  5499. // Fake content-box until we know it's needed to know the true value.
  5500. boxSizingNeeded = !support.boxSizingReliable() || extra,
  5501. isBorderBox = boxSizingNeeded &&
  5502. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  5503. valueIsBorderBox = isBorderBox,
  5504. val = curCSS( elem, dimension, styles ),
  5505. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  5506. // Support: Firefox <=54
  5507. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  5508. if ( rnumnonpx.test( val ) ) {
  5509. if ( !extra ) {
  5510. return val;
  5511. }
  5512. val = "auto";
  5513. }
  5514. // Support: IE 9 - 11 only
  5515. // Use offsetWidth/offsetHeight for when box sizing is unreliable.
  5516. // In those cases, the computed value can be trusted to be border-box.
  5517. if ( ( !support.boxSizingReliable() && isBorderBox ||
  5518. // Support: IE 10 - 11+, Edge 15 - 18+
  5519. // IE/Edge misreport `getComputedStyle` of table rows with width/height
  5520. // set in CSS while `offset*` properties report correct values.
  5521. // Interestingly, in some cases IE 9 doesn't suffer from this issue.
  5522. !support.reliableTrDimensions() && nodeName( elem, "tr" ) ||
  5523. // Fall back to offsetWidth/offsetHeight when value is "auto"
  5524. // This happens for inline elements with no explicit setting (gh-3571)
  5525. val === "auto" ||
  5526. // Support: Android <=4.1 - 4.3 only
  5527. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  5528. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  5529. // Make sure the element is visible & connected
  5530. elem.getClientRects().length ) {
  5531. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  5532. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  5533. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  5534. // retrieved value as a content box dimension.
  5535. valueIsBorderBox = offsetProp in elem;
  5536. if ( valueIsBorderBox ) {
  5537. val = elem[ offsetProp ];
  5538. }
  5539. }
  5540. // Normalize "" and auto
  5541. val = parseFloat( val ) || 0;
  5542. // Adjust for the element's box model
  5543. return ( val +
  5544. boxModelAdjustment(
  5545. elem,
  5546. dimension,
  5547. extra || ( isBorderBox ? "border" : "content" ),
  5548. valueIsBorderBox,
  5549. styles,
  5550. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  5551. val
  5552. )
  5553. ) + "px";
  5554. }
  5555. jQuery.extend( {
  5556. // Add in style property hooks for overriding the default
  5557. // behavior of getting and setting a style property
  5558. cssHooks: {
  5559. opacity: {
  5560. get: function( elem, computed ) {
  5561. if ( computed ) {
  5562. // We should always get a number back from opacity
  5563. var ret = curCSS( elem, "opacity" );
  5564. return ret === "" ? "1" : ret;
  5565. }
  5566. }
  5567. }
  5568. },
  5569. // Don't automatically add "px" to these possibly-unitless properties
  5570. cssNumber: {
  5571. "animationIterationCount": true,
  5572. "columnCount": true,
  5573. "fillOpacity": true,
  5574. "flexGrow": true,
  5575. "flexShrink": true,
  5576. "fontWeight": true,
  5577. "gridArea": true,
  5578. "gridColumn": true,
  5579. "gridColumnEnd": true,
  5580. "gridColumnStart": true,
  5581. "gridRow": true,
  5582. "gridRowEnd": true,
  5583. "gridRowStart": true,
  5584. "lineHeight": true,
  5585. "opacity": true,
  5586. "order": true,
  5587. "orphans": true,
  5588. "widows": true,
  5589. "zIndex": true,
  5590. "zoom": true
  5591. },
  5592. // Add in properties whose names you wish to fix before
  5593. // setting or getting the value
  5594. cssProps: {},
  5595. // Get and set the style property on a DOM Node
  5596. style: function( elem, name, value, extra ) {
  5597. // Don't set styles on text and comment nodes
  5598. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  5599. return;
  5600. }
  5601. // Make sure that we're working with the right name
  5602. var ret, type, hooks,
  5603. origName = camelCase( name ),
  5604. isCustomProp = rcustomProp.test( name ),
  5605. style = elem.style;
  5606. // Make sure that we're working with the right name. We don't
  5607. // want to query the value if it is a CSS custom property
  5608. // since they are user-defined.
  5609. if ( !isCustomProp ) {
  5610. name = finalPropName( origName );
  5611. }
  5612. // Gets hook for the prefixed version, then unprefixed version
  5613. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5614. // Check if we're setting a value
  5615. if ( value !== undefined ) {
  5616. type = typeof value;
  5617. // Convert "+=" or "-=" to relative numbers (#7345)
  5618. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  5619. value = adjustCSS( elem, name, ret );
  5620. // Fixes bug #9237
  5621. type = "number";
  5622. }
  5623. // Make sure that null and NaN values aren't set (#7116)
  5624. if ( value == null || value !== value ) {
  5625. return;
  5626. }
  5627. // If a number was passed in, add the unit (except for certain CSS properties)
  5628. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  5629. // "px" to a few hardcoded values.
  5630. if ( type === "number" && !isCustomProp ) {
  5631. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  5632. }
  5633. // background-* props affect original clone's values
  5634. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  5635. style[ name ] = "inherit";
  5636. }
  5637. // If a hook was provided, use that value, otherwise just set the specified value
  5638. if ( !hooks || !( "set" in hooks ) ||
  5639. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  5640. if ( isCustomProp ) {
  5641. style.setProperty( name, value );
  5642. } else {
  5643. style[ name ] = value;
  5644. }
  5645. }
  5646. } else {
  5647. // If a hook was provided get the non-computed value from there
  5648. if ( hooks && "get" in hooks &&
  5649. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  5650. return ret;
  5651. }
  5652. // Otherwise just get the value from the style object
  5653. return style[ name ];
  5654. }
  5655. },
  5656. css: function( elem, name, extra, styles ) {
  5657. var val, num, hooks,
  5658. origName = camelCase( name ),
  5659. isCustomProp = rcustomProp.test( name );
  5660. // Make sure that we're working with the right name. We don't
  5661. // want to modify the value if it is a CSS custom property
  5662. // since they are user-defined.
  5663. if ( !isCustomProp ) {
  5664. name = finalPropName( origName );
  5665. }
  5666. // Try prefixed name followed by the unprefixed name
  5667. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5668. // If a hook was provided get the computed value from there
  5669. if ( hooks && "get" in hooks ) {
  5670. val = hooks.get( elem, true, extra );
  5671. }
  5672. // Otherwise, if a way to get the computed value exists, use that
  5673. if ( val === undefined ) {
  5674. val = curCSS( elem, name, styles );
  5675. }
  5676. // Convert "normal" to computed value
  5677. if ( val === "normal" && name in cssNormalTransform ) {
  5678. val = cssNormalTransform[ name ];
  5679. }
  5680. // Make numeric if forced or a qualifier was provided and val looks numeric
  5681. if ( extra === "" || extra ) {
  5682. num = parseFloat( val );
  5683. return extra === true || isFinite( num ) ? num || 0 : val;
  5684. }
  5685. return val;
  5686. }
  5687. } );
  5688. jQuery.each( [ "height", "width" ], function( _i, dimension ) {
  5689. jQuery.cssHooks[ dimension ] = {
  5690. get: function( elem, computed, extra ) {
  5691. if ( computed ) {
  5692. // Certain elements can have dimension info if we invisibly show them
  5693. // but it must have a current display style that would benefit
  5694. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  5695. // Support: Safari 8+
  5696. // Table columns in Safari have non-zero offsetWidth & zero
  5697. // getBoundingClientRect().width unless display is changed.
  5698. // Support: IE <=11 only
  5699. // Running getBoundingClientRect on a disconnected node
  5700. // in IE throws an error.
  5701. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  5702. swap( elem, cssShow, function() {
  5703. return getWidthOrHeight( elem, dimension, extra );
  5704. } ) :
  5705. getWidthOrHeight( elem, dimension, extra );
  5706. }
  5707. },
  5708. set: function( elem, value, extra ) {
  5709. var matches,
  5710. styles = getStyles( elem ),
  5711. // Only read styles.position if the test has a chance to fail
  5712. // to avoid forcing a reflow.
  5713. scrollboxSizeBuggy = !support.scrollboxSize() &&
  5714. styles.position === "absolute",
  5715. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  5716. boxSizingNeeded = scrollboxSizeBuggy || extra,
  5717. isBorderBox = boxSizingNeeded &&
  5718. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  5719. subtract = extra ?
  5720. boxModelAdjustment(
  5721. elem,
  5722. dimension,
  5723. extra,
  5724. isBorderBox,
  5725. styles
  5726. ) :
  5727. 0;
  5728. // Account for unreliable border-box dimensions by comparing offset* to computed and
  5729. // faking a content-box to get border and padding (gh-3699)
  5730. if ( isBorderBox && scrollboxSizeBuggy ) {
  5731. subtract -= Math.ceil(
  5732. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  5733. parseFloat( styles[ dimension ] ) -
  5734. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  5735. 0.5
  5736. );
  5737. }
  5738. // Convert to pixels if value adjustment is needed
  5739. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  5740. ( matches[ 3 ] || "px" ) !== "px" ) {
  5741. elem.style[ dimension ] = value;
  5742. value = jQuery.css( elem, dimension );
  5743. }
  5744. return setPositiveNumber( elem, value, subtract );
  5745. }
  5746. };
  5747. } );
  5748. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  5749. function( elem, computed ) {
  5750. if ( computed ) {
  5751. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  5752. elem.getBoundingClientRect().left -
  5753. swap( elem, { marginLeft: 0 }, function() {
  5754. return elem.getBoundingClientRect().left;
  5755. } )
  5756. ) + "px";
  5757. }
  5758. }
  5759. );
  5760. // These hooks are used by animate to expand properties
  5761. jQuery.each( {
  5762. margin: "",
  5763. padding: "",
  5764. border: "Width"
  5765. }, function( prefix, suffix ) {
  5766. jQuery.cssHooks[ prefix + suffix ] = {
  5767. expand: function( value ) {
  5768. var i = 0,
  5769. expanded = {},
  5770. // Assumes a single number if not a string
  5771. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  5772. for ( ; i < 4; i++ ) {
  5773. expanded[ prefix + cssExpand[ i ] + suffix ] =
  5774. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  5775. }
  5776. return expanded;
  5777. }
  5778. };
  5779. if ( prefix !== "margin" ) {
  5780. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  5781. }
  5782. } );
  5783. jQuery.fn.extend( {
  5784. css: function( name, value ) {
  5785. return access( this, function( elem, name, value ) {
  5786. var styles, len,
  5787. map = {},
  5788. i = 0;
  5789. if ( Array.isArray( name ) ) {
  5790. styles = getStyles( elem );
  5791. len = name.length;
  5792. for ( ; i < len; i++ ) {
  5793. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  5794. }
  5795. return map;
  5796. }
  5797. return value !== undefined ?
  5798. jQuery.style( elem, name, value ) :
  5799. jQuery.css( elem, name );
  5800. }, name, value, arguments.length > 1 );
  5801. }
  5802. } );
  5803. // Based off of the plugin by Clint Helfers, with permission.
  5804. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  5805. jQuery.fn.delay = function( time, type ) {
  5806. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  5807. type = type || "fx";
  5808. return this.queue( type, function( next, hooks ) {
  5809. var timeout = window.setTimeout( next, time );
  5810. hooks.stop = function() {
  5811. window.clearTimeout( timeout );
  5812. };
  5813. } );
  5814. };
  5815. ( function() {
  5816. var input = document.createElement( "input" ),
  5817. select = document.createElement( "select" ),
  5818. opt = select.appendChild( document.createElement( "option" ) );
  5819. input.type = "checkbox";
  5820. // Support: Android <=4.3 only
  5821. // Default value for a checkbox should be "on"
  5822. support.checkOn = input.value !== "";
  5823. // Support: IE <=11 only
  5824. // Must access selectedIndex to make default options select
  5825. support.optSelected = opt.selected;
  5826. // Support: IE <=11 only
  5827. // An input loses its value after becoming a radio
  5828. input = document.createElement( "input" );
  5829. input.value = "t";
  5830. input.type = "radio";
  5831. support.radioValue = input.value === "t";
  5832. } )();
  5833. var boolHook,
  5834. attrHandle = jQuery.expr.attrHandle;
  5835. jQuery.fn.extend( {
  5836. attr: function( name, value ) {
  5837. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  5838. },
  5839. removeAttr: function( name ) {
  5840. return this.each( function() {
  5841. jQuery.removeAttr( this, name );
  5842. } );
  5843. }
  5844. } );
  5845. jQuery.extend( {
  5846. attr: function( elem, name, value ) {
  5847. var ret, hooks,
  5848. nType = elem.nodeType;
  5849. // Don't get/set attributes on text, comment and attribute nodes
  5850. if ( nType === 3 || nType === 8 || nType === 2 ) {
  5851. return;
  5852. }
  5853. // Fallback to prop when attributes are not supported
  5854. if ( typeof elem.getAttribute === "undefined" ) {
  5855. return jQuery.prop( elem, name, value );
  5856. }
  5857. // Attribute hooks are determined by the lowercase version
  5858. // Grab necessary hook if one is defined
  5859. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  5860. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  5861. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  5862. }
  5863. if ( value !== undefined ) {
  5864. if ( value === null ) {
  5865. jQuery.removeAttr( elem, name );
  5866. return;
  5867. }
  5868. if ( hooks && "set" in hooks &&
  5869. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  5870. return ret;
  5871. }
  5872. elem.setAttribute( name, value + "" );
  5873. return value;
  5874. }
  5875. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  5876. return ret;
  5877. }
  5878. ret = jQuery.find.attr( elem, name );
  5879. // Non-existent attributes return null, we normalize to undefined
  5880. return ret == null ? undefined : ret;
  5881. },
  5882. attrHooks: {
  5883. type: {
  5884. set: function( elem, value ) {
  5885. if ( !support.radioValue && value === "radio" &&
  5886. nodeName( elem, "input" ) ) {
  5887. var val = elem.value;
  5888. elem.setAttribute( "type", value );
  5889. if ( val ) {
  5890. elem.value = val;
  5891. }
  5892. return value;
  5893. }
  5894. }
  5895. }
  5896. },
  5897. removeAttr: function( elem, value ) {
  5898. var name,
  5899. i = 0,
  5900. // Attribute names can contain non-HTML whitespace characters
  5901. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  5902. attrNames = value && value.match( rnothtmlwhite );
  5903. if ( attrNames && elem.nodeType === 1 ) {
  5904. while ( ( name = attrNames[ i++ ] ) ) {
  5905. elem.removeAttribute( name );
  5906. }
  5907. }
  5908. }
  5909. } );
  5910. // Hooks for boolean attributes
  5911. boolHook = {
  5912. set: function( elem, value, name ) {
  5913. if ( value === false ) {
  5914. // Remove boolean attributes when set to false
  5915. jQuery.removeAttr( elem, name );
  5916. } else {
  5917. elem.setAttribute( name, name );
  5918. }
  5919. return name;
  5920. }
  5921. };
  5922. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
  5923. var getter = attrHandle[ name ] || jQuery.find.attr;
  5924. attrHandle[ name ] = function( elem, name, isXML ) {
  5925. var ret, handle,
  5926. lowercaseName = name.toLowerCase();
  5927. if ( !isXML ) {
  5928. // Avoid an infinite loop by temporarily removing this function from the getter
  5929. handle = attrHandle[ lowercaseName ];
  5930. attrHandle[ lowercaseName ] = ret;
  5931. ret = getter( elem, name, isXML ) != null ?
  5932. lowercaseName :
  5933. null;
  5934. attrHandle[ lowercaseName ] = handle;
  5935. }
  5936. return ret;
  5937. };
  5938. } );
  5939. var rfocusable = /^(?:input|select|textarea|button)$/i,
  5940. rclickable = /^(?:a|area)$/i;
  5941. jQuery.fn.extend( {
  5942. prop: function( name, value ) {
  5943. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  5944. },
  5945. removeProp: function( name ) {
  5946. return this.each( function() {
  5947. delete this[ jQuery.propFix[ name ] || name ];
  5948. } );
  5949. }
  5950. } );
  5951. jQuery.extend( {
  5952. prop: function( elem, name, value ) {
  5953. var ret, hooks,
  5954. nType = elem.nodeType;
  5955. // Don't get/set properties on text, comment and attribute nodes
  5956. if ( nType === 3 || nType === 8 || nType === 2 ) {
  5957. return;
  5958. }
  5959. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  5960. // Fix name and attach hooks
  5961. name = jQuery.propFix[ name ] || name;
  5962. hooks = jQuery.propHooks[ name ];
  5963. }
  5964. if ( value !== undefined ) {
  5965. if ( hooks && "set" in hooks &&
  5966. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  5967. return ret;
  5968. }
  5969. return ( elem[ name ] = value );
  5970. }
  5971. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  5972. return ret;
  5973. }
  5974. return elem[ name ];
  5975. },
  5976. propHooks: {
  5977. tabIndex: {
  5978. get: function( elem ) {
  5979. // Support: IE <=9 - 11 only
  5980. // elem.tabIndex doesn't always return the
  5981. // correct value when it hasn't been explicitly set
  5982. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  5983. // Use proper attribute retrieval(#12072)
  5984. var tabindex = jQuery.find.attr( elem, "tabindex" );
  5985. if ( tabindex ) {
  5986. return parseInt( tabindex, 10 );
  5987. }
  5988. if (
  5989. rfocusable.test( elem.nodeName ) ||
  5990. rclickable.test( elem.nodeName ) &&
  5991. elem.href
  5992. ) {
  5993. return 0;
  5994. }
  5995. return -1;
  5996. }
  5997. }
  5998. },
  5999. propFix: {
  6000. "for": "htmlFor",
  6001. "class": "className"
  6002. }
  6003. } );
  6004. // Support: IE <=11 only
  6005. // Accessing the selectedIndex property
  6006. // forces the browser to respect setting selected
  6007. // on the option
  6008. // The getter ensures a default option is selected
  6009. // when in an optgroup
  6010. // eslint rule "no-unused-expressions" is disabled for this code
  6011. // since it considers such accessions noop
  6012. if ( !support.optSelected ) {
  6013. jQuery.propHooks.selected = {
  6014. get: function( elem ) {
  6015. /* eslint no-unused-expressions: "off" */
  6016. var parent = elem.parentNode;
  6017. if ( parent && parent.parentNode ) {
  6018. parent.parentNode.selectedIndex;
  6019. }
  6020. return null;
  6021. },
  6022. set: function( elem ) {
  6023. /* eslint no-unused-expressions: "off" */
  6024. var parent = elem.parentNode;
  6025. if ( parent ) {
  6026. parent.selectedIndex;
  6027. if ( parent.parentNode ) {
  6028. parent.parentNode.selectedIndex;
  6029. }
  6030. }
  6031. }
  6032. };
  6033. }
  6034. jQuery.each( [
  6035. "tabIndex",
  6036. "readOnly",
  6037. "maxLength",
  6038. "cellSpacing",
  6039. "cellPadding",
  6040. "rowSpan",
  6041. "colSpan",
  6042. "useMap",
  6043. "frameBorder",
  6044. "contentEditable"
  6045. ], function() {
  6046. jQuery.propFix[ this.toLowerCase() ] = this;
  6047. } );
  6048. // Strip and collapse whitespace according to HTML spec
  6049. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  6050. function stripAndCollapse( value ) {
  6051. var tokens = value.match( rnothtmlwhite ) || [];
  6052. return tokens.join( " " );
  6053. }
  6054. function getClass( elem ) {
  6055. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  6056. }
  6057. function classesToArray( value ) {
  6058. if ( Array.isArray( value ) ) {
  6059. return value;
  6060. }
  6061. if ( typeof value === "string" ) {
  6062. return value.match( rnothtmlwhite ) || [];
  6063. }
  6064. return [];
  6065. }
  6066. jQuery.fn.extend( {
  6067. addClass: function( value ) {
  6068. var classes, elem, cur, curValue, clazz, j, finalValue,
  6069. i = 0;
  6070. if ( isFunction( value ) ) {
  6071. return this.each( function( j ) {
  6072. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  6073. } );
  6074. }
  6075. classes = classesToArray( value );
  6076. if ( classes.length ) {
  6077. while ( ( elem = this[ i++ ] ) ) {
  6078. curValue = getClass( elem );
  6079. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  6080. if ( cur ) {
  6081. j = 0;
  6082. while ( ( clazz = classes[ j++ ] ) ) {
  6083. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  6084. cur += clazz + " ";
  6085. }
  6086. }
  6087. // Only assign if different to avoid unneeded rendering.
  6088. finalValue = stripAndCollapse( cur );
  6089. if ( curValue !== finalValue ) {
  6090. elem.setAttribute( "class", finalValue );
  6091. }
  6092. }
  6093. }
  6094. }
  6095. return this;
  6096. },
  6097. removeClass: function( value ) {
  6098. var classes, elem, cur, curValue, clazz, j, finalValue,
  6099. i = 0;
  6100. if ( isFunction( value ) ) {
  6101. return this.each( function( j ) {
  6102. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  6103. } );
  6104. }
  6105. if ( !arguments.length ) {
  6106. return this.attr( "class", "" );
  6107. }
  6108. classes = classesToArray( value );
  6109. if ( classes.length ) {
  6110. while ( ( elem = this[ i++ ] ) ) {
  6111. curValue = getClass( elem );
  6112. // This expression is here for better compressibility (see addClass)
  6113. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  6114. if ( cur ) {
  6115. j = 0;
  6116. while ( ( clazz = classes[ j++ ] ) ) {
  6117. // Remove *all* instances
  6118. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  6119. cur = cur.replace( " " + clazz + " ", " " );
  6120. }
  6121. }
  6122. // Only assign if different to avoid unneeded rendering.
  6123. finalValue = stripAndCollapse( cur );
  6124. if ( curValue !== finalValue ) {
  6125. elem.setAttribute( "class", finalValue );
  6126. }
  6127. }
  6128. }
  6129. }
  6130. return this;
  6131. },
  6132. toggleClass: function( value, stateVal ) {
  6133. var type = typeof value,
  6134. isValidValue = type === "string" || Array.isArray( value );
  6135. if ( typeof stateVal === "boolean" && isValidValue ) {
  6136. return stateVal ? this.addClass( value ) : this.removeClass( value );
  6137. }
  6138. if ( isFunction( value ) ) {
  6139. return this.each( function( i ) {
  6140. jQuery( this ).toggleClass(
  6141. value.call( this, i, getClass( this ), stateVal ),
  6142. stateVal
  6143. );
  6144. } );
  6145. }
  6146. return this.each( function() {
  6147. var className, i, self, classNames;
  6148. if ( isValidValue ) {
  6149. // Toggle individual class names
  6150. i = 0;
  6151. self = jQuery( this );
  6152. classNames = classesToArray( value );
  6153. while ( ( className = classNames[ i++ ] ) ) {
  6154. // Check each className given, space separated list
  6155. if ( self.hasClass( className ) ) {
  6156. self.removeClass( className );
  6157. } else {
  6158. self.addClass( className );
  6159. }
  6160. }
  6161. // Toggle whole class name
  6162. } else if ( value === undefined || type === "boolean" ) {
  6163. className = getClass( this );
  6164. if ( className ) {
  6165. // Store className if set
  6166. dataPriv.set( this, "__className__", className );
  6167. }
  6168. // If the element has a class name or if we're passed `false`,
  6169. // then remove the whole classname (if there was one, the above saved it).
  6170. // Otherwise bring back whatever was previously saved (if anything),
  6171. // falling back to the empty string if nothing was stored.
  6172. if ( this.setAttribute ) {
  6173. this.setAttribute( "class",
  6174. className || value === false ?
  6175. "" :
  6176. dataPriv.get( this, "__className__" ) || ""
  6177. );
  6178. }
  6179. }
  6180. } );
  6181. },
  6182. hasClass: function( selector ) {
  6183. var className, elem,
  6184. i = 0;
  6185. className = " " + selector + " ";
  6186. while ( ( elem = this[ i++ ] ) ) {
  6187. if ( elem.nodeType === 1 &&
  6188. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  6189. return true;
  6190. }
  6191. }
  6192. return false;
  6193. }
  6194. } );
  6195. var rreturn = /\r/g;
  6196. jQuery.fn.extend( {
  6197. val: function( value ) {
  6198. var hooks, ret, valueIsFunction,
  6199. elem = this[ 0 ];
  6200. if ( !arguments.length ) {
  6201. if ( elem ) {
  6202. hooks = jQuery.valHooks[ elem.type ] ||
  6203. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  6204. if ( hooks &&
  6205. "get" in hooks &&
  6206. ( ret = hooks.get( elem, "value" ) ) !== undefined
  6207. ) {
  6208. return ret;
  6209. }
  6210. ret = elem.value;
  6211. // Handle most common string cases
  6212. if ( typeof ret === "string" ) {
  6213. return ret.replace( rreturn, "" );
  6214. }
  6215. // Handle cases where value is null/undef or number
  6216. return ret == null ? "" : ret;
  6217. }
  6218. return;
  6219. }
  6220. valueIsFunction = isFunction( value );
  6221. return this.each( function( i ) {
  6222. var val;
  6223. if ( this.nodeType !== 1 ) {
  6224. return;
  6225. }
  6226. if ( valueIsFunction ) {
  6227. val = value.call( this, i, jQuery( this ).val() );
  6228. } else {
  6229. val = value;
  6230. }
  6231. // Treat null/undefined as ""; convert numbers to string
  6232. if ( val == null ) {
  6233. val = "";
  6234. } else if ( typeof val === "number" ) {
  6235. val += "";
  6236. } else if ( Array.isArray( val ) ) {
  6237. val = jQuery.map( val, function( value ) {
  6238. return value == null ? "" : value + "";
  6239. } );
  6240. }
  6241. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  6242. // If set returns undefined, fall back to normal setting
  6243. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  6244. this.value = val;
  6245. }
  6246. } );
  6247. }
  6248. } );
  6249. jQuery.extend( {
  6250. valHooks: {
  6251. option: {
  6252. get: function( elem ) {
  6253. var val = jQuery.find.attr( elem, "value" );
  6254. return val != null ?
  6255. val :
  6256. // Support: IE <=10 - 11 only
  6257. // option.text throws exceptions (#14686, #14858)
  6258. // Strip and collapse whitespace
  6259. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  6260. stripAndCollapse( jQuery.text( elem ) );
  6261. }
  6262. },
  6263. select: {
  6264. get: function( elem ) {
  6265. var value, option, i,
  6266. options = elem.options,
  6267. index = elem.selectedIndex,
  6268. one = elem.type === "select-one",
  6269. values = one ? null : [],
  6270. max = one ? index + 1 : options.length;
  6271. if ( index < 0 ) {
  6272. i = max;
  6273. } else {
  6274. i = one ? index : 0;
  6275. }
  6276. // Loop through all the selected options
  6277. for ( ; i < max; i++ ) {
  6278. option = options[ i ];
  6279. // Support: IE <=9 only
  6280. // IE8-9 doesn't update selected after form reset (#2551)
  6281. if ( ( option.selected || i === index ) &&
  6282. // Don't return options that are disabled or in a disabled optgroup
  6283. !option.disabled &&
  6284. ( !option.parentNode.disabled ||
  6285. !nodeName( option.parentNode, "optgroup" ) ) ) {
  6286. // Get the specific value for the option
  6287. value = jQuery( option ).val();
  6288. // We don't need an array for one selects
  6289. if ( one ) {
  6290. return value;
  6291. }
  6292. // Multi-Selects return an array
  6293. values.push( value );
  6294. }
  6295. }
  6296. return values;
  6297. },
  6298. set: function( elem, value ) {
  6299. var optionSet, option,
  6300. options = elem.options,
  6301. values = jQuery.makeArray( value ),
  6302. i = options.length;
  6303. while ( i-- ) {
  6304. option = options[ i ];
  6305. /* eslint-disable no-cond-assign */
  6306. if ( option.selected =
  6307. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  6308. ) {
  6309. optionSet = true;
  6310. }
  6311. /* eslint-enable no-cond-assign */
  6312. }
  6313. // Force browsers to behave consistently when non-matching value is set
  6314. if ( !optionSet ) {
  6315. elem.selectedIndex = -1;
  6316. }
  6317. return values;
  6318. }
  6319. }
  6320. }
  6321. } );
  6322. // Radios and checkboxes getter/setter
  6323. jQuery.each( [ "radio", "checkbox" ], function() {
  6324. jQuery.valHooks[ this ] = {
  6325. set: function( elem, value ) {
  6326. if ( Array.isArray( value ) ) {
  6327. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  6328. }
  6329. }
  6330. };
  6331. if ( !support.checkOn ) {
  6332. jQuery.valHooks[ this ].get = function( elem ) {
  6333. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  6334. };
  6335. }
  6336. } );
  6337. // Return jQuery for attributes-only inclusion
  6338. support.focusin = "onfocusin" in window;
  6339. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  6340. stopPropagationCallback = function( e ) {
  6341. e.stopPropagation();
  6342. };
  6343. jQuery.extend( jQuery.event, {
  6344. trigger: function( event, data, elem, onlyHandlers ) {
  6345. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  6346. eventPath = [ elem || document ],
  6347. type = hasOwn.call( event, "type" ) ? event.type : event,
  6348. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  6349. cur = lastElement = tmp = elem = elem || document;
  6350. // Don't do events on text and comment nodes
  6351. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  6352. return;
  6353. }
  6354. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  6355. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  6356. return;
  6357. }
  6358. if ( type.indexOf( "." ) > -1 ) {
  6359. // Namespaced trigger; create a regexp to match event type in handle()
  6360. namespaces = type.split( "." );
  6361. type = namespaces.shift();
  6362. namespaces.sort();
  6363. }
  6364. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  6365. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  6366. event = event[ jQuery.expando ] ?
  6367. event :
  6368. new jQuery.Event( type, typeof event === "object" && event );
  6369. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  6370. event.isTrigger = onlyHandlers ? 2 : 3;
  6371. event.namespace = namespaces.join( "." );
  6372. event.rnamespace = event.namespace ?
  6373. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  6374. null;
  6375. // Clean up the event in case it is being reused
  6376. event.result = undefined;
  6377. if ( !event.target ) {
  6378. event.target = elem;
  6379. }
  6380. // Clone any incoming data and prepend the event, creating the handler arg list
  6381. data = data == null ?
  6382. [ event ] :
  6383. jQuery.makeArray( data, [ event ] );
  6384. // Allow special events to draw outside the lines
  6385. special = jQuery.event.special[ type ] || {};
  6386. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  6387. return;
  6388. }
  6389. // Determine event propagation path in advance, per W3C events spec (#9951)
  6390. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  6391. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  6392. bubbleType = special.delegateType || type;
  6393. if ( !rfocusMorph.test( bubbleType + type ) ) {
  6394. cur = cur.parentNode;
  6395. }
  6396. for ( ; cur; cur = cur.parentNode ) {
  6397. eventPath.push( cur );
  6398. tmp = cur;
  6399. }
  6400. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  6401. if ( tmp === ( elem.ownerDocument || document ) ) {
  6402. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  6403. }
  6404. }
  6405. // Fire handlers on the event path
  6406. i = 0;
  6407. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  6408. lastElement = cur;
  6409. event.type = i > 1 ?
  6410. bubbleType :
  6411. special.bindType || type;
  6412. // jQuery handler
  6413. handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] &&
  6414. dataPriv.get( cur, "handle" );
  6415. if ( handle ) {
  6416. handle.apply( cur, data );
  6417. }
  6418. // Native handler
  6419. handle = ontype && cur[ ontype ];
  6420. if ( handle && handle.apply && acceptData( cur ) ) {
  6421. event.result = handle.apply( cur, data );
  6422. if ( event.result === false ) {
  6423. event.preventDefault();
  6424. }
  6425. }
  6426. }
  6427. event.type = type;
  6428. // If nobody prevented the default action, do it now
  6429. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  6430. if ( ( !special._default ||
  6431. special._default.apply( eventPath.pop(), data ) === false ) &&
  6432. acceptData( elem ) ) {
  6433. // Call a native DOM method on the target with the same name as the event.
  6434. // Don't do default actions on window, that's where global variables be (#6170)
  6435. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  6436. // Don't re-trigger an onFOO event when we call its FOO() method
  6437. tmp = elem[ ontype ];
  6438. if ( tmp ) {
  6439. elem[ ontype ] = null;
  6440. }
  6441. // Prevent re-triggering of the same event, since we already bubbled it above
  6442. jQuery.event.triggered = type;
  6443. if ( event.isPropagationStopped() ) {
  6444. lastElement.addEventListener( type, stopPropagationCallback );
  6445. }
  6446. elem[ type ]();
  6447. if ( event.isPropagationStopped() ) {
  6448. lastElement.removeEventListener( type, stopPropagationCallback );
  6449. }
  6450. jQuery.event.triggered = undefined;
  6451. if ( tmp ) {
  6452. elem[ ontype ] = tmp;
  6453. }
  6454. }
  6455. }
  6456. }
  6457. return event.result;
  6458. },
  6459. // Piggyback on a donor event to simulate a different one
  6460. // Used only for `focus(in | out)` events
  6461. simulate: function( type, elem, event ) {
  6462. var e = jQuery.extend(
  6463. new jQuery.Event(),
  6464. event,
  6465. {
  6466. type: type,
  6467. isSimulated: true
  6468. }
  6469. );
  6470. jQuery.event.trigger( e, null, elem );
  6471. }
  6472. } );
  6473. jQuery.fn.extend( {
  6474. trigger: function( type, data ) {
  6475. return this.each( function() {
  6476. jQuery.event.trigger( type, data, this );
  6477. } );
  6478. },
  6479. triggerHandler: function( type, data ) {
  6480. var elem = this[ 0 ];
  6481. if ( elem ) {
  6482. return jQuery.event.trigger( type, data, elem, true );
  6483. }
  6484. }
  6485. } );
  6486. // Support: Firefox <=44
  6487. // Firefox doesn't have focus(in | out) events
  6488. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  6489. //
  6490. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  6491. // focus(in | out) events fire after focus & blur events,
  6492. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  6493. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  6494. if ( !support.focusin ) {
  6495. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  6496. // Attach a single capturing handler on the document while someone wants focusin/focusout
  6497. var handler = function( event ) {
  6498. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  6499. };
  6500. jQuery.event.special[ fix ] = {
  6501. setup: function() {
  6502. // Handle: regular nodes (via `this.ownerDocument`), window
  6503. // (via `this.document`) & document (via `this`).
  6504. var doc = this.ownerDocument || this.document || this,
  6505. attaches = dataPriv.access( doc, fix );
  6506. if ( !attaches ) {
  6507. doc.addEventListener( orig, handler, true );
  6508. }
  6509. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  6510. },
  6511. teardown: function() {
  6512. var doc = this.ownerDocument || this.document || this,
  6513. attaches = dataPriv.access( doc, fix ) - 1;
  6514. if ( !attaches ) {
  6515. doc.removeEventListener( orig, handler, true );
  6516. dataPriv.remove( doc, fix );
  6517. } else {
  6518. dataPriv.access( doc, fix, attaches );
  6519. }
  6520. }
  6521. };
  6522. } );
  6523. }
  6524. // Cross-browser xml parsing
  6525. jQuery.parseXML = function( data ) {
  6526. var xml, parserErrorElem;
  6527. if ( !data || typeof data !== "string" ) {
  6528. return null;
  6529. }
  6530. // Support: IE 9 - 11 only
  6531. // IE throws on parseFromString with invalid input.
  6532. try {
  6533. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  6534. } catch ( e ) {}
  6535. parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
  6536. if ( !xml || parserErrorElem ) {
  6537. jQuery.error( "Invalid XML: " + (
  6538. parserErrorElem ?
  6539. jQuery.map( parserErrorElem.childNodes, function( el ) {
  6540. return el.textContent;
  6541. } ).join( "\n" ) :
  6542. data
  6543. ) );
  6544. }
  6545. return xml;
  6546. };
  6547. var
  6548. rbracket = /\[\]$/,
  6549. rCRLF = /\r?\n/g,
  6550. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  6551. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  6552. function buildParams( prefix, obj, traditional, add ) {
  6553. var name;
  6554. if ( Array.isArray( obj ) ) {
  6555. // Serialize array item.
  6556. jQuery.each( obj, function( i, v ) {
  6557. if ( traditional || rbracket.test( prefix ) ) {
  6558. // Treat each array item as a scalar.
  6559. add( prefix, v );
  6560. } else {
  6561. // Item is non-scalar (array or object), encode its numeric index.
  6562. buildParams(
  6563. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  6564. v,
  6565. traditional,
  6566. add
  6567. );
  6568. }
  6569. } );
  6570. } else if ( !traditional && toType( obj ) === "object" ) {
  6571. // Serialize object item.
  6572. for ( name in obj ) {
  6573. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  6574. }
  6575. } else {
  6576. // Serialize scalar item.
  6577. add( prefix, obj );
  6578. }
  6579. }
  6580. // Serialize an array of form elements or a set of
  6581. // key/values into a query string
  6582. jQuery.param = function( a, traditional ) {
  6583. var prefix,
  6584. s = [],
  6585. add = function( key, valueOrFunction ) {
  6586. // If value is a function, invoke it and use its return value
  6587. var value = isFunction( valueOrFunction ) ?
  6588. valueOrFunction() :
  6589. valueOrFunction;
  6590. s[ s.length ] = encodeURIComponent( key ) + "=" +
  6591. encodeURIComponent( value == null ? "" : value );
  6592. };
  6593. if ( a == null ) {
  6594. return "";
  6595. }
  6596. // If an array was passed in, assume that it is an array of form elements.
  6597. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  6598. // Serialize the form elements
  6599. jQuery.each( a, function() {
  6600. add( this.name, this.value );
  6601. } );
  6602. } else {
  6603. // If traditional, encode the "old" way (the way 1.3.2 or older
  6604. // did it), otherwise encode params recursively.
  6605. for ( prefix in a ) {
  6606. buildParams( prefix, a[ prefix ], traditional, add );
  6607. }
  6608. }
  6609. // Return the resulting serialization
  6610. return s.join( "&" );
  6611. };
  6612. jQuery.fn.extend( {
  6613. serialize: function() {
  6614. return jQuery.param( this.serializeArray() );
  6615. },
  6616. serializeArray: function() {
  6617. return this.map( function() {
  6618. // Can add propHook for "elements" to filter or add form elements
  6619. var elements = jQuery.prop( this, "elements" );
  6620. return elements ? jQuery.makeArray( elements ) : this;
  6621. } ).filter( function() {
  6622. var type = this.type;
  6623. // Use .is( ":disabled" ) so that fieldset[disabled] works
  6624. return this.name && !jQuery( this ).is( ":disabled" ) &&
  6625. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  6626. ( this.checked || !rcheckableType.test( type ) );
  6627. } ).map( function( _i, elem ) {
  6628. var val = jQuery( this ).val();
  6629. if ( val == null ) {
  6630. return null;
  6631. }
  6632. if ( Array.isArray( val ) ) {
  6633. return jQuery.map( val, function( val ) {
  6634. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  6635. } );
  6636. }
  6637. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  6638. } ).get();
  6639. }
  6640. } );
  6641. jQuery.fn.extend( {
  6642. wrapAll: function( html ) {
  6643. var wrap;
  6644. if ( this[ 0 ] ) {
  6645. if ( isFunction( html ) ) {
  6646. html = html.call( this[ 0 ] );
  6647. }
  6648. // The elements to wrap the target around
  6649. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  6650. if ( this[ 0 ].parentNode ) {
  6651. wrap.insertBefore( this[ 0 ] );
  6652. }
  6653. wrap.map( function() {
  6654. var elem = this;
  6655. while ( elem.firstElementChild ) {
  6656. elem = elem.firstElementChild;
  6657. }
  6658. return elem;
  6659. } ).append( this );
  6660. }
  6661. return this;
  6662. },
  6663. wrapInner: function( html ) {
  6664. if ( isFunction( html ) ) {
  6665. return this.each( function( i ) {
  6666. jQuery( this ).wrapInner( html.call( this, i ) );
  6667. } );
  6668. }
  6669. return this.each( function() {
  6670. var self = jQuery( this ),
  6671. contents = self.contents();
  6672. if ( contents.length ) {
  6673. contents.wrapAll( html );
  6674. } else {
  6675. self.append( html );
  6676. }
  6677. } );
  6678. },
  6679. wrap: function( html ) {
  6680. var htmlIsFunction = isFunction( html );
  6681. return this.each( function( i ) {
  6682. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  6683. } );
  6684. },
  6685. unwrap: function( selector ) {
  6686. this.parent( selector ).not( "body" ).each( function() {
  6687. jQuery( this ).replaceWith( this.childNodes );
  6688. } );
  6689. return this;
  6690. }
  6691. } );
  6692. jQuery.expr.pseudos.hidden = function( elem ) {
  6693. return !jQuery.expr.pseudos.visible( elem );
  6694. };
  6695. jQuery.expr.pseudos.visible = function( elem ) {
  6696. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  6697. };
  6698. // Support: Safari 8 only
  6699. // In Safari 8 documents created via document.implementation.createHTMLDocument
  6700. // collapse sibling forms: the second one becomes a child of the first one.
  6701. // Because of that, this security measure has to be disabled in Safari 8.
  6702. // https://bugs.webkit.org/show_bug.cgi?id=137337
  6703. support.createHTMLDocument = ( function() {
  6704. var body = document.implementation.createHTMLDocument( "" ).body;
  6705. body.innerHTML = "<form></form><form></form>";
  6706. return body.childNodes.length === 2;
  6707. } )();
  6708. // Argument "data" should be string of html
  6709. // context (optional): If specified, the fragment will be created in this context,
  6710. // defaults to document
  6711. // keepScripts (optional): If true, will include scripts passed in the html string
  6712. jQuery.parseHTML = function( data, context, keepScripts ) {
  6713. if ( typeof data !== "string" ) {
  6714. return [];
  6715. }
  6716. if ( typeof context === "boolean" ) {
  6717. keepScripts = context;
  6718. context = false;
  6719. }
  6720. var base, parsed, scripts;
  6721. if ( !context ) {
  6722. // Stop scripts or inline event handlers from being executed immediately
  6723. // by using document.implementation
  6724. if ( support.createHTMLDocument ) {
  6725. context = document.implementation.createHTMLDocument( "" );
  6726. // Set the base href for the created document
  6727. // so any parsed elements with URLs
  6728. // are based on the document's URL (gh-2965)
  6729. base = context.createElement( "base" );
  6730. base.href = document.location.href;
  6731. context.head.appendChild( base );
  6732. } else {
  6733. context = document;
  6734. }
  6735. }
  6736. parsed = rsingleTag.exec( data );
  6737. scripts = !keepScripts && [];
  6738. // Single tag
  6739. if ( parsed ) {
  6740. return [ context.createElement( parsed[ 1 ] ) ];
  6741. }
  6742. parsed = buildFragment( [ data ], context, scripts );
  6743. if ( scripts && scripts.length ) {
  6744. jQuery( scripts ).remove();
  6745. }
  6746. return jQuery.merge( [], parsed.childNodes );
  6747. };
  6748. jQuery.offset = {
  6749. setOffset: function( elem, options, i ) {
  6750. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  6751. position = jQuery.css( elem, "position" ),
  6752. curElem = jQuery( elem ),
  6753. props = {};
  6754. // Set position first, in-case top/left are set even on static elem
  6755. if ( position === "static" ) {
  6756. elem.style.position = "relative";
  6757. }
  6758. curOffset = curElem.offset();
  6759. curCSSTop = jQuery.css( elem, "top" );
  6760. curCSSLeft = jQuery.css( elem, "left" );
  6761. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  6762. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  6763. // Need to be able to calculate position if either
  6764. // top or left is auto and position is either absolute or fixed
  6765. if ( calculatePosition ) {
  6766. curPosition = curElem.position();
  6767. curTop = curPosition.top;
  6768. curLeft = curPosition.left;
  6769. } else {
  6770. curTop = parseFloat( curCSSTop ) || 0;
  6771. curLeft = parseFloat( curCSSLeft ) || 0;
  6772. }
  6773. if ( isFunction( options ) ) {
  6774. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  6775. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  6776. }
  6777. if ( options.top != null ) {
  6778. props.top = ( options.top - curOffset.top ) + curTop;
  6779. }
  6780. if ( options.left != null ) {
  6781. props.left = ( options.left - curOffset.left ) + curLeft;
  6782. }
  6783. if ( "using" in options ) {
  6784. options.using.call( elem, props );
  6785. } else {
  6786. curElem.css( props );
  6787. }
  6788. }
  6789. };
  6790. jQuery.fn.extend( {
  6791. // offset() relates an element's border box to the document origin
  6792. offset: function( options ) {
  6793. // Preserve chaining for setter
  6794. if ( arguments.length ) {
  6795. return options === undefined ?
  6796. this :
  6797. this.each( function( i ) {
  6798. jQuery.offset.setOffset( this, options, i );
  6799. } );
  6800. }
  6801. var rect, win,
  6802. elem = this[ 0 ];
  6803. if ( !elem ) {
  6804. return;
  6805. }
  6806. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  6807. // Support: IE <=11 only
  6808. // Running getBoundingClientRect on a
  6809. // disconnected node in IE throws an error
  6810. if ( !elem.getClientRects().length ) {
  6811. return { top: 0, left: 0 };
  6812. }
  6813. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  6814. rect = elem.getBoundingClientRect();
  6815. win = elem.ownerDocument.defaultView;
  6816. return {
  6817. top: rect.top + win.pageYOffset,
  6818. left: rect.left + win.pageXOffset
  6819. };
  6820. },
  6821. // position() relates an element's margin box to its offset parent's padding box
  6822. // This corresponds to the behavior of CSS absolute positioning
  6823. position: function() {
  6824. if ( !this[ 0 ] ) {
  6825. return;
  6826. }
  6827. var offsetParent, offset, doc,
  6828. elem = this[ 0 ],
  6829. parentOffset = { top: 0, left: 0 };
  6830. // position:fixed elements are offset from the viewport, which itself always has zero offset
  6831. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  6832. // Assume position:fixed implies availability of getBoundingClientRect
  6833. offset = elem.getBoundingClientRect();
  6834. } else {
  6835. offset = this.offset();
  6836. // Account for the *real* offset parent, which can be the document or its root element
  6837. // when a statically positioned element is identified
  6838. doc = elem.ownerDocument;
  6839. offsetParent = elem.offsetParent || doc.documentElement;
  6840. while ( offsetParent &&
  6841. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  6842. jQuery.css( offsetParent, "position" ) === "static" ) {
  6843. offsetParent = offsetParent.parentNode;
  6844. }
  6845. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  6846. // Incorporate borders into its offset, since they are outside its content origin
  6847. parentOffset = jQuery( offsetParent ).offset();
  6848. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  6849. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  6850. }
  6851. }
  6852. // Subtract parent offsets and element margins
  6853. return {
  6854. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  6855. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  6856. };
  6857. },
  6858. // This method will return documentElement in the following cases:
  6859. // 1) For the element inside the iframe without offsetParent, this method will return
  6860. // documentElement of the parent window
  6861. // 2) For the hidden or detached element
  6862. // 3) For body or html element, i.e. in case of the html node - it will return itself
  6863. //
  6864. // but those exceptions were never presented as a real life use-cases
  6865. // and might be considered as more preferable results.
  6866. //
  6867. // This logic, however, is not guaranteed and can change at any point in the future
  6868. offsetParent: function() {
  6869. return this.map( function() {
  6870. var offsetParent = this.offsetParent;
  6871. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  6872. offsetParent = offsetParent.offsetParent;
  6873. }
  6874. return offsetParent || documentElement;
  6875. } );
  6876. }
  6877. } );
  6878. // Create scrollLeft and scrollTop methods
  6879. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  6880. var top = "pageYOffset" === prop;
  6881. jQuery.fn[ method ] = function( val ) {
  6882. return access( this, function( elem, method, val ) {
  6883. // Coalesce documents and windows
  6884. var win;
  6885. if ( isWindow( elem ) ) {
  6886. win = elem;
  6887. } else if ( elem.nodeType === 9 ) {
  6888. win = elem.defaultView;
  6889. }
  6890. if ( val === undefined ) {
  6891. return win ? win[ prop ] : elem[ method ];
  6892. }
  6893. if ( win ) {
  6894. win.scrollTo(
  6895. !top ? val : win.pageXOffset,
  6896. top ? val : win.pageYOffset
  6897. );
  6898. } else {
  6899. elem[ method ] = val;
  6900. }
  6901. }, method, val, arguments.length );
  6902. };
  6903. } );
  6904. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  6905. // Add the top/left cssHooks using jQuery.fn.position
  6906. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  6907. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  6908. // getComputedStyle returns percent when specified for top/left/bottom/right;
  6909. // rather than make the css module depend on the offset module, just check for it here
  6910. jQuery.each( [ "top", "left" ], function( _i, prop ) {
  6911. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  6912. function( elem, computed ) {
  6913. if ( computed ) {
  6914. computed = curCSS( elem, prop );
  6915. // If curCSS returns percentage, fallback to offset
  6916. return rnumnonpx.test( computed ) ?
  6917. jQuery( elem ).position()[ prop ] + "px" :
  6918. computed;
  6919. }
  6920. }
  6921. );
  6922. } );
  6923. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  6924. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  6925. jQuery.each( {
  6926. padding: "inner" + name,
  6927. content: type,
  6928. "": "outer" + name
  6929. }, function( defaultExtra, funcName ) {
  6930. // Margin is only for outerHeight, outerWidth
  6931. jQuery.fn[ funcName ] = function( margin, value ) {
  6932. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  6933. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  6934. return access( this, function( elem, type, value ) {
  6935. var doc;
  6936. if ( isWindow( elem ) ) {
  6937. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  6938. return funcName.indexOf( "outer" ) === 0 ?
  6939. elem[ "inner" + name ] :
  6940. elem.document.documentElement[ "client" + name ];
  6941. }
  6942. // Get document width or height
  6943. if ( elem.nodeType === 9 ) {
  6944. doc = elem.documentElement;
  6945. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  6946. // whichever is greatest
  6947. return Math.max(
  6948. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  6949. elem.body[ "offset" + name ], doc[ "offset" + name ],
  6950. doc[ "client" + name ]
  6951. );
  6952. }
  6953. return value === undefined ?
  6954. // Get width or height on the element, requesting but not forcing parseFloat
  6955. jQuery.css( elem, type, extra ) :
  6956. // Set width or height on the element
  6957. jQuery.style( elem, type, value, extra );
  6958. }, type, chainable ? margin : undefined, chainable );
  6959. };
  6960. } );
  6961. } );
  6962. jQuery.fn.extend( {
  6963. bind: function( types, data, fn ) {
  6964. return this.on( types, null, data, fn );
  6965. },
  6966. unbind: function( types, fn ) {
  6967. return this.off( types, null, fn );
  6968. },
  6969. delegate: function( selector, types, data, fn ) {
  6970. return this.on( types, selector, data, fn );
  6971. },
  6972. undelegate: function( selector, types, fn ) {
  6973. // ( namespace ) or ( selector, types [, fn] )
  6974. return arguments.length === 1 ?
  6975. this.off( selector, "**" ) :
  6976. this.off( types, selector || "**", fn );
  6977. },
  6978. hover: function( fnOver, fnOut ) {
  6979. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  6980. }
  6981. } );
  6982. jQuery.each(
  6983. ( "blur focus focusin focusout resize scroll click dblclick " +
  6984. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  6985. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  6986. function( _i, name ) {
  6987. // Handle event binding
  6988. jQuery.fn[ name ] = function( data, fn ) {
  6989. return arguments.length > 0 ?
  6990. this.on( name, null, data, fn ) :
  6991. this.trigger( name );
  6992. };
  6993. }
  6994. );
  6995. // Support: Android <=4.0 only
  6996. // Make sure we trim BOM and NBSP
  6997. var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  6998. // Bind a function to a context, optionally partially applying any
  6999. // arguments.
  7000. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  7001. // However, it is not slated for removal any time soon
  7002. jQuery.proxy = function( fn, context ) {
  7003. var tmp, args, proxy;
  7004. if ( typeof context === "string" ) {
  7005. tmp = fn[ context ];
  7006. context = fn;
  7007. fn = tmp;
  7008. }
  7009. // Quick check to determine if target is callable, in the spec
  7010. // this throws a TypeError, but we will just return undefined.
  7011. if ( !isFunction( fn ) ) {
  7012. return undefined;
  7013. }
  7014. // Simulated bind
  7015. args = slice.call( arguments, 2 );
  7016. proxy = function() {
  7017. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  7018. };
  7019. // Set the guid of unique handler to the same of original handler, so it can be removed
  7020. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  7021. return proxy;
  7022. };
  7023. jQuery.holdReady = function( hold ) {
  7024. if ( hold ) {
  7025. jQuery.readyWait++;
  7026. } else {
  7027. jQuery.ready( true );
  7028. }
  7029. };
  7030. jQuery.isArray = Array.isArray;
  7031. jQuery.parseJSON = JSON.parse;
  7032. jQuery.nodeName = nodeName;
  7033. jQuery.isFunction = isFunction;
  7034. jQuery.isWindow = isWindow;
  7035. jQuery.camelCase = camelCase;
  7036. jQuery.type = toType;
  7037. jQuery.now = Date.now;
  7038. jQuery.isNumeric = function( obj ) {
  7039. // As of jQuery 3.0, isNumeric is limited to
  7040. // strings and numbers (primitives or objects)
  7041. // that can be coerced to finite numbers (gh-2662)
  7042. var type = jQuery.type( obj );
  7043. return ( type === "number" || type === "string" ) &&
  7044. // parseFloat NaNs numeric-cast false positives ("")
  7045. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  7046. // subtraction forces infinities to NaN
  7047. !isNaN( obj - parseFloat( obj ) );
  7048. };
  7049. jQuery.trim = function( text ) {
  7050. return text == null ?
  7051. "" :
  7052. ( text + "" ).replace( rtrim, "" );
  7053. };
  7054. // Register as a named AMD module, since jQuery can be concatenated with other
  7055. // files that may use define, but not via a proper concatenation script that
  7056. // understands anonymous AMD modules. A named AMD is safest and most robust
  7057. // way to register. Lowercase jquery is used because AMD module names are
  7058. // derived from file names, and jQuery is normally delivered in a lowercase
  7059. // file name. Do this after creating the global so that if an AMD module wants
  7060. // to call noConflict to hide this version of jQuery, it will work.
  7061. // Note that for maximum portability, libraries that are not jQuery should
  7062. // declare themselves as anonymous modules, and avoid setting a global if an
  7063. // AMD loader is present. jQuery is a special case. For more information, see
  7064. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  7065. if ( typeof define === "function" && define.amd ) {
  7066. define( "jquery", [], function() {
  7067. return jQuery;
  7068. } );
  7069. }
  7070. var
  7071. // Map over jQuery in case of overwrite
  7072. _jQuery = window.jQuery,
  7073. // Map over the $ in case of overwrite
  7074. _$ = window.$;
  7075. jQuery.noConflict = function( deep ) {
  7076. if ( window.$ === jQuery ) {
  7077. window.$ = _$;
  7078. }
  7079. if ( deep && window.jQuery === jQuery ) {
  7080. window.jQuery = _jQuery;
  7081. }
  7082. return jQuery;
  7083. };
  7084. // Expose jQuery and $ identifiers, even in AMD
  7085. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  7086. // and CommonJS for browser emulators (#13566)
  7087. if ( typeof noGlobal === "undefined" ) {
  7088. window.jQuery = window.$ = jQuery;
  7089. }
  7090. return jQuery;
  7091. } );