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