1/*! 2 * jQuery JavaScript Library v3.3.1 3 * https://jquery.com/ 4 * 5 * Includes Sizzle.js 6 * https://sizzlejs.com/ 7 * 8 * Copyright JS Foundation and other contributors 9 * Released under the MIT license 10 * https://jquery.org/license 11 * 12 * Date: 2018-01-20T17:24Z 13 */
vendor: 271,488 bytes, lines 14-10365
14 15( function( global, factory ) { 16 17 "use strict"; 18 19 if ( typeof module === "object" && typeof module.exports === "object" ) { 20 21 // For CommonJS and CommonJS-like environments where a proper `window` 22 // is present, execute the factory and get jQuery. 23 // For environments that do not have a `window` with a `document` 24 // (such as Node.js), expose a factory as module.exports. 25 // This accentuates the need for the creation of a real `window`. 26 // e.g. var jQuery = require("jquery")(window); 27 // See ticket #14549 for more info. 28 module.exports = global.document ? 29 factory( global, true ) : 30 function( w ) { 31 if ( !w.document ) { 32 throw new Error( "jQuery requires a window with a document" ); 33 } 34 return factory( w ); 35 }; 36 } else { 37 factory( global ); 38 } 39 40// Pass this if window is not defined yet 41} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 42 43// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 44// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 45// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 46// enough that all such attempts are guarded in a try block. 47"use strict"; 48 49var arr = []; 50 51var document = window.document; 52 53var getProto = Object.getPrototypeOf; 54 55var slice = arr.slice; 56 57var concat = arr.concat; 58 59var push = arr.push; 60 61var indexOf = arr.indexOf; 62 63var class2type = {}; 64 65var toString = class2type.toString; 66 67var hasOwn = class2type.hasOwnProperty; 68 69var fnToString = hasOwn.toString; 70 71var ObjectFunctionString = fnToString.call( Object ); 72 73var support = {}; 74 75var isFunction = function isFunction( obj ) { 76 77 // Support: Chrome <=57, Firefox <=52 78 // In some browsers, typeof returns "function" for HTML <object> elements 79 // (i.e., `typeof document.createElement( "object" ) === "function"`). 80 // We don't want to classify *any* DOM node as a function. 81 return typeof obj === "function" && typeof obj.nodeType !== "number"; 82 }; 83 84 85var isWindow = function isWindow( obj ) { 86 return obj != null && obj === obj.window; 87 }; 88 89 90 91 92 var preservedScriptAttributes = { 93 type: true, 94 src: true, 95 noModule: true 96 }; 97 98 function DOMEval( code, doc, node ) { 99 doc = doc || document; 100 101 var i, 102 script = doc.createElement( "script" ); 103 104 script.text = code; 105 if ( node ) { 106 for ( i in preservedScriptAttributes ) { 107 if ( node[ i ] ) { 108 script[ i ] = node[ i ]; 109 } 110 } 111 } 112 doc.head.appendChild( script ).parentNode.removeChild( script ); 113 } 114 115 116function toType( obj ) { 117 if ( obj == null ) { 118 return obj + ""; 119 } 120 121 // Support: Android <=2.3 only (functionish RegExp) 122 return typeof obj === "object" || typeof obj === "function" ? 123 class2type[ toString.call( obj ) ] || "object" : 124 typeof obj; 125} 126/* global Symbol */ 127// Defining this global in .eslintrc.json would create a danger of using the global 128// unguarded in another place, it seems safer to define global only for this module 129 130 131 132var 133 version = "3.3.1", 134 135 // Define a local copy of jQuery 136 jQuery = function( selector, context ) { 137 138 // The jQuery object is actually just the init constructor 'enhanced' 139 // Need init if jQuery is called (just allow error to be thrown if not included) 140 return new jQuery.fn.init( selector, context ); 141 }, 142 143 // Support: Android <=4.0 only 144 // Make sure we trim BOM and NBSP 145 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; 146 147jQuery.fn = jQuery.prototype = { 148 149 // The current version of jQuery being used 150 jquery: version, 151 152 constructor: jQuery, 153 154 // The default length of a jQuery object is 0 155 length: 0, 156 157 toArray: function() { 158 return slice.call( this ); 159 }, 160 161 // Get the Nth element in the matched element set OR 162 // Get the whole matched element set as a clean array 163 get: function( num ) { 164 165 // Return all the elements in a clean array 166 if ( num == null ) { 167 return slice.call( this ); 168 } 169 170 // Return just the one element from the set 171 return num < 0 ? this[ num + this.length ] : this[ num ]; 172 }, 173 174 // Take an array of elements and push it onto the stack 175 // (returning the new matched element set) 176 pushStack: function( elems ) { 177 178 // Build a new jQuery matched element set 179 var ret = jQuery.merge( this.constructor(), elems ); 180 181 // Add the old object onto the stack (as a reference) 182 ret.prevObject = this; 183 184 // Return the newly-formed element set 185 return ret; 186 }, 187 188 // Execute a callback for every element in the matched set. 189 each: function( callback ) { 190 return jQuery.each( this, callback ); 191 }, 192 193 map: function( callback ) { 194 return this.pushStack( jQuery.map( this, function( elem, i ) { 195 return callback.call( elem, i, elem ); 196 } ) ); 197 }, 198 199 slice: function() { 200 return this.pushStack( slice.apply( this, arguments ) ); 201 }, 202 203 first: function() { 204 return this.eq( 0 ); 205 }, 206 207 last: function() { 208 return this.eq( -1 ); 209 }, 210 211 eq: function( i ) { 212 var len = this.length, 213 j = +i + ( i < 0 ? len : 0 ); 214 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 215 }, 216 217 end: function() { 218 return this.prevObject || this.constructor(); 219 }, 220 221 // For internal use only. 222 // Behaves like an Array's method, not like a jQuery method. 223 push: push, 224 sort: arr.sort, 225 splice: arr.splice 226}; 227 228jQuery.extend = jQuery.fn.extend = function() { 229 var options, name, src, copy, copyIsArray, clone, 230 target = arguments[ 0 ] || {}, 231 i = 1, 232 length = arguments.length, 233 deep = false; 234 235 // Handle a deep copy situation 236 if ( typeof target === "boolean" ) { 237 deep = target; 238 239 // Skip the boolean and the target 240 target = arguments[ i ] || {}; 241 i++; 242 } 243 244 // Handle case when target is a string or something (possible in deep copy) 245 if ( typeof target !== "object" && !isFunction( target ) ) { 246 target = {}; 247 } 248 249 // Extend jQuery itself if only one argument is passed 250 if ( i === length ) { 251 target = this; 252 i--; 253 } 254 255 for ( ; i < length; i++ ) { 256 257 // Only deal with non-null/undefined values 258 if ( ( options = arguments[ i ] ) != null ) { 259 260 // Extend the base object 261 for ( name in options ) { 262 src = target[ name ]; 263 copy = options[ name ]; 264 265 // Prevent never-ending loop 266 if ( target === copy ) { 267 continue; 268 } 269 270 // Recurse if we're merging plain objects or arrays 271 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 272 ( copyIsArray = Array.isArray( copy ) ) ) ) { 273 274 if ( copyIsArray ) { 275 copyIsArray = false; 276 clone = src && Array.isArray( src ) ? src : []; 277 278 } else { 279 clone = src && jQuery.isPlainObject( src ) ? src : {}; 280 } 281 282 // Never move original objects, clone them 283 target[ name ] = jQuery.extend( deep, clone, copy ); 284 285 // Don't bring in undefined values 286 } else if ( copy !== undefined ) { 287 target[ name ] = copy; 288 } 289 } 290 } 291 } 292 293 // Return the modified object 294 return target; 295}; 296 297jQuery.extend( { 298 299 // Unique for each copy of jQuery on the page 300 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 301 302 // Assume jQuery is ready without the ready module 303 isReady: true, 304 305 error: function( msg ) { 306 throw new Error( msg ); 307 }, 308 309 noop: function() {}, 310 311 isPlainObject: function( obj ) { 312 var proto, Ctor; 313 314 // Detect obvious negatives 315 // Use toString instead of jQuery.type to catch host objects 316 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 317 return false; 318 } 319 320 proto = getProto( obj ); 321 322 // Objects with no prototype (e.g., `Object.create( null )`) are plain 323 if ( !proto ) { 324 return true; 325 } 326 327 // Objects with prototype are plain iff they were constructed by a global Object function 328 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 329 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 330 }, 331 332 isEmptyObject: function( obj ) { 333 334 /* eslint-disable no-unused-vars */ 335 // See https://github.com/eslint/eslint/issues/6125 336 var name; 337 338 for ( name in obj ) { 339 return false; 340 } 341 return true; 342 }, 343 344 // Evaluates a script in a global context 345 globalEval: function( code ) { 346 DOMEval( code ); 347 }, 348 349 each: function( obj, callback ) { 350 var length, i = 0; 351 352 if ( isArrayLike( obj ) ) { 353 length = obj.length; 354 for ( ; i < length; i++ ) { 355 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 356 break; 357 } 358 } 359 } else { 360 for ( i in obj ) { 361 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 362 break; 363 } 364 } 365 } 366 367 return obj; 368 }, 369 370 // Support: Android <=4.0 only 371 trim: function( text ) { 372 return text == null ? 373 "" : 374 ( text + "" ).replace( rtrim, "" ); 375 }, 376 377 // results is for internal usage only 378 makeArray: function( arr, results ) { 379 var ret = results || []; 380 381 if ( arr != null ) { 382 if ( isArrayLike( Object( arr ) ) ) { 383 jQuery.merge( ret, 384 typeof arr === "string" ? 385 [ arr ] : arr 386 ); 387 } else { 388 push.call( ret, arr ); 389 } 390 } 391 392 return ret; 393 }, 394 395 inArray: function( elem, arr, i ) { 396 return arr == null ? -1 : indexOf.call( arr, elem, i ); 397 }, 398 399 // Support: Android <=4.0 only, PhantomJS 1 only 400 // push.apply(_, arraylike) throws on ancient WebKit 401 merge: function( first, second ) { 402 var len = +second.length, 403 j = 0, 404 i = first.length; 405 406 for ( ; j < len; j++ ) { 407 first[ i++ ] = second[ j ]; 408 } 409 410 first.length = i; 411 412 return first; 413 }, 414 415 grep: function( elems, callback, invert ) { 416 var callbackInverse, 417 matches = [], 418 i = 0, 419 length = elems.length, 420 callbackExpect = !invert; 421 422 // Go through the array, only saving the items 423 // that pass the validator function 424 for ( ; i < length; i++ ) { 425 callbackInverse = !callback( elems[ i ], i ); 426 if ( callbackInverse !== callbackExpect ) { 427 matches.push( elems[ i ] ); 428 } 429 } 430 431 return matches; 432 }, 433 434 // arg is for internal usage only 435 map: function( elems, callback, arg ) { 436 var length, value, 437 i = 0, 438 ret = []; 439 440 // Go through the array, translating each of the items to their new values 441 if ( isArrayLike( elems ) ) { 442 length = elems.length; 443 for ( ; i < length; i++ ) { 444 value = callback( elems[ i ], i, arg ); 445 446 if ( value != null ) { 447 ret.push( value ); 448 } 449 } 450 451 // Go through every key on the object, 452 } else { 453 for ( i in elems ) { 454 value = callback( elems[ i ], i, arg ); 455 456 if ( value != null ) { 457 ret.push( value ); 458 } 459 } 460 } 461 462 // Flatten any nested arrays 463 return concat.apply( [], ret ); 464 }, 465 466 // A global GUID counter for objects 467 guid: 1, 468 469 // jQuery.support is not used in Core but other projects attach their 470 // properties to it so it needs to exist. 471 support: support 472} ); 473 474if ( typeof Symbol === "function" ) { 475 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 476} 477 478// Populate the class2type map 479jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 480function( i, name ) { 481 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 482} ); 483 484function isArrayLike( obj ) { 485 486 // Support: real iOS 8.2 only (not reproducible in simulator) 487 // `in` check used to prevent JIT error (gh-2145) 488 // hasOwn isn't used here due to false negatives 489 // regarding Nodelist length in IE 490 var length = !!obj && "length" in obj && obj.length, 491 type = toType( obj ); 492 493 if ( isFunction( obj ) || isWindow( obj ) ) { 494 return false; 495 } 496 497 return type === "array" || length === 0 || 498 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 499} 500var Sizzle = 501/*! 502 * Sizzle CSS Selector Engine v2.3.3 503 * https://sizzlejs.com/ 504 * 505 * Copyright jQuery Foundation and other contributors 506 * Released under the MIT license 507 * http://jquery.org/license 508 * 509 * Date: 2016-08-08 510 */ 511(function( window ) { 512 513var i, 514 support, 515 Expr, 516 getText, 517 isXML, 518 tokenize, 519 compile, 520 select, 521 outermostContext, 522 sortInput, 523 hasDuplicate, 524 525 // Local document vars 526 setDocument, 527 document, 528 docElem, 529 documentIsHTML, 530 rbuggyQSA, 531 rbuggyMatches, 532 matches, 533 contains, 534 535 // Instance-specific data 536 expando = "sizzle" + 1 * new Date(), 537 preferredDoc = window.document, 538 dirruns = 0, 539 done = 0, 540 classCache = createCache(), 541 tokenCache = createCache(), 542 compilerCache = createCache(), 543 sortOrder = function( a, b ) { 544 if ( a === b ) { 545 hasDuplicate = true; 546 } 547 return 0; 548 }, 549 550 // Instance methods 551 hasOwn = ({}).hasOwnProperty, 552 arr = [], 553 pop = arr.pop, 554 push_native = arr.push, 555 push = arr.push, 556 slice = arr.slice, 557 // Use a stripped-down indexOf as it's faster than native 558 // https://jsperf.com/thor-indexof-vs-for/5 559 indexOf = function( list, elem ) { 560 var i = 0, 561 len = list.length; 562 for ( ; i < len; i++ ) { 563 if ( list[i] === elem ) { 564 return i; 565 } 566 } 567 return -1; 568 }, 569 570 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", 571 572 // Regular expressions 573 574 // http://www.w3.org/TR/css3-selectors/#whitespace 575 whitespace = "[\\x20\\t\\r\\n\\f]", 576 577 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier 578 identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", 579 580 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 581 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 582 // Operator (capture 2) 583 "*([*^$|!~]?=)" + whitespace + 584 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 585 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + 586 "*\\]", 587 588 pseudos = ":(" + identifier + ")(?:\\((" + 589 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 590 // 1. quoted (capture 3; capture 4 or capture 5) 591 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 592 // 2. simple (capture 6) 593 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 594 // 3. anything else (capture 2) 595 ".*" + 596 ")\\)|)", 597 598 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 599 rwhitespace = new RegExp( whitespace + "+", "g" ), 600 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), 601 602 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 603 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), 604 605 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), 606 607 rpseudo = new RegExp( pseudos ), 608 ridentifier = new RegExp( "^" + identifier + "$" ), 609 610 matchExpr = { 611 "ID": new RegExp( "^#(" + identifier + ")" ), 612 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), 613 "TAG": new RegExp( "^(" + identifier + "|[*])" ), 614 "ATTR": new RegExp( "^" + attributes ), 615 "PSEUDO": new RegExp( "^" + pseudos ), 616 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + 617 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + 618 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 619 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 620 // For use in libraries implementing .is() 621 // We use this for POS matching in `select` 622 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + 623 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 624 }, 625 626 rinputs = /^(?:input|select|textarea|button)$/i, 627 rheader = /^h\d$/i, 628 629 rnative = /^[^{]+\{\s*\[native \w/, 630 631 // Easily-parseable/retrievable ID or TAG or CLASS selectors 632 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 633 634 rsibling = /[+~]/, 635 636 // CSS escapes 637 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 638 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), 639 funescape = function( _, escaped, escapedWhitespace ) { 640 var high = "0x" + escaped - 0x10000; 641 // NaN means non-codepoint 642 // Support: Firefox<24 643 // Workaround erroneous numeric interpretation of +"0x" 644 return high !== high || escapedWhitespace ? 645 escaped : 646 high < 0 ? 647 // BMP codepoint 648 String.fromCharCode( high + 0x10000 ) : 649 // Supplemental Plane codepoint (surrogate pair) 650 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 651 }, 652 653 // CSS string/identifier serialization 654 // https://drafts.csswg.org/cssom/#common-serializing-idioms 655 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, 656 fcssescape = function( ch, asCodePoint ) { 657 if ( asCodePoint ) { 658 659 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 660 if ( ch === "\0" ) { 661 return "\uFFFD"; 662 } 663 664 // Control characters and (dependent upon position) numbers get escaped as code points 665 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 666 } 667 668 // Other potentially-special ASCII characters get backslash-escaped 669 return "\\" + ch; 670 }, 671 672 // Used for iframes 673 // See setDocument() 674 // Removing the function wrapper causes a "Permission Denied" 675 // error in IE 676 unloadHandler = function() { 677 setDocument(); 678 }, 679 680 disabledAncestor = addCombinator( 681 function( elem ) { 682 return elem.disabled === true && ("form" in elem || "label" in elem); 683 }, 684 { dir: "parentNode", next: "legend" } 685 ); 686 687// Optimize for push.apply( _, NodeList ) 688try { 689 push.apply( 690 (arr = slice.call( preferredDoc.childNodes )), 691 preferredDoc.childNodes 692 ); 693 // Support: Android<4.0 694 // Detect silently failing push.apply 695 arr[ preferredDoc.childNodes.length ].nodeType; 696} catch ( e ) { 697 push = { apply: arr.length ? 698 699 // Leverage slice if possible 700 function( target, els ) { 701 push_native.apply( target, slice.call(els) ); 702 } : 703 704 // Support: IE<9 705 // Otherwise append directly 706 function( target, els ) { 707 var j = target.length, 708 i = 0; 709 // Can't trust NodeList.length 710 while ( (target[j++] = els[i++]) ) {} 711 target.length = j - 1; 712 } 713 }; 714} 715 716function Sizzle( selector, context, results, seed ) { 717 var m, i, elem, nid, match, groups, newSelector, 718 newContext = context && context.ownerDocument, 719 720 // nodeType defaults to 9, since context defaults to document 721 nodeType = context ? context.nodeType : 9; 722 723 results = results || []; 724 725 // Return early from calls with invalid selector or context 726 if ( typeof selector !== "string" || !selector || 727 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 728 729 return results; 730 } 731 732 // Try to shortcut find operations (as opposed to filters) in HTML documents 733 if ( !seed ) { 734 735 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { 736 setDocument( context ); 737 } 738 context = context || document; 739 740 if ( documentIsHTML ) { 741 742 // If the selector is sufficiently simple, try using a "get*By*" DOM method 743 // (excepting DocumentFragment context, where the methods don't exist) 744 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { 745 746 // ID selector 747 if ( (m = match[1]) ) { 748 749 // Document context 750 if ( nodeType === 9 ) { 751 if ( (elem = context.getElementById( m )) ) { 752 753 // Support: IE, Opera, Webkit 754 // TODO: identify versions 755 // getElementById can match elements by name instead of ID 756 if ( elem.id === m ) { 757 results.push( elem ); 758 return results; 759 } 760 } else { 761 return results; 762 } 763 764 // Element context 765 } else { 766 767 // Support: IE, Opera, Webkit 768 // TODO: identify versions 769 // getElementById can match elements by name instead of ID 770 if ( newContext && (elem = newContext.getElementById( m )) && 771 contains( context, elem ) && 772 elem.id === m ) { 773 774 results.push( elem ); 775 return results; 776 } 777 } 778 779 // Type selector 780 } else if ( match[2] ) { 781 push.apply( results, context.getElementsByTagName( selector ) ); 782 return results; 783 784 // Class selector 785 } else if ( (m = match[3]) && support.getElementsByClassName && 786 context.getElementsByClassName ) { 787 788 push.apply( results, context.getElementsByClassName( m ) ); 789 return results; 790 } 791 } 792 793 // Take advantage of querySelectorAll 794 if ( support.qsa && 795 !compilerCache[ selector + " " ] && 796 (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { 797 798 if ( nodeType !== 1 ) { 799 newContext = context; 800 newSelector = selector; 801 802 // qSA looks outside Element context, which is not what we want 803 // Thanks to Andrew Dupont for this workaround technique 804 // Support: IE <=8 805 // Exclude object elements 806 } else if ( context.nodeName.toLowerCase() !== "object" ) { 807 808 // Capture the context ID, setting it first if necessary 809 if ( (nid = context.getAttribute( "id" )) ) { 810 nid = nid.replace( rcssescape, fcssescape ); 811 } else { 812 context.setAttribute( "id", (nid = expando) ); 813 } 814 815 // Prefix every selector in the list 816 groups = tokenize( selector ); 817 i = groups.length; 818 while ( i-- ) { 819 groups[i] = "#" + nid + " " + toSelector( groups[i] ); 820 } 821 newSelector = groups.join( "," ); 822 823 // Expand context for sibling selectors 824 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 825 context; 826 } 827 828 if ( newSelector ) { 829 try { 830 push.apply( results, 831 newContext.querySelectorAll( newSelector ) 832 ); 833 return results; 834 } catch ( qsaError ) { 835 } finally { 836 if ( nid === expando ) { 837 context.removeAttribute( "id" ); 838 } 839 } 840 } 841 } 842 } 843 } 844 845 // All others 846 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 847} 848 849/** 850 * Create key-value caches of limited size 851 * @returns {function(string, object)} Returns the Object data after storing it on itself with 852 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 853 * deleting the oldest entry 854 */ 855function createCache() { 856 var keys = []; 857 858 function cache( key, value ) { 859 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 860 if ( keys.push( key + " " ) > Expr.cacheLength ) { 861 // Only keep the most recent entries 862 delete cache[ keys.shift() ]; 863 } 864 return (cache[ key + " " ] = value); 865 } 866 return cache; 867} 868 869/** 870 * Mark a function for special use by Sizzle 871 * @param {Function} fn The function to mark 872 */ 873function markFunction( fn ) { 874 fn[ expando ] = true; 875 return fn; 876} 877 878/** 879 * Support testing using an element 880 * @param {Function} fn Passed the created element and returns a boolean result 881 */ 882function assert( fn ) { 883 var el = document.createElement("fieldset"); 884 885 try { 886 return !!fn( el ); 887 } catch (e) { 888 return false; 889 } finally { 890 // Remove from its parent by default 891 if ( el.parentNode ) { 892 el.parentNode.removeChild( el ); 893 } 894 // release memory in IE 895 el = null; 896 } 897} 898 899/** 900 * Adds the same handler for all of the specified attrs 901 * @param {String} attrs Pipe-separated list of attributes 902 * @param {Function} handler The method that will be applied 903 */ 904function addHandle( attrs, handler ) { 905 var arr = attrs.split("|"), 906 i = arr.length; 907 908 while ( i-- ) { 909 Expr.attrHandle[ arr[i] ] = handler; 910 } 911} 912 913/** 914 * Checks document order of two siblings 915 * @param {Element} a 916 * @param {Element} b 917 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 918 */ 919function siblingCheck( a, b ) { 920 var cur = b && a, 921 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 922 a.sourceIndex - b.sourceIndex; 923 924 // Use IE sourceIndex if available on both nodes 925 if ( diff ) { 926 return diff; 927 } 928 929 // Check if b follows a 930 if ( cur ) { 931 while ( (cur = cur.nextSibling) ) { 932 if ( cur === b ) { 933 return -1; 934 } 935 } 936 } 937 938 return a ? 1 : -1; 939} 940 941/** 942 * Returns a function to use in pseudos for input types 943 * @param {String} type 944 */ 945function createInputPseudo( type ) { 946 return function( elem ) { 947 var name = elem.nodeName.toLowerCase(); 948 return name === "input" && elem.type === type; 949 }; 950} 951 952/** 953 * Returns a function to use in pseudos for buttons 954 * @param {String} type 955 */ 956function createButtonPseudo( type ) { 957 return function( elem ) { 958 var name = elem.nodeName.toLowerCase(); 959 return (name === "input" || name === "button") && elem.type === type; 960 }; 961} 962 963/** 964 * Returns a function to use in pseudos for :enabled/:disabled 965 * @param {Boolean} disabled true for :disabled; false for :enabled 966 */ 967function createDisabledPseudo( disabled ) { 968 969 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 970 return function( elem ) { 971 972 // Only certain elements can match :enabled or :disabled 973 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 974 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 975 if ( "form" in elem ) { 976 977 // Check for inherited disabledness on relevant non-disabled elements: 978 // * listed form-associated elements in a disabled fieldset 979 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 980 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 981 // * option elements in a disabled optgroup 982 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 983 // All such elements have a "form" property. 984 if ( elem.parentNode && elem.disabled === false ) { 985 986 // Option elements defer to a parent optgroup if present 987 if ( "label" in elem ) { 988 if ( "label" in elem.parentNode ) { 989 return elem.parentNode.disabled === disabled; 990 } else { 991 return elem.disabled === disabled; 992 } 993 } 994 995 // Support: IE 6 - 11 996 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 997 return elem.isDisabled === disabled || 998 999 // Where there is no isDisabled, check manually 1000 /* jshint -W018 */ 1001 elem.isDisabled !== !disabled && 1002 disabledAncestor( elem ) === disabled; 1003 } 1004 1005 return elem.disabled === disabled; 1006 1007 // Try to winnow out elements that can't be disabled before trusting the disabled property. 1008 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 1009 // even exist on them, let alone have a boolean value. 1010 } else if ( "label" in elem ) { 1011 return elem.disabled === disabled; 1012 } 1013 1014 // Remaining elements are neither :enabled nor :disabled 1015 return false; 1016 }; 1017} 1018 1019/** 1020 * Returns a function to use in pseudos for positionals 1021 * @param {Function} fn 1022 */ 1023function createPositionalPseudo( fn ) { 1024 return markFunction(function( argument ) { 1025 argument = +argument; 1026 return markFunction(function( seed, matches ) { 1027 var j, 1028 matchIndexes = fn( [], seed.length, argument ), 1029 i = matchIndexes.length; 1030 1031 // Match elements found at the specified indexes 1032 while ( i-- ) { 1033 if ( seed[ (j = matchIndexes[i]) ] ) { 1034 seed[j] = !(matches[j] = seed[j]); 1035 } 1036 } 1037 }); 1038 }); 1039} 1040 1041/** 1042 * Checks a node for validity as a Sizzle context 1043 * @param {Element|Object=} context 1044 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1045 */ 1046function testContext( context ) { 1047 return context && typeof context.getElementsByTagName !== "undefined" && context; 1048} 1049 1050// Expose support vars for convenience 1051support = Sizzle.support = {}; 1052 1053/** 1054 * Detects XML nodes 1055 * @param {Element|Object} elem An element or a document 1056 * @returns {Boolean} True iff elem is a non-HTML XML node 1057 */ 1058isXML = Sizzle.isXML = function( elem ) { 1059 // documentElement is verified for cases where it doesn't yet exist 1060 // (such as loading iframes in IE - #4833) 1061 var documentElement = elem && (elem.ownerDocument || elem).documentElement; 1062 return documentElement ? documentElement.nodeName !== "HTML" : false; 1063}; 1064 1065/** 1066 * Sets document-related variables once based on the current document 1067 * @param {Element|Object} [doc] An element or document object to use to set the document 1068 * @returns {Object} Returns the current document 1069 */ 1070setDocument = Sizzle.setDocument = function( node ) { 1071 var hasCompare, subWindow, 1072 doc = node ? node.ownerDocument || node : preferredDoc; 1073 1074 // Return early if doc is invalid or already selected 1075 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { 1076 return document; 1077 } 1078 1079 // Update global variables 1080 document = doc; 1081 docElem = document.documentElement; 1082 documentIsHTML = !isXML( document ); 1083 1084 // Support: IE 9-11, Edge 1085 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 1086 if ( preferredDoc !== document && 1087 (subWindow = document.defaultView) && subWindow.top !== subWindow ) { 1088 1089 // Support: IE 11, Edge 1090 if ( subWindow.addEventListener ) { 1091 subWindow.addEventListener( "unload", unloadHandler, false ); 1092 1093 // Support: IE 9 - 10 only 1094 } else if ( subWindow.attachEvent ) { 1095 subWindow.attachEvent( "onunload", unloadHandler ); 1096 } 1097 } 1098 1099 /* Attributes 1100 ---------------------------------------------------------------------- */ 1101 1102 // Support: IE<8 1103 // Verify that getAttribute really returns attributes and not properties 1104 // (excepting IE8 booleans) 1105 support.attributes = assert(function( el ) { 1106 el.className = "i"; 1107 return !el.getAttribute("className"); 1108 }); 1109 1110 /* getElement(s)By* 1111 ---------------------------------------------------------------------- */ 1112 1113 // Check if getElementsByTagName("*") returns only elements 1114 support.getElementsByTagName = assert(function( el ) { 1115 el.appendChild( document.createComment("") ); 1116 return !el.getElementsByTagName("*").length; 1117 }); 1118 1119 // Support: IE<9 1120 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); 1121 1122 // Support: IE<10 1123 // Check if getElementById returns elements by name 1124 // The broken getElementById methods don't pick up programmatically-set names, 1125 // so use a roundabout getElementsByName test 1126 support.getById = assert(function( el ) { 1127 docElem.appendChild( el ).id = expando; 1128 return !document.getElementsByName || !document.getElementsByName( expando ).length; 1129 }); 1130 1131 // ID filter and find 1132 if ( support.getById ) { 1133 Expr.filter["ID"] = function( id ) { 1134 var attrId = id.replace( runescape, funescape ); 1135 return function( elem ) { 1136 return elem.getAttribute("id") === attrId; 1137 }; 1138 }; 1139 Expr.find["ID"] = function( id, context ) { 1140 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1141 var elem = context.getElementById( id ); 1142 return elem ? [ elem ] : []; 1143 } 1144 }; 1145 } else { 1146 Expr.filter["ID"] = function( id ) { 1147 var attrId = id.replace( runescape, funescape ); 1148 return function( elem ) { 1149 var node = typeof elem.getAttributeNode !== "undefined" && 1150 elem.getAttributeNode("id"); 1151 return node && node.value === attrId; 1152 }; 1153 }; 1154 1155 // Support: IE 6 - 7 only 1156 // getElementById is not reliable as a find shortcut 1157 Expr.find["ID"] = function( id, context ) { 1158 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1159 var node, i, elems, 1160 elem = context.getElementById( id ); 1161 1162 if ( elem ) { 1163 1164 // Verify the id attribute 1165 node = elem.getAttributeNode("id"); 1166 if ( node && node.value === id ) { 1167 return [ elem ]; 1168 } 1169 1170 // Fall back on getElementsByName 1171 elems = context.getElementsByName( id ); 1172 i = 0; 1173 while ( (elem = elems[i++]) ) { 1174 node = elem.getAttributeNode("id"); 1175 if ( node && node.value === id ) { 1176 return [ elem ]; 1177 } 1178 } 1179 } 1180 1181 return []; 1182 } 1183 }; 1184 } 1185 1186 // Tag 1187 Expr.find["TAG"] = support.getElementsByTagName ? 1188 function( tag, context ) { 1189 if ( typeof context.getElementsByTagName !== "undefined" ) { 1190 return context.getElementsByTagName( tag ); 1191 1192 // DocumentFragment nodes don't have gEBTN 1193 } else if ( support.qsa ) { 1194 return context.querySelectorAll( tag ); 1195 } 1196 } : 1197 1198 function( tag, context ) { 1199 var elem, 1200 tmp = [], 1201 i = 0, 1202 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 1203 results = context.getElementsByTagName( tag ); 1204 1205 // Filter out possible comments 1206 if ( tag === "*" ) { 1207 while ( (elem = results[i++]) ) { 1208 if ( elem.nodeType === 1 ) { 1209 tmp.push( elem ); 1210 } 1211 } 1212 1213 return tmp; 1214 } 1215 return results; 1216 }; 1217 1218 // Class 1219 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { 1220 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 1221 return context.getElementsByClassName( className ); 1222 } 1223 }; 1224 1225 /* QSA/matchesSelector 1226 ---------------------------------------------------------------------- */ 1227 1228 // QSA and matchesSelector support 1229 1230 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 1231 rbuggyMatches = []; 1232 1233 // qSa(:focus) reports false when true (Chrome 21) 1234 // We allow this because of a bug in IE8/9 that throws an error 1235 // whenever `document.activeElement` is accessed on an iframe 1236 // So, we allow :focus to pass through QSA all the time to avoid the IE error 1237 // See https://bugs.jquery.com/ticket/13378 1238 rbuggyQSA = []; 1239 1240 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { 1241 // Build QSA regex 1242 // Regex strategy adopted from Diego Perini 1243 assert(function( el ) { 1244 // Select is set to empty string on purpose 1245 // This is to test IE's treatment of not explicitly 1246 // setting a boolean content attribute, 1247 // since its presence should be enough 1248 // https://bugs.jquery.com/ticket/12359 1249 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + 1250 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 1251 "<option selected=''></option></select>"; 1252 1253 // Support: IE8, Opera 11-12.16 1254 // Nothing should be selected when empty strings follow ^= or $= or *= 1255 // The test attribute must be unknown in Opera but "safe" for WinRT 1256 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 1257 if ( el.querySelectorAll("[msallowcapture^='']").length ) { 1258 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 1259 } 1260 1261 // Support: IE8 1262 // Boolean attributes and "value" are not treated correctly 1263 if ( !el.querySelectorAll("[selected]").length ) { 1264 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 1265 } 1266 1267 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 1268 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 1269 rbuggyQSA.push("~="); 1270 } 1271 1272 // Webkit/Opera - :checked should return selected option elements 1273 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1274 // IE8 throws error here and will not see later tests 1275 if ( !el.querySelectorAll(":checked").length ) { 1276 rbuggyQSA.push(":checked"); 1277 } 1278 1279 // Support: Safari 8+, iOS 8+ 1280 // https://bugs.webkit.org/show_bug.cgi?id=136851 1281 // In-page `selector#id sibling-combinator selector` fails 1282 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 1283 rbuggyQSA.push(".#.+[+~]"); 1284 } 1285 }); 1286 1287 assert(function( el ) { 1288 el.innerHTML = "<a href='' disabled='disabled'></a>" + 1289 "<select disabled='disabled'><option/></select>"; 1290 1291 // Support: Windows 8 Native Apps 1292 // The type and name attributes are restricted during .innerHTML assignment 1293 var input = document.createElement("input"); 1294 input.setAttribute( "type", "hidden" ); 1295 el.appendChild( input ).setAttribute( "name", "D" ); 1296 1297 // Support: IE8 1298 // Enforce case-sensitivity of name attribute 1299 if ( el.querySelectorAll("[name=d]").length ) { 1300 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 1301 } 1302 1303 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 1304 // IE8 throws error here and will not see later tests 1305 if ( el.querySelectorAll(":enabled").length !== 2 ) { 1306 rbuggyQSA.push( ":enabled", ":disabled" ); 1307 } 1308 1309 // Support: IE9-11+ 1310 // IE's :disabled selector does not pick up the children of disabled fieldsets 1311 docElem.appendChild( el ).disabled = true; 1312 if ( el.querySelectorAll(":disabled").length !== 2 ) { 1313 rbuggyQSA.push( ":enabled", ":disabled" ); 1314 } 1315 1316 // Opera 10-11 does not throw on post-comma invalid pseudos 1317 el.querySelectorAll("*,:x"); 1318 rbuggyQSA.push(",.*:"); 1319 }); 1320 } 1321 1322 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || 1323 docElem.webkitMatchesSelector || 1324 docElem.mozMatchesSelector || 1325 docElem.oMatchesSelector || 1326 docElem.msMatchesSelector) )) ) { 1327 1328 assert(function( el ) { 1329 // Check to see if it's possible to do matchesSelector 1330 // on a disconnected node (IE 9) 1331 support.disconnectedMatch = matches.call( el, "*" ); 1332 1333 // This should fail with an exception 1334 // Gecko does not error, returns false instead 1335 matches.call( el, "[s!='']:x" ); 1336 rbuggyMatches.push( "!=", pseudos ); 1337 }); 1338 } 1339 1340 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); 1341 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); 1342 1343 /* Contains 1344 ---------------------------------------------------------------------- */ 1345 hasCompare = rnative.test( docElem.compareDocumentPosition ); 1346 1347 // Element contains another 1348 // Purposefully self-exclusive 1349 // As in, an element does not contain itself 1350 contains = hasCompare || rnative.test( docElem.contains ) ? 1351 function( a, b ) { 1352 var adown = a.nodeType === 9 ? a.documentElement : a, 1353 bup = b && b.parentNode; 1354 return a === bup || !!( bup && bup.nodeType === 1 && ( 1355 adown.contains ? 1356 adown.contains( bup ) : 1357 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 1358 )); 1359 } : 1360 function( a, b ) { 1361 if ( b ) { 1362 while ( (b = b.parentNode) ) { 1363 if ( b === a ) { 1364 return true; 1365 } 1366 } 1367 } 1368 return false; 1369 }; 1370 1371 /* Sorting 1372 ---------------------------------------------------------------------- */ 1373 1374 // Document order sorting 1375 sortOrder = hasCompare ? 1376 function( a, b ) { 1377 1378 // Flag for duplicate removal 1379 if ( a === b ) { 1380 hasDuplicate = true; 1381 return 0; 1382 } 1383 1384 // Sort on method existence if only one input has compareDocumentPosition 1385 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1386 if ( compare ) { 1387 return compare; 1388 } 1389 1390 // Calculate position if both inputs belong to the same document 1391 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? 1392 a.compareDocumentPosition( b ) : 1393 1394 // Otherwise we know they are disconnected 1395 1; 1396 1397 // Disconnected nodes 1398 if ( compare & 1 || 1399 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { 1400 1401 // Choose the first element that is related to our preferred document 1402 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { 1403 return -1; 1404 } 1405 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { 1406 return 1; 1407 } 1408 1409 // Maintain original order 1410 return sortInput ? 1411 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1412 0; 1413 } 1414 1415 return compare & 4 ? -1 : 1; 1416 } : 1417 function( a, b ) { 1418 // Exit early if the nodes are identical 1419 if ( a === b ) { 1420 hasDuplicate = true; 1421 return 0; 1422 } 1423 1424 var cur, 1425 i = 0, 1426 aup = a.parentNode, 1427 bup = b.parentNode, 1428 ap = [ a ], 1429 bp = [ b ]; 1430 1431 // Parentless nodes are either documents or disconnected 1432 if ( !aup || !bup ) { 1433 return a === document ? -1 : 1434 b === document ? 1 : 1435 aup ? -1 : 1436 bup ? 1 : 1437 sortInput ? 1438 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1439 0; 1440 1441 // If the nodes are siblings, we can do a quick check 1442 } else if ( aup === bup ) { 1443 return siblingCheck( a, b ); 1444 } 1445 1446 // Otherwise we need full lists of their ancestors for comparison 1447 cur = a; 1448 while ( (cur = cur.parentNode) ) { 1449 ap.unshift( cur ); 1450 } 1451 cur = b; 1452 while ( (cur = cur.parentNode) ) { 1453 bp.unshift( cur ); 1454 } 1455 1456 // Walk down the tree looking for a discrepancy 1457 while ( ap[i] === bp[i] ) { 1458 i++; 1459 } 1460 1461 return i ? 1462 // Do a sibling check if the nodes have a common ancestor 1463 siblingCheck( ap[i], bp[i] ) : 1464 1465 // Otherwise nodes in our document sort first 1466 ap[i] === preferredDoc ? -1 : 1467 bp[i] === preferredDoc ? 1 : 1468 0; 1469 }; 1470 1471 return document; 1472}; 1473 1474Sizzle.matches = function( expr, elements ) { 1475 return Sizzle( expr, null, null, elements ); 1476}; 1477 1478Sizzle.matchesSelector = function( elem, expr ) { 1479 // Set document vars if needed 1480 if ( ( elem.ownerDocument || elem ) !== document ) { 1481 setDocument( elem ); 1482 } 1483 1484 // Make sure that attribute selectors are quoted 1485 expr = expr.replace( rattributeQuotes, "='$1']" ); 1486 1487 if ( support.matchesSelector && documentIsHTML && 1488 !compilerCache[ expr + " " ] && 1489 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 1490 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 1491 1492 try { 1493 var ret = matches.call( elem, expr ); 1494 1495 // IE 9's matchesSelector returns false on disconnected nodes 1496 if ( ret || support.disconnectedMatch || 1497 // As well, disconnected nodes are said to be in a document 1498 // fragment in IE 9 1499 elem.document && elem.document.nodeType !== 11 ) { 1500 return ret; 1501 } 1502 } catch (e) {} 1503 } 1504 1505 return Sizzle( expr, document, null, [ elem ] ).length > 0; 1506}; 1507 1508Sizzle.contains = function( context, elem ) { 1509 // Set document vars if needed 1510 if ( ( context.ownerDocument || context ) !== document ) { 1511 setDocument( context ); 1512 } 1513 return contains( context, elem ); 1514}; 1515 1516Sizzle.attr = function( elem, name ) { 1517 // Set document vars if needed 1518 if ( ( elem.ownerDocument || elem ) !== document ) { 1519 setDocument( elem ); 1520 } 1521 1522 var fn = Expr.attrHandle[ name.toLowerCase() ], 1523 // Don't get fooled by Object.prototype properties (jQuery #13807) 1524 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 1525 fn( elem, name, !documentIsHTML ) : 1526 undefined; 1527 1528 return val !== undefined ? 1529 val : 1530 support.attributes || !documentIsHTML ? 1531 elem.getAttribute( name ) : 1532 (val = elem.getAttributeNode(name)) && val.specified ? 1533 val.value : 1534 null; 1535}; 1536 1537Sizzle.escape = function( sel ) { 1538 return (sel + "").replace( rcssescape, fcssescape ); 1539}; 1540 1541Sizzle.error = function( msg ) { 1542 throw new Error( "Syntax error, unrecognized expression: " + msg ); 1543}; 1544 1545/** 1546 * Document sorting and removing duplicates 1547 * @param {ArrayLike} results 1548 */ 1549Sizzle.uniqueSort = function( results ) { 1550 var elem, 1551 duplicates = [], 1552 j = 0, 1553 i = 0; 1554 1555 // Unless we *know* we can detect duplicates, assume their presence 1556 hasDuplicate = !support.detectDuplicates; 1557 sortInput = !support.sortStable && results.slice( 0 ); 1558 results.sort( sortOrder ); 1559 1560 if ( hasDuplicate ) { 1561 while ( (elem = results[i++]) ) { 1562 if ( elem === results[ i ] ) { 1563 j = duplicates.push( i ); 1564 } 1565 } 1566 while ( j-- ) { 1567 results.splice( duplicates[ j ], 1 ); 1568 } 1569 } 1570 1571 // Clear input after sorting to release objects 1572 // See https://github.com/jquery/sizzle/pull/225 1573 sortInput = null; 1574 1575 return results; 1576}; 1577 1578/** 1579 * Utility function for retrieving the text value of an array of DOM nodes 1580 * @param {Array|Element} elem 1581 */ 1582getText = Sizzle.getText = function( elem ) { 1583 var node, 1584 ret = "", 1585 i = 0, 1586 nodeType = elem.nodeType; 1587 1588 if ( !nodeType ) { 1589 // If no nodeType, this is expected to be an array 1590 while ( (node = elem[i++]) ) { 1591 // Do not traverse comment nodes 1592 ret += getText( node ); 1593 } 1594 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 1595 // Use textContent for elements 1596 // innerText usage removed for consistency of new lines (jQuery #11153) 1597 if ( typeof elem.textContent === "string" ) { 1598 return elem.textContent; 1599 } else { 1600 // Traverse its children 1601 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 1602 ret += getText( elem ); 1603 } 1604 } 1605 } else if ( nodeType === 3 || nodeType === 4 ) { 1606 return elem.nodeValue; 1607 } 1608 // Do not include comment or processing instruction nodes 1609 1610 return ret; 1611}; 1612 1613Expr = Sizzle.selectors = { 1614 1615 // Can be adjusted by the user 1616 cacheLength: 50, 1617 1618 createPseudo: markFunction, 1619 1620 match: matchExpr, 1621 1622 attrHandle: {}, 1623 1624 find: {}, 1625 1626 relative: { 1627 ">": { dir: "parentNode", first: true }, 1628 " ": { dir: "parentNode" }, 1629 "+": { dir: "previousSibling", first: true }, 1630 "~": { dir: "previousSibling" } 1631 }, 1632 1633 preFilter: { 1634 "ATTR": function( match ) { 1635 match[1] = match[1].replace( runescape, funescape ); 1636 1637 // Move the given value to match[3] whether quoted or unquoted 1638 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); 1639 1640 if ( match[2] === "~=" ) { 1641 match[3] = " " + match[3] + " "; 1642 } 1643 1644 return match.slice( 0, 4 ); 1645 }, 1646 1647 "CHILD": function( match ) { 1648 /* matches from matchExpr["CHILD"] 1649 1 type (only|nth|...) 1650 2 what (child|of-type) 1651 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1652 4 xn-component of xn+y argument ([+-]?\d*n|) 1653 5 sign of xn-component 1654 6 x of xn-component 1655 7 sign of y-component 1656 8 y of y-component 1657 */ 1658 match[1] = match[1].toLowerCase(); 1659 1660 if ( match[1].slice( 0, 3 ) === "nth" ) { 1661 // nth-* requires argument 1662 if ( !match[3] ) { 1663 Sizzle.error( match[0] ); 1664 } 1665 1666 // numeric x and y parameters for Expr.filter.CHILD 1667 // remember that false/true cast respectively to 0/1 1668 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); 1669 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); 1670 1671 // other types prohibit arguments 1672 } else if ( match[3] ) { 1673 Sizzle.error( match[0] ); 1674 } 1675 1676 return match; 1677 }, 1678 1679 "PSEUDO": function( match ) { 1680 var excess, 1681 unquoted = !match[6] && match[2]; 1682 1683 if ( matchExpr["CHILD"].test( match[0] ) ) { 1684 return null; 1685 } 1686 1687 // Accept quoted arguments as-is 1688 if ( match[3] ) { 1689 match[2] = match[4] || match[5] || ""; 1690 1691 // Strip excess characters from unquoted arguments 1692 } else if ( unquoted && rpseudo.test( unquoted ) && 1693 // Get excess from tokenize (recursively) 1694 (excess = tokenize( unquoted, true )) && 1695 // advance to the next closing parenthesis 1696 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { 1697 1698 // excess is a negative index 1699 match[0] = match[0].slice( 0, excess ); 1700 match[2] = unquoted.slice( 0, excess ); 1701 } 1702 1703 // Return only captures needed by the pseudo filter method (type and argument) 1704 return match.slice( 0, 3 ); 1705 } 1706 }, 1707 1708 filter: { 1709 1710 "TAG": function( nodeNameSelector ) { 1711 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 1712 return nodeNameSelector === "*" ? 1713 function() { return true; } : 1714 function( elem ) { 1715 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 1716 }; 1717 }, 1718 1719 "CLASS": function( className ) { 1720 var pattern = classCache[ className + " " ]; 1721 1722 return pattern || 1723 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && 1724 classCache( className, function( elem ) { 1725 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); 1726 }); 1727 }, 1728 1729 "ATTR": function( name, operator, check ) { 1730 return function( elem ) { 1731 var result = Sizzle.attr( elem, name ); 1732 1733 if ( result == null ) { 1734 return operator === "!="; 1735 } 1736 if ( !operator ) { 1737 return true; 1738 } 1739 1740 result += ""; 1741 1742 return operator === "=" ? result === check : 1743 operator === "!=" ? result !== check : 1744 operator === "^=" ? check && result.indexOf( check ) === 0 : 1745 operator === "*=" ? check && result.indexOf( check ) > -1 : 1746 operator === "$=" ? check && result.slice( -check.length ) === check : 1747 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 1748 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 1749 false; 1750 }; 1751 }, 1752 1753 "CHILD": function( type, what, argument, first, last ) { 1754 var simple = type.slice( 0, 3 ) !== "nth", 1755 forward = type.slice( -4 ) !== "last", 1756 ofType = what === "of-type"; 1757 1758 return first === 1 && last === 0 ? 1759 1760 // Shortcut for :nth-*(n) 1761 function( elem ) { 1762 return !!elem.parentNode; 1763 } : 1764 1765 function( elem, context, xml ) { 1766 var cache, uniqueCache, outerCache, node, nodeIndex, start, 1767 dir = simple !== forward ? "nextSibling" : "previousSibling", 1768 parent = elem.parentNode, 1769 name = ofType && elem.nodeName.toLowerCase(), 1770 useCache = !xml && !ofType, 1771 diff = false; 1772 1773 if ( parent ) { 1774 1775 // :(first|last|only)-(child|of-type) 1776 if ( simple ) { 1777 while ( dir ) { 1778 node = elem; 1779 while ( (node = node[ dir ]) ) { 1780 if ( ofType ? 1781 node.nodeName.toLowerCase() === name : 1782 node.nodeType === 1 ) { 1783 1784 return false; 1785 } 1786 } 1787 // Reverse direction for :only-* (if we haven't yet done so) 1788 start = dir = type === "only" && !start && "nextSibling"; 1789 } 1790 return true; 1791 } 1792 1793 start = [ forward ? parent.firstChild : parent.lastChild ]; 1794 1795 // non-xml :nth-child(...) stores cache data on `parent` 1796 if ( forward && useCache ) { 1797 1798 // Seek `elem` from a previously-cached index 1799 1800 // ...in a gzip-friendly way 1801 node = parent; 1802 outerCache = node[ expando ] || (node[ expando ] = {}); 1803 1804 // Support: IE <9 only 1805 // Defend against cloned attroperties (jQuery gh-1709) 1806 uniqueCache = outerCache[ node.uniqueID ] || 1807 (outerCache[ node.uniqueID ] = {}); 1808 1809 cache = uniqueCache[ type ] || []; 1810 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1811 diff = nodeIndex && cache[ 2 ]; 1812 node = nodeIndex && parent.childNodes[ nodeIndex ]; 1813 1814 while ( (node = ++nodeIndex && node && node[ dir ] || 1815 1816 // Fallback to seeking `elem` from the start 1817 (diff = nodeIndex = 0) || start.pop()) ) { 1818 1819 // When found, cache indexes on `parent` and break 1820 if ( node.nodeType === 1 && ++diff && node === elem ) { 1821 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; 1822 break; 1823 } 1824 } 1825 1826 } else { 1827 // Use previously-cached element index if available 1828 if ( useCache ) { 1829 // ...in a gzip-friendly way 1830 node = elem; 1831 outerCache = node[ expando ] || (node[ expando ] = {}); 1832 1833 // Support: IE <9 only 1834 // Defend against cloned attroperties (jQuery gh-1709) 1835 uniqueCache = outerCache[ node.uniqueID ] || 1836 (outerCache[ node.uniqueID ] = {}); 1837 1838 cache = uniqueCache[ type ] || []; 1839 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1840 diff = nodeIndex; 1841 } 1842 1843 // xml :nth-child(...) 1844 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 1845 if ( diff === false ) { 1846 // Use the same loop as above to seek `elem` from the start 1847 while ( (node = ++nodeIndex && node && node[ dir ] || 1848 (diff = nodeIndex = 0) || start.pop()) ) { 1849 1850 if ( ( ofType ? 1851 node.nodeName.toLowerCase() === name : 1852 node.nodeType === 1 ) && 1853 ++diff ) { 1854 1855 // Cache the index of each encountered element 1856 if ( useCache ) { 1857 outerCache = node[ expando ] || (node[ expando ] = {}); 1858 1859 // Support: IE <9 only 1860 // Defend against cloned attroperties (jQuery gh-1709) 1861 uniqueCache = outerCache[ node.uniqueID ] || 1862 (outerCache[ node.uniqueID ] = {}); 1863 1864 uniqueCache[ type ] = [ dirruns, diff ]; 1865 } 1866 1867 if ( node === elem ) { 1868 break; 1869 } 1870 } 1871 } 1872 } 1873 } 1874 1875 // Incorporate the offset, then check against cycle size 1876 diff -= last; 1877 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 1878 } 1879 }; 1880 }, 1881 1882 "PSEUDO": function( pseudo, argument ) { 1883 // pseudo-class names are case-insensitive 1884 // http://www.w3.org/TR/selectors/#pseudo-classes 1885 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 1886 // Remember that setFilters inherits from pseudos 1887 var args, 1888 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 1889 Sizzle.error( "unsupported pseudo: " + pseudo ); 1890 1891 // The user may use createPseudo to indicate that 1892 // arguments are needed to create the filter function 1893 // just as Sizzle does 1894 if ( fn[ expando ] ) { 1895 return fn( argument ); 1896 } 1897 1898 // But maintain support for old signatures 1899 if ( fn.length > 1 ) { 1900 args = [ pseudo, pseudo, "", argument ]; 1901 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 1902 markFunction(function( seed, matches ) { 1903 var idx, 1904 matched = fn( seed, argument ), 1905 i = matched.length; 1906 while ( i-- ) { 1907 idx = indexOf( seed, matched[i] ); 1908 seed[ idx ] = !( matches[ idx ] = matched[i] ); 1909 } 1910 }) : 1911 function( elem ) { 1912 return fn( elem, 0, args ); 1913 }; 1914 } 1915 1916 return fn; 1917 } 1918 }, 1919 1920 pseudos: { 1921 // Potentially complex pseudos 1922 "not": markFunction(function( selector ) { 1923 // Trim the selector passed to compile 1924 // to avoid treating leading and trailing 1925 // spaces as combinators 1926 var input = [], 1927 results = [], 1928 matcher = compile( selector.replace( rtrim, "$1" ) ); 1929 1930 return matcher[ expando ] ? 1931 markFunction(function( seed, matches, context, xml ) { 1932 var elem, 1933 unmatched = matcher( seed, null, xml, [] ), 1934 i = seed.length; 1935 1936 // Match elements unmatched by `matcher` 1937 while ( i-- ) { 1938 if ( (elem = unmatched[i]) ) { 1939 seed[i] = !(matches[i] = elem); 1940 } 1941 } 1942 }) : 1943 function( elem, context, xml ) { 1944 input[0] = elem; 1945 matcher( input, null, xml, results ); 1946 // Don't keep the element (issue #299) 1947 input[0] = null; 1948 return !results.pop(); 1949 }; 1950 }), 1951 1952 "has": markFunction(function( selector ) { 1953 return function( elem ) { 1954 return Sizzle( selector, elem ).length > 0; 1955 }; 1956 }), 1957 1958 "contains": markFunction(function( text ) { 1959 text = text.replace( runescape, funescape ); 1960 return function( elem ) { 1961 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; 1962 }; 1963 }), 1964 1965 // "Whether an element is represented by a :lang() selector 1966 // is based solely on the element's language value 1967 // being equal to the identifier C, 1968 // or beginning with the identifier C immediately followed by "-". 1969 // The matching of C against the element's language value is performed case-insensitively. 1970 // The identifier C does not have to be a valid language name." 1971 // http://www.w3.org/TR/selectors/#lang-pseudo 1972 "lang": markFunction( function( lang ) { 1973 // lang value must be a valid identifier 1974 if ( !ridentifier.test(lang || "") ) { 1975 Sizzle.error( "unsupported lang: " + lang ); 1976 } 1977 lang = lang.replace( runescape, funescape ).toLowerCase(); 1978 return function( elem ) { 1979 var elemLang; 1980 do { 1981 if ( (elemLang = documentIsHTML ? 1982 elem.lang : 1983 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { 1984 1985 elemLang = elemLang.toLowerCase(); 1986 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 1987 } 1988 } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); 1989 return false; 1990 }; 1991 }), 1992 1993 // Miscellaneous 1994 "target": function( elem ) { 1995 var hash = window.location && window.location.hash; 1996 return hash && hash.slice( 1 ) === elem.id; 1997 }, 1998 1999 "root": function( elem ) { 2000 return elem === docElem; 2001 }, 2002 2003 "focus": function( elem ) { 2004 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); 2005 }, 2006 2007 // Boolean properties 2008 "enabled": createDisabledPseudo( false ), 2009 "disabled": createDisabledPseudo( true ), 2010 2011 "checked": function( elem ) { 2012 // In CSS3, :checked should return both checked and selected elements 2013 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 2014 var nodeName = elem.nodeName.toLowerCase(); 2015 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); 2016 }, 2017 2018 "selected": function( elem ) { 2019 // Accessing this property makes selected-by-default 2020 // options in Safari work properly 2021 if ( elem.parentNode ) { 2022 elem.parentNode.selectedIndex; 2023 } 2024 2025 return elem.selected === true; 2026 }, 2027 2028 // Contents 2029 "empty": function( elem ) { 2030 // http://www.w3.org/TR/selectors/#empty-pseudo 2031 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 2032 // but not by others (comment: 8; processing instruction: 7; etc.) 2033 // nodeType < 6 works because attributes (2) do not appear as children 2034 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 2035 if ( elem.nodeType < 6 ) { 2036 return false; 2037 } 2038 } 2039 return true; 2040 }, 2041 2042 "parent": function( elem ) { 2043 return !Expr.pseudos["empty"]( elem ); 2044 }, 2045 2046 // Element/input types 2047 "header": function( elem ) { 2048 return rheader.test( elem.nodeName ); 2049 }, 2050 2051 "input": function( elem ) { 2052 return rinputs.test( elem.nodeName ); 2053 }, 2054 2055 "button": function( elem ) { 2056 var name = elem.nodeName.toLowerCase(); 2057 return name === "input" && elem.type === "button" || name === "button"; 2058 }, 2059 2060 "text": function( elem ) { 2061 var attr; 2062 return elem.nodeName.toLowerCase() === "input" && 2063 elem.type === "text" && 2064 2065 // Support: IE<8 2066 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 2067 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); 2068 }, 2069 2070 // Position-in-collection 2071 "first": createPositionalPseudo(function() { 2072 return [ 0 ]; 2073 }), 2074 2075 "last": createPositionalPseudo(function( matchIndexes, length ) { 2076 return [ length - 1 ]; 2077 }), 2078 2079 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { 2080 return [ argument < 0 ? argument + length : argument ]; 2081 }), 2082 2083 "even": createPositionalPseudo(function( matchIndexes, length ) { 2084 var i = 0; 2085 for ( ; i < length; i += 2 ) { 2086 matchIndexes.push( i ); 2087 } 2088 return matchIndexes; 2089 }), 2090 2091 "odd": createPositionalPseudo(function( matchIndexes, length ) { 2092 var i = 1; 2093 for ( ; i < length; i += 2 ) { 2094 matchIndexes.push( i ); 2095 } 2096 return matchIndexes; 2097 }), 2098 2099 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { 2100 var i = argument < 0 ? argument + length : argument; 2101 for ( ; --i >= 0; ) { 2102 matchIndexes.push( i ); 2103 } 2104 return matchIndexes; 2105 }), 2106 2107 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { 2108 var i = argument < 0 ? argument + length : argument; 2109 for ( ; ++i < length; ) { 2110 matchIndexes.push( i ); 2111 } 2112 return matchIndexes; 2113 }) 2114 } 2115}; 2116 2117Expr.pseudos["nth"] = Expr.pseudos["eq"]; 2118 2119// Add button/input type pseudos 2120for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 2121 Expr.pseudos[ i ] = createInputPseudo( i ); 2122} 2123for ( i in { submit: true, reset: true } ) { 2124 Expr.pseudos[ i ] = createButtonPseudo( i ); 2125} 2126 2127// Easy API for creating new setFilters 2128function setFilters() {} 2129setFilters.prototype = Expr.filters = Expr.pseudos; 2130Expr.setFilters = new setFilters(); 2131 2132tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 2133 var matched, match, tokens, type, 2134 soFar, groups, preFilters, 2135 cached = tokenCache[ selector + " " ]; 2136 2137 if ( cached ) { 2138 return parseOnly ? 0 : cached.slice( 0 ); 2139 } 2140 2141 soFar = selector; 2142 groups = []; 2143 preFilters = Expr.preFilter; 2144 2145 while ( soFar ) { 2146 2147 // Comma and first run 2148 if ( !matched || (match = rcomma.exec( soFar )) ) { 2149 if ( match ) { 2150 // Don't consume trailing commas as valid 2151 soFar = soFar.slice( match[0].length ) || soFar; 2152 } 2153 groups.push( (tokens = []) ); 2154 } 2155 2156 matched = false; 2157 2158 // Combinators 2159 if ( (match = rcombinators.exec( soFar )) ) { 2160 matched = match.shift(); 2161 tokens.push({ 2162 value: matched, 2163 // Cast descendant combinators to space 2164 type: match[0].replace( rtrim, " " ) 2165 }); 2166 soFar = soFar.slice( matched.length ); 2167 } 2168 2169 // Filters 2170 for ( type in Expr.filter ) { 2171 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || 2172 (match = preFilters[ type ]( match ))) ) { 2173 matched = match.shift(); 2174 tokens.push({ 2175 value: matched, 2176 type: type, 2177 matches: match 2178 }); 2179 soFar = soFar.slice( matched.length ); 2180 } 2181 } 2182 2183 if ( !matched ) { 2184 break; 2185 } 2186 } 2187 2188 // Return the length of the invalid excess 2189 // if we're just parsing 2190 // Otherwise, throw an error or return tokens 2191 return parseOnly ? 2192 soFar.length : 2193 soFar ? 2194 Sizzle.error( selector ) : 2195 // Cache the tokens 2196 tokenCache( selector, groups ).slice( 0 ); 2197}; 2198 2199function toSelector( tokens ) { 2200 var i = 0, 2201 len = tokens.length, 2202 selector = ""; 2203 for ( ; i < len; i++ ) { 2204 selector += tokens[i].value; 2205 } 2206 return selector; 2207} 2208 2209function addCombinator( matcher, combinator, base ) { 2210 var dir = combinator.dir, 2211 skip = combinator.next, 2212 key = skip || dir, 2213 checkNonElements = base && key === "parentNode", 2214 doneName = done++; 2215 2216 return combinator.first ? 2217 // Check against closest ancestor/preceding element 2218 function( elem, context, xml ) { 2219 while ( (elem = elem[ dir ]) ) { 2220 if ( elem.nodeType === 1 || checkNonElements ) { 2221 return matcher( elem, context, xml ); 2222 } 2223 } 2224 return false; 2225 } : 2226 2227 // Check against all ancestor/preceding elements 2228 function( elem, context, xml ) { 2229 var oldCache, uniqueCache, outerCache, 2230 newCache = [ dirruns, doneName ]; 2231 2232 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 2233 if ( xml ) { 2234 while ( (elem = elem[ dir ]) ) { 2235 if ( elem.nodeType === 1 || checkNonElements ) { 2236 if ( matcher( elem, context, xml ) ) { 2237 return true; 2238 } 2239 } 2240 } 2241 } else { 2242 while ( (elem = elem[ dir ]) ) { 2243 if ( elem.nodeType === 1 || checkNonElements ) { 2244 outerCache = elem[ expando ] || (elem[ expando ] = {}); 2245 2246 // Support: IE <9 only 2247 // Defend against cloned attroperties (jQuery gh-1709) 2248 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); 2249 2250 if ( skip && skip === elem.nodeName.toLowerCase() ) { 2251 elem = elem[ dir ] || elem; 2252 } else if ( (oldCache = uniqueCache[ key ]) && 2253 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 2254 2255 // Assign to newCache so results back-propagate to previous elements 2256 return (newCache[ 2 ] = oldCache[ 2 ]); 2257 } else { 2258 // Reuse newcache so results back-propagate to previous elements 2259 uniqueCache[ key ] = newCache; 2260 2261 // A match means we're done; a fail means we have to keep checking 2262 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { 2263 return true; 2264 } 2265 } 2266 } 2267 } 2268 } 2269 return false; 2270 }; 2271} 2272 2273function elementMatcher( matchers ) { 2274 return matchers.length > 1 ? 2275 function( elem, context, xml ) { 2276 var i = matchers.length; 2277 while ( i-- ) { 2278 if ( !matchers[i]( elem, context, xml ) ) { 2279 return false; 2280 } 2281 } 2282 return true; 2283 } : 2284 matchers[0]; 2285} 2286 2287function multipleContexts( selector, contexts, results ) { 2288 var i = 0, 2289 len = contexts.length; 2290 for ( ; i < len; i++ ) { 2291 Sizzle( selector, contexts[i], results ); 2292 } 2293 return results; 2294} 2295 2296function condense( unmatched, map, filter, context, xml ) { 2297 var elem, 2298 newUnmatched = [], 2299 i = 0, 2300 len = unmatched.length, 2301 mapped = map != null; 2302 2303 for ( ; i < len; i++ ) { 2304 if ( (elem = unmatched[i]) ) { 2305 if ( !filter || filter( elem, context, xml ) ) { 2306 newUnmatched.push( elem ); 2307 if ( mapped ) { 2308 map.push( i ); 2309 } 2310 } 2311 } 2312 } 2313 2314 return newUnmatched; 2315} 2316 2317function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 2318 if ( postFilter && !postFilter[ expando ] ) { 2319 postFilter = setMatcher( postFilter ); 2320 } 2321 if ( postFinder && !postFinder[ expando ] ) { 2322 postFinder = setMatcher( postFinder, postSelector ); 2323 } 2324 return markFunction(function( seed, results, context, xml ) { 2325 var temp, i, elem, 2326 preMap = [], 2327 postMap = [], 2328 preexisting = results.length, 2329 2330 // Get initial elements from seed or context 2331 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), 2332 2333 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2334 matcherIn = preFilter && ( seed || !selector ) ? 2335 condense( elems, preMap, preFilter, context, xml ) : 2336 elems, 2337 2338 matcherOut = matcher ? 2339 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 2340 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 2341 2342 // ...intermediate processing is necessary 2343 [] : 2344 2345 // ...otherwise use results directly 2346 results : 2347 matcherIn; 2348 2349 // Find primary matches 2350 if ( matcher ) { 2351 matcher( matcherIn, matcherOut, context, xml ); 2352 } 2353 2354 // Apply postFilter 2355 if ( postFilter ) { 2356 temp = condense( matcherOut, postMap ); 2357 postFilter( temp, [], context, xml ); 2358 2359 // Un-match failing elements by moving them back to matcherIn 2360 i = temp.length; 2361 while ( i-- ) { 2362 if ( (elem = temp[i]) ) { 2363 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); 2364 } 2365 } 2366 } 2367 2368 if ( seed ) { 2369 if ( postFinder || preFilter ) { 2370 if ( postFinder ) { 2371 // Get the final matcherOut by condensing this intermediate into postFinder contexts 2372 temp = []; 2373 i = matcherOut.length; 2374 while ( i-- ) { 2375 if ( (elem = matcherOut[i]) ) { 2376 // Restore matcherIn since elem is not yet a final match 2377 temp.push( (matcherIn[i] = elem) ); 2378 } 2379 } 2380 postFinder( null, (matcherOut = []), temp, xml ); 2381 } 2382 2383 // Move matched elements from seed to results to keep them synchronized 2384 i = matcherOut.length; 2385 while ( i-- ) { 2386 if ( (elem = matcherOut[i]) && 2387 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { 2388 2389 seed[temp] = !(results[temp] = elem); 2390 } 2391 } 2392 } 2393 2394 // Add elements to results, through postFinder if defined 2395 } else { 2396 matcherOut = condense( 2397 matcherOut === results ? 2398 matcherOut.splice( preexisting, matcherOut.length ) : 2399 matcherOut 2400 ); 2401 if ( postFinder ) { 2402 postFinder( null, results, matcherOut, xml ); 2403 } else { 2404 push.apply( results, matcherOut ); 2405 } 2406 } 2407 }); 2408} 2409 2410function matcherFromTokens( tokens ) { 2411 var checkContext, matcher, j, 2412 len = tokens.length, 2413 leadingRelative = Expr.relative[ tokens[0].type ], 2414 implicitRelative = leadingRelative || Expr.relative[" "], 2415 i = leadingRelative ? 1 : 0, 2416 2417 // The foundational matcher ensures that elements are reachable from top-level context(s) 2418 matchContext = addCombinator( function( elem ) { 2419 return elem === checkContext; 2420 }, implicitRelative, true ), 2421 matchAnyContext = addCombinator( function( elem ) { 2422 return indexOf( checkContext, elem ) > -1; 2423 }, implicitRelative, true ), 2424 matchers = [ function( elem, context, xml ) { 2425 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 2426 (checkContext = context).nodeType ? 2427 matchContext( elem, context, xml ) : 2428 matchAnyContext( elem, context, xml ) ); 2429 // Avoid hanging onto element (issue #299) 2430 checkContext = null; 2431 return ret; 2432 } ]; 2433 2434 for ( ; i < len; i++ ) { 2435 if ( (matcher = Expr.relative[ tokens[i].type ]) ) { 2436 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; 2437 } else { 2438 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); 2439 2440 // Return special upon seeing a positional matcher 2441 if ( matcher[ expando ] ) { 2442 // Find the next relative operator (if any) for proper handling 2443 j = ++i; 2444 for ( ; j < len; j++ ) { 2445 if ( Expr.relative[ tokens[j].type ] ) { 2446 break; 2447 } 2448 } 2449 return setMatcher( 2450 i > 1 && elementMatcher( matchers ), 2451 i > 1 && toSelector( 2452 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2453 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) 2454 ).replace( rtrim, "$1" ), 2455 matcher, 2456 i < j && matcherFromTokens( tokens.slice( i, j ) ), 2457 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), 2458 j < len && toSelector( tokens ) 2459 ); 2460 } 2461 matchers.push( matcher ); 2462 } 2463 } 2464 2465 return elementMatcher( matchers ); 2466} 2467 2468function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 2469 var bySet = setMatchers.length > 0, 2470 byElement = elementMatchers.length > 0, 2471 superMatcher = function( seed, context, xml, results, outermost ) { 2472 var elem, j, matcher, 2473 matchedCount = 0, 2474 i = "0", 2475 unmatched = seed && [], 2476 setMatched = [], 2477 contextBackup = outermostContext, 2478 // We must always have either seed elements or outermost context 2479 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), 2480 // Use integer dirruns iff this is the outermost matcher 2481 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), 2482 len = elems.length; 2483 2484 if ( outermost ) { 2485 outermostContext = context === document || context || outermost; 2486 } 2487 2488 // Add elements passing elementMatchers directly to results 2489 // Support: IE<9, Safari 2490 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 2491 for ( ; i !== len && (elem = elems[i]) != null; i++ ) { 2492 if ( byElement && elem ) { 2493 j = 0; 2494 if ( !context && elem.ownerDocument !== document ) { 2495 setDocument( elem ); 2496 xml = !documentIsHTML; 2497 } 2498 while ( (matcher = elementMatchers[j++]) ) { 2499 if ( matcher( elem, context || document, xml) ) { 2500 results.push( elem ); 2501 break; 2502 } 2503 } 2504 if ( outermost ) { 2505 dirruns = dirrunsUnique; 2506 } 2507 } 2508 2509 // Track unmatched elements for set filters 2510 if ( bySet ) { 2511 // They will have gone through all possible matchers 2512 if ( (elem = !matcher && elem) ) { 2513 matchedCount--; 2514 } 2515 2516 // Lengthen the array for every element, matched or not 2517 if ( seed ) { 2518 unmatched.push( elem ); 2519 } 2520 } 2521 } 2522 2523 // `i` is now the count of elements visited above, and adding it to `matchedCount` 2524 // makes the latter nonnegative. 2525 matchedCount += i; 2526 2527 // Apply set filters to unmatched elements 2528 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 2529 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 2530 // no element matchers and no seed. 2531 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 2532 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 2533 // numerically zero. 2534 if ( bySet && i !== matchedCount ) { 2535 j = 0; 2536 while ( (matcher = setMatchers[j++]) ) { 2537 matcher( unmatched, setMatched, context, xml ); 2538 } 2539 2540 if ( seed ) { 2541 // Reintegrate element matches to eliminate the need for sorting 2542 if ( matchedCount > 0 ) { 2543 while ( i-- ) { 2544 if ( !(unmatched[i] || setMatched[i]) ) { 2545 setMatched[i] = pop.call( results ); 2546 } 2547 } 2548 } 2549 2550 // Discard index placeholder values to get only actual matches 2551 setMatched = condense( setMatched ); 2552 } 2553 2554 // Add matches to results 2555 push.apply( results, setMatched ); 2556 2557 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2558 if ( outermost && !seed && setMatched.length > 0 && 2559 ( matchedCount + setMatchers.length ) > 1 ) { 2560 2561 Sizzle.uniqueSort( results ); 2562 } 2563 } 2564 2565 // Override manipulation of globals by nested matchers 2566 if ( outermost ) { 2567 dirruns = dirrunsUnique; 2568 outermostContext = contextBackup; 2569 } 2570 2571 return unmatched; 2572 }; 2573 2574 return bySet ? 2575 markFunction( superMatcher ) : 2576 superMatcher; 2577} 2578 2579compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 2580 var i, 2581 setMatchers = [], 2582 elementMatchers = [], 2583 cached = compilerCache[ selector + " " ]; 2584 2585 if ( !cached ) { 2586 // Generate a function of recursive functions that can be used to check each element 2587 if ( !match ) { 2588 match = tokenize( selector ); 2589 } 2590 i = match.length; 2591 while ( i-- ) { 2592 cached = matcherFromTokens( match[i] ); 2593 if ( cached[ expando ] ) { 2594 setMatchers.push( cached ); 2595 } else { 2596 elementMatchers.push( cached ); 2597 } 2598 } 2599 2600 // Cache the compiled function 2601 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 2602 2603 // Save selector and tokenization 2604 cached.selector = selector; 2605 } 2606 return cached; 2607}; 2608 2609/** 2610 * A low-level selection function that works with Sizzle's compiled 2611 * selector functions 2612 * @param {String|Function} selector A selector or a pre-compiled 2613 * selector function built with Sizzle.compile 2614 * @param {Element} context 2615 * @param {Array} [results] 2616 * @param {Array} [seed] A set of elements to match against 2617 */ 2618select = Sizzle.select = function( selector, context, results, seed ) { 2619 var i, tokens, token, type, find, 2620 compiled = typeof selector === "function" && selector, 2621 match = !seed && tokenize( (selector = compiled.selector || selector) ); 2622 2623 results = results || []; 2624 2625 // Try to minimize operations if there is only one selector in the list and no seed 2626 // (the latter of which guarantees us context) 2627 if ( match.length === 1 ) { 2628 2629 // Reduce context if the leading compound selector is an ID 2630 tokens = match[0] = match[0].slice( 0 ); 2631 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && 2632 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { 2633 2634 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; 2635 if ( !context ) { 2636 return results; 2637 2638 // Precompiled matchers will still verify ancestry, so step up a level 2639 } else if ( compiled ) { 2640 context = context.parentNode; 2641 } 2642 2643 selector = selector.slice( tokens.shift().value.length ); 2644 } 2645 2646 // Fetch a seed set for right-to-left matching 2647 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; 2648 while ( i-- ) { 2649 token = tokens[i]; 2650 2651 // Abort if we hit a combinator 2652 if ( Expr.relative[ (type = token.type) ] ) { 2653 break; 2654 } 2655 if ( (find = Expr.find[ type ]) ) { 2656 // Search, expanding context for leading sibling combinators 2657 if ( (seed = find( 2658 token.matches[0].replace( runescape, funescape ), 2659 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context 2660 )) ) { 2661 2662 // If seed is empty or no tokens remain, we can return early 2663 tokens.splice( i, 1 ); 2664 selector = seed.length && toSelector( tokens ); 2665 if ( !selector ) { 2666 push.apply( results, seed ); 2667 return results; 2668 } 2669 2670 break; 2671 } 2672 } 2673 } 2674 } 2675 2676 // Compile and execute a filtering function if one is not provided 2677 // Provide `match` to avoid retokenization if we modified the selector above 2678 ( compiled || compile( selector, match ) )( 2679 seed, 2680 context, 2681 !documentIsHTML, 2682 results, 2683 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 2684 ); 2685 return results; 2686}; 2687 2688// One-time assignments 2689 2690// Sort stability 2691support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; 2692 2693// Support: Chrome 14-35+ 2694// Always assume duplicates if they aren't passed to the comparison function 2695support.detectDuplicates = !!hasDuplicate; 2696 2697// Initialize against the default document 2698setDocument(); 2699 2700// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 2701// Detached nodes confoundingly follow *each other* 2702support.sortDetached = assert(function( el ) { 2703 // Should return 1, but returns 4 (following) 2704 return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; 2705}); 2706 2707// Support: IE<8 2708// Prevent attribute/property "interpolation" 2709// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 2710if ( !assert(function( el ) { 2711 el.innerHTML = "<a href='#'></a>"; 2712 return el.firstChild.getAttribute("href") === "#" ; 2713}) ) { 2714 addHandle( "type|href|height|width", function( elem, name, isXML ) { 2715 if ( !isXML ) { 2716 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 2717 } 2718 }); 2719} 2720 2721// Support: IE<9 2722// Use defaultValue in place of getAttribute("value") 2723if ( !support.attributes || !assert(function( el ) { 2724 el.innerHTML = "<input/>"; 2725 el.firstChild.setAttribute( "value", "" ); 2726 return el.firstChild.getAttribute( "value" ) === ""; 2727}) ) { 2728 addHandle( "value", function( elem, name, isXML ) { 2729 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 2730 return elem.defaultValue; 2731 } 2732 }); 2733} 2734 2735// Support: IE<9 2736// Use getAttributeNode to fetch booleans when getAttribute lies 2737if ( !assert(function( el ) { 2738 return el.getAttribute("disabled") == null; 2739}) ) { 2740 addHandle( booleans, function( elem, name, isXML ) { 2741 var val; 2742 if ( !isXML ) { 2743 return elem[ name ] === true ? name.toLowerCase() : 2744 (val = elem.getAttributeNode( name )) && val.specified ? 2745 val.value : 2746 null; 2747 } 2748 }); 2749} 2750 2751return Sizzle; 2752 2753})( window ); 2754 2755 2756 2757jQuery.find = Sizzle; 2758jQuery.expr = Sizzle.selectors; 2759 2760// Deprecated 2761jQuery.expr[ ":" ] = jQuery.expr.pseudos; 2762jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 2763jQuery.text = Sizzle.getText; 2764jQuery.isXMLDoc = Sizzle.isXML; 2765jQuery.contains = Sizzle.contains; 2766jQuery.escapeSelector = Sizzle.escape; 2767 2768 2769 2770 2771var dir = function( elem, dir, until ) { 2772 var matched = [], 2773 truncate = until !== undefined; 2774 2775 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 2776 if ( elem.nodeType === 1 ) { 2777 if ( truncate && jQuery( elem ).is( until ) ) { 2778 break; 2779 } 2780 matched.push( elem ); 2781 } 2782 } 2783 return matched; 2784}; 2785 2786 2787var siblings = function( n, elem ) { 2788 var matched = []; 2789 2790 for ( ; n; n = n.nextSibling ) { 2791 if ( n.nodeType === 1 && n !== elem ) { 2792 matched.push( n ); 2793 } 2794 } 2795 2796 return matched; 2797}; 2798 2799 2800var rneedsContext = jQuery.expr.match.needsContext; 2801 2802 2803 2804function nodeName( elem, name ) { 2805 2806 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 2807 2808}; 2809var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 2810 2811 2812 2813// Implement the identical functionality for filter and not 2814function winnow( elements, qualifier, not ) { 2815 if ( isFunction( qualifier ) ) { 2816 return jQuery.grep( elements, function( elem, i ) { 2817 return !!qualifier.call( elem, i, elem ) !== not; 2818 } ); 2819 } 2820 2821 // Single element 2822 if ( qualifier.nodeType ) { 2823 return jQuery.grep( elements, function( elem ) { 2824 return ( elem === qualifier ) !== not; 2825 } ); 2826 } 2827 2828 // Arraylike of elements (jQuery, arguments, Array) 2829 if ( typeof qualifier !== "string" ) { 2830 return jQuery.grep( elements, function( elem ) { 2831 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 2832 } ); 2833 } 2834 2835 // Filtered directly for both simple and complex selectors 2836 return jQuery.filter( qualifier, elements, not ); 2837} 2838 2839jQuery.filter = function( expr, elems, not ) { 2840 var elem = elems[ 0 ]; 2841 2842 if ( not ) { 2843 expr = ":not(" + expr + ")"; 2844 } 2845 2846 if ( elems.length === 1 && elem.nodeType === 1 ) { 2847 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 2848 } 2849 2850 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 2851 return elem.nodeType === 1; 2852 } ) ); 2853}; 2854 2855jQuery.fn.extend( { 2856 find: function( selector ) { 2857 var i, ret, 2858 len = this.length, 2859 self = this; 2860 2861 if ( typeof selector !== "string" ) { 2862 return this.pushStack( jQuery( selector ).filter( function() { 2863 for ( i = 0; i < len; i++ ) { 2864 if ( jQuery.contains( self[ i ], this ) ) { 2865 return true; 2866 } 2867 } 2868 } ) ); 2869 } 2870 2871 ret = this.pushStack( [] ); 2872 2873 for ( i = 0; i < len; i++ ) { 2874 jQuery.find( selector, self[ i ], ret ); 2875 } 2876 2877 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 2878 }, 2879 filter: function( selector ) { 2880 return this.pushStack( winnow( this, selector || [], false ) ); 2881 }, 2882 not: function( selector ) { 2883 return this.pushStack( winnow( this, selector || [], true ) ); 2884 }, 2885 is: function( selector ) { 2886 return !!winnow( 2887 this, 2888 2889 // If this is a positional/relative selector, check membership in the returned set 2890 // so $("p:first").is("p:last") won't return true for a doc with two "p". 2891 typeof selector === "string" && rneedsContext.test( selector ) ? 2892 jQuery( selector ) : 2893 selector || [], 2894 false 2895 ).length; 2896 } 2897} ); 2898 2899 2900// Initialize a jQuery object 2901 2902 2903// A central reference to the root jQuery(document) 2904var rootjQuery, 2905 2906 // A simple way to check for HTML strings 2907 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 2908 // Strict HTML recognition (#11290: must start with <) 2909 // Shortcut simple #id case for speed 2910 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 2911 2912 init = jQuery.fn.init = function( selector, context, root ) { 2913 var match, elem; 2914 2915 // HANDLE: $(""), $(null), $(undefined), $(false) 2916 if ( !selector ) { 2917 return this; 2918 } 2919 2920 // Method init() accepts an alternate rootjQuery 2921 // so migrate can support jQuery.sub (gh-2101) 2922 root = root || rootjQuery; 2923 2924 // Handle HTML strings 2925 if ( typeof selector === "string" ) { 2926 if ( selector[ 0 ] === "<" && 2927 selector[ selector.length - 1 ] === ">" && 2928 selector.length >= 3 ) { 2929 2930 // Assume that strings that start and end with <> are HTML and skip the regex check 2931 match = [ null, selector, null ]; 2932 2933 } else { 2934 match = rquickExpr.exec( selector ); 2935 } 2936 2937 // Match html or make sure no context is specified for #id 2938 if ( match && ( match[ 1 ] || !context ) ) { 2939 2940 // HANDLE: $(html) -> $(array) 2941 if ( match[ 1 ] ) { 2942 context = context instanceof jQuery ? context[ 0 ] : context; 2943 2944 // Option to run scripts is true for back-compat 2945 // Intentionally let the error be thrown if parseHTML is not present 2946 jQuery.merge( this, jQuery.parseHTML( 2947 match[ 1 ], 2948 context && context.nodeType ? context.ownerDocument || context : document, 2949 true 2950 ) ); 2951 2952 // HANDLE: $(html, props) 2953 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 2954 for ( match in context ) { 2955 2956 // Properties of context are called as methods if possible 2957 if ( isFunction( this[ match ] ) ) { 2958 this[ match ]( context[ match ] ); 2959 2960 // ...and otherwise set as attributes 2961 } else { 2962 this.attr( match, context[ match ] ); 2963 } 2964 } 2965 } 2966 2967 return this; 2968 2969 // HANDLE: $(#id) 2970 } else { 2971 elem = document.getElementById( match[ 2 ] ); 2972 2973 if ( elem ) { 2974 2975 // Inject the element directly into the jQuery object 2976 this[ 0 ] = elem; 2977 this.length = 1; 2978 } 2979 return this; 2980 } 2981 2982 // HANDLE: $(expr, $(...)) 2983 } else if ( !context || context.jquery ) { 2984 return ( context || root ).find( selector ); 2985 2986 // HANDLE: $(expr, context) 2987 // (which is just equivalent to: $(context).find(expr) 2988 } else { 2989 return this.constructor( context ).find( selector ); 2990 } 2991 2992 // HANDLE: $(DOMElement) 2993 } else if ( selector.nodeType ) { 2994 this[ 0 ] = selector; 2995 this.length = 1; 2996 return this; 2997 2998 // HANDLE: $(function) 2999 // Shortcut for document ready 3000 } else if ( isFunction( selector ) ) { 3001 return root.ready !== undefined ? 3002 root.ready( selector ) : 3003 3004 // Execute immediately if ready is not present 3005 selector( jQuery ); 3006 } 3007 3008 return jQuery.makeArray( selector, this ); 3009 }; 3010 3011// Give the init function the jQuery prototype for later instantiation 3012init.prototype = jQuery.fn; 3013 3014// Initialize central reference 3015rootjQuery = jQuery( document ); 3016 3017 3018var rparentsprev = /^(?:parents|prev(?:Until|All))/, 3019 3020 // Methods guaranteed to produce a unique set when starting from a unique set 3021 guaranteedUnique = { 3022 children: true, 3023 contents: true, 3024 next: true, 3025 prev: true 3026 }; 3027 3028jQuery.fn.extend( { 3029 has: function( target ) { 3030 var targets = jQuery( target, this ), 3031 l = targets.length; 3032 3033 return this.filter( function() { 3034 var i = 0; 3035 for ( ; i < l; i++ ) { 3036 if ( jQuery.contains( this, targets[ i ] ) ) { 3037 return true; 3038 } 3039 } 3040 } ); 3041 }, 3042 3043 closest: function( selectors, context ) { 3044 var cur, 3045 i = 0, 3046 l = this.length, 3047 matched = [], 3048 targets = typeof selectors !== "string" && jQuery( selectors ); 3049 3050 // Positional selectors never match, since there's no _selection_ context 3051 if ( !rneedsContext.test( selectors ) ) { 3052 for ( ; i < l; i++ ) { 3053 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 3054 3055 // Always skip document fragments 3056 if ( cur.nodeType < 11 && ( targets ? 3057 targets.index( cur ) > -1 : 3058 3059 // Don't pass non-elements to Sizzle 3060 cur.nodeType === 1 && 3061 jQuery.find.matchesSelector( cur, selectors ) ) ) { 3062 3063 matched.push( cur ); 3064 break; 3065 } 3066 } 3067 } 3068 } 3069 3070 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 3071 }, 3072 3073 // Determine the position of an element within the set 3074 index: function( elem ) { 3075 3076 // No argument, return index in parent 3077 if ( !elem ) { 3078 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 3079 } 3080 3081 // Index in selector 3082 if ( typeof elem === "string" ) { 3083 return indexOf.call( jQuery( elem ), this[ 0 ] ); 3084 } 3085 3086 // Locate the position of the desired element 3087 return indexOf.call( this, 3088 3089 // If it receives a jQuery object, the first element is used 3090 elem.jquery ? elem[ 0 ] : elem 3091 ); 3092 }, 3093 3094 add: function( selector, context ) { 3095 return this.pushStack( 3096 jQuery.uniqueSort( 3097 jQuery.merge( this.get(), jQuery( selector, context ) ) 3098 ) 3099 ); 3100 }, 3101 3102 addBack: function( selector ) { 3103 return this.add( selector == null ? 3104 this.prevObject : this.prevObject.filter( selector ) 3105 ); 3106 } 3107} ); 3108 3109function sibling( cur, dir ) { 3110 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 3111 return cur; 3112} 3113 3114jQuery.each( { 3115 parent: function( elem ) { 3116 var parent = elem.parentNode; 3117 return parent && parent.nodeType !== 11 ? parent : null; 3118 }, 3119 parents: function( elem ) { 3120 return dir( elem, "parentNode" ); 3121 }, 3122 parentsUntil: function( elem, i, until ) { 3123 return dir( elem, "parentNode", until ); 3124 }, 3125 next: function( elem ) { 3126 return sibling( elem, "nextSibling" ); 3127 }, 3128 prev: function( elem ) { 3129 return sibling( elem, "previousSibling" ); 3130 }, 3131 nextAll: function( elem ) { 3132 return dir( elem, "nextSibling" ); 3133 }, 3134 prevAll: function( elem ) { 3135 return dir( elem, "previousSibling" ); 3136 }, 3137 nextUntil: function( elem, i, until ) { 3138 return dir( elem, "nextSibling", until ); 3139 }, 3140 prevUntil: function( elem, i, until ) { 3141 return dir( elem, "previousSibling", until ); 3142 }, 3143 siblings: function( elem ) { 3144 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 3145 }, 3146 children: function( elem ) { 3147 return siblings( elem.firstChild ); 3148 }, 3149 contents: function( elem ) { 3150 if ( nodeName( elem, "iframe" ) ) { 3151 return elem.contentDocument; 3152 } 3153 3154 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 3155 // Treat the template element as a regular one in browsers that 3156 // don't support it. 3157 if ( nodeName( elem, "template" ) ) { 3158 elem = elem.content || elem; 3159 } 3160 3161 return jQuery.merge( [], elem.childNodes ); 3162 } 3163}, function( name, fn ) { 3164 jQuery.fn[ name ] = function( until, selector ) { 3165 var matched = jQuery.map( this, fn, until ); 3166 3167 if ( name.slice( -5 ) !== "Until" ) { 3168 selector = until; 3169 } 3170 3171 if ( selector && typeof selector === "string" ) { 3172 matched = jQuery.filter( selector, matched ); 3173 } 3174 3175 if ( this.length > 1 ) { 3176 3177 // Remove duplicates 3178 if ( !guaranteedUnique[ name ] ) { 3179 jQuery.uniqueSort( matched ); 3180 } 3181 3182 // Reverse order for parents* and prev-derivatives 3183 if ( rparentsprev.test( name ) ) { 3184 matched.reverse(); 3185 } 3186 } 3187 3188 return this.pushStack( matched ); 3189 }; 3190} ); 3191var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 3192 3193 3194 3195// Convert String-formatted options into Object-formatted ones 3196function createOptions( options ) { 3197 var object = {}; 3198 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 3199 object[ flag ] = true; 3200 } ); 3201 return object; 3202} 3203 3204/* 3205 * Create a callback list using the following parameters: 3206 * 3207 * options: an optional list of space-separated options that will change how 3208 * the callback list behaves or a more traditional option object 3209 * 3210 * By default a callback list will act like an event callback list and can be 3211 * "fired" multiple times. 3212 * 3213 * Possible options: 3214 * 3215 * once: will ensure the callback list can only be fired once (like a Deferred) 3216 * 3217 * memory: will keep track of previous values and will call any callback added 3218 * after the list has been fired right away with the latest "memorized" 3219 * values (like a Deferred) 3220 * 3221 * unique: will ensure a callback can only be added once (no duplicate in the list) 3222 * 3223 * stopOnFalse: interrupt callings when a callback returns false 3224 * 3225 */ 3226jQuery.Callbacks = function( options ) { 3227 3228 // Convert options from String-formatted to Object-formatted if needed 3229 // (we check in cache first) 3230 options = typeof options === "string" ? 3231 createOptions( options ) : 3232 jQuery.extend( {}, options ); 3233 3234 var // Flag to know if list is currently firing 3235 firing, 3236 3237 // Last fire value for non-forgettable lists 3238 memory, 3239 3240 // Flag to know if list was already fired 3241 fired, 3242 3243 // Flag to prevent firing 3244 locked, 3245 3246 // Actual callback list 3247 list = [], 3248 3249 // Queue of execution data for repeatable lists 3250 queue = [], 3251 3252 // Index of currently firing callback (modified by add/remove as needed) 3253 firingIndex = -1, 3254 3255 // Fire callbacks 3256 fire = function() { 3257 3258 // Enforce single-firing 3259 locked = locked || options.once; 3260 3261 // Execute callbacks for all pending executions, 3262 // respecting firingIndex overrides and runtime changes 3263 fired = firing = true; 3264 for ( ; queue.length; firingIndex = -1 ) { 3265 memory = queue.shift(); 3266 while ( ++firingIndex < list.length ) { 3267 3268 // Run callback and check for early termination 3269 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 3270 options.stopOnFalse ) { 3271 3272 // Jump to end and forget the data so .add doesn't re-fire 3273 firingIndex = list.length; 3274 memory = false; 3275 } 3276 } 3277 } 3278 3279 // Forget the data if we're done with it 3280 if ( !options.memory ) { 3281 memory = false; 3282 } 3283 3284 firing = false; 3285 3286 // Clean up if we're done firing for good 3287 if ( locked ) { 3288 3289 // Keep an empty list if we have data for future add calls 3290 if ( memory ) { 3291 list = []; 3292 3293 // Otherwise, this object is spent 3294 } else { 3295 list = ""; 3296 } 3297 } 3298 }, 3299 3300 // Actual Callbacks object 3301 self = { 3302 3303 // Add a callback or a collection of callbacks to the list 3304 add: function() { 3305 if ( list ) { 3306 3307 // If we have memory from a past run, we should fire after adding 3308 if ( memory && !firing ) { 3309 firingIndex = list.length - 1; 3310 queue.push( memory ); 3311 } 3312 3313 ( function add( args ) { 3314 jQuery.each( args, function( _, arg ) { 3315 if ( isFunction( arg ) ) { 3316 if ( !options.unique || !self.has( arg ) ) { 3317 list.push( arg ); 3318 } 3319 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 3320 3321 // Inspect recursively 3322 add( arg ); 3323 } 3324 } ); 3325 } )( arguments ); 3326 3327 if ( memory && !firing ) { 3328 fire(); 3329 } 3330 } 3331 return this; 3332 }, 3333 3334 // Remove a callback from the list 3335 remove: function() { 3336 jQuery.each( arguments, function( _, arg ) { 3337 var index; 3338 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 3339 list.splice( index, 1 ); 3340 3341 // Handle firing indexes 3342 if ( index <= firingIndex ) { 3343 firingIndex--; 3344 } 3345 } 3346 } ); 3347 return this; 3348 }, 3349 3350 // Check if a given callback is in the list. 3351 // If no argument is given, return whether or not list has callbacks attached. 3352 has: function( fn ) { 3353 return fn ? 3354 jQuery.inArray( fn, list ) > -1 : 3355 list.length > 0; 3356 }, 3357 3358 // Remove all callbacks from the list 3359 empty: function() { 3360 if ( list ) { 3361 list = []; 3362 } 3363 return this; 3364 }, 3365 3366 // Disable .fire and .add 3367 // Abort any current/pending executions 3368 // Clear all callbacks and values 3369 disable: function() { 3370 locked = queue = []; 3371 list = memory = ""; 3372 return this; 3373 }, 3374 disabled: function() { 3375 return !list; 3376 }, 3377 3378 // Disable .fire 3379 // Also disable .add unless we have memory (since it would have no effect) 3380 // Abort any pending executions 3381 lock: function() { 3382 locked = queue = []; 3383 if ( !memory && !firing ) { 3384 list = memory = ""; 3385 } 3386 return this; 3387 }, 3388 locked: function() { 3389 return !!locked; 3390 }, 3391 3392 // Call all callbacks with the given context and arguments 3393 fireWith: function( context, args ) { 3394 if ( !locked ) { 3395 args = args || []; 3396 args = [ context, args.slice ? args.slice() : args ]; 3397 queue.push( args ); 3398 if ( !firing ) { 3399 fire(); 3400 } 3401 } 3402 return this; 3403 }, 3404 3405 // Call all the callbacks with the given arguments 3406 fire: function() { 3407 self.fireWith( this, arguments ); 3408 return this; 3409 }, 3410 3411 // To know if the callbacks have already been called at least once 3412 fired: function() { 3413 return !!fired; 3414 } 3415 }; 3416 3417 return self; 3418}; 3419 3420 3421function Identity( v ) { 3422 return v; 3423} 3424function Thrower( ex ) { 3425 throw ex; 3426} 3427 3428function adoptValue( value, resolve, reject, noValue ) { 3429 var method; 3430 3431 try { 3432 3433 // Check for promise aspect first to privilege synchronous behavior 3434 if ( value && isFunction( ( method = value.promise ) ) ) { 3435 method.call( value ).done( resolve ).fail( reject ); 3436 3437 // Other thenables 3438 } else if ( value && isFunction( ( method = value.then ) ) ) { 3439 method.call( value, resolve, reject ); 3440 3441 // Other non-thenables 3442 } else { 3443 3444 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 3445 // * false: [ value ].slice( 0 ) => resolve( value ) 3446 // * true: [ value ].slice( 1 ) => resolve() 3447 resolve.apply( undefined, [ value ].slice( noValue ) ); 3448 } 3449 3450 // For Promises/A+, convert exceptions into rejections 3451 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 3452 // Deferred#then to conditionally suppress rejection. 3453 } catch ( value ) { 3454 3455 // Support: Android 4.0 only 3456 // Strict mode functions invoked without .call/.apply get global-object context 3457 reject.apply( undefined, [ value ] ); 3458 } 3459} 3460 3461jQuery.extend( { 3462 3463 Deferred: function( func ) { 3464 var tuples = [ 3465 3466 // action, add listener, callbacks, 3467 // ... .then handlers, argument index, [final state] 3468 [ "notify", "progress", jQuery.Callbacks( "memory" ), 3469 jQuery.Callbacks( "memory" ), 2 ], 3470 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 3471 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 3472 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 3473 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 3474 ], 3475 state = "pending", 3476 promise = { 3477 state: function() { 3478 return state; 3479 }, 3480 always: function() { 3481 deferred.done( arguments ).fail( arguments ); 3482 return this; 3483 }, 3484 "catch": function( fn ) { 3485 return promise.then( null, fn ); 3486 }, 3487 3488 // Keep pipe for back-compat 3489 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 3490 var fns = arguments; 3491 3492 return jQuery.Deferred( function( newDefer ) { 3493 jQuery.each( tuples, function( i, tuple ) { 3494 3495 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 3496 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 3497 3498 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 3499 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 3500 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 3501 deferred[ tuple[ 1 ] ]( function() { 3502 var returned = fn && fn.apply( this, arguments ); 3503 if ( returned && isFunction( returned.promise ) ) { 3504 returned.promise() 3505 .progress( newDefer.notify ) 3506 .done( newDefer.resolve ) 3507 .fail( newDefer.reject ); 3508 } else { 3509 newDefer[ tuple[ 0 ] + "With" ]( 3510 this, 3511 fn ? [ returned ] : arguments 3512 ); 3513 } 3514 } ); 3515 } ); 3516 fns = null; 3517 } ).promise(); 3518 }, 3519 then: function( onFulfilled, onRejected, onProgress ) { 3520 var maxDepth = 0; 3521 function resolve( depth, deferred, handler, special ) { 3522 return function() { 3523 var that = this, 3524 args = arguments, 3525 mightThrow = function() { 3526 var returned, then; 3527 3528 // Support: Promises/A+ section 2.3.3.3.3 3529 // https://promisesaplus.com/#point-59 3530 // Ignore double-resolution attempts 3531 if ( depth < maxDepth ) { 3532 return; 3533 } 3534 3535 returned = handler.apply( that, args ); 3536 3537 // Support: Promises/A+ section 2.3.1 3538 // https://promisesaplus.com/#point-48 3539 if ( returned === deferred.promise() ) { 3540 throw new TypeError( "Thenable self-resolution" ); 3541 } 3542 3543 // Support: Promises/A+ sections 2.3.3.1, 3.5 3544 // https://promisesaplus.com/#point-54 3545 // https://promisesaplus.com/#point-75 3546 // Retrieve `then` only once 3547 then = returned && 3548 3549 // Support: Promises/A+ section 2.3.4 3550 // https://promisesaplus.com/#point-64 3551 // Only check objects and functions for thenability 3552 ( typeof returned === "object" || 3553 typeof returned === "function" ) && 3554 returned.then; 3555 3556 // Handle a returned thenable 3557 if ( isFunction( then ) ) { 3558 3559 // Special processors (notify) just wait for resolution 3560 if ( special ) { 3561 then.call( 3562 returned, 3563 resolve( maxDepth, deferred, Identity, special ), 3564 resolve( maxDepth, deferred, Thrower, special ) 3565 ); 3566 3567 // Normal processors (resolve) also hook into progress 3568 } else { 3569 3570 // ...and disregard older resolution values 3571 maxDepth++; 3572 3573 then.call( 3574 returned, 3575 resolve( maxDepth, deferred, Identity, special ), 3576 resolve( maxDepth, deferred, Thrower, special ), 3577 resolve( maxDepth, deferred, Identity, 3578 deferred.notifyWith ) 3579 ); 3580 } 3581 3582 // Handle all other returned values 3583 } else { 3584 3585 // Only substitute handlers pass on context 3586 // and multiple values (non-spec behavior) 3587 if ( handler !== Identity ) { 3588 that = undefined; 3589 args = [ returned ]; 3590 } 3591 3592 // Process the value(s) 3593 // Default process is resolve 3594 ( special || deferred.resolveWith )( that, args ); 3595 } 3596 }, 3597 3598 // Only normal processors (resolve) catch and reject exceptions 3599 process = special ? 3600 mightThrow : 3601 function() { 3602 try { 3603 mightThrow(); 3604 } catch ( e ) { 3605 3606 if ( jQuery.Deferred.exceptionHook ) { 3607 jQuery.Deferred.exceptionHook( e, 3608 process.stackTrace ); 3609 } 3610 3611 // Support: Promises/A+ section 2.3.3.3.4.1 3612 // https://promisesaplus.com/#point-61 3613 // Ignore post-resolution exceptions 3614 if ( depth + 1 >= maxDepth ) { 3615 3616 // Only substitute handlers pass on context 3617 // and multiple values (non-spec behavior) 3618 if ( handler !== Thrower ) { 3619 that = undefined; 3620 args = [ e ]; 3621 } 3622 3623 deferred.rejectWith( that, args ); 3624 } 3625 } 3626 }; 3627 3628 // Support: Promises/A+ section 2.3.3.3.1 3629 // https://promisesaplus.com/#point-57 3630 // Re-resolve promises immediately to dodge false rejection from 3631 // subsequent errors 3632 if ( depth ) { 3633 process(); 3634 } else { 3635 3636 // Call an optional hook to record the stack, in case of exception 3637 // since it's otherwise lost when execution goes async 3638 if ( jQuery.Deferred.getStackHook ) { 3639 process.stackTrace = jQuery.Deferred.getStackHook(); 3640 } 3641 window.setTimeout( process ); 3642 } 3643 }; 3644 } 3645 3646 return jQuery.Deferred( function( newDefer ) { 3647 3648 // progress_handlers.add( ... ) 3649 tuples[ 0 ][ 3 ].add( 3650 resolve( 3651 0, 3652 newDefer, 3653 isFunction( onProgress ) ? 3654 onProgress : 3655 Identity, 3656 newDefer.notifyWith 3657 ) 3658 ); 3659 3660 // fulfilled_handlers.add( ... ) 3661 tuples[ 1 ][ 3 ].add( 3662 resolve( 3663 0, 3664 newDefer, 3665 isFunction( onFulfilled ) ? 3666 onFulfilled : 3667 Identity 3668 ) 3669 ); 3670 3671 // rejected_handlers.add( ... ) 3672 tuples[ 2 ][ 3 ].add( 3673 resolve( 3674 0, 3675 newDefer, 3676 isFunction( onRejected ) ? 3677 onRejected : 3678 Thrower 3679 ) 3680 ); 3681 } ).promise(); 3682 }, 3683 3684 // Get a promise for this deferred 3685 // If obj is provided, the promise aspect is added to the object 3686 promise: function( obj ) { 3687 return obj != null ? jQuery.extend( obj, promise ) : promise; 3688 } 3689 }, 3690 deferred = {}; 3691 3692 // Add list-specific methods 3693 jQuery.each( tuples, function( i, tuple ) { 3694 var list = tuple[ 2 ], 3695 stateString = tuple[ 5 ]; 3696 3697 // promise.progress = list.add 3698 // promise.done = list.add 3699 // promise.fail = list.add 3700 promise[ tuple[ 1 ] ] = list.add; 3701 3702 // Handle state 3703 if ( stateString ) { 3704 list.add( 3705 function() { 3706 3707 // state = "resolved" (i.e., fulfilled) 3708 // state = "rejected" 3709 state = stateString; 3710 }, 3711 3712 // rejected_callbacks.disable 3713 // fulfilled_callbacks.disable 3714 tuples[ 3 - i ][ 2 ].disable, 3715 3716 // rejected_handlers.disable 3717 // fulfilled_handlers.disable 3718 tuples[ 3 - i ][ 3 ].disable, 3719 3720 // progress_callbacks.lock 3721 tuples[ 0 ][ 2 ].lock, 3722 3723 // progress_handlers.lock 3724 tuples[ 0 ][ 3 ].lock 3725 ); 3726 } 3727 3728 // progress_handlers.fire 3729 // fulfilled_handlers.fire 3730 // rejected_handlers.fire 3731 list.add( tuple[ 3 ].fire ); 3732 3733 // deferred.notify = function() { deferred.notifyWith(...) } 3734 // deferred.resolve = function() { deferred.resolveWith(...) } 3735 // deferred.reject = function() { deferred.rejectWith(...) } 3736 deferred[ tuple[ 0 ] ] = function() { 3737 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 3738 return this; 3739 }; 3740 3741 // deferred.notifyWith = list.fireWith 3742 // deferred.resolveWith = list.fireWith 3743 // deferred.rejectWith = list.fireWith 3744 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 3745 } ); 3746 3747 // Make the deferred a promise 3748 promise.promise( deferred ); 3749 3750 // Call given func if any 3751 if ( func ) { 3752 func.call( deferred, deferred ); 3753 } 3754 3755 // All done! 3756 return deferred; 3757 }, 3758 3759 // Deferred helper 3760 when: function( singleValue ) { 3761 var 3762 3763 // count of uncompleted subordinates 3764 remaining = arguments.length, 3765 3766 // count of unprocessed arguments 3767 i = remaining, 3768 3769 // subordinate fulfillment data 3770 resolveContexts = Array( i ), 3771 resolveValues = slice.call( arguments ), 3772 3773 // the master Deferred 3774 master = jQuery.Deferred(), 3775 3776 // subordinate callback factory 3777 updateFunc = function( i ) { 3778 return function( value ) { 3779 resolveContexts[ i ] = this; 3780 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 3781 if ( !( --remaining ) ) { 3782 master.resolveWith( resolveContexts, resolveValues ); 3783 } 3784 }; 3785 }; 3786 3787 // Single- and empty arguments are adopted like Promise.resolve 3788 if ( remaining <= 1 ) { 3789 adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, 3790 !remaining ); 3791 3792 // Use .then() to unwrap secondary thenables (cf. gh-3000) 3793 if ( master.state() === "pending" || 3794 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 3795 3796 return master.then(); 3797 } 3798 } 3799 3800 // Multiple arguments are aggregated like Promise.all array elements 3801 while ( i-- ) { 3802 adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); 3803 } 3804 3805 return master.promise(); 3806 } 3807} ); 3808 3809 3810// These usually indicate a programmer mistake during development, 3811// warn about them ASAP rather than swallowing them by default. 3812var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 3813 3814jQuery.Deferred.exceptionHook = function( error, stack ) { 3815 3816 // Support: IE 8 - 9 only 3817 // Console exists when dev tools are open, which can happen at any time 3818 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 3819 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); 3820 } 3821}; 3822 3823 3824 3825 3826jQuery.readyException = function( error ) { 3827 window.setTimeout( function() { 3828 throw error; 3829 } ); 3830}; 3831 3832 3833 3834 3835// The deferred used on DOM ready 3836var readyList = jQuery.Deferred(); 3837 3838jQuery.fn.ready = function( fn ) { 3839 3840 readyList 3841 .then( fn ) 3842 3843 // Wrap jQuery.readyException in a function so that the lookup 3844 // happens at the time of error handling instead of callback 3845 // registration. 3846 .catch( function( error ) { 3847 jQuery.readyException( error ); 3848 } ); 3849 3850 return this; 3851}; 3852 3853jQuery.extend( { 3854 3855 // Is the DOM ready to be used? Set to true once it occurs. 3856 isReady: false, 3857 3858 // A counter to track how many items to wait for before 3859 // the ready event fires. See #6781 3860 readyWait: 1, 3861 3862 // Handle when the DOM is ready 3863 ready: function( wait ) { 3864 3865 // Abort if there are pending holds or we're already ready 3866 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 3867 return; 3868 } 3869 3870 // Remember that the DOM is ready 3871 jQuery.isReady = true; 3872 3873 // If a normal DOM Ready event fired, decrement, and wait if need be 3874 if ( wait !== true && --jQuery.readyWait > 0 ) { 3875 return; 3876 } 3877 3878 // If there are functions bound, to execute 3879 readyList.resolveWith( document, [ jQuery ] ); 3880 } 3881} ); 3882 3883jQuery.ready.then = readyList.then; 3884 3885// The ready event handler and self cleanup method 3886function completed() { 3887 document.removeEventListener( "DOMContentLoaded", completed ); 3888 window.removeEventListener( "load", completed ); 3889 jQuery.ready(); 3890} 3891 3892// Catch cases where $(document).ready() is called 3893// after the browser event has already occurred. 3894// Support: IE <=9 - 10 only 3895// Older IE sometimes signals "interactive" too soon 3896if ( document.readyState === "complete" || 3897 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 3898 3899 // Handle it asynchronously to allow scripts the opportunity to delay ready 3900 window.setTimeout( jQuery.ready ); 3901 3902} else { 3903 3904 // Use the handy event callback 3905 document.addEventListener( "DOMContentLoaded", completed ); 3906 3907 // A fallback to window.onload, that will always work 3908 window.addEventListener( "load", completed ); 3909} 3910 3911 3912 3913 3914// Multifunctional method to get and set values of a collection 3915// The value/s can optionally be executed if it's a function 3916var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 3917 var i = 0, 3918 len = elems.length, 3919 bulk = key == null; 3920 3921 // Sets many values 3922 if ( toType( key ) === "object" ) { 3923 chainable = true; 3924 for ( i in key ) { 3925 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 3926 } 3927 3928 // Sets one value 3929 } else if ( value !== undefined ) { 3930 chainable = true; 3931 3932 if ( !isFunction( value ) ) { 3933 raw = true; 3934 } 3935 3936 if ( bulk ) { 3937 3938 // Bulk operations run against the entire set 3939 if ( raw ) { 3940 fn.call( elems, value ); 3941 fn = null; 3942 3943 // ...except when executing function values 3944 } else { 3945 bulk = fn; 3946 fn = function( elem, key, value ) { 3947 return bulk.call( jQuery( elem ), value ); 3948 }; 3949 } 3950 } 3951 3952 if ( fn ) { 3953 for ( ; i < len; i++ ) { 3954 fn( 3955 elems[ i ], key, raw ? 3956 value : 3957 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 3958 ); 3959 } 3960 } 3961 } 3962 3963 if ( chainable ) { 3964 return elems; 3965 } 3966 3967 // Gets 3968 if ( bulk ) { 3969 return fn.call( elems ); 3970 } 3971 3972 return len ? fn( elems[ 0 ], key ) : emptyGet; 3973}; 3974 3975 3976// Matches dashed string for camelizing 3977var rmsPrefix = /^-ms-/, 3978 rdashAlpha = /-([a-z])/g; 3979 3980// Used by camelCase as callback to replace() 3981function fcamelCase( all, letter ) { 3982 return letter.toUpperCase(); 3983} 3984 3985// Convert dashed to camelCase; used by the css and data modules 3986// Support: IE <=9 - 11, Edge 12 - 15 3987// Microsoft forgot to hump their vendor prefix (#9572) 3988function camelCase( string ) { 3989 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 3990} 3991var acceptData = function( owner ) { 3992 3993 // Accepts only: 3994 // - Node 3995 // - Node.ELEMENT_NODE 3996 // - Node.DOCUMENT_NODE 3997 // - Object 3998 // - Any 3999 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 4000}; 4001 4002 4003 4004 4005function Data() { 4006 this.expando = jQuery.expando + Data.uid++; 4007} 4008 4009Data.uid = 1; 4010 4011Data.prototype = { 4012 4013 cache: function( owner ) { 4014 4015 // Check if the owner object already has a cache 4016 var value = owner[ this.expando ]; 4017 4018 // If not, create one 4019 if ( !value ) { 4020 value = {}; 4021 4022 // We can accept data for non-element nodes in modern browsers, 4023 // but we should not, see #8335. 4024 // Always return an empty object. 4025 if ( acceptData( owner ) ) { 4026 4027 // If it is a node unlikely to be stringify-ed or looped over 4028 // use plain assignment 4029 if ( owner.nodeType ) { 4030 owner[ this.expando ] = value; 4031 4032 // Otherwise secure it in a non-enumerable property 4033 // configurable must be true to allow the property to be 4034 // deleted when data is removed 4035 } else { 4036 Object.defineProperty( owner, this.expando, { 4037 value: value, 4038 configurable: true 4039 } ); 4040 } 4041 } 4042 } 4043 4044 return value; 4045 }, 4046 set: function( owner, data, value ) { 4047 var prop, 4048 cache = this.cache( owner ); 4049 4050 // Handle: [ owner, key, value ] args 4051 // Always use camelCase key (gh-2257) 4052 if ( typeof data === "string" ) { 4053 cache[ camelCase( data ) ] = value; 4054 4055 // Handle: [ owner, { properties } ] args 4056 } else { 4057 4058 // Copy the properties one-by-one to the cache object 4059 for ( prop in data ) { 4060 cache[ camelCase( prop ) ] = data[ prop ]; 4061 } 4062 } 4063 return cache; 4064 }, 4065 get: function( owner, key ) { 4066 return key === undefined ? 4067 this.cache( owner ) : 4068 4069 // Always use camelCase key (gh-2257) 4070 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 4071 }, 4072 access: function( owner, key, value ) { 4073 4074 // In cases where either: 4075 // 4076 // 1. No key was specified 4077 // 2. A string key was specified, but no value provided 4078 // 4079 // Take the "read" path and allow the get method to determine 4080 // which value to return, respectively either: 4081 // 4082 // 1. The entire cache object 4083 // 2. The data stored at the key 4084 // 4085 if ( key === undefined || 4086 ( ( key && typeof key === "string" ) && value === undefined ) ) { 4087 4088 return this.get( owner, key ); 4089 } 4090 4091 // When the key is not a string, or both a key and value 4092 // are specified, set or extend (existing objects) with either: 4093 // 4094 // 1. An object of properties 4095 // 2. A key and value 4096 // 4097 this.set( owner, key, value ); 4098 4099 // Since the "set" path can have two possible entry points 4100 // return the expected data based on which path was taken[*] 4101 return value !== undefined ? value : key; 4102 }, 4103 remove: function( owner, key ) { 4104 var i, 4105 cache = owner[ this.expando ]; 4106 4107 if ( cache === undefined ) { 4108 return; 4109 } 4110 4111 if ( key !== undefined ) { 4112 4113 // Support array or space separated string of keys 4114 if ( Array.isArray( key ) ) { 4115 4116 // If key is an array of keys... 4117 // We always set camelCase keys, so remove that. 4118 key = key.map( camelCase ); 4119 } else { 4120 key = camelCase( key ); 4121 4122 // If a key with the spaces exists, use it. 4123 // Otherwise, create an array by matching non-whitespace 4124 key = key in cache ? 4125 [ key ] : 4126 ( key.match( rnothtmlwhite ) || [] ); 4127 } 4128 4129 i = key.length; 4130 4131 while ( i-- ) { 4132 delete cache[ key[ i ] ]; 4133 } 4134 } 4135 4136 // Remove the expando if there's no more data 4137 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 4138 4139 // Support: Chrome <=35 - 45 4140 // Webkit & Blink performance suffers when deleting properties 4141 // from DOM nodes, so set to undefined instead 4142 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 4143 if ( owner.nodeType ) { 4144 owner[ this.expando ] = undefined; 4145 } else { 4146 delete owner[ this.expando ]; 4147 } 4148 } 4149 }, 4150 hasData: function( owner ) { 4151 var cache = owner[ this.expando ]; 4152 return cache !== undefined && !jQuery.isEmptyObject( cache ); 4153 } 4154}; 4155var dataPriv = new Data(); 4156 4157var dataUser = new Data(); 4158 4159 4160 4161// Implementation Summary 4162// 4163// 1. Enforce API surface and semantic compatibility with 1.9.x branch 4164// 2. Improve the module's maintainability by reducing the storage 4165// paths to a single mechanism. 4166// 3. Use the same single mechanism to support "private" and "user" data. 4167// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 4168// 5. Avoid exposing implementation details on user objects (eg. expando properties) 4169// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 4170 4171var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 4172 rmultiDash = /[A-Z]/g; 4173 4174function getData( data ) { 4175 if ( data === "true" ) { 4176 return true; 4177 } 4178 4179 if ( data === "false" ) { 4180 return false; 4181 } 4182 4183 if ( data === "null" ) { 4184 return null; 4185 } 4186 4187 // Only convert to a number if it doesn't change the string 4188 if ( data === +data + "" ) { 4189 return +data; 4190 } 4191 4192 if ( rbrace.test( data ) ) { 4193 return JSON.parse( data ); 4194 } 4195 4196 return data; 4197} 4198 4199function dataAttr( elem, key, data ) { 4200 var name; 4201 4202 // If nothing was found internally, try to fetch any 4203 // data from the HTML5 data-* attribute 4204 if ( data === undefined && elem.nodeType === 1 ) { 4205 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 4206 data = elem.getAttribute( name ); 4207 4208 if ( typeof data === "string" ) { 4209 try { 4210 data = getData( data ); 4211 } catch ( e ) {} 4212 4213 // Make sure we set the data so it isn't changed later 4214 dataUser.set( elem, key, data ); 4215 } else { 4216 data = undefined; 4217 } 4218 } 4219 return data; 4220} 4221 4222jQuery.extend( { 4223 hasData: function( elem ) { 4224 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 4225 }, 4226 4227 data: function( elem, name, data ) { 4228 return dataUser.access( elem, name, data ); 4229 }, 4230 4231 removeData: function( elem, name ) { 4232 dataUser.remove( elem, name ); 4233 }, 4234 4235 // TODO: Now that all calls to _data and _removeData have been replaced 4236 // with direct calls to dataPriv methods, these can be deprecated. 4237 _data: function( elem, name, data ) { 4238 return dataPriv.access( elem, name, data ); 4239 }, 4240 4241 _removeData: function( elem, name ) { 4242 dataPriv.remove( elem, name ); 4243 } 4244} ); 4245 4246jQuery.fn.extend( { 4247 data: function( key, value ) { 4248 var i, name, data, 4249 elem = this[ 0 ], 4250 attrs = elem && elem.attributes; 4251 4252 // Gets all values 4253 if ( key === undefined ) { 4254 if ( this.length ) { 4255 data = dataUser.get( elem ); 4256 4257 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 4258 i = attrs.length; 4259 while ( i-- ) { 4260 4261 // Support: IE 11 only 4262 // The attrs elements can be null (#14894) 4263 if ( attrs[ i ] ) { 4264 name = attrs[ i ].name; 4265 if ( name.indexOf( "data-" ) === 0 ) { 4266 name = camelCase( name.slice( 5 ) ); 4267 dataAttr( elem, name, data[ name ] ); 4268 } 4269 } 4270 } 4271 dataPriv.set( elem, "hasDataAttrs", true ); 4272 } 4273 } 4274 4275 return data; 4276 } 4277 4278 // Sets multiple values 4279 if ( typeof key === "object" ) { 4280 return this.each( function() { 4281 dataUser.set( this, key ); 4282 } ); 4283 } 4284 4285 return access( this, function( value ) { 4286 var data; 4287 4288 // The calling jQuery object (element matches) is not empty 4289 // (and therefore has an element appears at this[ 0 ]) and the 4290 // `value` parameter was not undefined. An empty jQuery object 4291 // will result in `undefined` for elem = this[ 0 ] which will 4292 // throw an exception if an attempt to read a data cache is made. 4293 if ( elem && value === undefined ) { 4294 4295 // Attempt to get data from the cache 4296 // The key will always be camelCased in Data 4297 data = dataUser.get( elem, key ); 4298 if ( data !== undefined ) { 4299 return data; 4300 } 4301 4302 // Attempt to "discover" the data in 4303 // HTML5 custom data-* attrs 4304 data = dataAttr( elem, key ); 4305 if ( data !== undefined ) { 4306 return data; 4307 } 4308 4309 // We tried really hard, but the data doesn't exist. 4310 return; 4311 } 4312 4313 // Set the data... 4314 this.each( function() { 4315 4316 // We always store the camelCased key 4317 dataUser.set( this, key, value ); 4318 } ); 4319 }, null, value, arguments.length > 1, null, true ); 4320 }, 4321 4322 removeData: function( key ) { 4323 return this.each( function() { 4324 dataUser.remove( this, key ); 4325 } ); 4326 } 4327} ); 4328 4329 4330jQuery.extend( { 4331 queue: function( elem, type, data ) { 4332 var queue; 4333 4334 if ( elem ) { 4335 type = ( type || "fx" ) + "queue"; 4336 queue = dataPriv.get( elem, type ); 4337 4338 // Speed up dequeue by getting out quickly if this is just a lookup 4339 if ( data ) { 4340 if ( !queue || Array.isArray( data ) ) { 4341 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 4342 } else { 4343 queue.push( data ); 4344 } 4345 } 4346 return queue || []; 4347 } 4348 }, 4349 4350 dequeue: function( elem, type ) { 4351 type = type || "fx"; 4352 4353 var queue = jQuery.queue( elem, type ), 4354 startLength = queue.length, 4355 fn = queue.shift(), 4356 hooks = jQuery._queueHooks( elem, type ), 4357 next = function() { 4358 jQuery.dequeue( elem, type ); 4359 }; 4360 4361 // If the fx queue is dequeued, always remove the progress sentinel 4362 if ( fn === "inprogress" ) { 4363 fn = queue.shift(); 4364 startLength--; 4365 } 4366 4367 if ( fn ) { 4368 4369 // Add a progress sentinel to prevent the fx queue from being 4370 // automatically dequeued 4371 if ( type === "fx" ) { 4372 queue.unshift( "inprogress" ); 4373 } 4374 4375 // Clear up the last queue stop function 4376 delete hooks.stop; 4377 fn.call( elem, next, hooks ); 4378 } 4379 4380 if ( !startLength && hooks ) { 4381 hooks.empty.fire(); 4382 } 4383 }, 4384 4385 // Not public - generate a queueHooks object, or return the current one 4386 _queueHooks: function( elem, type ) { 4387 var key = type + "queueHooks"; 4388 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 4389 empty: jQuery.Callbacks( "once memory" ).add( function() { 4390 dataPriv.remove( elem, [ type + "queue", key ] ); 4391 } ) 4392 } ); 4393 } 4394} ); 4395 4396jQuery.fn.extend( { 4397 queue: function( type, data ) { 4398 var setter = 2; 4399 4400 if ( typeof type !== "string" ) { 4401 data = type; 4402 type = "fx"; 4403 setter--; 4404 } 4405 4406 if ( arguments.length < setter ) { 4407 return jQuery.queue( this[ 0 ], type ); 4408 } 4409 4410 return data === undefined ? 4411 this : 4412 this.each( function() { 4413 var queue = jQuery.queue( this, type, data ); 4414 4415 // Ensure a hooks for this queue 4416 jQuery._queueHooks( this, type ); 4417 4418 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 4419 jQuery.dequeue( this, type ); 4420 } 4421 } ); 4422 }, 4423 dequeue: function( type ) { 4424 return this.each( function() { 4425 jQuery.dequeue( this, type ); 4426 } ); 4427 }, 4428 clearQueue: function( type ) { 4429 return this.queue( type || "fx", [] ); 4430 }, 4431 4432 // Get a promise resolved when queues of a certain type 4433 // are emptied (fx is the type by default) 4434 promise: function( type, obj ) { 4435 var tmp, 4436 count = 1, 4437 defer = jQuery.Deferred(), 4438 elements = this, 4439 i = this.length, 4440 resolve = function() { 4441 if ( !( --count ) ) { 4442 defer.resolveWith( elements, [ elements ] ); 4443 } 4444 }; 4445 4446 if ( typeof type !== "string" ) { 4447 obj = type; 4448 type = undefined; 4449 } 4450 type = type || "fx"; 4451 4452 while ( i-- ) { 4453 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 4454 if ( tmp && tmp.empty ) { 4455 count++; 4456 tmp.empty.add( resolve ); 4457 } 4458 } 4459 resolve(); 4460 return defer.promise( obj ); 4461 } 4462} ); 4463var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 4464 4465var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 4466 4467 4468var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 4469 4470var isHiddenWithinTree = function( elem, el ) { 4471 4472 // isHiddenWithinTree might be called from jQuery#filter function; 4473 // in that case, element will be second argument 4474 elem = el || elem; 4475 4476 // Inline style trumps all 4477 return elem.style.display === "none" || 4478 elem.style.display === "" && 4479 4480 // Otherwise, check computed style 4481 // Support: Firefox <=43 - 45 4482 // Disconnected elements can have computed display: none, so first confirm that elem is 4483 // in the document. 4484 jQuery.contains( elem.ownerDocument, elem ) && 4485 4486 jQuery.css( elem, "display" ) === "none"; 4487 }; 4488 4489var swap = function( elem, options, callback, args ) { 4490 var ret, name, 4491 old = {}; 4492 4493 // Remember the old values, and insert the new ones 4494 for ( name in options ) { 4495 old[ name ] = elem.style[ name ]; 4496 elem.style[ name ] = options[ name ]; 4497 } 4498 4499 ret = callback.apply( elem, args || [] ); 4500 4501 // Revert the old values 4502 for ( name in options ) { 4503 elem.style[ name ] = old[ name ]; 4504 } 4505 4506 return ret; 4507}; 4508 4509 4510 4511 4512function adjustCSS( elem, prop, valueParts, tween ) { 4513 var adjusted, scale, 4514 maxIterations = 20, 4515 currentValue = tween ? 4516 function() { 4517 return tween.cur(); 4518 } : 4519 function() { 4520 return jQuery.css( elem, prop, "" ); 4521 }, 4522 initial = currentValue(), 4523 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 4524 4525 // Starting value computation is required for potential unit mismatches 4526 initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 4527 rcssNum.exec( jQuery.css( elem, prop ) ); 4528 4529 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 4530 4531 // Support: Firefox <=54 4532 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 4533 initial = initial / 2; 4534 4535 // Trust units reported by jQuery.css 4536 unit = unit || initialInUnit[ 3 ]; 4537 4538 // Iteratively approximate from a nonzero starting point 4539 initialInUnit = +initial || 1; 4540 4541 while ( maxIterations-- ) { 4542 4543 // Evaluate and update our best guess (doubling guesses that zero out). 4544 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 4545 jQuery.style( elem, prop, initialInUnit + unit ); 4546 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 4547 maxIterations = 0; 4548 } 4549 initialInUnit = initialInUnit / scale; 4550 4551 } 4552 4553 initialInUnit = initialInUnit * 2; 4554 jQuery.style( elem, prop, initialInUnit + unit ); 4555 4556 // Make sure we update the tween properties later on 4557 valueParts = valueParts || []; 4558 } 4559 4560 if ( valueParts ) { 4561 initialInUnit = +initialInUnit || +initial || 0; 4562 4563 // Apply relative offset (+=/-=) if specified 4564 adjusted = valueParts[ 1 ] ? 4565 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 4566 +valueParts[ 2 ]; 4567 if ( tween ) { 4568 tween.unit = unit; 4569 tween.start = initialInUnit; 4570 tween.end = adjusted; 4571 } 4572 } 4573 return adjusted; 4574} 4575 4576 4577var defaultDisplayMap = {}; 4578 4579function getDefaultDisplay( elem ) { 4580 var temp, 4581 doc = elem.ownerDocument, 4582 nodeName = elem.nodeName, 4583 display = defaultDisplayMap[ nodeName ]; 4584 4585 if ( display ) { 4586 return display; 4587 } 4588 4589 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 4590 display = jQuery.css( temp, "display" ); 4591 4592 temp.parentNode.removeChild( temp ); 4593 4594 if ( display === "none" ) { 4595 display = "block"; 4596 } 4597 defaultDisplayMap[ nodeName ] = display; 4598 4599 return display; 4600} 4601 4602function showHide( elements, show ) { 4603 var display, elem, 4604 values = [], 4605 index = 0, 4606 length = elements.length; 4607 4608 // Determine new display value for elements that need to change 4609 for ( ; index < length; index++ ) { 4610 elem = elements[ index ]; 4611 if ( !elem.style ) { 4612 continue; 4613 } 4614 4615 display = elem.style.display; 4616 if ( show ) { 4617 4618 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 4619 // check is required in this first loop unless we have a nonempty display value (either 4620 // inline or about-to-be-restored) 4621 if ( display === "none" ) { 4622 values[ index ] = dataPriv.get( elem, "display" ) || null; 4623 if ( !values[ index ] ) { 4624 elem.style.display = ""; 4625 } 4626 } 4627 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 4628 values[ index ] = getDefaultDisplay( elem ); 4629 } 4630 } else { 4631 if ( display !== "none" ) { 4632 values[ index ] = "none"; 4633 4634 // Remember what we're overwriting 4635 dataPriv.set( elem, "display", display ); 4636 } 4637 } 4638 } 4639 4640 // Set the display of the elements in a second loop to avoid constant reflow 4641 for ( index = 0; index < length; index++ ) { 4642 if ( values[ index ] != null ) { 4643 elements[ index ].style.display = values[ index ]; 4644 } 4645 } 4646 4647 return elements; 4648} 4649 4650jQuery.fn.extend( { 4651 show: function() { 4652 return showHide( this, true ); 4653 }, 4654 hide: function() { 4655 return showHide( this ); 4656 }, 4657 toggle: function( state ) { 4658 if ( typeof state === "boolean" ) { 4659 return state ? this.show() : this.hide(); 4660 } 4661 4662 return this.each( function() { 4663 if ( isHiddenWithinTree( this ) ) { 4664 jQuery( this ).show(); 4665 } else { 4666 jQuery( this ).hide(); 4667 } 4668 } ); 4669 } 4670} ); 4671var rcheckableType = ( /^(?:checkbox|radio)$/i ); 4672 4673var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); 4674 4675var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 4676 4677 4678 4679// We have to close these tags to support XHTML (#13200) 4680var wrapMap = { 4681 4682 // Support: IE <=9 only 4683 option: [ 1, "<select multiple='multiple'>", "</select>" ], 4684 4685 // XHTML parsers do not magically insert elements in the 4686 // same way that tag soup parsers do. So we cannot shorten 4687 // this by omitting <tbody> or other required elements. 4688 thead: [ 1, "<table>", "</table>" ], 4689 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 4690 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 4691 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 4692 4693 _default: [ 0, "", "" ] 4694}; 4695 4696// Support: IE <=9 only 4697wrapMap.optgroup = wrapMap.option; 4698 4699wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 4700wrapMap.th = wrapMap.td; 4701 4702 4703function getAll( context, tag ) { 4704 4705 // Support: IE <=9 - 11 only 4706 // Use typeof to avoid zero-argument method invocation on host objects (#15151) 4707 var ret; 4708 4709 if ( typeof context.getElementsByTagName !== "undefined" ) { 4710 ret = context.getElementsByTagName( tag || "*" ); 4711 4712 } else if ( typeof context.querySelectorAll !== "undefined" ) { 4713 ret = context.querySelectorAll( tag || "*" ); 4714 4715 } else { 4716 ret = []; 4717 } 4718 4719 if ( tag === undefined || tag && nodeName( context, tag ) ) { 4720 return jQuery.merge( [ context ], ret ); 4721 } 4722 4723 return ret; 4724} 4725 4726 4727// Mark scripts as having already been evaluated 4728function setGlobalEval( elems, refElements ) { 4729 var i = 0, 4730 l = elems.length; 4731 4732 for ( ; i < l; i++ ) { 4733 dataPriv.set( 4734 elems[ i ], 4735 "globalEval", 4736 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 4737 ); 4738 } 4739} 4740 4741 4742var rhtml = /<|&#?\w+;/; 4743 4744function buildFragment( elems, context, scripts, selection, ignored ) { 4745 var elem, tmp, tag, wrap, contains, j, 4746 fragment = context.createDocumentFragment(), 4747 nodes = [], 4748 i = 0, 4749 l = elems.length; 4750 4751 for ( ; i < l; i++ ) { 4752 elem = elems[ i ]; 4753 4754 if ( elem || elem === 0 ) { 4755 4756 // Add nodes directly 4757 if ( toType( elem ) === "object" ) { 4758 4759 // Support: Android <=4.0 only, PhantomJS 1 only 4760 // push.apply(_, arraylike) throws on ancient WebKit 4761 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 4762 4763 // Convert non-html into a text node 4764 } else if ( !rhtml.test( elem ) ) { 4765 nodes.push( context.createTextNode( elem ) ); 4766 4767 // Convert html into DOM nodes 4768 } else { 4769 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 4770 4771 // Deserialize a standard representation 4772 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 4773 wrap = wrapMap[ tag ] || wrapMap._default; 4774 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 4775 4776 // Descend through wrappers to the right content 4777 j = wrap[ 0 ]; 4778 while ( j-- ) { 4779 tmp = tmp.lastChild; 4780 } 4781 4782 // Support: Android <=4.0 only, PhantomJS 1 only 4783 // push.apply(_, arraylike) throws on ancient WebKit 4784 jQuery.merge( nodes, tmp.childNodes ); 4785 4786 // Remember the top-level container 4787 tmp = fragment.firstChild; 4788 4789 // Ensure the created nodes are orphaned (#12392) 4790 tmp.textContent = ""; 4791 } 4792 } 4793 } 4794 4795 // Remove wrapper from fragment 4796 fragment.textContent = ""; 4797 4798 i = 0; 4799 while ( ( elem = nodes[ i++ ] ) ) { 4800 4801 // Skip elements already in the context collection (trac-4087) 4802 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 4803 if ( ignored ) { 4804 ignored.push( elem ); 4805 } 4806 continue; 4807 } 4808 4809 contains = jQuery.contains( elem.ownerDocument, elem ); 4810 4811 // Append to fragment 4812 tmp = getAll( fragment.appendChild( elem ), "script" ); 4813 4814 // Preserve script evaluation history 4815 if ( contains ) { 4816 setGlobalEval( tmp ); 4817 } 4818 4819 // Capture executables 4820 if ( scripts ) { 4821 j = 0; 4822 while ( ( elem = tmp[ j++ ] ) ) { 4823 if ( rscriptType.test( elem.type || "" ) ) { 4824 scripts.push( elem ); 4825 } 4826 } 4827 } 4828 } 4829 4830 return fragment; 4831} 4832 4833 4834( function() { 4835 var fragment = document.createDocumentFragment(), 4836 div = fragment.appendChild( document.createElement( "div" ) ), 4837 input = document.createElement( "input" ); 4838 4839 // Support: Android 4.0 - 4.3 only 4840 // Check state lost if the name is set (#11217) 4841 // Support: Windows Web Apps (WWA) 4842 // `name` and `type` must use .setAttribute for WWA (#14901) 4843 input.setAttribute( "type", "radio" ); 4844 input.setAttribute( "checked", "checked" ); 4845 input.setAttribute( "name", "t" ); 4846 4847 div.appendChild( input ); 4848 4849 // Support: Android <=4.1 only 4850 // Older WebKit doesn't clone checked state correctly in fragments 4851 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 4852 4853 // Support: IE <=11 only 4854 // Make sure textarea (and checkbox) defaultValue is properly cloned 4855 div.innerHTML = "<textarea>x</textarea>"; 4856 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 4857} )(); 4858var documentElement = document.documentElement; 4859 4860 4861 4862var 4863 rkeyEvent = /^key/, 4864 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, 4865 rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 4866 4867function returnTrue() { 4868 return true; 4869} 4870 4871function returnFalse() { 4872 return false; 4873} 4874 4875// Support: IE <=9 only 4876// See #13393 for more info 4877function safeActiveElement() { 4878 try { 4879 return document.activeElement; 4880 } catch ( err ) { } 4881} 4882 4883function on( elem, types, selector, data, fn, one ) { 4884 var origFn, type; 4885 4886 // Types can be a map of types/handlers 4887 if ( typeof types === "object" ) { 4888 4889 // ( types-Object, selector, data ) 4890 if ( typeof selector !== "string" ) { 4891 4892 // ( types-Object, data ) 4893 data = data || selector; 4894 selector = undefined; 4895 } 4896 for ( type in types ) { 4897 on( elem, type, selector, data, types[ type ], one ); 4898 } 4899 return elem; 4900 } 4901 4902 if ( data == null && fn == null ) { 4903 4904 // ( types, fn ) 4905 fn = selector; 4906 data = selector = undefined; 4907 } else if ( fn == null ) { 4908 if ( typeof selector === "string" ) { 4909 4910 // ( types, selector, fn ) 4911 fn = data; 4912 data = undefined; 4913 } else { 4914 4915 // ( types, data, fn ) 4916 fn = data; 4917 data = selector; 4918 selector = undefined; 4919 } 4920 } 4921 if ( fn === false ) { 4922 fn = returnFalse; 4923 } else if ( !fn ) { 4924 return elem; 4925 } 4926 4927 if ( one === 1 ) { 4928 origFn = fn; 4929 fn = function( event ) { 4930 4931 // Can use an empty set, since event contains the info 4932 jQuery().off( event ); 4933 return origFn.apply( this, arguments ); 4934 }; 4935 4936 // Use same guid so caller can remove using origFn 4937 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 4938 } 4939 return elem.each( function() { 4940 jQuery.event.add( this, types, fn, data, selector ); 4941 } ); 4942} 4943 4944/* 4945 * Helper functions for managing events -- not part of the public interface. 4946 * Props to Dean Edwards' addEvent library for many of the ideas. 4947 */ 4948jQuery.event = { 4949 4950 global: {}, 4951 4952 add: function( elem, types, handler, data, selector ) { 4953 4954 var handleObjIn, eventHandle, tmp, 4955 events, t, handleObj, 4956 special, handlers, type, namespaces, origType, 4957 elemData = dataPriv.get( elem ); 4958 4959 // Don't attach events to noData or text/comment nodes (but allow plain objects) 4960 if ( !elemData ) { 4961 return; 4962 } 4963 4964 // Caller can pass in an object of custom data in lieu of the handler 4965 if ( handler.handler ) { 4966 handleObjIn = handler; 4967 handler = handleObjIn.handler; 4968 selector = handleObjIn.selector; 4969 } 4970 4971 // Ensure that invalid selectors throw exceptions at attach time 4972 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 4973 if ( selector ) { 4974 jQuery.find.matchesSelector( documentElement, selector ); 4975 } 4976 4977 // Make sure that the handler has a unique ID, used to find/remove it later 4978 if ( !handler.guid ) { 4979 handler.guid = jQuery.guid++; 4980 } 4981 4982 // Init the element's event structure and main handler, if this is the first 4983 if ( !( events = elemData.events ) ) { 4984 events = elemData.events = {}; 4985 } 4986 if ( !( eventHandle = elemData.handle ) ) { 4987 eventHandle = elemData.handle = function( e ) { 4988 4989 // Discard the second event of a jQuery.event.trigger() and 4990 // when an event is called after a page has unloaded 4991 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 4992 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 4993 }; 4994 } 4995 4996 // Handle multiple events separated by a space 4997 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 4998 t = types.length; 4999 while ( t-- ) { 5000 tmp = rtypenamespace.exec( types[ t ] ) || []; 5001 type = origType = tmp[ 1 ]; 5002 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5003 5004 // There *must* be a type, no attaching namespace-only handlers 5005 if ( !type ) { 5006 continue; 5007 } 5008 5009 // If event changes its type, use the special event handlers for the changed type 5010 special = jQuery.event.special[ type ] || {}; 5011 5012 // If selector defined, determine special event api type, otherwise given type 5013 type = ( selector ? special.delegateType : special.bindType ) || type; 5014 5015 // Update special based on newly reset type 5016 special = jQuery.event.special[ type ] || {}; 5017 5018 // handleObj is passed to all event handlers 5019 handleObj = jQuery.extend( { 5020 type: type, 5021 origType: origType, 5022 data: data, 5023 handler: handler, 5024 guid: handler.guid, 5025 selector: selector, 5026 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 5027 namespace: namespaces.join( "." ) 5028 }, handleObjIn ); 5029 5030 // Init the event handler queue if we're the first 5031 if ( !( handlers = events[ type ] ) ) { 5032 handlers = events[ type ] = []; 5033 handlers.delegateCount = 0; 5034 5035 // Only use addEventListener if the special events handler returns false 5036 if ( !special.setup || 5037 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 5038 5039 if ( elem.addEventListener ) { 5040 elem.addEventListener( type, eventHandle ); 5041 } 5042 } 5043 } 5044 5045 if ( special.add ) { 5046 special.add.call( elem, handleObj ); 5047 5048 if ( !handleObj.handler.guid ) { 5049 handleObj.handler.guid = handler.guid; 5050 } 5051 } 5052 5053 // Add to the element's handler list, delegates in front 5054 if ( selector ) { 5055 handlers.splice( handlers.delegateCount++, 0, handleObj ); 5056 } else { 5057 handlers.push( handleObj ); 5058 } 5059 5060 // Keep track of which events have ever been used, for event optimization 5061 jQuery.event.global[ type ] = true; 5062 } 5063 5064 }, 5065 5066 // Detach an event or set of events from an element 5067 remove: function( elem, types, handler, selector, mappedTypes ) { 5068 5069 var j, origCount, tmp, 5070 events, t, handleObj, 5071 special, handlers, type, namespaces, origType, 5072 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 5073 5074 if ( !elemData || !( events = elemData.events ) ) { 5075 return; 5076 } 5077 5078 // Once for each type.namespace in types; type may be omitted 5079 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5080 t = types.length; 5081 while ( t-- ) { 5082 tmp = rtypenamespace.exec( types[ t ] ) || []; 5083 type = origType = tmp[ 1 ]; 5084 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5085 5086 // Unbind all events (on this namespace, if provided) for the element 5087 if ( !type ) { 5088 for ( type in events ) { 5089 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 5090 } 5091 continue; 5092 } 5093 5094 special = jQuery.event.special[ type ] || {}; 5095 type = ( selector ? special.delegateType : special.bindType ) || type; 5096 handlers = events[ type ] || []; 5097 tmp = tmp[ 2 ] && 5098 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 5099 5100 // Remove matching events 5101 origCount = j = handlers.length; 5102 while ( j-- ) { 5103 handleObj = handlers[ j ]; 5104 5105 if ( ( mappedTypes || origType === handleObj.origType ) && 5106 ( !handler || handler.guid === handleObj.guid ) && 5107 ( !tmp || tmp.test( handleObj.namespace ) ) && 5108 ( !selector || selector === handleObj.selector || 5109 selector === "**" && handleObj.selector ) ) { 5110 handlers.splice( j, 1 ); 5111 5112 if ( handleObj.selector ) { 5113 handlers.delegateCount--; 5114 } 5115 if ( special.remove ) { 5116 special.remove.call( elem, handleObj ); 5117 } 5118 } 5119 } 5120 5121 // Remove generic event handler if we removed something and no more handlers exist 5122 // (avoids potential for endless recursion during removal of special event handlers) 5123 if ( origCount && !handlers.length ) { 5124 if ( !special.teardown || 5125 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 5126 5127 jQuery.removeEvent( elem, type, elemData.handle ); 5128 } 5129 5130 delete events[ type ]; 5131 } 5132 } 5133 5134 // Remove data and the expando if it's no longer used 5135 if ( jQuery.isEmptyObject( events ) ) { 5136 dataPriv.remove( elem, "handle events" ); 5137 } 5138 }, 5139 5140 dispatch: function( nativeEvent ) { 5141 5142 // Make a writable jQuery.Event from the native event object 5143 var event = jQuery.event.fix( nativeEvent ); 5144 5145 var i, j, ret, matched, handleObj, handlerQueue, 5146 args = new Array( arguments.length ), 5147 handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], 5148 special = jQuery.event.special[ event.type ] || {}; 5149 5150 // Use the fix-ed jQuery.Event rather than the (read-only) native event 5151 args[ 0 ] = event; 5152 5153 for ( i = 1; i < arguments.length; i++ ) { 5154 args[ i ] = arguments[ i ]; 5155 } 5156 5157 event.delegateTarget = this; 5158 5159 // Call the preDispatch hook for the mapped type, and let it bail if desired 5160 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 5161 return; 5162 } 5163 5164 // Determine handlers 5165 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 5166 5167 // Run delegates first; they may want to stop propagation beneath us 5168 i = 0; 5169 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 5170 event.currentTarget = matched.elem; 5171 5172 j = 0; 5173 while ( ( handleObj = matched.handlers[ j++ ] ) && 5174 !event.isImmediatePropagationStopped() ) { 5175 5176 // Triggered event must either 1) have no namespace, or 2) have namespace(s) 5177 // a subset or equal to those in the bound event (both can have no namespace). 5178 if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { 5179 5180 event.handleObj = handleObj; 5181 event.data = handleObj.data; 5182 5183 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 5184 handleObj.handler ).apply( matched.elem, args ); 5185 5186 if ( ret !== undefined ) { 5187 if ( ( event.result = ret ) === false ) { 5188 event.preventDefault(); 5189 event.stopPropagation(); 5190 } 5191 } 5192 } 5193 } 5194 } 5195 5196 // Call the postDispatch hook for the mapped type 5197 if ( special.postDispatch ) { 5198 special.postDispatch.call( this, event ); 5199 } 5200 5201 return event.result; 5202 }, 5203 5204 handlers: function( event, handlers ) { 5205 var i, handleObj, sel, matchedHandlers, matchedSelectors, 5206 handlerQueue = [], 5207 delegateCount = handlers.delegateCount, 5208 cur = event.target; 5209 5210 // Find delegate handlers 5211 if ( delegateCount && 5212 5213 // Support: IE <=9 5214 // Black-hole SVG <use> instance trees (trac-13180) 5215 cur.nodeType && 5216 5217 // Support: Firefox <=42 5218 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 5219 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 5220 // Support: IE 11 only 5221 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 5222 !( event.type === "click" && event.button >= 1 ) ) { 5223 5224 for ( ; cur !== this; cur = cur.parentNode || this ) { 5225 5226 // Don't check non-elements (#13208) 5227 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 5228 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 5229 matchedHandlers = []; 5230 matchedSelectors = {}; 5231 for ( i = 0; i < delegateCount; i++ ) { 5232 handleObj = handlers[ i ]; 5233 5234 // Don't conflict with Object.prototype properties (#13203) 5235 sel = handleObj.selector + " "; 5236 5237 if ( matchedSelectors[ sel ] === undefined ) { 5238 matchedSelectors[ sel ] = handleObj.needsContext ? 5239 jQuery( sel, this ).index( cur ) > -1 : 5240 jQuery.find( sel, this, null, [ cur ] ).length; 5241 } 5242 if ( matchedSelectors[ sel ] ) { 5243 matchedHandlers.push( handleObj ); 5244 } 5245 } 5246 if ( matchedHandlers.length ) { 5247 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 5248 } 5249 } 5250 } 5251 } 5252 5253 // Add the remaining (directly-bound) handlers 5254 cur = this; 5255 if ( delegateCount < handlers.length ) { 5256 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 5257 } 5258 5259 return handlerQueue; 5260 }, 5261 5262 addProp: function( name, hook ) { 5263 Object.defineProperty( jQuery.Event.prototype, name, { 5264 enumerable: true, 5265 configurable: true, 5266 5267 get: isFunction( hook ) ? 5268 function() { 5269 if ( this.originalEvent ) { 5270 return hook( this.originalEvent ); 5271 } 5272 } : 5273 function() { 5274 if ( this.originalEvent ) { 5275 return this.originalEvent[ name ]; 5276 } 5277 }, 5278 5279 set: function( value ) { 5280 Object.defineProperty( this, name, { 5281 enumerable: true, 5282 configurable: true, 5283 writable: true, 5284 value: value 5285 } ); 5286 } 5287 } ); 5288 }, 5289 5290 fix: function( originalEvent ) { 5291 return originalEvent[ jQuery.expando ] ? 5292 originalEvent : 5293 new jQuery.Event( originalEvent ); 5294 }, 5295 5296 special: { 5297 load: { 5298 5299 // Prevent triggered image.load events from bubbling to window.load 5300 noBubble: true 5301 }, 5302 focus: { 5303 5304 // Fire native event if possible so blur/focus sequence is correct 5305 trigger: function() { 5306 if ( this !== safeActiveElement() && this.focus ) { 5307 this.focus(); 5308 return false; 5309 } 5310 }, 5311 delegateType: "focusin" 5312 }, 5313 blur: { 5314 trigger: function() { 5315 if ( this === safeActiveElement() && this.blur ) { 5316 this.blur(); 5317 return false; 5318 } 5319 }, 5320 delegateType: "focusout" 5321 }, 5322 click: { 5323 5324 // For checkbox, fire native event so checked state will be right 5325 trigger: function() { 5326 if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) { 5327 this.click(); 5328 return false; 5329 } 5330 }, 5331 5332 // For cross-browser consistency, don't fire native .click() on links 5333 _default: function( event ) { 5334 return nodeName( event.target, "a" ); 5335 } 5336 }, 5337 5338 beforeunload: { 5339 postDispatch: function( event ) { 5340 5341 // Support: Firefox 20+ 5342 // Firefox doesn't alert if the returnValue field is not set. 5343 if ( event.result !== undefined && event.originalEvent ) { 5344 event.originalEvent.returnValue = event.result; 5345 } 5346 } 5347 } 5348 } 5349}; 5350 5351jQuery.removeEvent = function( elem, type, handle ) { 5352 5353 // This "if" is needed for plain objects 5354 if ( elem.removeEventListener ) { 5355 elem.removeEventListener( type, handle ); 5356 } 5357}; 5358 5359jQuery.Event = function( src, props ) { 5360 5361 // Allow instantiation without the 'new' keyword 5362 if ( !( this instanceof jQuery.Event ) ) { 5363 return new jQuery.Event( src, props ); 5364 } 5365 5366 // Event object 5367 if ( src && src.type ) { 5368 this.originalEvent = src; 5369 this.type = src.type; 5370 5371 // Events bubbling up the document may have been marked as prevented 5372 // by a handler lower down the tree; reflect the correct value. 5373 this.isDefaultPrevented = src.defaultPrevented || 5374 src.defaultPrevented === undefined && 5375 5376 // Support: Android <=2.3 only 5377 src.returnValue === false ? 5378 returnTrue : 5379 returnFalse; 5380 5381 // Create target properties 5382 // Support: Safari <=6 - 7 only 5383 // Target should not be a text node (#504, #13143) 5384 this.target = ( src.target && src.target.nodeType === 3 ) ? 5385 src.target.parentNode : 5386 src.target; 5387 5388 this.currentTarget = src.currentTarget; 5389 this.relatedTarget = src.relatedTarget; 5390 5391 // Event type 5392 } else { 5393 this.type = src; 5394 } 5395 5396 // Put explicitly provided properties onto the event object 5397 if ( props ) { 5398 jQuery.extend( this, props ); 5399 } 5400 5401 // Create a timestamp if incoming event doesn't have one 5402 this.timeStamp = src && src.timeStamp || Date.now(); 5403 5404 // Mark it as fixed 5405 this[ jQuery.expando ] = true; 5406}; 5407 5408// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 5409// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 5410jQuery.Event.prototype = { 5411 constructor: jQuery.Event, 5412 isDefaultPrevented: returnFalse, 5413 isPropagationStopped: returnFalse, 5414 isImmediatePropagationStopped: returnFalse, 5415 isSimulated: false, 5416 5417 preventDefault: function() { 5418 var e = this.originalEvent; 5419 5420 this.isDefaultPrevented = returnTrue; 5421 5422 if ( e && !this.isSimulated ) { 5423 e.preventDefault(); 5424 } 5425 }, 5426 stopPropagation: function() { 5427 var e = this.originalEvent; 5428 5429 this.isPropagationStopped = returnTrue; 5430 5431 if ( e && !this.isSimulated ) { 5432 e.stopPropagation(); 5433 } 5434 }, 5435 stopImmediatePropagation: function() { 5436 var e = this.originalEvent; 5437 5438 this.isImmediatePropagationStopped = returnTrue; 5439 5440 if ( e && !this.isSimulated ) { 5441 e.stopImmediatePropagation(); 5442 } 5443 5444 this.stopPropagation(); 5445 } 5446}; 5447 5448// Includes all common event props including KeyEvent and MouseEvent specific props 5449jQuery.each( { 5450 altKey: true, 5451 bubbles: true, 5452 cancelable: true, 5453 changedTouches: true, 5454 ctrlKey: true, 5455 detail: true, 5456 eventPhase: true, 5457 metaKey: true, 5458 pageX: true, 5459 pageY: true, 5460 shiftKey: true, 5461 view: true, 5462 "char": true, 5463 charCode: true, 5464 key: true, 5465 keyCode: true, 5466 button: true, 5467 buttons: true, 5468 clientX: true, 5469 clientY: true, 5470 offsetX: true, 5471 offsetY: true, 5472 pointerId: true, 5473 pointerType: true, 5474 screenX: true, 5475 screenY: true, 5476 targetTouches: true, 5477 toElement: true, 5478 touches: true, 5479 5480 which: function( event ) { 5481 var button = event.button; 5482 5483 // Add which for key events 5484 if ( event.which == null && rkeyEvent.test( event.type ) ) { 5485 return event.charCode != null ? event.charCode : event.keyCode; 5486 } 5487 5488 // Add which for click: 1 === left; 2 === middle; 3 === right 5489 if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { 5490 if ( button & 1 ) { 5491 return 1; 5492 } 5493 5494 if ( button & 2 ) { 5495 return 3; 5496 } 5497 5498 if ( button & 4 ) { 5499 return 2; 5500 } 5501 5502 return 0; 5503 } 5504 5505 return event.which; 5506 } 5507}, jQuery.event.addProp ); 5508 5509// Create mouseenter/leave events using mouseover/out and event-time checks 5510// so that event delegation works in jQuery. 5511// Do the same for pointerenter/pointerleave and pointerover/pointerout 5512// 5513// Support: Safari 7 only 5514// Safari sends mouseenter too often; see: 5515// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 5516// for the description of the bug (it existed in older Chrome versions as well). 5517jQuery.each( { 5518 mouseenter: "mouseover", 5519 mouseleave: "mouseout", 5520 pointerenter: "pointerover", 5521 pointerleave: "pointerout" 5522}, function( orig, fix ) { 5523 jQuery.event.special[ orig ] = { 5524 delegateType: fix, 5525 bindType: fix, 5526 5527 handle: function( event ) { 5528 var ret, 5529 target = this, 5530 related = event.relatedTarget, 5531 handleObj = event.handleObj; 5532 5533 // For mouseenter/leave call the handler if related is outside the target. 5534 // NB: No relatedTarget if the mouse left/entered the browser window 5535 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 5536 event.type = handleObj.origType; 5537 ret = handleObj.handler.apply( this, arguments ); 5538 event.type = fix; 5539 } 5540 return ret; 5541 } 5542 }; 5543} ); 5544 5545jQuery.fn.extend( { 5546 5547 on: function( types, selector, data, fn ) { 5548 return on( this, types, selector, data, fn ); 5549 }, 5550 one: function( types, selector, data, fn ) { 5551 return on( this, types, selector, data, fn, 1 ); 5552 }, 5553 off: function( types, selector, fn ) { 5554 var handleObj, type; 5555 if ( types && types.preventDefault && types.handleObj ) { 5556 5557 // ( event ) dispatched jQuery.Event 5558 handleObj = types.handleObj; 5559 jQuery( types.delegateTarget ).off( 5560 handleObj.namespace ? 5561 handleObj.origType + "." + handleObj.namespace : 5562 handleObj.origType, 5563 handleObj.selector, 5564 handleObj.handler 5565 ); 5566 return this; 5567 } 5568 if ( typeof types === "object" ) { 5569 5570 // ( types-object [, selector] ) 5571 for ( type in types ) { 5572 this.off( type, selector, types[ type ] ); 5573 } 5574 return this; 5575 } 5576 if ( selector === false || typeof selector === "function" ) { 5577 5578 // ( types [, fn] ) 5579 fn = selector; 5580 selector = undefined; 5581 } 5582 if ( fn === false ) { 5583 fn = returnFalse; 5584 } 5585 return this.each( function() { 5586 jQuery.event.remove( this, types, fn, selector ); 5587 } ); 5588 } 5589} ); 5590 5591 5592var 5593 5594 /* eslint-disable max-len */ 5595 5596 // See https://github.com/eslint/eslint/issues/3229 5597 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, 5598 5599 /* eslint-enable */ 5600 5601 // Support: IE <=10 - 11, Edge 12 - 13 only 5602 // In IE/Edge using regex groups here causes severe slowdowns. 5603 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 5604 rnoInnerhtml = /<script|<style|<link/i, 5605 5606 // checked="checked" or checked 5607 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5608 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; 5609 5610// Prefer a tbody over its parent table for containing new rows 5611function manipulationTarget( elem, content ) { 5612 if ( nodeName( elem, "table" ) && 5613 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 5614 5615 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 5616 } 5617 5618 return elem; 5619} 5620 5621// Replace/restore the type attribute of script elements for safe DOM manipulation 5622function disableScript( elem ) { 5623 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 5624 return elem; 5625} 5626function restoreScript( elem ) { 5627 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 5628 elem.type = elem.type.slice( 5 ); 5629 } else { 5630 elem.removeAttribute( "type" ); 5631 } 5632 5633 return elem; 5634} 5635 5636function cloneCopyEvent( src, dest ) { 5637 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; 5638 5639 if ( dest.nodeType !== 1 ) { 5640 return; 5641 } 5642 5643 // 1. Copy private data: events, handlers, etc. 5644 if ( dataPriv.hasData( src ) ) { 5645 pdataOld = dataPriv.access( src ); 5646 pdataCur = dataPriv.set( dest, pdataOld ); 5647 events = pdataOld.events; 5648 5649 if ( events ) { 5650 delete pdataCur.handle; 5651 pdataCur.events = {}; 5652 5653 for ( type in events ) { 5654 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 5655 jQuery.event.add( dest, type, events[ type ][ i ] ); 5656 } 5657 } 5658 } 5659 } 5660 5661 // 2. Copy user data 5662 if ( dataUser.hasData( src ) ) { 5663 udataOld = dataUser.access( src ); 5664 udataCur = jQuery.extend( {}, udataOld ); 5665 5666 dataUser.set( dest, udataCur ); 5667 } 5668} 5669 5670// Fix IE bugs, see support tests 5671function fixInput( src, dest ) { 5672 var nodeName = dest.nodeName.toLowerCase(); 5673 5674 // Fails to persist the checked state of a cloned checkbox or radio button. 5675 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 5676 dest.checked = src.checked; 5677 5678 // Fails to return the selected option to the default selected state when cloning options 5679 } else if ( nodeName === "input" || nodeName === "textarea" ) { 5680 dest.defaultValue = src.defaultValue; 5681 } 5682} 5683 5684function domManip( collection, args, callback, ignored ) { 5685 5686 // Flatten any nested arrays 5687 args = concat.apply( [], args ); 5688 5689 var fragment, first, scripts, hasScripts, node, doc, 5690 i = 0, 5691 l = collection.length, 5692 iNoClone = l - 1, 5693 value = args[ 0 ], 5694 valueIsFunction = isFunction( value ); 5695 5696 // We can't cloneNode fragments that contain checked, in WebKit 5697 if ( valueIsFunction || 5698 ( l > 1 && typeof value === "string" && 5699 !support.checkClone && rchecked.test( value ) ) ) { 5700 return collection.each( function( index ) { 5701 var self = collection.eq( index ); 5702 if ( valueIsFunction ) { 5703 args[ 0 ] = value.call( this, index, self.html() ); 5704 } 5705 domManip( self, args, callback, ignored ); 5706 } ); 5707 } 5708 5709 if ( l ) { 5710 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 5711 first = fragment.firstChild; 5712 5713 if ( fragment.childNodes.length === 1 ) { 5714 fragment = first; 5715 } 5716 5717 // Require either new content or an interest in ignored elements to invoke the callback 5718 if ( first || ignored ) { 5719 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 5720 hasScripts = scripts.length; 5721 5722 // Use the original fragment for the last item 5723 // instead of the first because it can end up 5724 // being emptied incorrectly in certain situations (#8070). 5725 for ( ; i < l; i++ ) { 5726 node = fragment; 5727 5728 if ( i !== iNoClone ) { 5729 node = jQuery.clone( node, true, true ); 5730 5731 // Keep references to cloned scripts for later restoration 5732 if ( hasScripts ) { 5733 5734 // Support: Android <=4.0 only, PhantomJS 1 only 5735 // push.apply(_, arraylike) throws on ancient WebKit 5736 jQuery.merge( scripts, getAll( node, "script" ) ); 5737 } 5738 } 5739 5740 callback.call( collection[ i ], node, i ); 5741 } 5742 5743 if ( hasScripts ) { 5744 doc = scripts[ scripts.length - 1 ].ownerDocument; 5745 5746 // Reenable scripts 5747 jQuery.map( scripts, restoreScript ); 5748 5749 // Evaluate executable scripts on first document insertion 5750 for ( i = 0; i < hasScripts; i++ ) { 5751 node = scripts[ i ]; 5752 if ( rscriptType.test( node.type || "" ) && 5753 !dataPriv.access( node, "globalEval" ) && 5754 jQuery.contains( doc, node ) ) { 5755 5756 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 5757 5758 // Optional AJAX dependency, but won't run scripts if not present 5759 if ( jQuery._evalUrl ) { 5760 jQuery._evalUrl( node.src ); 5761 } 5762 } else { 5763 DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node ); 5764 } 5765 } 5766 } 5767 } 5768 } 5769 } 5770 5771 return collection; 5772} 5773 5774function remove( elem, selector, keepData ) { 5775 var node, 5776 nodes = selector ? jQuery.filter( selector, elem ) : elem, 5777 i = 0; 5778 5779 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 5780 if ( !keepData && node.nodeType === 1 ) { 5781 jQuery.cleanData( getAll( node ) ); 5782 } 5783 5784 if ( node.parentNode ) { 5785 if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { 5786 setGlobalEval( getAll( node, "script" ) ); 5787 } 5788 node.parentNode.removeChild( node ); 5789 } 5790 } 5791 5792 return elem; 5793} 5794 5795jQuery.extend( { 5796 htmlPrefilter: function( html ) { 5797 return html.replace( rxhtmlTag, "<$1></$2>" ); 5798 }, 5799 5800 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 5801 var i, l, srcElements, destElements, 5802 clone = elem.cloneNode( true ), 5803 inPage = jQuery.contains( elem.ownerDocument, elem ); 5804 5805 // Fix IE cloning issues 5806 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 5807 !jQuery.isXMLDoc( elem ) ) { 5808 5809 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 5810 destElements = getAll( clone ); 5811 srcElements = getAll( elem ); 5812 5813 for ( i = 0, l = srcElements.length; i < l; i++ ) { 5814 fixInput( srcElements[ i ], destElements[ i ] ); 5815 } 5816 } 5817 5818 // Copy the events from the original to the clone 5819 if ( dataAndEvents ) { 5820 if ( deepDataAndEvents ) { 5821 srcElements = srcElements || getAll( elem ); 5822 destElements = destElements || getAll( clone ); 5823 5824 for ( i = 0, l = srcElements.length; i < l; i++ ) { 5825 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 5826 } 5827 } else { 5828 cloneCopyEvent( elem, clone ); 5829 } 5830 } 5831 5832 // Preserve script evaluation history 5833 destElements = getAll( clone, "script" ); 5834 if ( destElements.length > 0 ) { 5835 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 5836 } 5837 5838 // Return the cloned set 5839 return clone; 5840 }, 5841 5842 cleanData: function( elems ) { 5843 var data, elem, type, 5844 special = jQuery.event.special, 5845 i = 0; 5846 5847 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 5848 if ( acceptData( elem ) ) { 5849 if ( ( data = elem[ dataPriv.expando ] ) ) { 5850 if ( data.events ) { 5851 for ( type in data.events ) { 5852 if ( special[ type ] ) { 5853 jQuery.event.remove( elem, type ); 5854 5855 // This is a shortcut to avoid jQuery.event.remove's overhead 5856 } else { 5857 jQuery.removeEvent( elem, type, data.handle ); 5858 } 5859 } 5860 } 5861 5862 // Support: Chrome <=35 - 45+ 5863 // Assign undefined instead of using delete, see Data#remove 5864 elem[ dataPriv.expando ] = undefined; 5865 } 5866 if ( elem[ dataUser.expando ] ) { 5867 5868 // Support: Chrome <=35 - 45+ 5869 // Assign undefined instead of using delete, see Data#remove 5870 elem[ dataUser.expando ] = undefined; 5871 } 5872 } 5873 } 5874 } 5875} ); 5876 5877jQuery.fn.extend( { 5878 detach: function( selector ) { 5879 return remove( this, selector, true ); 5880 }, 5881 5882 remove: function( selector ) { 5883 return remove( this, selector ); 5884 }, 5885 5886 text: function( value ) { 5887 return access( this, function( value ) { 5888 return value === undefined ? 5889 jQuery.text( this ) : 5890 this.empty().each( function() { 5891 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 5892 this.textContent = value; 5893 } 5894 } ); 5895 }, null, value, arguments.length ); 5896 }, 5897 5898 append: function() { 5899 return domManip( this, arguments, function( elem ) { 5900 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 5901 var target = manipulationTarget( this, elem ); 5902 target.appendChild( elem ); 5903 } 5904 } ); 5905 }, 5906 5907 prepend: function() { 5908 return domManip( this, arguments, function( elem ) { 5909 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 5910 var target = manipulationTarget( this, elem ); 5911 target.insertBefore( elem, target.firstChild ); 5912 } 5913 } ); 5914 }, 5915 5916 before: function() { 5917 return domManip( this, arguments, function( elem ) { 5918 if ( this.parentNode ) { 5919 this.parentNode.insertBefore( elem, this ); 5920 } 5921 } ); 5922 }, 5923 5924 after: function() { 5925 return domManip( this, arguments, function( elem ) { 5926 if ( this.parentNode ) { 5927 this.parentNode.insertBefore( elem, this.nextSibling ); 5928 } 5929 } ); 5930 }, 5931 5932 empty: function() { 5933 var elem, 5934 i = 0; 5935 5936 for ( ; ( elem = this[ i ] ) != null; i++ ) { 5937 if ( elem.nodeType === 1 ) { 5938 5939 // Prevent memory leaks 5940 jQuery.cleanData( getAll( elem, false ) ); 5941 5942 // Remove any remaining nodes 5943 elem.textContent = ""; 5944 } 5945 } 5946 5947 return this; 5948 }, 5949 5950 clone: function( dataAndEvents, deepDataAndEvents ) { 5951 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 5952 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 5953 5954 return this.map( function() { 5955 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 5956 } ); 5957 }, 5958 5959 html: function( value ) { 5960 return access( this, function( value ) { 5961 var elem = this[ 0 ] || {}, 5962 i = 0, 5963 l = this.length; 5964 5965 if ( value === undefined && elem.nodeType === 1 ) { 5966 return elem.innerHTML; 5967 } 5968 5969 // See if we can take a shortcut and just use innerHTML 5970 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 5971 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 5972 5973 value = jQuery.htmlPrefilter( value ); 5974 5975 try { 5976 for ( ; i < l; i++ ) { 5977 elem = this[ i ] || {}; 5978 5979 // Remove element nodes and prevent memory leaks 5980 if ( elem.nodeType === 1 ) { 5981 jQuery.cleanData( getAll( elem, false ) ); 5982 elem.innerHTML = value; 5983 } 5984 } 5985 5986 elem = 0; 5987 5988 // If using innerHTML throws an exception, use the fallback method 5989 } catch ( e ) {} 5990 } 5991 5992 if ( elem ) { 5993 this.empty().append( value ); 5994 } 5995 }, null, value, arguments.length ); 5996 }, 5997 5998 replaceWith: function() { 5999 var ignored = []; 6000 6001 // Make the changes, replacing each non-ignored context element with the new content 6002 return domManip( this, arguments, function( elem ) { 6003 var parent = this.parentNode; 6004 6005 if ( jQuery.inArray( this, ignored ) < 0 ) { 6006 jQuery.cleanData( getAll( this ) ); 6007 if ( parent ) { 6008 parent.replaceChild( elem, this ); 6009 } 6010 } 6011 6012 // Force callback invocation 6013 }, ignored ); 6014 } 6015} ); 6016 6017jQuery.each( { 6018 appendTo: "append", 6019 prependTo: "prepend", 6020 insertBefore: "before", 6021 insertAfter: "after", 6022 replaceAll: "replaceWith" 6023}, function( name, original ) { 6024 jQuery.fn[ name ] = function( selector ) { 6025 var elems, 6026 ret = [], 6027 insert = jQuery( selector ), 6028 last = insert.length - 1, 6029 i = 0; 6030 6031 for ( ; i <= last; i++ ) { 6032 elems = i === last ? this : this.clone( true ); 6033 jQuery( insert[ i ] )[ original ]( elems ); 6034 6035 // Support: Android <=4.0 only, PhantomJS 1 only 6036 // .get() because push.apply(_, arraylike) throws on ancient WebKit 6037 push.apply( ret, elems.get() ); 6038 } 6039 6040 return this.pushStack( ret ); 6041 }; 6042} ); 6043var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 6044 6045var getStyles = function( elem ) { 6046 6047 // Support: IE <=11 only, Firefox <=30 (#15098, #14150) 6048 // IE throws on elements created in popups 6049 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6050 var view = elem.ownerDocument.defaultView; 6051 6052 if ( !view || !view.opener ) { 6053 view = window; 6054 } 6055 6056 return view.getComputedStyle( elem ); 6057 }; 6058 6059var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 6060 6061 6062 6063( function() { 6064 6065 // Executing both pixelPosition & boxSizingReliable tests require only one layout 6066 // so they're executed at the same time to save the second computation. 6067 function computeStyleTests() { 6068 6069 // This is a singleton, we need to execute it only once 6070 if ( !div ) { 6071 return; 6072 } 6073 6074 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 6075 "margin-top:1px;padding:0;border:0"; 6076 div.style.cssText = 6077 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 6078 "margin:auto;border:1px;padding:1px;" + 6079 "width:60%;top:1%"; 6080 documentElement.appendChild( container ).appendChild( div ); 6081 6082 var divStyle = window.getComputedStyle( div ); 6083 pixelPositionVal = divStyle.top !== "1%"; 6084 6085 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 6086 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 6087 6088 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 6089 // Some styles come back with percentage values, even though they shouldn't 6090 div.style.right = "60%"; 6091 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 6092 6093 // Support: IE 9 - 11 only 6094 // Detect misreporting of content dimensions for box-sizing:border-box elements 6095 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 6096 6097 // Support: IE 9 only 6098 // Detect overflow:scroll screwiness (gh-3699) 6099 div.style.position = "absolute"; 6100 scrollboxSizeVal = div.offsetWidth === 36 || "absolute"; 6101 6102 documentElement.removeChild( container ); 6103 6104 // Nullify the div so it wouldn't be stored in the memory and 6105 // it will also be a sign that checks already performed 6106 div = null; 6107 } 6108 6109 function roundPixelMeasures( measure ) { 6110 return Math.round( parseFloat( measure ) ); 6111 } 6112 6113 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 6114 reliableMarginLeftVal, 6115 container = document.createElement( "div" ), 6116 div = document.createElement( "div" ); 6117 6118 // Finish early in limited (non-browser) environments 6119 if ( !div.style ) { 6120 return; 6121 } 6122 6123 // Support: IE <=9 - 11 only 6124 // Style of cloned element affects source element cloned (#8908) 6125 div.style.backgroundClip = "content-box"; 6126 div.cloneNode( true ).style.backgroundClip = ""; 6127 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6128 6129 jQuery.extend( support, { 6130 boxSizingReliable: function() { 6131 computeStyleTests(); 6132 return boxSizingReliableVal; 6133 }, 6134 pixelBoxStyles: function() { 6135 computeStyleTests(); 6136 return pixelBoxStylesVal; 6137 }, 6138 pixelPosition: function() { 6139 computeStyleTests(); 6140 return pixelPositionVal; 6141 }, 6142 reliableMarginLeft: function() { 6143 computeStyleTests(); 6144 return reliableMarginLeftVal; 6145 }, 6146 scrollboxSize: function() { 6147 computeStyleTests(); 6148 return scrollboxSizeVal; 6149 } 6150 } ); 6151} )(); 6152 6153 6154function curCSS( elem, name, computed ) { 6155 var width, minWidth, maxWidth, ret, 6156 6157 // Support: Firefox 51+ 6158 // Retrieving style before computed somehow 6159 // fixes an issue with getting wrong values 6160 // on detached elements 6161 style = elem.style; 6162 6163 computed = computed || getStyles( elem ); 6164 6165 // getPropertyValue is needed for: 6166 // .css('filter') (IE 9 only, #12537) 6167 // .css('--customProperty) (#3144) 6168 if ( computed ) { 6169 ret = computed.getPropertyValue( name ) || computed[ name ]; 6170 6171 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { 6172 ret = jQuery.style( elem, name ); 6173 } 6174 6175 // A tribute to the "awesome hack by Dean Edwards" 6176 // Android Browser returns percentage for some values, 6177 // but width seems to be reliably pixels. 6178 // This is against the CSSOM draft spec: 6179 // https://drafts.csswg.org/cssom/#resolved-values 6180 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 6181 6182 // Remember the original values 6183 width = style.width; 6184 minWidth = style.minWidth; 6185 maxWidth = style.maxWidth; 6186 6187 // Put in the new values to get a computed value out 6188 style.minWidth = style.maxWidth = style.width = ret; 6189 ret = computed.width; 6190 6191 // Revert the changed values 6192 style.width = width; 6193 style.minWidth = minWidth; 6194 style.maxWidth = maxWidth; 6195 } 6196 } 6197 6198 return ret !== undefined ? 6199 6200 // Support: IE <=9 - 11 only 6201 // IE returns zIndex value as an integer. 6202 ret + "" : 6203 ret; 6204} 6205 6206 6207function addGetHookIf( conditionFn, hookFn ) { 6208 6209 // Define the hook, we'll check on the first run if it's really needed. 6210 return { 6211 get: function() { 6212 if ( conditionFn() ) { 6213 6214 // Hook not needed (or it's not possible to use it due 6215 // to missing dependency), remove it. 6216 delete this.get; 6217 return; 6218 } 6219 6220 // Hook needed; redefine it so that the support test is not executed again. 6221 return ( this.get = hookFn ).apply( this, arguments ); 6222 } 6223 }; 6224} 6225 6226 6227var 6228 6229 // Swappable if display is none or starts with table 6230 // except "table", "table-cell", or "table-caption" 6231 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 6232 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6233 rcustomProp = /^--/, 6234 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6235 cssNormalTransform = { 6236 letterSpacing: "0", 6237 fontWeight: "400" 6238 }, 6239 6240 cssPrefixes = [ "Webkit", "Moz", "ms" ], 6241 emptyStyle = document.createElement( "div" ).style; 6242 6243// Return a css property mapped to a potentially vendor prefixed property 6244function vendorPropName( name ) { 6245 6246 // Shortcut for names that are not vendor prefixed 6247 if ( name in emptyStyle ) { 6248 return name; 6249 } 6250 6251 // Check for vendor prefixed names 6252 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 6253 i = cssPrefixes.length; 6254 6255 while ( i-- ) { 6256 name = cssPrefixes[ i ] + capName; 6257 if ( name in emptyStyle ) { 6258 return name; 6259 } 6260 } 6261} 6262 6263// Return a property mapped along what jQuery.cssProps suggests or to 6264// a vendor prefixed property. 6265function finalPropName( name ) { 6266 var ret = jQuery.cssProps[ name ]; 6267 if ( !ret ) { 6268 ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name; 6269 } 6270 return ret; 6271} 6272 6273function setPositiveNumber( elem, value, subtract ) { 6274 6275 // Any relative (+/-) values have already been 6276 // normalized at this point 6277 var matches = rcssNum.exec( value ); 6278 return matches ? 6279 6280 // Guard against undefined "subtract", e.g., when used as in cssHooks 6281 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 6282 value; 6283} 6284 6285function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 6286 var i = dimension === "width" ? 1 : 0, 6287 extra = 0, 6288 delta = 0; 6289 6290 // Adjustment may not be necessary 6291 if ( box === ( isBorderBox ? "border" : "content" ) ) { 6292 return 0; 6293 } 6294 6295 for ( ; i < 4; i += 2 ) { 6296 6297 // Both box models exclude margin 6298 if ( box === "margin" ) { 6299 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 6300 } 6301 6302 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 6303 if ( !isBorderBox ) { 6304 6305 // Add padding 6306 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6307 6308 // For "border" or "margin", add border 6309 if ( box !== "padding" ) { 6310 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6311 6312 // But still keep track of it otherwise 6313 } else { 6314 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6315 } 6316 6317 // If we get here with a border-box (content + padding + border), we're seeking "content" or 6318 // "padding" or "margin" 6319 } else { 6320 6321 // For "content", subtract padding 6322 if ( box === "content" ) { 6323 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6324 } 6325 6326 // For "content" or "padding", subtract border 6327 if ( box !== "margin" ) { 6328 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6329 } 6330 } 6331 } 6332 6333 // Account for positive content-box scroll gutter when requested by providing computedVal 6334 if ( !isBorderBox && computedVal >= 0 ) { 6335 6336 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 6337 // Assuming integer scroll gutter, subtract the rest and round down 6338 delta += Math.max( 0, Math.ceil( 6339 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 6340 computedVal - 6341 delta - 6342 extra - 6343 0.5 6344 ) ); 6345 } 6346 6347 return delta; 6348} 6349 6350function getWidthOrHeight( elem, dimension, extra ) { 6351 6352 // Start with computed style 6353 var styles = getStyles( elem ), 6354 val = curCSS( elem, dimension, styles ), 6355 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6356 valueIsBorderBox = isBorderBox; 6357 6358 // Support: Firefox <=54 6359 // Return a confounding non-pixel value or feign ignorance, as appropriate. 6360 if ( rnumnonpx.test( val ) ) { 6361 if ( !extra ) { 6362 return val; 6363 } 6364 val = "auto"; 6365 } 6366 6367 // Check for style in case a browser which returns unreliable values 6368 // for getComputedStyle silently falls back to the reliable elem.style 6369 valueIsBorderBox = valueIsBorderBox && 6370 ( support.boxSizingReliable() || val === elem.style[ dimension ] ); 6371 6372 // Fall back to offsetWidth/offsetHeight when value is "auto" 6373 // This happens for inline elements with no explicit setting (gh-3571) 6374 // Support: Android <=4.1 - 4.3 only 6375 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 6376 if ( val === "auto" || 6377 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) { 6378 6379 val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ]; 6380 6381 // offsetWidth/offsetHeight provide border-box values 6382 valueIsBorderBox = true; 6383 } 6384 6385 // Normalize "" and auto 6386 val = parseFloat( val ) || 0; 6387 6388 // Adjust for the element's box model 6389 return ( val + 6390 boxModelAdjustment( 6391 elem, 6392 dimension, 6393 extra || ( isBorderBox ? "border" : "content" ), 6394 valueIsBorderBox, 6395 styles, 6396 6397 // Provide the current computed size to request scroll gutter calculation (gh-3589) 6398 val 6399 ) 6400 ) + "px"; 6401} 6402 6403jQuery.extend( { 6404 6405 // Add in style property hooks for overriding the default 6406 // behavior of getting and setting a style property 6407 cssHooks: { 6408 opacity: { 6409 get: function( elem, computed ) { 6410 if ( computed ) { 6411 6412 // We should always get a number back from opacity 6413 var ret = curCSS( elem, "opacity" ); 6414 return ret === "" ? "1" : ret; 6415 } 6416 } 6417 } 6418 }, 6419 6420 // Don't automatically add "px" to these possibly-unitless properties 6421 cssNumber: { 6422 "animationIterationCount": true, 6423 "columnCount": true, 6424 "fillOpacity": true, 6425 "flexGrow": true, 6426 "flexShrink": true, 6427 "fontWeight": true, 6428 "lineHeight": true, 6429 "opacity": true, 6430 "order": true, 6431 "orphans": true, 6432 "widows": true, 6433 "zIndex": true, 6434 "zoom": true 6435 }, 6436 6437 // Add in properties whose names you wish to fix before 6438 // setting or getting the value 6439 cssProps: {}, 6440 6441 // Get and set the style property on a DOM Node 6442 style: function( elem, name, value, extra ) { 6443 6444 // Don't set styles on text and comment nodes 6445 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 6446 return; 6447 } 6448 6449 // Make sure that we're working with the right name 6450 var ret, type, hooks, 6451 origName = camelCase( name ), 6452 isCustomProp = rcustomProp.test( name ), 6453 style = elem.style; 6454 6455 // Make sure that we're working with the right name. We don't 6456 // want to query the value if it is a CSS custom property 6457 // since they are user-defined. 6458 if ( !isCustomProp ) { 6459 name = finalPropName( origName ); 6460 } 6461 6462 // Gets hook for the prefixed version, then unprefixed version 6463 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6464 6465 // Check if we're setting a value 6466 if ( value !== undefined ) { 6467 type = typeof value; 6468 6469 // Convert "+=" or "-=" to relative numbers (#7345) 6470 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 6471 value = adjustCSS( elem, name, ret ); 6472 6473 // Fixes bug #9237 6474 type = "number"; 6475 } 6476 6477 // Make sure that null and NaN values aren't set (#7116) 6478 if ( value == null || value !== value ) { 6479 return; 6480 } 6481 6482 // If a number was passed in, add the unit (except for certain CSS properties) 6483 if ( type === "number" ) { 6484 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 6485 } 6486 6487 // background-* props affect original clone's values 6488 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 6489 style[ name ] = "inherit"; 6490 } 6491 6492 // If a hook was provided, use that value, otherwise just set the specified value 6493 if ( !hooks || !( "set" in hooks ) || 6494 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 6495 6496 if ( isCustomProp ) { 6497 style.setProperty( name, value ); 6498 } else { 6499 style[ name ] = value; 6500 } 6501 } 6502 6503 } else { 6504 6505 // If a hook was provided get the non-computed value from there 6506 if ( hooks && "get" in hooks && 6507 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 6508 6509 return ret; 6510 } 6511 6512 // Otherwise just get the value from the style object 6513 return style[ name ]; 6514 } 6515 }, 6516 6517 css: function( elem, name, extra, styles ) { 6518 var val, num, hooks, 6519 origName = camelCase( name ), 6520 isCustomProp = rcustomProp.test( name ); 6521 6522 // Make sure that we're working with the right name. We don't 6523 // want to modify the value if it is a CSS custom property 6524 // since they are user-defined. 6525 if ( !isCustomProp ) { 6526 name = finalPropName( origName ); 6527 } 6528 6529 // Try prefixed name followed by the unprefixed name 6530 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6531 6532 // If a hook was provided get the computed value from there 6533 if ( hooks && "get" in hooks ) { 6534 val = hooks.get( elem, true, extra ); 6535 } 6536 6537 // Otherwise, if a way to get the computed value exists, use that 6538 if ( val === undefined ) { 6539 val = curCSS( elem, name, styles ); 6540 } 6541 6542 // Convert "normal" to computed value 6543 if ( val === "normal" && name in cssNormalTransform ) { 6544 val = cssNormalTransform[ name ]; 6545 } 6546 6547 // Make numeric if forced or a qualifier was provided and val looks numeric 6548 if ( extra === "" || extra ) { 6549 num = parseFloat( val ); 6550 return extra === true || isFinite( num ) ? num || 0 : val; 6551 } 6552 6553 return val; 6554 } 6555} ); 6556 6557jQuery.each( [ "height", "width" ], function( i, dimension ) { 6558 jQuery.cssHooks[ dimension ] = { 6559 get: function( elem, computed, extra ) { 6560 if ( computed ) { 6561 6562 // Certain elements can have dimension info if we invisibly show them 6563 // but it must have a current display style that would benefit 6564 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 6565 6566 // Support: Safari 8+ 6567 // Table columns in Safari have non-zero offsetWidth & zero 6568 // getBoundingClientRect().width unless display is changed. 6569 // Support: IE <=11 only 6570 // Running getBoundingClientRect on a disconnected node 6571 // in IE throws an error. 6572 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 6573 swap( elem, cssShow, function() { 6574 return getWidthOrHeight( elem, dimension, extra ); 6575 } ) : 6576 getWidthOrHeight( elem, dimension, extra ); 6577 } 6578 }, 6579 6580 set: function( elem, value, extra ) { 6581 var matches, 6582 styles = getStyles( elem ), 6583 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6584 subtract = extra && boxModelAdjustment( 6585 elem, 6586 dimension, 6587 extra, 6588 isBorderBox, 6589 styles 6590 ); 6591 6592 // Account for unreliable border-box dimensions by comparing offset* to computed and 6593 // faking a content-box to get border and padding (gh-3699) 6594 if ( isBorderBox && support.scrollboxSize() === styles.position ) { 6595 subtract -= Math.ceil( 6596 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 6597 parseFloat( styles[ dimension ] ) - 6598 boxModelAdjustment( elem, dimension, "border", false, styles ) - 6599 0.5 6600 ); 6601 } 6602 6603 // Convert to pixels if value adjustment is needed 6604 if ( subtract && ( matches = rcssNum.exec( value ) ) && 6605 ( matches[ 3 ] || "px" ) !== "px" ) { 6606 6607 elem.style[ dimension ] = value; 6608 value = jQuery.css( elem, dimension ); 6609 } 6610 6611 return setPositiveNumber( elem, value, subtract ); 6612 } 6613 }; 6614} ); 6615 6616jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 6617 function( elem, computed ) { 6618 if ( computed ) { 6619 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 6620 elem.getBoundingClientRect().left - 6621 swap( elem, { marginLeft: 0 }, function() { 6622 return elem.getBoundingClientRect().left; 6623 } ) 6624 ) + "px"; 6625 } 6626 } 6627); 6628 6629// These hooks are used by animate to expand properties 6630jQuery.each( { 6631 margin: "", 6632 padding: "", 6633 border: "Width" 6634}, function( prefix, suffix ) { 6635 jQuery.cssHooks[ prefix + suffix ] = { 6636 expand: function( value ) { 6637 var i = 0, 6638 expanded = {}, 6639 6640 // Assumes a single number if not a string 6641 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 6642 6643 for ( ; i < 4; i++ ) { 6644 expanded[ prefix + cssExpand[ i ] + suffix ] = 6645 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 6646 } 6647 6648 return expanded; 6649 } 6650 }; 6651 6652 if ( prefix !== "margin" ) { 6653 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 6654 } 6655} ); 6656 6657jQuery.fn.extend( { 6658 css: function( name, value ) { 6659 return access( this, function( elem, name, value ) { 6660 var styles, len, 6661 map = {}, 6662 i = 0; 6663 6664 if ( Array.isArray( name ) ) { 6665 styles = getStyles( elem ); 6666 len = name.length; 6667 6668 for ( ; i < len; i++ ) { 6669 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 6670 } 6671 6672 return map; 6673 } 6674 6675 return value !== undefined ? 6676 jQuery.style( elem, name, value ) : 6677 jQuery.css( elem, name ); 6678 }, name, value, arguments.length > 1 ); 6679 } 6680} ); 6681 6682 6683function Tween( elem, options, prop, end, easing ) { 6684 return new Tween.prototype.init( elem, options, prop, end, easing ); 6685} 6686jQuery.Tween = Tween; 6687 6688Tween.prototype = { 6689 constructor: Tween, 6690 init: function( elem, options, prop, end, easing, unit ) { 6691 this.elem = elem; 6692 this.prop = prop; 6693 this.easing = easing || jQuery.easing._default; 6694 this.options = options; 6695 this.start = this.now = this.cur(); 6696 this.end = end; 6697 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 6698 }, 6699 cur: function() { 6700 var hooks = Tween.propHooks[ this.prop ]; 6701 6702 return hooks && hooks.get ? 6703 hooks.get( this ) : 6704 Tween.propHooks._default.get( this ); 6705 }, 6706 run: function( percent ) { 6707 var eased, 6708 hooks = Tween.propHooks[ this.prop ]; 6709 6710 if ( this.options.duration ) { 6711 this.pos = eased = jQuery.easing[ this.easing ]( 6712 percent, this.options.duration * percent, 0, 1, this.options.duration 6713 ); 6714 } else { 6715 this.pos = eased = percent; 6716 } 6717 this.now = ( this.end - this.start ) * eased + this.start; 6718 6719 if ( this.options.step ) { 6720 this.options.step.call( this.elem, this.now, this ); 6721 } 6722 6723 if ( hooks && hooks.set ) { 6724 hooks.set( this ); 6725 } else { 6726 Tween.propHooks._default.set( this ); 6727 } 6728 return this; 6729 } 6730}; 6731 6732Tween.prototype.init.prototype = Tween.prototype; 6733 6734Tween.propHooks = { 6735 _default: { 6736 get: function( tween ) { 6737 var result; 6738 6739 // Use a property on the element directly when it is not a DOM element, 6740 // or when there is no matching style property that exists. 6741 if ( tween.elem.nodeType !== 1 || 6742 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 6743 return tween.elem[ tween.prop ]; 6744 } 6745 6746 // Passing an empty string as a 3rd parameter to .css will automatically 6747 // attempt a parseFloat and fallback to a string if the parse fails. 6748 // Simple values such as "10px" are parsed to Float; 6749 // complex values such as "rotate(1rad)" are returned as-is. 6750 result = jQuery.css( tween.elem, tween.prop, "" ); 6751 6752 // Empty strings, null, undefined and "auto" are converted to 0. 6753 return !result || result === "auto" ? 0 : result; 6754 }, 6755 set: function( tween ) { 6756 6757 // Use step hook for back compat. 6758 // Use cssHook if its there. 6759 // Use .style if available and use plain properties where available. 6760 if ( jQuery.fx.step[ tween.prop ] ) { 6761 jQuery.fx.step[ tween.prop ]( tween ); 6762 } else if ( tween.elem.nodeType === 1 && 6763 ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || 6764 jQuery.cssHooks[ tween.prop ] ) ) { 6765 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 6766 } else { 6767 tween.elem[ tween.prop ] = tween.now; 6768 } 6769 } 6770 } 6771}; 6772 6773// Support: IE <=9 only 6774// Panic based approach to setting things on disconnected nodes 6775Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 6776 set: function( tween ) { 6777 if ( tween.elem.nodeType && tween.elem.parentNode ) { 6778 tween.elem[ tween.prop ] = tween.now; 6779 } 6780 } 6781}; 6782 6783jQuery.easing = { 6784 linear: function( p ) { 6785 return p; 6786 }, 6787 swing: function( p ) { 6788 return 0.5 - Math.cos( p * Math.PI ) / 2; 6789 }, 6790 _default: "swing" 6791}; 6792 6793jQuery.fx = Tween.prototype.init; 6794 6795// Back compat <1.8 extension point 6796jQuery.fx.step = {}; 6797 6798 6799 6800 6801var 6802 fxNow, inProgress, 6803 rfxtypes = /^(?:toggle|show|hide)$/, 6804 rrun = /queueHooks$/; 6805 6806function schedule() { 6807 if ( inProgress ) { 6808 if ( document.hidden === false && window.requestAnimationFrame ) { 6809 window.requestAnimationFrame( schedule ); 6810 } else { 6811 window.setTimeout( schedule, jQuery.fx.interval ); 6812 } 6813 6814 jQuery.fx.tick(); 6815 } 6816} 6817 6818// Animations created synchronously will run synchronously 6819function createFxNow() { 6820 window.setTimeout( function() { 6821 fxNow = undefined; 6822 } ); 6823 return ( fxNow = Date.now() ); 6824} 6825 6826// Generate parameters to create a standard animation 6827function genFx( type, includeWidth ) { 6828 var which, 6829 i = 0, 6830 attrs = { height: type }; 6831 6832 // If we include width, step value is 1 to do all cssExpand values, 6833 // otherwise step value is 2 to skip over Left and Right 6834 includeWidth = includeWidth ? 1 : 0; 6835 for ( ; i < 4; i += 2 - includeWidth ) { 6836 which = cssExpand[ i ]; 6837 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 6838 } 6839 6840 if ( includeWidth ) { 6841 attrs.opacity = attrs.width = type; 6842 } 6843 6844 return attrs; 6845} 6846 6847function createTween( value, prop, animation ) { 6848 var tween, 6849 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 6850 index = 0, 6851 length = collection.length; 6852 for ( ; index < length; index++ ) { 6853 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 6854 6855 // We're done with this property 6856 return tween; 6857 } 6858 } 6859} 6860 6861function defaultPrefilter( elem, props, opts ) { 6862 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 6863 isBox = "width" in props || "height" in props, 6864 anim = this, 6865 orig = {}, 6866 style = elem.style, 6867 hidden = elem.nodeType && isHiddenWithinTree( elem ), 6868 dataShow = dataPriv.get( elem, "fxshow" ); 6869 6870 // Queue-skipping animations hijack the fx hooks 6871 if ( !opts.queue ) { 6872 hooks = jQuery._queueHooks( elem, "fx" ); 6873 if ( hooks.unqueued == null ) { 6874 hooks.unqueued = 0; 6875 oldfire = hooks.empty.fire; 6876 hooks.empty.fire = function() { 6877 if ( !hooks.unqueued ) { 6878 oldfire(); 6879 } 6880 }; 6881 } 6882 hooks.unqueued++; 6883 6884 anim.always( function() { 6885 6886 // Ensure the complete handler is called before this completes 6887 anim.always( function() { 6888 hooks.unqueued--; 6889 if ( !jQuery.queue( elem, "fx" ).length ) { 6890 hooks.empty.fire(); 6891 } 6892 } ); 6893 } ); 6894 } 6895 6896 // Detect show/hide animations 6897 for ( prop in props ) { 6898 value = props[ prop ]; 6899 if ( rfxtypes.test( value ) ) { 6900 delete props[ prop ]; 6901 toggle = toggle || value === "toggle"; 6902 if ( value === ( hidden ? "hide" : "show" ) ) { 6903 6904 // Pretend to be hidden if this is a "show" and 6905 // there is still data from a stopped show/hide 6906 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 6907 hidden = true; 6908 6909 // Ignore all other no-op show/hide data 6910 } else { 6911 continue; 6912 } 6913 } 6914 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 6915 } 6916 } 6917 6918 // Bail out if this is a no-op like .hide().hide() 6919 propTween = !jQuery.isEmptyObject( props ); 6920 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 6921 return; 6922 } 6923 6924 // Restrict "overflow" and "display" styles during box animations 6925 if ( isBox && elem.nodeType === 1 ) { 6926 6927 // Support: IE <=9 - 11, Edge 12 - 15 6928 // Record all 3 overflow attributes because IE does not infer the shorthand 6929 // from identically-valued overflowX and overflowY and Edge just mirrors 6930 // the overflowX value there. 6931 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 6932 6933 // Identify a display type, preferring old show/hide data over the CSS cascade 6934 restoreDisplay = dataShow && dataShow.display; 6935 if ( restoreDisplay == null ) { 6936 restoreDisplay = dataPriv.get( elem, "display" ); 6937 } 6938 display = jQuery.css( elem, "display" ); 6939 if ( display === "none" ) { 6940 if ( restoreDisplay ) { 6941 display = restoreDisplay; 6942 } else { 6943 6944 // Get nonempty value(s) by temporarily forcing visibility 6945 showHide( [ elem ], true ); 6946 restoreDisplay = elem.style.display || restoreDisplay; 6947 display = jQuery.css( elem, "display" ); 6948 showHide( [ elem ] ); 6949 } 6950 } 6951 6952 // Animate inline elements as inline-block 6953 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 6954 if ( jQuery.css( elem, "float" ) === "none" ) { 6955 6956 // Restore the original display value at the end of pure show/hide animations 6957 if ( !propTween ) { 6958 anim.done( function() { 6959 style.display = restoreDisplay; 6960 } ); 6961 if ( restoreDisplay == null ) { 6962 display = style.display; 6963 restoreDisplay = display === "none" ? "" : display; 6964 } 6965 } 6966 style.display = "inline-block"; 6967 } 6968 } 6969 } 6970 6971 if ( opts.overflow ) { 6972 style.overflow = "hidden"; 6973 anim.always( function() { 6974 style.overflow = opts.overflow[ 0 ]; 6975 style.overflowX = opts.overflow[ 1 ]; 6976 style.overflowY = opts.overflow[ 2 ]; 6977 } ); 6978 } 6979 6980 // Implement show/hide animations 6981 propTween = false; 6982 for ( prop in orig ) { 6983 6984 // General show/hide setup for this element animation 6985 if ( !propTween ) { 6986 if ( dataShow ) { 6987 if ( "hidden" in dataShow ) { 6988 hidden = dataShow.hidden; 6989 } 6990 } else { 6991 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 6992 } 6993 6994 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 6995 if ( toggle ) { 6996 dataShow.hidden = !hidden; 6997 } 6998 6999 // Show elements before animating them 7000 if ( hidden ) { 7001 showHide( [ elem ], true ); 7002 } 7003 7004 /* eslint-disable no-loop-func */ 7005 7006 anim.done( function() { 7007 7008 /* eslint-enable no-loop-func */ 7009 7010 // The final step of a "hide" animation is actually hiding the element 7011 if ( !hidden ) { 7012 showHide( [ elem ] ); 7013 } 7014 dataPriv.remove( elem, "fxshow" ); 7015 for ( prop in orig ) { 7016 jQuery.style( elem, prop, orig[ prop ] ); 7017 } 7018 } ); 7019 } 7020 7021 // Per-property setup 7022 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 7023 if ( !( prop in dataShow ) ) { 7024 dataShow[ prop ] = propTween.start; 7025 if ( hidden ) { 7026 propTween.end = propTween.start; 7027 propTween.start = 0; 7028 } 7029 } 7030 } 7031} 7032 7033function propFilter( props, specialEasing ) { 7034 var index, name, easing, value, hooks; 7035 7036 // camelCase, specialEasing and expand cssHook pass 7037 for ( index in props ) { 7038 name = camelCase( index ); 7039 easing = specialEasing[ name ]; 7040 value = props[ index ]; 7041 if ( Array.isArray( value ) ) { 7042 easing = value[ 1 ]; 7043 value = props[ index ] = value[ 0 ]; 7044 } 7045 7046 if ( index !== name ) { 7047 props[ name ] = value; 7048 delete props[ index ]; 7049 } 7050 7051 hooks = jQuery.cssHooks[ name ]; 7052 if ( hooks && "expand" in hooks ) { 7053 value = hooks.expand( value ); 7054 delete props[ name ]; 7055 7056 // Not quite $.extend, this won't overwrite existing keys. 7057 // Reusing 'index' because we have the correct "name" 7058 for ( index in value ) { 7059 if ( !( index in props ) ) { 7060 props[ index ] = value[ index ]; 7061 specialEasing[ index ] = easing; 7062 } 7063 } 7064 } else { 7065 specialEasing[ name ] = easing; 7066 } 7067 } 7068} 7069 7070function Animation( elem, properties, options ) { 7071 var result, 7072 stopped, 7073 index = 0, 7074 length = Animation.prefilters.length, 7075 deferred = jQuery.Deferred().always( function() { 7076 7077 // Don't match elem in the :animated selector 7078 delete tick.elem; 7079 } ), 7080 tick = function() { 7081 if ( stopped ) { 7082 return false; 7083 } 7084 var currentTime = fxNow || createFxNow(), 7085 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 7086 7087 // Support: Android 2.3 only 7088 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) 7089 temp = remaining / animation.duration || 0, 7090 percent = 1 - temp, 7091 index = 0, 7092 length = animation.tweens.length; 7093 7094 for ( ; index < length; index++ ) { 7095 animation.tweens[ index ].run( percent ); 7096 } 7097 7098 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 7099 7100 // If there's more to do, yield 7101 if ( percent < 1 && length ) { 7102 return remaining; 7103 } 7104 7105 // If this was an empty animation, synthesize a final progress notification 7106 if ( !length ) { 7107 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7108 } 7109 7110 // Resolve the animation and report its conclusion 7111 deferred.resolveWith( elem, [ animation ] ); 7112 return false; 7113 }, 7114 animation = deferred.promise( { 7115 elem: elem, 7116 props: jQuery.extend( {}, properties ), 7117 opts: jQuery.extend( true, { 7118 specialEasing: {}, 7119 easing: jQuery.easing._default 7120 }, options ), 7121 originalProperties: properties, 7122 originalOptions: options, 7123 startTime: fxNow || createFxNow(), 7124 duration: options.duration, 7125 tweens: [], 7126 createTween: function( prop, end ) { 7127 var tween = jQuery.Tween( elem, animation.opts, prop, end, 7128 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 7129 animation.tweens.push( tween ); 7130 return tween; 7131 }, 7132 stop: function( gotoEnd ) { 7133 var index = 0, 7134 7135 // If we are going to the end, we want to run all the tweens 7136 // otherwise we skip this part 7137 length = gotoEnd ? animation.tweens.length : 0; 7138 if ( stopped ) { 7139 return this; 7140 } 7141 stopped = true; 7142 for ( ; index < length; index++ ) { 7143 animation.tweens[ index ].run( 1 ); 7144 } 7145 7146 // Resolve when we played the last frame; otherwise, reject 7147 if ( gotoEnd ) { 7148 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7149 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 7150 } else { 7151 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 7152 } 7153 return this; 7154 } 7155 } ), 7156 props = animation.props; 7157 7158 propFilter( props, animation.opts.specialEasing ); 7159 7160 for ( ; index < length; index++ ) { 7161 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 7162 if ( result ) { 7163 if ( isFunction( result.stop ) ) { 7164 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 7165 result.stop.bind( result ); 7166 } 7167 return result; 7168 } 7169 } 7170 7171 jQuery.map( props, createTween, animation ); 7172 7173 if ( isFunction( animation.opts.start ) ) { 7174 animation.opts.start.call( elem, animation ); 7175 } 7176 7177 // Attach callbacks from options 7178 animation 7179 .progress( animation.opts.progress ) 7180 .done( animation.opts.done, animation.opts.complete ) 7181 .fail( animation.opts.fail ) 7182 .always( animation.opts.always ); 7183 7184 jQuery.fx.timer( 7185 jQuery.extend( tick, { 7186 elem: elem, 7187 anim: animation, 7188 queue: animation.opts.queue 7189 } ) 7190 ); 7191 7192 return animation; 7193} 7194 7195jQuery.Animation = jQuery.extend( Animation, { 7196 7197 tweeners: { 7198 "*": [ function( prop, value ) { 7199 var tween = this.createTween( prop, value ); 7200 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 7201 return tween; 7202 } ] 7203 }, 7204 7205 tweener: function( props, callback ) { 7206 if ( isFunction( props ) ) { 7207 callback = props; 7208 props = [ "*" ]; 7209 } else { 7210 props = props.match( rnothtmlwhite ); 7211 } 7212 7213 var prop, 7214 index = 0, 7215 length = props.length; 7216 7217 for ( ; index < length; index++ ) { 7218 prop = props[ index ]; 7219 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 7220 Animation.tweeners[ prop ].unshift( callback ); 7221 } 7222 }, 7223 7224 prefilters: [ defaultPrefilter ], 7225 7226 prefilter: function( callback, prepend ) { 7227 if ( prepend ) { 7228 Animation.prefilters.unshift( callback ); 7229 } else { 7230 Animation.prefilters.push( callback ); 7231 } 7232 } 7233} ); 7234 7235jQuery.speed = function( speed, easing, fn ) { 7236 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 7237 complete: fn || !fn && easing || 7238 isFunction( speed ) && speed, 7239 duration: speed, 7240 easing: fn && easing || easing && !isFunction( easing ) && easing 7241 }; 7242 7243 // Go to the end state if fx are off 7244 if ( jQuery.fx.off ) { 7245 opt.duration = 0; 7246 7247 } else { 7248 if ( typeof opt.duration !== "number" ) { 7249 if ( opt.duration in jQuery.fx.speeds ) { 7250 opt.duration = jQuery.fx.speeds[ opt.duration ]; 7251 7252 } else { 7253 opt.duration = jQuery.fx.speeds._default; 7254 } 7255 } 7256 } 7257 7258 // Normalize opt.queue - true/undefined/null -> "fx" 7259 if ( opt.queue == null || opt.queue === true ) { 7260 opt.queue = "fx"; 7261 } 7262 7263 // Queueing 7264 opt.old = opt.complete; 7265 7266 opt.complete = function() { 7267 if ( isFunction( opt.old ) ) { 7268 opt.old.call( this ); 7269 } 7270 7271 if ( opt.queue ) { 7272 jQuery.dequeue( this, opt.queue ); 7273 } 7274 }; 7275 7276 return opt; 7277}; 7278 7279jQuery.fn.extend( { 7280 fadeTo: function( speed, to, easing, callback ) { 7281 7282 // Show any hidden elements after setting opacity to 0 7283 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 7284 7285 // Animate to the value specified 7286 .end().animate( { opacity: to }, speed, easing, callback ); 7287 }, 7288 animate: function( prop, speed, easing, callback ) { 7289 var empty = jQuery.isEmptyObject( prop ), 7290 optall = jQuery.speed( speed, easing, callback ), 7291 doAnimation = function() { 7292 7293 // Operate on a copy of prop so per-property easing won't be lost 7294 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 7295 7296 // Empty animations, or finishing resolves immediately 7297 if ( empty || dataPriv.get( this, "finish" ) ) { 7298 anim.stop( true ); 7299 } 7300 }; 7301 doAnimation.finish = doAnimation; 7302 7303 return empty || optall.queue === false ? 7304 this.each( doAnimation ) : 7305 this.queue( optall.queue, doAnimation ); 7306 }, 7307 stop: function( type, clearQueue, gotoEnd ) { 7308 var stopQueue = function( hooks ) { 7309 var stop = hooks.stop; 7310 delete hooks.stop; 7311 stop( gotoEnd ); 7312 }; 7313 7314 if ( typeof type !== "string" ) { 7315 gotoEnd = clearQueue; 7316 clearQueue = type; 7317 type = undefined; 7318 } 7319 if ( clearQueue && type !== false ) { 7320 this.queue( type || "fx", [] ); 7321 } 7322 7323 return this.each( function() { 7324 var dequeue = true, 7325 index = type != null && type + "queueHooks", 7326 timers = jQuery.timers, 7327 data = dataPriv.get( this ); 7328 7329 if ( index ) { 7330 if ( data[ index ] && data[ index ].stop ) { 7331 stopQueue( data[ index ] ); 7332 } 7333 } else { 7334 for ( index in data ) { 7335 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 7336 stopQueue( data[ index ] ); 7337 } 7338 } 7339 } 7340 7341 for ( index = timers.length; index--; ) { 7342 if ( timers[ index ].elem === this && 7343 ( type == null || timers[ index ].queue === type ) ) { 7344 7345 timers[ index ].anim.stop( gotoEnd ); 7346 dequeue = false; 7347 timers.splice( index, 1 ); 7348 } 7349 } 7350 7351 // Start the next in the queue if the last step wasn't forced. 7352 // Timers currently will call their complete callbacks, which 7353 // will dequeue but only if they were gotoEnd. 7354 if ( dequeue || !gotoEnd ) { 7355 jQuery.dequeue( this, type ); 7356 } 7357 } ); 7358 }, 7359 finish: function( type ) { 7360 if ( type !== false ) { 7361 type = type || "fx"; 7362 } 7363 return this.each( function() { 7364 var index, 7365 data = dataPriv.get( this ), 7366 queue = data[ type + "queue" ], 7367 hooks = data[ type + "queueHooks" ], 7368 timers = jQuery.timers, 7369 length = queue ? queue.length : 0; 7370 7371 // Enable finishing flag on private data 7372 data.finish = true; 7373 7374 // Empty the queue first 7375 jQuery.queue( this, type, [] ); 7376 7377 if ( hooks && hooks.stop ) { 7378 hooks.stop.call( this, true ); 7379 } 7380 7381 // Look for any active animations, and finish them 7382 for ( index = timers.length; index--; ) { 7383 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 7384 timers[ index ].anim.stop( true ); 7385 timers.splice( index, 1 ); 7386 } 7387 } 7388 7389 // Look for any animations in the old queue and finish them 7390 for ( index = 0; index < length; index++ ) { 7391 if ( queue[ index ] && queue[ index ].finish ) { 7392 queue[ index ].finish.call( this ); 7393 } 7394 } 7395 7396 // Turn off finishing flag 7397 delete data.finish; 7398 } ); 7399 } 7400} ); 7401 7402jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { 7403 var cssFn = jQuery.fn[ name ]; 7404 jQuery.fn[ name ] = function( speed, easing, callback ) { 7405 return speed == null || typeof speed === "boolean" ? 7406 cssFn.apply( this, arguments ) : 7407 this.animate( genFx( name, true ), speed, easing, callback ); 7408 }; 7409} ); 7410 7411// Generate shortcuts for custom animations 7412jQuery.each( { 7413 slideDown: genFx( "show" ), 7414 slideUp: genFx( "hide" ), 7415 slideToggle: genFx( "toggle" ), 7416 fadeIn: { opacity: "show" }, 7417 fadeOut: { opacity: "hide" }, 7418 fadeToggle: { opacity: "toggle" } 7419}, function( name, props ) { 7420 jQuery.fn[ name ] = function( speed, easing, callback ) { 7421 return this.animate( props, speed, easing, callback ); 7422 }; 7423} ); 7424 7425jQuery.timers = []; 7426jQuery.fx.tick = function() { 7427 var timer, 7428 i = 0, 7429 timers = jQuery.timers; 7430 7431 fxNow = Date.now(); 7432 7433 for ( ; i < timers.length; i++ ) { 7434 timer = timers[ i ]; 7435 7436 // Run the timer and safely remove it when done (allowing for external removal) 7437 if ( !timer() && timers[ i ] === timer ) { 7438 timers.splice( i--, 1 ); 7439 } 7440 } 7441 7442 if ( !timers.length ) { 7443 jQuery.fx.stop(); 7444 } 7445 fxNow = undefined; 7446}; 7447 7448jQuery.fx.timer = function( timer ) { 7449 jQuery.timers.push( timer ); 7450 jQuery.fx.start(); 7451}; 7452 7453jQuery.fx.interval = 13; 7454jQuery.fx.start = function() { 7455 if ( inProgress ) { 7456 return; 7457 } 7458 7459 inProgress = true; 7460 schedule(); 7461}; 7462 7463jQuery.fx.stop = function() { 7464 inProgress = null; 7465}; 7466 7467jQuery.fx.speeds = { 7468 slow: 600, 7469 fast: 200, 7470 7471 // Default speed 7472 _default: 400 7473}; 7474 7475 7476// Based off of the plugin by Clint Helfers, with permission. 7477// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ 7478jQuery.fn.delay = function( time, type ) { 7479 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 7480 type = type || "fx"; 7481 7482 return this.queue( type, function( next, hooks ) { 7483 var timeout = window.setTimeout( next, time ); 7484 hooks.stop = function() { 7485 window.clearTimeout( timeout ); 7486 }; 7487 } ); 7488}; 7489 7490 7491( function() { 7492 var input = document.createElement( "input" ), 7493 select = document.createElement( "select" ), 7494 opt = select.appendChild( document.createElement( "option" ) ); 7495 7496 input.type = "checkbox"; 7497 7498 // Support: Android <=4.3 only 7499 // Default value for a checkbox should be "on" 7500 support.checkOn = input.value !== ""; 7501 7502 // Support: IE <=11 only 7503 // Must access selectedIndex to make default options select 7504 support.optSelected = opt.selected; 7505 7506 // Support: IE <=11 only 7507 // An input loses its value after becoming a radio 7508 input = document.createElement( "input" ); 7509 input.value = "t"; 7510 input.type = "radio"; 7511 support.radioValue = input.value === "t"; 7512} )(); 7513 7514 7515var boolHook, 7516 attrHandle = jQuery.expr.attrHandle; 7517 7518jQuery.fn.extend( { 7519 attr: function( name, value ) { 7520 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 7521 }, 7522 7523 removeAttr: function( name ) { 7524 return this.each( function() { 7525 jQuery.removeAttr( this, name ); 7526 } ); 7527 } 7528} ); 7529 7530jQuery.extend( { 7531 attr: function( elem, name, value ) { 7532 var ret, hooks, 7533 nType = elem.nodeType; 7534 7535 // Don't get/set attributes on text, comment and attribute nodes 7536 if ( nType === 3 || nType === 8 || nType === 2 ) { 7537 return; 7538 } 7539 7540 // Fallback to prop when attributes are not supported 7541 if ( typeof elem.getAttribute === "undefined" ) { 7542 return jQuery.prop( elem, name, value ); 7543 } 7544 7545 // Attribute hooks are determined by the lowercase version 7546 // Grab necessary hook if one is defined 7547 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 7548 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 7549 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 7550 } 7551 7552 if ( value !== undefined ) { 7553 if ( value === null ) { 7554 jQuery.removeAttr( elem, name ); 7555 return; 7556 } 7557 7558 if ( hooks && "set" in hooks && 7559 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 7560 return ret; 7561 } 7562 7563 elem.setAttribute( name, value + "" ); 7564 return value; 7565 } 7566 7567 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 7568 return ret; 7569 } 7570 7571 ret = jQuery.find.attr( elem, name ); 7572 7573 // Non-existent attributes return null, we normalize to undefined 7574 return ret == null ? undefined : ret; 7575 }, 7576 7577 attrHooks: { 7578 type: { 7579 set: function( elem, value ) { 7580 if ( !support.radioValue && value === "radio" && 7581 nodeName( elem, "input" ) ) { 7582 var val = elem.value; 7583 elem.setAttribute( "type", value ); 7584 if ( val ) { 7585 elem.value = val; 7586 } 7587 return value; 7588 } 7589 } 7590 } 7591 }, 7592 7593 removeAttr: function( elem, value ) { 7594 var name, 7595 i = 0, 7596 7597 // Attribute names can contain non-HTML whitespace characters 7598 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 7599 attrNames = value && value.match( rnothtmlwhite ); 7600 7601 if ( attrNames && elem.nodeType === 1 ) { 7602 while ( ( name = attrNames[ i++ ] ) ) { 7603 elem.removeAttribute( name ); 7604 } 7605 } 7606 } 7607} ); 7608 7609// Hooks for boolean attributes 7610boolHook = { 7611 set: function( elem, value, name ) { 7612 if ( value === false ) { 7613 7614 // Remove boolean attributes when set to false 7615 jQuery.removeAttr( elem, name ); 7616 } else { 7617 elem.setAttribute( name, name ); 7618 } 7619 return name; 7620 } 7621}; 7622 7623jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { 7624 var getter = attrHandle[ name ] || jQuery.find.attr; 7625 7626 attrHandle[ name ] = function( elem, name, isXML ) { 7627 var ret, handle, 7628 lowercaseName = name.toLowerCase(); 7629 7630 if ( !isXML ) { 7631 7632 // Avoid an infinite loop by temporarily removing this function from the getter 7633 handle = attrHandle[ lowercaseName ]; 7634 attrHandle[ lowercaseName ] = ret; 7635 ret = getter( elem, name, isXML ) != null ? 7636 lowercaseName : 7637 null; 7638 attrHandle[ lowercaseName ] = handle; 7639 } 7640 return ret; 7641 }; 7642} ); 7643 7644 7645 7646 7647var rfocusable = /^(?:input|select|textarea|button)$/i, 7648 rclickable = /^(?:a|area)$/i; 7649 7650jQuery.fn.extend( { 7651 prop: function( name, value ) { 7652 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 7653 }, 7654 7655 removeProp: function( name ) { 7656 return this.each( function() { 7657 delete this[ jQuery.propFix[ name ] || name ]; 7658 } ); 7659 } 7660} ); 7661 7662jQuery.extend( { 7663 prop: function( elem, name, value ) { 7664 var ret, hooks, 7665 nType = elem.nodeType; 7666 7667 // Don't get/set properties on text, comment and attribute nodes 7668 if ( nType === 3 || nType === 8 || nType === 2 ) { 7669 return; 7670 } 7671 7672 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 7673 7674 // Fix name and attach hooks 7675 name = jQuery.propFix[ name ] || name; 7676 hooks = jQuery.propHooks[ name ]; 7677 } 7678 7679 if ( value !== undefined ) { 7680 if ( hooks && "set" in hooks && 7681 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 7682 return ret; 7683 } 7684 7685 return ( elem[ name ] = value ); 7686 } 7687 7688 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 7689 return ret; 7690 } 7691 7692 return elem[ name ]; 7693 }, 7694 7695 propHooks: { 7696 tabIndex: { 7697 get: function( elem ) { 7698 7699 // Support: IE <=9 - 11 only 7700 // elem.tabIndex doesn't always return the 7701 // correct value when it hasn't been explicitly set 7702 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 7703 // Use proper attribute retrieval(#12072) 7704 var tabindex = jQuery.find.attr( elem, "tabindex" ); 7705 7706 if ( tabindex ) { 7707 return parseInt( tabindex, 10 ); 7708 } 7709 7710 if ( 7711 rfocusable.test( elem.nodeName ) || 7712 rclickable.test( elem.nodeName ) && 7713 elem.href 7714 ) { 7715 return 0; 7716 } 7717 7718 return -1; 7719 } 7720 } 7721 }, 7722 7723 propFix: { 7724 "for": "htmlFor", 7725 "class": "className" 7726 } 7727} ); 7728 7729// Support: IE <=11 only 7730// Accessing the selectedIndex property 7731// forces the browser to respect setting selected 7732// on the option 7733// The getter ensures a default option is selected 7734// when in an optgroup 7735// eslint rule "no-unused-expressions" is disabled for this code 7736// since it considers such accessions noop 7737if ( !support.optSelected ) { 7738 jQuery.propHooks.selected = { 7739 get: function( elem ) { 7740 7741 /* eslint no-unused-expressions: "off" */ 7742 7743 var parent = elem.parentNode; 7744 if ( parent && parent.parentNode ) { 7745 parent.parentNode.selectedIndex; 7746 } 7747 return null; 7748 }, 7749 set: function( elem ) { 7750 7751 /* eslint no-unused-expressions: "off" */ 7752 7753 var parent = elem.parentNode; 7754 if ( parent ) { 7755 parent.selectedIndex; 7756 7757 if ( parent.parentNode ) { 7758 parent.parentNode.selectedIndex; 7759 } 7760 } 7761 } 7762 }; 7763} 7764 7765jQuery.each( [ 7766 "tabIndex", 7767 "readOnly", 7768 "maxLength", 7769 "cellSpacing", 7770 "cellPadding", 7771 "rowSpan", 7772 "colSpan", 7773 "useMap", 7774 "frameBorder", 7775 "contentEditable" 7776], function() { 7777 jQuery.propFix[ this.toLowerCase() ] = this; 7778} ); 7779 7780 7781 7782 7783 // Strip and collapse whitespace according to HTML spec 7784 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 7785 function stripAndCollapse( value ) { 7786 var tokens = value.match( rnothtmlwhite ) || []; 7787 return tokens.join( " " ); 7788 } 7789 7790 7791function getClass( elem ) { 7792 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 7793} 7794 7795function classesToArray( value ) { 7796 if ( Array.isArray( value ) ) { 7797 return value; 7798 } 7799 if ( typeof value === "string" ) { 7800 return value.match( rnothtmlwhite ) || []; 7801 } 7802 return []; 7803} 7804 7805jQuery.fn.extend( { 7806 addClass: function( value ) { 7807 var classes, elem, cur, curValue, clazz, j, finalValue, 7808 i = 0; 7809 7810 if ( isFunction( value ) ) { 7811 return this.each( function( j ) { 7812 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 7813 } ); 7814 } 7815 7816 classes = classesToArray( value ); 7817 7818 if ( classes.length ) { 7819 while ( ( elem = this[ i++ ] ) ) { 7820 curValue = getClass( elem ); 7821 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 7822 7823 if ( cur ) { 7824 j = 0; 7825 while ( ( clazz = classes[ j++ ] ) ) { 7826 if ( cur.indexOf( " " + clazz + " " ) < 0 ) { 7827 cur += clazz + " "; 7828 } 7829 } 7830 7831 // Only assign if different to avoid unneeded rendering. 7832 finalValue = stripAndCollapse( cur ); 7833 if ( curValue !== finalValue ) { 7834 elem.setAttribute( "class", finalValue ); 7835 } 7836 } 7837 } 7838 } 7839 7840 return this; 7841 }, 7842 7843 removeClass: function( value ) { 7844 var classes, elem, cur, curValue, clazz, j, finalValue, 7845 i = 0; 7846 7847 if ( isFunction( value ) ) { 7848 return this.each( function( j ) { 7849 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 7850 } ); 7851 } 7852 7853 if ( !arguments.length ) { 7854 return this.attr( "class", "" ); 7855 } 7856 7857 classes = classesToArray( value ); 7858 7859 if ( classes.length ) { 7860 while ( ( elem = this[ i++ ] ) ) { 7861 curValue = getClass( elem ); 7862 7863 // This expression is here for better compressibility (see addClass) 7864 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 7865 7866 if ( cur ) { 7867 j = 0; 7868 while ( ( clazz = classes[ j++ ] ) ) { 7869 7870 // Remove *all* instances 7871 while ( cur.indexOf( " " + clazz + " " ) > -1 ) { 7872 cur = cur.replace( " " + clazz + " ", " " ); 7873 } 7874 } 7875 7876 // Only assign if different to avoid unneeded rendering. 7877 finalValue = stripAndCollapse( cur ); 7878 if ( curValue !== finalValue ) { 7879 elem.setAttribute( "class", finalValue ); 7880 } 7881 } 7882 } 7883 } 7884 7885 return this; 7886 }, 7887 7888 toggleClass: function( value, stateVal ) { 7889 var type = typeof value, 7890 isValidValue = type === "string" || Array.isArray( value ); 7891 7892 if ( typeof stateVal === "boolean" && isValidValue ) { 7893 return stateVal ? this.addClass( value ) : this.removeClass( value ); 7894 } 7895 7896 if ( isFunction( value ) ) { 7897 return this.each( function( i ) { 7898 jQuery( this ).toggleClass( 7899 value.call( this, i, getClass( this ), stateVal ), 7900 stateVal 7901 ); 7902 } ); 7903 } 7904 7905 return this.each( function() { 7906 var className, i, self, classNames; 7907 7908 if ( isValidValue ) { 7909 7910 // Toggle individual class names 7911 i = 0; 7912 self = jQuery( this ); 7913 classNames = classesToArray( value ); 7914 7915 while ( ( className = classNames[ i++ ] ) ) { 7916 7917 // Check each className given, space separated list 7918 if ( self.hasClass( className ) ) { 7919 self.removeClass( className ); 7920 } else { 7921 self.addClass( className ); 7922 } 7923 } 7924 7925 // Toggle whole class name 7926 } else if ( value === undefined || type === "boolean" ) { 7927 className = getClass( this ); 7928 if ( className ) { 7929 7930 // Store className if set 7931 dataPriv.set( this, "__className__", className ); 7932 } 7933 7934 // If the element has a class name or if we're passed `false`, 7935 // then remove the whole classname (if there was one, the above saved it). 7936 // Otherwise bring back whatever was previously saved (if anything), 7937 // falling back to the empty string if nothing was stored. 7938 if ( this.setAttribute ) { 7939 this.setAttribute( "class", 7940 className || value === false ? 7941 "" : 7942 dataPriv.get( this, "__className__" ) || "" 7943 ); 7944 } 7945 } 7946 } ); 7947 }, 7948 7949 hasClass: function( selector ) { 7950 var className, elem, 7951 i = 0; 7952 7953 className = " " + selector + " "; 7954 while ( ( elem = this[ i++ ] ) ) { 7955 if ( elem.nodeType === 1 && 7956 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 7957 return true; 7958 } 7959 } 7960 7961 return false; 7962 } 7963} ); 7964 7965 7966 7967 7968var rreturn = /\r/g; 7969 7970jQuery.fn.extend( { 7971 val: function( value ) { 7972 var hooks, ret, valueIsFunction, 7973 elem = this[ 0 ]; 7974 7975 if ( !arguments.length ) { 7976 if ( elem ) { 7977 hooks = jQuery.valHooks[ elem.type ] || 7978 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 7979 7980 if ( hooks && 7981 "get" in hooks && 7982 ( ret = hooks.get( elem, "value" ) ) !== undefined 7983 ) { 7984 return ret; 7985 } 7986 7987 ret = elem.value; 7988 7989 // Handle most common string cases 7990 if ( typeof ret === "string" ) { 7991 return ret.replace( rreturn, "" ); 7992 } 7993 7994 // Handle cases where value is null/undef or number 7995 return ret == null ? "" : ret; 7996 } 7997 7998 return; 7999 } 8000 8001 valueIsFunction = isFunction( value ); 8002 8003 return this.each( function( i ) { 8004 var val; 8005 8006 if ( this.nodeType !== 1 ) { 8007 return; 8008 } 8009 8010 if ( valueIsFunction ) { 8011 val = value.call( this, i, jQuery( this ).val() ); 8012 } else { 8013 val = value; 8014 } 8015 8016 // Treat null/undefined as ""; convert numbers to string 8017 if ( val == null ) { 8018 val = ""; 8019 8020 } else if ( typeof val === "number" ) { 8021 val += ""; 8022 8023 } else if ( Array.isArray( val ) ) { 8024 val = jQuery.map( val, function( value ) { 8025 return value == null ? "" : value + ""; 8026 } ); 8027 } 8028 8029 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 8030 8031 // If set returns undefined, fall back to normal setting 8032 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 8033 this.value = val; 8034 } 8035 } ); 8036 } 8037} ); 8038 8039jQuery.extend( { 8040 valHooks: { 8041 option: { 8042 get: function( elem ) { 8043 8044 var val = jQuery.find.attr( elem, "value" ); 8045 return val != null ? 8046 val : 8047 8048 // Support: IE <=10 - 11 only 8049 // option.text throws exceptions (#14686, #14858) 8050 // Strip and collapse whitespace 8051 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 8052 stripAndCollapse( jQuery.text( elem ) ); 8053 } 8054 }, 8055 select: { 8056 get: function( elem ) { 8057 var value, option, i, 8058 options = elem.options, 8059 index = elem.selectedIndex, 8060 one = elem.type === "select-one", 8061 values = one ? null : [], 8062 max = one ? index + 1 : options.length; 8063 8064 if ( index < 0 ) { 8065 i = max; 8066 8067 } else { 8068 i = one ? index : 0; 8069 } 8070 8071 // Loop through all the selected options 8072 for ( ; i < max; i++ ) { 8073 option = options[ i ]; 8074 8075 // Support: IE <=9 only 8076 // IE8-9 doesn't update selected after form reset (#2551) 8077 if ( ( option.selected || i === index ) && 8078 8079 // Don't return options that are disabled or in a disabled optgroup 8080 !option.disabled && 8081 ( !option.parentNode.disabled || 8082 !nodeName( option.parentNode, "optgroup" ) ) ) { 8083 8084 // Get the specific value for the option 8085 value = jQuery( option ).val(); 8086 8087 // We don't need an array for one selects 8088 if ( one ) { 8089 return value; 8090 } 8091 8092 // Multi-Selects return an array 8093 values.push( value ); 8094 } 8095 } 8096 8097 return values; 8098 }, 8099 8100 set: function( elem, value ) { 8101 var optionSet, option, 8102 options = elem.options, 8103 values = jQuery.makeArray( value ), 8104 i = options.length; 8105 8106 while ( i-- ) { 8107 option = options[ i ]; 8108 8109 /* eslint-disable no-cond-assign */ 8110 8111 if ( option.selected = 8112 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 8113 ) { 8114 optionSet = true; 8115 } 8116 8117 /* eslint-enable no-cond-assign */ 8118 } 8119 8120 // Force browsers to behave consistently when non-matching value is set 8121 if ( !optionSet ) { 8122 elem.selectedIndex = -1; 8123 } 8124 return values; 8125 } 8126 } 8127 } 8128} ); 8129 8130// Radios and checkboxes getter/setter 8131jQuery.each( [ "radio", "checkbox" ], function() { 8132 jQuery.valHooks[ this ] = { 8133 set: function( elem, value ) { 8134 if ( Array.isArray( value ) ) { 8135 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 8136 } 8137 } 8138 }; 8139 if ( !support.checkOn ) { 8140 jQuery.valHooks[ this ].get = function( elem ) { 8141 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 8142 }; 8143 } 8144} ); 8145 8146 8147 8148 8149// Return jQuery for attributes-only inclusion 8150 8151 8152support.focusin = "onfocusin" in window; 8153 8154 8155var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 8156 stopPropagationCallback = function( e ) { 8157 e.stopPropagation(); 8158 }; 8159 8160jQuery.extend( jQuery.event, { 8161 8162 trigger: function( event, data, elem, onlyHandlers ) { 8163 8164 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 8165 eventPath = [ elem || document ], 8166 type = hasOwn.call( event, "type" ) ? event.type : event, 8167 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 8168 8169 cur = lastElement = tmp = elem = elem || document; 8170 8171 // Don't do events on text and comment nodes 8172 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 8173 return; 8174 } 8175 8176 // focus/blur morphs to focusin/out; ensure we're not firing them right now 8177 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 8178 return; 8179 } 8180 8181 if ( type.indexOf( "." ) > -1 ) { 8182 8183 // Namespaced trigger; create a regexp to match event type in handle() 8184 namespaces = type.split( "." ); 8185 type = namespaces.shift(); 8186 namespaces.sort(); 8187 } 8188 ontype = type.indexOf( ":" ) < 0 && "on" + type; 8189 8190 // Caller can pass in a jQuery.Event object, Object, or just an event type string 8191 event = event[ jQuery.expando ] ? 8192 event : 8193 new jQuery.Event( type, typeof event === "object" && event ); 8194 8195 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 8196 event.isTrigger = onlyHandlers ? 2 : 3; 8197 event.namespace = namespaces.join( "." ); 8198 event.rnamespace = event.namespace ? 8199 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 8200 null; 8201 8202 // Clean up the event in case it is being reused 8203 event.result = undefined; 8204 if ( !event.target ) { 8205 event.target = elem; 8206 } 8207 8208 // Clone any incoming data and prepend the event, creating the handler arg list 8209 data = data == null ? 8210 [ event ] : 8211 jQuery.makeArray( data, [ event ] ); 8212 8213 // Allow special events to draw outside the lines 8214 special = jQuery.event.special[ type ] || {}; 8215 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 8216 return; 8217 } 8218 8219 // Determine event propagation path in advance, per W3C events spec (#9951) 8220 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 8221 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 8222 8223 bubbleType = special.delegateType || type; 8224 if ( !rfocusMorph.test( bubbleType + type ) ) { 8225 cur = cur.parentNode; 8226 } 8227 for ( ; cur; cur = cur.parentNode ) { 8228 eventPath.push( cur ); 8229 tmp = cur; 8230 } 8231 8232 // Only add window if we got to document (e.g., not plain obj or detached DOM) 8233 if ( tmp === ( elem.ownerDocument || document ) ) { 8234 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 8235 } 8236 } 8237 8238 // Fire handlers on the event path 8239 i = 0; 8240 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 8241 lastElement = cur; 8242 event.type = i > 1 ? 8243 bubbleType : 8244 special.bindType || type; 8245 8246 // jQuery handler 8247 handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && 8248 dataPriv.get( cur, "handle" ); 8249 if ( handle ) { 8250 handle.apply( cur, data ); 8251 } 8252 8253 // Native handler 8254 handle = ontype && cur[ ontype ]; 8255 if ( handle && handle.apply && acceptData( cur ) ) { 8256 event.result = handle.apply( cur, data ); 8257 if ( event.result === false ) { 8258 event.preventDefault(); 8259 } 8260 } 8261 } 8262 event.type = type; 8263 8264 // If nobody prevented the default action, do it now 8265 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 8266 8267 if ( ( !special._default || 8268 special._default.apply( eventPath.pop(), data ) === false ) && 8269 acceptData( elem ) ) { 8270 8271 // Call a native DOM method on the target with the same name as the event. 8272 // Don't do default actions on window, that's where global variables be (#6170) 8273 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 8274 8275 // Don't re-trigger an onFOO event when we call its FOO() method 8276 tmp = elem[ ontype ]; 8277 8278 if ( tmp ) { 8279 elem[ ontype ] = null; 8280 } 8281 8282 // Prevent re-triggering of the same event, since we already bubbled it above 8283 jQuery.event.triggered = type; 8284 8285 if ( event.isPropagationStopped() ) { 8286 lastElement.addEventListener( type, stopPropagationCallback ); 8287 } 8288 8289 elem[ type ](); 8290 8291 if ( event.isPropagationStopped() ) { 8292 lastElement.removeEventListener( type, stopPropagationCallback ); 8293 } 8294 8295 jQuery.event.triggered = undefined; 8296 8297 if ( tmp ) { 8298 elem[ ontype ] = tmp; 8299 } 8300 } 8301 } 8302 } 8303 8304 return event.result; 8305 }, 8306 8307 // Piggyback on a donor event to simulate a different one 8308 // Used only for `focus(in | out)` events 8309 simulate: function( type, elem, event ) { 8310 var e = jQuery.extend( 8311 new jQuery.Event(), 8312 event, 8313 { 8314 type: type, 8315 isSimulated: true 8316 } 8317 ); 8318 8319 jQuery.event.trigger( e, null, elem ); 8320 } 8321 8322} ); 8323 8324jQuery.fn.extend( { 8325 8326 trigger: function( type, data ) { 8327 return this.each( function() { 8328 jQuery.event.trigger( type, data, this ); 8329 } ); 8330 }, 8331 triggerHandler: function( type, data ) { 8332 var elem = this[ 0 ]; 8333 if ( elem ) { 8334 return jQuery.event.trigger( type, data, elem, true ); 8335 } 8336 } 8337} ); 8338 8339 8340// Support: Firefox <=44 8341// Firefox doesn't have focus(in | out) events 8342// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 8343// 8344// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 8345// focus(in | out) events fire after focus & blur events, 8346// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 8347// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 8348if ( !support.focusin ) { 8349 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { 8350 8351 // Attach a single capturing handler on the document while someone wants focusin/focusout 8352 var handler = function( event ) { 8353 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); 8354 }; 8355 8356 jQuery.event.special[ fix ] = { 8357 setup: function() { 8358 var doc = this.ownerDocument || this, 8359 attaches = dataPriv.access( doc, fix ); 8360 8361 if ( !attaches ) { 8362 doc.addEventListener( orig, handler, true ); 8363 } 8364 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); 8365 }, 8366 teardown: function() { 8367 var doc = this.ownerDocument || this, 8368 attaches = dataPriv.access( doc, fix ) - 1; 8369 8370 if ( !attaches ) { 8371 doc.removeEventListener( orig, handler, true ); 8372 dataPriv.remove( doc, fix ); 8373 8374 } else { 8375 dataPriv.access( doc, fix, attaches ); 8376 } 8377 } 8378 }; 8379 } ); 8380} 8381var location = window.location; 8382 8383var nonce = Date.now(); 8384 8385var rquery = ( /\?/ ); 8386 8387 8388 8389// Cross-browser xml parsing 8390jQuery.parseXML = function( data ) { 8391 var xml; 8392 if ( !data || typeof data !== "string" ) { 8393 return null; 8394 } 8395 8396 // Support: IE 9 - 11 only 8397 // IE throws on parseFromString with invalid input. 8398 try { 8399 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 8400 } catch ( e ) { 8401 xml = undefined; 8402 } 8403 8404 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { 8405 jQuery.error( "Invalid XML: " + data ); 8406 } 8407 return xml; 8408}; 8409 8410 8411var 8412 rbracket = /\[\]$/, 8413 rCRLF = /\r?\n/g, 8414 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 8415 rsubmittable = /^(?:input|select|textarea|keygen)/i; 8416 8417function buildParams( prefix, obj, traditional, add ) { 8418 var name; 8419 8420 if ( Array.isArray( obj ) ) { 8421 8422 // Serialize array item. 8423 jQuery.each( obj, function( i, v ) { 8424 if ( traditional || rbracket.test( prefix ) ) { 8425 8426 // Treat each array item as a scalar. 8427 add( prefix, v ); 8428 8429 } else { 8430 8431 // Item is non-scalar (array or object), encode its numeric index. 8432 buildParams( 8433 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 8434 v, 8435 traditional, 8436 add 8437 ); 8438 } 8439 } ); 8440 8441 } else if ( !traditional && toType( obj ) === "object" ) { 8442 8443 // Serialize object item. 8444 for ( name in obj ) { 8445 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 8446 } 8447 8448 } else { 8449 8450 // Serialize scalar item. 8451 add( prefix, obj ); 8452 } 8453} 8454 8455// Serialize an array of form elements or a set of 8456// key/values into a query string 8457jQuery.param = function( a, traditional ) { 8458 var prefix, 8459 s = [], 8460 add = function( key, valueOrFunction ) { 8461 8462 // If value is a function, invoke it and use its return value 8463 var value = isFunction( valueOrFunction ) ? 8464 valueOrFunction() : 8465 valueOrFunction; 8466 8467 s[ s.length ] = encodeURIComponent( key ) + "=" + 8468 encodeURIComponent( value == null ? "" : value ); 8469 }; 8470 8471 // If an array was passed in, assume that it is an array of form elements. 8472 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 8473 8474 // Serialize the form elements 8475 jQuery.each( a, function() { 8476 add( this.name, this.value ); 8477 } ); 8478 8479 } else { 8480 8481 // If traditional, encode the "old" way (the way 1.3.2 or older 8482 // did it), otherwise encode params recursively. 8483 for ( prefix in a ) { 8484 buildParams( prefix, a[ prefix ], traditional, add ); 8485 } 8486 } 8487 8488 // Return the resulting serialization 8489 return s.join( "&" ); 8490}; 8491 8492jQuery.fn.extend( { 8493 serialize: function() { 8494 return jQuery.param( this.serializeArray() ); 8495 }, 8496 serializeArray: function() { 8497 return this.map( function() { 8498 8499 // Can add propHook for "elements" to filter or add form elements 8500 var elements = jQuery.prop( this, "elements" ); 8501 return elements ? jQuery.makeArray( elements ) : this; 8502 } ) 8503 .filter( function() { 8504 var type = this.type; 8505 8506 // Use .is( ":disabled" ) so that fieldset[disabled] works 8507 return this.name && !jQuery( this ).is( ":disabled" ) && 8508 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 8509 ( this.checked || !rcheckableType.test( type ) ); 8510 } ) 8511 .map( function( i, elem ) { 8512 var val = jQuery( this ).val(); 8513 8514 if ( val == null ) { 8515 return null; 8516 } 8517 8518 if ( Array.isArray( val ) ) { 8519 return jQuery.map( val, function( val ) { 8520 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 8521 } ); 8522 } 8523 8524 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 8525 } ).get(); 8526 } 8527} ); 8528 8529 8530var 8531 r20 = /%20/g, 8532 rhash = /#.*$/, 8533 rantiCache = /([?&])_=[^&]*/, 8534 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 8535 8536 // #7653, #8125, #8152: local protocol detection 8537 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 8538 rnoContent = /^(?:GET|HEAD)$/, 8539 rprotocol = /^\/\//, 8540 8541 /* Prefilters 8542 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 8543 * 2) These are called: 8544 * - BEFORE asking for a transport 8545 * - AFTER param serialization (s.data is a string if s.processData is true) 8546 * 3) key is the dataType 8547 * 4) the catchall symbol "*" can be used 8548 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 8549 */ 8550 prefilters = {}, 8551 8552 /* Transports bindings 8553 * 1) key is the dataType 8554 * 2) the catchall symbol "*" can be used 8555 * 3) selection will start with transport dataType and THEN go to "*" if needed 8556 */ 8557 transports = {}, 8558 8559 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 8560 allTypes = "*/".concat( "*" ), 8561 8562 // Anchor tag for parsing the document origin 8563 originAnchor = document.createElement( "a" ); 8564 originAnchor.href = location.href; 8565 8566// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 8567function addToPrefiltersOrTransports( structure ) { 8568 8569 // dataTypeExpression is optional and defaults to "*" 8570 return function( dataTypeExpression, func ) { 8571 8572 if ( typeof dataTypeExpression !== "string" ) { 8573 func = dataTypeExpression; 8574 dataTypeExpression = "*"; 8575 } 8576 8577 var dataType, 8578 i = 0, 8579 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 8580 8581 if ( isFunction( func ) ) { 8582 8583 // For each dataType in the dataTypeExpression 8584 while ( ( dataType = dataTypes[ i++ ] ) ) { 8585 8586 // Prepend if requested 8587 if ( dataType[ 0 ] === "+" ) { 8588 dataType = dataType.slice( 1 ) || "*"; 8589 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 8590 8591 // Otherwise append 8592 } else { 8593 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 8594 } 8595 } 8596 } 8597 }; 8598} 8599 8600// Base inspection function for prefilters and transports 8601function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 8602 8603 var inspected = {}, 8604 seekingTransport = ( structure === transports ); 8605 8606 function inspect( dataType ) { 8607 var selected; 8608 inspected[ dataType ] = true; 8609 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 8610 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 8611 if ( typeof dataTypeOrTransport === "string" && 8612 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 8613 8614 options.dataTypes.unshift( dataTypeOrTransport ); 8615 inspect( dataTypeOrTransport ); 8616 return false; 8617 } else if ( seekingTransport ) { 8618 return !( selected = dataTypeOrTransport ); 8619 } 8620 } ); 8621 return selected; 8622 } 8623 8624 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 8625} 8626 8627// A special extend for ajax options 8628// that takes "flat" options (not to be deep extended) 8629// Fixes #9887 8630function ajaxExtend( target, src ) { 8631 var key, deep, 8632 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 8633 8634 for ( key in src ) { 8635 if ( src[ key ] !== undefined ) { 8636 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 8637 } 8638 } 8639 if ( deep ) { 8640 jQuery.extend( true, target, deep ); 8641 } 8642 8643 return target; 8644} 8645 8646/* Handles responses to an ajax request: 8647 * - finds the right dataType (mediates between content-type and expected dataType) 8648 * - returns the corresponding response 8649 */ 8650function ajaxHandleResponses( s, jqXHR, responses ) { 8651 8652 var ct, type, finalDataType, firstDataType, 8653 contents = s.contents, 8654 dataTypes = s.dataTypes; 8655 8656 // Remove auto dataType and get content-type in the process 8657 while ( dataTypes[ 0 ] === "*" ) { 8658 dataTypes.shift(); 8659 if ( ct === undefined ) { 8660 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 8661 } 8662 } 8663 8664 // Check if we're dealing with a known content-type 8665 if ( ct ) { 8666 for ( type in contents ) { 8667 if ( contents[ type ] && contents[ type ].test( ct ) ) { 8668 dataTypes.unshift( type ); 8669 break; 8670 } 8671 } 8672 } 8673 8674 // Check to see if we have a response for the expected dataType 8675 if ( dataTypes[ 0 ] in responses ) { 8676 finalDataType = dataTypes[ 0 ]; 8677 } else { 8678 8679 // Try convertible dataTypes 8680 for ( type in responses ) { 8681 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 8682 finalDataType = type; 8683 break; 8684 } 8685 if ( !firstDataType ) { 8686 firstDataType = type; 8687 } 8688 } 8689 8690 // Or just use first one 8691 finalDataType = finalDataType || firstDataType; 8692 } 8693 8694 // If we found a dataType 8695 // We add the dataType to the list if needed 8696 // and return the corresponding response 8697 if ( finalDataType ) { 8698 if ( finalDataType !== dataTypes[ 0 ] ) { 8699 dataTypes.unshift( finalDataType ); 8700 } 8701 return responses[ finalDataType ]; 8702 } 8703} 8704 8705/* Chain conversions given the request and the original response 8706 * Also sets the responseXXX fields on the jqXHR instance 8707 */ 8708function ajaxConvert( s, response, jqXHR, isSuccess ) { 8709 var conv2, current, conv, tmp, prev, 8710 converters = {}, 8711 8712 // Work with a copy of dataTypes in case we need to modify it for conversion 8713 dataTypes = s.dataTypes.slice(); 8714 8715 // Create converters map with lowercased keys 8716 if ( dataTypes[ 1 ] ) { 8717 for ( conv in s.converters ) { 8718 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 8719 } 8720 } 8721 8722 current = dataTypes.shift(); 8723 8724 // Convert to each sequential dataType 8725 while ( current ) { 8726 8727 if ( s.responseFields[ current ] ) { 8728 jqXHR[ s.responseFields[ current ] ] = response; 8729 } 8730 8731 // Apply the dataFilter if provided 8732 if ( !prev && isSuccess && s.dataFilter ) { 8733 response = s.dataFilter( response, s.dataType ); 8734 } 8735 8736 prev = current; 8737 current = dataTypes.shift(); 8738 8739 if ( current ) { 8740 8741 // There's only work to do if current dataType is non-auto 8742 if ( current === "*" ) { 8743 8744 current = prev; 8745 8746 // Convert response if prev dataType is non-auto and differs from current 8747 } else if ( prev !== "*" && prev !== current ) { 8748 8749 // Seek a direct converter 8750 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 8751 8752 // If none found, seek a pair 8753 if ( !conv ) { 8754 for ( conv2 in converters ) { 8755 8756 // If conv2 outputs current 8757 tmp = conv2.split( " " ); 8758 if ( tmp[ 1 ] === current ) { 8759 8760 // If prev can be converted to accepted input 8761 conv = converters[ prev + " " + tmp[ 0 ] ] || 8762 converters[ "* " + tmp[ 0 ] ]; 8763 if ( conv ) { 8764 8765 // Condense equivalence converters 8766 if ( conv === true ) { 8767 conv = converters[ conv2 ]; 8768 8769 // Otherwise, insert the intermediate dataType 8770 } else if ( converters[ conv2 ] !== true ) { 8771 current = tmp[ 0 ]; 8772 dataTypes.unshift( tmp[ 1 ] ); 8773 } 8774 break; 8775 } 8776 } 8777 } 8778 } 8779 8780 // Apply converter (if not an equivalence) 8781 if ( conv !== true ) { 8782 8783 // Unless errors are allowed to bubble, catch and return them 8784 if ( conv && s.throws ) { 8785 response = conv( response ); 8786 } else { 8787 try { 8788 response = conv( response ); 8789 } catch ( e ) { 8790 return { 8791 state: "parsererror", 8792 error: conv ? e : "No conversion from " + prev + " to " + current 8793 }; 8794 } 8795 } 8796 } 8797 } 8798 } 8799 } 8800 8801 return { state: "success", data: response }; 8802} 8803 8804jQuery.extend( { 8805 8806 // Counter for holding the number of active queries 8807 active: 0, 8808 8809 // Last-Modified header cache for next request 8810 lastModified: {}, 8811 etag: {}, 8812 8813 ajaxSettings: { 8814 url: location.href, 8815 type: "GET", 8816 isLocal: rlocalProtocol.test( location.protocol ), 8817 global: true, 8818 processData: true, 8819 async: true, 8820 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 8821 8822 /* 8823 timeout: 0, 8824 data: null, 8825 dataType: null, 8826 username: null, 8827 password: null, 8828 cache: null, 8829 throws: false, 8830 traditional: false, 8831 headers: {}, 8832 */ 8833 8834 accepts: { 8835 "*": allTypes, 8836 text: "text/plain", 8837 html: "text/html", 8838 xml: "application/xml, text/xml", 8839 json: "application/json, text/javascript" 8840 }, 8841 8842 contents: { 8843 xml: /\bxml\b/, 8844 html: /\bhtml/, 8845 json: /\bjson\b/ 8846 }, 8847 8848 responseFields: { 8849 xml: "responseXML", 8850 text: "responseText", 8851 json: "responseJSON" 8852 }, 8853 8854 // Data converters 8855 // Keys separate source (or catchall "*") and destination types with a single space 8856 converters: { 8857 8858 // Convert anything to text 8859 "* text": String, 8860 8861 // Text to html (true = no transformation) 8862 "text html": true, 8863 8864 // Evaluate text as a json expression 8865 "text json": JSON.parse, 8866 8867 // Parse text as xml 8868 "text xml": jQuery.parseXML 8869 }, 8870 8871 // For options that shouldn't be deep extended: 8872 // you can add your own custom options here if 8873 // and when you create one that shouldn't be 8874 // deep extended (see ajaxExtend) 8875 flatOptions: { 8876 url: true, 8877 context: true 8878 } 8879 }, 8880 8881 // Creates a full fledged settings object into target 8882 // with both ajaxSettings and settings fields. 8883 // If target is omitted, writes into ajaxSettings. 8884 ajaxSetup: function( target, settings ) { 8885 return settings ? 8886 8887 // Building a settings object 8888 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 8889 8890 // Extending ajaxSettings 8891 ajaxExtend( jQuery.ajaxSettings, target ); 8892 }, 8893 8894 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 8895 ajaxTransport: addToPrefiltersOrTransports( transports ), 8896 8897 // Main method 8898 ajax: function( url, options ) { 8899 8900 // If url is an object, simulate pre-1.5 signature 8901 if ( typeof url === "object" ) { 8902 options = url; 8903 url = undefined; 8904 } 8905 8906 // Force options to be an object 8907 options = options || {}; 8908 8909 var transport, 8910 8911 // URL without anti-cache param 8912 cacheURL, 8913 8914 // Response headers 8915 responseHeadersString, 8916 responseHeaders, 8917 8918 // timeout handle 8919 timeoutTimer, 8920 8921 // Url cleanup var 8922 urlAnchor, 8923 8924 // Request state (becomes false upon send and true upon completion) 8925 completed, 8926 8927 // To know if global events are to be dispatched 8928 fireGlobals, 8929 8930 // Loop variable 8931 i, 8932 8933 // uncached part of the url 8934 uncached, 8935 8936 // Create the final options object 8937 s = jQuery.ajaxSetup( {}, options ), 8938 8939 // Callbacks context 8940 callbackContext = s.context || s, 8941 8942 // Context for global events is callbackContext if it is a DOM node or jQuery collection 8943 globalEventContext = s.context && 8944 ( callbackContext.nodeType || callbackContext.jquery ) ? 8945 jQuery( callbackContext ) : 8946 jQuery.event, 8947 8948 // Deferreds 8949 deferred = jQuery.Deferred(), 8950 completeDeferred = jQuery.Callbacks( "once memory" ), 8951 8952 // Status-dependent callbacks 8953 statusCode = s.statusCode || {}, 8954 8955 // Headers (they are sent all at once) 8956 requestHeaders = {}, 8957 requestHeadersNames = {}, 8958 8959 // Default abort message 8960 strAbort = "canceled", 8961 8962 // Fake xhr 8963 jqXHR = { 8964 readyState: 0, 8965 8966 // Builds headers hashtable if needed 8967 getResponseHeader: function( key ) { 8968 var match; 8969 if ( completed ) { 8970 if ( !responseHeaders ) { 8971 responseHeaders = {}; 8972 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 8973 responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; 8974 } 8975 } 8976 match = responseHeaders[ key.toLowerCase() ]; 8977 } 8978 return match == null ? null : match; 8979 }, 8980 8981 // Raw string 8982 getAllResponseHeaders: function() { 8983 return completed ? responseHeadersString : null; 8984 }, 8985 8986 // Caches the header 8987 setRequestHeader: function( name, value ) { 8988 if ( completed == null ) { 8989 name = requestHeadersNames[ name.toLowerCase() ] = 8990 requestHeadersNames[ name.toLowerCase() ] || name; 8991 requestHeaders[ name ] = value; 8992 } 8993 return this; 8994 }, 8995 8996 // Overrides response content-type header 8997 overrideMimeType: function( type ) { 8998 if ( completed == null ) { 8999 s.mimeType = type; 9000 } 9001 return this; 9002 }, 9003 9004 // Status-dependent callbacks 9005 statusCode: function( map ) { 9006 var code; 9007 if ( map ) { 9008 if ( completed ) { 9009 9010 // Execute the appropriate callbacks 9011 jqXHR.always( map[ jqXHR.status ] ); 9012 } else { 9013 9014 // Lazy-add the new callbacks in a way that preserves old ones 9015 for ( code in map ) { 9016 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 9017 } 9018 } 9019 } 9020 return this; 9021 }, 9022 9023 // Cancel the request 9024 abort: function( statusText ) { 9025 var finalText = statusText || strAbort; 9026 if ( transport ) { 9027 transport.abort( finalText ); 9028 } 9029 done( 0, finalText ); 9030 return this; 9031 } 9032 }; 9033 9034 // Attach deferreds 9035 deferred.promise( jqXHR ); 9036 9037 // Add protocol if not provided (prefilters might expect it) 9038 // Handle falsy url in the settings object (#10093: consistency with old signature) 9039 // We also use the url parameter if available 9040 s.url = ( ( url || s.url || location.href ) + "" ) 9041 .replace( rprotocol, location.protocol + "//" ); 9042 9043 // Alias method option to type as per ticket #12004 9044 s.type = options.method || options.type || s.method || s.type; 9045 9046 // Extract dataTypes list 9047 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 9048 9049 // A cross-domain request is in order when the origin doesn't match the current origin. 9050 if ( s.crossDomain == null ) { 9051 urlAnchor = document.createElement( "a" ); 9052 9053 // Support: IE <=8 - 11, Edge 12 - 15 9054 // IE throws exception on accessing the href property if url is malformed, 9055 // e.g. http://example.com:80x/ 9056 try { 9057 urlAnchor.href = s.url; 9058 9059 // Support: IE <=8 - 11 only 9060 // Anchor's host property isn't correctly set when s.url is relative 9061 urlAnchor.href = urlAnchor.href; 9062 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 9063 urlAnchor.protocol + "//" + urlAnchor.host; 9064 } catch ( e ) { 9065 9066 // If there is an error parsing the URL, assume it is crossDomain, 9067 // it can be rejected by the transport if it is invalid 9068 s.crossDomain = true; 9069 } 9070 } 9071 9072 // Convert data if not already a string 9073 if ( s.data && s.processData && typeof s.data !== "string" ) { 9074 s.data = jQuery.param( s.data, s.traditional ); 9075 } 9076 9077 // Apply prefilters 9078 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 9079 9080 // If request was aborted inside a prefilter, stop there 9081 if ( completed ) { 9082 return jqXHR; 9083 } 9084 9085 // We can fire global events as of now if asked to 9086 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) 9087 fireGlobals = jQuery.event && s.global; 9088 9089 // Watch for a new set of requests 9090 if ( fireGlobals && jQuery.active++ === 0 ) { 9091 jQuery.event.trigger( "ajaxStart" ); 9092 } 9093 9094 // Uppercase the type 9095 s.type = s.type.toUpperCase(); 9096 9097 // Determine if request has content 9098 s.hasContent = !rnoContent.test( s.type ); 9099 9100 // Save the URL in case we're toying with the If-Modified-Since 9101 // and/or If-None-Match header later on 9102 // Remove hash to simplify url manipulation 9103 cacheURL = s.url.replace( rhash, "" ); 9104 9105 // More options handling for requests with no content 9106 if ( !s.hasContent ) { 9107 9108 // Remember the hash so we can put it back 9109 uncached = s.url.slice( cacheURL.length ); 9110 9111 // If data is available and should be processed, append data to url 9112 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 9113 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 9114 9115 // #9682: remove data so that it's not used in an eventual retry 9116 delete s.data; 9117 } 9118 9119 // Add or update anti-cache param if needed 9120 if ( s.cache === false ) { 9121 cacheURL = cacheURL.replace( rantiCache, "$1" ); 9122 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; 9123 } 9124 9125 // Put hash and anti-cache on the URL that will be requested (gh-1732) 9126 s.url = cacheURL + uncached; 9127 9128 // Change '%20' to '+' if this is encoded form body content (gh-2658) 9129 } else if ( s.data && s.processData && 9130 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 9131 s.data = s.data.replace( r20, "+" ); 9132 } 9133 9134 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9135 if ( s.ifModified ) { 9136 if ( jQuery.lastModified[ cacheURL ] ) { 9137 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 9138 } 9139 if ( jQuery.etag[ cacheURL ] ) { 9140 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 9141 } 9142 } 9143 9144 // Set the correct header, if data is being sent 9145 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 9146 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 9147 } 9148 9149 // Set the Accepts header for the server, depending on the dataType 9150 jqXHR.setRequestHeader( 9151 "Accept", 9152 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 9153 s.accepts[ s.dataTypes[ 0 ] ] + 9154 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 9155 s.accepts[ "*" ] 9156 ); 9157 9158 // Check for headers option 9159 for ( i in s.headers ) { 9160 jqXHR.setRequestHeader( i, s.headers[ i ] ); 9161 } 9162 9163 // Allow custom headers/mimetypes and early abort 9164 if ( s.beforeSend && 9165 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 9166 9167 // Abort if not done already and return 9168 return jqXHR.abort(); 9169 } 9170 9171 // Aborting is no longer a cancellation 9172 strAbort = "abort"; 9173 9174 // Install callbacks on deferreds 9175 completeDeferred.add( s.complete ); 9176 jqXHR.done( s.success ); 9177 jqXHR.fail( s.error ); 9178 9179 // Get transport 9180 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 9181 9182 // If no transport, we auto-abort 9183 if ( !transport ) { 9184 done( -1, "No Transport" ); 9185 } else { 9186 jqXHR.readyState = 1; 9187 9188 // Send global event 9189 if ( fireGlobals ) { 9190 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 9191 } 9192 9193 // If request was aborted inside ajaxSend, stop there 9194 if ( completed ) { 9195 return jqXHR; 9196 } 9197 9198 // Timeout 9199 if ( s.async && s.timeout > 0 ) { 9200 timeoutTimer = window.setTimeout( function() { 9201 jqXHR.abort( "timeout" ); 9202 }, s.timeout ); 9203 } 9204 9205 try { 9206 completed = false; 9207 transport.send( requestHeaders, done ); 9208 } catch ( e ) { 9209 9210 // Rethrow post-completion exceptions 9211 if ( completed ) { 9212 throw e; 9213 } 9214 9215 // Propagate others as results 9216 done( -1, e ); 9217 } 9218 } 9219 9220 // Callback for when everything is done 9221 function done( status, nativeStatusText, responses, headers ) { 9222 var isSuccess, success, error, response, modified, 9223 statusText = nativeStatusText; 9224 9225 // Ignore repeat invocations 9226 if ( completed ) { 9227 return; 9228 } 9229 9230 completed = true; 9231 9232 // Clear timeout if it exists 9233 if ( timeoutTimer ) { 9234 window.clearTimeout( timeoutTimer ); 9235 } 9236 9237 // Dereference transport for early garbage collection 9238 // (no matter how long the jqXHR object will be used) 9239 transport = undefined; 9240 9241 // Cache response headers 9242 responseHeadersString = headers || ""; 9243 9244 // Set readyState 9245 jqXHR.readyState = status > 0 ? 4 : 0; 9246 9247 // Determine if successful 9248 isSuccess = status >= 200 && status < 300 || status === 304; 9249 9250 // Get response data 9251 if ( responses ) { 9252 response = ajaxHandleResponses( s, jqXHR, responses ); 9253 } 9254 9255 // Convert no matter what (that way responseXXX fields are always set) 9256 response = ajaxConvert( s, response, jqXHR, isSuccess ); 9257 9258 // If successful, handle type chaining 9259 if ( isSuccess ) { 9260 9261 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9262 if ( s.ifModified ) { 9263 modified = jqXHR.getResponseHeader( "Last-Modified" ); 9264 if ( modified ) { 9265 jQuery.lastModified[ cacheURL ] = modified; 9266 } 9267 modified = jqXHR.getResponseHeader( "etag" ); 9268 if ( modified ) { 9269 jQuery.etag[ cacheURL ] = modified; 9270 } 9271 } 9272 9273 // if no content 9274 if ( status === 204 || s.type === "HEAD" ) { 9275 statusText = "nocontent"; 9276 9277 // if not modified 9278 } else if ( status === 304 ) { 9279 statusText = "notmodified"; 9280 9281 // If we have data, let's convert it 9282 } else { 9283 statusText = response.state; 9284 success = response.data; 9285 error = response.error; 9286 isSuccess = !error; 9287 } 9288 } else { 9289 9290 // Extract error from statusText and normalize for non-aborts 9291 error = statusText; 9292 if ( status || !statusText ) { 9293 statusText = "error"; 9294 if ( status < 0 ) { 9295 status = 0; 9296 } 9297 } 9298 } 9299 9300 // Set data for the fake xhr object 9301 jqXHR.status = status; 9302 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 9303 9304 // Success/Error 9305 if ( isSuccess ) { 9306 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 9307 } else { 9308 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 9309 } 9310 9311 // Status-dependent callbacks 9312 jqXHR.statusCode( statusCode ); 9313 statusCode = undefined; 9314 9315 if ( fireGlobals ) { 9316 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 9317 [ jqXHR, s, isSuccess ? success : error ] ); 9318 } 9319 9320 // Complete 9321 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 9322 9323 if ( fireGlobals ) { 9324 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 9325 9326 // Handle the global AJAX counter 9327 if ( !( --jQuery.active ) ) { 9328 jQuery.event.trigger( "ajaxStop" ); 9329 } 9330 } 9331 } 9332 9333 return jqXHR; 9334 }, 9335 9336 getJSON: function( url, data, callback ) { 9337 return jQuery.get( url, data, callback, "json" ); 9338 }, 9339 9340 getScript: function( url, callback ) { 9341 return jQuery.get( url, undefined, callback, "script" ); 9342 } 9343} ); 9344 9345jQuery.each( [ "get", "post" ], function( i, method ) { 9346 jQuery[ method ] = function( url, data, callback, type ) { 9347 9348 // Shift arguments if data argument was omitted 9349 if ( isFunction( data ) ) { 9350 type = type || callback; 9351 callback = data; 9352 data = undefined; 9353 } 9354 9355 // The url can be an options object (which then must have .url) 9356 return jQuery.ajax( jQuery.extend( { 9357 url: url, 9358 type: method, 9359 dataType: type, 9360 data: data, 9361 success: callback 9362 }, jQuery.isPlainObject( url ) && url ) ); 9363 }; 9364} ); 9365 9366 9367jQuery._evalUrl = function( url ) { 9368 return jQuery.ajax( { 9369 url: url, 9370 9371 // Make this explicit, since user can override this through ajaxSetup (#11264) 9372 type: "GET", 9373 dataType: "script", 9374 cache: true, 9375 async: false, 9376 global: false, 9377 "throws": true 9378 } ); 9379}; 9380 9381 9382jQuery.fn.extend( { 9383 wrapAll: function( html ) { 9384 var wrap; 9385 9386 if ( this[ 0 ] ) { 9387 if ( isFunction( html ) ) { 9388 html = html.call( this[ 0 ] ); 9389 } 9390 9391 // The elements to wrap the target around 9392 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 9393 9394 if ( this[ 0 ].parentNode ) { 9395 wrap.insertBefore( this[ 0 ] ); 9396 } 9397 9398 wrap.map( function() { 9399 var elem = this; 9400 9401 while ( elem.firstElementChild ) { 9402 elem = elem.firstElementChild; 9403 } 9404 9405 return elem; 9406 } ).append( this ); 9407 } 9408 9409 return this; 9410 }, 9411 9412 wrapInner: function( html ) { 9413 if ( isFunction( html ) ) { 9414 return this.each( function( i ) { 9415 jQuery( this ).wrapInner( html.call( this, i ) ); 9416 } ); 9417 } 9418 9419 return this.each( function() { 9420 var self = jQuery( this ), 9421 contents = self.contents(); 9422 9423 if ( contents.length ) { 9424 contents.wrapAll( html ); 9425 9426 } else { 9427 self.append( html ); 9428 } 9429 } ); 9430 }, 9431 9432 wrap: function( html ) { 9433 var htmlIsFunction = isFunction( html ); 9434 9435 return this.each( function( i ) { 9436 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 9437 } ); 9438 }, 9439 9440 unwrap: function( selector ) { 9441 this.parent( selector ).not( "body" ).each( function() { 9442 jQuery( this ).replaceWith( this.childNodes ); 9443 } ); 9444 return this; 9445 } 9446} ); 9447 9448 9449jQuery.expr.pseudos.hidden = function( elem ) { 9450 return !jQuery.expr.pseudos.visible( elem ); 9451}; 9452jQuery.expr.pseudos.visible = function( elem ) { 9453 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 9454}; 9455 9456 9457 9458 9459jQuery.ajaxSettings.xhr = function() { 9460 try { 9461 return new window.XMLHttpRequest(); 9462 } catch ( e ) {} 9463}; 9464 9465var xhrSuccessStatus = { 9466 9467 // File protocol always yields status code 0, assume 200 9468 0: 200, 9469 9470 // Support: IE <=9 only 9471 // #1450: sometimes IE returns 1223 when it should be 204 9472 1223: 204 9473 }, 9474 xhrSupported = jQuery.ajaxSettings.xhr(); 9475 9476support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 9477support.ajax = xhrSupported = !!xhrSupported; 9478 9479jQuery.ajaxTransport( function( options ) { 9480 var callback, errorCallback; 9481 9482 // Cross domain only allowed if supported through XMLHttpRequest 9483 if ( support.cors || xhrSupported && !options.crossDomain ) { 9484 return { 9485 send: function( headers, complete ) { 9486 var i, 9487 xhr = options.xhr(); 9488 9489 xhr.open( 9490 options.type, 9491 options.url, 9492 options.async, 9493 options.username, 9494 options.password 9495 ); 9496 9497 // Apply custom fields if provided 9498 if ( options.xhrFields ) { 9499 for ( i in options.xhrFields ) { 9500 xhr[ i ] = options.xhrFields[ i ]; 9501 } 9502 } 9503 9504 // Override mime type if needed 9505 if ( options.mimeType && xhr.overrideMimeType ) { 9506 xhr.overrideMimeType( options.mimeType ); 9507 } 9508 9509 // X-Requested-With header 9510 // For cross-domain requests, seeing as conditions for a preflight are 9511 // akin to a jigsaw puzzle, we simply never set it to be sure. 9512 // (it can always be set on a per-request basis or even using ajaxSetup) 9513 // For same-domain requests, won't change header if already provided. 9514 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 9515 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 9516 } 9517 9518 // Set headers 9519 for ( i in headers ) { 9520 xhr.setRequestHeader( i, headers[ i ] ); 9521 } 9522 9523 // Callback 9524 callback = function( type ) { 9525 return function() { 9526 if ( callback ) { 9527 callback = errorCallback = xhr.onload = 9528 xhr.onerror = xhr.onabort = xhr.ontimeout = 9529 xhr.onreadystatechange = null; 9530 9531 if ( type === "abort" ) { 9532 xhr.abort(); 9533 } else if ( type === "error" ) { 9534 9535 // Support: IE <=9 only 9536 // On a manual native abort, IE9 throws 9537 // errors on any property access that is not readyState 9538 if ( typeof xhr.status !== "number" ) { 9539 complete( 0, "error" ); 9540 } else { 9541 complete( 9542 9543 // File: protocol always yields status 0; see #8605, #14207 9544 xhr.status, 9545 xhr.statusText 9546 ); 9547 } 9548 } else { 9549 complete( 9550 xhrSuccessStatus[ xhr.status ] || xhr.status, 9551 xhr.statusText, 9552 9553 // Support: IE <=9 only 9554 // IE9 has no XHR2 but throws on binary (trac-11426) 9555 // For XHR2 non-text, let the caller handle it (gh-2498) 9556 ( xhr.responseType || "text" ) !== "text" || 9557 typeof xhr.responseText !== "string" ? 9558 { binary: xhr.response } : 9559 { text: xhr.responseText }, 9560 xhr.getAllResponseHeaders() 9561 ); 9562 } 9563 } 9564 }; 9565 }; 9566 9567 // Listen to events 9568 xhr.onload = callback(); 9569 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 9570 9571 // Support: IE 9 only 9572 // Use onreadystatechange to replace onabort 9573 // to handle uncaught aborts 9574 if ( xhr.onabort !== undefined ) { 9575 xhr.onabort = errorCallback; 9576 } else { 9577 xhr.onreadystatechange = function() { 9578 9579 // Check readyState before timeout as it changes 9580 if ( xhr.readyState === 4 ) { 9581 9582 // Allow onerror to be called first, 9583 // but that will not handle a native abort 9584 // Also, save errorCallback to a variable 9585 // as xhr.onerror cannot be accessed 9586 window.setTimeout( function() { 9587 if ( callback ) { 9588 errorCallback(); 9589 } 9590 } ); 9591 } 9592 }; 9593 } 9594 9595 // Create the abort callback 9596 callback = callback( "abort" ); 9597 9598 try { 9599 9600 // Do send the request (this may raise an exception) 9601 xhr.send( options.hasContent && options.data || null ); 9602 } catch ( e ) { 9603 9604 // #14683: Only rethrow if this hasn't been notified as an error yet 9605 if ( callback ) { 9606 throw e; 9607 } 9608 } 9609 }, 9610 9611 abort: function() { 9612 if ( callback ) { 9613 callback(); 9614 } 9615 } 9616 }; 9617 } 9618} ); 9619 9620 9621 9622 9623// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 9624jQuery.ajaxPrefilter( function( s ) { 9625 if ( s.crossDomain ) { 9626 s.contents.script = false; 9627 } 9628} ); 9629 9630// Install script dataType 9631jQuery.ajaxSetup( { 9632 accepts: { 9633 script: "text/javascript, application/javascript, " + 9634 "application/ecmascript, application/x-ecmascript" 9635 }, 9636 contents: { 9637 script: /\b(?:java|ecma)script\b/ 9638 }, 9639 converters: { 9640 "text script": function( text ) { 9641 jQuery.globalEval( text ); 9642 return text; 9643 } 9644 } 9645} ); 9646 9647// Handle cache's special case and crossDomain 9648jQuery.ajaxPrefilter( "script", function( s ) { 9649 if ( s.cache === undefined ) { 9650 s.cache = false; 9651 } 9652 if ( s.crossDomain ) { 9653 s.type = "GET"; 9654 } 9655} ); 9656 9657// Bind script tag hack transport 9658jQuery.ajaxTransport( "script", function( s ) { 9659 9660 // This transport only deals with cross domain requests 9661 if ( s.crossDomain ) { 9662 var script, callback; 9663 return { 9664 send: function( _, complete ) { 9665 script = jQuery( "<script>" ).prop( { 9666 charset: s.scriptCharset, 9667 src: s.url 9668 } ).on( 9669 "load error", 9670 callback = function( evt ) { 9671 script.remove(); 9672 callback = null; 9673 if ( evt ) { 9674 complete( evt.type === "error" ? 404 : 200, evt.type ); 9675 } 9676 } 9677 ); 9678 9679 // Use native DOM manipulation to avoid our domManip AJAX trickery 9680 document.head.appendChild( script[ 0 ] ); 9681 }, 9682 abort: function() { 9683 if ( callback ) { 9684 callback(); 9685 } 9686 } 9687 }; 9688 } 9689} ); 9690 9691 9692 9693 9694var oldCallbacks = [], 9695 rjsonp = /(=)\?(?=&|$)|\?\?/; 9696 9697// Default jsonp settings 9698jQuery.ajaxSetup( { 9699 jsonp: "callback", 9700 jsonpCallback: function() { 9701 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); 9702 this[ callback ] = true; 9703 return callback; 9704 } 9705} ); 9706 9707// Detect, normalize options and install callbacks for jsonp requests 9708jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 9709 9710 var callbackName, overwritten, responseContainer, 9711 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 9712 "url" : 9713 typeof s.data === "string" && 9714 ( s.contentType || "" ) 9715 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 9716 rjsonp.test( s.data ) && "data" 9717 ); 9718 9719 // Handle iff the expected data type is "jsonp" or we have a parameter to set 9720 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 9721 9722 // Get callback name, remembering preexisting value associated with it 9723 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 9724 s.jsonpCallback() : 9725 s.jsonpCallback; 9726 9727 // Insert callback into url or form data 9728 if ( jsonProp ) { 9729 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 9730 } else if ( s.jsonp !== false ) { 9731 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 9732 } 9733 9734 // Use data converter to retrieve json after script execution 9735 s.converters[ "script json" ] = function() { 9736 if ( !responseContainer ) { 9737 jQuery.error( callbackName + " was not called" ); 9738 } 9739 return responseContainer[ 0 ]; 9740 }; 9741 9742 // Force json dataType 9743 s.dataTypes[ 0 ] = "json"; 9744 9745 // Install callback 9746 overwritten = window[ callbackName ]; 9747 window[ callbackName ] = function() { 9748 responseContainer = arguments; 9749 }; 9750 9751 // Clean-up function (fires after converters) 9752 jqXHR.always( function() { 9753 9754 // If previous value didn't exist - remove it 9755 if ( overwritten === undefined ) { 9756 jQuery( window ).removeProp( callbackName ); 9757 9758 // Otherwise restore preexisting value 9759 } else { 9760 window[ callbackName ] = overwritten; 9761 } 9762 9763 // Save back as free 9764 if ( s[ callbackName ] ) { 9765 9766 // Make sure that re-using the options doesn't screw things around 9767 s.jsonpCallback = originalSettings.jsonpCallback; 9768 9769 // Save the callback name for future use 9770 oldCallbacks.push( callbackName ); 9771 } 9772 9773 // Call if it was a function and we have a response 9774 if ( responseContainer && isFunction( overwritten ) ) { 9775 overwritten( responseContainer[ 0 ] ); 9776 } 9777 9778 responseContainer = overwritten = undefined; 9779 } ); 9780 9781 // Delegate to script 9782 return "script"; 9783 } 9784} ); 9785 9786 9787 9788 9789// Support: Safari 8 only 9790// In Safari 8 documents created via document.implementation.createHTMLDocument 9791// collapse sibling forms: the second one becomes a child of the first one. 9792// Because of that, this security measure has to be disabled in Safari 8. 9793// https://bugs.webkit.org/show_bug.cgi?id=137337 9794support.createHTMLDocument = ( function() { 9795 var body = document.implementation.createHTMLDocument( "" ).body; 9796 body.innerHTML = "<form></form><form></form>"; 9797 return body.childNodes.length === 2; 9798} )(); 9799 9800 9801// Argument "data" should be string of html 9802// context (optional): If specified, the fragment will be created in this context, 9803// defaults to document 9804// keepScripts (optional): If true, will include scripts passed in the html string 9805jQuery.parseHTML = function( data, context, keepScripts ) { 9806 if ( typeof data !== "string" ) { 9807 return []; 9808 } 9809 if ( typeof context === "boolean" ) { 9810 keepScripts = context; 9811 context = false; 9812 } 9813 9814 var base, parsed, scripts; 9815 9816 if ( !context ) { 9817 9818 // Stop scripts or inline event handlers from being executed immediately 9819 // by using document.implementation 9820 if ( support.createHTMLDocument ) { 9821 context = document.implementation.createHTMLDocument( "" ); 9822 9823 // Set the base href for the created document 9824 // so any parsed elements with URLs 9825 // are based on the document's URL (gh-2965) 9826 base = context.createElement( "base" ); 9827 base.href = document.location.href; 9828 context.head.appendChild( base ); 9829 } else { 9830 context = document; 9831 } 9832 } 9833 9834 parsed = rsingleTag.exec( data ); 9835 scripts = !keepScripts && []; 9836 9837 // Single tag 9838 if ( parsed ) { 9839 return [ context.createElement( parsed[ 1 ] ) ]; 9840 } 9841 9842 parsed = buildFragment( [ data ], context, scripts ); 9843 9844 if ( scripts && scripts.length ) { 9845 jQuery( scripts ).remove(); 9846 } 9847 9848 return jQuery.merge( [], parsed.childNodes ); 9849}; 9850 9851 9852/** 9853 * Load a url into a page 9854 */ 9855jQuery.fn.load = function( url, params, callback ) { 9856 var selector, type, response, 9857 self = this, 9858 off = url.indexOf( " " ); 9859 9860 if ( off > -1 ) { 9861 selector = stripAndCollapse( url.slice( off ) ); 9862 url = url.slice( 0, off ); 9863 } 9864 9865 // If it's a function 9866 if ( isFunction( params ) ) { 9867 9868 // We assume that it's the callback 9869 callback = params; 9870 params = undefined; 9871 9872 // Otherwise, build a param string 9873 } else if ( params && typeof params === "object" ) { 9874 type = "POST"; 9875 } 9876 9877 // If we have elements to modify, make the request 9878 if ( self.length > 0 ) { 9879 jQuery.ajax( { 9880 url: url, 9881 9882 // If "type" variable is undefined, then "GET" method will be used. 9883 // Make value of this field explicit since 9884 // user can override it through ajaxSetup method 9885 type: type || "GET", 9886 dataType: "html", 9887 data: params 9888 } ).done( function( responseText ) { 9889 9890 // Save response for use in complete callback 9891 response = arguments; 9892 9893 self.html( selector ? 9894 9895 // If a selector was specified, locate the right elements in a dummy div 9896 // Exclude scripts to avoid IE 'Permission Denied' errors 9897 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 9898 9899 // Otherwise use the full result 9900 responseText ); 9901 9902 // If the request succeeds, this function gets "data", "status", "jqXHR" 9903 // but they are ignored because response was set above. 9904 // If it fails, this function gets "jqXHR", "status", "error" 9905 } ).always( callback && function( jqXHR, status ) { 9906 self.each( function() { 9907 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 9908 } ); 9909 } ); 9910 } 9911 9912 return this; 9913}; 9914 9915 9916 9917 9918// Attach a bunch of functions for handling common AJAX events 9919jQuery.each( [ 9920 "ajaxStart", 9921 "ajaxStop", 9922 "ajaxComplete", 9923 "ajaxError", 9924 "ajaxSuccess", 9925 "ajaxSend" 9926], function( i, type ) { 9927 jQuery.fn[ type ] = function( fn ) { 9928 return this.on( type, fn ); 9929 }; 9930} ); 9931 9932 9933 9934 9935jQuery.expr.pseudos.animated = function( elem ) { 9936 return jQuery.grep( jQuery.timers, function( fn ) { 9937 return elem === fn.elem; 9938 } ).length; 9939}; 9940 9941 9942 9943 9944jQuery.offset = { 9945 setOffset: function( elem, options, i ) { 9946 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 9947 position = jQuery.css( elem, "position" ), 9948 curElem = jQuery( elem ), 9949 props = {}; 9950 9951 // Set position first, in-case top/left are set even on static elem 9952 if ( position === "static" ) { 9953 elem.style.position = "relative"; 9954 } 9955 9956 curOffset = curElem.offset(); 9957 curCSSTop = jQuery.css( elem, "top" ); 9958 curCSSLeft = jQuery.css( elem, "left" ); 9959 calculatePosition = ( position === "absolute" || position === "fixed" ) && 9960 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 9961 9962 // Need to be able to calculate position if either 9963 // top or left is auto and position is either absolute or fixed 9964 if ( calculatePosition ) { 9965 curPosition = curElem.position(); 9966 curTop = curPosition.top; 9967 curLeft = curPosition.left; 9968 9969 } else { 9970 curTop = parseFloat( curCSSTop ) || 0; 9971 curLeft = parseFloat( curCSSLeft ) || 0; 9972 } 9973 9974 if ( isFunction( options ) ) { 9975 9976 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 9977 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 9978 } 9979 9980 if ( options.top != null ) { 9981 props.top = ( options.top - curOffset.top ) + curTop; 9982 } 9983 if ( options.left != null ) { 9984 props.left = ( options.left - curOffset.left ) + curLeft; 9985 } 9986 9987 if ( "using" in options ) { 9988 options.using.call( elem, props ); 9989 9990 } else { 9991 curElem.css( props ); 9992 } 9993 } 9994}; 9995 9996jQuery.fn.extend( { 9997 9998 // offset() relates an element's border box to the document origin 9999 offset: function( options ) { 10000 10001 // Preserve chaining for setter 10002 if ( arguments.length ) { 10003 return options === undefined ? 10004 this : 10005 this.each( function( i ) { 10006 jQuery.offset.setOffset( this, options, i ); 10007 } ); 10008 } 10009 10010 var rect, win, 10011 elem = this[ 0 ]; 10012 10013 if ( !elem ) { 10014 return; 10015 } 10016 10017 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 10018 // Support: IE <=11 only 10019 // Running getBoundingClientRect on a 10020 // disconnected node in IE throws an error 10021 if ( !elem.getClientRects().length ) { 10022 return { top: 0, left: 0 }; 10023 } 10024 10025 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 10026 rect = elem.getBoundingClientRect(); 10027 win = elem.ownerDocument.defaultView; 10028 return { 10029 top: rect.top + win.pageYOffset, 10030 left: rect.left + win.pageXOffset 10031 }; 10032 }, 10033 10034 // position() relates an element's margin box to its offset parent's padding box 10035 // This corresponds to the behavior of CSS absolute positioning 10036 position: function() { 10037 if ( !this[ 0 ] ) { 10038 return; 10039 } 10040 10041 var offsetParent, offset, doc, 10042 elem = this[ 0 ], 10043 parentOffset = { top: 0, left: 0 }; 10044 10045 // position:fixed elements are offset from the viewport, which itself always has zero offset 10046 if ( jQuery.css( elem, "position" ) === "fixed" ) { 10047 10048 // Assume position:fixed implies availability of getBoundingClientRect 10049 offset = elem.getBoundingClientRect(); 10050 10051 } else { 10052 offset = this.offset(); 10053 10054 // Account for the *real* offset parent, which can be the document or its root element 10055 // when a statically positioned element is identified 10056 doc = elem.ownerDocument; 10057 offsetParent = elem.offsetParent || doc.documentElement; 10058 while ( offsetParent && 10059 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 10060 jQuery.css( offsetParent, "position" ) === "static" ) { 10061 10062 offsetParent = offsetParent.parentNode; 10063 } 10064 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 10065 10066 // Incorporate borders into its offset, since they are outside its content origin 10067 parentOffset = jQuery( offsetParent ).offset(); 10068 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 10069 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 10070 } 10071 } 10072 10073 // Subtract parent offsets and element margins 10074 return { 10075 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 10076 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 10077 }; 10078 }, 10079 10080 // This method will return documentElement in the following cases: 10081 // 1) For the element inside the iframe without offsetParent, this method will return 10082 // documentElement of the parent window 10083 // 2) For the hidden or detached element 10084 // 3) For body or html element, i.e. in case of the html node - it will return itself 10085 // 10086 // but those exceptions were never presented as a real life use-cases 10087 // and might be considered as more preferable results. 10088 // 10089 // This logic, however, is not guaranteed and can change at any point in the future 10090 offsetParent: function() { 10091 return this.map( function() { 10092 var offsetParent = this.offsetParent; 10093 10094 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 10095 offsetParent = offsetParent.offsetParent; 10096 } 10097 10098 return offsetParent || documentElement; 10099 } ); 10100 } 10101} ); 10102 10103// Create scrollLeft and scrollTop methods 10104jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 10105 var top = "pageYOffset" === prop; 10106 10107 jQuery.fn[ method ] = function( val ) { 10108 return access( this, function( elem, method, val ) { 10109 10110 // Coalesce documents and windows 10111 var win; 10112 if ( isWindow( elem ) ) { 10113 win = elem; 10114 } else if ( elem.nodeType === 9 ) { 10115 win = elem.defaultView; 10116 } 10117 10118 if ( val === undefined ) { 10119 return win ? win[ prop ] : elem[ method ]; 10120 } 10121 10122 if ( win ) { 10123 win.scrollTo( 10124 !top ? val : win.pageXOffset, 10125 top ? val : win.pageYOffset 10126 ); 10127 10128 } else { 10129 elem[ method ] = val; 10130 } 10131 }, method, val, arguments.length ); 10132 }; 10133} ); 10134 10135// Support: Safari <=7 - 9.1, Chrome <=37 - 49 10136// Add the top/left cssHooks using jQuery.fn.position 10137// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10138// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 10139// getComputedStyle returns percent when specified for top/left/bottom/right; 10140// rather than make the css module depend on the offset module, just check for it here 10141jQuery.each( [ "top", "left" ], function( i, prop ) { 10142 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 10143 function( elem, computed ) { 10144 if ( computed ) { 10145 computed = curCSS( elem, prop ); 10146 10147 // If curCSS returns percentage, fallback to offset 10148 return rnumnonpx.test( computed ) ? 10149 jQuery( elem ).position()[ prop ] + "px" : 10150 computed; 10151 } 10152 } 10153 ); 10154} ); 10155 10156 10157// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10158jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 10159 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, 10160 function( defaultExtra, funcName ) { 10161 10162 // Margin is only for outerHeight, outerWidth 10163 jQuery.fn[ funcName ] = function( margin, value ) { 10164 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 10165 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 10166 10167 return access( this, function( elem, type, value ) { 10168 var doc; 10169 10170 if ( isWindow( elem ) ) { 10171 10172 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 10173 return funcName.indexOf( "outer" ) === 0 ? 10174 elem[ "inner" + name ] : 10175 elem.document.documentElement[ "client" + name ]; 10176 } 10177 10178 // Get document width or height 10179 if ( elem.nodeType === 9 ) { 10180 doc = elem.documentElement; 10181 10182 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 10183 // whichever is greatest 10184 return Math.max( 10185 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 10186 elem.body[ "offset" + name ], doc[ "offset" + name ], 10187 doc[ "client" + name ] 10188 ); 10189 } 10190 10191 return value === undefined ? 10192 10193 // Get width or height on the element, requesting but not forcing parseFloat 10194 jQuery.css( elem, type, extra ) : 10195 10196 // Set width or height on the element 10197 jQuery.style( elem, type, value, extra ); 10198 }, type, chainable ? margin : undefined, chainable ); 10199 }; 10200 } ); 10201} ); 10202 10203 10204jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + 10205 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 10206 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 10207 function( i, name ) { 10208 10209 // Handle event binding 10210 jQuery.fn[ name ] = function( data, fn ) { 10211 return arguments.length > 0 ? 10212 this.on( name, null, data, fn ) : 10213 this.trigger( name ); 10214 }; 10215} ); 10216 10217jQuery.fn.extend( { 10218 hover: function( fnOver, fnOut ) { 10219 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 10220 } 10221} ); 10222 10223 10224 10225 10226jQuery.fn.extend( { 10227 10228 bind: function( types, data, fn ) { 10229 return this.on( types, null, data, fn ); 10230 }, 10231 unbind: function( types, fn ) { 10232 return this.off( types, null, fn ); 10233 }, 10234 10235 delegate: function( selector, types, data, fn ) { 10236 return this.on( types, selector, data, fn ); 10237 }, 10238 undelegate: function( selector, types, fn ) { 10239 10240 // ( namespace ) or ( selector, types [, fn] ) 10241 return arguments.length === 1 ? 10242 this.off( selector, "**" ) : 10243 this.off( types, selector || "**", fn ); 10244 } 10245} ); 10246 10247// Bind a function to a context, optionally partially applying any 10248// arguments. 10249// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 10250// However, it is not slated for removal any time soon 10251jQuery.proxy = function( fn, context ) { 10252 var tmp, args, proxy; 10253 10254 if ( typeof context === "string" ) { 10255 tmp = fn[ context ]; 10256 context = fn; 10257 fn = tmp; 10258 } 10259 10260 // Quick check to determine if target is callable, in the spec 10261 // this throws a TypeError, but we will just return undefined. 10262 if ( !isFunction( fn ) ) { 10263 return undefined; 10264 } 10265 10266 // Simulated bind 10267 args = slice.call( arguments, 2 ); 10268 proxy = function() { 10269 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 10270 }; 10271 10272 // Set the guid of unique handler to the same of original handler, so it can be removed 10273 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 10274 10275 return proxy; 10276}; 10277 10278jQuery.holdReady = function( hold ) { 10279 if ( hold ) { 10280 jQuery.readyWait++; 10281 } else { 10282 jQuery.ready( true ); 10283 } 10284}; 10285jQuery.isArray = Array.isArray; 10286jQuery.parseJSON = JSON.parse; 10287jQuery.nodeName = nodeName; 10288jQuery.isFunction = isFunction; 10289jQuery.isWindow = isWindow; 10290jQuery.camelCase = camelCase; 10291jQuery.type = toType; 10292 10293jQuery.now = Date.now; 10294 10295jQuery.isNumeric = function( obj ) { 10296 10297 // As of jQuery 3.0, isNumeric is limited to 10298 // strings and numbers (primitives or objects) 10299 // that can be coerced to finite numbers (gh-2662) 10300 var type = jQuery.type( obj ); 10301 return ( type === "number" || type === "string" ) && 10302 10303 // parseFloat NaNs numeric-cast false positives ("") 10304 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 10305 // subtraction forces infinities to NaN 10306 !isNaN( obj - parseFloat( obj ) ); 10307}; 10308 10309 10310 10311 10312// Register as a named AMD module, since jQuery can be concatenated with other 10313// files that may use define, but not via a proper concatenation script that 10314// understands anonymous AMD modules. A named AMD is safest and most robust 10315// way to register. Lowercase jquery is used because AMD module names are 10316// derived from file names, and jQuery is normally delivered in a lowercase 10317// file name. Do this after creating the global so that if an AMD module wants 10318// to call noConflict to hide this version of jQuery, it will work. 10319 10320// Note that for maximum portability, libraries that are not jQuery should 10321// declare themselves as anonymous modules, and avoid setting a global if an 10322// AMD loader is present. jQuery is a special case. For more information, see 10323// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 10324 10325if ( typeof define === "function" && define.amd ) { 10326 define( "jquery", [], function() { 10327 return jQuery; 10328 } ); 10329} 10330 10331 10332 10333 10334var 10335 10336 // Map over jQuery in case of overwrite 10337 _jQuery = window.jQuery, 10338 10339 // Map over the $ in case of overwrite 10340 _$ = window.$; 10341 10342jQuery.noConflict = function( deep ) { 10343 if ( window.$ === jQuery ) { 10344 window.$ = _$; 10345 } 10346 10347 if ( deep && window.jQuery === jQuery ) { 10348 window.jQuery = _jQuery; 10349 } 10350 10351 return jQuery; 10352}; 10353 10354// Expose jQuery and $ identifiers, even in AMD 10355// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 10356// and CommonJS for browser emulators (#13566) 10357if ( !noGlobal ) { 10358 window.jQuery = window.$ = jQuery; 10359} 10360 10361 10362 10363 10364return jQuery; 10365} );
10366(function($, undefined) { 10367 10368/** 10369 * Unobtrusive scripting adapter for jQuery 10370 * https://github.com/rails/jquery-ujs 10371 * 10372 * Requires jQuery 1.8.0 or later. 10373 * 10374 * Released under the MIT license 10375 * 10376 */ 10377 10378 // Cut down on the number of issues from people inadvertently including jquery_ujs twice 10379 // by detecting and raising an error when it happens. 10380 'use strict'; 10381 10382 if ( $.rails !== undefined ) { 10383 $.error('jquery-ujs has already been loaded!'); 10384 } 10385 10386 // Shorthand to make it a little easier to call public rails functions from within rails.js 10387 var rails; 10388 var $document = $(document); 10389 10390 $.rails = rails = { 10391 // Link elements bound by jquery-ujs 10392 linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]', 10393 10394 // Button elements bound by jquery-ujs 10395 buttonClickSelector: 'button[data-remote]:not([form]):not(form button), button[data-confirm]:not([form]):not(form button)', 10396 10397 // Select elements bound by jquery-ujs 10398 inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]', 10399 10400 // Form elements bound by jquery-ujs 10401 formSubmitSelector: 'form', 10402 10403 // Form input elements bound by jquery-ujs 10404 formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])', 10405 10406 // Form input elements disabled during form submission 10407 disableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled', 10408 10409 // Form input elements re-enabled after form submission 10410 enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled', 10411 10412 // Form required input elements 10413 requiredInputSelector: 'input[name][required]:not([disabled]), textarea[name][required]:not([disabled])', 10414 10415 // Form file input elements 10416 fileInputSelector: 'input[name][type=file]:not([disabled])', 10417 10418 // Link onClick disable selector with possible reenable after remote submission 10419 linkDisableSelector: 'a[data-disable-with], a[data-disable]', 10420 10421 // Button onClick disable selector with possible reenable after remote submission 10422 buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]', 10423 10424 // Up-to-date Cross-Site Request Forgery token 10425 csrfToken: function() { 10426 return $('meta[name=csrf-token]').attr('content'); 10427 }, 10428 10429 // URL param that must contain the CSRF token 10430 csrfParam: function() { 10431 return $('meta[name=csrf-param]').attr('content'); 10432 }, 10433 10434 // Make sure that every Ajax request sends the CSRF token 10435 CSRFProtection: function(xhr) { 10436 var token = rails.csrfToken(); 10437 if (token) xhr.setRequestHeader('X-CSRF-Token', token); 10438 }, 10439 10440 // Make sure that all forms have actual up-to-date tokens (cached forms contain old ones) 10441 refreshCSRFTokens: function(){ 10442 $('form input[name="' + rails.csrfParam() + '"]').val(rails.csrfToken()); 10443 }, 10444 10445 // Triggers an event on an element and returns false if the event result is false 10446 fire: function(obj, name, data) { 10447 var event = $.Event(name); 10448 obj.trigger(event, data); 10449 return event.result !== false; 10450 }, 10451 10452 // Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm 10453 confirm: function(message) { 10454 return confirm(message); 10455 }, 10456 10457 // Default ajax function, may be overridden with custom function in $.rails.ajax 10458 ajax: function(options) { 10459 return $.ajax(options); 10460 }, 10461 10462 // Default way to get an element's href. May be overridden at $.rails.href. 10463 href: function(element) { 10464 return element[0].href; 10465 }, 10466 10467 // Checks "data-remote" if true to handle the request through a XHR request. 10468 isRemote: function(element) { 10469 return element.data('remote') !== undefined && element.data('remote') !== false; 10470 }, 10471 10472 // Submits "remote" forms and links with ajax 10473 handleRemote: function(element) { 10474 var method, url, data, withCredentials, dataType, options; 10475 10476 if (rails.fire(element, 'ajax:before')) { 10477 withCredentials = element.data('with-credentials') || null; 10478 dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType); 10479 10480 if (element.is('form')) { 10481 method = element.data('ujs:submit-button-formmethod') || element.attr('method'); 10482 url = element.data('ujs:submit-button-formaction') || element.attr('action'); 10483 data = $(element[0]).serializeArray(); 10484 // memoized value from clicked submit button 10485 var button = element.data('ujs:submit-button'); 10486 if (button) { 10487 data.push(button); 10488 element.data('ujs:submit-button', null); 10489 } 10490 element.data('ujs:submit-button-formmethod', null); 10491 element.data('ujs:submit-button-formaction', null); 10492 } else if (element.is(rails.inputChangeSelector)) { 10493 method = element.data('method'); 10494 url = element.data('url'); 10495 data = element.serialize(); 10496 if (element.data('params')) data = data + '&' + element.data('params'); 10497 } else if (element.is(rails.buttonClickSelector)) { 10498 method = element.data('method') || 'get'; 10499 url = element.data('url'); 10500 data = element.serialize(); 10501 if (element.data('params')) data = data + '&' + element.data('params'); 10502 } else { 10503 method = element.data('method'); 10504 url = rails.href(element); 10505 data = element.data('params') || null; 10506 } 10507 10508 options = { 10509 type: method || 'GET', data: data, dataType: dataType, 10510 // stopping the "ajax:beforeSend" event will cancel the ajax request 10511 beforeSend: function(xhr, settings) { 10512 if (settings.dataType === undefined) { 10513 xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script); 10514 } 10515 if (rails.fire(element, 'ajax:beforeSend', [xhr, settings])) {
10516 element.trigger('ajax:send', xhr); 10517 } else { 10518 return false; 10519 } 10520 }, 10521 success: function(data, status, xhr) { 10522 element.trigger('ajax:success', [data, status, xhr]); 10523 }, 10524 complete: function(xhr, status) { 10525 element.trigger('ajax:complete', [xhr, status]); 10526 }, 10527 error: function(xhr, status, error) { 10528 element.trigger('ajax:error', [xhr, status, error]); 10529 }, 10530 crossDomain: rails.isCrossDomain(url) 10531 }; 10532 10533 // There is no withCredentials for IE6-8 when 10534 // "Enable native XMLHTTP support" is disabled 10535 if (withCredentials) { 10536 options.xhrFields = { 10537 withCredentials: withCredentials 10538 }; 10539 } 10540 10541 // Only pass url to `ajax` options if not blank 10542 if (url) { options.url = url; } 10543 10544 return rails.ajax(options); 10545 } else { 10546 return false; 10547 } 10548 }, 10549 10550 // Determines if the request is a cross domain request. 10551 isCrossDomain: function(url) { 10552 var originAnchor = document.createElement('a'); 10553 originAnchor.href = location.href; 10554 var urlAnchor = document.createElement('a'); 10555 10556 try { 10557 urlAnchor.href = url; 10558 // This is a workaround to a IE bug. 10559 urlAnchor.href = urlAnchor.href; 10560 10561 // If URL protocol is false or is a string containing a single colon 10562 // *and* host are false, assume it is not a cross-domain request 10563 // (should only be the case for IE7 and IE compatibility mode). 10564 // Otherwise, evaluate protocol and host of the URL against the origin 10565 // protocol and host. 10566 return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) || 10567 (originAnchor.protocol + '//' + originAnchor.host === 10568 urlAnchor.protocol + '//' + urlAnchor.host)); 10569 } catch (e) { 10570 // If there is an error parsing the URL, assume it is crossDomain. 10571 return true; 10572 } 10573 }, 10574 10575 // Handles "data-method" on links such as: 10576 // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a> 10577 handleMethod: function(link) { 10578 var href = rails.href(link), 10579 method = link.data('method'), 10580 target = link.attr('target'), 10581 csrfToken = rails.csrfToken(), 10582 csrfParam = rails.csrfParam(), 10583 form = $('<form method="post" action="' + href + '"></form>'), 10584 metadataInput = '<input name="_method" value="' + method + '" type="hidden" />'; 10585 10586 if (csrfParam !== undefined && csrfToken !== undefined && !rails.isCrossDomain(href)) { 10587 metadataInput += '<input name="' + csrfParam + '" value="' + csrfToken + '" type="hidden" />'; 10588 } 10589 10590 if (target) { form.attr('target', target); } 10591 10592 form.hide().append(metadataInput).appendTo('body'); 10593 form.submit(); 10594 }, 10595 10596 // Helper function that returns form elements that match the specified CSS selector 10597 // If form is actually a "form" element this will return associated elements outside the from that have 10598 // the html form attribute set 10599 formElements: function(form, selector) { 10600 return form.is('form') ? $(form[0].elements).filter(selector) : form.find(selector); 10601 }, 10602 10603 /* Disables form elements: 10604 - Caches element value in 'ujs:enable-with' data store 10605 - Replaces element text with value of 'data-disable-with' attribute 10606 - Sets disabled property to true 10607 */ 10608 disableFormElements: function(form) { 10609 rails.formElements(form, rails.disableSelector).each(function() { 10610 rails.disableFormElement($(this)); 10611 }); 10612 }, 10613 10614 disableFormElement: function(element) { 10615 var method, replacement; 10616 10617 method = element.is('button') ? 'html' : 'val'; 10618 replacement = element.data('disable-with'); 10619 10620 if (replacement !== undefined) { 10621 element.data('ujs:enable-with', element[method]()); 10622 element[method](replacement); 10623 } 10624 10625 element.prop('disabled', true); 10626 element.data('ujs:disabled', true); 10627 }, 10628 10629 /* Re-enables disabled form elements: 10630 - Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`) 10631 - Sets disabled property to false 10632 */ 10633 enableFormElements: function(form) { 10634 rails.formElements(form, rails.enableSelector).each(function() { 10635 rails.enableFormElement($(this)); 10636 }); 10637 }, 10638 10639 enableFormElement: function(element) { 10640 var method = element.is('button') ? 'html' : 'val'; 10641 if (element.data('ujs:enable-with') !== undefined) { 10642 element[method](element.data('ujs:enable-with')); 10643 element.removeData('ujs:enable-with'); // clean up cache 10644 } 10645 element.prop('disabled', false); 10646 element.removeData('ujs:disabled'); 10647 }, 10648 10649 /* For 'data-confirm' attribute: 10650 - Fires `confirm` event 10651 - Shows the confirmation dialog 10652 - Fires the `confirm:complete` event 10653 10654 Returns `true` if no function stops the chain and user chose yes; `false` otherwise. 10655 Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog. 10656 Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
10657 return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog. 10658 */ 10659 allowAction: function(element) { 10660 var message = element.data('confirm'), 10661 answer = false, callback; 10662 if (!message) { return true; } 10663 10664 if (rails.fire(element, 'confirm')) { 10665 try { 10666 answer = rails.confirm(message); 10667 } catch (e) { 10668 (console.error || console.log).call(console, e.stack || e); 10669 } 10670 callback = rails.fire(element, 'confirm:complete', [answer]); 10671 } 10672 return answer && callback; 10673 }, 10674 10675 // Helper function which checks for blank inputs in a form that match the specified CSS selector 10676 blankInputs: function(form, specifiedSelector, nonBlank) { 10677 var foundInputs = $(), 10678 input, 10679 valueToCheck, 10680 radiosForNameWithNoneSelected, 10681 radioName, 10682 selector = specifiedSelector || 'input,textarea', 10683 requiredInputs = form.find(selector), 10684 checkedRadioButtonNames = {}; 10685 10686 requiredInputs.each(function() { 10687 input = $(this); 10688 if (input.is('input[type=radio]')) { 10689 10690 // Don't count unchecked required radio as blank if other radio with same name is checked, 10691 // regardless of whether same-name radio input has required attribute or not. The spec 10692 // states https://www.w3.org/TR/html5/forms.html#the-required-attribute 10693 radioName = input.attr('name'); 10694 10695 // Skip if we've already seen the radio with this name. 10696 if (!checkedRadioButtonNames[radioName]) { 10697 10698 // If none checked 10699 if (form.find('input[type=radio]:checked[name="' + radioName + '"]').length === 0) { 10700 radiosForNameWithNoneSelected = form.find( 10701 'input[type=radio][name="' + radioName + '"]'); 10702 foundInputs = foundInputs.add(radiosForNameWithNoneSelected); 10703 } 10704 10705 // We only need to check each name once. 10706 checkedRadioButtonNames[radioName] = radioName; 10707 } 10708 } else { 10709 valueToCheck = input.is('input[type=checkbox],input[type=radio]') ? input.is(':checked') : !!input.val(); 10710 if (valueToCheck === nonBlank) { 10711 foundInputs = foundInputs.add(input); 10712 } 10713 } 10714 }); 10715 return foundInputs.length ? foundInputs : false; 10716 }, 10717 10718 // Helper function which checks for non-blank inputs in a form that match the specified CSS selector 10719 nonBlankInputs: function(form, specifiedSelector) { 10720 return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank 10721 }, 10722 10723 // Helper function, needed to provide consistent behavior in IE 10724 stopEverything: function(e) { 10725 $(e.target).trigger('ujs:everythingStopped'); 10726 e.stopImmediatePropagation(); 10727 return false; 10728 }, 10729 10730 // Replace element's html with the 'data-disable-with' after storing original html 10731 // and prevent clicking on it 10732 disableElement: function(element) { 10733 var replacement = element.data('disable-with'); 10734 10735 if (replacement !== undefined) { 10736 element.data('ujs:enable-with', element.html()); // store enabled state 10737 element.html(replacement); 10738 } 10739 10740 element.bind('click.railsDisable', function(e) { // prevent further clicking 10741 return rails.stopEverything(e); 10742 }); 10743 element.data('ujs:disabled', true); 10744 }, 10745 10746 // Restore element to its original state which was disabled by 'disableElement' above 10747 enableElement: function(element) { 10748 if (element.data('ujs:enable-with') !== undefined) { 10749 element.html(element.data('ujs:enable-with')); // set to old enabled state 10750 element.removeData('ujs:enable-with'); // clean up cache 10751 } 10752 element.unbind('click.railsDisable'); // enable element 10753 element.removeData('ujs:disabled'); 10754 } 10755 }; 10756 10757 if (rails.fire($document, 'rails:attachBindings')) { 10758 10759 $.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }}); 10760 10761 // This event works the same as the load event, except that it fires every 10762 // time the page is loaded. 10763 // 10764 // See https://github.com/rails/jquery-ujs/issues/357 10765 // See https://developer.mozilla.org/en-US/docs/Using_Firefox_1.5_caching 10766 $(window).on('pageshow.rails', function () { 10767 $($.rails.enableSelector).each(function () { 10768 var element = $(this); 10769 10770 if (element.data('ujs:disabled')) { 10771 $.rails.enableFormElement(element); 10772 } 10773 }); 10774 10775 $($.rails.linkDisableSelector).each(function () { 10776 var element = $(this); 10777 10778 if (element.data('ujs:disabled')) { 10779 $.rails.enableElement(element); 10780 } 10781 }); 10782 }); 10783 10784 $document.on('ajax:complete', rails.linkDisableSelector, function() { 10785 rails.enableElement($(this)); 10786 }); 10787 10788 $document.on('ajax:complete', rails.buttonDisableSelector, function() { 10789 rails.enableFormElement($(this)); 10790 }); 10791 10792 $document.on('click.rails', rails.linkClickSelector, function(e) { 10793 var link = $(this), method = link.data('method'), data = link.data('params'), metaClick = e.metaKey || e.ctrlKey; 10794 if (!rails.allowAction(link)) return rails.stopEverything(e); 10795 10796 if (!metaClick && link.is(rails.linkDisableSelector)) rails.disableElement(link); 10797 10798 if (rails.isRemote(link)) { 10799 if (metaClick && (!method || method === 'GET') && !data) { return true; } 10800 10801 var handleRemote = rails.handleRemote(link); 10802 // Response from rails.handleRemote() will either be false or a deferred object promise. 10803 if (handleRemote === false) { 10804 rails.enableElement(link); 10805 } else { 10806 handleRemote.fail( function() { rails.enableElement(link); } ); 10807 } 10808 return false;
10809 10810 } else if (method) { 10811 rails.handleMethod(link); 10812 return false; 10813 } 10814 }); 10815 10816 $document.on('click.rails', rails.buttonClickSelector, function(e) { 10817 var button = $(this); 10818 10819 if (!rails.allowAction(button) || !rails.isRemote(button)) return rails.stopEverything(e); 10820 10821 if (button.is(rails.buttonDisableSelector)) rails.disableFormElement(button); 10822 10823 var handleRemote = rails.handleRemote(button); 10824 // Response from rails.handleRemote() will either be false or a deferred object promise. 10825 if (handleRemote === false) { 10826 rails.enableFormElement(button); 10827 } else { 10828 handleRemote.fail( function() { rails.enableFormElement(button); } ); 10829 } 10830 return false; 10831 }); 10832 10833 $document.on('change.rails', rails.inputChangeSelector, function(e) { 10834 var link = $(this); 10835 if (!rails.allowAction(link) || !rails.isRemote(link)) return rails.stopEverything(e); 10836 10837 rails.handleRemote(link); 10838 return false; 10839 }); 10840 10841 $document.on('submit.rails', rails.formSubmitSelector, function(e) { 10842 var form = $(this), 10843 remote = rails.isRemote(form), 10844 blankRequiredInputs, 10845 nonBlankFileInputs; 10846 10847 if (!rails.allowAction(form)) return rails.stopEverything(e); 10848 10849 // Skip other logic when required values are missing or file upload is present 10850 if (form.attr('novalidate') === undefined) { 10851 if (form.data('ujs:formnovalidate-button') === undefined) { 10852 blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector, false); 10853 if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) { 10854 return rails.stopEverything(e); 10855 } 10856 } else { 10857 // Clear the formnovalidate in case the next button click is not on a formnovalidate button 10858 // Not strictly necessary to do here, since it is also reset on each button click, but just to be certain 10859 form.data('ujs:formnovalidate-button', undefined); 10860 } 10861 } 10862 10863 if (remote) { 10864 nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector); 10865 if (nonBlankFileInputs) { 10866 // Slight timeout so that the submit button gets properly serialized 10867 // (make it easy for event handler to serialize form without disabled values) 10868 setTimeout(function(){ rails.disableFormElements(form); }, 13); 10869 var aborted = rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]); 10870 10871 // Re-enable form elements if event bindings return false (canceling normal form submission) 10872 if (!aborted) { setTimeout(function(){ rails.enableFormElements(form); }, 13); } 10873 10874 return aborted; 10875 } 10876 10877 rails.handleRemote(form); 10878 return false; 10879 10880 } else { 10881 // Slight timeout so that the submit button gets properly serialized 10882 setTimeout(function(){ rails.disableFormElements(form); }, 13); 10883 } 10884 }); 10885 10886 $document.on('click.rails', rails.formInputClickSelector, function(event) { 10887 var button = $(this); 10888 10889 if (!rails.allowAction(button)) return rails.stopEverything(event); 10890 10891 // Register the pressed submit button 10892 var name = button.attr('name'), 10893 data = name ? {name:name, value:button.val()} : null; 10894 10895 var form = button.closest('form'); 10896 if (form.length === 0) { 10897 form = $('#' + button.attr('form')); 10898 } 10899 form.data('ujs:submit-button', data); 10900 10901 // Save attributes from button 10902 form.data('ujs:formnovalidate-button', button.attr('formnovalidate')); 10903 form.data('ujs:submit-button-formaction', button.attr('formaction')); 10904 form.data('ujs:submit-button-formmethod', button.attr('formmethod')); 10905 }); 10906 10907 $document.on('ajax:send.rails', rails.formSubmitSelector, function(event) { 10908 if (this === event.target) rails.disableFormElements($(this)); 10909 }); 10910 10911 $document.on('ajax:complete.rails', rails.formSubmitSelector, function(event) { 10912 if (this === event.target) rails.enableFormElements($(this)); 10913 }); 10914 10915 $(function(){ 10916 rails.refreshCSRFTokens(); 10917 }); 10918 } 10919 10920})( jQuery ); 10921/**! 10922 * @fileOverview Kickass library to create and place poppers near their reference elements. 10923 * @version 1.14.5 10924 * @license 10925 * Copyright (c) 2016 Federico Zivolo and contributors 10926 * 10927 * Permission is hereby granted, free of charge, to any person obtaining a copy 10928 * of this software and associated documentation files (the "Software"), to deal 10929 * in the Software without restriction, including without limitation the rights 10930 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10931 * copies of the Software, and to permit persons to whom the Software is 10932 * furnished to do so, subject to the following conditions: 10933 * 10934 * The above copyright notice and this permission notice shall be included in all 10935 * copies or substantial portions of the Software. 10936 * 10937 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10938 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10939 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10940 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10941 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 10942 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 10943 * SOFTWARE. 10944 */ 10945 10946(function (global, factory) { 10947 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 10948 typeof define === 'function' && define.amd ? define(factory) : 10949 (global.Popper = factory()); 10950}(this, (function () { 'use strict'; 10951 10952var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined'; 10953 10954var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; 10955var timeoutDuration = 0; 10956for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { 10957 if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { 10958 timeoutDuration = 1; 10959 break; 10960 } 10961} 10962 10963function microtaskDebounce(fn) { 10964 var called = false;
vendor: 4,149 bytes, lines 10965-11129
10965 return function () { 10966 if (called) { 10967 return; 10968 } 10969 called = true; 10970 window.Promise.resolve().then(function () { 10971 called = false; 10972 fn(); 10973 }); 10974 }; 10975} 10976 10977function taskDebounce(fn) { 10978 var scheduled = false; 10979 return function () { 10980 if (!scheduled) { 10981 scheduled = true; 10982 setTimeout(function () { 10983 scheduled = false; 10984 fn(); 10985 }, timeoutDuration); 10986 } 10987 }; 10988} 10989 10990var supportsMicroTasks = isBrowser && window.Promise; 10991 10992/** 10993* Create a debounced version of a method, that's asynchronously deferred 10994* but called in the minimum time possible. 10995* 10996* @method 10997* @memberof Popper.Utils 10998* @argument {Function} fn 10999* @returns {Function} 11000*/ 11001var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce; 11002 11003/** 11004 * Check if the given variable is a function 11005 * @method 11006 * @memberof Popper.Utils 11007 * @argument {Any} functionToCheck - variable to check 11008 * @returns {Boolean} answer to: is a function? 11009 */ 11010function isFunction(functionToCheck) { 11011 var getType = {}; 11012 return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; 11013} 11014 11015/** 11016 * Get CSS computed property of the given element 11017 * @method 11018 * @memberof Popper.Utils 11019 * @argument {Eement} element 11020 * @argument {String} property 11021 */ 11022function getStyleComputedProperty(element, property) { 11023 if (element.nodeType !== 1) { 11024 return []; 11025 } 11026 // NOTE: 1 DOM access here 11027 var window = element.ownerDocument.defaultView; 11028 var css = window.getComputedStyle(element, null); 11029 return property ? css[property] : css; 11030} 11031 11032/** 11033 * Returns the parentNode or the host of the element 11034 * @method 11035 * @memberof Popper.Utils 11036 * @argument {Element} element 11037 * @returns {Element} parent 11038 */ 11039function getParentNode(element) { 11040 if (element.nodeName === 'HTML') { 11041 return element; 11042 } 11043 return element.parentNode || element.host; 11044} 11045 11046/** 11047 * Returns the scrolling parent of the given element 11048 * @method 11049 * @memberof Popper.Utils 11050 * @argument {Element} element 11051 * @returns {Element} scroll parent 11052 */ 11053function getScrollParent(element) { 11054 // Return body, `getScroll` will take care to get the correct `scrollTop` from it 11055 if (!element) { 11056 return document.body; 11057 } 11058 11059 switch (element.nodeName) { 11060 case 'HTML': 11061 case 'BODY': 11062 return element.ownerDocument.body; 11063 case '#document': 11064 return element.body; 11065 } 11066 11067 // Firefox want us to check `-x` and `-y` variations as well 11068 11069 var _getStyleComputedProp = getStyleComputedProperty(element), 11070 overflow = _getStyleComputedProp.overflow, 11071 overflowX = _getStyleComputedProp.overflowX, 11072 overflowY = _getStyleComputedProp.overflowY; 11073 11074 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { 11075 return element; 11076 } 11077 11078 return getScrollParent(getParentNode(element)); 11079} 11080 11081var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode); 11082var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent); 11083 11084/** 11085 * Determines if the browser is Internet Explorer 11086 * @method 11087 * @memberof Popper.Utils 11088 * @param {Number} version to check 11089 * @returns {Boolean} isIE 11090 */ 11091function isIE(version) { 11092 if (version === 11) { 11093 return isIE11; 11094 } 11095 if (version === 10) { 11096 return isIE10; 11097 } 11098 return isIE11 || isIE10; 11099} 11100 11101/** 11102 * Returns the offset parent of the given element 11103 * @method 11104 * @memberof Popper.Utils 11105 * @argument {Element} element 11106 * @returns {Element} offset parent 11107 */ 11108function getOffsetParent(element) { 11109 if (!element) { 11110 return document.documentElement; 11111 } 11112 11113 var noOffsetParent = isIE(10) ? document.body : null; 11114 11115 // NOTE: 1 DOM access here 11116 var offsetParent = element.offsetParent || null; 11117 // Skip hidden elements which don't have an offsetParent 11118 while (offsetParent === noOffsetParent && element.nextElementSibling) { 11119 offsetParent = (element = element.nextElementSibling).offsetParent; 11120 } 11121 11122 var nodeName = offsetParent && offsetParent.nodeName; 11123 11124 if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { 11125 return element ? element.ownerDocument.documentElement : document.documentElement; 11126 } 11127 11128 // .offsetParent will return the closest TH, TD or TABLE in case 11129 // no offsetParent is present, I hate this job...
vendor: 1,652 bytes, lines 11130-11185
11130 if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { 11131 return getOffsetParent(offsetParent); 11132 } 11133 11134 return offsetParent; 11135} 11136 11137function isOffsetContainer(element) { 11138 var nodeName = element.nodeName; 11139 11140 if (nodeName === 'BODY') { 11141 return false; 11142 } 11143 return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; 11144} 11145 11146/** 11147 * Finds the root node (document, shadowDOM root) of the given element 11148 * @method 11149 * @memberof Popper.Utils 11150 * @argument {Element} node 11151 * @returns {Element} root node 11152 */ 11153function getRoot(node) { 11154 if (node.parentNode !== null) { 11155 return getRoot(node.parentNode); 11156 } 11157 11158 return node; 11159} 11160 11161/** 11162 * Finds the offset parent common to the two provided nodes 11163 * @method 11164 * @memberof Popper.Utils 11165 * @argument {Element} element1 11166 * @argument {Element} element2 11167 * @returns {Element} common offset parent 11168 */ 11169function findCommonOffsetParent(element1, element2) { 11170 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 11171 if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { 11172 return document.documentElement; 11173 } 11174 11175 // Here we make sure to give as "start" the element that comes first in the DOM 11176 var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; 11177 var start = order ? element1 : element2; 11178 var end = order ? element2 : element1; 11179 11180 // Get common ancestor container 11181 var range = document.createRange(); 11182 range.setStart(start, 0); 11183 range.setEnd(end, 0); 11184 var commonAncestorContainer = range.commonAncestorContainer; 11185
vendor: 5,362 bytes, lines 11186-11363
11186 // Both nodes are inside #document 11187 11188 if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { 11189 if (isOffsetContainer(commonAncestorContainer)) { 11190 return commonAncestorContainer; 11191 } 11192 11193 return getOffsetParent(commonAncestorContainer); 11194 } 11195 11196 // one of the nodes is inside shadowDOM, find which one 11197 var element1root = getRoot(element1); 11198 if (element1root.host) { 11199 return findCommonOffsetParent(element1root.host, element2); 11200 } else { 11201 return findCommonOffsetParent(element1, getRoot(element2).host); 11202 } 11203} 11204 11205/** 11206 * Gets the scroll value of the given element in the given side (top and left) 11207 * @method 11208 * @memberof Popper.Utils 11209 * @argument {Element} element 11210 * @argument {String} side `top` or `left` 11211 * @returns {number} amount of scrolled pixels 11212 */ 11213function getScroll(element) { 11214 var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; 11215 11216 var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; 11217 var nodeName = element.nodeName; 11218 11219 if (nodeName === 'BODY' || nodeName === 'HTML') { 11220 var html = element.ownerDocument.documentElement; 11221 var scrollingElement = element.ownerDocument.scrollingElement || html; 11222 return scrollingElement[upperSide]; 11223 } 11224 11225 return element[upperSide]; 11226} 11227 11228/* 11229 * Sum or subtract the element scroll values (left and top) from a given rect object 11230 * @method 11231 * @memberof Popper.Utils 11232 * @param {Object} rect - Rect object you want to change 11233 * @param {HTMLElement} element - The element from the function reads the scroll values 11234 * @param {Boolean} subtract - set to true if you want to subtract the scroll values 11235 * @return {Object} rect - The modifier rect object 11236 */ 11237function includeScroll(rect, element) { 11238 var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 11239 11240 var scrollTop = getScroll(element, 'top'); 11241 var scrollLeft = getScroll(element, 'left'); 11242 var modifier = subtract ? -1 : 1; 11243 rect.top += scrollTop * modifier; 11244 rect.bottom += scrollTop * modifier; 11245 rect.left += scrollLeft * modifier; 11246 rect.right += scrollLeft * modifier; 11247 return rect; 11248} 11249 11250/* 11251 * Helper to detect borders of a given element 11252 * @method 11253 * @memberof Popper.Utils 11254 * @param {CSSStyleDeclaration} styles 11255 * Result of `getStyleComputedProperty` on the given element 11256 * @param {String} axis - `x` or `y` 11257 * @return {number} borders - The borders size of the given axis 11258 */ 11259 11260function getBordersSize(styles, axis) { 11261 var sideA = axis === 'x' ? 'Left' : 'Top'; 11262 var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; 11263 11264 return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10); 11265} 11266 11267function getSize(axis, body, html, computedStyle) { 11268 return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0); 11269} 11270 11271function getWindowSizes(document) { 11272 var body = document.body; 11273 var html = document.documentElement; 11274 var computedStyle = isIE(10) && getComputedStyle(html); 11275 11276 return { 11277 height: getSize('Height', body, html, computedStyle), 11278 width: getSize('Width', body, html, computedStyle) 11279 }; 11280} 11281 11282var classCallCheck = function (instance, Constructor) { 11283 if (!(instance instanceof Constructor)) { 11284 throw new TypeError("Cannot call a class as a function"); 11285 } 11286}; 11287 11288var createClass = function () { 11289 function defineProperties(target, props) { 11290 for (var i = 0; i < props.length; i++) { 11291 var descriptor = props[i]; 11292 descriptor.enumerable = descriptor.enumerable || false; 11293 descriptor.configurable = true; 11294 if ("value" in descriptor) descriptor.writable = true; 11295 Object.defineProperty(target, descriptor.key, descriptor); 11296 } 11297 } 11298 11299 return function (Constructor, protoProps, staticProps) { 11300 if (protoProps) defineProperties(Constructor.prototype, protoProps); 11301 if (staticProps) defineProperties(Constructor, staticProps); 11302 return Constructor; 11303 }; 11304}(); 11305 11306 11307 11308 11309 11310var defineProperty = function (obj, key, value) { 11311 if (key in obj) { 11312 Object.defineProperty(obj, key, { 11313 value: value, 11314 enumerable: true, 11315 configurable: true, 11316 writable: true 11317 }); 11318 } else { 11319 obj[key] = value; 11320 } 11321 11322 return obj; 11323}; 11324 11325var _extends = Object.assign || function (target) { 11326 for (var i = 1; i < arguments.length; i++) { 11327 var source = arguments[i]; 11328 11329 for (var key in source) { 11330 if (Object.prototype.hasOwnProperty.call(source, key)) { 11331 target[key] = source[key]; 11332 } 11333 } 11334 } 11335 11336 return target; 11337}; 11338 11339/** 11340 * Given element offsets, generate an output similar to getBoundingClientRect 11341 * @method 11342 * @memberof Popper.Utils 11343 * @argument {Object} offsets 11344 * @returns {Object} ClientRect like output 11345 */ 11346function getClientRect(offsets) { 11347 return _extends({}, offsets, { 11348 right: offsets.left + offsets.width, 11349 bottom: offsets.top + offsets.height 11350 }); 11351} 11352 11353/** 11354 * Get bounding client rect of given element 11355 * @method 11356 * @memberof Popper.Utils 11357 * @param {HTMLElement} element 11358 * @return {Object} client rect 11359 */ 11360function getBoundingClientRect(element) { 11361 var rect = {}; 11362 11363 // IE10 10 FIX: Please, don't ask, the element isn't
vendor: 4,668 bytes, lines 11364-11493
11364 // considered in DOM in some circumstances... 11365 // This isn't reproducible in IE10 compatibility mode of IE11 11366 try { 11367 if (isIE(10)) { 11368 rect = element.getBoundingClientRect(); 11369 var scrollTop = getScroll(element, 'top'); 11370 var scrollLeft = getScroll(element, 'left'); 11371 rect.top += scrollTop; 11372 rect.left += scrollLeft; 11373 rect.bottom += scrollTop; 11374 rect.right += scrollLeft; 11375 } else { 11376 rect = element.getBoundingClientRect(); 11377 } 11378 } catch (e) {} 11379 11380 var result = { 11381 left: rect.left, 11382 top: rect.top, 11383 width: rect.right - rect.left, 11384 height: rect.bottom - rect.top 11385 }; 11386 11387 // subtract scrollbar size from sizes 11388 var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {}; 11389 var width = sizes.width || element.clientWidth || result.right - result.left; 11390 var height = sizes.height || element.clientHeight || result.bottom - result.top; 11391 11392 var horizScrollbar = element.offsetWidth - width; 11393 var vertScrollbar = element.offsetHeight - height; 11394 11395 // if an hypothetical scrollbar is detected, we must be sure it's not a `border` 11396 // we make this check conditional for performance reasons 11397 if (horizScrollbar || vertScrollbar) { 11398 var styles = getStyleComputedProperty(element); 11399 horizScrollbar -= getBordersSize(styles, 'x'); 11400 vertScrollbar -= getBordersSize(styles, 'y'); 11401 11402 result.width -= horizScrollbar; 11403 result.height -= vertScrollbar; 11404 } 11405 11406 return getClientRect(result); 11407} 11408 11409function getOffsetRectRelativeToArbitraryNode(children, parent) { 11410 var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 11411 11412 var isIE10 = isIE(10); 11413 var isHTML = parent.nodeName === 'HTML'; 11414 var childrenRect = getBoundingClientRect(children); 11415 var parentRect = getBoundingClientRect(parent); 11416 var scrollParent = getScrollParent(children); 11417 11418 var styles = getStyleComputedProperty(parent); 11419 var borderTopWidth = parseFloat(styles.borderTopWidth, 10); 11420 var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10); 11421 11422 // In cases where the parent is fixed, we must ignore negative scroll in offset calc 11423 if (fixedPosition && isHTML) { 11424 parentRect.top = Math.max(parentRect.top, 0); 11425 parentRect.left = Math.max(parentRect.left, 0); 11426 } 11427 var offsets = getClientRect({ 11428 top: childrenRect.top - parentRect.top - borderTopWidth, 11429 left: childrenRect.left - parentRect.left - borderLeftWidth, 11430 width: childrenRect.width, 11431 height: childrenRect.height 11432 }); 11433 offsets.marginTop = 0; 11434 offsets.marginLeft = 0; 11435 11436 // Subtract margins of documentElement in case it's being used as parent 11437 // we do this only on HTML because it's the only element that behaves 11438 // differently when margins are applied to it. The margins are included in 11439 // the box of the documentElement, in the other cases not. 11440 if (!isIE10 && isHTML) { 11441 var marginTop = parseFloat(styles.marginTop, 10); 11442 var marginLeft = parseFloat(styles.marginLeft, 10); 11443 11444 offsets.top -= borderTopWidth - marginTop; 11445 offsets.bottom -= borderTopWidth - marginTop; 11446 offsets.left -= borderLeftWidth - marginLeft; 11447 offsets.right -= borderLeftWidth - marginLeft; 11448 11449 // Attach marginTop and marginLeft because in some circumstances we may need them 11450 offsets.marginTop = marginTop; 11451 offsets.marginLeft = marginLeft; 11452 } 11453 11454 if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { 11455 offsets = includeScroll(offsets, parent); 11456 } 11457 11458 return offsets; 11459} 11460 11461function getViewportOffsetRectRelativeToArtbitraryNode(element) { 11462 var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 11463 11464 var html = element.ownerDocument.documentElement; 11465 var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); 11466 var width = Math.max(html.clientWidth, window.innerWidth || 0); 11467 var height = Math.max(html.clientHeight, window.innerHeight || 0); 11468 11469 var scrollTop = !excludeScroll ? getScroll(html) : 0; 11470 var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0; 11471 11472 var offset = { 11473 top: scrollTop - relativeOffset.top + relativeOffset.marginTop, 11474 left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, 11475 width: width, 11476 height: height 11477 }; 11478 11479 return getClientRect(offset); 11480} 11481 11482/** 11483 * Check if the given element is fixed or is inside a fixed parent 11484 * @method 11485 * @memberof Popper.Utils 11486 * @argument {Element} element 11487 * @argument {Element} customContainer 11488 * @returns {Boolean} answer to "isFixed?" 11489 */ 11490function isFixed(element) { 11491 var nodeName = element.nodeName; 11492 if (nodeName === 'BODY' || nodeName === 'HTML') { 11493 return false;
vendor: 5,444 bytes, lines 11494-11661
11494 } 11495 if (getStyleComputedProperty(element, 'position') === 'fixed') { 11496 return true; 11497 } 11498 return isFixed(getParentNode(element)); 11499} 11500 11501/** 11502 * Finds the first parent of an element that has a transformed property defined 11503 * @method 11504 * @memberof Popper.Utils 11505 * @argument {Element} element 11506 * @returns {Element} first transformed parent or documentElement 11507 */ 11508 11509function getFixedPositionOffsetParent(element) { 11510 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 11511 if (!element || !element.parentElement || isIE()) { 11512 return document.documentElement; 11513 } 11514 var el = element.parentElement; 11515 while (el && getStyleComputedProperty(el, 'transform') === 'none') { 11516 el = el.parentElement; 11517 } 11518 return el || document.documentElement; 11519} 11520 11521/** 11522 * Computed the boundaries limits and return them 11523 * @method 11524 * @memberof Popper.Utils 11525 * @param {HTMLElement} popper 11526 * @param {HTMLElement} reference 11527 * @param {number} padding 11528 * @param {HTMLElement} boundariesElement - Element used to define the boundaries 11529 * @param {Boolean} fixedPosition - Is in fixed position mode 11530 * @returns {Object} Coordinates of the boundaries 11531 */ 11532function getBoundaries(popper, reference, padding, boundariesElement) { 11533 var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; 11534 11535 // NOTE: 1 DOM access here 11536 11537 var boundaries = { top: 0, left: 0 }; 11538 var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference); 11539 11540 // Handle viewport case 11541 if (boundariesElement === 'viewport') { 11542 boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition); 11543 } else { 11544 // Handle other cases based on DOM element used as boundaries 11545 var boundariesNode = void 0; 11546 if (boundariesElement === 'scrollParent') { 11547 boundariesNode = getScrollParent(getParentNode(reference)); 11548 if (boundariesNode.nodeName === 'BODY') { 11549 boundariesNode = popper.ownerDocument.documentElement; 11550 } 11551 } else if (boundariesElement === 'window') { 11552 boundariesNode = popper.ownerDocument.documentElement; 11553 } else { 11554 boundariesNode = boundariesElement; 11555 } 11556 11557 var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); 11558 11559 // In case of HTML, we need a different computation 11560 if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { 11561 var _getWindowSizes = getWindowSizes(popper.ownerDocument), 11562 height = _getWindowSizes.height, 11563 width = _getWindowSizes.width; 11564 11565 boundaries.top += offsets.top - offsets.marginTop; 11566 boundaries.bottom = height + offsets.top; 11567 boundaries.left += offsets.left - offsets.marginLeft; 11568 boundaries.right = width + offsets.left; 11569 } else { 11570 // for all the other DOM elements, this one is good 11571 boundaries = offsets; 11572 } 11573 } 11574 11575 // Add paddings 11576 padding = padding || 0; 11577 var isPaddingNumber = typeof padding === 'number'; 11578 boundaries.left += isPaddingNumber ? padding : padding.left || 0; 11579 boundaries.top += isPaddingNumber ? padding : padding.top || 0; 11580 boundaries.right -= isPaddingNumber ? padding : padding.right || 0; 11581 boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; 11582 11583 return boundaries; 11584} 11585 11586function getArea(_ref) { 11587 var width = _ref.width, 11588 height = _ref.height; 11589 11590 return width * height; 11591} 11592 11593/** 11594 * Utility used to transform the `auto` placement to the placement with more 11595 * available space. 11596 * @method 11597 * @memberof Popper.Utils 11598 * @argument {Object} data - The data object generated by update method 11599 * @argument {Object} options - Modifiers configuration and options 11600 * @returns {Object} The data object, properly modified 11601 */ 11602function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { 11603 var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; 11604 11605 if (placement.indexOf('auto') === -1) { 11606 return placement; 11607 } 11608 11609 var boundaries = getBoundaries(popper, reference, padding, boundariesElement); 11610 11611 var rects = { 11612 top: { 11613 width: boundaries.width, 11614 height: refRect.top - boundaries.top 11615 }, 11616 right: { 11617 width: boundaries.right - refRect.right, 11618 height: boundaries.height 11619 }, 11620 bottom: { 11621 width: boundaries.width, 11622 height: boundaries.bottom - refRect.bottom 11623 }, 11624 left: { 11625 width: refRect.left - boundaries.left, 11626 height: boundaries.height 11627 } 11628 }; 11629 11630 var sortedAreas = Object.keys(rects).map(function (key) { 11631 return _extends({ 11632 key: key 11633 }, rects[key], { 11634 area: getArea(rects[key]) 11635 }); 11636 }).sort(function (a, b) { 11637 return b.area - a.area; 11638 }); 11639 11640 var filteredAreas = sortedAreas.filter(function (_ref2) { 11641 var width = _ref2.width, 11642 height = _ref2.height; 11643 return width >= popper.clientWidth && height >= popper.clientHeight; 11644 }); 11645 11646 var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; 11647 11648 var variation = placement.split('-')[1]; 11649 11650 return computedPlacement + (variation ? '-' + variation : ''); 11651} 11652 11653/** 11654 * Get offsets to the reference element 11655 * @method 11656 * @memberof Popper.Utils 11657 * @param {Object} state 11658 * @param {Element} popper - the popper element 11659 * @param {Element} reference - the reference element (the popper will be relative to this) 11660 * @param {Element} fixedPosition - is in fixed position mode 11661 * @returns {Object}
vendor: 8,436 bytes, lines 11661-11928
11661 An object containing the offsets which will be applied to the popper 11662 */ 11663function getReferenceOffsets(state, popper, reference) { 11664 var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 11665 11666 var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference); 11667 return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition); 11668} 11669 11670/** 11671 * Get the outer sizes of the given element (offset size + margins) 11672 * @method 11673 * @memberof Popper.Utils 11674 * @argument {Element} element 11675 * @returns {Object} object containing width and height properties 11676 */ 11677function getOuterSizes(element) { 11678 var window = element.ownerDocument.defaultView; 11679 var styles = window.getComputedStyle(element); 11680 var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom); 11681 var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight); 11682 var result = { 11683 width: element.offsetWidth + y, 11684 height: element.offsetHeight + x 11685 }; 11686 return result; 11687} 11688 11689/** 11690 * Get the opposite placement of the given one 11691 * @method 11692 * @memberof Popper.Utils 11693 * @argument {String} placement 11694 * @returns {String} flipped placement 11695 */ 11696function getOppositePlacement(placement) { 11697 var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; 11698 return placement.replace(/left|right|bottom|top/g, function (matched) { 11699 return hash[matched]; 11700 }); 11701} 11702 11703/** 11704 * Get offsets to the popper 11705 * @method 11706 * @memberof Popper.Utils 11707 * @param {Object} position - CSS position the Popper will get applied 11708 * @param {HTMLElement} popper - the popper element 11709 * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) 11710 * @param {String} placement - one of the valid placement options 11711 * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper 11712 */ 11713function getPopperOffsets(popper, referenceOffsets, placement) { 11714 placement = placement.split('-')[0]; 11715 11716 // Get popper node sizes 11717 var popperRect = getOuterSizes(popper); 11718 11719 // Add position, width and height to our offsets object 11720 var popperOffsets = { 11721 width: popperRect.width, 11722 height: popperRect.height 11723 }; 11724 11725 // depending by the popper placement we have to compute its offsets slightly differently 11726 var isHoriz = ['right', 'left'].indexOf(placement) !== -1; 11727 var mainSide = isHoriz ? 'top' : 'left'; 11728 var secondarySide = isHoriz ? 'left' : 'top'; 11729 var measurement = isHoriz ? 'height' : 'width'; 11730 var secondaryMeasurement = !isHoriz ? 'height' : 'width'; 11731 11732 popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; 11733 if (placement === secondarySide) { 11734 popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; 11735 } else { 11736 popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; 11737 } 11738 11739 return popperOffsets; 11740} 11741 11742/** 11743 * Mimics the `find` method of Array 11744 * @method 11745 * @memberof Popper.Utils 11746 * @argument {Array} arr 11747 * @argument prop 11748 * @argument value 11749 * @returns index or -1 11750 */ 11751function find(arr, check) { 11752 // use native find if supported 11753 if (Array.prototype.find) { 11754 return arr.find(check); 11755 } 11756 11757 // use `filter` to obtain the same behavior of `find` 11758 return arr.filter(check)[0]; 11759} 11760 11761/** 11762 * Return the index of the matching object 11763 * @method 11764 * @memberof Popper.Utils 11765 * @argument {Array} arr 11766 * @argument prop 11767 * @argument value 11768 * @returns index or -1 11769 */ 11770function findIndex(arr, prop, value) { 11771 // use native findIndex if supported 11772 if (Array.prototype.findIndex) { 11773 return arr.findIndex(function (cur) { 11774 return cur[prop] === value; 11775 }); 11776 } 11777 11778 // use `find` + `indexOf` if `findIndex` isn't supported 11779 var match = find(arr, function (obj) { 11780 return obj[prop] === value; 11781 }); 11782 return arr.indexOf(match); 11783} 11784 11785/** 11786 * Loop trough the list of modifiers and run them in order, 11787 * each of them will then edit the data object. 11788 * @method 11789 * @memberof Popper.Utils 11790 * @param {dataObject} data 11791 * @param {Array} modifiers 11792 * @param {String} ends - Optional modifier name used as stopper 11793 * @returns {dataObject} 11794 */ 11795function runModifiers(modifiers, data, ends) { 11796 var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); 11797 11798 modifiersToRun.forEach(function (modifier) { 11799 if (modifier['function']) { 11800 // eslint-disable-line dot-notation 11801 console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); 11802 } 11803 var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation 11804 if (modifier.enabled && isFunction(fn)) { 11805 // Add properties to offsets to make them a complete clientRect object 11806 // we do this before each modifier to make sure the previous one doesn't 11807 // mess with these values 11808 data.offsets.popper = getClientRect(data.offsets.popper); 11809 data.offsets.reference = getClientRect(data.offsets.reference); 11810 11811 data = fn(data, modifier); 11812 } 11813 }); 11814 11815 return data; 11816} 11817 11818/** 11819 * Updates the position of the popper, computing the new offsets and applying 11820 * the new style.<br /> 11821 * Prefer `scheduleUpdate` over `update` because of performance reasons. 11822 * @method 11823 * @memberof Popper 11824 */ 11825function update() { 11826 // if popper is destroyed, don't perform any further update 11827 if (this.state.isDestroyed) { 11828 return; 11829 } 11830 11831 var data = { 11832 instance: this, 11833 styles: {}, 11834 arrowStyles: {}, 11835 attributes: {}, 11836 flipped: false, 11837 offsets: {} 11838 }; 11839 11840 // compute reference element offsets 11841 data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); 11842 11843 // compute auto placement, store placement inside the data object, 11844 // modifiers will be able to edit `placement` if needed 11845 // and refer to originalPlacement to know the original value 11846 data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); 11847 11848 // store the computed placement inside `originalPlacement` 11849 data.originalPlacement = data.placement; 11850 11851 data.positionFixed = this.options.positionFixed; 11852 11853 // compute the popper offsets 11854 data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); 11855 11856 data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; 11857 11858 // run the modifiers 11859 data = runModifiers(this.modifiers, data); 11860 11861 // the first `update` will call `onCreate` callback 11862 // the other ones will call `onUpdate` callback 11863 if (!this.state.isCreated) { 11864 this.state.isCreated = true; 11865 this.options.onCreate(data); 11866 } else { 11867 this.options.onUpdate(data); 11868 } 11869} 11870 11871/** 11872 * Helper used to know if the given modifier is enabled. 11873 * @method 11874 * @memberof Popper.Utils 11875 * @returns {Boolean} 11876 */ 11877function isModifierEnabled(modifiers, modifierName) { 11878 return modifiers.some(function (_ref) { 11879 var name = _ref.name, 11880 enabled = _ref.enabled; 11881 return enabled && name === modifierName; 11882 }); 11883} 11884 11885/** 11886 * Get the prefixed supported property name 11887 * @method 11888 * @memberof Popper.Utils 11889 * @argument {String} property (camelCase) 11890 * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) 11891 */ 11892function getSupportedPropertyName(property) { 11893 var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; 11894 var upperProp = property.charAt(0).toUpperCase() + property.slice(1); 11895 11896 for (var i = 0; i < prefixes.length; i++) { 11897 var prefix = prefixes[i]; 11898 var toCheck = prefix ? '' + prefix + upperProp : property; 11899 if (typeof document.body.style[toCheck] !== 'undefined') { 11900 return toCheck; 11901 } 11902 } 11903 return null; 11904} 11905 11906/** 11907 * Destroys the popper. 11908 * @method 11909 * @memberof Popper 11910 */ 11911function destroy() { 11912 this.state.isDestroyed = true; 11913 11914 // touch DOM only if `applyStyle` modifier is enabled 11915 if (isModifierEnabled(this.modifiers, 'applyStyle')) { 11916 this.popper.removeAttribute('x-placement'); 11917 this.popper.style.position = ''; 11918 this.popper.style.top = ''; 11919 this.popper.style.left = ''; 11920 this.popper.style.right = ''; 11921 this.popper.style.bottom = ''; 11922 this.popper.style.willChange = ''; 11923 this.popper.style[getSupportedPropertyName('transform')] = ''; 11924 } 11925 11926 this.disableEventListeners(); 11927 11928 // remove the popper if user explicit
vendor: 6,754 bytes, lines 11928-12133
11928y asked for the deletion on destroy 11929 // do not use `remove` because IE11 doesn't support it 11930 if (this.options.removeOnDestroy) { 11931 this.popper.parentNode.removeChild(this.popper); 11932 } 11933 return this; 11934} 11935 11936/** 11937 * Get the window associated with the element 11938 * @argument {Element} element 11939 * @returns {Window} 11940 */ 11941function getWindow(element) { 11942 var ownerDocument = element.ownerDocument; 11943 return ownerDocument ? ownerDocument.defaultView : window; 11944} 11945 11946function attachToScrollParents(scrollParent, event, callback, scrollParents) { 11947 var isBody = scrollParent.nodeName === 'BODY'; 11948 var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; 11949 target.addEventListener(event, callback, { passive: true }); 11950 11951 if (!isBody) { 11952 attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); 11953 } 11954 scrollParents.push(target); 11955} 11956 11957/** 11958 * Setup needed event listeners used to update the popper position 11959 * @method 11960 * @memberof Popper.Utils 11961 * @private 11962 */ 11963function setupEventListeners(reference, options, state, updateBound) { 11964 // Resize event listener on window 11965 state.updateBound = updateBound; 11966 getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); 11967 11968 // Scroll event listener on scroll parents 11969 var scrollElement = getScrollParent(reference); 11970 attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); 11971 state.scrollElement = scrollElement; 11972 state.eventsEnabled = true; 11973 11974 return state; 11975} 11976 11977/** 11978 * It will add resize/scroll events and start recalculating 11979 * position of the popper element when they are triggered. 11980 * @method 11981 * @memberof Popper 11982 */ 11983function enableEventListeners() { 11984 if (!this.state.eventsEnabled) { 11985 this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); 11986 } 11987} 11988 11989/** 11990 * Remove event listeners used to update the popper position 11991 * @method 11992 * @memberof Popper.Utils 11993 * @private 11994 */ 11995function removeEventListeners(reference, state) { 11996 // Remove resize event listener on window 11997 getWindow(reference).removeEventListener('resize', state.updateBound); 11998 11999 // Remove scroll event listener on scroll parents 12000 state.scrollParents.forEach(function (target) { 12001 target.removeEventListener('scroll', state.updateBound); 12002 }); 12003 12004 // Reset state 12005 state.updateBound = null; 12006 state.scrollParents = []; 12007 state.scrollElement = null; 12008 state.eventsEnabled = false; 12009 return state; 12010} 12011 12012/** 12013 * It will remove resize/scroll events and won't recalculate popper position 12014 * when they are triggered. It also won't trigger `onUpdate` callback anymore, 12015 * unless you call `update` method manually. 12016 * @method 12017 * @memberof Popper 12018 */ 12019function disableEventListeners() { 12020 if (this.state.eventsEnabled) { 12021 cancelAnimationFrame(this.scheduleUpdate); 12022 this.state = removeEventListeners(this.reference, this.state); 12023 } 12024} 12025 12026/** 12027 * Tells if a given input is a number 12028 * @method 12029 * @memberof Popper.Utils 12030 * @param {*} input to check 12031 * @return {Boolean} 12032 */ 12033function isNumeric(n) { 12034 return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); 12035} 12036 12037/** 12038 * Set the style to the given popper 12039 * @method 12040 * @memberof Popper.Utils 12041 * @argument {Element} element - Element to apply the style to 12042 * @argument {Object} styles 12043 * Object with a list of properties and values which will be applied to the element 12044 */ 12045function setStyles(element, styles) { 12046 Object.keys(styles).forEach(function (prop) { 12047 var unit = ''; 12048 // add unit if the value is numeric and is one of the following 12049 if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { 12050 unit = 'px'; 12051 } 12052 element.style[prop] = styles[prop] + unit; 12053 }); 12054} 12055 12056/** 12057 * Set the attributes to the given popper 12058 * @method 12059 * @memberof Popper.Utils 12060 * @argument {Element} element - Element to apply the attributes to 12061 * @argument {Object} styles 12062 * Object with a list of properties and values which will be applied to the element 12063 */ 12064function setAttributes(element, attributes) { 12065 Object.keys(attributes).forEach(function (prop) { 12066 var value = attributes[prop]; 12067 if (value !== false) { 12068 element.setAttribute(prop, attributes[prop]); 12069 } else { 12070 element.removeAttribute(prop); 12071 } 12072 }); 12073} 12074 12075/** 12076 * @function 12077 * @memberof Modifiers 12078 * @argument {Object} data - The data object generated by `update` method 12079 * @argument {Object} data.styles - List of style properties - values to apply to popper element 12080 * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element 12081 * @argument {Object} options - Modifiers configuration and options 12082 * @returns {Object} The same data object 12083 */ 12084function applyStyle(data) { 12085 // any property present in `data.styles` will be applied to the popper, 12086 // in this way we can make the 3rd party modifiers add custom styles to it 12087 // Be aware, modifiers could override the properties defined in the previous 12088 // lines of this modifier! 12089 setStyles(data.instance.popper, data.styles); 12090 12091 // any property present in `data.attributes` will be applied to the popper, 12092 // they will be set as HTML attributes of the element 12093 setAttributes(data.instance.popper, data.attributes); 12094 12095 // if arrowElement is defined and arrowStyles has some properties 12096 if (data.arrowElement && Object.keys(data.arrowStyles).length) { 12097 setStyles(data.arrowElement, data.arrowStyles); 12098 } 12099 12100 return data; 12101} 12102 12103/** 12104 * Set the x-placement attribute before everything else because it could be used 12105 * to add margins to the popper margins needs to be calculated to get the 12106 * correct popper offsets. 12107 * @method 12108 * @memberof Popper.modifiers 12109 * @param {HTMLElement} reference - The reference element used to position the popper 12110 * @param {HTMLElement} popper - The HTML element used as popper 12111 * @param {Object} options - Popper.js options 12112 */ 12113function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { 12114 // compute reference element offsets 12115 var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed); 12116 12117 // compute auto placement, store placement inside the data object, 12118 // modifiers will be able to edit `placement` if needed 12119 // and refer to originalPlacement to know the original value 12120 var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); 12121 12122 popper.setAttribute('x-placement', placement); 12123 12124 // Apply `position` to popper before anything else because 12125 // without the position applied we can't guarantee correct computations 12126 setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' }); 12127 12128 return options; 12129} 12130 12131/** 12132 * @function 12133 * @memberof
12133Modifiers 12134 * @argument {Object} data - The data object generated by `update` method 12135 * @argument {Object} options - Modifiers configuration and options 12136 * @returns {Object} The data object, properly modified 12137 */ 12138function computeStyle(data, options) { 12139 var x = options.x, 12140 y = options.y; 12141 var popper = data.offsets.popper; 12142 12143 // Remove this legacy support in Popper.js v2 12144 12145 var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { 12146 return modifier.name === 'applyStyle'; 12147 }).gpuAcceleration; 12148 if (legacyGpuAccelerationOption !== undefined) { 12149 console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); 12150 } 12151 var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; 12152 12153 var offsetParent = getOffsetParent(data.instance.popper); 12154 var offsetParentRect = getBoundingClientRect(offsetParent); 12155 12156 // Styles 12157 var styles = { 12158 position: popper.position 12159 }; 12160 12161 // Avoid blurry text by using full pixel integers. 12162 // For pixel-perfect positioning, top/bottom prefers rounded 12163 // values, while left/right prefers floored values. 12164 var offsets = { 12165 left: Math.floor(popper.left), 12166 top: Math.round(popper.top), 12167 bottom: Math.round(popper.bottom), 12168 right: Math.floor(popper.right) 12169 }; 12170 12171 var sideA = x === 'bottom' ? 'top' : 'bottom'; 12172 var sideB = y === 'right' ? 'left' : 'right'; 12173 12174 // if gpuAcceleration is set to `true` and transform is supported, 12175 // we use `translate3d` to apply the position to the popper we 12176 // automatically use the supported prefixed version if needed 12177 var prefixedProperty = getSupportedPropertyName('transform'); 12178 12179 // now, let's make a step back and look at this code closely (wtf?) 12180 // If the content of the popper grows once it's been positioned, it 12181 // may happen that the popper gets misplaced because of the new content 12182 // overflowing its reference element 12183 // To avoid this problem, we provide two options (x and y), which allow 12184 // the consumer to define the offset origin. 12185 // If we position a popper on top of a reference element, we can set 12186 // `x` to `top` to make the popper grow towards its top instead of 12187 // its bottom. 12188 var left = void 0, 12189 top = void 0; 12190 if (sideA === 'bottom') { 12191 // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar) 12192 // and not the bottom of the html element 12193 if (offsetParent.nodeName === 'HTML') { 12194 top = -offsetParent.clientHeight + offsets.bottom; 12195 } else { 12196 top = -offsetParentRect.height + offsets.bottom; 12197 } 12198 } else { 12199 top = offsets.top; 12200 } 12201 if (sideB === 'right') {
vendor: 5,843 bytes, lines 12202-12373
12202 if (offsetParent.nodeName === 'HTML') { 12203 left = -offsetParent.clientWidth + offsets.right; 12204 } else { 12205 left = -offsetParentRect.width + offsets.right; 12206 } 12207 } else { 12208 left = offsets.left; 12209 } 12210 if (gpuAcceleration && prefixedProperty) { 12211 styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; 12212 styles[sideA] = 0; 12213 styles[sideB] = 0; 12214 styles.willChange = 'transform'; 12215 } else { 12216 // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties 12217 var invertTop = sideA === 'bottom' ? -1 : 1; 12218 var invertLeft = sideB === 'right' ? -1 : 1; 12219 styles[sideA] = top * invertTop; 12220 styles[sideB] = left * invertLeft; 12221 styles.willChange = sideA + ', ' + sideB; 12222 } 12223 12224 // Attributes 12225 var attributes = { 12226 'x-placement': data.placement 12227 }; 12228 12229 // Update `data` attributes, styles and arrowStyles 12230 data.attributes = _extends({}, attributes, data.attributes); 12231 data.styles = _extends({}, styles, data.styles); 12232 data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); 12233 12234 return data; 12235} 12236 12237/** 12238 * Helper used to know if the given modifier depends from another one.<br /> 12239 * It checks if the needed modifier is listed and enabled. 12240 * @method 12241 * @memberof Popper.Utils 12242 * @param {Array} modifiers - list of modifiers 12243 * @param {String} requestingName - name of requesting modifier 12244 * @param {String} requestedName - name of requested modifier 12245 * @returns {Boolean} 12246 */ 12247function isModifierRequired(modifiers, requestingName, requestedName) { 12248 var requesting = find(modifiers, function (_ref) { 12249 var name = _ref.name; 12250 return name === requestingName; 12251 }); 12252 12253 var isRequired = !!requesting && modifiers.some(function (modifier) { 12254 return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; 12255 }); 12256 12257 if (!isRequired) { 12258 var _requesting = '`' + requestingName + '`'; 12259 var requested = '`' + requestedName + '`'; 12260 console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); 12261 } 12262 return isRequired; 12263} 12264 12265/** 12266 * @function 12267 * @memberof Modifiers 12268 * @argument {Object} data - The data object generated by update method 12269 * @argument {Object} options - Modifiers configuration and options 12270 * @returns {Object} The data object, properly modified 12271 */ 12272function arrow(data, options) { 12273 var _data$offsets$arrow; 12274 12275 // arrow depends on keepTogether in order to work 12276 if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { 12277 return data; 12278 } 12279 12280 var arrowElement = options.element; 12281 12282 // if arrowElement is a string, suppose it's a CSS selector 12283 if (typeof arrowElement === 'string') { 12284 arrowElement = data.instance.popper.querySelector(arrowElement); 12285 12286 // if arrowElement is not found, don't run the modifier 12287 if (!arrowElement) { 12288 return data; 12289 } 12290 } else { 12291 // if the arrowElement isn't a query selector we must check that the 12292 // provided DOM node is child of its popper node 12293 if (!data.instance.popper.contains(arrowElement)) { 12294 console.warn('WARNING: `arrow.element` must be child of its popper element!'); 12295 return data; 12296 } 12297 } 12298 12299 var placement = data.placement.split('-')[0]; 12300 var _data$offsets = data.offsets, 12301 popper = _data$offsets.popper, 12302 reference = _data$offsets.reference; 12303 12304 var isVertical = ['left', 'right'].indexOf(placement) !== -1; 12305 12306 var len = isVertical ? 'height' : 'width'; 12307 var sideCapitalized = isVertical ? 'Top' : 'Left'; 12308 var side = sideCapitalized.toLowerCase(); 12309 var altSide = isVertical ? 'left' : 'top'; 12310 var opSide = isVertical ? 'bottom' : 'right'; 12311 var arrowElementSize = getOuterSizes(arrowElement)[len]; 12312 12313 // 12314 // extends keepTogether behavior making sure the popper and its 12315 // reference have enough pixels in conjunction 12316 // 12317 12318 // top/left side 12319 if (reference[opSide] - arrowElementSize < popper[side]) { 12320 data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); 12321 } 12322 // bottom/right side 12323 if (reference[side] + arrowElementSize > popper[opSide]) { 12324 data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; 12325 } 12326 data.offsets.popper = getClientRect(data.offsets.popper); 12327 12328 // compute center of the popper 12329 var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; 12330 12331 // Compute the sideValue using the updated popper offsets 12332 // take popper margin in account because we don't have this info available 12333 var css = getStyleComputedProperty(data.instance.popper); 12334 var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10); 12335 var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10); 12336 var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; 12337 12338 // prevent arrowElement from being placed not contiguously to its popper 12339 sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); 12340 12341 data.arrowElement = arrowElement; 12342 data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow); 12343 12344 return data; 12345} 12346 12347/** 12348 * Get the opposite placement variation of the given one 12349 * @method 12350 * @memberof Popper.Utils 12351 * @argument {String} placement variation 12352 * @returns {String} flipped placement variation 12353 */ 12354function getOppositeVariation(variation) { 12355 if (variation === 'end') { 12356 return 'start'; 12357 } else if (variation === 'start') { 12358 return 'end'; 12359 } 12360 return variation; 12361} 12362 12363/** 12364 * List of accepted placements to use as values of the `placement` option.<br /> 12365 * Valid placements are: 12366 * - `auto` 12367 * - `top` 12368 * - `right` 12369 * - `bottom` 12370 * - `left` 12371 * 12372 * Each placement can have a variation from this list: 12373 * - `-start`
12374 * - `-end` 12375 * 12376 * Variations are interpreted easily if you think of them as the left to right 12377 * written languages. Horizontally (`top` and `bottom`), `start` is left and `end` 12378 * is right.<br /> 12379 * Vertically (`left` and `right`), `start` is top and `end` is bottom. 12380 * 12381 * Some valid examples are: 12382 * - `top-end` (on top of reference, right aligned) 12383 * - `right-start` (on right of reference, top aligned) 12384 * - `bottom` (on bottom, centered) 12385 * - `auto-end` (on the side with more space available, alignment depends by placement) 12386 * 12387 * @static 12388 * @type {Array} 12389 * @enum {String} 12390 * @readonly 12391 * @method placements 12392 * @memberof Popper 12393 */ 12394var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']; 12395 12396// Get rid of `auto` `auto-start` and `auto-end` 12397var validPlacements = placements.slice(3); 12398 12399/** 12400 * Given an initial placement, returns all the subsequent placements 12401 * clockwise (or counter-clockwise). 12402 * 12403 * @method 12404 * @memberof Popper.Utils 12405 * @argument {String} placement - A valid placement (it accepts variations) 12406 * @argument {Boolean} counter - Set to true to walk the placements counterclockwise 12407 * @returns {Array} placements including their variations 12408 */ 12409function clockwise(placement) { 12410 var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 12411 12412 var index = validPlacements.indexOf(placement); 12413 var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); 12414 return counter ? arr.reverse() : arr; 12415} 12416 12417var BEHAVIORS = { 12418 FLIP: 'flip', 12419 CLOCKWISE: 'clockwise', 12420 COUNTERCLOCKWISE: 'counterclockwise' 12421}; 12422 12423/** 12424 * @function 12425 * @memberof Modifiers 12426 * @argument {Object} data - The data object generated by update method 12427 * @argument {Object} options - Modifiers configuration and options 12428 * @returns {Object} The data object, properly modified 12429 */ 12430function flip(data, options) { 12431 // if `inner` modifier is enabled, we can't use the `flip` modifier 12432 if (isModifierEnabled(data.instance.modifiers, 'inner')) { 12433 return data; 12434 } 12435 12436 if (data.flipped && data.placement === data.originalPlacement) { 12437 // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides 12438 return data; 12439 } 12440 12441 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed); 12442 12443 var placement = data.placement.split('-')[0]; 12444 var placementOpposite = getOppositePlacement(placement); 12445 var variation = data.placement.split('-')[1] || ''; 12446 12447 var flipOrder = []; 12448 12449 switch (options.behavior) { 12450 case BEHAVIORS.FLIP: 12451 flipOrder = [placement, placementOpposite]; 12452 break; 12453 case BEHAVIORS.CLOCKWISE: 12454 flipOrder = clockwise(placement); 12455 break; 12456 case BEHAVIORS.COUNTERCLOCKWISE: 12457 flipOrder = clockwise(placement, true); 12458 break; 12459 default: 12460 flipOrder = options.behavior; 12461 } 12462 12463 flipOrder.forEach(function (step, index) { 12464 if (placement !== step || flipOrder.length === index + 1) { 12465 return data; 12466 } 12467 12468 placement = data.placement.split('-')[0]; 12469 placementOpposite = getOppositePlacement(placement); 12470 12471 var popperOffsets = data.offsets.popper; 12472 var refOffsets = data.offsets.reference; 12473 12474 // using floor because the reference offsets may contain decimals we are not going to consider here 12475 var floor = Math.floor; 12476 var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom); 12477 12478 var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); 12479 var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); 12480 var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); 12481 var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); 12482 12483 var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; 12484 12485 // flip the variation if required 12486 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 12487 var flippedVariation = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom)
vendor: 21,083 bytes, lines 12487-13094
12487; 12488 12489 if (overlapsRef || overflowsBoundaries || flippedVariation) { 12490 // this boolean to detect any flip loop 12491 data.flipped = true; 12492 12493 if (overlapsRef || overflowsBoundaries) { 12494 placement = flipOrder[index + 1]; 12495 } 12496 12497 if (flippedVariation) { 12498 variation = getOppositeVariation(variation); 12499 } 12500 12501 data.placement = placement + (variation ? '-' + variation : ''); 12502 12503 // this object contains `position`, we want to preserve it along with 12504 // any additional property we may add in the future 12505 data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); 12506 12507 data = runModifiers(data.instance.modifiers, data, 'flip'); 12508 } 12509 }); 12510 return data; 12511} 12512 12513/** 12514 * @function 12515 * @memberof Modifiers 12516 * @argument {Object} data - The data object generated by update method 12517 * @argument {Object} options - Modifiers configuration and options 12518 * @returns {Object} The data object, properly modified 12519 */ 12520function keepTogether(data) { 12521 var _data$offsets = data.offsets, 12522 popper = _data$offsets.popper, 12523 reference = _data$offsets.reference; 12524 12525 var placement = data.placement.split('-')[0]; 12526 var floor = Math.floor; 12527 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 12528 var side = isVertical ? 'right' : 'bottom'; 12529 var opSide = isVertical ? 'left' : 'top'; 12530 var measurement = isVertical ? 'width' : 'height'; 12531 12532 if (popper[side] < floor(reference[opSide])) { 12533 data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; 12534 } 12535 if (popper[opSide] > floor(reference[side])) { 12536 data.offsets.popper[opSide] = floor(reference[side]); 12537 } 12538 12539 return data; 12540} 12541 12542/** 12543 * Converts a string containing value + unit into a px value number 12544 * @function 12545 * @memberof {modifiers~offset} 12546 * @private 12547 * @argument {String} str - Value + unit string 12548 * @argument {String} measurement - `height` or `width` 12549 * @argument {Object} popperOffsets 12550 * @argument {Object} referenceOffsets 12551 * @returns {Number|String} 12552 * Value in pixels, or original string if no values were extracted 12553 */ 12554function toValue(str, measurement, popperOffsets, referenceOffsets) { 12555 // separate value from unit 12556 var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); 12557 var value = +split[1]; 12558 var unit = split[2]; 12559 12560 // If it's not a number it's an operator, I guess 12561 if (!value) { 12562 return str; 12563 } 12564 12565 if (unit.indexOf('%') === 0) { 12566 var element = void 0; 12567 switch (unit) { 12568 case '%p': 12569 element = popperOffsets; 12570 break; 12571 case '%': 12572 case '%r': 12573 default: 12574 element = referenceOffsets; 12575 } 12576 12577 var rect = getClientRect(element); 12578 return rect[measurement] / 100 * value; 12579 } else if (unit === 'vh' || unit === 'vw') { 12580 // if is a vh or vw, we calculate the size based on the viewport 12581 var size = void 0; 12582 if (unit === 'vh') { 12583 size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); 12584 } else { 12585 size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 12586 } 12587 return size / 100 * value; 12588 } else { 12589 // if is an explicit pixel unit, we get rid of the unit and keep the value 12590 // if is an implicit unit, it's px, and we return just the value 12591 return value; 12592 } 12593} 12594 12595/** 12596 * Parse an `offset` string to extrapolate `x` and `y` numeric offsets. 12597 * @function 12598 * @memberof {modifiers~offset} 12599 * @private 12600 * @argument {String} offset 12601 * @argument {Object} popperOffsets 12602 * @argument {Object} referenceOffsets 12603 * @argument {String} basePlacement 12604 * @returns {Array} a two cells array with x and y offsets in numbers 12605 */ 12606function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { 12607 var offsets = [0, 0]; 12608 12609 // Use height if placement is left or right and index is 0 otherwise use width 12610 // in this way the first offset will use an axis and the second one 12611 // will use the other one 12612 var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; 12613 12614 // Split the offset string to obtain a list of values and operands 12615 // The regex addresses values with the plus or minus sign in front (+10, -20, etc) 12616 var fragments = offset.split(/(\+|\-)/).map(function (frag) { 12617 return frag.trim(); 12618 }); 12619 12620 // Detect if the offset string contains a pair of values or a single one 12621 // they could be separated by comma or space 12622 var divider = fragments.indexOf(find(fragments, function (frag) { 12623 return frag.search(/,|\s/) !== -1; 12624 })); 12625 12626 if (fragments[divider] && fragments[divider].indexOf(',') === -1) { 12627 console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); 12628 } 12629 12630 // If divider is found, we divide the list of values and operands to divide 12631 // them by ofset X and Y. 12632 var splitRegex = /\s*,\s*|\s+/; 12633 var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments]; 12634 12635 // Convert the values with units to absolute pixels to allow our computations 12636 ops = ops.map(function (op, index) { 12637 // Most of the units rely on the orientation of the popper 12638 var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; 12639 var mergeWithPrevious = false; 12640 return op 12641 // This aggregates any `+` or `-` sign that aren't considered operators 12642 // e.g.: 10 + +5 => [10, +, +5] 12643 .reduce(function (a, b) { 12644 if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { 12645 a[a.length - 1] = b; 12646 mergeWithPrevious = true; 12647 return a; 12648 } else if (mergeWithPrevious) { 12649 a[a.length - 1] += b; 12650 mergeWithPrevious = false; 12651 return a; 12652 } else { 12653 return a.concat(b); 12654 } 12655 }, []) 12656 // Here we convert the string values into number values (in px) 12657 .map(function (str) { 12658 return toValue(str, measurement, popperOffsets, referenceOffsets); 12659 }); 12660 }); 12661 12662 // Loop trough the offsets arrays and execute the operations 12663 ops.forEach(function (op, index) { 12664 op.forEach(function (frag, index2) { 12665 if (isNumeric(frag)) { 12666 offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); 12667 } 12668 }); 12669 }); 12670 return offsets; 12671} 12672 12673/** 12674 * @function 12675 * @memberof Modifiers 12676 * @argument {Object} data - The data object generated by update method 12677 * @argument {Object} options - Modifiers configuration and options 12678 * @argument {Number|String} options.offset=0 12679 * The offset value as described in the modifier description 12680 * @returns {Object} The data object, properly modified 12681 */ 12682function offset(data, _ref) { 12683 var offset = _ref.offset; 12684 var placement = data.placement, 12685 _data$offsets = data.offsets, 12686 popper = _data$offsets.popper, 12687 reference = _data$offsets.reference; 12688 12689 var basePlacement = placement.split('-')[0]; 12690 12691 var offsets = void 0; 12692 if (isNumeric(+offset)) { 12693 offsets = [+offset, 0]; 12694 } else { 12695 offsets = parseOffset(offset, popper, reference, basePlacement); 12696 } 12697 12698 if (basePlacement === 'left') { 12699 popper.top += offsets[0]; 12700 popper.left -= offsets[1]; 12701 } else if (basePlacement === 'right') { 12702 popper.top += offsets[0]; 12703 popper.left += offsets[1]; 12704 } else if (basePlacement === 'top') { 12705 popper.left += offsets[0]; 12706 popper.top -= offsets[1]; 12707 } else if (basePlacement === 'bottom') { 12708 popper.left += offsets[0]; 12709 popper.top += offsets[1]; 12710 } 12711 12712 data.popper = popper; 12713 return data; 12714} 12715 12716/** 12717 * @function 12718 * @memberof Modifiers 12719 * @argument {Object} data - The data object generated by `update` method 12720 * @argument {Object} options - Modifiers configuration and options 12721 * @returns {Object} The data object, properly modified 12722 */ 12723function preventOverflow(data, options) { 12724 var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); 12725 12726 // If offsetParent is the reference element, we really want to 12727 // go one step up and use the next offsetParent as reference to 12728 // avoid to make this modifier completely useless and look like broken 12729 if (data.instance.reference === boundariesElement) { 12730 boundariesElement = getOffsetParent(boundariesElement); 12731 } 12732 12733 // NOTE: DOM access here 12734 // resets the popper's position so that the document size can be calculated excluding 12735 // the size of the popper element itself 12736 var transformProp = getSupportedPropertyName('transform'); 12737 var popperStyles = data.instance.popper.style; // assignment to help minification 12738 var top = popperStyles.top, 12739 left = popperStyles.left, 12740 transform = popperStyles[transformProp]; 12741 12742 popperStyles.top = ''; 12743 popperStyles.left = ''; 12744 popperStyles[transformProp] = ''; 12745 12746 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed); 12747 12748 // NOTE: DOM access here 12749 // restores the original style properties after the offsets have been computed 12750 popperStyles.top = top; 12751 popperStyles.left = left; 12752 popperStyles[transformProp] = transform; 12753 12754 options.boundaries = boundaries; 12755 12756 var order = options.priority; 12757 var popper = data.offsets.popper; 12758 12759 var check = { 12760 primary: function primary(placement) { 12761 var value = popper[placement]; 12762 if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { 12763 value = Math.max(popper[placement], boundaries[placement]); 12764 } 12765 return defineProperty({}, placement, value); 12766 }, 12767 secondary: function secondary(placement) { 12768 var mainSide = placement === 'right' ? 'left' : 'top'; 12769 var value = popper[mainSide]; 12770 if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { 12771 value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); 12772 } 12773 return defineProperty({}, mainSide, value); 12774 } 12775 }; 12776 12777 order.forEach(function (placement) { 12778 var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; 12779 popper = _extends({}, popper, check[side](placement)); 12780 }); 12781 12782 data.offsets.popper = popper; 12783 12784 return data; 12785} 12786 12787/** 12788 * @function 12789 * @memberof Modifiers 12790 * @argument {Object} data - The data object generated by `update` method 12791 * @argument {Object} options - Modifiers configuration and options 12792 * @returns {Object} The data object, properly modified 12793 */ 12794function shift(data) { 12795 var placement = data.placement; 12796 var basePlacement = placement.split('-')[0]; 12797 var shiftvariation = placement.split('-')[1]; 12798 12799 // if shift shiftvariation is specified, run the modifier 12800 if (shiftvariation) { 12801 var _data$offsets = data.offsets, 12802 reference = _data$offsets.reference, 12803 popper = _data$offsets.popper; 12804 12805 var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; 12806 var side = isVertical ? 'left' : 'top'; 12807 var measurement = isVertical ? 'width' : 'height'; 12808 12809 var shiftOffsets = { 12810 start: defineProperty({}, side, reference[side]), 12811 end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) 12812 }; 12813 12814 data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); 12815 } 12816 12817 return data; 12818} 12819 12820/** 12821 * @function 12822 * @memberof Modifiers 12823 * @argument {Object} data - The data object generated by update method 12824 * @argument {Object} options - Modifiers configuration and options 12825 * @returns {Object} The data object, properly modified 12826 */ 12827function hide(data) { 12828 if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { 12829 return data; 12830 } 12831 12832 var refRect = data.offsets.reference; 12833 var bound = find(data.instance.modifiers, function (modifier) { 12834 return modifier.name === 'preventOverflow'; 12835 }).boundaries; 12836 12837 if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { 12838 // Avoid unnecessary DOM access if visibility hasn't changed 12839 if (data.hide === true) { 12840 return data; 12841 } 12842 12843 data.hide = true; 12844 data.attributes['x-out-of-boundaries'] = ''; 12845 } else { 12846 // Avoid unnecessary DOM access if visibility hasn't changed 12847 if (data.hide === false) { 12848 return data; 12849 } 12850 12851 data.hide = false; 12852 data.attributes['x-out-of-boundaries'] = false; 12853 } 12854 12855 return data; 12856} 12857 12858/** 12859 * @function 12860 * @memberof Modifiers 12861 * @argument {Object} data - The data object generated by `update` method 12862 * @argument {Object} options - Modifiers configuration and options 12863 * @returns {Object} The data object, properly modified 12864 */ 12865function inner(data) { 12866 var placement = data.placement; 12867 var basePlacement = placement.split('-')[0]; 12868 var _data$offsets = data.offsets, 12869 popper = _data$offsets.popper, 12870 reference = _data$offsets.reference; 12871 12872 var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; 12873 12874 var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; 12875 12876 popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); 12877 12878 data.placement = getOppositePlacement(placement); 12879 data.offsets.popper = getClientRect(popper); 12880 12881 return data; 12882} 12883 12884/** 12885 * Modifier function, each modifier can have a function of this type assigned 12886 * to its `fn` property.<br /> 12887 * These functions will be called on each update, this means that you must 12888 * make sure they are performant enough to avoid performance bottlenecks. 12889 * 12890 * @function ModifierFn 12891 * @argument {dataObject} data - The data object generated by `update` method 12892 * @argument {Object} options - Modifiers configuration and options 12893 * @returns {dataObject} The data object, properly modified 12894 */ 12895 12896/** 12897 * Modifiers are plugins used to alter the behavior of your poppers.<br /> 12898 * Popper.js uses a set of 9 modifiers to provide all the basic functionalities 12899 * needed by the library. 12900 * 12901 * Usually you don't want to override the `order`, `fn` and `onLoad` props. 12902 * All the other properties are configurations that could be tweaked. 12903 * @namespace modifiers 12904 */ 12905var modifiers = { 12906 /** 12907 * Modifier used to shift the popper on the start or end of its reference 12908 * element.<br /> 12909 * It will read the variation of the `placement` property.<br /> 12910 * It can be one either `-end` or `-start`. 12911 * @memberof modifiers 12912 * @inner 12913 */ 12914 shift: { 12915 /** @prop {number} order=100 - Index used to define the order of execution */ 12916 order: 100, 12917 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 12918 enabled: true, 12919 /** @prop {ModifierFn} */ 12920 fn: shift 12921 }, 12922 12923 /** 12924 * The `offset` modifier can shift your popper on both its axis. 12925 * 12926 * It accepts the following units: 12927 * - `px` or unit-less, interpreted as pixels 12928 * - `%` or `%r`, percentage relative to the length of the reference element 12929 * - `%p`, percentage relative to the length of the popper element 12930 * - `vw`, CSS viewport width unit 12931 * - `vh`, CSS viewport height unit 12932 * 12933 * For length is intended the main axis relative to the placement of the popper.<br /> 12934 * This means that if the placement is `top` or `bottom`, the length will be the 12935 * `width`. In case of `left` or `right`, it will be the `height`. 12936 * 12937 * You can provide a single value (as `Number` or `String`), or a pair of values 12938 * as `String` divided by a comma or one (or more) white spaces.<br /> 12939 * The latter is a deprecated method because it leads to confusion and will be 12940 * removed in v2.<br /> 12941 * Additionally, it accepts additions and subtractions between different units. 12942 * Note that multiplications and divisions aren't supported. 12943 * 12944 * Valid examples are: 12945 * ``` 12946 * 10 12947 * '10%' 12948 * '10, 10' 12949 * '10%, 10' 12950 * '10 + 10%' 12951 * '10 - 5vh + 3%' 12952 * '-10px + 5vh, 5px - 6%' 12953 * ``` 12954 * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap 12955 * > with their reference element, unfortunately, you will have to disable the `flip` modifier. 12956 * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373). 12957 * 12958 * @memberof modifiers 12959 * @inner 12960 */ 12961 offset: { 12962 /** @prop {number} order=200 - Index used to define the order of execution */ 12963 order: 200, 12964 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 12965 enabled: true, 12966 /** @prop {ModifierFn} */ 12967 fn: offset, 12968 /** @prop {Number|String} offset=0 12969 * The offset value as described in the modifier description 12970 */ 12971 offset: 0 12972 }, 12973 12974 /** 12975 * Modifier used to prevent the popper from being positioned outside the boundary. 12976 * 12977 * A scenario exists where the reference itself is not within the boundaries.<br /> 12978 * We can say it has "escaped the boundaries" â or just "escaped".<br /> 12979 * In this case we need to decide whether the popper should either: 12980 * 12981 * - detach from the reference and remain "trapped" in the boundaries, or 12982 * - if it should ignore the boundary and "escape with its reference" 12983 * 12984 * When `escapeWithReference` is set to`true` and reference is completely 12985 * outside its boundaries, the popper will overflow (or completely leave) 12986 * the boundaries in order to remain attached to the edge of the reference. 12987 * 12988 * @memberof modifiers 12989 * @inner 12990 */ 12991 preventOverflow: { 12992 /** @prop {number} order=300 - Index used to define the order of execution */ 12993 order: 300, 12994 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 12995 enabled: true, 12996 /** @prop {ModifierFn} */ 12997 fn: preventOverflow, 12998 /** 12999 * @prop {Array} [priority=['left','right','top','bottom']] 13000 * Popper will try to prevent overflow following these priorities by default, 13001 * then, it could overflow on the left and on top of the `boundariesElement` 13002 */ 13003 priority: ['left', 'right', 'top', 'bottom'], 13004 /** 13005 * @prop {number} padding=5 13006 * Amount of pixel used to define a minimum distance between the boundaries 13007 * and the popper. This makes sure the popper always has a little padding 13008 * between the edges of its container 13009 */ 13010 padding: 5, 13011 /** 13012 * @prop {String|HTMLElement} boundariesElement='scrollParent' 13013 * Boundaries used by the modifier. Can be `scrollParent`, `window`, 13014 * `viewport` or any DOM element. 13015 */ 13016 boundariesElement: 'scrollParent' 13017 }, 13018 13019 /** 13020 * Modifier used to make sure the reference and its popper stay near each other 13021 * without leaving any gap between the two. Especially useful when the arrow is 13022 * enabled and you want to ensure that it points to its reference element. 13023 * It cares only about the first axis. You can still have poppers with margin 13024 * between the popper and its reference element. 13025 * @memberof modifiers 13026 * @inner 13027 */ 13028 keepTogether: { 13029 /** @prop {number} order=400 - Index used to define the order of execution */ 13030 order: 400, 13031 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13032 enabled: true, 13033 /** @prop {ModifierFn} */ 13034 fn: keepTogether 13035 }, 13036 13037 /** 13038 * This modifier is used to move the `arrowElement` of the popper to make 13039 * sure it is positioned between the reference element and its popper element. 13040 * It will read the outer size of the `arrowElement` node to detect how many 13041 * pixels of conjunction are needed. 13042 * 13043 * It has no effect if no `arrowElement` is provided. 13044 * @memberof modifiers 13045 * @inner 13046 */ 13047 arrow: { 13048 /** @prop {number} order=500 - Index used to define the order of execution */ 13049 order: 500, 13050 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13051 enabled: true, 13052 /** @prop {ModifierFn} */ 13053 fn: arrow, 13054 /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ 13055 element: '[x-arrow]' 13056 }, 13057 13058 /** 13059 * Modifier used to flip the popper's placement when it starts to overlap its 13060 * reference element. 13061 * 13062 * Requires the `preventOverflow` modifier before it in order to work. 13063 * 13064 * **NOTE:** this modifier will interrupt the current update cycle and will 13065 * restart it if it detects the need to flip the placement. 13066 * @memberof modifiers 13067 * @inner 13068 */ 13069 flip: { 13070 /** @prop {number} order=600 - Index used to define the order of execution */ 13071 order: 600, 13072 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13073 enabled: true, 13074 /** @prop {ModifierFn} */ 13075 fn: flip, 13076 /** 13077 * @prop {String|Array} behavior='flip' 13078 * The behavior used to change the popper's placement. It can be one of 13079 * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid 13080 * placements (with optional variations) 13081 */ 13082 behavior: 'flip', 13083 /** 13084 * @prop {number} padding=5 13085 * The popper will flip if it hits the edges of the `boundariesElement` 13086 */ 13087 padding: 5, 13088 /** 13089 * @prop {String|HTMLElement} boundariesElement='viewport' 13090 * The element which will define the boundaries of the popper position. 13091 * The popper will never be placed outside of the defined boundaries 13092 * (except if `keepTogether` is enabled) 13093 */ 13094 boundariesElement: 'viewport'
13094 13095 }, 13096 13097 /** 13098 * Modifier used to make the popper flow toward the inner of the reference element. 13099 * By default, when this modifier is disabled, the popper will be placed outside 13100 * the reference element. 13101 * @memberof modifiers 13102 * @inner 13103 */ 13104 inner: { 13105 /** @prop {number} order=700 - Index used to define the order of execution */ 13106 order: 700, 13107 /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ 13108 enabled: false, 13109 /** @prop {ModifierFn} */ 13110 fn: inner 13111 }, 13112 13113 /** 13114 * Modifier used to hide the popper when its reference element is outside of the 13115 * popper boundaries. It will set a `x-out-of-boundaries` attribute which can 13116 * be used to hide with a CSS selector the popper when its reference is 13117 * out of boundaries. 13118 * 13119 * Requires the `preventOverflow` modifier before it in order to work. 13120 * @memberof modifiers 13121 * @inner 13122 */ 13123 hide: { 13124 /** @prop {number} order=800 - Index used to define the order of execution */ 13125 order: 800, 13126 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13127 enabled: true, 13128 /** @prop {ModifierFn} */ 13129 fn: hide 13130 }, 13131 13132 /** 13133 * Computes the style that will be applied to the popper element to gets 13134 * properly positioned. 13135 * 13136 * Note that this modifier will not touch the DOM, it just prepares the styles 13137 * so that `applyStyle` modifier can apply it. This separation is useful 13138 * in case you need to replace `applyStyle` with a custom implementation. 13139 * 13140 * This modifier has `850` as `order` value to maintain backward compatibility 13141 * with previous versions of Popper.js. Expect the modifiers ordering method 13142 * to change in future major versions of the library. 13143 * 13144 * @memberof modifiers 13145 * @inner 13146 */ 13147 computeStyle: { 13148 /** @prop {number} order=850 - Index used to define the order of execution */ 13149 order: 850, 13150 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13151 enabled: true, 13152 /** @prop {ModifierFn} */ 13153 fn: computeStyle, 13154 /** 13155 * @prop {Boolean} gpuAcceleration=true 13156 * If true, it uses the CSS 3D transformation to position the popper. 13157 * Otherwise, it will use the `top` and `left` properties 13158 */ 13159 gpuAcceleration: true, 13160 /** 13161 * @prop {string} [x='bottom'] 13162 * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. 13163 * Change this if your popper should grow in a direction different from `bottom` 13164 */ 13165 x: 'bottom', 13166 /** 13167 * @prop {string} [x='left'] 13168 * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. 13169 * Change this if your popper should grow in a direction different from `right` 13170 */ 13171 y: 'right' 13172 }, 13173 13174 /** 13175 * Applies the computed styles to the popper element. 13176 * 13177 * All the DOM manipulations are limited to this modifier. This is useful in case 13178 * you want to integrate Popper.js inside a framework or view library and you 13179 * want to delegate all the DOM manipulations to it. 13180 * 13181 * Note that if you disable this modifier, you must make sure the popper element 13182 * has its position set to `absolute` before Popper.js can do its work! 13183 * 13184 * Just disable this modifier and define your own to achieve the desired effect. 13185 * 13186 * @memberof modifiers 13187 * @inner 13188 */ 13189 applyStyle: { 13190 /** @prop {number} order=900 - Index used to define the order of execution */ 13191 order: 900, 13192 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13193 enabled: true, 13194 /** @prop {ModifierFn} */
vendor: 4,830 bytes, lines 13195-13333
13195 fn: applyStyle, 13196 /** @prop {Function} */ 13197 onLoad: applyStyleOnLoad, 13198 /** 13199 * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier 13200 * @prop {Boolean} gpuAcceleration=true 13201 * If true, it uses the CSS 3D transformation to position the popper. 13202 * Otherwise, it will use the `top` and `left` properties 13203 */ 13204 gpuAcceleration: undefined 13205 } 13206}; 13207 13208/** 13209 * The `dataObject` is an object containing all the information used by Popper.js. 13210 * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks. 13211 * @name dataObject 13212 * @property {Object} data.instance The Popper.js instance 13213 * @property {String} data.placement Placement applied to popper 13214 * @property {String} data.originalPlacement Placement originally defined on init 13215 * @property {Boolean} data.flipped True if popper has been flipped by flip modifier 13216 * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper 13217 * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier 13218 * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`) 13219 * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`) 13220 * @property {Object} data.boundaries Offsets of the popper boundaries 13221 * @property {Object} data.offsets The measurements of popper, reference and arrow elements 13222 * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values 13223 * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values 13224 * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 13225 */ 13226 13227/** 13228 * Default options provided to Popper.js constructor.<br /> 13229 * These can be overridden using the `options` argument of Popper.js.<br /> 13230 * To override an option, simply pass an object with the same 13231 * structure of the `options` object, as the 3rd argument. For example: 13232 * ``` 13233 * new Popper(ref, pop, { 13234 * modifiers: { 13235 * preventOverflow: { enabled: false } 13236 * } 13237 * }) 13238 * ``` 13239 * @type {Object} 13240 * @static 13241 * @memberof Popper 13242 */ 13243var Defaults = { 13244 /** 13245 * Popper's placement. 13246 * @prop {Popper.placements} placement='bottom' 13247 */ 13248 placement: 'bottom', 13249 13250 /** 13251 * Set this to true if you want popper to position it self in 'fixed' mode 13252 * @prop {Boolean} positionFixed=false 13253 */ 13254 positionFixed: false, 13255 13256 /** 13257 * Whether events (resize, scroll) are initially enabled. 13258 * @prop {Boolean} eventsEnabled=true 13259 */ 13260 eventsEnabled: true, 13261 13262 /** 13263 * Set to true if you want to automatically remove the popper when 13264 * you call the `destroy` method. 13265 * @prop {Boolean} removeOnDestroy=false 13266 */ 13267 removeOnDestroy: false, 13268 13269 /** 13270 * Callback called when the popper is created.<br /> 13271 * By default, it is set to no-op.<br /> 13272 * Access Popper.js instance with `data.instance`. 13273 * @prop {onCreate} 13274 */ 13275 onCreate: function onCreate() {}, 13276 13277 /** 13278 * Callback called when the popper is updated. This callback is not called 13279 * on the initialization/creation of the popper, but only on subsequent 13280 * updates.<br /> 13281 * By default, it is set to no-op.<br /> 13282 * Access Popper.js instance with `data.instance`. 13283 * @prop {onUpdate} 13284 */ 13285 onUpdate: function onUpdate() {}, 13286 13287 /** 13288 * List of modifiers used to modify the offsets before they are applied to the popper. 13289 * They provide most of the functionalities of Popper.js. 13290 * @prop {modifiers} 13291 */ 13292 modifiers: modifiers 13293}; 13294 13295/** 13296 * @callback onCreate 13297 * @param {dataObject} data 13298 */ 13299 13300/** 13301 * @callback onUpdate 13302 * @param {dataObject} data 13303 */ 13304 13305// Utils 13306// Methods 13307var Popper = function () { 13308 /** 13309 * Creates a new Popper.js instance. 13310 * @class Popper 13311 * @param {HTMLElement|referenceObject} reference - The reference element used to position the popper 13312 * @param {HTMLElement} popper - The HTML element used as the popper 13313 * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) 13314 * @return {Object} instance - The generated Popper.js instance 13315 */ 13316 function Popper(reference, popper) { 13317 var _this = this; 13318 13319 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 13320 classCallCheck(this, Popper); 13321 13322 this.scheduleUpdate = function () { 13323 return requestAnimationFrame(_this.update); 13324 }; 13325 13326 // make update() debounced, so that it only runs at most once-per-tick 13327 this.update = debounce(this.update.bind(this)); 13328 13329 // with {} we create a new object with the options inside it 13330 this.options = _extends({}, Popper.Defaults, options); 13331 13332 // init state 13333 this.state = {
13334 isDestroyed: false, 13335 isCreated: false, 13336 scrollParents: [] 13337 }; 13338 13339 // get reference and popper elements (allow jQuery wrappers) 13340 this.reference = reference && reference.jquery ? reference[0] : reference; 13341 this.popper = popper && popper.jquery ? popper[0] : popper; 13342 13343 // Deep merge modifiers options 13344 this.options.modifiers = {}; 13345 Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { 13346 _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); 13347 }); 13348 13349 // Refactoring modifiers' list (Object => Array) 13350 this.modifiers = Object.keys(this.options.modifiers).map(function (name) { 13351 return _extends({ 13352 name: name 13353 }, _this.options.modifiers[name]); 13354 }) 13355 // sort the modifiers by order 13356 .sort(function (a, b) { 13357 return a.order - b.order; 13358 }); 13359 13360 // modifiers have the ability to execute arbitrary code when Popper.js get inited 13361 // such code is executed in the same order of its modifier 13362 // they could add new properties to their options configuration 13363 // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! 13364 this.modifiers.forEach(function (modifierOptions) { 13365 if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { 13366 modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); 13367 } 13368 }); 13369 13370 // fire the first update to position the popper in the right place 13371 this.update(); 13372 13373 var eventsEnabled = this.options.eventsEnabled; 13374 if (eventsEnabled) { 13375 // setup event listeners, they will take care of update the position in specific situations 13376 this.enableEventListeners(); 13377 } 13378 13379 this.state.eventsEnabled = eventsEnabled; 13380 } 13381 13382 // We can't use class properties because they don't get listed in the 13383 // class prototype and break stuff like Sinon stubs 13384 13385 13386 createClass(Popper, [{ 13387 key: 'update', 13388 value: function update$$1() { 13389 return update.call(this); 13390 } 13391 }, { 13392 key: 'destroy', 13393 value: function destroy$$1() { 13394 return destroy.call(this); 13395 } 13396 }, { 13397 key: 'enableEventListeners', 13398 value: function enableEventListeners$$1() { 13399 return enableEventListeners.call(this); 13400 } 13401 }, { 13402 key: 'disableEventListeners', 13403 value: function disableEventListeners$$1() { 13404 return disableEventListeners.call(this); 13405 } 13406 13407 /** 13408 * Schedules an update. It will run on the next UI update available. 13409 * @method scheduleUpdate 13410 * @memberof Popper 13411 */ 13412 13413 13414 /** 13415 * Collection of utilities useful when writing custom modifiers. 13416 * Starting from version 1.7, this method is available only if you 13417 * include `popper-utils.js` before `popper.js`. 13418 * 13419 * **DEPRECATION**: This way to access PopperUtils is deprecated 13420 * and will be removed in v2! Use the PopperUtils module directly instead. 13421 * Due to the high instability of the methods contained in Utils, we can't 13422 * guarantee them to follow semver. Use them at your own risk! 13423 * @static 13424 * @private 13425 * @type {Object} 13426 * @deprecated since version 1.8 13427 * @member Utils 13428 * @memberof Popper 13429 */ 13430 13431 }]); 13432 return Popper; 13433}(); 13434 13435/** 13436 * The `referenceObject` is an object that provides an interface compatible with Popper.js 13437 * and lets you use it as replacement of a real DOM node.<br /> 13438 * You can use this method to position a popper relatively to a set of coordinates 13439 * in case you don't have a DOM node to use as reference. 13440 * 13441 * ``` 13442 * new Popper(referenceObject, popperNode); 13443 * ``` 13444 * 13445 * NB: This feature isn't supported in Internet Explorer 10. 13446 * @name referenceObject 13447 * @property {Function} data.getBoundingClientRect 13448 * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. 13449 * @property {number} data.clientWidth 13450 * An ES6 getter that will return the width of the virtual reference element. 13451 * @property {number} data.clientHeight 13452 * An ES6 getter that will return the height of the virtual reference element. 13453 */ 13454 13455 13456Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils; 13457Popper.placements = placements; 13458Popper.Defaults = Defaults; 13459 13460return Popper; 13461 13462}))); 13463/*! 13464 * Bootstrap v4.3.1 (https://getbootstrap.com/) 13465 * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 13466 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 13467 */ 13468 13469(function (global, factory) { 13470 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery'), require('popper.js')) : 13471 typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) : 13472 (global = global || self, factory(global.bootstrap = {}, global.jQuery, global.Popper)); 13473}(this, function (exports, $, Popper) { 'use strict'; 13474 13475 $ = $ && $.hasOwnProperty('default') ? $['default'] : $; 13476 Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper; 13477 13478 function _defineProperties(target, props) { 13479 for (var i = 0; i < props.length; i++) { 13480 var descriptor = props[i]; 13481 descriptor.enumerable = descriptor.enumerable || false; 13482 descriptor.configurable = true; 13483 if ("value" in descriptor) descriptor.writable = true; 13484 Object.defineProperty(target, descriptor.key, descriptor); 13485 } 13486 } 13487 13488 function _createClass(Constructor, protoProps, staticProps) { 13489 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 13490 if (staticProps) _defineProperties(Constructor, staticProps); 13491 return Constructor; 13492 } 13493 13494 function _defineProperty(obj, key, value) { 13495 if (key in obj) { 13496 Object.defineProperty(obj, key, { 13497 value: value, 13498 enumerable: true, 13499 configurable: true, 13500 writable: true 13501 }); 13502 } else { 13503 obj[key] = value; 13504 } 13505 13506 return obj; 13507 } 13508 13509 function _objectSpread(target) { 13510 for (var i = 1; i < arguments.length; i++) { 13511 var source = arguments[i] != null ? arguments[i] : {}; 13512 var ownKeys = Object.keys(source); 13513 13514 if (typeof Object.getOwnPropertySymbols === 'function') { 13515 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { 13516 return Object.getOwnPropertyDescriptor(source, sym).enumerable; 13517 })); 13518 } 13519 13520 ownKeys.forEach(function (key) { 13521 _defineProperty(target, key, source[key]); 13522 }); 13523 } 13524 13525 return target; 13526 } 13527 13528 function _inheritsLoose(subClass, superClass) { 13529 subClass.prototype = Object.create(superClass.prototype); 13530 subClass.prototype.constructor = subClass; 13531 subClass.__proto__ = superClass; 13532 } 13533 13534 /** 13535 * -------------------------------------------------------------------------- 13536 * Bootstrap (v4.3.1): util.js 13537 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 13538 * -------------------------------------------------------------------------- 13539 */ 13540 /** 13541 * ------------------------------------------------------------------------ 13542 * Private TransitionEnd Helpers 13543 * ------------------------------------------------------------------------ 13544 */ 13545 13546 var TRANSITION_END = 'transitionend'; 13547 var MAX_UID = 1000000; 13548 var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp) 13549 13550 function toType(obj) { 13551 return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); 13552 } 13553 13554 function getSpecialTransitionEndEvent() { 13555 return { 13556 bindType: TRANSITION_END, 13557 delegateType: TRANSITION_END, 13558 handle: function handle(event) { 13559 if ($(event.target).is(this)) { 13560 return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params 13561 } 13562 13563 return undefined; // eslint-disable-line no-undefined 13564 } 13565 }; 13566 } 13567 13568 function transitionEndEmulator(duration) { 13569 var _this = this; 13570 13571 var called = false;
13572 $(this).one(Util.TRANSITION_END, function () { 13573 called = true; 13574 }); 13575 setTimeout(function () { 13576 if (!called) { 13577 Util.triggerTransitionEnd(_this); 13578 } 13579 }, duration); 13580 return this; 13581 } 13582 13583 function setTransitionEndSupport() { 13584 $.fn.emulateTransitionEnd = transitionEndEmulator; 13585 $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); 13586 } 13587 /** 13588 * -------------------------------------------------------------------------- 13589 * Public Util Api 13590 * -------------------------------------------------------------------------- 13591 */ 13592 13593 13594 var Util = { 13595 TRANSITION_END: 'bsTransitionEnd', 13596 getUID: function getUID(prefix) { 13597 do { 13598 // eslint-disable-next-line no-bitwise 13599 prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here 13600 } while (document.getElementById(prefix)); 13601 13602 return prefix; 13603 }, 13604 getSelectorFromElement: function getSelectorFromElement(element) { 13605 var selector = element.getAttribute('data-target'); 13606 13607 if (!selector || selector === '#') { 13608 var hrefAttr = element.getAttribute('href'); 13609 selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''; 13610 } 13611 13612 try { 13613 return document.querySelector(selector) ? selector : null; 13614 } catch (err) { 13615 return null; 13616 } 13617 }, 13618 getTransitionDurationFromElement: function getTransitionDurationFromElement(element) { 13619 if (!element) { 13620 return 0; 13621 } // Get transition-duration of the element 13622 13623 13624 var transitionDuration = $(element).css('transition-duration'); 13625 var transitionDelay = $(element).css('transition-delay'); 13626 var floatTransitionDuration = parseFloat(transitionDuration); 13627 var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found 13628 13629 if (!floatTransitionDuration && !floatTransitionDelay) { 13630 return 0; 13631 } // If multiple durations are defined, take the first 13632 13633 13634 transitionDuration = transitionDuration.split(',')[0]; 13635 transitionDelay = transitionDelay.split(',')[0]; 13636 return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 13637 }, 13638 reflow: function reflow(element) { 13639 return element.offsetHeight; 13640 }, 13641 triggerTransitionEnd: function triggerTransitionEnd(element) { 13642 $(element).trigger(TRANSITION_END); 13643 }, 13644 // TODO: Remove in v5 13645 supportsTransitionEnd: function supportsTransitionEnd() { 13646 return Boolean(TRANSITION_END); 13647 }, 13648 isElement: function isElement(obj) { 13649 return (obj[0] || obj).nodeType; 13650 }, 13651 typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { 13652 for (var property in configTypes) { 13653 if (Object.prototype.hasOwnProperty.call(configTypes, property)) { 13654 var expectedTypes = configTypes[property]; 13655 var value = config[property]; 13656 var valueType = value && Util.isElement(value) ? 'element' : toType(value); 13657 13658 if (!new RegExp(expectedTypes).test(valueType)) { 13659 throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\".")); 13660 } 13661 } 13662 } 13663 }, 13664 findShadowRoot: function findShadowRoot(element) { 13665 if (!document.documentElement.attachShadow) { 13666 return null; 13667 } // Can find the shadow root otherwise it'll return the document 13668 13669 13670 if (typeof element.getRootNode === 'function') { 13671 var root = element.getRootNode(); 13672 return root instanceof ShadowRoot ? root : null; 13673 } 13674 13675 if (element instanceof ShadowRoot) { 13676 return element; 13677 } // when we don't find a shadow root 13678 13679 13680 if (!element.parentNode) { 13681 return null; 13682 } 13683 13684 return Util.findShadowRoot(element.parentNode); 13685 } 13686 }; 13687 setTransitionEndSupport(); 13688 13689 /** 13690 * ------------------------------------------------------------------------ 13691 * Constants 13692 * ------------------------------------------------------------------------ 13693 */ 13694 13695 var NAME = 'alert'; 13696 var VERSION = '4.3.1'; 13697 var DATA_KEY = 'bs.alert'; 13698 var EVENT_KEY = "." + DATA_KEY; 13699 var DATA_API_KEY = '.data-api'; 13700 var JQUERY_NO_CONFLICT = $.fn[NAME]; 13701 var Selector = { 13702 DISMISS: '[data-dismiss="alert"]' 13703 }; 13704 var Event = { 13705 CLOSE: "close" + EVENT_KEY, 13706 CLOSED: "closed" + EVENT_KEY, 13707 CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY 13708 }; 13709 var ClassName = { 13710 ALERT: 'alert', 13711 FADE: 'fade', 13712 SHOW: 'show' 13713 /** 13714 * ------------------------------------------------------------------------ 13715 * Class Definition 13716 * ------------------------------------------------------------------------ 13717 */ 13718 13719 }; 13720 13721 var Alert = 13722 /*#__PURE__*/ 13723 function () { 13724 function Alert(element) { 13725 this._element = element; 13726 } // Getters 13727 13728 13729 var _proto = Alert.prototype; 13730 13731 // Public 13732 _proto.close = function close(element) { 13733 var rootElement = this._element; 13734 13735 if (element) { 13736 rootElement = this._getRootElement(element); 13737 } 13738 13739 var customEvent = this._triggerCloseEvent(rootElement); 13740 13741 if (customEvent.isDefaultPrevented()) { 13742 return; 13743 } 13744 13745 this._removeElement(rootElement); 13746 }; 13747 13748 _proto.dispose = function dispose() { 13749 $.removeData(this._element, DATA_KEY); 13750 this._element = null; 13751 } // Private 13752 ; 13753 13754 _proto._getRootElement = function _getRootElement(element) { 13755 var selector = Util.getSelectorFromElement(element); 13756 var parent = false;
13757 13758 if (selector) { 13759 parent = document.querySelector(selector); 13760 } 13761 13762 if (!parent) { 13763 parent = $(element).closest("." + ClassName.ALERT)[0]; 13764 } 13765 13766 return parent; 13767 }; 13768 13769 _proto._triggerCloseEvent = function _triggerCloseEvent(element) { 13770 var closeEvent = $.Event(Event.CLOSE); 13771 $(element).trigger(closeEvent); 13772 return closeEvent; 13773 }; 13774 13775 _proto._removeElement = function _removeElement(element) { 13776 var _this = this; 13777 13778 $(element).removeClass(ClassName.SHOW); 13779 13780 if (!$(element).hasClass(ClassName.FADE)) { 13781 this._destroyElement(element); 13782 13783 return; 13784 } 13785 13786 var transitionDuration = Util.getTransitionDurationFromElement(element); 13787 $(element).one(Util.TRANSITION_END, function (event) { 13788 return _this._destroyElement(element, event); 13789 }).emulateTransitionEnd(transitionDuration); 13790 }; 13791 13792 _proto._destroyElement = function _destroyElement(element) { 13793 $(element).detach().trigger(Event.CLOSED).remove(); 13794 } // Static 13795 ; 13796 13797 Alert._jQueryInterface = function _jQueryInterface(config) { 13798 return this.each(function () { 13799 var $element = $(this); 13800 var data = $element.data(DATA_KEY); 13801 13802 if (!data) { 13803 data = new Alert(this); 13804 $element.data(DATA_KEY, data); 13805 } 13806 13807 if (config === 'close') { 13808 data[config](this); 13809 } 13810 }); 13811 }; 13812 13813 Alert._handleDismiss = function _handleDismiss(alertInstance) { 13814 return function (event) { 13815 if (event) { 13816 event.preventDefault(); 13817 } 13818 13819 alertInstance.close(this); 13820 }; 13821 }; 13822 13823 _createClass(Alert, null, [{ 13824 key: "VERSION", 13825 get: function get() { 13826 return VERSION; 13827 } 13828 }]); 13829 13830 return Alert; 13831 }(); 13832 /** 13833 * ------------------------------------------------------------------------ 13834 * Data Api implementation 13835 * ------------------------------------------------------------------------ 13836 */ 13837 13838 13839 $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert())); 13840 /** 13841 * ------------------------------------------------------------------------ 13842 * jQuery 13843 * ------------------------------------------------------------------------ 13844 */ 13845 13846 $.fn[NAME] = Alert._jQueryInterface; 13847 $.fn[NAME].Constructor = Alert; 13848 13849 $.fn[NAME].noConflict = function () { 13850 $.fn[NAME] = JQUERY_NO_CONFLICT; 13851 return Alert._jQueryInterface; 13852 }; 13853 13854 /** 13855 * ------------------------------------------------------------------------ 13856 * Constants 13857 * ------------------------------------------------------------------------ 13858 */ 13859 13860 var NAME$1 = 'button'; 13861 var VERSION$1 = '4.3.1'; 13862 var DATA_KEY$1 = 'bs.button'; 13863 var EVENT_KEY$1 = "." + DATA_KEY$1; 13864 var DATA_API_KEY$1 = '.data-api'; 13865 var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1]; 13866 var ClassName$1 = { 13867 ACTIVE: 'active', 13868 BUTTON: 'btn', 13869 FOCUS: 'focus' 13870 }; 13871 var Selector$1 = { 13872 DATA_TOGGLE_CARROT: '[data-toggle^="button"]', 13873 DATA_TOGGLE: '[data-toggle="buttons"]', 13874 INPUT: 'input:not([type="hidden"])', 13875 ACTIVE: '.active', 13876 BUTTON: '.btn' 13877 }; 13878 var Event$1 = { 13879 CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1, 13880 FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1) 13881 /** 13882 * ------------------------------------------------------------------------ 13883 * Class Definition 13884 * ------------------------------------------------------------------------ 13885 */ 13886 13887 }; 13888 13889 var Button = 13890 /*#__PURE__*/ 13891 function () { 13892 function Button(element) { 13893 this._element = element; 13894 } // Getters 13895 13896 13897 var _proto = Button.prototype; 13898 13899 // Public 13900 _proto.toggle = function toggle() { 13901 var triggerChangeEvent = true; 13902 var addAriaPressed = true; 13903 var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLE)[0]; 13904 13905 if (rootElement) { 13906 var input = this._element.querySelector(Selector$1.INPUT); 13907 13908 if (input) { 13909 if (input.type === 'radio') { 13910 if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) { 13911 triggerChangeEvent = false;
13912 } else { 13913 var activeElement = rootElement.querySelector(Selector$1.ACTIVE); 13914 13915 if (activeElement) { 13916 $(activeElement).removeClass(ClassName$1.ACTIVE); 13917 } 13918 } 13919 } 13920 13921 if (triggerChangeEvent) { 13922 if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) { 13923 return; 13924 } 13925 13926 input.checked = !this._element.classList.contains(ClassName$1.ACTIVE); 13927 $(input).trigger('change'); 13928 } 13929 13930 input.focus(); 13931 addAriaPressed = false; 13932 } 13933 } 13934 13935 if (addAriaPressed) { 13936 this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE)); 13937 } 13938 13939 if (triggerChangeEvent) { 13940 $(this._element).toggleClass(ClassName$1.ACTIVE); 13941 } 13942 }; 13943 13944 _proto.dispose = function dispose() { 13945 $.removeData(this._element, DATA_KEY$1); 13946 this._element = null; 13947 } // Static 13948 ; 13949 13950 Button._jQueryInterface = function _jQueryInterface(config) { 13951 return this.each(function () { 13952 var data = $(this).data(DATA_KEY$1); 13953 13954 if (!data) { 13955 data = new Button(this); 13956 $(this).data(DATA_KEY$1, data); 13957 } 13958 13959 if (config === 'toggle') { 13960 data[config](); 13961 } 13962 }); 13963 }; 13964 13965 _createClass(Button, null, [{ 13966 key: "VERSION", 13967 get: function get() { 13968 return VERSION$1; 13969 } 13970 }]); 13971 13972 return Button; 13973 }(); 13974 /** 13975 * ------------------------------------------------------------------------ 13976 * Data Api implementation 13977 * ------------------------------------------------------------------------ 13978 */ 13979 13980 13981 $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) { 13982 event.preventDefault(); 13983 var button = event.target; 13984 13985 if (!$(button).hasClass(ClassName$1.BUTTON)) { 13986 button = $(button).closest(Selector$1.BUTTON); 13987 } 13988 13989 Button._jQueryInterface.call($(button), 'toggle'); 13990 }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) { 13991 var button = $(event.target).closest(Selector$1.BUTTON)[0]; 13992 $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type)); 13993 }); 13994 /** 13995 * ------------------------------------------------------------------------ 13996 * jQuery 13997 * ------------------------------------------------------------------------ 13998 */ 13999 14000 $.fn[NAME$1] = Button._jQueryInterface; 14001 $.fn[NAME$1].Constructor = Button; 14002 14003 $.fn[NAME$1].noConflict = function () { 14004 $.fn[NAME$1] = JQUERY_NO_CONFLICT$1; 14005 return Button._jQueryInterface; 14006 }; 14007 14008 /** 14009 * ------------------------------------------------------------------------ 14010 * Constants 14011 * ------------------------------------------------------------------------ 14012 */ 14013 14014 var NAME$2 = 'carousel'; 14015 var VERSION$2 = '4.3.1'; 14016 var DATA_KEY$2 = 'bs.carousel'; 14017 var EVENT_KEY$2 = "." + DATA_KEY$2; 14018 var DATA_API_KEY$2 = '.data-api'; 14019 var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2]; 14020 var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key 14021 14022 var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key 14023 14024 var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch 14025 14026 var SWIPE_THRESHOLD = 40; 14027 var Default = { 14028 interval: 5000, 14029 keyboard: true, 14030 slide: false, 14031 pause: 'hover', 14032 wrap: true, 14033 touch: true 14034 }; 14035 var DefaultType = { 14036 interval: '(number|boolean)', 14037 keyboard: 'boolean', 14038 slide: '(boolean|string)', 14039 pause: '(string|boolean)', 14040 wrap: 'boolean', 14041 touch: 'boolean' 14042 }; 14043 var Direction = { 14044 NEXT: 'next', 14045 PREV: 'prev', 14046 LEFT: 'left', 14047 RIGHT: 'right' 14048 }; 14049 var Event$2 = { 14050 SLIDE: "slide" + EVENT_KEY$2, 14051 SLID: "slid" + EVENT_KEY$2, 14052 KEYDOWN: "keydown" + EVENT_KEY$2, 14053 MOUSEENTER: "mouseenter" + EVENT_KEY$2, 14054 MOUSELEAVE: "mouseleave" + EVENT_KEY$2, 14055 TOUCHSTART: "touchstart" + EVENT_KEY$2, 14056 TOUCHMOVE: "touchmove" + EVENT_KEY$2, 14057 TOUCHEND: "touchend" + EVENT_KEY$2, 14058 POINTERDOWN: "pointerdown" + EVENT_KEY$2, 14059 POINTERUP: "pointerup" + EVENT_KEY$2, 14060 DRAG_START: "dragstart" + EVENT_KEY$2, 14061 LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2, 14062 CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2 14063 }; 14064 var ClassName$2 = { 14065 CAROUSEL: 'carousel', 14066 ACTIVE: 'active', 14067 SLIDE: 'slide', 14068 RIGHT: 'carousel-item-right', 14069 LEFT: 'carousel-item-left', 14070 NEXT: 'carousel-item-next', 14071 PREV: 'carousel-item-prev', 14072 ITEM: 'carousel-item', 14073 POINTER_EVENT: 'pointer-event' 14074 }; 14075 var Selector$2 = { 14076 ACTIVE: '.active', 14077 ACTIVE_ITEM: '.active.carousel-item', 14078 ITEM: '.carousel-item', 14079 ITEM_IMG: '.carousel-item img', 14080 NEXT_PREV: '.carousel-item-next, .carousel-item-prev', 14081 INDICATORS: '.carousel-indicators',
14082 DATA_SLIDE: '[data-slide], [data-slide-to]', 14083 DATA_RIDE: '[data-ride="carousel"]' 14084 }; 14085 var PointerType = { 14086 TOUCH: 'touch', 14087 PEN: 'pen' 14088 /** 14089 * ------------------------------------------------------------------------ 14090 * Class Definition 14091 * ------------------------------------------------------------------------ 14092 */ 14093 14094 }; 14095 14096 var Carousel = 14097 /*#__PURE__*/ 14098 function () { 14099 function Carousel(element, config) { 14100 this._items = null; 14101 this._interval = null; 14102 this._activeElement = null; 14103 this._isPaused = false; 14104 this._isSliding = false; 14105 this.touchTimeout = null; 14106 this.touchStartX = 0; 14107 this.touchDeltaX = 0; 14108 this._config = this._getConfig(config); 14109 this._element = element; 14110 this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS); 14111 this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; 14112 this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent); 14113 14114 this._addEventListeners(); 14115 } // Getters 14116 14117 14118 var _proto = Carousel.prototype; 14119 14120 // Public 14121 _proto.next = function next() { 14122 if (!this._isSliding) { 14123 this._slide(Direction.NEXT); 14124 } 14125 }; 14126 14127 _proto.nextWhenVisible = function nextWhenVisible() { 14128 // Don't call next when the page isn't visible 14129 // or the carousel or its parent isn't visible 14130 if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') { 14131 this.next(); 14132 } 14133 }; 14134 14135 _proto.prev = function prev() { 14136 if (!this._isSliding) { 14137 this._slide(Direction.PREV); 14138 } 14139 }; 14140 14141 _proto.pause = function pause(event) { 14142 if (!event) { 14143 this._isPaused = true; 14144 } 14145 14146 if (this._element.querySelector(Selector$2.NEXT_PREV)) { 14147 Util.triggerTransitionEnd(this._element); 14148 this.cycle(true); 14149 } 14150 14151 clearInterval(this._interval); 14152 this._interval = null; 14153 }; 14154 14155 _proto.cycle = function cycle(event) { 14156 if (!event) { 14157 this._isPaused = false; 14158 } 14159 14160 if (this._interval) { 14161 clearInterval(this._interval); 14162 this._interval = null; 14163 } 14164 14165 if (this._config.interval && !this._isPaused) { 14166 this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); 14167 } 14168 }; 14169 14170 _proto.to = function to(index) { 14171 var _this = this; 14172 14173 this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM); 14174 14175 var activeIndex = this._getItemIndex(this._activeElement); 14176 14177 if (index > this._items.length - 1 || index < 0) { 14178 return; 14179 } 14180 14181 if (this._isSliding) { 14182 $(this._element).one(Event$2.SLID, function () { 14183 return _this.to(index); 14184 }); 14185 return; 14186 } 14187 14188 if (activeIndex === index) { 14189 this.pause(); 14190 this.cycle(); 14191 return; 14192 } 14193 14194 var direction = index > activeIndex ? Direction.NEXT : Direction.PREV; 14195 14196 this._slide(direction, this._items[index]); 14197 }; 14198 14199 _proto.dispose = function dispose() { 14200 $(this._element).off(EVENT_KEY$2); 14201 $.removeData(this._element, DATA_KEY$2); 14202 this._items = null; 14203 this._config = null; 14204 this._element = null; 14205 this._interval = null; 14206 this._isPaused = null; 14207 this._isSliding = null; 14208 this._activeElement = null; 14209 this._indicatorsElement = null; 14210 } // Private 14211 ; 14212 14213 _proto._getConfig = function _getConfig(config) { 14214 config = _objectSpread({}, Default, config); 14215 Util.typeCheckConfig(NAME$2, config, DefaultType); 14216 return config; 14217 }; 14218 14219 _proto._handleSwipe = function _handleSwipe() { 14220 var absDeltax = Math.abs(this.touchDeltaX); 14221 14222 if (absDeltax <= SWIPE_THRESHOLD) { 14223 return; 14224 } 14225 14226 var direction = absDeltax / this.touchDeltaX; // swipe left 14227 14228 if (direction > 0) { 14229 this.prev(); 14230 } // swipe right 14231 14232 14233 if (direction < 0) { 14234 this.next(); 14235 } 14236 }; 14237 14238 _proto._addEventListeners = function _addEventListeners() { 14239 var _this2 = this; 14240 14241 if (this._config.keyboard) { 14242 $(this._element).on(Event$2.KEYDOWN, function (event) { 14243 return _this2._keydown(event); 14244 }); 14245 } 14246 14247 if (this._config.pause === 'hover') { 14248 $(this._element).on(Event$2.MOUSEENTER, function (event) { 14249 return _this2.pause(event); 14250 }).on(Event$2.MOUSELEAVE, function (event) { 14251 return _this2.cycle(event); 14252 }); 14253 } 14254 14255 if (this._config.touch) { 14256 this._addTouchEventListeners(); 14257 } 14258 }; 14259 14260 _proto._addTouchEventListeners = function _addTouchEventListeners() { 14261 var _this3 = this; 14262 14263 if (!this._touchSupported) { 14264 return; 14265 } 14266 14267 var start = function start(event) { 14268 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 14269 _this3.touchStartX = event.originalEvent.clientX; 14270 } else if (!_this3._pointerEvent) { 14271 _this3.touchStartX = event.originalEvent.touches[0].clientX; 14272 } 14273 }; 14274 14275 var move = function move(event) { 14276 // ensure swiping with one touch and not pinching 14277 if (event.originalEvent.touches && event.originalEvent.touches.length > 1) { 14278 _this3.touchDeltaX = 0; 14279 } else { 14280 _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX; 14281 } 14282 }; 14283 14284 var end = function end(event) { 14285 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 14286 _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX; 14287 } 14288 14289 _this3._handleSwipe(); 14290 14291 if (_this3._config.pause === 'hover') {
14292 // If it's a touch-enabled device, mouseenter/leave are fired as 14293 // part of the mouse compatibility events on first tap - the carousel 14294 // would stop cycling until user tapped out of it; 14295 // here, we listen for touchend, explicitly pause the carousel 14296 // (as if it's the second time we tap on it, mouseenter compat event 14297 // is NOT fired) and after a timeout (to allow for mouse compatibility 14298 // events to fire) we explicitly restart cycling 14299 _this3.pause(); 14300 14301 if (_this3.touchTimeout) { 14302 clearTimeout(_this3.touchTimeout); 14303 } 14304 14305 _this3.touchTimeout = setTimeout(function (event) { 14306 return _this3.cycle(event); 14307 }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval); 14308 } 14309 }; 14310 14311 $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) { 14312 return e.preventDefault(); 14313 }); 14314 14315 if (this._pointerEvent) { 14316 $(this._element).on(Event$2.POINTERDOWN, function (event) { 14317 return start(event); 14318 }); 14319 $(this._element).on(Event$2.POINTERUP, function (event) { 14320 return end(event); 14321 }); 14322 14323 this._element.classList.add(ClassName$2.POINTER_EVENT); 14324 } else { 14325 $(this._element).on(Event$2.TOUCHSTART, function (event) { 14326 return start(event); 14327 }); 14328 $(this._element).on(Event$2.TOUCHMOVE, function (event) { 14329 return move(event); 14330 }); 14331 $(this._element).on(Event$2.TOUCHEND, function (event) { 14332 return end(event); 14333 }); 14334 } 14335 }; 14336 14337 _proto._keydown = function _keydown(event) { 14338 if (/input|textarea/i.test(event.target.tagName)) { 14339 return; 14340 } 14341 14342 switch (event.which) { 14343 case ARROW_LEFT_KEYCODE: 14344 event.preventDefault(); 14345 this.prev(); 14346 break; 14347 14348 case ARROW_RIGHT_KEYCODE: 14349 event.preventDefault(); 14350 this.next(); 14351 break; 14352 14353 default: 14354 } 14355 }; 14356 14357 _proto._getItemIndex = function _getItemIndex(element) { 14358 this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : []; 14359 return this._items.indexOf(element); 14360 }; 14361 14362 _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) { 14363 var isNextDirection = direction === Direction.NEXT; 14364 var isPrevDirection = direction === Direction.PREV; 14365 14366 var activeIndex = this._getItemIndex(activeElement); 14367 14368 var lastItemIndex = this._items.length - 1; 14369 var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; 14370 14371 if (isGoingToWrap && !this._config.wrap) { 14372 return activeElement; 14373 } 14374 14375 var delta = direction === Direction.PREV ? -1 : 1; 14376 var itemIndex = (activeIndex + delta) % this._items.length; 14377 return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; 14378 }; 14379 14380 _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { 14381 var targetIndex = this._getItemIndex(relatedTarget); 14382 14383 var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM)); 14384 14385 var slideEvent = $.Event(Event$2.SLIDE, { 14386 relatedTarget: relatedTarget, 14387 direction: eventDirectionName, 14388 from: fromIndex, 14389 to: targetIndex 14390 }); 14391 $(this._element).trigger(slideEvent); 14392 return slideEvent; 14393 }; 14394 14395 _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { 14396 if (this._indicatorsElement) { 14397 var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE)); 14398 $(indicators).removeClass(ClassName$2.ACTIVE); 14399 14400 var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; 14401 14402 if (nextIndicator) { 14403 $(nextIndicator).addClass(ClassName$2.ACTIVE); 14404 } 14405 } 14406 }; 14407 14408 _proto._slide = function _slide(direction, element) { 14409 var _this4 = this; 14410 14411 var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM); 14412 14413 var activeElementIndex = this._getItemIndex(activeElement); 14414 14415 var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); 14416 14417 var nextElementIndex = this._getItemIndex(nextElement); 14418 14419 var isCycling = Boolean(this._interval); 14420 var directionalClassName; 14421 var orderClassName; 14422 var eventDirectionName; 14423 14424 if (direction === Direction.NEXT) { 14425 directionalClassName = ClassName$2.LEFT; 14426 orderClassName = ClassName$2.NEXT; 14427 eventDirectionName = Direction.LEFT; 14428 } else { 14429 directionalClassName = ClassName$2.RIGHT; 14430 orderClassName = ClassName$2.PREV; 14431 eventDirectionName = Direction.RIGHT; 14432 } 14433 14434 if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) { 14435 this._isSliding = false;
14436 return; 14437 } 14438 14439 var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); 14440 14441 if (slideEvent.isDefaultPrevented()) { 14442 return; 14443 } 14444 14445 if (!activeElement || !nextElement) { 14446 // Some weirdness is happening, so we bail 14447 return; 14448 } 14449 14450 this._isSliding = true; 14451 14452 if (isCycling) { 14453 this.pause(); 14454 } 14455 14456 this._setActiveIndicatorElement(nextElement); 14457 14458 var slidEvent = $.Event(Event$2.SLID, { 14459 relatedTarget: nextElement, 14460 direction: eventDirectionName, 14461 from: activeElementIndex, 14462 to: nextElementIndex 14463 }); 14464 14465 if ($(this._element).hasClass(ClassName$2.SLIDE)) { 14466 $(nextElement).addClass(orderClassName); 14467 Util.reflow(nextElement); 14468 $(activeElement).addClass(directionalClassName); 14469 $(nextElement).addClass(directionalClassName); 14470 var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10); 14471 14472 if (nextElementInterval) { 14473 this._config.defaultInterval = this._config.defaultInterval || this._config.interval; 14474 this._config.interval = nextElementInterval; 14475 } else { 14476 this._config.interval = this._config.defaultInterval || this._config.interval; 14477 } 14478 14479 var transitionDuration = Util.getTransitionDurationFromElement(activeElement); 14480 $(activeElement).one(Util.TRANSITION_END, function () { 14481 $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE); 14482 $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName); 14483 _this4._isSliding = false; 14484 setTimeout(function () { 14485 return $(_this4._element).trigger(slidEvent); 14486 }, 0); 14487 }).emulateTransitionEnd(transitionDuration); 14488 } else { 14489 $(activeElement).removeClass(ClassName$2.ACTIVE); 14490 $(nextElement).addClass(ClassName$2.ACTIVE); 14491 this._isSliding = false; 14492 $(this._element).trigger(slidEvent); 14493 } 14494 14495 if (isCycling) { 14496 this.cycle(); 14497 } 14498 } // Static 14499 ; 14500 14501 Carousel._jQueryInterface = function _jQueryInterface(config) { 14502 return this.each(function () { 14503 var data = $(this).data(DATA_KEY$2); 14504 14505 var _config = _objectSpread({}, Default, $(this).data()); 14506 14507 if (typeof config === 'object') { 14508 _config = _objectSpread({}, _config, config); 14509 } 14510 14511 var action = typeof config === 'string' ? config : _config.slide; 14512 14513 if (!data) { 14514 data = new Carousel(this, _config); 14515 $(this).data(DATA_KEY$2, data); 14516 } 14517 14518 if (typeof config === 'number') { 14519 data.to(config); 14520 } else if (typeof action === 'string') { 14521 if (typeof data[action] === 'undefined') { 14522 throw new TypeError("No method named \"" + action + "\""); 14523 } 14524 14525 data[action](); 14526 } else if (_config.interval && _config.ride) { 14527 data.pause(); 14528 data.cycle(); 14529 } 14530 }); 14531 }; 14532 14533 Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { 14534 var selector = Util.getSelectorFromElement(this); 14535 14536 if (!selector) { 14537 return; 14538 } 14539 14540 var target = $(selector)[0]; 14541 14542 if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) { 14543 return; 14544 } 14545 14546 var config = _objectSpread({}, $(target).data(), $(this).data()); 14547 14548 var slideIndex = this.getAttribute('data-slide-to'); 14549 14550 if (slideIndex) { 14551 config.interval = false; 14552 } 14553 14554 Carousel._jQueryInterface.call($(target), config); 14555 14556 if (slideIndex) { 14557 $(target).data(DATA_KEY$2).to(slideIndex); 14558 } 14559 14560 event.preventDefault(); 14561 }; 14562 14563 _createClass(Carousel, null, [{ 14564 key: "VERSION", 14565 get: function get() { 14566 return VERSION$2; 14567 } 14568 }, { 14569 key: "Default", 14570 get: function get() { 14571 return Default; 14572 } 14573 }]); 14574 14575 return Carousel; 14576 }(); 14577 /** 14578 * ------------------------------------------------------------------------ 14579 * Data Api implementation 14580 * ------------------------------------------------------------------------ 14581 */ 14582 14583 14584 $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler); 14585 $(window).on(Event$2.LOAD_DATA_API, function () { 14586 var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE)); 14587 14588 for (var i = 0, len = carousels.length; i < len; i++) {
14589 var $carousel = $(carousels[i]); 14590 14591 Carousel._jQueryInterface.call($carousel, $carousel.data()); 14592 } 14593 }); 14594 /** 14595 * ------------------------------------------------------------------------ 14596 * jQuery 14597 * ------------------------------------------------------------------------ 14598 */ 14599 14600 $.fn[NAME$2] = Carousel._jQueryInterface; 14601 $.fn[NAME$2].Constructor = Carousel; 14602 14603 $.fn[NAME$2].noConflict = function () { 14604 $.fn[NAME$2] = JQUERY_NO_CONFLICT$2; 14605 return Carousel._jQueryInterface; 14606 }; 14607 14608 /** 14609 * ------------------------------------------------------------------------ 14610 * Constants 14611 * ------------------------------------------------------------------------ 14612 */ 14613 14614 var NAME$3 = 'collapse'; 14615 var VERSION$3 = '4.3.1'; 14616 var DATA_KEY$3 = 'bs.collapse'; 14617 var EVENT_KEY$3 = "." + DATA_KEY$3; 14618 var DATA_API_KEY$3 = '.data-api'; 14619 var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3]; 14620 var Default$1 = { 14621 toggle: true, 14622 parent: '' 14623 }; 14624 var DefaultType$1 = { 14625 toggle: 'boolean', 14626 parent: '(string|element)' 14627 }; 14628 var Event$3 = { 14629 SHOW: "show" + EVENT_KEY$3, 14630 SHOWN: "shown" + EVENT_KEY$3, 14631 HIDE: "hide" + EVENT_KEY$3, 14632 HIDDEN: "hidden" + EVENT_KEY$3, 14633 CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3 14634 }; 14635 var ClassName$3 = { 14636 SHOW: 'show', 14637 COLLAPSE: 'collapse', 14638 COLLAPSING: 'collapsing', 14639 COLLAPSED: 'collapsed' 14640 }; 14641 var Dimension = { 14642 WIDTH: 'width', 14643 HEIGHT: 'height' 14644 }; 14645 var Selector$3 = { 14646 ACTIVES: '.show, .collapsing', 14647 DATA_TOGGLE: '[data-toggle="collapse"]' 14648 /** 14649 * ------------------------------------------------------------------------ 14650 * Class Definition 14651 * ------------------------------------------------------------------------ 14652 */ 14653 14654 }; 14655 14656 var Collapse = 14657 /*#__PURE__*/ 14658 function () { 14659 function Collapse(element, config) { 14660 this._isTransitioning = false; 14661 this._element = element; 14662 this._config = this._getConfig(config); 14663 this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); 14664 var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE)); 14665 14666 for (var i = 0, len = toggleList.length; i < len; i++) { 14667 var elem = toggleList[i]; 14668 var selector = Util.getSelectorFromElement(elem); 14669 var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) { 14670 return foundElem === element; 14671 }); 14672 14673 if (selector !== null && filterElement.length > 0) { 14674 this._selector = selector; 14675 14676 this._triggerArray.push(elem); 14677 } 14678 } 14679 14680 this._parent = this._config.parent ? this._getParent() : null; 14681 14682 if (!this._config.parent) { 14683 this._addAriaAndCollapsedClass(this._element, this._triggerArray); 14684 } 14685 14686 if (this._config.toggle) { 14687 this.toggle(); 14688 } 14689 } // Getters 14690 14691 14692 var _proto = Collapse.prototype; 14693 14694 // Public 14695 _proto.toggle = function toggle() { 14696 if ($(this._element).hasClass(ClassName$3.SHOW)) { 14697 this.hide(); 14698 } else { 14699 this.show(); 14700 } 14701 }; 14702 14703 _proto.show = function show() { 14704 var _this = this; 14705 14706 if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) { 14707 return; 14708 } 14709 14710 var actives; 14711 var activesData; 14712 14713 if (this._parent) { 14714 actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) { 14715 if (typeof _this._config.parent === 'string') { 14716 return elem.getAttribute('data-parent') === _this._config.parent; 14717 } 14718 14719 return elem.classList.contains(ClassName$3.COLLAPSE); 14720 }); 14721 14722 if (actives.length === 0) { 14723 actives = null; 14724 } 14725 } 14726 14727 if (actives) { 14728 activesData = $(actives).not(this._selector).data(DATA_KEY$3); 14729 14730 if (activesData && activesData._isTransitioning) { 14731 return; 14732 } 14733 } 14734 14735 var startEvent = $.Event(Event$3.SHOW); 14736 $(this._element).trigger(startEvent); 14737 14738 if (startEvent.isDefaultPrevented()) { 14739 return; 14740 } 14741 14742 if (actives) { 14743 Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide'); 14744 14745 if (!activesData) { 14746 $(actives).data(DATA_KEY$3, null); 14747 } 14748 } 14749 14750 var dimension = this._getDimension(); 14751 14752 $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING); 14753 this._element.style[dimension] = 0; 14754 14755 if (this._triggerArray.length) { 14756 $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true); 14757 } 14758 14759 this.setTransitioning(true); 14760 14761 var complete = function complete() { 14762 $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW); 14763 _this._element.style[dimension] = ''; 14764 14765 _this.setTransitioning(false); 14766 14767 $(_this._element).trigger(Event$3.SHOWN); 14768 }; 14769 14770 var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 14771 var scrollSize = "scroll" + capitalizedDimension; 14772 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 14773 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 14774 this._element.style[dimension] = this._element[scrollSize] + "px"; 14775 }; 14776 14777 _proto.hide = function hide() { 14778 var _this2 = this; 14779 14780 if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) { 14781 return; 14782 } 14783 14784 var startEvent = $.Event(Event$3.HIDE); 14785 $(this._element).trigger(startEvent); 14786 14787 if (startEvent.isDefaultPrevented()) { 14788 return; 14789 } 14790 14791 var dimension = this._getDimension(); 14792 14793 this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; 14794 Util.reflow(this._element); 14795 $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW); 14796 var triggerArrayLength = this._triggerArray.length; 14797 14798 if (triggerArrayLength > 0) { 14799 for (var i = 0; i < triggerArrayLength; i++) { 14800 var trigger = this._triggerArray[i]; 14801 var selector = Util.getSelectorFromElement(trigger); 14802 14803 if (selector !== null) { 14804 var $elem = $([].slice.call(document.querySelectorAll(selector))); 14805 14806 if (!$elem.hasClass(ClassName$3.SHOW)) { 14807 $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false); 14808 } 14809 } 14810 } 14811 } 14812 14813 this.setTransitioning(true); 14814 14815 var complete = function complete() { 14816 _this2.setTransitioning(false); 14817 14818 $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN); 14819 }; 14820 14821 this._element.style[dimension] = ''; 14822 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 14823 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 14824 }; 14825 14826 _proto.setTransitioning = function setTransitioning(isTransitioning) { 14827 this._isTransitioning = isTransitioning; 14828 }; 14829 14830 _proto.dispose = function dispose() { 14831 $.removeData(this._element, DATA_KEY$3); 14832 this._config = null; 14833 this._parent = null; 14834 this._element = null; 14835 this._triggerArray = null; 14836 this._isTransitioning = null; 14837 } // Private 14838 ; 14839 14840 _proto._getConfig = function _getConfig(config) { 14841 config = _objectSpread({}, Default$1, config); 14842 config.toggle = Boolean(config.toggle); // Coerce string values 14843 14844 Util.typeCheckConfig(NAME$3, config, DefaultType$1); 14845 return config; 14846 }; 14847 14848 _proto._getDimension = function _getDimension() { 14849 var hasWidth = $(this._element).hasClass(Dimension.WIDTH); 14850 return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT; 14851 }; 14852 14853 _proto._getParent = function _getParent() { 14854 var _this3 = this; 14855 14856 var parent; 14857 14858 if (Util.isElement(this._config.parent)) { 14859 parent = this._config.parent; // It's a jQuery object 14860 14861 if (typeof this._config.parent.jquery !== 'undefined') { 14862 parent = this._config.parent[0]; 14863 } 14864 } else { 14865 parent = document.querySelector(this._config.parent); 14866 } 14867 14868 var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; 14869 var children = [].slice.call(parent.querySelectorAll(selector)); 14870 $(children).each(function (i, element) { 14871 _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); 14872 }); 14873 return parent; 14874 }; 14875 14876 _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { 14877 var isOpen = $(element).hasClass(ClassName$3.SHOW); 14878 14879 if (triggerArray.length) { 14880 $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen); 14881 } 14882 } // Static 14883 ; 14884 14885 Collapse._getTargetFromElement = function _getTargetFromElement(element) { 14886 var selector = Util.getSelectorFromElement(element); 14887 return selector ? document.querySelector(selector) : null; 14888 }; 14889 14890 Collapse._jQueryInterface = function _jQueryInterface(config) { 14891 return this.each(function () { 14892 var $this = $(this); 14893 var data = $this.data(DATA_KEY$3); 14894 14895 var _config = _objectSpread({}, Default$1, $this.data(), typeof config === 'object' && config ? config : {}); 14896 14897 if (!data && _config.toggle && /show|hide/.test(config)) { 14898 _config.toggle = false;
14899 } 14900 14901 if (!data) { 14902 data = new Collapse(this, _config); 14903 $this.data(DATA_KEY$3, data); 14904 } 14905 14906 if (typeof config === 'string') { 14907 if (typeof data[config] === 'undefined') { 14908 throw new TypeError("No method named \"" + config + "\""); 14909 } 14910 14911 data[config](); 14912 } 14913 }); 14914 }; 14915 14916 _createClass(Collapse, null, [{ 14917 key: "VERSION", 14918 get: function get() { 14919 return VERSION$3; 14920 } 14921 }, { 14922 key: "Default", 14923 get: function get() { 14924 return Default$1; 14925 } 14926 }]); 14927 14928 return Collapse; 14929 }(); 14930 /** 14931 * ------------------------------------------------------------------------ 14932 * Data Api implementation 14933 * ------------------------------------------------------------------------ 14934 */ 14935 14936 14937 $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) { 14938 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 14939 if (event.currentTarget.tagName === 'A') { 14940 event.preventDefault(); 14941 } 14942 14943 var $trigger = $(this); 14944 var selector = Util.getSelectorFromElement(this); 14945 var selectors = [].slice.call(document.querySelectorAll(selector)); 14946 $(selectors).each(function () { 14947 var $target = $(this); 14948 var data = $target.data(DATA_KEY$3); 14949 var config = data ? 'toggle' : $trigger.data(); 14950 14951 Collapse._jQueryInterface.call($target, config); 14952 }); 14953 }); 14954 /** 14955 * ------------------------------------------------------------------------ 14956 * jQuery 14957 * ------------------------------------------------------------------------ 14958 */ 14959 14960 $.fn[NAME$3] = Collapse._jQueryInterface; 14961 $.fn[NAME$3].Constructor = Collapse; 14962 14963 $.fn[NAME$3].noConflict = function () { 14964 $.fn[NAME$3] = JQUERY_NO_CONFLICT$3; 14965 return Collapse._jQueryInterface; 14966 }; 14967 14968 /** 14969 * ------------------------------------------------------------------------ 14970 * Constants 14971 * ------------------------------------------------------------------------ 14972 */ 14973 14974 var NAME$4 = 'dropdown'; 14975 var VERSION$4 = '4.3.1'; 14976 var DATA_KEY$4 = 'bs.dropdown'; 14977 var EVENT_KEY$4 = "." + DATA_KEY$4; 14978 var DATA_API_KEY$4 = '.data-api'; 14979 var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4]; 14980 var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key 14981 14982 var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key 14983 14984 var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key 14985 14986 var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key 14987 14988 var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key 14989 14990 var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) 14991 14992 var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE); 14993 var Event$4 = { 14994 HIDE: "hide" + EVENT_KEY$4, 14995 HIDDEN: "hidden" + EVENT_KEY$4, 14996 SHOW: "show" + EVENT_KEY$4, 14997 SHOWN: "shown" + EVENT_KEY$4, 14998 CLICK: "click" + EVENT_KEY$4, 14999 CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4, 15000 KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4, 15001 KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4 15002 }; 15003 var ClassName$4 = { 15004 DISABLED: 'disabled', 15005 SHOW: 'show', 15006 DROPUP: 'dropup', 15007 DROPRIGHT: 'dropright', 15008 DROPLEFT: 'dropleft', 15009 MENURIGHT: 'dropdown-menu-right', 15010 MENULEFT: 'dropdown-menu-left', 15011 POSITION_STATIC: 'position-static' 15012 }; 15013 var Selector$4 = { 15014 DATA_TOGGLE: '[data-toggle="dropdown"]', 15015 FORM_CHILD: '.dropdown form', 15016 MENU: '.dropdown-menu', 15017 NAVBAR_NAV: '.navbar-nav', 15018 VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)' 15019 }; 15020 var AttachmentMap = { 15021 TOP: 'top-start', 15022 TOPEND: 'top-end', 15023 BOTTOM: 'bottom-start', 15024 BOTTOMEND: 'bottom-end', 15025 RIGHT: 'right-start', 15026 RIGHTEND: 'right-end', 15027 LEFT: 'left-start', 15028 LEFTEND: 'left-end' 15029 }; 15030 var Default$2 = { 15031 offset: 0, 15032 flip: true, 15033 boundary: 'scrollParent', 15034 reference: 'toggle', 15035 display: 'dynamic' 15036 }; 15037 var DefaultType$2 = { 15038 offset: '(number|string|function)', 15039 flip: 'boolean', 15040 boundary: '(string|element)', 15041 reference: '(string|element)', 15042 display: 'string' 15043 /** 15044 * ------------------------------------------------------------------------ 15045 * Class Definition 15046 * ------------------------------------------------------------------------ 15047 */ 15048 15049 }; 15050 15051 var Dropdown = 15052 /*#__PURE__*/ 15053 function () { 15054 function Dropdown(element, config) { 15055 this._element = element; 15056 this._popper = null; 15057 this._config = this._getConfig(config); 15058 this._menu = this._getMenuElement(); 15059 this._inNavbar = this._detectNavbar(); 15060 15061 this._addEventListeners(); 15062 } // Getters 15063 15064 15065 var _proto = Dropdown.prototype; 15066 15067 // Public
15068 _proto.toggle = function toggle() { 15069 if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) { 15070 return; 15071 } 15072 15073 var parent = Dropdown._getParentFromElement(this._element); 15074 15075 var isActive = $(this._menu).hasClass(ClassName$4.SHOW); 15076 15077 Dropdown._clearMenus(); 15078 15079 if (isActive) { 15080 return; 15081 } 15082 15083 var relatedTarget = { 15084 relatedTarget: this._element 15085 }; 15086 var showEvent = $.Event(Event$4.SHOW, relatedTarget); 15087 $(parent).trigger(showEvent); 15088 15089 if (showEvent.isDefaultPrevented()) { 15090 return; 15091 } // Disable totally Popper.js for Dropdown in Navbar 15092 15093 15094 if (!this._inNavbar) { 15095 /** 15096 * Check for Popper dependency 15097 * Popper - https://popper.js.org 15098 */ 15099 if (typeof Popper === 'undefined') { 15100 throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)'); 15101 } 15102 15103 var referenceElement = this._element; 15104 15105 if (this._config.reference === 'parent') { 15106 referenceElement = parent; 15107 } else if (Util.isElement(this._config.reference)) { 15108 referenceElement = this._config.reference; // Check if it's jQuery element 15109 15110 if (typeof this._config.reference.jquery !== 'undefined') { 15111 referenceElement = this._config.reference[0]; 15112 } 15113 } // If boundary is not `scrollParent`, then set position to `static` 15114 // to allow the menu to "escape" the scroll parent's boundaries 15115 // https://github.com/twbs/bootstrap/issues/24251 15116 15117 15118 if (this._config.boundary !== 'scrollParent') { 15119 $(parent).addClass(ClassName$4.POSITION_STATIC); 15120 } 15121 15122 this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig()); 15123 } // If this is a touch-enabled device we add extra 15124 // empty mouseover listeners to the body's immediate children; 15125 // only needed because of broken event delegation on iOS 15126 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 15127 15128 15129 if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) { 15130 $(document.body).children().on('mouseover', null, $.noop); 15131 } 15132 15133 this._element.focus(); 15134 15135 this._element.setAttribute('aria-expanded', true); 15136 15137 $(this._menu).toggleClass(ClassName$4.SHOW); 15138 $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget)); 15139 }; 15140 15141 _proto.show = function show() { 15142 if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) { 15143 return; 15144 } 15145 15146 var relatedTarget = { 15147 relatedTarget: this._element 15148 }; 15149 var showEvent = $.Event(Event$4.SHOW, relatedTarget); 15150 15151 var parent = Dropdown._getParentFromElement(this._element); 15152 15153 $(parent).trigger(showEvent); 15154 15155 if (showEvent.isDefaultPrevented()) { 15156 return; 15157 } 15158 15159 $(this._menu).toggleClass(ClassName$4.SHOW); 15160 $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget)); 15161 }; 15162 15163 _proto.hide = function hide() { 15164 if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) { 15165 return; 15166 } 15167 15168 var relatedTarget = { 15169 relatedTarget: this._element 15170 }; 15171 var hideEvent = $.Event(Event$4.HIDE, relatedTarget); 15172 15173 var parent = Dropdown._getParentFromElement(this._element); 15174 15175 $(parent).trigger(hideEvent); 15176 15177 if (hideEvent.isDefaultPrevented()) { 15178 return; 15179 } 15180 15181 $(this._menu).toggleClass(ClassName$4.SHOW); 15182 $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget)); 15183 }; 15184 15185 _proto.dispose = function dispose() { 15186 $.removeData(this._element, DATA_KEY$4); 15187 $(this._element).off(EVENT_KEY$4); 15188 this._element = null; 15189 this._menu = null; 15190 15191 if (this._popper !== null) { 15192 this._popper.destroy(); 15193 15194 this._popper = null; 15195 } 15196 }; 15197
15198 _proto.update = function update() { 15199 this._inNavbar = this._detectNavbar(); 15200 15201 if (this._popper !== null) { 15202 this._popper.scheduleUpdate(); 15203 } 15204 } // Private 15205 ; 15206 15207 _proto._addEventListeners = function _addEventListeners() { 15208 var _this = this; 15209 15210 $(this._element).on(Event$4.CLICK, function (event) { 15211 event.preventDefault(); 15212 event.stopPropagation(); 15213 15214 _this.toggle(); 15215 }); 15216 }; 15217 15218 _proto._getConfig = function _getConfig(config) { 15219 config = _objectSpread({}, this.constructor.Default, $(this._element).data(), config); 15220 Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType); 15221 return config; 15222 }; 15223 15224 _proto._getMenuElement = function _getMenuElement() { 15225 if (!this._menu) { 15226 var parent = Dropdown._getParentFromElement(this._element); 15227 15228 if (parent) { 15229 this._menu = parent.querySelector(Selector$4.MENU); 15230 } 15231 } 15232 15233 return this._menu; 15234 }; 15235 15236 _proto._getPlacement = function _getPlacement() { 15237 var $parentDropdown = $(this._element.parentNode); 15238 var placement = AttachmentMap.BOTTOM; // Handle dropup 15239 15240 if ($parentDropdown.hasClass(ClassName$4.DROPUP)) { 15241 placement = AttachmentMap.TOP; 15242 15243 if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) { 15244 placement = AttachmentMap.TOPEND; 15245 } 15246 } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) { 15247 placement = AttachmentMap.RIGHT; 15248 } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) { 15249 placement = AttachmentMap.LEFT; 15250 } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) { 15251 placement = AttachmentMap.BOTTOMEND; 15252 } 15253 15254 return placement; 15255 }; 15256 15257 _proto._detectNavbar = function _detectNavbar() { 15258 return $(this._element).closest('.navbar').length > 0; 15259 }; 15260 15261 _proto._getOffset = function _getOffset() { 15262 var _this2 = this; 15263 15264 var offset = {}; 15265 15266 if (typeof this._config.offset === 'function') { 15267 offset.fn = function (data) { 15268 data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {}); 15269 return data; 15270 }; 15271 } else { 15272 offset.offset = this._config.offset; 15273 } 15274 15275 return offset; 15276 }; 15277 15278 _proto._getPopperConfig = function _getPopperConfig() { 15279 var popperConfig = { 15280 placement: this._getPlacement(), 15281 modifiers: { 15282 offset: this._getOffset(), 15283 flip: { 15284 enabled: this._config.flip 15285 }, 15286 preventOverflow: { 15287 boundariesElement: this._config.boundary 15288 } 15289 } // Disable Popper.js if we have a static display 15290 15291 }; 15292 15293 if (this._config.display === 'static') { 15294 popperConfig.modifiers.applyStyle = { 15295 enabled: false 15296 }; 15297 } 15298 15299 return popperConfig; 15300 } // Static 15301 ; 15302 15303 Dropdown._jQueryInterface = function _jQueryInterface(config) { 15304 return this.each(function () { 15305 var data = $(this).data(DATA_KEY$4); 15306 15307 var _config = typeof config === 'object' ? config : null; 15308 15309 if (!data) { 15310 data = new Dropdown(this, _config); 15311 $(this).data(DATA_KEY$4, data); 15312 } 15313 15314 if (typeof config === 'string') { 15315 if (typeof data[config] === 'undefined') { 15316 throw new TypeError("No method named \"" + config + "\""); 15317 } 15318 15319 data[config](); 15320 } 15321 }); 15322 }; 15323 15324 Dropdown._clearMenus = function _clearMenus(event) { 15325 if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) { 15326 return; 15327 } 15328 15329 var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE)); 15330 15331 for (var i = 0, len = toggles.length; i < len; i++) { 15332 var parent = Dropdown._getParentFromElement(toggles[i]); 15333 15334 var context = $(toggles[i]).data(DATA_KEY$4); 15335 var relatedTarget = { 15336 relatedTarget: toggles[i] 15337 }; 15338 15339 if (event && event.type === 'click') { 15340 relatedTarget.clickEvent = event; 15341 } 15342 15343 if (!context) { 15344 continue; 15345 } 15346 15347 var dropdownMenu = context._menu; 15348 15349 if (!$(parent).hasClass(ClassName$4.SHOW)) { 15350 continue; 15351 } 15352 15353 if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) { 15354 continue; 15355 } 15356 15357 var hideEvent = $.Event(Event$4.HIDE, relatedTarget); 15358 $(parent).trigger(hideEvent); 15359 15360 if (hideEvent.isDefaultPrevented()) { 15361 continue; 15362 } // If this is a touch-enabled device we remove the extra 15363 // empty mouseover listeners we added for iOS support 15364 15365 15366 if ('ontouchstart' in document.documentElement) { 15367 $(document.body).children().off('mouseover', null, $.noop); 15368 } 15369 15370 toggles[i].setAttribute('aria-expanded', 'false'); 15371 $(dropdownMenu).removeClass(ClassName$4.SHOW); 15372 $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget)); 15373 } 15374 }; 15375 15376 Dropdown._getParentFromElement = function _getParentFromElement(element) { 15377 var parent; 15378 var selector = Util.getSelectorFromElement(element); 15379 15380 if (selector) { 15381 parent = document.querySelector(selector); 15382 } 15383 15384 return parent || element.parentNode; 15385 } // eslint-disable-next-line complexity 15386 ; 15387 15388 Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { 15389 // If not input/textarea: 15390 // - And not a key in REGEXP_KEYDOWN => not a dropdown command 15391 // If input/textarea: 15392 // - If space key => not a dropdown command 15393 // - If key is other than escape 15394 // - If key is not up or down => not a dropdown command 15395 // - If trigger inside the menu =>
15395 not a dropdown command 15396 if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) { 15397 return; 15398 } 15399 15400 event.preventDefault(); 15401 event.stopPropagation(); 15402 15403 if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) { 15404 return; 15405 } 15406 15407 var parent = Dropdown._getParentFromElement(this); 15408 15409 var isActive = $(parent).hasClass(ClassName$4.SHOW); 15410 15411 if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { 15412 if (event.which === ESCAPE_KEYCODE) { 15413 var toggle = parent.querySelector(Selector$4.DATA_TOGGLE); 15414 $(toggle).trigger('focus'); 15415 } 15416 15417 $(this).trigger('click'); 15418 return; 15419 } 15420 15421 var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)); 15422 15423 if (items.length === 0) { 15424 return; 15425 } 15426 15427 var index = items.indexOf(event.target); 15428 15429 if (event.which === ARROW_UP_KEYCODE && index > 0) { 15430 // Up 15431 index--; 15432 } 15433 15434 if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { 15435 // Down 15436 index++; 15437 } 15438 15439 if (index < 0) { 15440 index = 0; 15441 } 15442 15443 items[index].focus(); 15444 }; 15445 15446 _createClass(Dropdown, null, [{ 15447 key: "VERSION", 15448 get: function get() { 15449 return VERSION$4; 15450 } 15451 }, { 15452 key: "Default", 15453 get: function get() { 15454 return Default$2; 15455 } 15456 }, { 15457 key: "DefaultType", 15458 get: function get() { 15459 return DefaultType$2; 15460 } 15461 }]); 15462 15463 return Dropdown; 15464 }(); 15465 /** 15466 * ------------------------------------------------------------------------ 15467 * Data Api implementation 15468 * ------------------------------------------------------------------------ 15469 */ 15470 15471 15472 $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) { 15473 event.preventDefault(); 15474 event.stopPropagation(); 15475 15476 Dropdown._jQueryInterface.call($(this), 'toggle'); 15477 }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) { 15478 e.stopPropagation(); 15479 }); 15480 /** 15481 * ------------------------------------------------------------------------ 15482 * jQuery 15483 * ------------------------------------------------------------------------ 15484 */ 15485 15486 $.fn[NAME$4] = Dropdown._jQueryInterface; 15487 $.fn[NAME$4].Constructor = Dropdown; 15488 15489 $.fn[NAME$4].noConflict = function () { 15490 $.fn[NAME$4] = JQUERY_NO_CONFLICT$4; 15491 return Dropdown._jQueryInterface; 15492 }; 15493 15494 /** 15495 * ------------------------------------------------------------------------ 15496 * Constants 15497 * ------------------------------------------------------------------------ 15498 */ 15499 15500 var NAME$5 = 'modal'; 15501 var VERSION$5 = '4.3.1'; 15502 var DATA_KEY$5 = 'bs.modal'; 15503 var EVENT_KEY$5 = "." + DATA_KEY$5; 15504 var DATA_API_KEY$5 = '.data-api'; 15505 var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5]; 15506 var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key 15507 15508 var Default$3 = { 15509 backdrop: true, 15510 keyboard: true, 15511 focus: true, 15512 show: true 15513 }; 15514 var DefaultType$3 = { 15515 backdrop: '(boolean|string)', 15516 keyboard: 'boolean', 15517 focus: 'boolean', 15518 show: 'boolean' 15519 }; 15520 var Event$5 = { 15521 HIDE: "hide" + EVENT_KEY$5, 15522 HIDDEN: "hidden" + EVENT_KEY$5, 15523 SHOW: "show" + EVENT_KEY$5, 15524 SHOWN: "shown" + EVENT_KEY$5, 15525 FOCUSIN: "focusin" + EVENT_KEY$5, 15526 RESIZE: "resize" + EVENT_KEY$5, 15527 CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5, 15528 KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5, 15529 MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5, 15530 MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5, 15531 CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5 15532 }; 15533 var ClassName$5 = {
15534 SCROLLABLE: 'modal-dialog-scrollable', 15535 SCROLLBAR_MEASURER: 'modal-scrollbar-measure', 15536 BACKDROP: 'modal-backdrop', 15537 OPEN: 'modal-open', 15538 FADE: 'fade', 15539 SHOW: 'show' 15540 }; 15541 var Selector$5 = { 15542 DIALOG: '.modal-dialog', 15543 MODAL_BODY: '.modal-body', 15544 DATA_TOGGLE: '[data-toggle="modal"]', 15545 DATA_DISMISS: '[data-dismiss="modal"]', 15546 FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top', 15547 STICKY_CONTENT: '.sticky-top' 15548 /** 15549 * ------------------------------------------------------------------------ 15550 * Class Definition 15551 * ------------------------------------------------------------------------ 15552 */ 15553 15554 }; 15555 15556 var Modal = 15557 /*#__PURE__*/ 15558 function () { 15559 function Modal(element, config) { 15560 this._config = this._getConfig(config); 15561 this._element = element; 15562 this._dialog = element.querySelector(Selector$5.DIALOG); 15563 this._backdrop = null; 15564 this._isShown = false; 15565 this._isBodyOverflowing = false; 15566 this._ignoreBackdropClick = false; 15567 this._isTransitioning = false; 15568 this._scrollbarWidth = 0; 15569 } // Getters 15570 15571 15572 var _proto = Modal.prototype; 15573 15574 // Public 15575 _proto.toggle = function toggle(relatedTarget) { 15576 return this._isShown ? this.hide() : this.show(relatedTarget); 15577 }; 15578 15579 _proto.show = function show(relatedTarget) { 15580 var _this = this; 15581 15582 if (this._isShown || this._isTransitioning) { 15583 return; 15584 } 15585 15586 if ($(this._element).hasClass(ClassName$5.FADE)) { 15587 this._isTransitioning = true; 15588 } 15589 15590 var showEvent = $.Event(Event$5.SHOW, { 15591 relatedTarget: relatedTarget 15592 }); 15593 $(this._element).trigger(showEvent); 15594 15595 if (this._isShown || showEvent.isDefaultPrevented()) { 15596 return; 15597 } 15598 15599 this._isShown = true; 15600 15601 this._checkScrollbar(); 15602 15603 this._setScrollbar(); 15604 15605 this._adjustDialog(); 15606 15607 this._setEscapeEvent(); 15608 15609 this._setResizeEvent(); 15610 15611 $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) { 15612 return _this.hide(event); 15613 }); 15614 $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () { 15615 $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) { 15616 if ($(event.target).is(_this._element)) { 15617 _this._ignoreBackdropClick = true; 15618 } 15619 }); 15620 }); 15621 15622 this._showBackdrop(function () { 15623 return _this._showElement(relatedTarget); 15624 }); 15625 }; 15626 15627 _proto.hide = function hide(event) { 15628 var _this2 = this; 15629 15630 if (event) { 15631 event.preventDefault(); 15632 } 15633 15634 if (!this._isShown || this._isTransitioning) { 15635 return; 15636 } 15637 15638 var hideEvent = $.Event(Event$5.HIDE); 15639 $(this._element).trigger(hideEvent); 15640 15641 if (!this._isShown || hideEvent.isDefaultPrevented()) { 15642 return; 15643 } 15644 15645 this._isShown = false; 15646 var transition = $(this._element).hasClass(ClassName$5.FADE); 15647 15648 if (transition) { 15649 this._isTransitioning = true; 15650 } 15651 15652 this._setEscapeEvent(); 15653 15654 this._setResizeEvent(); 15655 15656 $(document).off(Event$5.FOCUSIN); 15657 $(this._element).removeClass(ClassName$5.SHOW); 15658 $(this._element).off(Event$5.CLICK_DISMISS); 15659 $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS); 15660 15661 if (transition) { 15662 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 15663 $(this._element).one(Util.TRANSITION_END, function (event) { 15664 return _this2._hideModal(event); 15665 }).emulateTransitionEnd(transitionDuration); 15666 } else { 15667 this._hideModal(); 15668 } 15669 }; 15670 15671 _proto.dispose = function dispose() { 15672 [window, this._element, this._dialog].forEach(function (htmlElement) { 15673 return $(htmlElement).off(EVENT_KEY$5); 15674 }); 15675 /** 15676 * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API` 15677 * Do not move `document` in `htmlElements` array 15678 * It will remove `Event.CLICK_DATA_API` event that should remain 15679 */ 15680 15681 $(document).off(Event$5.FOCUSIN); 15682 $.removeData(this._element, DATA_KEY$5); 15683 this._config = null; 15684 this._element = null; 15685 this._dialog = null; 15686 this._backdrop = null; 15687 this._isShown = null; 15688 this._isBodyOverflowing = null; 15689 this._ignoreBackdropClick = null; 15690 this._isTransitioning = null; 15691 this._scrollbarWidth = null; 15692 }; 15693 15694 _proto.handleUpdate = function handleUpdate() { 15695 this._adjustDialog(); 15696 } // Private 15697 ; 15698 15699 _proto._getConfig = function _getConfig(config) { 15700 config = _objectSpread({}, Default$3, config); 15701 Util.typeCheckConfig(NAME$5, config, DefaultType$3); 15702 return config; 15703 }; 15704 15705 _proto._showElement = function _showElement(relatedTarget) { 15706 var _this3 = this; 15707 15708 var transition = $(this._element).hasClass(ClassName$5.FADE); 15709 15710 if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { 15711 // Don't move modal's DOM position 15712 document.body.appendChild(this._element); 15713 } 15714 15715 this._element.style.display = 'block'; 15716 15717 this._element.removeAttribute('aria-hidden'); 15718 15719 this._element.setAttribute('aria-modal', true); 15720 15721 if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE)) { 15722 this._dialog.querySelector(Selector$5.MODAL_BODY).scrollTop = 0; 15723 } else { 15724 this._element.scrollTop = 0; 15725 } 15726 15727 if (transition) { 15728 Util.reflow(this._element); 15729 } 15730 15731 $(this._element).addClass(ClassName$5.SHOW); 15732 15733 if (this._config.focus) { 15734 this._enforceFocus(); 15735 } 15736 15737 var shownEvent = $.Event(Event$5.SHOWN, { 15738 relatedTarget: relatedTarget 15739 }); 15740 15741 var transitionComplete = function transitionComplete() { 15742 if (_this3._config.focus) { 15743 _this3._element.focus(); 15744 } 15745 15746 _this3._isTransitioning = false;
15747 $(_this3._element).trigger(shownEvent); 15748 }; 15749 15750 if (transition) { 15751 var transitionDuration = Util.getTransitionDurationFromElement(this._dialog); 15752 $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration); 15753 } else { 15754 transitionComplete(); 15755 } 15756 }; 15757 15758 _proto._enforceFocus = function _enforceFocus() { 15759 var _this4 = this; 15760 15761 $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop 15762 .on(Event$5.FOCUSIN, function (event) { 15763 if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) { 15764 _this4._element.focus(); 15765 } 15766 }); 15767 }; 15768 15769 _proto._setEscapeEvent = function _setEscapeEvent() { 15770 var _this5 = this; 15771 15772 if (this._isShown && this._config.keyboard) { 15773 $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) { 15774 if (event.which === ESCAPE_KEYCODE$1) { 15775 event.preventDefault(); 15776 15777 _this5.hide(); 15778 } 15779 }); 15780 } else if (!this._isShown) { 15781 $(this._element).off(Event$5.KEYDOWN_DISMISS); 15782 } 15783 }; 15784 15785 _proto._setResizeEvent = function _setResizeEvent() { 15786 var _this6 = this; 15787 15788 if (this._isShown) { 15789 $(window).on(Event$5.RESIZE, function (event) { 15790 return _this6.handleUpdate(event); 15791 }); 15792 } else { 15793 $(window).off(Event$5.RESIZE); 15794 } 15795 }; 15796 15797 _proto._hideModal = function _hideModal() { 15798 var _this7 = this; 15799 15800 this._element.style.display = 'none'; 15801 15802 this._element.setAttribute('aria-hidden', true); 15803 15804 this._element.removeAttribute('aria-modal'); 15805 15806 this._isTransitioning = false; 15807 15808 this._showBackdrop(function () { 15809 $(document.body).removeClass(ClassName$5.OPEN); 15810 15811 _this7._resetAdjustments(); 15812 15813 _this7._resetScrollbar(); 15814 15815 $(_this7._element).trigger(Event$5.HIDDEN); 15816 }); 15817 }; 15818 15819 _proto._removeBackdrop = function _removeBackdrop() { 15820 if (this._backdrop) { 15821 $(this._backdrop).remove(); 15822 this._backdrop = null; 15823 } 15824 }; 15825 15826 _proto._showBackdrop = function _showBackdrop(callback) { 15827 var _this8 = this; 15828 15829 var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : ''; 15830 15831 if (this._isShown && this._config.backdrop) { 15832 this._backdrop = document.createElement('div'); 15833 this._backdrop.className = ClassName$5.BACKDROP; 15834 15835 if (animate) { 15836 this._backdrop.classList.add(animate); 15837 } 15838 15839 $(this._backdrop).appendTo(document.body); 15840 $(this._element).on(Event$5.CLICK_DISMISS, function (event) { 15841 if (_this8._ignoreBackdropClick) { 15842 _this8._ignoreBackdropClick = false; 15843 return; 15844 } 15845 15846 if (event.target !== event.currentTarget) { 15847 return; 15848 } 15849 15850 if (_this8._config.backdrop === 'static') { 15851 _this8._element.focus(); 15852 } else { 15853 _this8.hide(); 15854 } 15855 }); 15856 15857 if (animate) { 15858 Util.reflow(this._backdrop); 15859 } 15860 15861 $(this._backdrop).addClass(ClassName$5.SHOW); 15862 15863 if (!callback) { 15864 return; 15865 } 15866 15867 if (!animate) { 15868 callback(); 15869 return; 15870 } 15871 15872 var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 15873 $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration); 15874 } else if (!this._isShown && this._backdrop) { 15875 $(this._backdrop).removeClass(ClassName$5.SHOW); 15876 15877 var callbackRemove = function callbackRemove() { 15878 _this8._removeBackdrop(); 15879 15880 if (callback) { 15881 callback(); 15882 } 15883 }; 15884 15885 if ($(this._element).hasClass(ClassName$5.FADE)) { 15886 var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 15887 15888 $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration); 15889 } else { 15890 callbackRemove(); 15891 } 15892 } else if (callback) { 15893 callback(); 15894 } 15895 } // ---------------------------------------------------------------------- 15896 // the following methods are used to handle overflowing modals 15897 // todo (fat): these should probably be refactored out of modal.js 15898 // ---------------------------------------------------------------------- 15899 ; 15900
15901 _proto._adjustDialog = function _adjustDialog() { 15902 var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 15903 15904 if (!this._isBodyOverflowing && isModalOverflowing) { 15905 this._element.style.paddingLeft = this._scrollbarWidth + "px"; 15906 } 15907 15908 if (this._isBodyOverflowing && !isModalOverflowing) { 15909 this._element.style.paddingRight = this._scrollbarWidth + "px"; 15910 } 15911 }; 15912 15913 _proto._resetAdjustments = function _resetAdjustments() { 15914 this._element.style.paddingLeft = ''; 15915 this._element.style.paddingRight = ''; 15916 }; 15917 15918 _proto._checkScrollbar = function _checkScrollbar() { 15919 var rect = document.body.getBoundingClientRect(); 15920 this._isBodyOverflowing = rect.left + rect.right < window.innerWidth; 15921 this._scrollbarWidth = this._getScrollbarWidth(); 15922 }; 15923 15924 _proto._setScrollbar = function _setScrollbar() { 15925 var _this9 = this; 15926 15927 if (this._isBodyOverflowing) { 15928 // Note: DOMNode.style.paddingRight returns the actual value or '' if not set 15929 // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set 15930 var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT)); 15931 var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding 15932 15933 $(fixedContent).each(function (index, element) { 15934 var actualPadding = element.style.paddingRight; 15935 var calculatedPadding = $(element).css('padding-right'); 15936 $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px"); 15937 }); // Adjust sticky content margin 15938 15939 $(stickyContent).each(function (index, element) { 15940 var actualMargin = element.style.marginRight; 15941 var calculatedMargin = $(element).css('margin-right'); 15942 $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px"); 15943 }); // Adjust body padding 15944 15945 var actualPadding = document.body.style.paddingRight; 15946 var calculatedPadding = $(document.body).css('padding-right'); 15947 $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px"); 15948 } 15949 15950 $(document.body).addClass(ClassName$5.OPEN); 15951 }; 15952 15953 _proto._resetScrollbar = function _resetScrollbar() { 15954 // Restore fixed content padding 15955 var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT)); 15956 $(fixedContent).each(function (index, element) { 15957 var padding = $(element).data('padding-right'); 15958 $(element).removeData('padding-right'); 15959 element.style.paddingRight = padding ? padding : ''; 15960 }); // Restore sticky content 15961 15962 var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT)); 15963 $(elements).each(function (index, element) { 15964 var margin = $(element).data('margin-right'); 15965 15966 if (typeof margin !== 'undefined') { 15967 $(element).css('margin-right', margin).removeData('margin-right'); 15968 } 15969 }); // Restore body padding 15970 15971 var padding = $(document.body).data('padding-right'); 15972 $(document.body).removeData('padding-right'); 15973 document.body.style.paddingRight = padding ? padding : ''; 15974 }; 15975 15976 _proto._getScrollbarWidth = function _getScrollbarWidth() { 15977 // thx d.walsh 15978 var scrollDiv = document.createElement('div'); 15979 scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER; 15980 document.body.appendChild(scrollDiv); 15981 var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; 15982 document.body.removeChild(scrollDiv); 15983 return scrollbarWidth; 15984 } // Static 15985 ; 15986 15987 Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { 15988 return this.each(function () { 15989 var data = $(this).data(DATA_KEY$5); 15990 15991 var _config = _objectSpread({}, Default$3, $(this).data(), typeof config === 'object' && config ? config : {}); 15992 15993 if (!data) { 15994 data = new Modal(this, _config); 15995 $(this).data(DATA_KEY$5, data); 15996 } 15997 15998 if (typeof config === 'string') { 15999 if (typeof data[config] === 'undefined') {
16000 throw new TypeError("No method named \"" + config + "\""); 16001 } 16002 16003 data[config](relatedTarget); 16004 } else if (_config.show) { 16005 data.show(relatedTarget); 16006 } 16007 }); 16008 }; 16009 16010 _createClass(Modal, null, [{ 16011 key: "VERSION", 16012 get: function get() { 16013 return VERSION$5; 16014 } 16015 }, { 16016 key: "Default", 16017 get: function get() { 16018 return Default$3; 16019 } 16020 }]); 16021 16022 return Modal; 16023 }(); 16024 /** 16025 * ------------------------------------------------------------------------ 16026 * Data Api implementation 16027 * ------------------------------------------------------------------------ 16028 */ 16029 16030 16031 $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) { 16032 var _this10 = this; 16033 16034 var target; 16035 var selector = Util.getSelectorFromElement(this); 16036 16037 if (selector) { 16038 target = document.querySelector(selector); 16039 } 16040 16041 var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread({}, $(target).data(), $(this).data()); 16042 16043 if (this.tagName === 'A' || this.tagName === 'AREA') { 16044 event.preventDefault(); 16045 } 16046 16047 var $target = $(target).one(Event$5.SHOW, function (showEvent) { 16048 if (showEvent.isDefaultPrevented()) { 16049 // Only register focus restorer if modal will actually get shown 16050 return; 16051 } 16052 16053 $target.one(Event$5.HIDDEN, function () { 16054 if ($(_this10).is(':visible')) { 16055 _this10.focus(); 16056 } 16057 }); 16058 }); 16059 16060 Modal._jQueryInterface.call($(target), config, this); 16061 }); 16062 /** 16063 * ------------------------------------------------------------------------ 16064 * jQuery 16065 * ------------------------------------------------------------------------ 16066 */ 16067 16068 $.fn[NAME$5] = Modal._jQueryInterface; 16069 $.fn[NAME$5].Constructor = Modal; 16070 16071 $.fn[NAME$5].noConflict = function () { 16072 $.fn[NAME$5] = JQUERY_NO_CONFLICT$5; 16073 return Modal._jQueryInterface; 16074 }; 16075 16076 /** 16077 * -------------------------------------------------------------------------- 16078 * Bootstrap (v4.3.1): tools/sanitizer.js 16079 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 16080 * -------------------------------------------------------------------------- 16081 */ 16082 var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']; 16083 var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 16084 var DefaultWhitelist = { 16085 // Global attributes allowed on any supplied element below. 16086 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 16087 a: ['target', 'href', 'title', 'rel'], 16088 area: [], 16089 b: [], 16090 br: [], 16091 col: [], 16092 code: [], 16093 div: [], 16094 em: [], 16095 hr: [], 16096 h1: [], 16097 h2: [], 16098 h3: [], 16099 h4: [], 16100 h5: [], 16101 h6: [], 16102 i: [], 16103 img: ['src', 'alt', 'title', 'width', 'height'], 16104 li: [], 16105 ol: [], 16106 p: [], 16107 pre: [], 16108 s: [], 16109 small: [], 16110 span: [], 16111 sub: [], 16112 sup: [], 16113 strong: [], 16114 u: [], 16115 ul: [] 16116 /** 16117 * A pattern that recognizes a commonly useful subset of URLs that are safe. 16118 * 16119 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 16120 */ 16121 16122 }; 16123 var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi; 16124 /** 16125 * A pattern that matches safe data URLs. Only matches image, video and audio types. 16126 * 16127 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 16128 */ 16129 16130 var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i; 16131 16132 function allowedAttribute(attr, allowedAttributeList) { 16133 var attrName = attr.nodeName.toLowerCase(); 16134 16135 if (allowedAttributeList.indexOf(attrName) !== -1) { 16136 if (uriAttrs.indexOf(attrName) !== -1) { 16137 return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)); 16138 } 16139 16140 return true; 16141 } 16142 16143 var regExp = allowedAttributeList.filter(function (attrRegex) {
16144 return attrRegex instanceof RegExp; 16145 }); // Check if a regular expression validates the attribute. 16146 16147 for (var i = 0, l = regExp.length; i < l; i++) { 16148 if (attrName.match(regExp[i])) { 16149 return true; 16150 } 16151 } 16152 16153 return false; 16154 } 16155 16156 function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { 16157 if (unsafeHtml.length === 0) { 16158 return unsafeHtml; 16159 } 16160 16161 if (sanitizeFn && typeof sanitizeFn === 'function') { 16162 return sanitizeFn(unsafeHtml); 16163 } 16164 16165 var domParser = new window.DOMParser(); 16166 var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); 16167 var whitelistKeys = Object.keys(whiteList); 16168 var elements = [].slice.call(createdDocument.body.querySelectorAll('*')); 16169 16170 var _loop = function _loop(i, len) { 16171 var el = elements[i]; 16172 var elName = el.nodeName.toLowerCase(); 16173 16174 if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) { 16175 el.parentNode.removeChild(el); 16176 return "continue"; 16177 } 16178 16179 var attributeList = [].slice.call(el.attributes); 16180 var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); 16181 attributeList.forEach(function (attr) { 16182 if (!allowedAttribute(attr, whitelistedAttributes)) { 16183 el.removeAttribute(attr.nodeName); 16184 } 16185 }); 16186 }; 16187 16188 for (var i = 0, len = elements.length; i < len; i++) { 16189 var _ret = _loop(i, len); 16190 16191 if (_ret === "continue") continue; 16192 } 16193 16194 return createdDocument.body.innerHTML; 16195 } 16196 16197 /** 16198 * ------------------------------------------------------------------------ 16199 * Constants 16200 * ------------------------------------------------------------------------ 16201 */ 16202 16203 var NAME$6 = 'tooltip'; 16204 var VERSION$6 = '4.3.1'; 16205 var DATA_KEY$6 = 'bs.tooltip'; 16206 var EVENT_KEY$6 = "." + DATA_KEY$6; 16207 var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6]; 16208 var CLASS_PREFIX = 'bs-tooltip'; 16209 var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); 16210 var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; 16211 var DefaultType$4 = { 16212 animation: 'boolean', 16213 template: 'string', 16214 title: '(string|element|function)', 16215 trigger: 'string', 16216 delay: '(number|object)', 16217 html: 'boolean', 16218 selector: '(string|boolean)', 16219 placement: '(string|function)', 16220 offset: '(number|string|function)', 16221 container: '(string|element|boolean)', 16222 fallbackPlacement: '(string|array)', 16223 boundary: '(string|element)', 16224 sanitize: 'boolean', 16225 sanitizeFn: '(null|function)', 16226 whiteList: 'object' 16227 }; 16228 var AttachmentMap$1 = { 16229 AUTO: 'auto', 16230 TOP: 'top', 16231 RIGHT: 'right', 16232 BOTTOM: 'bottom', 16233 LEFT: 'left' 16234 }; 16235 var Default$4 = { 16236 animation: true, 16237 template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>', 16238 trigger: 'hover focus', 16239 title: '', 16240 delay: 0, 16241 html: false, 16242 selector: false, 16243 placement: 'top', 16244 offset: 0, 16245 container: false, 16246 fallbackPlacement: 'flip', 16247 boundary: 'scrollParent', 16248 sanitize: true, 16249 sanitizeFn: null, 16250 whiteList: DefaultWhitelist 16251 }; 16252 var HoverState = { 16253 SHOW: 'show', 16254 OUT: 'out' 16255 }; 16256 var Event$6 = { 16257 HIDE: "hide" + EVENT_KEY$6, 16258 HIDDEN: "hidden" + EVENT_KEY$6, 16259 SHOW: "show" + EVENT_KEY$6, 16260 SHOWN: "shown" + EVENT_KEY$6, 16261 INSERTED: "inserted" + EVENT_KEY$6, 16262 CLICK: "click" + EVENT_KEY$6, 16263 FOCUSIN: "focusin" + EVENT_KEY$6, 16264 FOCUSOUT: "focusout" + EVENT_KEY$6, 16265 MOUSEENTER: "mouseenter" + EVENT_KEY$6, 16266 MOUSELEAVE: "mouseleave" + EVENT_KEY$6 16267 }; 16268 var ClassName$6 = { 16269 FADE: 'fade', 16270 SHOW: 'show' 16271 }; 16272 var Selector$6 = { 16273 TOOLTIP: '.tooltip', 16274 TOOLTIP_INNER: '.tooltip-inner', 16275 ARROW: '.arrow' 16276 }; 16277 var Trigger = { 16278 HOVER: 'hover', 16279 FOCUS: 'focus', 16280 CLICK: 'click', 16281 MANUAL: 'manual' 16282 /** 16283 * ------------------------------------------------------------------------ 16284 * Class Definition 16285 * ------------------------------------------------------------------------ 16286 */ 16287 16288 }; 16289 16290 var Tooltip = 16291 /*#__PURE__*/ 16292 function () { 16293 function Tooltip(element, config) { 16294 /** 16295 * Check for Popper dependency 16296 * Popper - https://popper.js.org 16297 */ 16298 if (typeof Popper === 'undefined') { 16299 throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)'); 16300 } // private 16301 16302 16303 this._isEnabled = true; 16304 this._timeout = 0; 16305 this._hoverState = ''; 16306 this._activeTrigger = {}; 16307 this._popper = null; // Protected 16308 16309 this.element = element; 16310 this.config = this._getConfig(config); 16311 this.tip = null; 16312 16313 this._setListeners(); 16314 } // Getters 16315 16316 16317 var _proto = Tooltip.prototype; 16318 16319 // Public 16320 _proto.enable = function enable() { 16321 this._isEnabled = true; 16322 }; 16323 16324 _proto.disable = function disable() { 16325 this._isEnabled = false;
16326 }; 16327 16328 _proto.toggleEnabled = function toggleEnabled() { 16329 this._isEnabled = !this._isEnabled; 16330 }; 16331 16332 _proto.toggle = function toggle(event) { 16333 if (!this._isEnabled) { 16334 return; 16335 } 16336 16337 if (event) { 16338 var dataKey = this.constructor.DATA_KEY; 16339 var context = $(event.currentTarget).data(dataKey); 16340 16341 if (!context) { 16342 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 16343 $(event.currentTarget).data(dataKey, context); 16344 } 16345 16346 context._activeTrigger.click = !context._activeTrigger.click; 16347 16348 if (context._isWithActiveTrigger()) { 16349 context._enter(null, context); 16350 } else { 16351 context._leave(null, context); 16352 } 16353 } else { 16354 if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) { 16355 this._leave(null, this); 16356 16357 return; 16358 } 16359 16360 this._enter(null, this); 16361 } 16362 }; 16363 16364 _proto.dispose = function dispose() { 16365 clearTimeout(this._timeout); 16366 $.removeData(this.element, this.constructor.DATA_KEY); 16367 $(this.element).off(this.constructor.EVENT_KEY); 16368 $(this.element).closest('.modal').off('hide.bs.modal'); 16369 16370 if (this.tip) { 16371 $(this.tip).remove(); 16372 } 16373 16374 this._isEnabled = null; 16375 this._timeout = null; 16376 this._hoverState = null; 16377 this._activeTrigger = null; 16378 16379 if (this._popper !== null) { 16380 this._popper.destroy(); 16381 } 16382 16383 this._popper = null; 16384 this.element = null; 16385 this.config = null; 16386 this.tip = null; 16387 }; 16388 16389 _proto.show = function show() { 16390 var _this = this; 16391 16392 if ($(this.element).css('display') === 'none') { 16393 throw new Error('Please use show on visible elements'); 16394 } 16395 16396 var showEvent = $.Event(this.constructor.Event.SHOW); 16397 16398 if (this.isWithContent() && this._isEnabled) { 16399 $(this.element).trigger(showEvent); 16400 var shadowRoot = Util.findShadowRoot(this.element); 16401 var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element); 16402 16403 if (showEvent.isDefaultPrevented() || !isInTheDom) { 16404 return; 16405 } 16406 16407 var tip = this.getTipElement(); 16408 var tipId = Util.getUID(this.constructor.NAME);
16409 tip.setAttribute('id', tipId); 16410 this.element.setAttribute('aria-describedby', tipId); 16411 this.setContent(); 16412 16413 if (this.config.animation) { 16414 $(tip).addClass(ClassName$6.FADE); 16415 } 16416 16417 var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; 16418 16419 var attachment = this._getAttachment(placement); 16420 16421 this.addAttachmentClass(attachment); 16422 16423 var container = this._getContainer(); 16424 16425 $(tip).data(this.constructor.DATA_KEY, this); 16426 16427 if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) { 16428 $(tip).appendTo(container); 16429 } 16430 16431 $(this.element).trigger(this.constructor.Event.INSERTED); 16432 this._popper = new Popper(this.element, tip, { 16433 placement: attachment, 16434 modifiers: { 16435 offset: this._getOffset(), 16436 flip: { 16437 behavior: this.config.fallbackPlacement 16438 }, 16439 arrow: { 16440 element: Selector$6.ARROW 16441 }, 16442 preventOverflow: { 16443 boundariesElement: this.config.boundary 16444 } 16445 }, 16446 onCreate: function onCreate(data) { 16447 if (data.originalPlacement !== data.placement) { 16448 _this._handlePopperPlacementChange(data); 16449 } 16450 }, 16451 onUpdate: function onUpdate(data) { 16452 return _this._handlePopperPlacementChange(data); 16453 } 16454 }); 16455 $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra 16456 // empty mouseover listeners to the body's immediate children; 16457 // only needed because of broken event delegation on iOS 16458 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 16459 16460 if ('ontouchstart' in document.documentElement) { 16461 $(document.body).children().on('mouseover', null, $.noop); 16462 } 16463 16464 var complete = function complete() { 16465 if (_this.config.animation) { 16466 _this._fixTransition(); 16467 } 16468 16469 var prevHoverState = _this._hoverState; 16470 _this._hoverState = null; 16471 $(_this.element).trigger(_this.constructor.Event.SHOWN); 16472 16473 if (prevHoverState === HoverState.OUT) { 16474 _this._leave(null, _this); 16475 } 16476 }; 16477 16478 if ($(this.tip).hasClass(ClassName$6.FADE)) { 16479 var transitionDuration = Util.getTransitionDurationFromElement(this.tip); 16480 $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 16481 } else { 16482 complete(); 16483 } 16484 } 16485 }; 16486 16487 _proto.hide = function hide(callback) { 16488 var _this2 = this; 16489 16490 var tip = this.getTipElement(); 16491 var hideEvent = $.Event(this.constructor.Event.HIDE); 16492 16493 var complete = function complete() { 16494 if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) { 16495 tip.parentNode.removeChild(tip); 16496 } 16497 16498 _this2._cleanTipClass(); 16499 16500 _this2.element.removeAttribute('aria-describedby'); 16501 16502 $(_this2.element).trigger(_this2.constructor.Event.HIDDEN); 16503 16504 if (_this2._popper !== null) { 16505 _this2._popper.destroy(); 16506 } 16507 16508 if (callback) { 16509 callback(); 16510 } 16511 }; 16512 16513 $(this.element).trigger(hideEvent); 16514 16515 if (hideEvent.isDefaultPrevented()) { 16516 return; 16517 } 16518 16519 $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra 16520 // empty mouseover listeners we added for iOS support 16521 16522 if ('ontouchstart' in document.documentElement) { 16523 $(document.body).children().off('mouseover', null, $.noop); 16524 } 16525 16526 this._activeTrigger[Trigger.CLICK] = false; 16527 this._activeTrigger[Trigger.FOCUS] = false; 16528 this._activeTrigger[Trigger.HOVER] = false; 16529 16530 if ($(this.tip).hasClass(ClassName$6.FADE)) { 16531 var transitionDuration = Util.getTransitionDurationFromElement(tip); 16532 $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 16533 } else { 16534 complete(); 16535 } 16536 16537 this._hoverState = ''; 16538 }; 16539
16540 _proto.update = function update() { 16541 if (this._popper !== null) { 16542 this._popper.scheduleUpdate(); 16543 } 16544 } // Protected 16545 ; 16546 16547 _proto.isWithContent = function isWithContent() { 16548 return Boolean(this.getTitle()); 16549 }; 16550 16551 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 16552 $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); 16553 }; 16554 16555 _proto.getTipElement = function getTipElement() { 16556 this.tip = this.tip || $(this.config.template)[0]; 16557 return this.tip; 16558 }; 16559 16560 _proto.setContent = function setContent() { 16561 var tip = this.getTipElement(); 16562 this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle()); 16563 $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW); 16564 }; 16565 16566 _proto.setElementContent = function setElementContent($element, content) { 16567 if (typeof content === 'object' && (content.nodeType || content.jquery)) { 16568 // Content is a DOM node or a jQuery 16569 if (this.config.html) { 16570 if (!$(content).parent().is($element)) { 16571 $element.empty().append(content); 16572 } 16573 } else { 16574 $element.text($(content).text()); 16575 } 16576 16577 return; 16578 } 16579 16580 if (this.config.html) { 16581 if (this.config.sanitize) { 16582 content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn); 16583 } 16584 16585 $element.html(content); 16586 } else { 16587 $element.text(content); 16588 } 16589 }; 16590 16591 _proto.getTitle = function getTitle() { 16592 var title = this.element.getAttribute('data-original-title'); 16593 16594 if (!title) { 16595 title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; 16596 } 16597 16598 return title; 16599 } // Private 16600 ; 16601 16602 _proto._getOffset = function _getOffset() { 16603 var _this3 = this; 16604 16605 var offset = {}; 16606 16607 if (typeof this.config.offset === 'function') { 16608 offset.fn = function (data) { 16609 data.offsets = _objectSpread({}, data.offsets, _this3.config.offset(data.offsets, _this3.element) || {}); 16610 return data; 16611 }; 16612 } else { 16613 offset.offset = this.config.offset; 16614 } 16615 16616 return offset; 16617 }; 16618 16619 _proto._getContainer = function _getContainer() { 16620 if (this.config.container === false) { 16621 return document.body; 16622 } 16623 16624 if (Util.isElement(this.config.container)) { 16625 return $(this.config.container); 16626 } 16627 16628 return $(document).find(this.config.container); 16629 }; 16630 16631 _proto._getAttachment = function _getAttachment(placement) { 16632 return AttachmentMap$1[placement.toUpperCase()]; 16633 }; 16634 16635 _proto._setListeners = function _setListeners() { 16636 var _this4 = this; 16637 16638 var triggers = this.config.trigger.split(' '); 16639 triggers.forEach(function (trigger) { 16640 if (trigger === 'click') { 16641 $(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, function (event) { 16642 return _this4.toggle(event); 16643 }); 16644 } else if (trigger !== Trigger.MANUAL) { 16645 var eventIn = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN; 16646 var eventOut = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT; 16647 $(_this4.element).on(eventIn, _this4.config.selector, function (event) { 16648 return _this4._enter(event); 16649 }).on(eventOut, _this4.config.selector, function (event) { 16650 return _this4._leave(event); 16651 }); 16652 } 16653 }); 16654 $(this.element).closest('.modal').on('hide.bs.modal', function () { 16655 if (_this4.element) { 16656 _this4.hide(); 16657 } 16658 }); 16659 16660 if (this.config.selector) { 16661 this.config = _objectSpread({}, this.config, { 16662 trigger: 'manual', 16663 selector: '' 16664 }); 16665 } else { 16666 this._fixTitle(); 16667 } 16668 }; 16669 16670 _proto._fixTitle = function _fixTitle() { 16671 var titleType = typeof this.element.getAttribute('data-original-title'); 16672 16673 if (this.element.getAttribute('title') || titleType !== 'string') { 16674 this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); 16675 this.element.setAttribute('title', ''); 16676 } 16677 }; 16678 16679 _proto._enter = function _enter(event, context) { 16680 var dataKey = this.constructor.DATA_KEY; 16681 context = context || $(event.currentTarget).data(dataKey); 16682 16683 if (!context) { 16684 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 16685 $(event.currentTarget).data(dataKey, context); 16686 } 16687 16688 if (event) { 16689 context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true; 16690 } 16691 16692 if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) { 16693 context._hoverState = HoverState.SHOW; 16694 return; 16695 } 16696 16697 clearTimeout(context._timeout); 16698 context._hoverState = HoverState.SHOW; 16699 16700 if (!context.config.delay || !context.config.delay.show) { 16701 context.show(); 16702 return; 16703 } 16704 16705 context._timeout = setTimeout(function () { 16706 if (context._hoverState === HoverState.SHOW) { 16707 context.show(); 16708 } 16709 }, context.config.delay.show); 16710 }; 16711 16712 _proto._leave = function _leave(event, context) { 16713 var dataKey = this.constructor.DATA_KEY; 16714 context = context || $(event.currentTarget).data(dataKey); 16715 16716 if (!context) { 16717 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 16718 $(event.currentTarget).data(dataKey, context); 16719 } 16720 16721 if (event) { 16722 context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
16723 } 16724 16725 if (context._isWithActiveTrigger()) { 16726 return; 16727 } 16728 16729 clearTimeout(context._timeout); 16730 context._hoverState = HoverState.OUT; 16731 16732 if (!context.config.delay || !context.config.delay.hide) { 16733 context.hide(); 16734 return; 16735 } 16736 16737 context._timeout = setTimeout(function () { 16738 if (context._hoverState === HoverState.OUT) { 16739 context.hide(); 16740 } 16741 }, context.config.delay.hide); 16742 }; 16743 16744 _proto._isWithActiveTrigger = function _isWithActiveTrigger() { 16745 for (var trigger in this._activeTrigger) { 16746 if (this._activeTrigger[trigger]) { 16747 return true; 16748 } 16749 } 16750 16751 return false; 16752 }; 16753 16754 _proto._getConfig = function _getConfig(config) { 16755 var dataAttributes = $(this.element).data(); 16756 Object.keys(dataAttributes).forEach(function (dataAttr) { 16757 if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) { 16758 delete dataAttributes[dataAttr]; 16759 } 16760 }); 16761 config = _objectSpread({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {}); 16762 16763 if (typeof config.delay === 'number') { 16764 config.delay = { 16765 show: config.delay, 16766 hide: config.delay 16767 }; 16768 } 16769 16770 if (typeof config.title === 'number') { 16771 config.title = config.title.toString(); 16772 } 16773 16774 if (typeof config.content === 'number') { 16775 config.content = config.content.toString(); 16776 } 16777 16778 Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType); 16779 16780 if (config.sanitize) { 16781 config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn); 16782 } 16783 16784 return config; 16785 }; 16786 16787 _proto._getDelegateConfig = function _getDelegateConfig() { 16788 var config = {}; 16789 16790 if (this.config) { 16791 for (var key in this.config) { 16792 if (this.constructor.Default[key] !== this.config[key]) { 16793 config[key] = this.config[key]; 16794 } 16795 } 16796 } 16797 16798 return config; 16799 }; 16800 16801 _proto._cleanTipClass = function _cleanTipClass() { 16802 var $tip = $(this.getTipElement()); 16803 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); 16804 16805 if (tabClass !== null && tabClass.length) { 16806 $tip.removeClass(tabClass.join('')); 16807 } 16808 }; 16809 16810 _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) { 16811 var popperInstance = popperData.instance; 16812 this.tip = popperInstance.popper; 16813 16814 this._cleanTipClass(); 16815 16816 this.addAttachmentClass(this._getAttachment(popperData.placement)); 16817 }; 16818 16819 _proto._fixTransition = function _fixTransition() { 16820 var tip = this.getTipElement(); 16821 var initConfigAnimation = this.config.animation; 16822 16823 if (tip.getAttribute('x-placement') !== null) { 16824 return; 16825 } 16826 16827 $(tip).removeClass(ClassName$6.FADE); 16828 this.config.animation = false; 16829 this.hide(); 16830 this.show(); 16831 this.config.animation = initConfigAnimation; 16832 } // Static 16833 ; 16834 16835 Tooltip._jQueryInterface = function _jQueryInterface(config) { 16836 return this.each(function () { 16837 var data = $(this).data(DATA_KEY$6); 16838 16839 var _config = typeof config === 'object' && config; 16840 16841 if (!data && /dispose|hide/.test(config)) { 16842 return; 16843 } 16844 16845 if (!data) { 16846 data = new Tooltip(this, _config); 16847 $(this).data(DATA_KEY$6, data); 16848 } 16849 16850 if (typeof config === 'string') { 16851 if (typeof data[config] === 'undefined') { 16852 throw new TypeError("No method named \"" + config + "\""); 16853 } 16854 16855 data[config](); 16856 } 16857 }); 16858 }; 16859 16860 _createClass(Tooltip, null, [{ 16861 key: "VERSION", 16862 get: function get() { 16863 return VERSION$6; 16864 } 16865 }, { 16866 key: "Default", 16867 get: function get() { 16868 return Default$4; 16869 } 16870 }, { 16871 key: "NAME", 16872 get: function get() { 16873 return NAME$6; 16874 } 16875 }, { 16876 key: "DATA_KEY", 16877 get: function get() { 16878 return DATA_KEY$6; 16879 } 16880 }, { 16881 key: "Event", 16882 get: function get() { 16883 return Event$6; 16884 } 16885 }, {
16886 key: "EVENT_KEY", 16887 get: function get() { 16888 return EVENT_KEY$6; 16889 } 16890 }, { 16891 key: "DefaultType", 16892 get: function get() { 16893 return DefaultType$4; 16894 } 16895 }]); 16896 16897 return Tooltip; 16898 }(); 16899 /** 16900 * ------------------------------------------------------------------------ 16901 * jQuery 16902 * ------------------------------------------------------------------------ 16903 */ 16904 16905 16906 $.fn[NAME$6] = Tooltip._jQueryInterface; 16907 $.fn[NAME$6].Constructor = Tooltip; 16908 16909 $.fn[NAME$6].noConflict = function () { 16910 $.fn[NAME$6] = JQUERY_NO_CONFLICT$6; 16911 return Tooltip._jQueryInterface; 16912 }; 16913 16914 /** 16915 * ------------------------------------------------------------------------ 16916 * Constants 16917 * ------------------------------------------------------------------------ 16918 */ 16919 16920 var NAME$7 = 'popover'; 16921 var VERSION$7 = '4.3.1'; 16922 var DATA_KEY$7 = 'bs.popover'; 16923 var EVENT_KEY$7 = "." + DATA_KEY$7; 16924 var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7]; 16925 var CLASS_PREFIX$1 = 'bs-popover'; 16926 var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g'); 16927 16928 var Default$5 = _objectSpread({}, Tooltip.Default, { 16929 placement: 'right', 16930 trigger: 'click', 16931 content: '', 16932 template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' 16933 }); 16934 16935 var DefaultType$5 = _objectSpread({}, Tooltip.DefaultType, { 16936 content: '(string|element|function)' 16937 }); 16938 16939 var ClassName$7 = { 16940 FADE: 'fade', 16941 SHOW: 'show' 16942 }; 16943 var Selector$7 = { 16944 TITLE: '.popover-header', 16945 CONTENT: '.popover-body' 16946 }; 16947 var Event$7 = { 16948 HIDE: "hide" + EVENT_KEY$7, 16949 HIDDEN: "hidden" + EVENT_KEY$7, 16950 SHOW: "show" + EVENT_KEY$7, 16951 SHOWN: "shown" + EVENT_KEY$7, 16952 INSERTED: "inserted" + EVENT_KEY$7, 16953 CLICK: "click" + EVENT_KEY$7, 16954 FOCUSIN: "focusin" + EVENT_KEY$7, 16955 FOCUSOUT: "focusout" + EVENT_KEY$7, 16956 MOUSEENTER: "mouseenter" + EVENT_KEY$7, 16957 MOUSELEAVE: "mouseleave" + EVENT_KEY$7 16958 /** 16959 * ------------------------------------------------------------------------ 16960 * Class Definition 16961 * ------------------------------------------------------------------------ 16962 */ 16963 16964 }; 16965 16966 var Popover = 16967 /*#__PURE__*/ 16968 function (_Tooltip) { 16969 _inheritsLoose(Popover, _Tooltip); 16970 16971 function Popover() { 16972 return _Tooltip.apply(this, arguments) || this; 16973 } 16974 16975 var _proto = Popover.prototype; 16976 16977 // Overrides 16978 _proto.isWithContent = function isWithContent() { 16979 return this.getTitle() || this._getContent(); 16980 }; 16981 16982 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 16983 $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment); 16984 }; 16985 16986 _proto.getTipElement = function getTipElement() { 16987 this.tip = this.tip || $(this.config.template)[0]; 16988 return this.tip; 16989 }; 16990 16991 _proto.setContent = function setContent() { 16992 var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events 16993 16994 this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle()); 16995 16996 var content = this._getContent(); 16997 16998 if (typeof content === 'function') { 16999 content = content.call(this.element); 17000 } 17001 17002 this.setElementContent($tip.find(Selector$7.CONTENT), content); 17003 $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW); 17004 } // Private 17005 ; 17006 17007 _proto._getContent = function _getContent() { 17008 return this.element.getAttribute('data-content') || this.config.content; 17009 }; 17010 17011 _proto._cleanTipClass = function _cleanTipClass() { 17012 var $tip = $(this.getTipElement()); 17013 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1); 17014 17015 if (tabClass !== null && tabClass.length > 0) { 17016 $tip.removeClass(tabClass.join('')); 17017 } 17018 } // Static 17019 ; 17020 17021 Popover._jQueryInterface = function _jQueryInterface(config) { 17022 return this.each(function () { 17023 var data = $(this).data(DATA_KEY$7); 17024 17025 var _config = typeof config === 'object' ? config : null; 17026 17027 if (!data && /dispose|hide/.test(config)) { 17028 return; 17029 } 17030 17031 if (!data) { 17032 data = new Popover(this, _config); 17033 $(this).data(DATA_KEY$7, data); 17034 } 17035 17036 if (typeof config === 'string') { 17037 if (typeof data[config] === 'undefined') {
17038 throw new TypeError("No method named \"" + config + "\""); 17039 } 17040 17041 data[config](); 17042 } 17043 }); 17044 }; 17045 17046 _createClass(Popover, null, [{ 17047 key: "VERSION", 17048 // Getters 17049 get: function get() { 17050 return VERSION$7; 17051 } 17052 }, { 17053 key: "Default", 17054 get: function get() { 17055 return Default$5; 17056 } 17057 }, { 17058 key: "NAME", 17059 get: function get() { 17060 return NAME$7; 17061 } 17062 }, { 17063 key: "DATA_KEY", 17064 get: function get() { 17065 return DATA_KEY$7; 17066 } 17067 }, { 17068 key: "Event", 17069 get: function get() { 17070 return Event$7; 17071 } 17072 }, { 17073 key: "EVENT_KEY", 17074 get: function get() { 17075 return EVENT_KEY$7; 17076 } 17077 }, { 17078 key: "DefaultType", 17079 get: function get() { 17080 return DefaultType$5; 17081 } 17082 }]); 17083 17084 return Popover; 17085 }(Tooltip); 17086 /** 17087 * ------------------------------------------------------------------------ 17088 * jQuery 17089 * ------------------------------------------------------------------------ 17090 */ 17091 17092 17093 $.fn[NAME$7] = Popover._jQueryInterface; 17094 $.fn[NAME$7].Constructor = Popover; 17095 17096 $.fn[NAME$7].noConflict = function () { 17097 $.fn[NAME$7] = JQUERY_NO_CONFLICT$7; 17098 return Popover._jQueryInterface; 17099 }; 17100 17101 /** 17102 * ------------------------------------------------------------------------ 17103 * Constants 17104 * ------------------------------------------------------------------------ 17105 */ 17106 17107 var NAME$8 = 'scrollspy'; 17108 var VERSION$8 = '4.3.1'; 17109 var DATA_KEY$8 = 'bs.scrollspy'; 17110 var EVENT_KEY$8 = "." + DATA_KEY$8; 17111 var DATA_API_KEY$6 = '.data-api'; 17112 var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8]; 17113 var Default$6 = { 17114 offset: 10, 17115 method: 'auto', 17116 target: '' 17117 }; 17118 var DefaultType$6 = { 17119 offset: 'number', 17120 method: 'string', 17121 target: '(string|element)' 17122 }; 17123 var Event$8 = { 17124 ACTIVATE: "activate" + EVENT_KEY$8, 17125 SCROLL: "scroll" + EVENT_KEY$8, 17126 LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6 17127 }; 17128 var ClassName$8 = { 17129 DROPDOWN_ITEM: 'dropdown-item', 17130 DROPDOWN_MENU: 'dropdown-menu', 17131 ACTIVE: 'active' 17132 }; 17133 var Selector$8 = { 17134 DATA_SPY: '[data-spy="scroll"]', 17135 ACTIVE: '.active', 17136 NAV_LIST_GROUP: '.nav, .list-group', 17137 NAV_LINKS: '.nav-link', 17138 NAV_ITEMS: '.nav-item', 17139 LIST_ITEMS: '.list-group-item', 17140 DROPDOWN: '.dropdown', 17141 DROPDOWN_ITEMS: '.dropdown-item', 17142 DROPDOWN_TOGGLE: '.dropdown-toggle' 17143 }; 17144 var OffsetMethod = { 17145 OFFSET: 'offset', 17146 POSITION: 'position' 17147 /** 17148 * ------------------------------------------------------------------------ 17149 * Class Definition 17150 * ------------------------------------------------------------------------ 17151 */ 17152 17153 }; 17154 17155 var ScrollSpy = 17156 /*#__PURE__*/ 17157 function () { 17158 function ScrollSpy(element, config) { 17159 var _this = this; 17160 17161 this._element = element; 17162 this._scrollElement = element.tagName === 'BODY' ? window : element; 17163 this._config = this._getConfig(config); 17164 this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS); 17165 this._offsets = []; 17166 this._targets = []; 17167 this._activeTarget = null; 17168 this._scrollHeight = 0; 17169 $(this._scrollElement).on(Event$8.SCROLL, function (event) { 17170 return _this._process(event); 17171 }); 17172 this.refresh(); 17173 17174 this._process(); 17175 } // Getters 17176 17177 17178 var _proto = ScrollSpy.prototype; 17179 17180 // Public 17181 _proto.refresh = function refresh() { 17182 var _this2 = this; 17183 17184 var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION; 17185 var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; 17186 var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0; 17187 this._offsets = []; 17188 this._targets = []; 17189 this._scrollHeight = this._getScrollHeight(); 17190 var targets = [].slice.call(document.querySelectorAll(this._selector)); 17191 targets.map(function (element) { 17192 var target; 17193 var targetSelector = Util.getSelectorFromElement(element); 17194
17195 if (targetSelector) { 17196 target = document.querySelector(targetSelector); 17197 } 17198 17199 if (target) { 17200 var targetBCR = target.getBoundingClientRect(); 17201 17202 if (targetBCR.width || targetBCR.height) { 17203 // TODO (fat): remove sketch reliance on jQuery position/offset 17204 return [$(target)[offsetMethod]().top + offsetBase, targetSelector]; 17205 } 17206 } 17207 17208 return null; 17209 }).filter(function (item) { 17210 return item; 17211 }).sort(function (a, b) { 17212 return a[0] - b[0]; 17213 }).forEach(function (item) { 17214 _this2._offsets.push(item[0]); 17215 17216 _this2._targets.push(item[1]); 17217 }); 17218 }; 17219 17220 _proto.dispose = function dispose() { 17221 $.removeData(this._element, DATA_KEY$8); 17222 $(this._scrollElement).off(EVENT_KEY$8); 17223 this._element = null; 17224 this._scrollElement = null; 17225 this._config = null; 17226 this._selector = null; 17227 this._offsets = null; 17228 this._targets = null; 17229 this._activeTarget = null; 17230 this._scrollHeight = null; 17231 } // Private 17232 ; 17233 17234 _proto._getConfig = function _getConfig(config) { 17235 config = _objectSpread({}, Default$6, typeof config === 'object' && config ? config : {}); 17236 17237 if (typeof config.target !== 'string') { 17238 var id = $(config.target).attr('id'); 17239 17240 if (!id) { 17241 id = Util.getUID(NAME$8); 17242 $(config.target).attr('id', id); 17243 } 17244 17245 config.target = "#" + id; 17246 } 17247 17248 Util.typeCheckConfig(NAME$8, config, DefaultType$6); 17249 return config; 17250 }; 17251 17252 _proto._getScrollTop = function _getScrollTop() { 17253 return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; 17254 }; 17255 17256 _proto._getScrollHeight = function _getScrollHeight() { 17257 return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); 17258 }; 17259 17260 _proto._getOffsetHeight = function _getOffsetHeight() { 17261 return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; 17262 }; 17263 17264 _proto._process = function _process() { 17265 var scrollTop = this._getScrollTop() + this._config.offset; 17266 17267 var scrollHeight = this._getScrollHeight(); 17268 17269 var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); 17270 17271 if (this._scrollHeight !== scrollHeight) { 17272 this.refresh(); 17273 } 17274 17275 if (scrollTop >= maxScroll) { 17276 var target = this._targets[this._targets.length - 1]; 17277 17278 if (this._activeTarget !== target) { 17279 this._activate(target); 17280 } 17281 17282 return; 17283 } 17284 17285 if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { 17286 this._activeTarget = null; 17287 17288 this._clear(); 17289 17290 return; 17291 } 17292 17293 var offsetLength = this._offsets.length; 17294 17295 for (var i = offsetLength; i--;) { 17296 var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); 17297 17298 if (isActiveTarget) { 17299 this._activate(this._targets[i]); 17300 } 17301 } 17302 }; 17303 17304 _proto._activate = function _activate(target) { 17305 this._activeTarget = target; 17306 17307 this._clear(); 17308 17309 var queries = this._selector.split(',').map(function (selector) { 17310 return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]"; 17311 }); 17312 17313 var $link = $([].slice.call(document.querySelectorAll(queries.join(',')))); 17314 17315 if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) { 17316 $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE); 17317 $link.addClass(ClassName$8.ACTIVE); 17318 } else { 17319 // Set triggered link as active 17320 $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active 17321 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 17322 17323 $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.
17323LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item 17324 17325 $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE); 17326 } 17327 17328 $(this._scrollElement).trigger(Event$8.ACTIVATE, { 17329 relatedTarget: target 17330 }); 17331 }; 17332 17333 _proto._clear = function _clear() { 17334 [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) { 17335 return node.classList.contains(ClassName$8.ACTIVE); 17336 }).forEach(function (node) { 17337 return node.classList.remove(ClassName$8.ACTIVE); 17338 }); 17339 } // Static 17340 ; 17341 17342 ScrollSpy._jQueryInterface = function _jQueryInterface(config) { 17343 return this.each(function () { 17344 var data = $(this).data(DATA_KEY$8); 17345 17346 var _config = typeof config === 'object' && config; 17347 17348 if (!data) { 17349 data = new ScrollSpy(this, _config); 17350 $(this).data(DATA_KEY$8, data); 17351 } 17352 17353 if (typeof config === 'string') { 17354 if (typeof data[config] === 'undefined') { 17355 throw new TypeError("No method named \"" + config + "\""); 17356 } 17357 17358 data[config](); 17359 } 17360 }); 17361 }; 17362 17363 _createClass(ScrollSpy, null, [{ 17364 key: "VERSION", 17365 get: function get() { 17366 return VERSION$8; 17367 } 17368 }, { 17369 key: "Default", 17370 get: function get() { 17371 return Default$6; 17372 } 17373 }]); 17374 17375 return ScrollSpy; 17376 }(); 17377 /** 17378 * ------------------------------------------------------------------------ 17379 * Data Api implementation 17380 * ------------------------------------------------------------------------ 17381 */ 17382 17383 17384 $(window).on(Event$8.LOAD_DATA_API, function () { 17385 var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY)); 17386 var scrollSpysLength = scrollSpys.length; 17387 17388 for (var i = scrollSpysLength; i--;) { 17389 var $spy = $(scrollSpys[i]); 17390 17391 ScrollSpy._jQueryInterface.call($spy, $spy.data()); 17392 } 17393 }); 17394 /** 17395 * ------------------------------------------------------------------------ 17396 * jQuery 17397 * ------------------------------------------------------------------------ 17398 */ 17399 17400 $.fn[NAME$8] = ScrollSpy._jQueryInterface; 17401 $.fn[NAME$8].Constructor = ScrollSpy; 17402 17403 $.fn[NAME$8].noConflict = function () { 17404 $.fn[NAME$8] = JQUERY_NO_CONFLICT$8; 17405 return ScrollSpy._jQueryInterface; 17406 }; 17407 17408 /** 17409 * ------------------------------------------------------------------------ 17410 * Constants 17411 * ------------------------------------------------------------------------ 17412 */ 17413 17414 var NAME$9 = 'tab'; 17415 var VERSION$9 = '4.3.1'; 17416 var DATA_KEY$9 = 'bs.tab'; 17417 var EVENT_KEY$9 = "." + DATA_KEY$9; 17418 var DATA_API_KEY$7 = '.data-api'; 17419 var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9]; 17420 var Event$9 = { 17421 HIDE: "hide" + EVENT_KEY$9, 17422 HIDDEN: "hidden" + EVENT_KEY$9, 17423 SHOW: "show" + EVENT_KEY$9, 17424 SHOWN: "shown" + EVENT_KEY$9, 17425 CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7 17426 }; 17427 var ClassName$9 = { 17428 DROPDOWN_MENU: 'dropdown-menu', 17429 ACTIVE: 'active', 17430 DISABLED: 'disabled', 17431 FADE: 'fade', 17432 SHOW: 'show' 17433 }; 17434 var Selector$9 = { 17435 DROPDOWN: '.dropdown', 17436 NAV_LIST_GROUP: '.nav, .list-group', 17437 ACTIVE: '.active', 17438 ACTIVE_UL: '> li > .active', 17439 DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]', 17440 DROPDOWN_TOGGLE: '.dropdown-toggle', 17441 DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active' 17442 /** 17443 * ------------------------------------------------------------------------ 17444 * Class Definition 17445 * ------------------------------------------------------------------------ 17446 */ 17447 17448 }; 17449 17450 var Tab = 17451 /*#__PURE__*/ 17452 function () { 17453 function Tab(element) { 17454 this._element = element; 17455 } // Getters 17456 17457 17458 var _proto = Tab.prototype; 17459 17460 // Public 17461 _proto.show = function show() { 17462 var _this = this; 17463 17464 if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) { 17465 return; 17466 } 17467 17468 var target; 17469 var previous; 17470 var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0]; 17471 var selector = Util.getSelectorFromElement(this._element); 17472 17473 if (listElement) { 17474 var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE; 17475 previous = $.makeArray($(listElement).find(itemSelector)); 17476 previous = previous[previous.length - 1]; 17477 } 17478 17479 var hideEvent = $.Event(Event$9.HIDE, { 17480 relatedTarget: this._element 17481 }); 17482 var showEvent = $.Event(Event$9.SHOW, { 17483 relatedTarget: previous 17484 }); 17485 17486 if (previous) { 17487 $(previous).trigger(hideEvent); 17488 } 17489 17490 $(this._element).trigger(showEvent); 17491 17492 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { 17493 return; 17494 } 17495 17496 if (selector) { 17497 target = document.querySelector(selector); 17498 } 17499 17500 this._activate(this._element, listElement); 17501 17502 var complete = function complete() { 17503 var hiddenEvent = $.Event(Event$9.HIDDEN, { 17504 relatedTarget: _this._element 17505 }); 17506 var shownEvent = $.Event(Event$9.SHOWN, { 17507 relatedTarget: previous 17508 }); 17509 $(previous).trigger(hiddenEvent); 17510 $(_this._element).trigger(shownEvent); 17511 }; 17512 17513 if (target) { 17514 this._activate(target, target.parentNode, complete); 17515 } else { 17516 complete(); 17517 } 17518 }; 17519 17520 _proto.dispose = function dispose() { 17521 $.removeData(this._element, DATA_KEY$9); 17522 this._element = null; 17523 } // Private 17524 ; 17525 17526 _proto._activate = function _activate(element, container, callback) { 17527 var _this2 = this; 17528 17529 var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE); 17530 var active = activeElements[0]; 17531 var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE); 17532 17533 var complete = function complete() { 17534 return _this2._transitionComplete(element, active, callback); 17535 }; 17536 17537 if (active && isTransitioning) { 17538 var transitionDuration = Util.getTransitionDurationFromElement(active); 17539 $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 17540 } else { 17541 complete(); 17542 } 17543 }; 17544 17545 _proto._transitionComplete = function _transitionComplete(element, active, callback) { 17546 if (active) { 17547 $(active).removeClass(ClassName$9.ACTIVE);
17548 var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0]; 17549 17550 if (dropdownChild) { 17551 $(dropdownChild).removeClass(ClassName$9.ACTIVE); 17552 } 17553 17554 if (active.getAttribute('role') === 'tab') { 17555 active.setAttribute('aria-selected', false); 17556 } 17557 } 17558 17559 $(element).addClass(ClassName$9.ACTIVE); 17560 17561 if (element.getAttribute('role') === 'tab') { 17562 element.setAttribute('aria-selected', true); 17563 } 17564 17565 Util.reflow(element); 17566 17567 if (element.classList.contains(ClassName$9.FADE)) { 17568 element.classList.add(ClassName$9.SHOW); 17569 } 17570 17571 if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) { 17572 var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0]; 17573 17574 if (dropdownElement) { 17575 var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE)); 17576 $(dropdownToggleList).addClass(ClassName$9.ACTIVE); 17577 } 17578 17579 element.setAttribute('aria-expanded', true); 17580 } 17581 17582 if (callback) { 17583 callback(); 17584 } 17585 } // Static 17586 ; 17587 17588 Tab._jQueryInterface = function _jQueryInterface(config) { 17589 return this.each(function () { 17590 var $this = $(this); 17591 var data = $this.data(DATA_KEY$9); 17592 17593 if (!data) { 17594 data = new Tab(this); 17595 $this.data(DATA_KEY$9, data); 17596 } 17597 17598 if (typeof config === 'string') { 17599 if (typeof data[config] === 'undefined') { 17600 throw new TypeError("No method named \"" + config + "\""); 17601 } 17602 17603 data[config](); 17604 } 17605 }); 17606 }; 17607 17608 _createClass(Tab, null, [{ 17609 key: "VERSION", 17610 get: function get() { 17611 return VERSION$9; 17612 } 17613 }]); 17614 17615 return Tab; 17616 }(); 17617 /** 17618 * ------------------------------------------------------------------------ 17619 * Data Api implementation 17620 * ------------------------------------------------------------------------ 17621 */ 17622 17623 17624 $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) { 17625 event.preventDefault(); 17626 17627 Tab._jQueryInterface.call($(this), 'show'); 17628 }); 17629 /** 17630 * ------------------------------------------------------------------------ 17631 * jQuery 17632 * ------------------------------------------------------------------------ 17633 */ 17634 17635 $.fn[NAME$9] = Tab._jQueryInterface; 17636 $.fn[NAME$9].Constructor = Tab; 17637 17638 $.fn[NAME$9].noConflict = function () { 17639 $.fn[NAME$9] = JQUERY_NO_CONFLICT$9; 17640 return Tab._jQueryInterface; 17641 }; 17642 17643 /** 17644 * ------------------------------------------------------------------------ 17645 * Constants 17646 * ------------------------------------------------------------------------ 17647 */ 17648 17649 var NAME$a = 'toast'; 17650 var VERSION$a = '4.3.1'; 17651 var DATA_KEY$a = 'bs.toast'; 17652 var EVENT_KEY$a = "." + DATA_KEY$a; 17653 var JQUERY_NO_CONFLICT$a = $.fn[NAME$a]; 17654 var Event$a = { 17655 CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a, 17656 HIDE: "hide" + EVENT_KEY$a, 17657 HIDDEN: "hidden" + EVENT_KEY$a, 17658 SHOW: "show" + EVENT_KEY$a, 17659 SHOWN: "shown" + EVENT_KEY$a 17660 }; 17661 var ClassName$a = { 17662 FADE: 'fade', 17663 HIDE: 'hide', 17664 SHOW: 'show', 17665 SHOWING: 'showing' 17666 }; 17667 var DefaultType$7 = { 17668 animation: 'boolean', 17669 autohide: 'boolean', 17670 delay: 'number' 17671 }; 17672 var Default$7 = { 17673 animation: true, 17674 autohide: true, 17675 delay: 500 17676 }; 17677 var Selector$a = { 17678 DATA_DISMISS: '[data-dismiss="toast"]' 17679 /** 17680 * ------------------------------------------------------------------------ 17681 * Class Definition 17682 * ------------------------------------------------------------------------ 17683 */ 17684 17685 }; 17686 17687 var Toast = 17688 /*#__PURE__*/ 17689 function () { 17690 function Toast(element, config) { 17691 this._element = element; 17692 this._config = this._getConfig(config); 17693 this._timeout = null; 17694 17695 this._setListeners(); 17696 } // Getters 17697 17698 17699 var _proto = Toast.prototype; 17700 17701 // Public 17702 _proto.show = function show() { 17703 var _this = this; 17704 17705 $(this._element).trigger(Event$a.SHOW); 17706 17707 if (this._config.animation) { 17708 this._element.classList.add(ClassName$a.FADE); 17709 } 17710 17711 var complete = function complete() { 17712 _this._element.classList.remove(ClassName$a.SHOWING); 17713 17714 _this._element.classList.add(ClassName$a.SHOW); 17715 17716 $(_this._element).trigger(Event$a.SHOWN); 17717 17718 if (_this._config.autohide) { 17719 _this.hide(); 17720 } 17721 }; 17722 17723 this._element.classList.remove(ClassName$a.HIDE); 17724 17725 this._element.classList.add(ClassName$a.SHOWING); 17726 17727 if (this._config.animation) { 17728 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 17729 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 17730 } else { 17731 complete(); 17732 } 17733 }; 17734 17735 _proto.hide = function hide(withoutTimeout) { 17736 var _this2 = this; 17737 17738 if (!this._element.classList.contains(ClassName$a.SHOW)) { 17739 return; 17740 } 17741 17742 $(this._element).trigger(Event$a.HIDE); 17743 17744 if (withoutTimeout) { 17745 this._close(); 17746 } else { 17747 this._timeout = setTimeout(function () { 17748 _this2._close(); 17749 }, this._config.delay); 17750 } 17751 }; 17752 17753 _proto.dispose = function dispose() { 17754 clearTimeout(this._timeout); 17755 this._timeout = null; 17756 17757 if (this._element.classList.contains(ClassName$a.SHOW)) { 17758 this._element.classList.remove(ClassName$a.SHOW); 17759 } 17760 17761 $(this._element).off(Event$a.CLICK_DISMISS); 17762 $.removeData(this._element, DATA_KEY$a); 17763 this._element = null; 17764 this._config = null; 17765 } // Private 17766 ; 17767 17768 _proto._getConfig = function _getConfig(config) { 17769 config = _objectSpread({}, Default$7, $(this._element).data(), typeof config === 'object' && config ? config : {}); 17770 Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType); 17771 return config; 17772 }; 17773 17774 _proto._setListeners = function _setListeners() { 17775 var _this3 = this; 17776 17777 $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () { 17778 return _this3.hide(true); 17779 }); 17780 }; 17781 17782 _proto._close = function _close() { 17783 var _this4 = this; 17784 17785 var complete = function complete() { 17786 _this4._element.classList.add(ClassName$a.HIDE); 17787 17788 $(_this4._element).trigger(Event$a.HIDDEN); 17789 }; 17790 17791 this._element.classList.remove(ClassName$a.SHOW); 17792 17793 if (this._config.animation) { 17794 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 17795 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 17796 } else { 17797 complete(); 17798 } 17799 } // Static 17800 ; 17801 17802 Toast._jQueryInterface = function _jQueryInterface(config) { 17803 return this.each(function () { 17804 var $element = $(this); 17805 var data = $element.data(DATA_KEY$a); 17806 17807 var _config = typeof config === 'object' && config; 17808 17809 if (!data) { 17810 data = new Toast(this, _config); 17811 $element.data(DATA_KEY$a, data); 17812 } 17813 17814 if (typeof config === 'string') { 17815 if (typeof data[config] === 'undefined') {
17816 throw new TypeError("No method named \"" + config + "\""); 17817 } 17818 17819 data[config](this); 17820 } 17821 }); 17822 }; 17823 17824 _createClass(Toast, null, [{ 17825 key: "VERSION", 17826 get: function get() { 17827 return VERSION$a; 17828 } 17829 }, { 17830 key: "DefaultType", 17831 get: function get() { 17832 return DefaultType$7; 17833 } 17834 }, { 17835 key: "Default", 17836 get: function get() { 17837 return Default$7; 17838 } 17839 }]); 17840 17841 return Toast; 17842 }(); 17843 /** 17844 * ------------------------------------------------------------------------ 17845 * jQuery 17846 * ------------------------------------------------------------------------ 17847 */ 17848 17849 17850 $.fn[NAME$a] = Toast._jQueryInterface; 17851 $.fn[NAME$a].Constructor = Toast; 17852 17853 $.fn[NAME$a].noConflict = function () { 17854 $.fn[NAME$a] = JQUERY_NO_CONFLICT$a; 17855 return Toast._jQueryInterface; 17856 }; 17857 17858 /** 17859 * -------------------------------------------------------------------------- 17860 * Bootstrap (v4.3.1): index.js 17861 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 17862 * -------------------------------------------------------------------------- 17863 */ 17864 17865 (function () { 17866 if (typeof $ === 'undefined') { 17867 throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.'); 17868 } 17869 17870 var version = $.fn.jquery.split(' ')[0].split('.'); 17871 var minMajor = 1; 17872 var ltMajor = 2; 17873 var minMinor = 9; 17874 var minPatch = 1; 17875 var maxMajor = 4; 17876 17877 if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) { 17878 throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0'); 17879 } 17880 })(); 17881 17882 exports.Util = Util; 17883 exports.Alert = Alert; 17884 exports.Button = Button; 17885 exports.Carousel = Carousel; 17886 exports.Collapse = Collapse; 17887 exports.Dropdown = Dropdown; 17888 exports.Modal = Modal; 17889 exports.Popover = Popover; 17890 exports.Scrollspy = ScrollSpy; 17891 exports.Tab = Tab; 17892 exports.Toast = Toast; 17893 exports.Tooltip = Tooltip; 17894 17895 Object.defineProperty(exports, '__esModule', { value: true }); 17896 17897})); 17898/* 17899Turbolinks 5.2.0 17900Copyright © 2018 Basecamp, LLC 17901 */ 17902 17903(function(){var t=this;(function(){(function(){this.Turbolinks={supported:function(){return null!=window.history.pushState&&null!=window.requestAnimationFrame&&null!=window.addEventListener}(),visit:function(t,r){return e.controller.visit(t,r)},clearCache:function(){return e.controller.clearCache()},setProgressBarDelay:function(t){return e.controller.setProgressBarDelay(t)}}}).call(this)}).call(t);var e=t.Turbolinks;(function(){(function(){var t,r,n,o=[].slice;e.copyObject=function(t){var e,r,n;r={};for(e in t)n=t[e],r[e]=n;return r},e.closest=function(e,r){return t.call(e,r)},t=function(){var t,e;return t=document.documentElement,null!=(e=t.closest)?e:function(t){var e;for(e=this;e;){if(e.nodeType===Node.ELEMENT_NODE&&r.call(e,t))return e;e=e.parentNode}}}(),e.defer=function(t){return setTimeout(t,1)},e.throttle=function(t){var e;return e=null,function(){var r;return r=1<=arguments.length?o.call(arguments,0):[],null!=e?e:e=requestAnimationFrame(function(n){return function(){return e=null,t.apply(n,r)}}(this))}},e.dispatch=function(t,e){var r,o,i,s,a,u;return a=null!=e?e:{},u=a.target,r=a.cancelable,o=a.data,i=document.createEvent("Events"),i.initEvent(t,!0,r===!0),i.data=null!=o?o:{},i.cancelable&&!n&&(s=i.preventDefault,i.preventDefault=function(){return this.defaultPrevented||Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}}),s.call(this)}),(null!=u?u:document).dispatchEvent(i),i},n=function(){var t;return t=document.createEvent("Events"),t.initEvent("test",!0,!0),t.preventDefault(),t.defaultPrevented}(),e.match=function(t,e){return r.call(t,e)},r=function(){var t,e,r,n;return t=document.documentElement,null!=(e=null!=(r=null!=(n=t.matchesSelector)?n:t.webkitMatchesSelector)?r:t.msMatchesSelector)?e:t.mozMatchesSelector}(),e.uuid=function(){var t,e,r;for(r="",t=e=1;36>=e;t=++e)r+=9===t||14===t||19===t||24===t?"-":15===t?"4":20===t?(Math.floor(4*Math.random())+8).toString(16):Math.floor(15*Math.random()).toString(16);return r}}).call(this),function(){e.Location=function(){function t(t){var e,r;null==t&&(t=""),r=document.createElement("a"),r.href=t.toString(),this.absoluteURL=r.href,e=r.hash.length,2>e?this.requestURL=this.absoluteURL:(this.requestURL=this.absoluteURL.slice(0,-e),this.anchor=r.hash.slice(1))}var e,r,n,o;return t.wrap=function(t){return t instanceof this?t:new this(t)},t.prototype.getOrigin=function(){return this.absoluteURL.split("/",3).join("/")},t.prototype.getPath=function(){var t,e;return null!=(t=null!=(e=this.requestURL.match(/\/\/[^\/]*(\/[^?;]*)/))?e[1]:void 0)?t:"/"},t.prototype.getPathComponents=function(){return this.getPath().split("/").slice(1)},t.prototype.getLastPathComponent=function(){return this.getPathComponents().slice(-1)[0]},t.prototype.getExtension=function(){var t,e;return null!=(t=null!=(e=this.getLastPathComponent().match(/\.[^.]*$/))?e[0]:void 0)?t:""},t.prototype.isHTML=function(){return this.getExtension().match(/^(?:|\.(?:htm|html|xhtml))$/)},t.prototype.isPrefixedBy=function(t){var e;return e=r(t),this.isEqualTo(t)||o(this.absoluteURL,e)},t.prototype.isEqualTo=function(t){return this.absoluteURL===(null!=t?t.absoluteURL:void 0)},t.prototype.toCacheKey=function(){return this.requestURL},t.prototype.toJSON=function(){return this.absoluteURL},t.prototype.toString=function(){return this.absoluteURL},t.prototype.valueOf=function(){return this.absoluteURL},r=function(t){return e(t.getOrigin()+t.getPath())},e=function(t){return n(t,"/")?t:t+"/"},o=function(t,e){return t.slice(0,e.length)===e},n=function(t,e){return t.slice(-e.length)===e},t}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.HttpRequest=function(){function r(r,n,o){this.delegate=r,this.requestCanceled=t(this.requestCanceled,this),this.requestTimedOut=t(this.requestTimedOut,this),this.requestFailed=t(this.requestFailed,this),this.requestLoaded=t(this.requestLoaded,this),this.requestProgressed=t(this.requestProgressed,this),this.url=e.Location.wrap(n).requestURL,this.referrer=e.Location.wrap(o).absoluteURL,this.createXHR()}
17903return r.NETWORK_FAILURE=0,r.TIMEOUT_FAILURE=-1,r.timeout=60,r.prototype.send=function(){var t;return this.xhr&&!this.sent?(this.notifyApplicationBeforeRequestStart(),this.setProgress(0),this.xhr.send(),this.sent=!0,"function"==typeof(t=this.delegate).requestStarted?t.requestStarted():void 0):void 0},r.prototype.cancel=function(){return this.xhr&&this.sent?this.xhr.abort():void 0},r.prototype.requestProgressed=function(t){return t.lengthComputable?this.setProgress(t.loaded/t.total):void 0},r.prototype.requestLoaded=function(){return this.endRequest(function(t){return function(){var e;return 200<=(e=t.xhr.status)&&300>e?t.delegate.requestCompletedWithResponse(t.xhr.responseText,t.xhr.getResponseHeader("Turbolinks-Location")):(t.failed=!0,t.delegate.requestFailedWithStatusCode(t.xhr.status,t.xhr.responseText))}}(this))},r.prototype.requestFailed=function(){return this.endRequest(function(t){return function(){return t.failed=!0,t.delegate.requestFailedWithStatusCode(t.constructor.NETWORK_FAILURE)}}(this))},r.prototype.requestTimedOut=function(){return this.endRequest(function(t){return function(){return t.failed=!0,t.delegate.requestFailedWithStatusCode(t.constructor.TIMEOUT_FAILURE)}}(this))},r.prototype.requestCanceled=function(){return this.endRequest()},r.prototype.notifyApplicationBeforeRequestStart=function(){return e.dispatch("turbolinks:request-start",{data:{url:this.url,xhr:this.xhr}})},r.prototype.notifyApplicationAfterRequestEnd=function(){return e.dispatch("turbolinks:request-end",{data:{url:this.url,xhr:this.xhr}})},r.prototype.createXHR=function(){return this.xhr=new XMLHttpRequest,this.xhr.open("GET",this.url,!0),this.xhr.timeout=1e3*this.constructor.timeout,this.xhr.setRequestHeader("Accept","text/html, application/xhtml+xml"),this.xhr.setRequestHeader("Turbolinks-Referrer",this.referrer),this.xhr.onprogress=this.requestProgressed,this.xhr.onload=this.requestLoaded,this.xhr.onerror=this.requestFailed,this.xhr.ontimeout=this.requestTimedOut,this.xhr.onabort=this.requestCanceled},r.prototype.endRequest=function(t){return this.xhr?(this.notifyApplicationAfterRequestEnd(),null!=t&&t.call(this),this.destroy()):void 0},r.prototype.setProgress=function(t){var e;return this.progress=t,"function"==typeof(e=this.delegate).requestProgressed?e.requestProgressed(this.progress):void 0},r.prototype.destroy=function(){var t;return this.setProgress(1),"function"==typeof(t=this.delegate).requestFinished&&t.requestFinished(),this.delegate=null,this.xhr=null},r}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.ProgressBar=function(){function e(){this.trickle=t(this.trickle,this),this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement()}var r;return r=300,e.defaultCSS=".turbolinks-progress-bar {\n position: fixed;\n display: block;\n top: 0;\n left: 0;\n height: 3px;\n background: #0076ff;\n z-index: 9999;\n transition: width "+r+"ms ease-out, opacity "+r/2+"ms "+r/2+"ms ease-in;\n transform: translate3d(0, 0, 0);\n}",e.prototype.show=function(){return this.visible?void 0:(this.visible=!0,this.installStylesheetElement(),this.installProgressElement(),this.startTrickling())},e.prototype.hide=function(){return this.visible&&!this.hiding?(this.hiding=!0,this.fadeProgressElement(function(t){return function(){return t.uninstallProgressElement(),t.stopTrickling(),t.visible=!1,t.hiding=!1}}(this))):void 0},e.prototype.setValue=function(t){return this.value=t,this.refresh()},e.prototype.installStylesheetElement=function(){return document.head.insertBefore(this.stylesheetElement,document.head.firstChild)},e.prototype.installProgressElement=function(){return this.progressElement.style.width=0,this.progressElement.style.opacity=1,document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()},e.prototype.fadeProgressElement=function(t){return this.progressElement.style.opacity=0,setTimeout(t,1.5*r)},e.prototype.uninstallProgressElement=function(){return this.progressElement.parentNode?document.documentElement.removeChild(this.progressElement):void 0},e.prototype.startTrickling=function(){return null!=this.trickleInterval?this.trickleInterval:this.trickleInterval=setInterval(this.trickle,r)},e.prototype.stopTrickling=function(){return clearInterval(this.trickleInterval),this.trickleInterval=null},e.prototype.trickle=function(){return this.setValue(this.value+Math.random()/100)},e.prototype.refresh=function(){return requestAnimationFrame(function(t){return function(){return t.progressElement.style.width=10+90*t.value+"%"}}(this))},e.prototype.createStylesheetElement=function(){var t;return t=document.createElement("style"),t.type="text/css",t.textContent=this.constructor.defaultCSS,t},e.prototype.createProgressElement=function(){var t;return t=document.createElement("div"),t.className="turbolinks-progress-bar",t},e}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.BrowserAdapter=function(){function r(r){this.controller=r,this.showProgressBar=t(this.showProgressBar,this),this.progressBar=new e.ProgressBar}var n,o,i;return i=e.HttpRequest,n=i.NETWORK_FAILURE,o=i.TIMEOUT_FAILURE,r.prototype.visitProposedToLocationWithAction=function(t,e){return this.controller.startVisitToLocationWithAction(t,e)},r.prototype.visitStarted=function(t){return t.issueRequest(),t.changeHistory(),t.loadCachedSnapshot()},r.prototype.visitRequestStarted=function(t){return this.progressBar.setValue(0),t.hasCachedSnapshot()||"restore"!==t.action?this.showProgressBarAfterDelay():this.showProgressBar()},r.prototype.visitRequestProgressed=function(t){return this.progressBar.setValue(t.progress)},r.prototype.visitRequestCompleted=function(t){return t.loadResponse()},r.prototype.visitRequestFailedWithStatusCode=function(t,e){switch(e){case n:case o:return this.reload();default:return t.loadResponse()}},r.prototype.visitRequestFinished=function(t){return this.hideProgressBar()},r.prototype.visitCompleted=function(t){return t.followRedirect()},r.prototype.pageInvalidated=function(){return this.reload()},r.prototype.showProgressBarAfterDelay=function(){return this.progressBarTimeout=setTimeout(this.showProgressBar,this.controller.progressBarDelay)},r.prototype.showProgressBar=function(){return this.progressBar.show()},r.prototype.hideProgressBar=function(){return this.progressBar.hide(),clearTimeout(this.progressBarTimeout)},r.prototype.reload=function(){return window.location.reload()},r}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.History=function(){function r(e){this.delegate=e,this.onPageLoad=t(this.onPageLoad,this),this.onPopState=t(this.onPopState,this)}return r.prototype.start=function(){return this.started?void 0:(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.started=!0)},r.prototype.stop=function(){return this.started?(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1):void 0},r.prototype.push=function(t,r){return t=e.Location.wrap(t),this.update("push",t,r)},r.prototype.replace=function(t,r){return t=e.Location.wrap(t),this.update("replace",t,r)},r.prototype.onPopState=function(t){var r,n,o,i;return this.shouldHandlePopState()&&(i=null!=(n=t.state)?n.turbolinks:void 0)?(r=e.Location.wrap(window.location),o=i.restorationIdentifier,this.delegate.historyPoppedToLocationWithRestorationIdentifier(r,o)):void 0},r.prototype.onPageLoad=function(t){return e.defer(function(t){return function(){return t.pageLoaded=!0}}(this))},r.prototype.shouldHandlePopState=function(){return this.pageIsLoaded()},r.prototype.pageIsLoaded=function(){return this.pageLoaded||"complete"===document.readyState},r.prototype.update=function(t,e,r){var n;return n={turbolinks:{restorationIdentifier:r}},history[t+"State"](n,null,e)},r}()}.call(this),function(){e.HeadDetails=function(){function t(t){var e,r,n,s,a,u;for(this.elements={},n=0,a=t.length;a>n;n++)u=t[n],u.nodeType===Node.ELEMENT_NODE&&(s=u.outerHTML,r=null!=(e=this.elements)[s]?e[s]:e[s]={type:i(u),tracked:o(u),elements:[]},r.elements.push(u))}var e,r,n,o,i;return t.fromHeadElement=function(t){var e;return new this(null!=(e=null!=t?t.childNodes:void 0)?e:[])},t.prototype.hasElementWithKey=function(t){return t in this.elements},t.prototype.getTrackedElementSignature=function(){var t,e;return function(){var r,n;r=this.elements,n=[];for(t in r)e=r[t].tracked,e&&n.push(t);return n}.call(this).join("")},t.prototype.getScriptElementsNotInDetails=function(t){return this.getElementsMatchingTypeNotInDetails("script",t)},t.prototype.getStylesheetElementsNotInDetails=function(t){return this.getElementsMatchingTypeNotInDetails("stylesheet",t)},t.prototype.getElementsMatchingTypeNotInDetails=function(t,e){var r,n,o,i,s,a;o=this.elements,s=[];for(n in o)i=o[n],a=i.type,r=i.elements,a!==t||e.hasElementWithKey(n)||s.push(r[0]);return s},t.prototype.getProvisionalElements=function(){var t,e,r,n,o,i,s;r=[],n=this.elements;for(e in n)o=n[e],s=o.type,i=o.tracked,t=o.elements,null!=s||i?t.length>1&&r.push.apply(r,t.slice(1)):r.push.apply(r,t);return r},t.prototype.getMetaValue=function(t){var e;return null!=(e=this.findMetaElementByName(t))?e.getAttribute("content"):void 0},t.prototype.findMetaElementByName=function(t){var r,n,o,i;r=void 0,i=this.elements;for(o in i)n=i[o].elements,e(n[0],t)&&(r=n[0]);return r},i=function(t){return r(t)?"script":n(t)?"stylesheet":void 0},o=function(t){return"reload"===t.getAttribute("data-turbolinks-track")},r=function(t){var e;return e=t.tagName.toLowerCase(),"script"===e},n=function(t){var e;return e=t.tagName.toLowerCase(),"style"===e||"link"===e&&"stylesheet"===t.getAttribute("rel")},e=function(t,e){var r;return r=t.tagName.toLowerCase(),"meta"===r&&t.getAttribute("name")===e},t}()}.call(this),function(){e.Snapshot=function(){function t(t,e){this.headDetails=t,this.bodyElement=e}return t.wrap=function(t){return t instanceof this?t:"string"==typeof t?this.fromHTMLString(t):this.fromHTMLElement(t)},t.fromHTMLString=function(t){var e;return e=document.createElement("html"),e.innerHTML=t,this.fromHTMLElement(e)},t.fromHTMLElement=function(t){var r,n,o,i;return o=t.querySelector("head"),r=null!=(i=t.querySelector("body"))?i:document.createElement("body"),n=e.HeadDetails.fromHeadElement(o),new this(n,r)},t.prototype.clone=function(){return new this.constructor(this.headDetails,this.bodyElement.cloneNode(!0))},t.prototype.getRootLocation=function(){var t,r;return r=null!=(t=this.getSetting("root"))?t:"/",new e.Location(r)}
17903,t.prototype.getCacheControlValue=function(){return this.getSetting("cache-control")},t.prototype.getElementForAnchor=function(t){try{return this.bodyElement.querySelector("[id='"+t+"'], a[name='"+t+"']")}catch(e){}},t.prototype.getPermanentElements=function(){return this.bodyElement.querySelectorAll("[id][data-turbolinks-permanent]")},t.prototype.getPermanentElementById=function(t){return this.bodyElement.querySelector("#"+t+"[data-turbolinks-permanent]")},t.prototype.getPermanentElementsPresentInSnapshot=function(t){var e,r,n,o,i;for(o=this.getPermanentElements(),i=[],r=0,n=o.length;n>r;r++)e=o[r],t.getPermanentElementById(e.id)&&i.push(e);return i},t.prototype.findFirstAutofocusableElement=function(){return this.bodyElement.querySelector("[autofocus]")},t.prototype.hasAnchor=function(t){return null!=this.getElementForAnchor(t)},t.prototype.isPreviewable=function(){return"no-preview"!==this.getCacheControlValue()},t.prototype.isCacheable=function(){return"no-cache"!==this.getCacheControlValue()},t.prototype.isVisitable=function(){return"reload"!==this.getSetting("visit-control")},t.prototype.getSetting=function(t){return this.headDetails.getMetaValue("turbolinks-"+t)},t}()}.call(this),function(){var t=[].slice;e.Renderer=function(){function e(){}var r;return e.render=function(){var e,r,n,o;return n=arguments[0],r=arguments[1],e=3<=arguments.length?t.call(arguments,2):[],o=function(t,e,r){r.prototype=t.prototype;var n=new r,o=t.apply(n,e);return Object(o)===o?o:n}(this,e,function(){}),o.delegate=n,o.render(r),o},e.prototype.renderView=function(t){return this.delegate.viewWillRender(this.newBody),t(),this.delegate.viewRendered(this.newBody)},e.prototype.invalidateView=function(){return this.delegate.viewInvalidated()},e.prototype.createScriptElement=function(t){var e;return"false"===t.getAttribute("data-turbolinks-eval")?t:(e=document.createElement("script"),e.textContent=t.textContent,e.async=!1,r(e,t),e)},r=function(t,e){var r,n,o,i,s,a,u;for(i=e.attributes,a=[],r=0,n=i.length;n>r;r++)s=i[r],o=s.name,u=s.value,a.push(t.setAttribute(o,u));return a},e}()}.call(this),function(){var t,r,n=function(t,e){function r(){this.constructor=t}for(var n in e)o.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},o={}.hasOwnProperty;e.SnapshotRenderer=function(e){function o(t,e,r){this.currentSnapshot=t,this.newSnapshot=e,this.isPreview=r,this.currentHeadDetails=this.currentSnapshot.headDetails,this.newHeadDetails=this.newSnapshot.headDetails,this.currentBody=this.currentSnapshot.bodyElement,this.newBody=this.newSnapshot.bodyElement}return n(o,e),o.prototype.render=function(t){return this.shouldRender()?(this.mergeHead(),this.renderView(function(e){return function(){return e.replaceBody(),e.isPreview||e.focusFirstAutofocusableElement(),t()}}(this))):this.invalidateView()},o.prototype.mergeHead=function(){return this.copyNewHeadStylesheetElements(),this.copyNewHeadScriptElements(),this.removeCurrentHeadProvisionalElements(),this.copyNewHeadProvisionalElements()},o.prototype.replaceBody=function(){var t;return t=this.relocateCurrentBodyPermanentElements(),this.activateNewBodyScriptElements(),this.assignNewBody(),this.replacePlaceholderElementsWithClonedPermanentElements(t)},o.prototype.shouldRender=function(){return this.newSnapshot.isVisitable()&&this.trackedElementsAreIdentical()},o.prototype.trackedElementsAreIdentical=function(){return this.currentHeadDetails.getTrackedElementSignature()===this.newHeadDetails.getTrackedElementSignature()},o.prototype.copyNewHeadStylesheetElements=function(){var t,e,r,n,o;for(n=this.getNewHeadStylesheetElements(),o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(document.head.appendChild(t));return o},o.prototype.copyNewHeadScriptElements=function(){var t,e,r,n,o;for(n=this.getNewHeadScriptElements(),o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(document.head.appendChild(this.createScriptElement(t)));return o},o.prototype.removeCurrentHeadProvisionalElements=function(){var t,e,r,n,o;for(n=this.getCurrentHeadProvisionalElements(),o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(document.head.removeChild(t));return o},o.prototype.copyNewHeadProvisionalElements=function(){var t,e,r,n,o;for(n=this.getNewHeadProvisionalElements(),o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(document.head.appendChild(t));return o},o.prototype.relocateCurrentBodyPermanentElements=function(){var e,n,o,i,s,a,u;for(a=this.getCurrentBodyPermanentElements(),u=[],e=0,n=a.length;n>e;
17903e++)i=a[e],s=t(i),o=this.newSnapshot.getPermanentElementById(i.id),r(i,s.element),r(o,i),u.push(s);return u},o.prototype.replacePlaceholderElementsWithClonedPermanentElements=function(t){var e,n,o,i,s,a,u;for(u=[],o=0,i=t.length;i>o;o++)a=t[o],n=a.element,s=a.permanentElement,e=s.cloneNode(!0),u.push(r(n,e));return u},o.prototype.activateNewBodyScriptElements=function(){var t,e,n,o,i,s;for(i=this.getNewBodyScriptElements(),s=[],e=0,o=i.length;o>e;e++)n=i[e],t=this.createScriptElement(n),s.push(r(n,t));return s},o.prototype.assignNewBody=function(){return document.body=this.newBody},o.prototype.focusFirstAutofocusableElement=function(){var t;return null!=(t=this.newSnapshot.findFirstAutofocusableElement())?t.focus():void 0},o.prototype.getNewHeadStylesheetElements=function(){return this.newHeadDetails.getStylesheetElementsNotInDetails(this.currentHeadDetails)},o.prototype.getNewHeadScriptElements=function(){return this.newHeadDetails.getScriptElementsNotInDetails(this.currentHeadDetails)},o.prototype.getCurrentHeadProvisionalElements=function(){return this.currentHeadDetails.getProvisionalElements()},o.prototype.getNewHeadProvisionalElements=function(){return this.newHeadDetails.getProvisionalElements()},o.prototype.getCurrentBodyPermanentElements=function(){return this.currentSnapshot.getPermanentElementsPresentInSnapshot(this.newSnapshot)},o.prototype.getNewBodyScriptElements=function(){return this.newBody.querySelectorAll("script")},o}(e.Renderer),t=function(t){var e;return e=document.createElement("meta"),e.setAttribute("name","turbolinks-permanent-placeholder"),e.setAttribute("content",t.id),{element:e,permanentElement:t}},r=function(t,e){var r;return(r=t.parentNode)?r.replaceChild(e,t):void 0}}.call(this),function(){var t=function(t,e){function n(){this.constructor=t}for(var o in e)r.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;e.ErrorRenderer=function(e){function r(t){var e;e=document.createElement("html"),e.innerHTML=t,this.newHead=e.querySelector("head"),this.newBody=e.querySelector("body")}return t(r,e),r.prototype.render=function(t){return this.renderView(function(e){return function(){return e.replaceHeadAndBody(),e.activateBodyScriptElements(),t()}}(this))},r.prototype.replaceHeadAndBody=function(){var t,e;return e=document.head,t=document.body,e.parentNode.replaceChild(this.newHead,e),t.parentNode.replaceChild(this.newBody,t)},r.prototype.activateBodyScriptElements=function(){var t,e,r,n,o,i;for(n=this.getScriptElements(),i=[],e=0,r=n.length;r>e;e++)o=n[e],t=this.createScriptElement(o),i.push(o.parentNode.replaceChild(t,o));return i},r.prototype.getScriptElements=function(){return document.documentElement.querySelectorAll("script")},r}(e.Renderer)}.call(this),function(){e.View=function(){function t(t){this.delegate=t,this.htmlElement=document.documentElement}return t.prototype.getRootLocation=function(){return this.getSnapshot().getRootLocation()},t.prototype.getElementForAnchor=function(t){return this.getSnapshot().getElementForAnchor(t)},t.prototype.getSnapshot=function(){return e.Snapshot.fromHTMLElement(this.htmlElement)},t.prototype.render=function(t,e){var r,n,o;return o=t.snapshot,r=t.error,n=t.isPreview,this.markAsPreview(n),null!=o?this.renderSnapshot(o,n,e):this.renderError(r,e)},t.prototype.markAsPreview=function(t){return t?this.htmlElement.setAttribute("data-turbolinks-preview",""):this.htmlElement.removeAttribute("data-turbolinks-preview")},t.prototype.renderSnapshot=function(t,r,n){return e.SnapshotRenderer.render(this.delegate,n,this.getSnapshot(),e.Snapshot.wrap(t),r)},t.prototype.renderError=function(t,r){return e.ErrorRenderer.render(this.delegate,r,t)},t}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.ScrollManager=function(){function r(r){this.delegate=r,this.onScroll=t(this.onScroll,this),this.onScroll=e.throttle(this.onScroll)}return r.prototype.start=function(){return this.started?void 0:(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)},r.prototype.stop=function(){return this.started?(removeEventListener("scroll",this.onScroll,!1),this.started=!1):void 0},r.prototype.scrollToElement=function(t){return t.scrollIntoView()},r.prototype.scrollToPosition=function(t){var e,r;return e=t.x,r=t.y,window.scrollTo(e,r)},r.prototype.onScroll=function(t){return this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})},r.prototype.updatePosition=function(t){var e;
17903return this.position=t,null!=(e=this.delegate)?e.scrollPositionChanged(this.position):void 0},r}()}.call(this),function(){e.SnapshotCache=function(){function t(t){this.size=t,this.keys=[],this.snapshots={}}var r;return t.prototype.has=function(t){var e;return e=r(t),e in this.snapshots},t.prototype.get=function(t){var e;if(this.has(t))return e=this.read(t),this.touch(t),e},t.prototype.put=function(t,e){return this.write(t,e),this.touch(t),e},t.prototype.read=function(t){var e;return e=r(t),this.snapshots[e]},t.prototype.write=function(t,e){var n;return n=r(t),this.snapshots[n]=e},t.prototype.touch=function(t){var e,n;return n=r(t),e=this.keys.indexOf(n),e>-1&&this.keys.splice(e,1),this.keys.unshift(n),this.trim()},t.prototype.trim=function(){var t,e,r,n,o;for(n=this.keys.splice(this.size),o=[],t=0,r=n.length;r>t;t++)e=n[t],o.push(delete this.snapshots[e]);return o},r=function(t){return e.Location.wrap(t).toCacheKey()},t}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.Visit=function(){function r(r,n,o){this.controller=r,this.action=o,this.performScroll=t(this.performScroll,this),this.identifier=e.uuid(),this.location=e.Location.wrap(n),this.adapter=this.controller.adapter,this.state="initialized",this.timingMetrics={}}var n;return r.prototype.start=function(){return"initialized"===this.state?(this.recordTimingMetric("visitStart"),this.state="started",this.adapter.visitStarted(this)):void 0},r.prototype.cancel=function(){var t;return"started"===this.state?(null!=(t=this.request)&&t.cancel(),this.cancelRender(),this.state="canceled"):void 0},r.prototype.complete=function(){var t;return"started"===this.state?(this.recordTimingMetric("visitEnd"),this.state="completed","function"==typeof(t=this.adapter).visitCompleted&&t.visitCompleted(this),this.controller.visitCompleted(this)):void 0},r.prototype.fail=function(){var t;return"started"===this.state?(this.state="failed","function"==typeof(t=this.adapter).visitFailed?t.visitFailed(this):void 0):void 0},r.prototype.changeHistory=function(){var t,e;return this.historyChanged?void 0:(t=this.location.isEqualTo(this.referrer)?"replace":this.action,e=n(t),this.controller[e](this.location,this.restorationIdentifier),this.historyChanged=!0)},r.prototype.issueRequest=function(){return this.shouldIssueRequest()&&null==this.request?(this.progress=0,this.request=new e.HttpRequest(this,this.location,this.referrer),this.request.send()):void 0},r.prototype.getCachedSnapshot=function(){var t;return!(t=this.controller.getCachedSnapshotForLocation(this.location))||null!=this.location.anchor&&!t.hasAnchor(this.location.anchor)||"restore"!==this.action&&!t.isPreviewable()?void 0:t},r.prototype.hasCachedSnapshot=function(){return null!=this.getCachedSnapshot()},r.prototype.loadCachedSnapshot=function(){var t,e;return(e=this.getCachedSnapshot())?(t=this.shouldIssueRequest(),this.render(function(){var r;return this.cacheSnapshot(),this.controller.render({snapshot:e,isPreview:t},this.performScroll),"function"==typeof(r=this.adapter).visitRendered&&r.visitRendered(this),t?void 0:this.complete()})):void 0},r.prototype.loadResponse=function(){return null!=this.response?this.render(function(){var t,e;return this.cacheSnapshot(),this.request.failed?(this.controller.render({error:this.response},this.performScroll),"function"==typeof(t=this.adapter).visitRendered&&t.visitRendered(this),this.fail()):(this.controller.render({snapshot:this.response},this.performScroll),"function"==typeof(e=this.adapter).visitRendered&&e.visitRendered(this),this.complete())}):void 0},r.prototype.followRedirect=function(){return this.redirectedToLocation&&!this.followedRedirect?(this.location=this.redirectedToLocation,this.controller.replaceHistoryWithLocationAndRestorationIdentifier(this.redirectedToLocation,this.restorationIdentifier),this.followedRedirect=!0):void 0},r.prototype.requestStarted=function(){var t;return this.recordTimingMetric("requestStart"),"function"==typeof(t=this.adapter).visitRequestStarted?t.visitRequestStarted(this):void 0},r.prototype.requestProgressed=function(t){var e;return this.progress=t,"function"==typeof(e=this.adapter).visitRequestProgressed?e.visitRequestProgressed(this):void 0},r.prototype.requestCompletedWithResponse=function(t,r){return this.response=t,null!=r&&(this.redirectedToLocation=e.Location.wrap(r)),this.adapter.visitRequestCompleted(this)},r.prototype.requestFailedWithStatusCode=function(t,e){return this.response=e,this.adapter.visitRequestFailedWithStatusCode(this,t)},r.prototype.requestFinished=function(){var t;return this.recordTimingMetric("requestEnd"),"function"==typeof(t=this.adapter).visitRequestFinished?t.visitRequestFinished(this):void 0},r.prototype.performScroll=function(){return this.scrolled?void 0:("restore"===this.action?this.scrollToRestoredPosition()||this.scrollToTop():this.scrollToAnchor()||this.scrollToTop(),this.scrolled=!0)},r.prototype.scrollToRestoredPosition=function(){var t,e;return t=null!=(e=this.restorationData)?e.scrollPosition:void 0,null!=t?(this.controller.scrollToPosition(t),!0):void 0},r.prototype.scrollToAnchor=function(){return null!=this.location.anchor?(this.controller.scrollToAnchor(this.location.anchor),!0):void 0},r.prototype.scrollToTop=function(){return this.controller.scrollToPosition({x:0,y:0})},r.prototype.recordTimingMetric=function(t){var e;return null!=(e=this.timingMetrics)[t]?e[t]:e[t]=(new Date).getTime()},r.prototype.getTimingMetrics=function(){return e.copyObject(this.timingMetrics)},n=function(t){switch(t){case"replace":return"replaceHistoryWithLocationAndRestorationIdentifier";case"advance":case"restore":return"pushHistoryWithLocationAndRestorationIdentifier"}},r.prototype.shouldIssueRequest=function(){return"restore"===this.action?!this.hasCachedSnapshot():!0},r.prototype.cacheSnapshot=function(){return this.snapshotCached?void 0:(this.controller.cacheSnapshot(),this.snapshotCached=!0)},r.prototype.render=function(t){return this.cancelRender(),this.frame=requestAnimationFrame(function(e){return function(){return e.frame=null,t.call(e)}}(this))},r.prototype.cancelRender=function(){return this.frame?cancelAnimationFrame(this.frame):void 0},r}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.Controller=function(){function r(){this.clickBubbled=t(this.clickBubbled,this),this.clickCaptured=t(this.clickCaptured,this),this.pageLoaded=t(this.pageLoaded,this),this.history=new e.History(this),this.view=new e.View(this),this.scrollManager=new e.ScrollManager(this),this.restorationData={},this.clearCache(),this.setProgressBarDelay(500)}
17903return r.prototype.start=function(){return e.supported&&!this.started?(addEventListener("click",this.clickCaptured,!0),addEventListener("DOMContentLoaded",this.pageLoaded,!1),this.scrollManager.start(),this.startHistory(),this.started=!0,this.enabled=!0):void 0},r.prototype.disable=function(){return this.enabled=!1},r.prototype.stop=function(){return this.started?(removeEventListener("click",this.clickCaptured,!0),removeEventListener("DOMContentLoaded",this.pageLoaded,!1),this.scrollManager.stop(),this.stopHistory(),this.started=!1):void 0},r.prototype.clearCache=function(){return this.cache=new e.SnapshotCache(10)},r.prototype.visit=function(t,r){var n,o;return null==r&&(r={}),t=e.Location.wrap(t),this.applicationAllowsVisitingLocation(t)?this.locationIsVisitable(t)?(n=null!=(o=r.action)?o:"advance",this.adapter.visitProposedToLocationWithAction(t,n)):window.location=t:void 0},r.prototype.startVisitToLocationWithAction=function(t,r,n){var o;return e.supported?(o=this.getRestorationDataForIdentifier(n),this.startVisit(t,r,{restorationData:o})):window.location=t},r.prototype.setProgressBarDelay=function(t){return this.progressBarDelay=t},r.prototype.startHistory=function(){return this.location=e.Location.wrap(window.location),this.restorationIdentifier=e.uuid(),this.history.start(),this.history.replace(this.location,this.restorationIdentifier)},r.prototype.stopHistory=function(){return this.history.stop()},r.prototype.pushHistoryWithLocationAndRestorationIdentifier=function(t,r){return this.restorationIdentifier=r,this.location=e.Location.wrap(t),this.history.push(this.location,this.restorationIdentifier)},r.prototype.replaceHistoryWithLocationAndRestorationIdentifier=function(t,r){return this.restorationIdentifier=r,this.location=e.Location.wrap(t),this.history.replace(this.location,this.restorationIdentifier)},r.prototype.historyPoppedToLocationWithRestorationIdentifier=function(t,r){var n;return this.restorationIdentifier=r,this.enabled?(n=this.getRestorationDataForIdentifier(this.restorationIdentifier),this.startVisit(t,"restore",{restorationIdentifier:this.restorationIdentifier,restorationData:n,historyChanged:!0}),this.location=e.Location.wrap(t)):this.adapter.pageInvalidated()},r.prototype.getCachedSnapshotForLocation=function(t){var e;return null!=(e=this.cache.get(t))?e.clone():void 0},r.prototype.shouldCacheSnapshot=function(){return this.view.getSnapshot().isCacheable(); 17904},r.prototype.cacheSnapshot=function(){var t,r;return this.shouldCacheSnapshot()?(this.notifyApplicationBeforeCachingSnapshot(),r=this.view.getSnapshot(),t=this.lastRenderedLocation,e.defer(function(e){return function(){return e.cache.put(t,r.clone())}}(this))):void 0},r.prototype.scrollToAnchor=function(t){var e;return(e=this.view.getElementForAnchor(t))?this.scrollToElement(e):this.scrollToPosition({x:0,y:0})},r.prototype.scrollToElement=function(t){return this.scrollManager.scrollToElement(t)},r.prototype.scrollToPosition=function(t){return this.scrollManager.scrollToPosition(t)},r.prototype.scrollPositionChanged=function(t){var e;return e=this.getCurrentRestorationData(),e.scrollPosition=t},r.prototype.render=function(t,e){return this.view.render(t,e)},r.prototype.viewInvalidated=function(){return this.adapter.pageInvalidated()},r.prototype.viewWillRender=function(t){return this.notifyApplicationBeforeRender(t)},r.prototype.viewRendered=function(){return this.lastRenderedLocation=this.currentVisit.location,this.notifyApplicationAfterRender()},r.prototype.pageLoaded=function(){return this.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()},r.prototype.clickCaptured=function(){return removeEventListener("click",this.clickBubbled,!1),addEventListener("click",this.clickBubbled,!1)},r.prototype.clickBubbled=function(t){var e,r,n;return this.enabled&&this.clickEventIsSignificant(t)&&(r=this.getVisitableLinkForNode(t.target))&&(n=this.getVisitableLocationForLink(r))&&this.applicationAllowsFollowingLinkToLocation(r,n)?(t.preventDefault(),e=this.getActionForLink(r),this.visit(n,{action:e})):void 0},r.prototype.applicationAllowsFollowingLinkToLocation=function(t,e){var r;return r=this.notifyApplicationAfterClickingLinkToLocation(t,e),!r.defaultPrevented},r.prototype.applicationAllowsVisitingLocation=function(t){var e;return e=this.notifyApplicationBeforeVisitingLocation(t),!e.defaultPrevented},r.prototype.notifyApplicationAfterClickingLinkToLocation=function(t,r){return e.dispatch("turbolinks:click",{target:t,data:{url:r.absoluteURL},cancelable:!0})},r.prototype.notifyApplicationBeforeVisitingLocation=function(t){return e.dispatch("turbolinks:before-visit",{data:{url:t.absoluteURL},cancelable:!0})},r.prototype.notifyApplicationAfterVisitingLocation=function(t){return e.dispatch("turbolinks:visit",{data:{url:t.absoluteURL}})},r.prototype.notifyApplicationBeforeCachingSnapshot=function(){return e.dispatch("turbolinks:before-cache")},r.prototype.notifyApplicationBeforeRender=function(t){return e.dispatch("turbolinks:before-render",{data:{newBody:t}})},r.prototype.notifyApplicationAfterRender=function(){return e.dispatch("turbolinks:render")},r.prototype.notifyApplicationAfterPageLoad=function(t){return null==t&&(t={}),e.dispatch("turbolinks:load",{data:{url:this.location.absoluteURL,timing:t}})},r.prototype.startVisit=function(t,e,r){var n;return null!=(n=this.currentVisit)&&n.cancel(),this.currentVisit=this.createVisit(t,e,r),this.currentVisit.start(),this.notifyApplicationAfterVisitingLocation(t)},r.prototype.createVisit=function(t,r,n){var o,i,s,a,u;return i=null!=n?n:{},a=i.restorationIdentifier,s=i.restorationData,o=i.historyChanged,u=new e.Visit(this,t,r),u.restorationIdentifier=null!=a?a:e.uuid(),u.restorationData=e.copyObject(s),u.historyChanged=o,u.referrer=this.location,u},r.prototype.visitCompleted=function(t){return this.notifyApplicationAfterPageLoad(t.getTimingMetrics())},r.prototype.clickEventIsSignificant=function(t){return!(t.defaultPrevented||t.target.isContentEditable||t.which>1||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)},r.prototype.getVisitableLinkForNode=function(t){return this.nodeIsVisitable(t)?e.closest(t,"a[href]:not([target]):not([download])"):void 0},r.prototype.getVisitableLocationForLink=function(t){var r;return r=new e.Location(t.getAttribute("href")),this.locationIsVisitable(r)?r:void 0},r.prototype.getActionForLink=function(t){var e;return null!=(e=t.getAttribute("data-turbolinks-action"))?e:"advance"},r.prototype.nodeIsVisitable=function(t){var r;return(r=e.closest(t,"[data-turbolinks]"))?"false"!==r.getAttribute("data-turbolinks"):!0},r.prototype.locationIsVisitable=function(t){return t.isPrefixedBy(this.view.getRootLocation())&&t.isHTML()},r.prototype.getCurrentRestorationData=function(){return this.getRestorationDataForIdentifier(this.restorationIdentifier)},r.prototype.getRestorationDataForIdentifier=function(t){var e;return null!=(e=this.restorationData)[t]?e[t]:e[t]={}},r}()}.call(this),function(){!function(){var t,e;if((t=e=document.currentScript)&&!e.hasAttribute("data-turbolinks-suppress-warning"))for(;t=t.parentNode;)if(t===document.body)return console.warn("You are loading Turbolinks from a <script> element inside the <body> element. This is probably not what you meant to do!\n\nLoad your application\u2019s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.\n\nFor more information, see: https://github.com/turbolinks/turbolinks#working-with-script-elements\n\n\u2014\u2014\nSuppress this warning by adding a `data-turbolinks-suppress-warning` attribute to: %s",e.outerHTML)}()}.call(this),function(){var t,r,n;e.start=function(){return r()?(null==e.controller&&(e.controller=t()),e.controller.start()):void 0},r=function(){return null==window.Turbolinks&&(window.Turbolinks=e),n()},t=function(){var t;return t=new e.Controller,t.adapter=new e.BrowserAdapter(t),t},n=function(){return window.Turbolinks===e},n()&&e.start()}.call(this)}).call(this),"object"==typeof module&&module.exports?module.exports=e:"function"==typeof define&&define.amd&&define(e)}).call(this); 17905(function() { 17906 var $, Query, Soulmate, Suggestion, SuggestionCollection, 17907 __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; 17908 17909 $ = jQuery; 17910 17911 Query = (function() { 17912 17913 function Query(minLength) { 17914 this.minLength = minLength; 17915 this.value = ''; 17916 this.lastValue = ''; 17917 this.emptyValues = []; 17918 } 17919 17920 Query.prototype.getValue = function() { 17921 return this.value; 17922 }; 17923 17924 Query.prototype.setValue = function(newValue) { 17925 this.lastValue = this.value; 17926 return this.value = newValue; 17927 }; 17928 17929 Query.prototype.hasChanged = function() { 17930 return !(this.value === this.lastValue); 17931 }; 17932 17933 Query.prototype.markEmpty = function() { 17934 return this.emptyValues.push(this.value); 17935 }; 17936 17937 Query.prototype.willHaveResults = function() { 17938 return this._isValid() && !this._isEmpty(); 17939 }; 17940 17941 Query.prototype._isValid = function() { 17942 return this.value.length >= this.minLength; 17943 }; 17944 17945 Query.prototype._isEmpty = function() { 17946 var empty, _i, _len, _ref; 17947 _ref = this.emptyValues; 17948 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 17949 empty = _ref[_i]; 17950 if (this.value.slice(0, empty.length) === empty) return true; 17951 } 17952 return false;
17953 }; 17954 17955 return Query; 17956 17957 })(); 17958 17959 Suggestion = (function() { 17960 17961 function Suggestion(index, term, data, type) { 17962 this.term = term; 17963 this.data = data; 17964 this.type = type; 17965 this.id = "" + index + "-soulmate-suggestion"; 17966 this.index = index; 17967 } 17968 17969 Suggestion.prototype.select = function(callback) { 17970 return callback(this.term, this.data, this.type, this.index, this.id); 17971 }; 17972 17973 Suggestion.prototype.focus = function() { 17974 return this.element().addClass('focus'); 17975 }; 17976 17977 Suggestion.prototype.blur = function() { 17978 return this.element().removeClass('focus'); 17979 }; 17980 17981 Suggestion.prototype.render = function(callback) { 17982 return "<li id=\"" + this.id + "\" class=\"soulmate-suggestion\">\n " + (callback(this.term, this.data, this.type, this.index, this.id)) + "\n</li>"; 17983 }; 17984 17985 Suggestion.prototype.element = function() { 17986 return $('#' + this.id); 17987 }; 17988 17989 return Suggestion; 17990 17991 })(); 17992 17993 SuggestionCollection = (function() { 17994 17995 function SuggestionCollection(renderCallback, selectCallback) { 17996 this.renderCallback = renderCallback; 17997 this.selectCallback = selectCallback; 17998 this.focusedIndex = -1; 17999 this.suggestions = []; 18000 } 18001 18002 SuggestionCollection.prototype.update = function(results) { 18003 var i, result, type, typeResults, _results; 18004 this.suggestions = []; 18005 i = 0; 18006 _results = []; 18007 for (type in results) { 18008 typeResults = results[type]; 18009 _results.push((function() { 18010 var _i, _len, _results2; 18011 _results2 = []; 18012 for (_i = 0, _len = typeResults.length; _i < _len; _i++) { 18013 result = typeResults[_i]; 18014 this.suggestions.push(new Suggestion(i, result.term, result.data, type)); 18015 _results2.push(i += 1); 18016 } 18017 return _results2; 18018 }).call(this)); 18019 } 18020 return _results; 18021 }; 18022 18023 SuggestionCollection.prototype.blurAll = function() { 18024 var suggestion, _i, _len, _ref, _results; 18025 this.focusedIndex = -1; 18026 _ref = this.suggestions; 18027 _results = []; 18028 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 18029 suggestion = _ref[_i]; 18030 _results.push(suggestion.blur()); 18031 } 18032 return _results; 18033 }; 18034 18035 SuggestionCollection.prototype.render = function() { 18036 var h, suggestion, type, _i, _len, _ref; 18037 h = ''; 18038 if (this.suggestions.length) { 18039 type = null; 18040 _ref = this.suggestions; 18041 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 18042 suggestion = _ref[_i]; 18043 if (suggestion.type !== type) { 18044 if (type !== null) h += this._renderTypeEnd(type); 18045 type = suggestion.type; 18046 h += this._renderTypeStart(); 18047 } 18048 h += this._renderSuggestion(suggestion); 18049 } 18050 h += this._renderTypeEnd(type); 18051 } 18052 return h; 18053 }; 18054 18055 SuggestionCollection.prototype.count = function() { 18056 return this.suggestions.length; 18057 }; 18058 18059 SuggestionCollection.prototype.focus = function(i) { 18060 if (i < this.count()) { 18061 this.blurAll(); 18062 if (i < 0) { 18063 return this.focusedIndex = -1; 18064 } else { 18065 this.suggestions[i].focus(); 18066 return this.focusedIndex = i; 18067 } 18068 } 18069 }; 18070 18071 SuggestionCollection.prototype.focusElement = function(element) { 18072 var index; 18073 index = parseInt($(element).attr('id')); 18074 return this.focus(index); 18075 }; 18076
18077 SuggestionCollection.prototype.focusNext = function() { 18078 return this.focus(this.focusedIndex + 1); 18079 }; 18080 18081 SuggestionCollection.prototype.focusPrevious = function() { 18082 return this.focus(this.focusedIndex - 1); 18083 }; 18084 18085 SuggestionCollection.prototype.selectFocused = function() { 18086 if (this.focusedIndex >= 0) { 18087 return this.suggestions[this.focusedIndex].select(this.selectCallback); 18088 } 18089 }; 18090 18091 SuggestionCollection.prototype.allBlured = function() { 18092 return this.focusedIndex === -1; 18093 }; 18094 18095 SuggestionCollection.prototype._renderTypeStart = function() { 18096 return "<li class=\"soulmate-type-container\">\n <ul class=\"soulmate-type-suggestions\">"; 18097 }; 18098 18099 SuggestionCollection.prototype._renderTypeEnd = function(type) { 18100 return " </ul>\n <div class=\"soulmate-type\">" + typesDiacritics(type) + "</div>\n</li>"; 18101 }; 18102 18103 SuggestionCollection.prototype._renderSuggestion = function(suggestion) { 18104 return suggestion.render(this.renderCallback); 18105 }; 18106 18107 return SuggestionCollection; 18108 18109 })(); 18110 18111 Soulmate = (function() { 18112 var KEYCODES; 18113 18114 KEYCODES = { 18115 9: 'tab', 18116 13: 'enter', 18117 27: 'escape', 18118 38: 'up', 18119 40: 'down' 18120 }; 18121 18122 function Soulmate(input, options) { 18123 var maxResults, minQueryLength, renderCallback, selectCallback, that, timeout, types, url; 18124 this.input = input; 18125 this.handleKeyup = __bind(this.handleKeyup, this); 18126 this.handleKeydown = __bind(this.handleKeydown, this); 18127 that = this; 18128 url = options.url, types = options.types, renderCallback = options.renderCallback, selectCallback = options.selectCallback, maxResults = options.maxResults, minQueryLength = options.minQueryLength, timeout = options.timeout; 18129 this.url = url; 18130 this.types = types; 18131 this.maxResults = maxResults; 18132 this.timeout = timeout || 500; 18133 this.xhr = null; 18134 this.suggestions = new SuggestionCollection(renderCallback, selectCallback); 18135 this.query = new Query(minQueryLength); 18136 if ($('ul#soulmate').length > 0) { 18137 this.container = $('ul#soulmate'); 18138 } else { 18139 this.container = $('<ul id="soulmate">').insertAfter(this.input); 18140 } 18141 this.container.delegate('.soulmate-suggestion', { 18142 mouseover: function() { 18143 return that.suggestions.focusElement(this); 18144 }, 18145 click: function(event) { 18146 event.preventDefault(); 18147 that.suggestions.selectFocused(); 18148 return that.input.focus(); 18149 } 18150 }); 18151 this.input.keydown(this.handleKeydown).keyup(this.handleKeyup).mouseover(function() { 18152 return that.suggestions.blurAll(); 18153 }); 18154 } 18155 18156 Soulmate.prototype.handleKeydown = function(event) { 18157 var killEvent; 18158 killEvent = true; 18159 switch (KEYCODES[event.keyCode]) { 18160 case 'escape': 18161 this.hideContainer(); 18162 break; 18163 case 'tab': 18164 this.suggestions.selectFocused(); 18165 break; 18166 case 'enter': 18167 this.suggestions.selectFocused(); 18168 if (this.suggestions.allBlured()) killEvent = false; 18169 break; 18170 case 'up': 18171 this.suggestions.focusPrevious(); 18172 break; 18173 case 'down': 18174 this.suggestions.focusNext(); 18175 break; 18176 default: 18177 killEvent = false; 18178 } 18179 if (killEvent) { 18180 event.stopImmediatePropagation(); 18181 return event.preventDefault(); 18182 } 18183 }; 18184 18185 Soulmate.prototype.handleKeyup = function(event) { 18186 this.query.setValue(this.input.val()); 18187 if (this.query.hasChanged()) { 18188 if (this.query.willHaveResults()) { 18189 this.suggestions.blurAll(); 18190 return this.fetchResults(); 18191 } else { 18192 return this.hideContainer(); 18193 } 18194 } 18195 }; 18196 18197 Soulmate.prototype.hideContainer = function() { 18198 this.suggestions.blurAll(); 18199 this.container.hide(); 18200 return $(document).unbind('click.soulmate'); 18201 }; 18202 18203 Soulmate.prototype.showContainer = function() { 18204 var _this = this; 18205 this.container.show(); 18206 return $(document).bind('click.soulmate', function(event) { 18207 if (!_this.container.has($(event.target)).length) { 18208 return _this.hideContainer(); 18209 } 18210 }); 18211 }; 18212 18213 Soulmate.prototype.fetchResults = function() { 18214 var _this = this; 18215 if (this.xhr != null) this.xhr.abort(); 18216 return this.xhr = $.ajax({ 18217 url: this.url, 18218 dataType: 'jsonp', 18219 timeout: this.timeout, 18220 cache: true, 18221 data: { 18222 // Parche para buscar cualquier cosa sin acentos 18223 term: removeDiacritics(this.query.getValue()), 18224 types: this.types, 18225 limit: this.maxResults 18226 }, 18227 success: function(data) { 18228 return _this.update(data.results); 18229 } 18230 }); 18231 }; 18232 18233 Soulmate.prototype.update = function(results) { 18234 this.suggestions.update(results); 18235 if (this.suggestions.count() > 0) { 18236 this.container.html($(this.suggestions.render())); 18237 return this.showContainer(); 18238 } else { 18239 this.query.markEmpty(); 18240 return this.hideContainer(); 18241 } 18242 }; 18243 18244 return Soulmate; 18245 18246 })(); 18247 18248 $.fn.soulmate = function(options) { 18249 new Soulmate($(this), options); 18250 return $(this); 18251 }; 18252 18253 window._test = { 18254 Query: Query, 18255 Suggestion: Suggestion, 18256 SuggestionCollection: SuggestionCollection, 18257 Soulmate: Soulmate 18258 }; 18259 18260}).call(this); 18261 18262function typesDiacritics(type) 18263{ 18264 var correct_type = type; 18265 18266 switch(type) 18267 { 18268 case 'region': 18269 correct_type = 'Región'; 18270 break; 18271 case 'pais': 18272 correct_type = 'PaÃs'; 18273 break; 18274 case 'diversidadnaturalycultural': 18275 correct_type = 'Diversidad natural y cultural'; 18276 break; 18277 case 'monitoreo': 18278 correct_type = 'Monitoreo'; 18279 break; 18280 case 'cienciaciudadana': 18281 correct_type = 'Ciencia ciudadana'; 18282 break; 18283 case 'conabio': 18284 correct_type = 'CONABIO'; 18285 break; 18286 } 18287 18288 return correct_type; 18289} 18290 18291function removeDiacritics (str) 18292{ 18293 var defaultDiacriticsRemovalMap = [ 18294 {'base':'A', 'letters':/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g}, 18295 {'base':'AA','letters':/[\uA732]/g}, 18296 {'base':'AE','letters':/[\u00C6\u01FC\u01E2]/g}, 18297 {'base':'AO','letters':/[\uA734]/g}, 18298 {'base':'AU','letters':/[\uA736]/g}, 18299 {'base':'AV','letters':/[\uA738\uA73A]/g}, 18300 {'base':'AY','letters':/[\uA73C]/g}, 18301 {'base':'B', 'letters':/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g}, 18302 {'base':'C', 'letters':/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g}, 18303 {'base':'D', 'letters':/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g}, 18304 {'base':'DZ','letters':/[\u01F1\u01C4]/g}, 18305 {'base':'Dz','letters':/[\u01F2\u01C5]/g}, 18306 {'base':'E', 'letters':/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g}, 18307 {'base':'F', 'letters':/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g}, 18308 {'base':'G', 'letters':/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g}, 18309 {'base':'H', 'letters':/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g}, 18310 {'base':'I', 'letters':/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g}, 18311 {'base':'J', 'letters':/[\u004A\u24BF\uFF2A\u0134\u0248]/g}, 18312 {'base':'K', 'letters':/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g}, 18313 {'base':'L', 'letters':/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u014
183131\u023D\u2C62\u2C60\uA748\uA746\uA780]/g}, 18314 {'base':'LJ','letters':/[\u01C7]/g}, 18315 {'base':'Lj','letters':/[\u01C8]/g}, 18316 {'base':'M', 'letters':/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g}, 18317 {'base':'N', 'letters':/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g}, 18318 {'base':'NJ','letters':/[\u01CA]/g}, 18319 {'base':'Nj','letters':/[\u01CB]/g}, 18320 {'base':'O', 'letters':/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g}, 18321 {'base':'OI','letters':/[\u01A2]/g}, 18322 {'base':'OO','letters':/[\uA74E]/g}, 18323 {'base':'OU','letters':/[\u0222]/g}, 18324 {'base':'P', 'letters':/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g}, 18325 {'base':'Q', 'letters':/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g}, 18326 {'base':'R', 'letters':/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g}, 18327 {'base':'S', 'letters':/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g}, 18328 {'base':'T', 'letters':/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g}, 18329 {'base':'TZ','letters':/[\uA728]/g}, 18330 {'base':'U', 'letters':/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g}, 18331 {'base':'V', 'letters':/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g}, 18332 {'base':'VY','letters':/[\uA760]/g}, 18333 {'base':'W', 'letters':/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g}, 18334 {'base':'X', 'letters':/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g}, 18335 {'base':'Y', 'letters':/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g}, 18336 {'base':'Z', 'letters':/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g}, 18337 {'base':'a', 'letters':/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g}, 18338 {'base':'aa','letters':/[\uA733]/g}, 18339 {'base':'ae','letters':/[\u00E6\u01FD\u01E3]/g}, 18340 {'base':'ao','letters':/[\uA735]/g}, 18341 {'base':'au','letters':/[\uA737]/g}, 18342 {'base':'av','letters':/[\uA739\uA73B]/g}, 18343 {'base':'ay','letters':/[\uA73D]/g}, 18344 {'base':'b', 'letters':/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g}, 18345 {'base':'c', 'letters':/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g}, 18346 {'base':'d', 'letters':/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g}, 18347 {'base':'dz','letters':/[\u01F3\u01C6]/g}, 18348 {'base':'e', 'letters':/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g}, 18349 {'base':'f', 'letters':/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g}, 18350 {'base':'g', 'letters':/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g}, 18351 {'base':'h', 'letters':/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g}, 18352 {'base':'hv','letters':/[\u0195]/g}, 18353 {'base':'i', 'letters':/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g}, 18354 {'base':'j', 'letters':/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g}, 18355 {'base':'k', 'letters':/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g}, 18356 {'base':'l', 'letters':/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g}, 18357 {'base':'lj','letters':/[\u01C9]/g}, 18358 {'base':'m', 'letters':/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g}, 18359 {'base':'n', 'letters':/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g}, 18360 {'base':'nj','letters':/[\u01CC]/g}, 18361 {'base':'o', 'letters':/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u
183611ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g}, 18362 {'base':'oi','letters':/[\u01A3]/g}, 18363 {'base':'ou','letters':/[\u0223]/g}, 18364 {'base':'oo','letters':/[\uA74F]/g}, 18365 {'base':'p','letters':/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g}, 18366 {'base':'q','letters':/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g}, 18367 {'base':'r','letters':/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g}, 18368 {'base':'s','letters':/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g}, 18369 {'base':'t','letters':/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g}, 18370 {'base':'tz','letters':/[\uA729]/g}, 18371 {'base':'u','letters':/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g}, 18372 {'base':'v','letters':/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g}, 18373 {'base':'vy','letters':/[\uA761]/g}, 18374 {'base':'w','letters':/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g}, 18375 {'base':'x','letters':/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g}, 18376 {'base':'y','letters':/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g}, 18377 {'base':'z','letters':/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g} 18378 ]; 18379 18380 for(var i=0; i<defaultDiacriticsRemovalMap.length; i++) { 18381 str = str.replace(defaultDiacriticsRemovalMap[i].letters, defaultDiacriticsRemovalMap[i].base); 18382 } 18383 18384 return str; 18385} 18386; 18387/** 18388 * Funcion para atachar que una caja de texto tenga funcionamiento con soulmate y redis 18389 */ 18390 18391var soulmateAsigna = function(elem) { 18392 18393 if (elem == undefined) 18394 var elemento = 'nombre'; 18395 else 18396 var elemento = elem; 18397 18398 /* Datos disponibles a extraer: id, term, score, summary, thumb, updated_at, subcategories, tags */ 18399 var render = function(term, data, type, index, id) { 18400 18401 var fColorClase = 'fcolor-' + type; 18402 var colorClase = 'color-' + type; 18403 18404 // Nombre (Siempre existirá) 18405 var nombre = '<p class="'+ fColorClase + '">' + primeraEnMayuscula(data.title) + ' </p>'; 18406 18407 // Resumen acortado ( por ahora, no se mostrará) 18408 /*if(data.summary != null) { 18409 var resumen = '<br><br><p class="overflow ellipsis">' + data.summary + '</p>' 18410 } else { 18411 var resumen = '' 18412 }*/ 18413 18414 // Etiquetas 18415 if(data.tags != null) { 18416 var tags = '<label style="color: #535353 "> Etiquetas: </label>';
18417 data.tags.forEach( function(valor) { 18418 tags = tags + ' <span class="badge '+ colorClase + '">' + valor + '</span>' 18419 }); 18420 } else { 18421 var tags = '' 18422 } 18423 18424 // Subcategorias 18425 if(data.subcategories != null) { 18426 var subcategorias = '<br><label style="color: #535353 "> SubcategorÃas: </label>'; 18427 data.subcategories.forEach( function(valor) { 18428 subcategorias = subcategorias + ' <span class="badge '+ colorClase + '">' + valor + '</span>' 18429 }); 18430 } else { 18431 var subcategorias = '' 18432 } 18433 18434 // Pegar la foto con estilo redondeado 18435 if(data.thumb == null) { 18436 var titulo = term.substring(0,2); 18437 var foto = '<span class="soulmate-img pull-left text-center '+ fColorClase + '"> ' + titulo + '</span>'; 18438 }else{ 18439 var foto_url = data.thumb; 18440 var foto = "<i class='soulmate-img pull-left' style='background-image: url(\"" + foto_url + "\")';></i>"; 18441 } 18442 18443 return foto + nombre + tags + subcategorias; 18444 }; 18445 18446 var select = function(term, data, type) { 18447 $('#' + elemento).val(term); 18448 $('ul#soulmate').hide(); // esconde el autocomplete cuando escoge uno 18449 $('#id').attr('value', data.slug); 18450 window.location.href = window.location.origin + '/' + data.slug; 18451 }; 18452 18453 $('#' + elemento).soulmate({ 18454 url: window.location.protocol + '//' + window.location.hostname + ':'+ window.location.port + "/sm/search", 18455 types: TYPES, 18456 renderCallback: render, 18457 selectCallback: select, 18458 minQueryLength: 2, 18459 maxResults: 30 18460 }); 18461}; 18462 18463function primeraEnMayuscula( str ) { 18464 return str.substr(0, 1).toUpperCase() + str.substr(1); 18465} 18466 18467 18468; 18469function resizeImgContainer(url_img) { 18470 var height = 0; 18471 var width = 0; 18472 var img = new Image(); 18473 var windowSpace = $(window).height() * 0.75; // Obtener el 75% de la pantalla 18474 18475 img.src = url_img; 18476 img.onload = function() { 18477 height = img.height; 18478 width = img.width; 18479 18480 // Verificar el tamaño en alto de la imagen: 18481 if(height >= windowSpace) { 18482 // Si es más grande que el alto del navegador, usar el alto de el tamaño el navegador para el contenedor 18483 $("#modal-media-content_body").css("height", windowSpace); 18484 // Si la imágen es alta 18485 if(height > width) { 18486 // Usar el ancho "autómatico" 18487 $("#modalTamanio").css("width", ""); 18488 } else { 18489 // Si es ancha, ocupar el 80% de la pantalla para mostrarla 18490 $("#modalTamanio").css("width", "80%"); 18491 } 18492 18493 } else { 18494 // Si es menor al tamaño del navegador, usar el alto de la imagen para el contenedor 18495 $("#modal-media-content_body").css("height", height); 18496 // Si la imágen es alta 18497 if(height > width) { 18498 // Usar el ancho "autómatico" 18499 $("#modalTamanio").css("width", ""); 18500 } else { 18501 // Si es ancha, ocupar el 80% de la pantalla para mostrarla 18502 $("#modalTamanio").css("width", width); 18503 } 18504 } 18505 }; 18506} 18507 18508 18509/*********************************************************************************************************************************/ 18510// When the user scrolls down 20px from the top of the document, show the button 18511window.onscroll = function() {scrollFunction()}; 18512 18513function scrollFunction() { 18514 if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { 18515 document.getElementById("upBtn").style.display = "block"; 18516 } else { 18517 document.getElementById("upBtn").style.display = "none"; 18518 } 18519} 18520 18521// When the user clicks on the button, scroll to the top of the document 18522function topFunction() { 18523 document.body.scrollTop = 0; // For Safari 18524 document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera 18525}; 18526 18527/*********************************************************************************************************************************/ 18528/* Fuente typekit (Adobe) */ 18529try{ 18530 Typekit.load({async: true}); 18531}catch(e) { 18532} 18533; 18534// This is a manifest file that'll be compiled into application.js, which will include all the files 18535// listed below. 18536// 18537// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 18538// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. 18539// 18540// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 18541// compiled file. JavaScript code in this file should be added after the last require_* statement. 18542// 18543// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 18544// about supported directives. 18545// 18546 18547 18548 18549 18550 18551 18552 18553 18554;
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.