😎 Give your xaringan slides some style
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

10882 lines
282KB

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