jQuery Core uncompressed

JavaScript library for DOM operations

目前为 2023-05-11 提交的版本。查看 最新版本

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/446665/1189214/jQuery%20Core%20uncompressed.js

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