vendor: 3,607 bytes, lines 1-88
1/******/ (function(modules) { // webpackBootstrap 2/******/ // The module cache 3/******/ var installedModules = {}; 4/******/ 5/******/ // The require function 6/******/ function __webpack_require__(moduleId) { 7/******/ 8/******/ // Check if module is in cache 9/******/ if(installedModules[moduleId]) { 10/******/ return installedModules[moduleId].exports; 11/******/ } 12/******/ // Create a new module (and put it into the cache) 13/******/ var module = installedModules[moduleId] = { 14/******/ i: moduleId, 15/******/ l: false, 16/******/ exports: {} 17/******/ }; 18/******/ 19/******/ // Execute the module function 20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21/******/ 22/******/ // Flag the module as loaded 23/******/ module.l = true; 24/******/ 25/******/ // Return the exports of the module 26/******/ return module.exports; 27/******/ } 28/******/ 29/******/ 30/******/ // expose the modules object (__webpack_modules__) 31/******/ __webpack_require__.m = modules; 32/******/ 33/******/ // expose the module cache 34/******/ __webpack_require__.c = installedModules; 35/******/ 36/******/ // define getter function for harmony exports 37/******/ __webpack_require__.d = function(exports, name, getter) { 38/******/ if(!__webpack_require__.o(exports, name)) { 39/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 40/******/ } 41/******/ }; 42/******/ 43/******/ // define __esModule on exports 44/******/ __webpack_require__.r = function(exports) { 45/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 46/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 47/******/ } 48/******/ Object.defineProperty(exports, '__esModule', { value: true }); 49/******/ }; 50/******/ 51/******/ // create a fake namespace object 52/******/ // mode & 1: value is a module id, require it 53/******/ // mode & 2: merge all properties of value into the ns 54/******/ // mode & 4: return value when already ns object 55/******/ // mode & 8|1: behave like require 56/******/ __webpack_require__.t = function(value, mode) { 57/******/ if(mode & 1) value = __webpack_require__(value); 58/******/ if(mode & 8) return value; 59/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 60/******/ var ns = Object.create(null); 61/******/ __webpack_require__.r(ns); 62/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 63/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 64/******/ return ns; 65/******/ }; 66/******/ 67/******/ // getDefaultExport function for compatibility with non-harmony modules 68/******/ __webpack_require__.n = function(module) { 69/******/ var getter = module && module.__esModule ? 70/******/ function getDefault() { return module['default']; } : 71/******/ function getModuleExports() { return module; }; 72/******/ __webpack_require__.d(getter, 'a', getter); 73/******/ return getter; 74/******/ }; 75/******/ 76/******/ // Object.prototype.hasOwnProperty.call 77/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 78/******/ 79/******/ // __webpack_public_path__ 80/******/ __webpack_require__.p = ""; 81/******/ 82/******/ 83/******/ // Load entry module and return exports 84/******/ return __webpack_require__(__webpack_require__.s = "./src/app.js"); 85/******/ }) 86/************************************************************************/ 87/******/ ({ 88
vendor: 18,460 bytes, lines 89-693
89/***/ "./node_modules/bootstrap/js/dist/dropdown.js": 90/*!****************************************************!*\ 91 !*** ./node_modules/bootstrap/js/dist/dropdown.js ***! 92 \****************************************************/ 93/*! no static exports found */ 94/***/ (function(module, exports, __webpack_require__) { 95 96/*! 97 * Bootstrap dropdown.js v4.3.1 (https://getbootstrap.com/) 98 * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 99 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 100 */ 101(function (global, factory) { 102 true ? module.exports = factory(__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js"), __webpack_require__(/*! ./util.js */ "./node_modules/bootstrap/js/dist/util.js")) : 103 undefined; 104}(this, function ($, Popper, Util) { 'use strict'; 105 106 $ = $ && $.hasOwnProperty('default') ? $['default'] : $; 107 Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper; 108 Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util; 109 110 function _defineProperties(target, props) { 111 for (var i = 0; i < props.length; i++) { 112 var descriptor = props[i]; 113 descriptor.enumerable = descriptor.enumerable || false; 114 descriptor.configurable = true; 115 if ("value" in descriptor) descriptor.writable = true; 116 Object.defineProperty(target, descriptor.key, descriptor); 117 } 118 } 119 120 function _createClass(Constructor, protoProps, staticProps) { 121 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 122 if (staticProps) _defineProperties(Constructor, staticProps); 123 return Constructor; 124 } 125 126 function _defineProperty(obj, key, value) { 127 if (key in obj) { 128 Object.defineProperty(obj, key, { 129 value: value, 130 enumerable: true, 131 configurable: true, 132 writable: true 133 }); 134 } else { 135 obj[key] = value; 136 } 137 138 return obj; 139 } 140 141 function _objectSpread(target) { 142 for (var i = 1; i < arguments.length; i++) { 143 var source = arguments[i] != null ? arguments[i] : {}; 144 var ownKeys = Object.keys(source); 145 146 if (typeof Object.getOwnPropertySymbols === 'function') { 147 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { 148 return Object.getOwnPropertyDescriptor(source, sym).enumerable; 149 })); 150 } 151 152 ownKeys.forEach(function (key) { 153 _defineProperty(target, key, source[key]); 154 }); 155 } 156 157 return target; 158 } 159 160 /** 161 * ------------------------------------------------------------------------ 162 * Constants 163 * ------------------------------------------------------------------------ 164 */ 165 166 var NAME = 'dropdown'; 167 var VERSION = '4.3.1'; 168 var DATA_KEY = 'bs.dropdown'; 169 var EVENT_KEY = "." + DATA_KEY; 170 var DATA_API_KEY = '.data-api'; 171 var JQUERY_NO_CONFLICT = $.fn[NAME]; 172 var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key 173 174 var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key 175 176 var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key 177 178 var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key 179 180 var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key 181 182 var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) 183 184 var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE); 185 var Event = { 186 HIDE: "hide" + EVENT_KEY, 187 HIDDEN: "hidden" + EVENT_KEY, 188 SHOW: "show" + EVENT_KEY, 189 SHOWN: "shown" + EVENT_KEY, 190 CLICK: "click" + EVENT_KEY, 191 CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY, 192 KEYDOWN_DATA_API: "keydown" + EVENT_KEY + DATA_API_KEY, 193 KEYUP_DATA_API: "keyup" + EVENT_KEY + DATA_API_KEY 194 }; 195 var ClassName = { 196 DISABLED: 'disabled', 197 SHOW: 'show', 198 DROPUP: 'dropup', 199 DROPRIGHT: 'dropright', 200 DROPLEFT: 'dropleft', 201 MENURIGHT: 'dropdown-menu-right', 202 MENULEFT: 'dropdown-menu-left', 203 POSITION_STATIC: 'position-static' 204 }; 205 var Selector = { 206 DATA_TOGGLE: '[data-toggle="dropdown"]', 207 FORM_CHILD: '.dropdown form', 208 MENU: '.dropdown-menu', 209 NAVBAR_NAV: '.navbar-nav', 210 VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)' 211 }; 212 var AttachmentMap = { 213 TOP: 'top-start', 214 TOPEND: 'top-end', 215 BOTTOM: 'bottom-start', 216 BOTTOMEND: 'bottom-end', 217 RIGHT: 'right-start', 218 RIGHTEND: 'right-end', 219 LEFT: 'left-start', 220 LEFTEND: 'left-end' 221 }; 222 var Default = { 223 offset: 0, 224 flip: true, 225 boundary: 'scrollParent', 226 reference: 'toggle', 227 display: 'dynamic' 228 }; 229 var DefaultType = { 230 offset: '(number|string|function)', 231 flip: 'boolean', 232 boundary: '(string|element)', 233 reference: '(string|element)', 234 display: 'string' 235 /** 236 * ------------------------------------------------------------------------ 237 * Class Definition 238 * ------------------------------------------------------------------------ 239 */ 240 241 }; 242 243 var Dropdown = 244 /*#__PURE__*/ 245 function () { 246 function Dropdown(element, config) { 247 this._element = element; 248 this._popper = null; 249 this._config = this._getConfig(config); 250 this._menu = this._getMenuElement(); 251 this._inNavbar = this._detectNavbar(); 252 253 this._addEventListeners(); 254 } // Getters 255 256 257 var _proto = Dropdown.prototype; 258 259 // Public 260 _proto.toggle = function toggle() { 261 if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED)) { 262 return; 263 } 264 265 var parent = Dropdown._getParentFromElement(this._element); 266 267 var isActive = $(this._menu).hasClass(ClassName.SHOW); 268 269 Dropdown._clearMenus(); 270 271 if (isActive) { 272 return; 273 } 274 275 var relatedTarget = { 276 relatedTarget: this._element 277 }; 278 var showEvent = $.Event(Event.SHOW, relatedTarget); 279 $(parent).trigger(showEvent); 280 281 if (showEvent.isDefaultPrevented()) { 282 return; 283 } // Disable totally Popper.js for Dropdown in Navbar 284 285 286 if (!this._inNavbar) { 287 /** 288 * Check for Popper dependency 289 * Popper - https://popper.js.org 290 */ 291 if (typeof Popper === 'undefined') { 292 throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)'); 293 } 294 295 var referenceElement = this._element; 296 297 if (this._config.reference === 'parent') { 298 referenceElement = parent; 299 } else if (Util.isElement(this._config.reference)) { 300 referenceElement = this._config.reference; // Check if it's jQuery element 301 302 if (typeof this._config.reference.jquery !== 'undefined') { 303 referenceElement = this._config.reference[0]; 304 } 305 } // If boundary is not `scrollParent`, then set position to `static` 306 // to allow the menu to "escape" the scroll parent's boundaries 307 // https://github.com/twbs/bootstrap/issues/24251 308 309 310 if (this._config.boundary !== 'scrollParent') { 311 $(parent).addClass(ClassName.POSITION_STATIC); 312 } 313 314 this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig()); 315 } // If this is a touch-enabled device we add extra 316 // empty mouseover listeners to the body's immediate children; 317 // only needed because of broken event delegation on iOS 318 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 319 320 321 if ('ontouchstart' in document.documentElement && $(parent).closest(Selector.NAVBAR_NAV).length === 0) { 322 $(document.body).children().on('mouseover', null, $.noop); 323 } 324 325 this._element.focus(); 326 327 this._element.setAttribute('aria-expanded', true); 328 329 $(this._menu).toggleClass(ClassName.SHOW); 330 $(parent).toggleClass(ClassName.SHOW).trigger($.Event(Event.SHOWN, relatedTarget)); 331 }; 332 333 _proto.show = function show() { 334 if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED) || $(this._menu).hasClass(ClassName.SHOW)) { 335 return; 336 } 337 338 var relatedTarget = { 339 relatedTarget: this._element 340 }; 341 var showEvent = $.Event(Event.SHOW, relatedTarget); 342 343 var parent = Dropdown._getParentFromElement(this._element); 344 345 $(parent).trigger(showEvent); 346 347 if (showEvent.isDefaultPrevented()) { 348 return; 349 } 350 351 $(this._menu).toggleClass(ClassName.SHOW); 352 $(parent).toggleClass(ClassName.SHOW).trigger($.Event(Event.SHOWN, relatedTarget)); 353 }; 354 355 _proto.hide = function hide() { 356 if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED) || !$(this._menu).hasClass(ClassName.SHOW)) { 357 return; 358 } 359 360 var relatedTarget = { 361 relatedTarget: this._element 362 }; 363 var hideEvent = $.Event(Event.HIDE, relatedTarget); 364 365 var parent = Dropdown._getParentFromElement(this._element); 366 367 $(parent).trigger(hideEvent); 368 369 if (hideEvent.isDefaultPrevented()) { 370 return; 371 } 372 373 $(this._menu).toggleClass(ClassName.SHOW); 374 $(parent).toggleClass(ClassName.SHOW).trigger($.Event(Event.HIDDEN, relatedTarget)); 375 }; 376 377 _proto.dispose = function dispose() { 378 $.removeData(this._element, DATA_KEY); 379 $(this._element).off(EVENT_KEY); 380 this._element = null; 381 this._menu = null; 382 383 if (this._popper !== null) { 384 this._popper.destroy(); 385 386 this._popper = null; 387 } 388 }; 389 390 _proto.update = function update() { 391 this._inNavbar = this._detectNavbar(); 392 393 if (this._popper !== null) { 394 this._popper.scheduleUpdate(); 395 } 396 } // Private 397 ; 398 399 _proto._addEventListeners = function _addEventListeners() { 400 var _this = this; 401 402 $(this._element).on(Event.CLICK, function (event) { 403 event.preventDefault(); 404 event.stopPropagation(); 405 406 _this.toggle(); 407 }); 408 }; 409 410 _proto._getConfig = function _getConfig(config) { 411 config = _objectSpread({}, this.constructor.Default, $(this._element).data(), config); 412 Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); 413 return config; 414 }; 415 416 _proto._getMenuElement = function _getMenuElement() { 417 if (!this._menu) { 418 var parent = Dropdown._getParentFromElement(this._element); 419 420 if (parent) { 421 this._menu = parent.querySelector(Selector.MENU); 422 } 423 } 424 425 return this._menu; 426 }; 427 428 _proto._getPlacement = function _getPlacement() { 429 var $parentDropdown = $(this._element.parentNode); 430 var placement = AttachmentMap.BOTTOM; // Handle dropup 431 432 if ($parentDropdown.hasClass(ClassName.DROPUP)) { 433 placement = AttachmentMap.TOP; 434 435 if ($(this._menu).hasClass(ClassName.MENURIGHT)) { 436 placement = AttachmentMap.TOPEND; 437 } 438 } else if ($parentDropdown.hasClass(ClassName.DROPRIGHT)) { 439 placement = AttachmentMap.RIGHT; 440 } else if ($parentDropdown.hasClass(ClassName.DROPLEFT)) { 441 placement = AttachmentMap.LEFT; 442 } else if ($(this._menu).hasClass(ClassName.MENURIGHT)) { 443 placement = AttachmentMap.BOTTOMEND; 444 } 445 446 return placement; 447 }; 448 449 _proto._detectNavbar = function _detectNavbar() { 450 return $(this._element).closest('.navbar').length > 0; 451 }; 452 453 _proto._getOffset = function _getOffset() { 454 var _this2 = this; 455 456 var offset = {}; 457 458 if (typeof this._config.offset === 'function') { 459 offset.fn = function (data) { 460 data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {}); 461 return data; 462 }; 463 } else { 464 offset.offset = this._config.offset; 465 } 466 467 return offset; 468 }; 469 470 _proto._getPopperConfig = function _getPopperConfig() { 471 var popperConfig = { 472 placement: this._getPlacement(), 473 modifiers: { 474 offset: this._getOffset(), 475 flip: { 476 enabled: this._config.flip 477 }, 478 preventOverflow: { 479 boundariesElement: this._config.boundary 480 } 481 } // Disable Popper.js if we have a static display 482 483 }; 484 485 if (this._config.display === 'static') { 486 popperConfig.modifiers.applyStyle = { 487 enabled: false 488 }; 489 } 490 491 return popperConfig; 492 } // Static 493 ; 494 495 Dropdown._jQueryInterface = function _jQueryInterface(config) { 496 return this.each(function () { 497 var data = $(this).data(DATA_KEY); 498 499 var _config = typeof config === 'object' ? config : null; 500 501 if (!data) { 502 data = new Dropdown(this, _config); 503 $(this).data(DATA_KEY, data); 504 } 505 506 if (typeof config === 'string') { 507 if (typeof data[config] === 'undefined') { 508 throw new TypeError("No method named \"" + config + "\""); 509 } 510 511 data[config](); 512 } 513 }); 514 }; 515 516 Dropdown._clearMenus = function _clearMenus(event) { 517 if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) { 518 return; 519 } 520 521 var toggles = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE)); 522 523 for (var i = 0, len = toggles.length; i < len; i++) { 524 var parent = Dropdown._getParentFromElement(toggles[i]); 525 526 var context = $(toggles[i]).data(DATA_KEY); 527 var relatedTarget = { 528 relatedTarget: toggles[i] 529 }; 530 531 if (event && event.type === 'click') { 532 relatedTarget.clickEvent = event; 533 } 534 535 if (!context) { 536 continue; 537 } 538 539 var dropdownMenu = context._menu; 540 541 if (!$(parent).hasClass(ClassName.SHOW)) { 542 continue; 543 } 544 545 if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) { 546 continue; 547 } 548 549 var hideEvent = $.Event(Event.HIDE, relatedTarget); 550 $(parent).trigger(hideEvent); 551 552 if (hideEvent.isDefaultPrevented()) { 553 continue; 554 } // If this is a touch-enabled device we remove the extra 555 // empty mouseover listeners we added for iOS support 556 557 558 if ('ontouchstart' in document.documentElement) { 559 $(document.body).children().off('mouseover', null, $.noop); 560 } 561 562 toggles[i].setAttribute('aria-expanded', 'false'); 563 $(dropdownMenu).removeClass(ClassName.SHOW); 564 $(parent).removeClass(ClassName.SHOW).trigger($.Event(Event.HIDDEN, relatedTarget)); 565 } 566 }; 567 568 Dropdown._getParentFromElement = function _getParentFromElement(element) { 569 var parent; 570 var selector = Util.getSelectorFromElement(element); 571 572 if (selector) { 573 parent = document.querySelector(selector); 574 } 575 576 return parent || element.parentNode; 577 } // eslint-disable-next-line complexity 578 ; 579 580 Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { 581 // If not input/textarea: 582 // - And not a key in REGEXP_KEYDOWN => not a dropdown command 583 // If input/textarea: 584 // - If space key => not a dropdown command 585 // - If key is other than escape 586 // - If key is not up or down => not a dropdown command 587 // - If trigger inside the menu => not a dropdown command 588 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.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) { 589 return; 590 } 591 592 event.preventDefault(); 593 event.stopPropagation(); 594 595 if (this.disabled || $(this).hasClass(ClassName.DISABLED)) { 596 return; 597 } 598 599 var parent = Dropdown._getParentFromElement(this); 600 601 var isActive = $(parent).hasClass(ClassName.SHOW); 602 603 if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { 604 if (event.which === ESCAPE_KEYCODE) { 605 var toggle = parent.querySelector(Selector.DATA_TOGGLE); 606 $(toggle).trigger('focus'); 607 } 608 609 $(this).trigger('click'); 610 return; 611 } 612 613 var items = [].slice.call(parent.querySelectorAll(Selector.VISIBLE_ITEMS)); 614 615 if (items.length === 0) { 616 return; 617 } 618 619 var index = items.indexOf(event.target); 620 621 if (event.which === ARROW_UP_KEYCODE && index > 0) { 622 // Up 623 index--; 624 } 625 626 if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { 627 // Down 628 index++; 629 } 630 631 if (index < 0) { 632 index = 0; 633 } 634 635 items[index].focus(); 636 }; 637 638 _createClass(Dropdown, null, [{ 639 key: "VERSION", 640 get: function get() { 641 return VERSION; 642 } 643 }, { 644 key: "Default", 645 get: function get() { 646 return Default; 647 } 648 }, { 649 key: "DefaultType", 650 get: function get() { 651 return DefaultType; 652 } 653 }]); 654 655 return Dropdown; 656 }(); 657 /** 658 * ------------------------------------------------------------------------ 659 * Data Api implementation 660 * ------------------------------------------------------------------------ 661 */ 662 663 664 $(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.MENU, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API + " " + Event.KEYUP_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { 665 event.preventDefault(); 666 event.stopPropagation(); 667 668 Dropdown._jQueryInterface.call($(this), 'toggle'); 669 }).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) { 670 e.stopPropagation(); 671 }); 672 /** 673 * ------------------------------------------------------------------------ 674 * jQuery 675 * ------------------------------------------------------------------------ 676 */ 677 678 $.fn[NAME] = Dropdown._jQueryInterface; 679 $.fn[NAME].Constructor = Dropdown; 680 681 $.fn[NAME].noConflict = function () { 682 $.fn[NAME] = JQUERY_NO_CONFLICT; 683 return Dropdown._jQueryInterface; 684 }; 685 686 return Dropdown; 687 688})); 689//# sourceMappingURL=dropdown.js.map 690 691 692/***/ }), 693
vendor: 6,051 bytes, lines 694-875
694/***/ "./node_modules/bootstrap/js/dist/util.js": 695/*!************************************************!*\ 696 !*** ./node_modules/bootstrap/js/dist/util.js ***! 697 \************************************************/ 698/*! no static exports found */ 699/***/ (function(module, exports, __webpack_require__) { 700 701/*! 702 * Bootstrap util.js v4.3.1 (https://getbootstrap.com/) 703 * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 704 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 705 */ 706(function (global, factory) { 707 true ? module.exports = factory(__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")) : 708 undefined; 709}(this, function ($) { 'use strict'; 710 711 $ = $ && $.hasOwnProperty('default') ? $['default'] : $; 712 713 /** 714 * -------------------------------------------------------------------------- 715 * Bootstrap (v4.3.1): util.js 716 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 717 * -------------------------------------------------------------------------- 718 */ 719 /** 720 * ------------------------------------------------------------------------ 721 * Private TransitionEnd Helpers 722 * ------------------------------------------------------------------------ 723 */ 724 725 var TRANSITION_END = 'transitionend'; 726 var MAX_UID = 1000000; 727 var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp) 728 729 function toType(obj) { 730 return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); 731 } 732 733 function getSpecialTransitionEndEvent() { 734 return { 735 bindType: TRANSITION_END, 736 delegateType: TRANSITION_END, 737 handle: function handle(event) { 738 if ($(event.target).is(this)) { 739 return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params 740 } 741 742 return undefined; // eslint-disable-line no-undefined 743 } 744 }; 745 } 746 747 function transitionEndEmulator(duration) { 748 var _this = this; 749 750 var called = false; 751 $(this).one(Util.TRANSITION_END, function () { 752 called = true; 753 }); 754 setTimeout(function () { 755 if (!called) { 756 Util.triggerTransitionEnd(_this); 757 } 758 }, duration); 759 return this; 760 } 761 762 function setTransitionEndSupport() { 763 $.fn.emulateTransitionEnd = transitionEndEmulator; 764 $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); 765 } 766 /** 767 * -------------------------------------------------------------------------- 768 * Public Util Api 769 * -------------------------------------------------------------------------- 770 */ 771 772 773 var Util = { 774 TRANSITION_END: 'bsTransitionEnd', 775 getUID: function getUID(prefix) { 776 do { 777 // eslint-disable-next-line no-bitwise 778 prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here 779 } while (document.getElementById(prefix)); 780 781 return prefix; 782 }, 783 getSelectorFromElement: function getSelectorFromElement(element) { 784 var selector = element.getAttribute('data-target'); 785 786 if (!selector || selector === '#') { 787 var hrefAttr = element.getAttribute('href'); 788 selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''; 789 } 790 791 try { 792 return document.querySelector(selector) ? selector : null; 793 } catch (err) { 794 return null; 795 } 796 }, 797 getTransitionDurationFromElement: function getTransitionDurationFromElement(element) { 798 if (!element) { 799 return 0; 800 } // Get transition-duration of the element 801 802 803 var transitionDuration = $(element).css('transition-duration'); 804 var transitionDelay = $(element).css('transition-delay'); 805 var floatTransitionDuration = parseFloat(transitionDuration); 806 var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found 807 808 if (!floatTransitionDuration && !floatTransitionDelay) { 809 return 0; 810 } // If multiple durations are defined, take the first 811 812 813 transitionDuration = transitionDuration.split(',')[0]; 814 transitionDelay = transitionDelay.split(',')[0]; 815 return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 816 }, 817 reflow: function reflow(element) { 818 return element.offsetHeight; 819 }, 820 triggerTransitionEnd: function triggerTransitionEnd(element) { 821 $(element).trigger(TRANSITION_END); 822 }, 823 // TODO: Remove in v5 824 supportsTransitionEnd: function supportsTransitionEnd() { 825 return Boolean(TRANSITION_END); 826 }, 827 isElement: function isElement(obj) { 828 return (obj[0] || obj).nodeType; 829 }, 830 typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { 831 for (var property in configTypes) { 832 if (Object.prototype.hasOwnProperty.call(configTypes, property)) { 833 var expectedTypes = configTypes[property]; 834 var value = config[property]; 835 var valueType = value && Util.isElement(value) ? 'element' : toType(value); 836 837 if (!new RegExp(expectedTypes).test(valueType)) { 838 throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\".")); 839 } 840 } 841 } 842 }, 843 findShadowRoot: function findShadowRoot(element) { 844 if (!document.documentElement.attachShadow) { 845 return null; 846 } // Can find the shadow root otherwise it'll return the document 847 848 849 if (typeof element.getRootNode === 'function') { 850 var root = element.getRootNode(); 851 return root instanceof ShadowRoot ? root : null; 852 } 853 854 if (element instanceof ShadowRoot) { 855 return element; 856 } // when we don't find a shadow root 857 858 859 if (!element.parentNode) { 860 return null; 861 } 862 863 return Util.findShadowRoot(element.parentNode); 864 } 865 }; 866 setTransitionEndSupport(); 867 868 return Util; 869 870})); 871//# sourceMappingURL=util.js.map 872 873 874/***/ }), 875
vendor: 280,355 bytes, lines 876-11475
876/***/ "./node_modules/jquery/dist/jquery.js": 877/*!********************************************!*\ 878 !*** ./node_modules/jquery/dist/jquery.js ***! 879 \********************************************/ 880/*! no static exports found */ 881/***/ (function(module, exports, __webpack_require__) { 882 883var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 884 * jQuery JavaScript Library v3.4.0 885 * https://jquery.com/ 886 * 887 * Includes Sizzle.js 888 * https://sizzlejs.com/ 889 * 890 * Copyright JS Foundation and other contributors 891 * Released under the MIT license 892 * https://jquery.org/license 893 * 894 * Date: 2019-04-10T19:48Z 895 */ 896( function( global, factory ) { 897 898 "use strict"; 899 900 if ( true && typeof module.exports === "object" ) { 901 902 // For CommonJS and CommonJS-like environments where a proper `window` 903 // is present, execute the factory and get jQuery. 904 // For environments that do not have a `window` with a `document` 905 // (such as Node.js), expose a factory as module.exports. 906 // This accentuates the need for the creation of a real `window`. 907 // e.g. var jQuery = require("jquery")(window); 908 // See ticket #14549 for more info. 909 module.exports = global.document ? 910 factory( global, true ) : 911 function( w ) { 912 if ( !w.document ) { 913 throw new Error( "jQuery requires a window with a document" ); 914 } 915 return factory( w ); 916 }; 917 } else { 918 factory( global ); 919 } 920 921// Pass this if window is not defined yet 922} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 923 924// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 925// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 926// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 927// enough that all such attempts are guarded in a try block. 928"use strict"; 929 930var arr = []; 931 932var document = window.document; 933 934var getProto = Object.getPrototypeOf; 935 936var slice = arr.slice; 937 938var concat = arr.concat; 939 940var push = arr.push; 941 942var indexOf = arr.indexOf; 943 944var class2type = {}; 945 946var toString = class2type.toString; 947 948var hasOwn = class2type.hasOwnProperty; 949 950var fnToString = hasOwn.toString; 951 952var ObjectFunctionString = fnToString.call( Object ); 953 954var support = {}; 955 956var isFunction = function isFunction( obj ) { 957 958 // Support: Chrome <=57, Firefox <=52 959 // In some browsers, typeof returns "function" for HTML <object> elements 960 // (i.e., `typeof document.createElement( "object" ) === "function"`). 961 // We don't want to classify *any* DOM node as a function. 962 return typeof obj === "function" && typeof obj.nodeType !== "number"; 963 }; 964 965 966var isWindow = function isWindow( obj ) { 967 return obj != null && obj === obj.window; 968 }; 969 970 971 972 973 var preservedScriptAttributes = { 974 type: true, 975 src: true, 976 nonce: true, 977 noModule: true 978 }; 979 980 function DOMEval( code, node, doc ) { 981 doc = doc || document; 982 983 var i, val, 984 script = doc.createElement( "script" ); 985 986 script.text = code; 987 if ( node ) { 988 for ( i in preservedScriptAttributes ) { 989 990 // Support: Firefox 64+, Edge 18+ 991 // Some browsers don't support the "nonce" property on scripts. 992 // On the other hand, just using `getAttribute` is not enough as 993 // the `nonce` attribute is reset to an empty string whenever it 994 // becomes browsing-context connected. 995 // See https://github.com/whatwg/html/issues/2369 996 // See https://html.spec.whatwg.org/#nonce-attributes 997 // The `node.getAttribute` check was added for the sake of 998 // `jQuery.globalEval` so that it can fake a nonce-containing node 999 // via an object. 1000 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 1001 if ( val ) { 1002 script.setAttribute( i, val ); 1003 } 1004 } 1005 } 1006 doc.head.appendChild( script ).parentNode.removeChild( script ); 1007 } 1008 1009 1010function toType( obj ) { 1011 if ( obj == null ) { 1012 return obj + ""; 1013 } 1014 1015 // Support: Android <=2.3 only (functionish RegExp) 1016 return typeof obj === "object" || typeof obj === "function" ? 1017 class2type[ toString.call( obj ) ] || "object" : 1018 typeof obj; 1019} 1020/* global Symbol */ 1021// Defining this global in .eslintrc.json would create a danger of using the global 1022// unguarded in another place, it seems safer to define global only for this module 1023 1024 1025 1026var 1027 version = "3.4.0", 1028 1029 // Define a local copy of jQuery 1030 jQuery = function( selector, context ) { 1031 1032 // The jQuery object is actually just the init constructor 'enhanced' 1033 // Need init if jQuery is called (just allow error to be thrown if not included) 1034 return new jQuery.fn.init( selector, context ); 1035 }, 1036 1037 // Support: Android <=4.0 only 1038 // Make sure we trim BOM and NBSP 1039 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; 1040 1041jQuery.fn = jQuery.prototype = { 1042 1043 // The current version of jQuery being used 1044 jquery: version, 1045 1046 constructor: jQuery, 1047 1048 // The default length of a jQuery object is 0 1049 length: 0, 1050 1051 toArray: function() { 1052 return slice.call( this ); 1053 }, 1054 1055 // Get the Nth element in the matched element set OR 1056 // Get the whole matched element set as a clean array 1057 get: function( num ) { 1058 1059 // Return all the elements in a clean array 1060 if ( num == null ) { 1061 return slice.call( this ); 1062 } 1063 1064 // Return just the one element from the set 1065 return num < 0 ? this[ num + this.length ] : this[ num ]; 1066 }, 1067 1068 // Take an array of elements and push it onto the stack 1069 // (returning the new matched element set) 1070 pushStack: function( elems ) { 1071 1072 // Build a new jQuery matched element set 1073 var ret = jQuery.merge( this.constructor(), elems ); 1074 1075 // Add the old object onto the stack (as a reference) 1076 ret.prevObject = this; 1077 1078 // Return the newly-formed element set 1079 return ret; 1080 }, 1081 1082 // Execute a callback for every element in the matched set. 1083 each: function( callback ) { 1084 return jQuery.each( this, callback ); 1085 }, 1086 1087 map: function( callback ) { 1088 return this.pushStack( jQuery.map( this, function( elem, i ) { 1089 return callback.call( elem, i, elem ); 1090 } ) ); 1091 }, 1092 1093 slice: function() { 1094 return this.pushStack( slice.apply( this, arguments ) ); 1095 }, 1096 1097 first: function() { 1098 return this.eq( 0 ); 1099 }, 1100 1101 last: function() { 1102 return this.eq( -1 ); 1103 }, 1104 1105 eq: function( i ) { 1106 var len = this.length, 1107 j = +i + ( i < 0 ? len : 0 ); 1108 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 1109 }, 1110 1111 end: function() { 1112 return this.prevObject || this.constructor(); 1113 }, 1114 1115 // For internal use only. 1116 // Behaves like an Array's method, not like a jQuery method. 1117 push: push, 1118 sort: arr.sort, 1119 splice: arr.splice 1120}; 1121 1122jQuery.extend = jQuery.fn.extend = function() { 1123 var options, name, src, copy, copyIsArray, clone, 1124 target = arguments[ 0 ] || {}, 1125 i = 1, 1126 length = arguments.length, 1127 deep = false; 1128 1129 // Handle a deep copy situation 1130 if ( typeof target === "boolean" ) { 1131 deep = target; 1132 1133 // Skip the boolean and the target 1134 target = arguments[ i ] || {}; 1135 i++; 1136 } 1137 1138 // Handle case when target is a string or something (possible in deep copy) 1139 if ( typeof target !== "object" && !isFunction( target ) ) { 1140 target = {}; 1141 } 1142 1143 // Extend jQuery itself if only one argument is passed 1144 if ( i === length ) { 1145 target = this; 1146 i--; 1147 } 1148 1149 for ( ; i < length; i++ ) { 1150 1151 // Only deal with non-null/undefined values 1152 if ( ( options = arguments[ i ] ) != null ) { 1153 1154 // Extend the base object 1155 for ( name in options ) { 1156 copy = options[ name ]; 1157 1158 // Prevent Object.prototype pollution 1159 // Prevent never-ending loop 1160 if ( name === "__proto__" || target === copy ) { 1161 continue; 1162 } 1163 1164 // Recurse if we're merging plain objects or arrays 1165 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 1166 ( copyIsArray = Array.isArray( copy ) ) ) ) { 1167 src = target[ name ]; 1168 1169 // Ensure proper type for the source value 1170 if ( copyIsArray && !Array.isArray( src ) ) { 1171 clone = []; 1172 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 1173 clone = {}; 1174 } else { 1175 clone = src; 1176 } 1177 copyIsArray = false; 1178 1179 // Never move original objects, clone them 1180 target[ name ] = jQuery.extend( deep, clone, copy ); 1181 1182 // Don't bring in undefined values 1183 } else if ( copy !== undefined ) { 1184 target[ name ] = copy; 1185 } 1186 } 1187 } 1188 } 1189 1190 // Return the modified object 1191 return target; 1192}; 1193 1194jQuery.extend( { 1195 1196 // Unique for each copy of jQuery on the page 1197 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 1198 1199 // Assume jQuery is ready without the ready module 1200 isReady: true, 1201 1202 error: function( msg ) { 1203 throw new Error( msg ); 1204 }, 1205 1206 noop: function() {}, 1207 1208 isPlainObject: function( obj ) { 1209 var proto, Ctor; 1210 1211 // Detect obvious negatives 1212 // Use toString instead of jQuery.type to catch host objects 1213 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 1214 return false; 1215 } 1216 1217 proto = getProto( obj ); 1218 1219 // Objects with no prototype (e.g., `Object.create( null )`) are plain 1220 if ( !proto ) { 1221 return true; 1222 } 1223 1224 // Objects with prototype are plain iff they were constructed by a global Object function 1225 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 1226 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 1227 }, 1228 1229 isEmptyObject: function( obj ) { 1230 var name; 1231 1232 for ( name in obj ) { 1233 return false; 1234 } 1235 return true; 1236 }, 1237 1238 // Evaluates a script in a global context 1239 globalEval: function( code, options ) { 1240 DOMEval( code, { nonce: options && options.nonce } ); 1241 }, 1242 1243 each: function( obj, callback ) { 1244 var length, i = 0; 1245 1246 if ( isArrayLike( obj ) ) { 1247 length = obj.length; 1248 for ( ; i < length; i++ ) { 1249 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 1250 break; 1251 } 1252 } 1253 } else { 1254 for ( i in obj ) { 1255 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 1256 break; 1257 } 1258 } 1259 } 1260 1261 return obj; 1262 }, 1263 1264 // Support: Android <=4.0 only 1265 trim: function( text ) { 1266 return text == null ? 1267 "" : 1268 ( text + "" ).replace( rtrim, "" ); 1269 }, 1270 1271 // results is for internal usage only 1272 makeArray: function( arr, results ) { 1273 var ret = results || []; 1274 1275 if ( arr != null ) { 1276 if ( isArrayLike( Object( arr ) ) ) { 1277 jQuery.merge( ret, 1278 typeof arr === "string" ? 1279 [ arr ] : arr 1280 ); 1281 } else { 1282 push.call( ret, arr ); 1283 } 1284 } 1285 1286 return ret; 1287 }, 1288 1289 inArray: function( elem, arr, i ) { 1290 return arr == null ? -1 : indexOf.call( arr, elem, i ); 1291 }, 1292 1293 // Support: Android <=4.0 only, PhantomJS 1 only 1294 // push.apply(_, arraylike) throws on ancient WebKit 1295 merge: function( first, second ) { 1296 var len = +second.length, 1297 j = 0, 1298 i = first.length; 1299 1300 for ( ; j < len; j++ ) { 1301 first[ i++ ] = second[ j ]; 1302 } 1303 1304 first.length = i; 1305 1306 return first; 1307 }, 1308 1309 grep: function( elems, callback, invert ) { 1310 var callbackInverse, 1311 matches = [], 1312 i = 0, 1313 length = elems.length, 1314 callbackExpect = !invert; 1315 1316 // Go through the array, only saving the items 1317 // that pass the validator function 1318 for ( ; i < length; i++ ) { 1319 callbackInverse = !callback( elems[ i ], i ); 1320 if ( callbackInverse !== callbackExpect ) { 1321 matches.push( elems[ i ] ); 1322 } 1323 } 1324 1325 return matches; 1326 }, 1327 1328 // arg is for internal usage only 1329 map: function( elems, callback, arg ) { 1330 var length, value, 1331 i = 0, 1332 ret = []; 1333 1334 // Go through the array, translating each of the items to their new values 1335 if ( isArrayLike( elems ) ) { 1336 length = elems.length; 1337 for ( ; i < length; i++ ) { 1338 value = callback( elems[ i ], i, arg ); 1339 1340 if ( value != null ) { 1341 ret.push( value ); 1342 } 1343 } 1344 1345 // Go through every key on the object, 1346 } else { 1347 for ( i in elems ) { 1348 value = callback( elems[ i ], i, arg ); 1349 1350 if ( value != null ) { 1351 ret.push( value ); 1352 } 1353 } 1354 } 1355 1356 // Flatten any nested arrays 1357 return concat.apply( [], ret ); 1358 }, 1359 1360 // A global GUID counter for objects 1361 guid: 1, 1362 1363 // jQuery.support is not used in Core but other projects attach their 1364 // properties to it so it needs to exist. 1365 support: support 1366} ); 1367 1368if ( typeof Symbol === "function" ) { 1369 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 1370} 1371 1372// Populate the class2type map 1373jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 1374function( i, name ) { 1375 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 1376} ); 1377 1378function isArrayLike( obj ) { 1379 1380 // Support: real iOS 8.2 only (not reproducible in simulator) 1381 // `in` check used to prevent JIT error (gh-2145) 1382 // hasOwn isn't used here due to false negatives 1383 // regarding Nodelist length in IE 1384 var length = !!obj && "length" in obj && obj.length, 1385 type = toType( obj ); 1386 1387 if ( isFunction( obj ) || isWindow( obj ) ) { 1388 return false; 1389 } 1390 1391 return type === "array" || length === 0 || 1392 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 1393} 1394var Sizzle = 1395/*! 1396 * Sizzle CSS Selector Engine v2.3.4 1397 * https://sizzlejs.com/ 1398 * 1399 * Copyright JS Foundation and other contributors 1400 * Released under the MIT license 1401 * https://js.foundation/ 1402 * 1403 * Date: 2019-04-08 1404 */ 1405(function( window ) { 1406 1407var i, 1408 support, 1409 Expr, 1410 getText, 1411 isXML, 1412 tokenize, 1413 compile, 1414 select, 1415 outermostContext, 1416 sortInput, 1417 hasDuplicate, 1418 1419 // Local document vars 1420 setDocument, 1421 document, 1422 docElem, 1423 documentIsHTML, 1424 rbuggyQSA, 1425 rbuggyMatches, 1426 matches, 1427 contains, 1428 1429 // Instance-specific data 1430 expando = "sizzle" + 1 * new Date(), 1431 preferredDoc = window.document, 1432 dirruns = 0, 1433 done = 0, 1434 classCache = createCache(), 1435 tokenCache = createCache(), 1436 compilerCache = createCache(), 1437 nonnativeSelectorCache = createCache(), 1438 sortOrder = function( a, b ) { 1439 if ( a === b ) { 1440 hasDuplicate = true; 1441 } 1442 return 0; 1443 }, 1444 1445 // Instance methods 1446 hasOwn = ({}).hasOwnProperty, 1447 arr = [], 1448 pop = arr.pop, 1449 push_native = arr.push, 1450 push = arr.push, 1451 slice = arr.slice, 1452 // Use a stripped-down indexOf as it's faster than native 1453 // https://jsperf.com/thor-indexof-vs-for/5 1454 indexOf = function( list, elem ) { 1455 var i = 0, 1456 len = list.length; 1457 for ( ; i < len; i++ ) { 1458 if ( list[i] === elem ) { 1459 return i; 1460 } 1461 } 1462 return -1; 1463 }, 1464 1465 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", 1466 1467 // Regular expressions 1468 1469 // http://www.w3.org/TR/css3-selectors/#whitespace 1470 whitespace = "[\\x20\\t\\r\\n\\f]", 1471 1472 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier 1473 identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", 1474 1475 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 1476 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 1477 // Operator (capture 2) 1478 "*([*^$|!~]?=)" + whitespace + 1479 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 1480 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + 1481 "*\\]", 1482 1483 pseudos = ":(" + identifier + ")(?:\\((" + 1484 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 1485 // 1. quoted (capture 3; capture 4 or capture 5) 1486 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 1487 // 2. simple (capture 6) 1488 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 1489 // 3. anything else (capture 2) 1490 ".*" + 1491 ")\\)|)", 1492 1493 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 1494 rwhitespace = new RegExp( whitespace + "+", "g" ), 1495 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), 1496 1497 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 1498 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), 1499 rdescend = new RegExp( whitespace + "|>" ), 1500 1501 rpseudo = new RegExp( pseudos ), 1502 ridentifier = new RegExp( "^" + identifier + "$" ), 1503 1504 matchExpr = { 1505 "ID": new RegExp( "^#(" + identifier + ")" ), 1506 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), 1507 "TAG": new RegExp( "^(" + identifier + "|[*])" ), 1508 "ATTR": new RegExp( "^" + attributes ), 1509 "PSEUDO": new RegExp( "^" + pseudos ), 1510 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + 1511 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + 1512 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 1513 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 1514 // For use in libraries implementing .is() 1515 // We use this for POS matching in `select` 1516 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + 1517 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 1518 }, 1519 1520 rhtml = /HTML$/i, 1521 rinputs = /^(?:input|select|textarea|button)$/i, 1522 rheader = /^h\d$/i, 1523 1524 rnative = /^[^{]+\{\s*\[native \w/, 1525 1526 // Easily-parseable/retrievable ID or TAG or CLASS selectors 1527 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 1528 1529 rsibling = /[+~]/, 1530 1531 // CSS escapes 1532 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 1533 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), 1534 funescape = function( _, escaped, escapedWhitespace ) { 1535 var high = "0x" + escaped - 0x10000; 1536 // NaN means non-codepoint 1537 // Support: Firefox<24 1538 // Workaround erroneous numeric interpretation of +"0x" 1539 return high !== high || escapedWhitespace ? 1540 escaped : 1541 high < 0 ? 1542 // BMP codepoint 1543 String.fromCharCode( high + 0x10000 ) : 1544 // Supplemental Plane codepoint (surrogate pair) 1545 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 1546 }, 1547 1548 // CSS string/identifier serialization 1549 // https://drafts.csswg.org/cssom/#common-serializing-idioms 1550 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, 1551 fcssescape = function( ch, asCodePoint ) { 1552 if ( asCodePoint ) { 1553 1554 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 1555 if ( ch === "\0" ) { 1556 return "\uFFFD"; 1557 } 1558 1559 // Control characters and (dependent upon position) numbers get escaped as code points 1560 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 1561 } 1562 1563 // Other potentially-special ASCII characters get backslash-escaped 1564 return "\\" + ch; 1565 }, 1566 1567 // Used for iframes 1568 // See setDocument() 1569 // Removing the function wrapper causes a "Permission Denied" 1570 // error in IE 1571 unloadHandler = function() { 1572 setDocument(); 1573 }, 1574 1575 inDisabledFieldset = addCombinator( 1576 function( elem ) { 1577 return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; 1578 }, 1579 { dir: "parentNode", next: "legend" } 1580 ); 1581 1582// Optimize for push.apply( _, NodeList ) 1583try { 1584 push.apply( 1585 (arr = slice.call( preferredDoc.childNodes )), 1586 preferredDoc.childNodes 1587 ); 1588 // Support: Android<4.0 1589 // Detect silently failing push.apply 1590 arr[ preferredDoc.childNodes.length ].nodeType; 1591} catch ( e ) { 1592 push = { apply: arr.length ? 1593 1594 // Leverage slice if possible 1595 function( target, els ) { 1596 push_native.apply( target, slice.call(els) ); 1597 } : 1598 1599 // Support: IE<9 1600 // Otherwise append directly 1601 function( target, els ) { 1602 var j = target.length, 1603 i = 0; 1604 // Can't trust NodeList.length 1605 while ( (target[j++] = els[i++]) ) {} 1606 target.length = j - 1; 1607 } 1608 }; 1609} 1610 1611function Sizzle( selector, context, results, seed ) { 1612 var m, i, elem, nid, match, groups, newSelector, 1613 newContext = context && context.ownerDocument, 1614 1615 // nodeType defaults to 9, since context defaults to document 1616 nodeType = context ? context.nodeType : 9; 1617 1618 results = results || []; 1619 1620 // Return early from calls with invalid selector or context 1621 if ( typeof selector !== "string" || !selector || 1622 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 1623 1624 return results; 1625 } 1626 1627 // Try to shortcut find operations (as opposed to filters) in HTML documents 1628 if ( !seed ) { 1629 1630 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { 1631 setDocument( context ); 1632 } 1633 context = context || document; 1634 1635 if ( documentIsHTML ) { 1636 1637 // If the selector is sufficiently simple, try using a "get*By*" DOM method 1638 // (excepting DocumentFragment context, where the methods don't exist) 1639 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { 1640 1641 // ID selector 1642 if ( (m = match[1]) ) { 1643 1644 // Document context 1645 if ( nodeType === 9 ) { 1646 if ( (elem = context.getElementById( m )) ) { 1647 1648 // Support: IE, Opera, Webkit 1649 // TODO: identify versions 1650 // getElementById can match elements by name instead of ID 1651 if ( elem.id === m ) { 1652 results.push( elem ); 1653 return results; 1654 } 1655 } else { 1656 return results; 1657 } 1658 1659 // Element context 1660 } else { 1661 1662 // Support: IE, Opera, Webkit 1663 // TODO: identify versions 1664 // getElementById can match elements by name instead of ID 1665 if ( newContext && (elem = newContext.getElementById( m )) && 1666 contains( context, elem ) && 1667 elem.id === m ) { 1668 1669 results.push( elem ); 1670 return results; 1671 } 1672 } 1673 1674 // Type selector 1675 } else if ( match[2] ) { 1676 push.apply( results, context.getElementsByTagName( selector ) ); 1677 return results; 1678 1679 // Class selector 1680 } else if ( (m = match[3]) && support.getElementsByClassName && 1681 context.getElementsByClassName ) { 1682 1683 push.apply( results, context.getElementsByClassName( m ) ); 1684 return results; 1685 } 1686 } 1687 1688 // Take advantage of querySelectorAll 1689 if ( support.qsa && 1690 !nonnativeSelectorCache[ selector + " " ] && 1691 (!rbuggyQSA || !rbuggyQSA.test( selector )) && 1692 1693 // Support: IE 8 only 1694 // Exclude object elements 1695 (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) { 1696 1697 newSelector = selector; 1698 newContext = context; 1699 1700 // qSA considers elements outside a scoping root when evaluating child or 1701 // descendant combinators, which is not what we want. 1702 // In such cases, we work around the behavior by prefixing every selector in the 1703 // list with an ID selector referencing the scope context. 1704 // Thanks to Andrew Dupont for this technique. 1705 if ( nodeType === 1 && rdescend.test( selector ) ) { 1706 1707 // Capture the context ID, setting it first if necessary 1708 if ( (nid = context.getAttribute( "id" )) ) { 1709 nid = nid.replace( rcssescape, fcssescape ); 1710 } else { 1711 context.setAttribute( "id", (nid = expando) ); 1712 } 1713 1714 // Prefix every selector in the list 1715 groups = tokenize( selector ); 1716 i = groups.length; 1717 while ( i-- ) { 1718 groups[i] = "#" + nid + " " + toSelector( groups[i] ); 1719 } 1720 newSelector = groups.join( "," ); 1721 1722 // Expand context for sibling selectors 1723 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 1724 context; 1725 } 1726 1727 try { 1728 push.apply( results, 1729 newContext.querySelectorAll( newSelector ) 1730 ); 1731 return results; 1732 } catch ( qsaError ) { 1733 nonnativeSelectorCache( selector, true ); 1734 } finally { 1735 if ( nid === expando ) { 1736 context.removeAttribute( "id" ); 1737 } 1738 } 1739 } 1740 } 1741 } 1742 1743 // All others 1744 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 1745} 1746 1747/** 1748 * Create key-value caches of limited size 1749 * @returns {function(string, object)} Returns the Object data after storing it on itself with 1750 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 1751 * deleting the oldest entry 1752 */ 1753function createCache() { 1754 var keys = []; 1755 1756 function cache( key, value ) { 1757 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 1758 if ( keys.push( key + " " ) > Expr.cacheLength ) { 1759 // Only keep the most recent entries 1760 delete cache[ keys.shift() ]; 1761 } 1762 return (cache[ key + " " ] = value); 1763 } 1764 return cache; 1765} 1766 1767/** 1768 * Mark a function for special use by Sizzle 1769 * @param {Function} fn The function to mark 1770 */ 1771function markFunction( fn ) { 1772 fn[ expando ] = true; 1773 return fn; 1774} 1775 1776/** 1777 * Support testing using an element 1778 * @param {Function} fn Passed the created element and returns a boolean result 1779 */ 1780function assert( fn ) { 1781 var el = document.createElement("fieldset"); 1782 1783 try { 1784 return !!fn( el ); 1785 } catch (e) { 1786 return false; 1787 } finally { 1788 // Remove from its parent by default 1789 if ( el.parentNode ) { 1790 el.parentNode.removeChild( el ); 1791 } 1792 // release memory in IE 1793 el = null; 1794 } 1795} 1796 1797/** 1798 * Adds the same handler for all of the specified attrs 1799 * @param {String} attrs Pipe-separated list of attributes 1800 * @param {Function} handler The method that will be applied 1801 */ 1802function addHandle( attrs, handler ) { 1803 var arr = attrs.split("|"), 1804 i = arr.length; 1805 1806 while ( i-- ) { 1807 Expr.attrHandle[ arr[i] ] = handler; 1808 } 1809} 1810 1811/** 1812 * Checks document order of two siblings 1813 * @param {Element} a 1814 * @param {Element} b 1815 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 1816 */ 1817function siblingCheck( a, b ) { 1818 var cur = b && a, 1819 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 1820 a.sourceIndex - b.sourceIndex; 1821 1822 // Use IE sourceIndex if available on both nodes 1823 if ( diff ) { 1824 return diff; 1825 } 1826 1827 // Check if b follows a 1828 if ( cur ) { 1829 while ( (cur = cur.nextSibling) ) { 1830 if ( cur === b ) { 1831 return -1; 1832 } 1833 } 1834 } 1835 1836 return a ? 1 : -1; 1837} 1838 1839/** 1840 * Returns a function to use in pseudos for input types 1841 * @param {String} type 1842 */ 1843function createInputPseudo( type ) { 1844 return function( elem ) { 1845 var name = elem.nodeName.toLowerCase(); 1846 return name === "input" && elem.type === type; 1847 }; 1848} 1849 1850/** 1851 * Returns a function to use in pseudos for buttons 1852 * @param {String} type 1853 */ 1854function createButtonPseudo( type ) { 1855 return function( elem ) { 1856 var name = elem.nodeName.toLowerCase(); 1857 return (name === "input" || name === "button") && elem.type === type; 1858 }; 1859} 1860 1861/** 1862 * Returns a function to use in pseudos for :enabled/:disabled 1863 * @param {Boolean} disabled true for :disabled; false for :enabled 1864 */ 1865function createDisabledPseudo( disabled ) { 1866 1867 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 1868 return function( elem ) { 1869 1870 // Only certain elements can match :enabled or :disabled 1871 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 1872 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 1873 if ( "form" in elem ) { 1874 1875 // Check for inherited disabledness on relevant non-disabled elements: 1876 // * listed form-associated elements in a disabled fieldset 1877 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 1878 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 1879 // * option elements in a disabled optgroup 1880 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 1881 // All such elements have a "form" property. 1882 if ( elem.parentNode && elem.disabled === false ) { 1883 1884 // Option elements defer to a parent optgroup if present 1885 if ( "label" in elem ) { 1886 if ( "label" in elem.parentNode ) { 1887 return elem.parentNode.disabled === disabled; 1888 } else { 1889 return elem.disabled === disabled; 1890 } 1891 } 1892 1893 // Support: IE 6 - 11 1894 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 1895 return elem.isDisabled === disabled || 1896 1897 // Where there is no isDisabled, check manually 1898 /* jshint -W018 */ 1899 elem.isDisabled !== !disabled && 1900 inDisabledFieldset( elem ) === disabled; 1901 } 1902 1903 return elem.disabled === disabled; 1904 1905 // Try to winnow out elements that can't be disabled before trusting the disabled property. 1906 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 1907 // even exist on them, let alone have a boolean value. 1908 } else if ( "label" in elem ) { 1909 return elem.disabled === disabled; 1910 } 1911 1912 // Remaining elements are neither :enabled nor :disabled 1913 return false; 1914 }; 1915} 1916 1917/** 1918 * Returns a function to use in pseudos for positionals 1919 * @param {Function} fn 1920 */ 1921function createPositionalPseudo( fn ) { 1922 return markFunction(function( argument ) { 1923 argument = +argument; 1924 return markFunction(function( seed, matches ) { 1925 var j, 1926 matchIndexes = fn( [], seed.length, argument ), 1927 i = matchIndexes.length; 1928 1929 // Match elements found at the specified indexes 1930 while ( i-- ) { 1931 if ( seed[ (j = matchIndexes[i]) ] ) { 1932 seed[j] = !(matches[j] = seed[j]); 1933 } 1934 } 1935 }); 1936 }); 1937} 1938 1939/** 1940 * Checks a node for validity as a Sizzle context 1941 * @param {Element|Object=} context 1942 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1943 */ 1944function testContext( context ) { 1945 return context && typeof context.getElementsByTagName !== "undefined" && context; 1946} 1947 1948// Expose support vars for convenience 1949support = Sizzle.support = {}; 1950 1951/** 1952 * Detects XML nodes 1953 * @param {Element|Object} elem An element or a document 1954 * @returns {Boolean} True iff elem is a non-HTML XML node 1955 */ 1956isXML = Sizzle.isXML = function( elem ) { 1957 var namespace = elem.namespaceURI, 1958 docElem = (elem.ownerDocument || elem).documentElement; 1959 1960 // Support: IE <=8 1961 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes 1962 // https://bugs.jquery.com/ticket/4833 1963 return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); 1964}; 1965 1966/** 1967 * Sets document-related variables once based on the current document 1968 * @param {Element|Object} [doc] An element or document object to use to set the document 1969 * @returns {Object} Returns the current document 1970 */ 1971setDocument = Sizzle.setDocument = function( node ) { 1972 var hasCompare, subWindow, 1973 doc = node ? node.ownerDocument || node : preferredDoc; 1974 1975 // Return early if doc is invalid or already selected 1976 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { 1977 return document; 1978 } 1979 1980 // Update global variables 1981 document = doc; 1982 docElem = document.documentElement; 1983 documentIsHTML = !isXML( document ); 1984 1985 // Support: IE 9-11, Edge 1986 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 1987 if ( preferredDoc !== document && 1988 (subWindow = document.defaultView) && subWindow.top !== subWindow ) { 1989 1990 // Support: IE 11, Edge 1991 if ( subWindow.addEventListener ) { 1992 subWindow.addEventListener( "unload", unloadHandler, false ); 1993 1994 // Support: IE 9 - 10 only 1995 } else if ( subWindow.attachEvent ) { 1996 subWindow.attachEvent( "onunload", unloadHandler ); 1997 } 1998 } 1999 2000 /* Attributes 2001 ---------------------------------------------------------------------- */ 2002 2003 // Support: IE<8 2004 // Verify that getAttribute really returns attributes and not properties 2005 // (excepting IE8 booleans) 2006 support.attributes = assert(function( el ) { 2007 el.className = "i"; 2008 return !el.getAttribute("className"); 2009 }); 2010 2011 /* getElement(s)By* 2012 ---------------------------------------------------------------------- */ 2013 2014 // Check if getElementsByTagName("*") returns only elements 2015 support.getElementsByTagName = assert(function( el ) { 2016 el.appendChild( document.createComment("") ); 2017 return !el.getElementsByTagName("*").length; 2018 }); 2019 2020 // Support: IE<9 2021 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); 2022 2023 // Support: IE<10 2024 // Check if getElementById returns elements by name 2025 // The broken getElementById methods don't pick up programmatically-set names, 2026 // so use a roundabout getElementsByName test 2027 support.getById = assert(function( el ) { 2028 docElem.appendChild( el ).id = expando; 2029 return !document.getElementsByName || !document.getElementsByName( expando ).length; 2030 }); 2031 2032 // ID filter and find 2033 if ( support.getById ) { 2034 Expr.filter["ID"] = function( id ) { 2035 var attrId = id.replace( runescape, funescape ); 2036 return function( elem ) { 2037 return elem.getAttribute("id") === attrId; 2038 }; 2039 }; 2040 Expr.find["ID"] = function( id, context ) { 2041 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 2042 var elem = context.getElementById( id ); 2043 return elem ? [ elem ] : []; 2044 } 2045 }; 2046 } else { 2047 Expr.filter["ID"] = function( id ) { 2048 var attrId = id.replace( runescape, funescape ); 2049 return function( elem ) { 2050 var node = typeof elem.getAttributeNode !== "undefined" && 2051 elem.getAttributeNode("id"); 2052 return node && node.value === attrId; 2053 }; 2054 }; 2055 2056 // Support: IE 6 - 7 only 2057 // getElementById is not reliable as a find shortcut 2058 Expr.find["ID"] = function( id, context ) { 2059 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 2060 var node, i, elems, 2061 elem = context.getElementById( id ); 2062 2063 if ( elem ) { 2064 2065 // Verify the id attribute 2066 node = elem.getAttributeNode("id"); 2067 if ( node && node.value === id ) { 2068 return [ elem ]; 2069 } 2070 2071 // Fall back on getElementsByName 2072 elems = context.getElementsByName( id ); 2073 i = 0; 2074 while ( (elem = elems[i++]) ) { 2075 node = elem.getAttributeNode("id"); 2076 if ( node && node.value === id ) { 2077 return [ elem ]; 2078 } 2079 } 2080 } 2081 2082 return []; 2083 } 2084 }; 2085 } 2086 2087 // Tag 2088 Expr.find["TAG"] = support.getElementsByTagName ? 2089 function( tag, context ) { 2090 if ( typeof context.getElementsByTagName !== "undefined" ) { 2091 return context.getElementsByTagName( tag ); 2092 2093 // DocumentFragment nodes don't have gEBTN 2094 } else if ( support.qsa ) { 2095 return context.querySelectorAll( tag ); 2096 } 2097 } : 2098 2099 function( tag, context ) { 2100 var elem, 2101 tmp = [], 2102 i = 0, 2103 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 2104 results = context.getElementsByTagName( tag ); 2105 2106 // Filter out possible comments 2107 if ( tag === "*" ) { 2108 while ( (elem = results[i++]) ) { 2109 if ( elem.nodeType === 1 ) { 2110 tmp.push( elem ); 2111 } 2112 } 2113 2114 return tmp; 2115 } 2116 return results; 2117 }; 2118 2119 // Class 2120 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { 2121 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 2122 return context.getElementsByClassName( className ); 2123 } 2124 }; 2125 2126 /* QSA/matchesSelector 2127 ---------------------------------------------------------------------- */ 2128 2129 // QSA and matchesSelector support 2130 2131 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 2132 rbuggyMatches = []; 2133 2134 // qSa(:focus) reports false when true (Chrome 21) 2135 // We allow this because of a bug in IE8/9 that throws an error 2136 // whenever `document.activeElement` is accessed on an iframe 2137 // So, we allow :focus to pass through QSA all the time to avoid the IE error 2138 // See https://bugs.jquery.com/ticket/13378 2139 rbuggyQSA = []; 2140 2141 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { 2142 // Build QSA regex 2143 // Regex strategy adopted from Diego Perini 2144 assert(function( el ) { 2145 // Select is set to empty string on purpose 2146 // This is to test IE's treatment of not explicitly 2147 // setting a boolean content attribute, 2148 // since its presence should be enough 2149 // https://bugs.jquery.com/ticket/12359 2150 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + 2151 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 2152 "<option selected=''></option></select>"; 2153 2154 // Support: IE8, Opera 11-12.16 2155 // Nothing should be selected when empty strings follow ^= or $= or *= 2156 // The test attribute must be unknown in Opera but "safe" for WinRT 2157 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 2158 if ( el.querySelectorAll("[msallowcapture^='']").length ) { 2159 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 2160 } 2161 2162 // Support: IE8 2163 // Boolean attributes and "value" are not treated correctly 2164 if ( !el.querySelectorAll("[selected]").length ) { 2165 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 2166 } 2167 2168 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 2169 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 2170 rbuggyQSA.push("~="); 2171 } 2172 2173 // Webkit/Opera - :checked should return selected option elements 2174 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 2175 // IE8 throws error here and will not see later tests 2176 if ( !el.querySelectorAll(":checked").length ) { 2177 rbuggyQSA.push(":checked"); 2178 } 2179 2180 // Support: Safari 8+, iOS 8+ 2181 // https://bugs.webkit.org/show_bug.cgi?id=136851 2182 // In-page `selector#id sibling-combinator selector` fails 2183 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 2184 rbuggyQSA.push(".#.+[+~]"); 2185 } 2186 }); 2187 2188 assert(function( el ) { 2189 el.innerHTML = "<a href='' disabled='disabled'></a>" + 2190 "<select disabled='disabled'><option/></select>"; 2191 2192 // Support: Windows 8 Native Apps 2193 // The type and name attributes are restricted during .innerHTML assignment 2194 var input = document.createElement("input"); 2195 input.setAttribute( "type", "hidden" ); 2196 el.appendChild( input ).setAttribute( "name", "D" ); 2197 2198 // Support: IE8 2199 // Enforce case-sensitivity of name attribute 2200 if ( el.querySelectorAll("[name=d]").length ) { 2201 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 2202 } 2203 2204 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 2205 // IE8 throws error here and will not see later tests 2206 if ( el.querySelectorAll(":enabled").length !== 2 ) { 2207 rbuggyQSA.push( ":enabled", ":disabled" ); 2208 } 2209 2210 // Support: IE9-11+ 2211 // IE's :disabled selector does not pick up the children of disabled fieldsets 2212 docElem.appendChild( el ).disabled = true; 2213 if ( el.querySelectorAll(":disabled").length !== 2 ) { 2214 rbuggyQSA.push( ":enabled", ":disabled" ); 2215 } 2216 2217 // Opera 10-11 does not throw on post-comma invalid pseudos 2218 el.querySelectorAll("*,:x"); 2219 rbuggyQSA.push(",.*:"); 2220 }); 2221 } 2222 2223 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || 2224 docElem.webkitMatchesSelector || 2225 docElem.mozMatchesSelector || 2226 docElem.oMatchesSelector || 2227 docElem.msMatchesSelector) )) ) { 2228 2229 assert(function( el ) { 2230 // Check to see if it's possible to do matchesSelector 2231 // on a disconnected node (IE 9) 2232 support.disconnectedMatch = matches.call( el, "*" ); 2233 2234 // This should fail with an exception 2235 // Gecko does not error, returns false instead 2236 matches.call( el, "[s!='']:x" ); 2237 rbuggyMatches.push( "!=", pseudos ); 2238 }); 2239 } 2240 2241 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); 2242 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); 2243 2244 /* Contains 2245 ---------------------------------------------------------------------- */ 2246 hasCompare = rnative.test( docElem.compareDocumentPosition ); 2247 2248 // Element contains another 2249 // Purposefully self-exclusive 2250 // As in, an element does not contain itself 2251 contains = hasCompare || rnative.test( docElem.contains ) ? 2252 function( a, b ) { 2253 var adown = a.nodeType === 9 ? a.documentElement : a, 2254 bup = b && b.parentNode; 2255 return a === bup || !!( bup && bup.nodeType === 1 && ( 2256 adown.contains ? 2257 adown.contains( bup ) : 2258 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 2259 )); 2260 } : 2261 function( a, b ) { 2262 if ( b ) { 2263 while ( (b = b.parentNode) ) { 2264 if ( b === a ) { 2265 return true; 2266 } 2267 } 2268 } 2269 return false; 2270 }; 2271 2272 /* Sorting 2273 ---------------------------------------------------------------------- */ 2274 2275 // Document order sorting 2276 sortOrder = hasCompare ? 2277 function( a, b ) { 2278 2279 // Flag for duplicate removal 2280 if ( a === b ) { 2281 hasDuplicate = true; 2282 return 0; 2283 } 2284 2285 // Sort on method existence if only one input has compareDocumentPosition 2286 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 2287 if ( compare ) { 2288 return compare; 2289 } 2290 2291 // Calculate position if both inputs belong to the same document 2292 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? 2293 a.compareDocumentPosition( b ) : 2294 2295 // Otherwise we know they are disconnected 2296 1; 2297 2298 // Disconnected nodes 2299 if ( compare & 1 || 2300 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { 2301 2302 // Choose the first element that is related to our preferred document 2303 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { 2304 return -1; 2305 } 2306 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { 2307 return 1; 2308 } 2309 2310 // Maintain original order 2311 return sortInput ? 2312 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 2313 0; 2314 } 2315 2316 return compare & 4 ? -1 : 1; 2317 } : 2318 function( a, b ) { 2319 // Exit early if the nodes are identical 2320 if ( a === b ) { 2321 hasDuplicate = true; 2322 return 0; 2323 } 2324 2325 var cur, 2326 i = 0, 2327 aup = a.parentNode, 2328 bup = b.parentNode, 2329 ap = [ a ], 2330 bp = [ b ]; 2331 2332 // Parentless nodes are either documents or disconnected 2333 if ( !aup || !bup ) { 2334 return a === document ? -1 : 2335 b === document ? 1 : 2336 aup ? -1 : 2337 bup ? 1 : 2338 sortInput ? 2339 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 2340 0; 2341 2342 // If the nodes are siblings, we can do a quick check 2343 } else if ( aup === bup ) { 2344 return siblingCheck( a, b ); 2345 } 2346 2347 // Otherwise we need full lists of their ancestors for comparison 2348 cur = a; 2349 while ( (cur = cur.parentNode) ) { 2350 ap.unshift( cur ); 2351 } 2352 cur = b; 2353 while ( (cur = cur.parentNode) ) { 2354 bp.unshift( cur ); 2355 } 2356 2357 // Walk down the tree looking for a discrepancy 2358 while ( ap[i] === bp[i] ) { 2359 i++; 2360 } 2361 2362 return i ? 2363 // Do a sibling check if the nodes have a common ancestor 2364 siblingCheck( ap[i], bp[i] ) : 2365 2366 // Otherwise nodes in our document sort first 2367 ap[i] === preferredDoc ? -1 : 2368 bp[i] === preferredDoc ? 1 : 2369 0; 2370 }; 2371 2372 return document; 2373}; 2374 2375Sizzle.matches = function( expr, elements ) { 2376 return Sizzle( expr, null, null, elements ); 2377}; 2378 2379Sizzle.matchesSelector = function( elem, expr ) { 2380 // Set document vars if needed 2381 if ( ( elem.ownerDocument || elem ) !== document ) { 2382 setDocument( elem ); 2383 } 2384 2385 if ( support.matchesSelector && documentIsHTML && 2386 !nonnativeSelectorCache[ expr + " " ] && 2387 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 2388 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 2389 2390 try { 2391 var ret = matches.call( elem, expr ); 2392 2393 // IE 9's matchesSelector returns false on disconnected nodes 2394 if ( ret || support.disconnectedMatch || 2395 // As well, disconnected nodes are said to be in a document 2396 // fragment in IE 9 2397 elem.document && elem.document.nodeType !== 11 ) { 2398 return ret; 2399 } 2400 } catch (e) { 2401 nonnativeSelectorCache( expr, true ); 2402 } 2403 } 2404 2405 return Sizzle( expr, document, null, [ elem ] ).length > 0; 2406}; 2407 2408Sizzle.contains = function( context, elem ) { 2409 // Set document vars if needed 2410 if ( ( context.ownerDocument || context ) !== document ) { 2411 setDocument( context ); 2412 } 2413 return contains( context, elem ); 2414}; 2415 2416Sizzle.attr = function( elem, name ) { 2417 // Set document vars if needed 2418 if ( ( elem.ownerDocument || elem ) !== document ) { 2419 setDocument( elem ); 2420 } 2421 2422 var fn = Expr.attrHandle[ name.toLowerCase() ], 2423 // Don't get fooled by Object.prototype properties (jQuery #13807) 2424 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 2425 fn( elem, name, !documentIsHTML ) : 2426 undefined; 2427 2428 return val !== undefined ? 2429 val : 2430 support.attributes || !documentIsHTML ? 2431 elem.getAttribute( name ) : 2432 (val = elem.getAttributeNode(name)) && val.specified ? 2433 val.value : 2434 null; 2435}; 2436 2437Sizzle.escape = function( sel ) { 2438 return (sel + "").replace( rcssescape, fcssescape ); 2439}; 2440 2441Sizzle.error = function( msg ) { 2442 throw new Error( "Syntax error, unrecognized expression: " + msg ); 2443}; 2444 2445/** 2446 * Document sorting and removing duplicates 2447 * @param {ArrayLike} results 2448 */ 2449Sizzle.uniqueSort = function( results ) { 2450 var elem, 2451 duplicates = [], 2452 j = 0, 2453 i = 0; 2454 2455 // Unless we *know* we can detect duplicates, assume their presence 2456 hasDuplicate = !support.detectDuplicates; 2457 sortInput = !support.sortStable && results.slice( 0 ); 2458 results.sort( sortOrder ); 2459 2460 if ( hasDuplicate ) { 2461 while ( (elem = results[i++]) ) { 2462 if ( elem === results[ i ] ) { 2463 j = duplicates.push( i ); 2464 } 2465 } 2466 while ( j-- ) { 2467 results.splice( duplicates[ j ], 1 ); 2468 } 2469 } 2470 2471 // Clear input after sorting to release objects 2472 // See https://github.com/jquery/sizzle/pull/225 2473 sortInput = null; 2474 2475 return results; 2476}; 2477 2478/** 2479 * Utility function for retrieving the text value of an array of DOM nodes 2480 * @param {Array|Element} elem 2481 */ 2482getText = Sizzle.getText = function( elem ) { 2483 var node, 2484 ret = "", 2485 i = 0, 2486 nodeType = elem.nodeType; 2487 2488 if ( !nodeType ) { 2489 // If no nodeType, this is expected to be an array 2490 while ( (node = elem[i++]) ) { 2491 // Do not traverse comment nodes 2492 ret += getText( node ); 2493 } 2494 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 2495 // Use textContent for elements 2496 // innerText usage removed for consistency of new lines (jQuery #11153) 2497 if ( typeof elem.textContent === "string" ) { 2498 return elem.textContent; 2499 } else { 2500 // Traverse its children 2501 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 2502 ret += getText( elem ); 2503 } 2504 } 2505 } else if ( nodeType === 3 || nodeType === 4 ) { 2506 return elem.nodeValue; 2507 } 2508 // Do not include comment or processing instruction nodes 2509 2510 return ret; 2511}; 2512 2513Expr = Sizzle.selectors = { 2514 2515 // Can be adjusted by the user 2516 cacheLength: 50, 2517 2518 createPseudo: markFunction, 2519 2520 match: matchExpr, 2521 2522 attrHandle: {}, 2523 2524 find: {}, 2525 2526 relative: { 2527 ">": { dir: "parentNode", first: true }, 2528 " ": { dir: "parentNode" }, 2529 "+": { dir: "previousSibling", first: true }, 2530 "~": { dir: "previousSibling" } 2531 }, 2532 2533 preFilter: { 2534 "ATTR": function( match ) { 2535 match[1] = match[1].replace( runescape, funescape ); 2536 2537 // Move the given value to match[3] whether quoted or unquoted 2538 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); 2539 2540 if ( match[2] === "~=" ) { 2541 match[3] = " " + match[3] + " "; 2542 } 2543 2544 return match.slice( 0, 4 ); 2545 }, 2546 2547 "CHILD": function( match ) { 2548 /* matches from matchExpr["CHILD"] 2549 1 type (only|nth|...) 2550 2 what (child|of-type) 2551 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 2552 4 xn-component of xn+y argument ([+-]?\d*n|) 2553 5 sign of xn-component 2554 6 x of xn-component 2555 7 sign of y-component 2556 8 y of y-component 2557 */ 2558 match[1] = match[1].toLowerCase(); 2559 2560 if ( match[1].slice( 0, 3 ) === "nth" ) { 2561 // nth-* requires argument 2562 if ( !match[3] ) { 2563 Sizzle.error( match[0] ); 2564 } 2565 2566 // numeric x and y parameters for Expr.filter.CHILD 2567 // remember that false/true cast respectively to 0/1 2568 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); 2569 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); 2570 2571 // other types prohibit arguments 2572 } else if ( match[3] ) { 2573 Sizzle.error( match[0] ); 2574 } 2575 2576 return match; 2577 }, 2578 2579 "PSEUDO": function( match ) { 2580 var excess, 2581 unquoted = !match[6] && match[2]; 2582 2583 if ( matchExpr["CHILD"].test( match[0] ) ) { 2584 return null; 2585 } 2586 2587 // Accept quoted arguments as-is 2588 if ( match[3] ) { 2589 match[2] = match[4] || match[5] || ""; 2590 2591 // Strip excess characters from unquoted arguments 2592 } else if ( unquoted && rpseudo.test( unquoted ) && 2593 // Get excess from tokenize (recursively) 2594 (excess = tokenize( unquoted, true )) && 2595 // advance to the next closing parenthesis 2596 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { 2597 2598 // excess is a negative index 2599 match[0] = match[0].slice( 0, excess ); 2600 match[2] = unquoted.slice( 0, excess ); 2601 } 2602 2603 // Return only captures needed by the pseudo filter method (type and argument) 2604 return match.slice( 0, 3 ); 2605 } 2606 }, 2607 2608 filter: { 2609 2610 "TAG": function( nodeNameSelector ) { 2611 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 2612 return nodeNameSelector === "*" ? 2613 function() { return true; } : 2614 function( elem ) { 2615 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 2616 }; 2617 }, 2618 2619 "CLASS": function( className ) { 2620 var pattern = classCache[ className + " " ]; 2621 2622 return pattern || 2623 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && 2624 classCache( className, function( elem ) { 2625 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); 2626 }); 2627 }, 2628 2629 "ATTR": function( name, operator, check ) { 2630 return function( elem ) { 2631 var result = Sizzle.attr( elem, name ); 2632 2633 if ( result == null ) { 2634 return operator === "!="; 2635 } 2636 if ( !operator ) { 2637 return true; 2638 } 2639 2640 result += ""; 2641 2642 return operator === "=" ? result === check : 2643 operator === "!=" ? result !== check : 2644 operator === "^=" ? check && result.indexOf( check ) === 0 : 2645 operator === "*=" ? check && result.indexOf( check ) > -1 : 2646 operator === "$=" ? check && result.slice( -check.length ) === check : 2647 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 2648 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 2649 false; 2650 }; 2651 }, 2652 2653 "CHILD": function( type, what, argument, first, last ) { 2654 var simple = type.slice( 0, 3 ) !== "nth", 2655 forward = type.slice( -4 ) !== "last", 2656 ofType = what === "of-type"; 2657 2658 return first === 1 && last === 0 ? 2659 2660 // Shortcut for :nth-*(n) 2661 function( elem ) { 2662 return !!elem.parentNode; 2663 } : 2664 2665 function( elem, context, xml ) { 2666 var cache, uniqueCache, outerCache, node, nodeIndex, start, 2667 dir = simple !== forward ? "nextSibling" : "previousSibling", 2668 parent = elem.parentNode, 2669 name = ofType && elem.nodeName.toLowerCase(), 2670 useCache = !xml && !ofType, 2671 diff = false; 2672 2673 if ( parent ) { 2674 2675 // :(first|last|only)-(child|of-type) 2676 if ( simple ) { 2677 while ( dir ) { 2678 node = elem; 2679 while ( (node = node[ dir ]) ) { 2680 if ( ofType ? 2681 node.nodeName.toLowerCase() === name : 2682 node.nodeType === 1 ) { 2683 2684 return false; 2685 } 2686 } 2687 // Reverse direction for :only-* (if we haven't yet done so) 2688 start = dir = type === "only" && !start && "nextSibling"; 2689 } 2690 return true; 2691 } 2692 2693 start = [ forward ? parent.firstChild : parent.lastChild ]; 2694 2695 // non-xml :nth-child(...) stores cache data on `parent` 2696 if ( forward && useCache ) { 2697 2698 // Seek `elem` from a previously-cached index 2699 2700 // ...in a gzip-friendly way 2701 node = parent; 2702 outerCache = node[ expando ] || (node[ expando ] = {}); 2703 2704 // Support: IE <9 only 2705 // Defend against cloned attroperties (jQuery gh-1709) 2706 uniqueCache = outerCache[ node.uniqueID ] || 2707 (outerCache[ node.uniqueID ] = {}); 2708 2709 cache = uniqueCache[ type ] || []; 2710 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 2711 diff = nodeIndex && cache[ 2 ]; 2712 node = nodeIndex && parent.childNodes[ nodeIndex ]; 2713 2714 while ( (node = ++nodeIndex && node && node[ dir ] || 2715 2716 // Fallback to seeking `elem` from the start 2717 (diff = nodeIndex = 0) || start.pop()) ) { 2718 2719 // When found, cache indexes on `parent` and break 2720 if ( node.nodeType === 1 && ++diff && node === elem ) { 2721 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; 2722 break; 2723 } 2724 } 2725 2726 } else { 2727 // Use previously-cached element index if available 2728 if ( useCache ) { 2729 // ...in a gzip-friendly way 2730 node = elem; 2731 outerCache = node[ expando ] || (node[ expando ] = {}); 2732 2733 // Support: IE <9 only 2734 // Defend against cloned attroperties (jQuery gh-1709) 2735 uniqueCache = outerCache[ node.uniqueID ] || 2736 (outerCache[ node.uniqueID ] = {}); 2737 2738 cache = uniqueCache[ type ] || []; 2739 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 2740 diff = nodeIndex; 2741 } 2742 2743 // xml :nth-child(...) 2744 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 2745 if ( diff === false ) { 2746 // Use the same loop as above to seek `elem` from the start 2747 while ( (node = ++nodeIndex && node && node[ dir ] || 2748 (diff = nodeIndex = 0) || start.pop()) ) { 2749 2750 if ( ( ofType ? 2751 node.nodeName.toLowerCase() === name : 2752 node.nodeType === 1 ) && 2753 ++diff ) { 2754 2755 // Cache the index of each encountered element 2756 if ( useCache ) { 2757 outerCache = node[ expando ] || (node[ expando ] = {}); 2758 2759 // Support: IE <9 only 2760 // Defend against cloned attroperties (jQuery gh-1709) 2761 uniqueCache = outerCache[ node.uniqueID ] || 2762 (outerCache[ node.uniqueID ] = {}); 2763 2764 uniqueCache[ type ] = [ dirruns, diff ]; 2765 } 2766 2767 if ( node === elem ) { 2768 break; 2769 } 2770 } 2771 } 2772 } 2773 } 2774 2775 // Incorporate the offset, then check against cycle size 2776 diff -= last; 2777 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 2778 } 2779 }; 2780 }, 2781 2782 "PSEUDO": function( pseudo, argument ) { 2783 // pseudo-class names are case-insensitive 2784 // http://www.w3.org/TR/selectors/#pseudo-classes 2785 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 2786 // Remember that setFilters inherits from pseudos 2787 var args, 2788 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 2789 Sizzle.error( "unsupported pseudo: " + pseudo ); 2790 2791 // The user may use createPseudo to indicate that 2792 // arguments are needed to create the filter function 2793 // just as Sizzle does 2794 if ( fn[ expando ] ) { 2795 return fn( argument ); 2796 } 2797 2798 // But maintain support for old signatures 2799 if ( fn.length > 1 ) { 2800 args = [ pseudo, pseudo, "", argument ]; 2801 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 2802 markFunction(function( seed, matches ) { 2803 var idx, 2804 matched = fn( seed, argument ), 2805 i = matched.length; 2806 while ( i-- ) { 2807 idx = indexOf( seed, matched[i] ); 2808 seed[ idx ] = !( matches[ idx ] = matched[i] ); 2809 } 2810 }) : 2811 function( elem ) { 2812 return fn( elem, 0, args ); 2813 }; 2814 } 2815 2816 return fn; 2817 } 2818 }, 2819 2820 pseudos: { 2821 // Potentially complex pseudos 2822 "not": markFunction(function( selector ) { 2823 // Trim the selector passed to compile 2824 // to avoid treating leading and trailing 2825 // spaces as combinators 2826 var input = [], 2827 results = [], 2828 matcher = compile( selector.replace( rtrim, "$1" ) ); 2829 2830 return matcher[ expando ] ? 2831 markFunction(function( seed, matches, context, xml ) { 2832 var elem, 2833 unmatched = matcher( seed, null, xml, [] ), 2834 i = seed.length; 2835 2836 // Match elements unmatched by `matcher` 2837 while ( i-- ) { 2838 if ( (elem = unmatched[i]) ) { 2839 seed[i] = !(matches[i] = elem); 2840 } 2841 } 2842 }) : 2843 function( elem, context, xml ) { 2844 input[0] = elem; 2845 matcher( input, null, xml, results ); 2846 // Don't keep the element (issue #299) 2847 input[0] = null; 2848 return !results.pop(); 2849 }; 2850 }), 2851 2852 "has": markFunction(function( selector ) { 2853 return function( elem ) { 2854 return Sizzle( selector, elem ).length > 0; 2855 }; 2856 }), 2857 2858 "contains": markFunction(function( text ) { 2859 text = text.replace( runescape, funescape ); 2860 return function( elem ) { 2861 return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; 2862 }; 2863 }), 2864 2865 // "Whether an element is represented by a :lang() selector 2866 // is based solely on the element's language value 2867 // being equal to the identifier C, 2868 // or beginning with the identifier C immediately followed by "-". 2869 // The matching of C against the element's language value is performed case-insensitively. 2870 // The identifier C does not have to be a valid language name." 2871 // http://www.w3.org/TR/selectors/#lang-pseudo 2872 "lang": markFunction( function( lang ) { 2873 // lang value must be a valid identifier 2874 if ( !ridentifier.test(lang || "") ) { 2875 Sizzle.error( "unsupported lang: " + lang ); 2876 } 2877 lang = lang.replace( runescape, funescape ).toLowerCase(); 2878 return function( elem ) { 2879 var elemLang; 2880 do { 2881 if ( (elemLang = documentIsHTML ? 2882 elem.lang : 2883 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { 2884 2885 elemLang = elemLang.toLowerCase(); 2886 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 2887 } 2888 } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); 2889 return false; 2890 }; 2891 }), 2892 2893 // Miscellaneous 2894 "target": function( elem ) { 2895 var hash = window.location && window.location.hash; 2896 return hash && hash.slice( 1 ) === elem.id; 2897 }, 2898 2899 "root": function( elem ) { 2900 return elem === docElem; 2901 }, 2902 2903 "focus": function( elem ) { 2904 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); 2905 }, 2906 2907 // Boolean properties 2908 "enabled": createDisabledPseudo( false ), 2909 "disabled": createDisabledPseudo( true ), 2910 2911 "checked": function( elem ) { 2912 // In CSS3, :checked should return both checked and selected elements 2913 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 2914 var nodeName = elem.nodeName.toLowerCase(); 2915 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); 2916 }, 2917 2918 "selected": function( elem ) { 2919 // Accessing this property makes selected-by-default 2920 // options in Safari work properly 2921 if ( elem.parentNode ) { 2922 elem.parentNode.selectedIndex; 2923 } 2924 2925 return elem.selected === true; 2926 }, 2927 2928 // Contents 2929 "empty": function( elem ) { 2930 // http://www.w3.org/TR/selectors/#empty-pseudo 2931 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 2932 // but not by others (comment: 8; processing instruction: 7; etc.) 2933 // nodeType < 6 works because attributes (2) do not appear as children 2934 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 2935 if ( elem.nodeType < 6 ) { 2936 return false; 2937 } 2938 } 2939 return true; 2940 }, 2941 2942 "parent": function( elem ) { 2943 return !Expr.pseudos["empty"]( elem ); 2944 }, 2945 2946 // Element/input types 2947 "header": function( elem ) { 2948 return rheader.test( elem.nodeName ); 2949 }, 2950 2951 "input": function( elem ) { 2952 return rinputs.test( elem.nodeName ); 2953 }, 2954 2955 "button": function( elem ) { 2956 var name = elem.nodeName.toLowerCase(); 2957 return name === "input" && elem.type === "button" || name === "button"; 2958 }, 2959 2960 "text": function( elem ) { 2961 var attr; 2962 return elem.nodeName.toLowerCase() === "input" && 2963 elem.type === "text" && 2964 2965 // Support: IE<8 2966 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 2967 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); 2968 }, 2969 2970 // Position-in-collection 2971 "first": createPositionalPseudo(function() { 2972 return [ 0 ]; 2973 }), 2974 2975 "last": createPositionalPseudo(function( matchIndexes, length ) { 2976 return [ length - 1 ]; 2977 }), 2978 2979 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { 2980 return [ argument < 0 ? argument + length : argument ]; 2981 }), 2982 2983 "even": createPositionalPseudo(function( matchIndexes, length ) { 2984 var i = 0; 2985 for ( ; i < length; i += 2 ) { 2986 matchIndexes.push( i ); 2987 } 2988 return matchIndexes; 2989 }), 2990 2991 "odd": createPositionalPseudo(function( matchIndexes, length ) { 2992 var i = 1; 2993 for ( ; i < length; i += 2 ) { 2994 matchIndexes.push( i ); 2995 } 2996 return matchIndexes; 2997 }), 2998 2999 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { 3000 var i = argument < 0 ? 3001 argument + length : 3002 argument > length ? 3003 length : 3004 argument; 3005 for ( ; --i >= 0; ) { 3006 matchIndexes.push( i ); 3007 } 3008 return matchIndexes; 3009 }), 3010 3011 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { 3012 var i = argument < 0 ? argument + length : argument; 3013 for ( ; ++i < length; ) { 3014 matchIndexes.push( i ); 3015 } 3016 return matchIndexes; 3017 }) 3018 } 3019}; 3020 3021Expr.pseudos["nth"] = Expr.pseudos["eq"]; 3022 3023// Add button/input type pseudos 3024for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 3025 Expr.pseudos[ i ] = createInputPseudo( i ); 3026} 3027for ( i in { submit: true, reset: true } ) { 3028 Expr.pseudos[ i ] = createButtonPseudo( i ); 3029} 3030 3031// Easy API for creating new setFilters 3032function setFilters() {} 3033setFilters.prototype = Expr.filters = Expr.pseudos; 3034Expr.setFilters = new setFilters(); 3035 3036tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 3037 var matched, match, tokens, type, 3038 soFar, groups, preFilters, 3039 cached = tokenCache[ selector + " " ]; 3040 3041 if ( cached ) { 3042 return parseOnly ? 0 : cached.slice( 0 ); 3043 } 3044 3045 soFar = selector; 3046 groups = []; 3047 preFilters = Expr.preFilter; 3048 3049 while ( soFar ) { 3050 3051 // Comma and first run 3052 if ( !matched || (match = rcomma.exec( soFar )) ) { 3053 if ( match ) { 3054 // Don't consume trailing commas as valid 3055 soFar = soFar.slice( match[0].length ) || soFar; 3056 } 3057 groups.push( (tokens = []) ); 3058 } 3059 3060 matched = false; 3061 3062 // Combinators 3063 if ( (match = rcombinators.exec( soFar )) ) { 3064 matched = match.shift(); 3065 tokens.push({ 3066 value: matched, 3067 // Cast descendant combinators to space 3068 type: match[0].replace( rtrim, " " ) 3069 }); 3070 soFar = soFar.slice( matched.length ); 3071 } 3072 3073 // Filters 3074 for ( type in Expr.filter ) { 3075 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || 3076 (match = preFilters[ type ]( match ))) ) { 3077 matched = match.shift(); 3078 tokens.push({ 3079 value: matched, 3080 type: type, 3081 matches: match 3082 }); 3083 soFar = soFar.slice( matched.length ); 3084 } 3085 } 3086 3087 if ( !matched ) { 3088 break; 3089 } 3090 } 3091 3092 // Return the length of the invalid excess 3093 // if we're just parsing 3094 // Otherwise, throw an error or return tokens 3095 return parseOnly ? 3096 soFar.length : 3097 soFar ? 3098 Sizzle.error( selector ) : 3099 // Cache the tokens 3100 tokenCache( selector, groups ).slice( 0 ); 3101}; 3102 3103function toSelector( tokens ) { 3104 var i = 0, 3105 len = tokens.length, 3106 selector = ""; 3107 for ( ; i < len; i++ ) { 3108 selector += tokens[i].value; 3109 } 3110 return selector; 3111} 3112 3113function addCombinator( matcher, combinator, base ) { 3114 var dir = combinator.dir, 3115 skip = combinator.next, 3116 key = skip || dir, 3117 checkNonElements = base && key === "parentNode", 3118 doneName = done++; 3119 3120 return combinator.first ? 3121 // Check against closest ancestor/preceding element 3122 function( elem, context, xml ) { 3123 while ( (elem = elem[ dir ]) ) { 3124 if ( elem.nodeType === 1 || checkNonElements ) { 3125 return matcher( elem, context, xml ); 3126 } 3127 } 3128 return false; 3129 } : 3130 3131 // Check against all ancestor/preceding elements 3132 function( elem, context, xml ) { 3133 var oldCache, uniqueCache, outerCache, 3134 newCache = [ dirruns, doneName ]; 3135 3136 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 3137 if ( xml ) { 3138 while ( (elem = elem[ dir ]) ) { 3139 if ( elem.nodeType === 1 || checkNonElements ) { 3140 if ( matcher( elem, context, xml ) ) { 3141 return true; 3142 } 3143 } 3144 } 3145 } else { 3146 while ( (elem = elem[ dir ]) ) { 3147 if ( elem.nodeType === 1 || checkNonElements ) { 3148 outerCache = elem[ expando ] || (elem[ expando ] = {}); 3149 3150 // Support: IE <9 only 3151 // Defend against cloned attroperties (jQuery gh-1709) 3152 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); 3153 3154 if ( skip && skip === elem.nodeName.toLowerCase() ) { 3155 elem = elem[ dir ] || elem; 3156 } else if ( (oldCache = uniqueCache[ key ]) && 3157 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 3158 3159 // Assign to newCache so results back-propagate to previous elements 3160 return (newCache[ 2 ] = oldCache[ 2 ]); 3161 } else { 3162 // Reuse newcache so results back-propagate to previous elements 3163 uniqueCache[ key ] = newCache; 3164 3165 // A match means we're done; a fail means we have to keep checking 3166 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { 3167 return true; 3168 } 3169 } 3170 } 3171 } 3172 } 3173 return false; 3174 }; 3175} 3176 3177function elementMatcher( matchers ) { 3178 return matchers.length > 1 ? 3179 function( elem, context, xml ) { 3180 var i = matchers.length; 3181 while ( i-- ) { 3182 if ( !matchers[i]( elem, context, xml ) ) { 3183 return false; 3184 } 3185 } 3186 return true; 3187 } : 3188 matchers[0]; 3189} 3190 3191function multipleContexts( selector, contexts, results ) { 3192 var i = 0, 3193 len = contexts.length; 3194 for ( ; i < len; i++ ) { 3195 Sizzle( selector, contexts[i], results ); 3196 } 3197 return results; 3198} 3199 3200function condense( unmatched, map, filter, context, xml ) { 3201 var elem, 3202 newUnmatched = [], 3203 i = 0, 3204 len = unmatched.length, 3205 mapped = map != null; 3206 3207 for ( ; i < len; i++ ) { 3208 if ( (elem = unmatched[i]) ) { 3209 if ( !filter || filter( elem, context, xml ) ) { 3210 newUnmatched.push( elem ); 3211 if ( mapped ) { 3212 map.push( i ); 3213 } 3214 } 3215 } 3216 } 3217 3218 return newUnmatched; 3219} 3220 3221function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 3222 if ( postFilter && !postFilter[ expando ] ) { 3223 postFilter = setMatcher( postFilter ); 3224 } 3225 if ( postFinder && !postFinder[ expando ] ) { 3226 postFinder = setMatcher( postFinder, postSelector ); 3227 } 3228 return markFunction(function( seed, results, context, xml ) { 3229 var temp, i, elem, 3230 preMap = [], 3231 postMap = [], 3232 preexisting = results.length, 3233 3234 // Get initial elements from seed or context 3235 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), 3236 3237 // Prefilter to get matcher input, preserving a map for seed-results synchronization 3238 matcherIn = preFilter && ( seed || !selector ) ? 3239 condense( elems, preMap, preFilter, context, xml ) : 3240 elems, 3241 3242 matcherOut = matcher ? 3243 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 3244 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 3245 3246 // ...intermediate processing is necessary 3247 [] : 3248 3249 // ...otherwise use results directly 3250 results : 3251 matcherIn; 3252 3253 // Find primary matches 3254 if ( matcher ) { 3255 matcher( matcherIn, matcherOut, context, xml ); 3256 } 3257 3258 // Apply postFilter 3259 if ( postFilter ) { 3260 temp = condense( matcherOut, postMap ); 3261 postFilter( temp, [], context, xml ); 3262 3263 // Un-match failing elements by moving them back to matcherIn 3264 i = temp.length; 3265 while ( i-- ) { 3266 if ( (elem = temp[i]) ) { 3267 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); 3268 } 3269 } 3270 } 3271 3272 if ( seed ) { 3273 if ( postFinder || preFilter ) { 3274 if ( postFinder ) { 3275 // Get the final matcherOut by condensing this intermediate into postFinder contexts 3276 temp = []; 3277 i = matcherOut.length; 3278 while ( i-- ) { 3279 if ( (elem = matcherOut[i]) ) { 3280 // Restore matcherIn since elem is not yet a final match 3281 temp.push( (matcherIn[i] = elem) ); 3282 } 3283 } 3284 postFinder( null, (matcherOut = []), temp, xml ); 3285 } 3286 3287 // Move matched elements from seed to results to keep them synchronized 3288 i = matcherOut.length; 3289 while ( i-- ) { 3290 if ( (elem = matcherOut[i]) && 3291 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { 3292 3293 seed[temp] = !(results[temp] = elem); 3294 } 3295 } 3296 } 3297 3298 // Add elements to results, through postFinder if defined 3299 } else { 3300 matcherOut = condense( 3301 matcherOut === results ? 3302 matcherOut.splice( preexisting, matcherOut.length ) : 3303 matcherOut 3304 ); 3305 if ( postFinder ) { 3306 postFinder( null, results, matcherOut, xml ); 3307 } else { 3308 push.apply( results, matcherOut ); 3309 } 3310 } 3311 }); 3312} 3313 3314function matcherFromTokens( tokens ) { 3315 var checkContext, matcher, j, 3316 len = tokens.length, 3317 leadingRelative = Expr.relative[ tokens[0].type ], 3318 implicitRelative = leadingRelative || Expr.relative[" "], 3319 i = leadingRelative ? 1 : 0, 3320 3321 // The foundational matcher ensures that elements are reachable from top-level context(s) 3322 matchContext = addCombinator( function( elem ) { 3323 return elem === checkContext; 3324 }, implicitRelative, true ), 3325 matchAnyContext = addCombinator( function( elem ) { 3326 return indexOf( checkContext, elem ) > -1; 3327 }, implicitRelative, true ), 3328 matchers = [ function( elem, context, xml ) { 3329 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 3330 (checkContext = context).nodeType ? 3331 matchContext( elem, context, xml ) : 3332 matchAnyContext( elem, context, xml ) ); 3333 // Avoid hanging onto element (issue #299) 3334 checkContext = null; 3335 return ret; 3336 } ]; 3337 3338 for ( ; i < len; i++ ) { 3339 if ( (matcher = Expr.relative[ tokens[i].type ]) ) { 3340 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; 3341 } else { 3342 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); 3343 3344 // Return special upon seeing a positional matcher 3345 if ( matcher[ expando ] ) { 3346 // Find the next relative operator (if any) for proper handling 3347 j = ++i; 3348 for ( ; j < len; j++ ) { 3349 if ( Expr.relative[ tokens[j].type ] ) { 3350 break; 3351 } 3352 } 3353 return setMatcher( 3354 i > 1 && elementMatcher( matchers ), 3355 i > 1 && toSelector( 3356 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 3357 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) 3358 ).replace( rtrim, "$1" ), 3359 matcher, 3360 i < j && matcherFromTokens( tokens.slice( i, j ) ), 3361 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), 3362 j < len && toSelector( tokens ) 3363 ); 3364 } 3365 matchers.push( matcher ); 3366 } 3367 } 3368 3369 return elementMatcher( matchers ); 3370} 3371 3372function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 3373 var bySet = setMatchers.length > 0, 3374 byElement = elementMatchers.length > 0, 3375 superMatcher = function( seed, context, xml, results, outermost ) { 3376 var elem, j, matcher, 3377 matchedCount = 0, 3378 i = "0", 3379 unmatched = seed && [], 3380 setMatched = [], 3381 contextBackup = outermostContext, 3382 // We must always have either seed elements or outermost context 3383 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), 3384 // Use integer dirruns iff this is the outermost matcher 3385 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), 3386 len = elems.length; 3387 3388 if ( outermost ) { 3389 outermostContext = context === document || context || outermost; 3390 } 3391 3392 // Add elements passing elementMatchers directly to results 3393 // Support: IE<9, Safari 3394 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 3395 for ( ; i !== len && (elem = elems[i]) != null; i++ ) { 3396 if ( byElement && elem ) { 3397 j = 0; 3398 if ( !context && elem.ownerDocument !== document ) { 3399 setDocument( elem ); 3400 xml = !documentIsHTML; 3401 } 3402 while ( (matcher = elementMatchers[j++]) ) { 3403 if ( matcher( elem, context || document, xml) ) { 3404 results.push( elem ); 3405 break; 3406 } 3407 } 3408 if ( outermost ) { 3409 dirruns = dirrunsUnique; 3410 } 3411 } 3412 3413 // Track unmatched elements for set filters 3414 if ( bySet ) { 3415 // They will have gone through all possible matchers 3416 if ( (elem = !matcher && elem) ) { 3417 matchedCount--; 3418 } 3419 3420 // Lengthen the array for every element, matched or not 3421 if ( seed ) { 3422 unmatched.push( elem ); 3423 } 3424 } 3425 } 3426 3427 // `i` is now the count of elements visited above, and adding it to `matchedCount` 3428 // makes the latter nonnegative. 3429 matchedCount += i; 3430 3431 // Apply set filters to unmatched elements 3432 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 3433 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 3434 // no element matchers and no seed. 3435 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 3436 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 3437 // numerically zero. 3438 if ( bySet && i !== matchedCount ) { 3439 j = 0; 3440 while ( (matcher = setMatchers[j++]) ) { 3441 matcher( unmatched, setMatched, context, xml ); 3442 } 3443 3444 if ( seed ) { 3445 // Reintegrate element matches to eliminate the need for sorting 3446 if ( matchedCount > 0 ) { 3447 while ( i-- ) { 3448 if ( !(unmatched[i] || setMatched[i]) ) { 3449 setMatched[i] = pop.call( results ); 3450 } 3451 } 3452 } 3453 3454 // Discard index placeholder values to get only actual matches 3455 setMatched = condense( setMatched ); 3456 } 3457 3458 // Add matches to results 3459 push.apply( results, setMatched ); 3460 3461 // Seedless set matches succeeding multiple successful matchers stipulate sorting 3462 if ( outermost && !seed && setMatched.length > 0 && 3463 ( matchedCount + setMatchers.length ) > 1 ) { 3464 3465 Sizzle.uniqueSort( results ); 3466 } 3467 } 3468 3469 // Override manipulation of globals by nested matchers 3470 if ( outermost ) { 3471 dirruns = dirrunsUnique; 3472 outermostContext = contextBackup; 3473 } 3474 3475 return unmatched; 3476 }; 3477 3478 return bySet ? 3479 markFunction( superMatcher ) : 3480 superMatcher; 3481} 3482 3483compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 3484 var i, 3485 setMatchers = [], 3486 elementMatchers = [], 3487 cached = compilerCache[ selector + " " ]; 3488 3489 if ( !cached ) { 3490 // Generate a function of recursive functions that can be used to check each element 3491 if ( !match ) { 3492 match = tokenize( selector ); 3493 } 3494 i = match.length; 3495 while ( i-- ) { 3496 cached = matcherFromTokens( match[i] ); 3497 if ( cached[ expando ] ) { 3498 setMatchers.push( cached ); 3499 } else { 3500 elementMatchers.push( cached ); 3501 } 3502 } 3503 3504 // Cache the compiled function 3505 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 3506 3507 // Save selector and tokenization 3508 cached.selector = selector; 3509 } 3510 return cached; 3511}; 3512 3513/** 3514 * A low-level selection function that works with Sizzle's compiled 3515 * selector functions 3516 * @param {String|Function} selector A selector or a pre-compiled 3517 * selector function built with Sizzle.compile 3518 * @param {Element} context 3519 * @param {Array} [results] 3520 * @param {Array} [seed] A set of elements to match against 3521 */ 3522select = Sizzle.select = function( selector, context, results, seed ) { 3523 var i, tokens, token, type, find, 3524 compiled = typeof selector === "function" && selector, 3525 match = !seed && tokenize( (selector = compiled.selector || selector) ); 3526 3527 results = results || []; 3528 3529 // Try to minimize operations if there is only one selector in the list and no seed 3530 // (the latter of which guarantees us context) 3531 if ( match.length === 1 ) { 3532 3533 // Reduce context if the leading compound selector is an ID 3534 tokens = match[0] = match[0].slice( 0 ); 3535 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && 3536 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { 3537 3538 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; 3539 if ( !context ) { 3540 return results; 3541 3542 // Precompiled matchers will still verify ancestry, so step up a level 3543 } else if ( compiled ) { 3544 context = context.parentNode; 3545 } 3546 3547 selector = selector.slice( tokens.shift().value.length ); 3548 } 3549 3550 // Fetch a seed set for right-to-left matching 3551 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; 3552 while ( i-- ) { 3553 token = tokens[i]; 3554 3555 // Abort if we hit a combinator 3556 if ( Expr.relative[ (type = token.type) ] ) { 3557 break; 3558 } 3559 if ( (find = Expr.find[ type ]) ) { 3560 // Search, expanding context for leading sibling combinators 3561 if ( (seed = find( 3562 token.matches[0].replace( runescape, funescape ), 3563 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context 3564 )) ) { 3565 3566 // If seed is empty or no tokens remain, we can return early 3567 tokens.splice( i, 1 ); 3568 selector = seed.length && toSelector( tokens ); 3569 if ( !selector ) { 3570 push.apply( results, seed ); 3571 return results; 3572 } 3573 3574 break; 3575 } 3576 } 3577 } 3578 } 3579 3580 // Compile and execute a filtering function if one is not provided 3581 // Provide `match` to avoid retokenization if we modified the selector above 3582 ( compiled || compile( selector, match ) )( 3583 seed, 3584 context, 3585 !documentIsHTML, 3586 results, 3587 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 3588 ); 3589 return results; 3590}; 3591 3592// One-time assignments 3593 3594// Sort stability 3595support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; 3596 3597// Support: Chrome 14-35+ 3598// Always assume duplicates if they aren't passed to the comparison function 3599support.detectDuplicates = !!hasDuplicate; 3600 3601// Initialize against the default document 3602setDocument(); 3603 3604// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 3605// Detached nodes confoundingly follow *each other* 3606support.sortDetached = assert(function( el ) { 3607 // Should return 1, but returns 4 (following) 3608 return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; 3609}); 3610 3611// Support: IE<8 3612// Prevent attribute/property "interpolation" 3613// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 3614if ( !assert(function( el ) { 3615 el.innerHTML = "<a href='#'></a>"; 3616 return el.firstChild.getAttribute("href") === "#" ; 3617}) ) { 3618 addHandle( "type|href|height|width", function( elem, name, isXML ) { 3619 if ( !isXML ) { 3620 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 3621 } 3622 }); 3623} 3624 3625// Support: IE<9 3626// Use defaultValue in place of getAttribute("value") 3627if ( !support.attributes || !assert(function( el ) { 3628 el.innerHTML = "<input/>"; 3629 el.firstChild.setAttribute( "value", "" ); 3630 return el.firstChild.getAttribute( "value" ) === ""; 3631}) ) { 3632 addHandle( "value", function( elem, name, isXML ) { 3633 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 3634 return elem.defaultValue; 3635 } 3636 }); 3637} 3638 3639// Support: IE<9 3640// Use getAttributeNode to fetch booleans when getAttribute lies 3641if ( !assert(function( el ) { 3642 return el.getAttribute("disabled") == null; 3643}) ) { 3644 addHandle( booleans, function( elem, name, isXML ) { 3645 var val; 3646 if ( !isXML ) { 3647 return elem[ name ] === true ? name.toLowerCase() : 3648 (val = elem.getAttributeNode( name )) && val.specified ? 3649 val.value : 3650 null; 3651 } 3652 }); 3653} 3654 3655return Sizzle; 3656 3657})( window ); 3658 3659 3660 3661jQuery.find = Sizzle; 3662jQuery.expr = Sizzle.selectors; 3663 3664// Deprecated 3665jQuery.expr[ ":" ] = jQuery.expr.pseudos; 3666jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 3667jQuery.text = Sizzle.getText; 3668jQuery.isXMLDoc = Sizzle.isXML; 3669jQuery.contains = Sizzle.contains; 3670jQuery.escapeSelector = Sizzle.escape; 3671 3672 3673 3674 3675var dir = function( elem, dir, until ) { 3676 var matched = [], 3677 truncate = until !== undefined; 3678 3679 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 3680 if ( elem.nodeType === 1 ) { 3681 if ( truncate && jQuery( elem ).is( until ) ) { 3682 break; 3683 } 3684 matched.push( elem ); 3685 } 3686 } 3687 return matched; 3688}; 3689 3690 3691var siblings = function( n, elem ) { 3692 var matched = []; 3693 3694 for ( ; n; n = n.nextSibling ) { 3695 if ( n.nodeType === 1 && n !== elem ) { 3696 matched.push( n ); 3697 } 3698 } 3699 3700 return matched; 3701}; 3702 3703 3704var rneedsContext = jQuery.expr.match.needsContext; 3705 3706 3707 3708function nodeName( elem, name ) { 3709 3710 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 3711 3712}; 3713var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 3714 3715 3716 3717// Implement the identical functionality for filter and not 3718function winnow( elements, qualifier, not ) { 3719 if ( isFunction( qualifier ) ) { 3720 return jQuery.grep( elements, function( elem, i ) { 3721 return !!qualifier.call( elem, i, elem ) !== not; 3722 } ); 3723 } 3724 3725 // Single element 3726 if ( qualifier.nodeType ) { 3727 return jQuery.grep( elements, function( elem ) { 3728 return ( elem === qualifier ) !== not; 3729 } ); 3730 } 3731 3732 // Arraylike of elements (jQuery, arguments, Array) 3733 if ( typeof qualifier !== "string" ) { 3734 return jQuery.grep( elements, function( elem ) { 3735 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 3736 } ); 3737 } 3738 3739 // Filtered directly for both simple and complex selectors 3740 return jQuery.filter( qualifier, elements, not ); 3741} 3742 3743jQuery.filter = function( expr, elems, not ) { 3744 var elem = elems[ 0 ]; 3745 3746 if ( not ) { 3747 expr = ":not(" + expr + ")"; 3748 } 3749 3750 if ( elems.length === 1 && elem.nodeType === 1 ) { 3751 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 3752 } 3753 3754 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 3755 return elem.nodeType === 1; 3756 } ) ); 3757}; 3758 3759jQuery.fn.extend( { 3760 find: function( selector ) { 3761 var i, ret, 3762 len = this.length, 3763 self = this; 3764 3765 if ( typeof selector !== "string" ) { 3766 return this.pushStack( jQuery( selector ).filter( function() { 3767 for ( i = 0; i < len; i++ ) { 3768 if ( jQuery.contains( self[ i ], this ) ) { 3769 return true; 3770 } 3771 } 3772 } ) ); 3773 } 3774 3775 ret = this.pushStack( [] ); 3776 3777 for ( i = 0; i < len; i++ ) { 3778 jQuery.find( selector, self[ i ], ret ); 3779 } 3780 3781 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 3782 }, 3783 filter: function( selector ) { 3784 return this.pushStack( winnow( this, selector || [], false ) ); 3785 }, 3786 not: function( selector ) { 3787 return this.pushStack( winnow( this, selector || [], true ) ); 3788 }, 3789 is: function( selector ) { 3790 return !!winnow( 3791 this, 3792 3793 // If this is a positional/relative selector, check membership in the returned set 3794 // so $("p:first").is("p:last") won't return true for a doc with two "p". 3795 typeof selector === "string" && rneedsContext.test( selector ) ? 3796 jQuery( selector ) : 3797 selector || [], 3798 false 3799 ).length; 3800 } 3801} ); 3802 3803 3804// Initialize a jQuery object 3805 3806 3807// A central reference to the root jQuery(document) 3808var rootjQuery, 3809 3810 // A simple way to check for HTML strings 3811 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 3812 // Strict HTML recognition (#11290: must start with <) 3813 // Shortcut simple #id case for speed 3814 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 3815 3816 init = jQuery.fn.init = function( selector, context, root ) { 3817 var match, elem; 3818 3819 // HANDLE: $(""), $(null), $(undefined), $(false) 3820 if ( !selector ) { 3821 return this; 3822 } 3823 3824 // Method init() accepts an alternate rootjQuery 3825 // so migrate can support jQuery.sub (gh-2101) 3826 root = root || rootjQuery; 3827 3828 // Handle HTML strings 3829 if ( typeof selector === "string" ) { 3830 if ( selector[ 0 ] === "<" && 3831 selector[ selector.length - 1 ] === ">" && 3832 selector.length >= 3 ) { 3833 3834 // Assume that strings that start and end with <> are HTML and skip the regex check 3835 match = [ null, selector, null ]; 3836 3837 } else { 3838 match = rquickExpr.exec( selector ); 3839 } 3840 3841 // Match html or make sure no context is specified for #id 3842 if ( match && ( match[ 1 ] || !context ) ) { 3843 3844 // HANDLE: $(html) -> $(array) 3845 if ( match[ 1 ] ) { 3846 context = context instanceof jQuery ? context[ 0 ] : context; 3847 3848 // Option to run scripts is true for back-compat 3849 // Intentionally let the error be thrown if parseHTML is not present 3850 jQuery.merge( this, jQuery.parseHTML( 3851 match[ 1 ], 3852 context && context.nodeType ? context.ownerDocument || context : document, 3853 true 3854 ) ); 3855 3856 // HANDLE: $(html, props) 3857 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 3858 for ( match in context ) { 3859 3860 // Properties of context are called as methods if possible 3861 if ( isFunction( this[ match ] ) ) { 3862 this[ match ]( context[ match ] ); 3863 3864 // ...and otherwise set as attributes 3865 } else { 3866 this.attr( match, context[ match ] ); 3867 } 3868 } 3869 } 3870 3871 return this; 3872 3873 // HANDLE: $(#id) 3874 } else { 3875 elem = document.getElementById( match[ 2 ] ); 3876 3877 if ( elem ) { 3878 3879 // Inject the element directly into the jQuery object 3880 this[ 0 ] = elem; 3881 this.length = 1; 3882 } 3883 return this; 3884 } 3885 3886 // HANDLE: $(expr, $(...)) 3887 } else if ( !context || context.jquery ) { 3888 return ( context || root ).find( selector ); 3889 3890 // HANDLE: $(expr, context) 3891 // (which is just equivalent to: $(context).find(expr) 3892 } else { 3893 return this.constructor( context ).find( selector ); 3894 } 3895 3896 // HANDLE: $(DOMElement) 3897 } else if ( selector.nodeType ) { 3898 this[ 0 ] = selector; 3899 this.length = 1; 3900 return this; 3901 3902 // HANDLE: $(function) 3903 // Shortcut for document ready 3904 } else if ( isFunction( selector ) ) { 3905 return root.ready !== undefined ? 3906 root.ready( selector ) : 3907 3908 // Execute immediately if ready is not present 3909 selector( jQuery ); 3910 } 3911 3912 return jQuery.makeArray( selector, this ); 3913 }; 3914 3915// Give the init function the jQuery prototype for later instantiation 3916init.prototype = jQuery.fn; 3917 3918// Initialize central reference 3919rootjQuery = jQuery( document ); 3920 3921 3922var rparentsprev = /^(?:parents|prev(?:Until|All))/, 3923 3924 // Methods guaranteed to produce a unique set when starting from a unique set 3925 guaranteedUnique = { 3926 children: true, 3927 contents: true, 3928 next: true, 3929 prev: true 3930 }; 3931 3932jQuery.fn.extend( { 3933 has: function( target ) { 3934 var targets = jQuery( target, this ), 3935 l = targets.length; 3936 3937 return this.filter( function() { 3938 var i = 0; 3939 for ( ; i < l; i++ ) { 3940 if ( jQuery.contains( this, targets[ i ] ) ) { 3941 return true; 3942 } 3943 } 3944 } ); 3945 }, 3946 3947 closest: function( selectors, context ) { 3948 var cur, 3949 i = 0, 3950 l = this.length, 3951 matched = [], 3952 targets = typeof selectors !== "string" && jQuery( selectors ); 3953 3954 // Positional selectors never match, since there's no _selection_ context 3955 if ( !rneedsContext.test( selectors ) ) { 3956 for ( ; i < l; i++ ) { 3957 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 3958 3959 // Always skip document fragments 3960 if ( cur.nodeType < 11 && ( targets ? 3961 targets.index( cur ) > -1 : 3962 3963 // Don't pass non-elements to Sizzle 3964 cur.nodeType === 1 && 3965 jQuery.find.matchesSelector( cur, selectors ) ) ) { 3966 3967 matched.push( cur ); 3968 break; 3969 } 3970 } 3971 } 3972 } 3973 3974 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 3975 }, 3976 3977 // Determine the position of an element within the set 3978 index: function( elem ) { 3979 3980 // No argument, return index in parent 3981 if ( !elem ) { 3982 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 3983 } 3984 3985 // Index in selector 3986 if ( typeof elem === "string" ) { 3987 return indexOf.call( jQuery( elem ), this[ 0 ] ); 3988 } 3989 3990 // Locate the position of the desired element 3991 return indexOf.call( this, 3992 3993 // If it receives a jQuery object, the first element is used 3994 elem.jquery ? elem[ 0 ] : elem 3995 ); 3996 }, 3997 3998 add: function( selector, context ) { 3999 return this.pushStack( 4000 jQuery.uniqueSort( 4001 jQuery.merge( this.get(), jQuery( selector, context ) ) 4002 ) 4003 ); 4004 }, 4005 4006 addBack: function( selector ) { 4007 return this.add( selector == null ? 4008 this.prevObject : this.prevObject.filter( selector ) 4009 ); 4010 } 4011} ); 4012 4013function sibling( cur, dir ) { 4014 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 4015 return cur; 4016} 4017 4018jQuery.each( { 4019 parent: function( elem ) { 4020 var parent = elem.parentNode; 4021 return parent && parent.nodeType !== 11 ? parent : null; 4022 }, 4023 parents: function( elem ) { 4024 return dir( elem, "parentNode" ); 4025 }, 4026 parentsUntil: function( elem, i, until ) { 4027 return dir( elem, "parentNode", until ); 4028 }, 4029 next: function( elem ) { 4030 return sibling( elem, "nextSibling" ); 4031 }, 4032 prev: function( elem ) { 4033 return sibling( elem, "previousSibling" ); 4034 }, 4035 nextAll: function( elem ) { 4036 return dir( elem, "nextSibling" ); 4037 }, 4038 prevAll: function( elem ) { 4039 return dir( elem, "previousSibling" ); 4040 }, 4041 nextUntil: function( elem, i, until ) { 4042 return dir( elem, "nextSibling", until ); 4043 }, 4044 prevUntil: function( elem, i, until ) { 4045 return dir( elem, "previousSibling", until ); 4046 }, 4047 siblings: function( elem ) { 4048 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 4049 }, 4050 children: function( elem ) { 4051 return siblings( elem.firstChild ); 4052 }, 4053 contents: function( elem ) { 4054 if ( typeof elem.contentDocument !== "undefined" ) { 4055 return elem.contentDocument; 4056 } 4057 4058 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 4059 // Treat the template element as a regular one in browsers that 4060 // don't support it. 4061 if ( nodeName( elem, "template" ) ) { 4062 elem = elem.content || elem; 4063 } 4064 4065 return jQuery.merge( [], elem.childNodes ); 4066 } 4067}, function( name, fn ) { 4068 jQuery.fn[ name ] = function( until, selector ) { 4069 var matched = jQuery.map( this, fn, until ); 4070 4071 if ( name.slice( -5 ) !== "Until" ) { 4072 selector = until; 4073 } 4074 4075 if ( selector && typeof selector === "string" ) { 4076 matched = jQuery.filter( selector, matched ); 4077 } 4078 4079 if ( this.length > 1 ) { 4080 4081 // Remove duplicates 4082 if ( !guaranteedUnique[ name ] ) { 4083 jQuery.uniqueSort( matched ); 4084 } 4085 4086 // Reverse order for parents* and prev-derivatives 4087 if ( rparentsprev.test( name ) ) { 4088 matched.reverse(); 4089 } 4090 } 4091 4092 return this.pushStack( matched ); 4093 }; 4094} ); 4095var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 4096 4097 4098 4099// Convert String-formatted options into Object-formatted ones 4100function createOptions( options ) { 4101 var object = {}; 4102 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 4103 object[ flag ] = true; 4104 } ); 4105 return object; 4106} 4107 4108/* 4109 * Create a callback list using the following parameters: 4110 * 4111 * options: an optional list of space-separated options that will change how 4112 * the callback list behaves or a more traditional option object 4113 * 4114 * By default a callback list will act like an event callback list and can be 4115 * "fired" multiple times. 4116 * 4117 * Possible options: 4118 * 4119 * once: will ensure the callback list can only be fired once (like a Deferred) 4120 * 4121 * memory: will keep track of previous values and will call any callback added 4122 * after the list has been fired right away with the latest "memorized" 4123 * values (like a Deferred) 4124 * 4125 * unique: will ensure a callback can only be added once (no duplicate in the list) 4126 * 4127 * stopOnFalse: interrupt callings when a callback returns false 4128 * 4129 */ 4130jQuery.Callbacks = function( options ) { 4131 4132 // Convert options from String-formatted to Object-formatted if needed 4133 // (we check in cache first) 4134 options = typeof options === "string" ? 4135 createOptions( options ) : 4136 jQuery.extend( {}, options ); 4137 4138 var // Flag to know if list is currently firing 4139 firing, 4140 4141 // Last fire value for non-forgettable lists 4142 memory, 4143 4144 // Flag to know if list was already fired 4145 fired, 4146 4147 // Flag to prevent firing 4148 locked, 4149 4150 // Actual callback list 4151 list = [], 4152 4153 // Queue of execution data for repeatable lists 4154 queue = [], 4155 4156 // Index of currently firing callback (modified by add/remove as needed) 4157 firingIndex = -1, 4158 4159 // Fire callbacks 4160 fire = function() { 4161 4162 // Enforce single-firing 4163 locked = locked || options.once; 4164 4165 // Execute callbacks for all pending executions, 4166 // respecting firingIndex overrides and runtime changes 4167 fired = firing = true; 4168 for ( ; queue.length; firingIndex = -1 ) { 4169 memory = queue.shift(); 4170 while ( ++firingIndex < list.length ) { 4171 4172 // Run callback and check for early termination 4173 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 4174 options.stopOnFalse ) { 4175 4176 // Jump to end and forget the data so .add doesn't re-fire 4177 firingIndex = list.length; 4178 memory = false; 4179 } 4180 } 4181 } 4182 4183 // Forget the data if we're done with it 4184 if ( !options.memory ) { 4185 memory = false; 4186 } 4187 4188 firing = false; 4189 4190 // Clean up if we're done firing for good 4191 if ( locked ) { 4192 4193 // Keep an empty list if we have data for future add calls 4194 if ( memory ) { 4195 list = []; 4196 4197 // Otherwise, this object is spent 4198 } else { 4199 list = ""; 4200 } 4201 } 4202 }, 4203 4204 // Actual Callbacks object 4205 self = { 4206 4207 // Add a callback or a collection of callbacks to the list 4208 add: function() { 4209 if ( list ) { 4210 4211 // If we have memory from a past run, we should fire after adding 4212 if ( memory && !firing ) { 4213 firingIndex = list.length - 1; 4214 queue.push( memory ); 4215 } 4216 4217 ( function add( args ) { 4218 jQuery.each( args, function( _, arg ) { 4219 if ( isFunction( arg ) ) { 4220 if ( !options.unique || !self.has( arg ) ) { 4221 list.push( arg ); 4222 } 4223 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 4224 4225 // Inspect recursively 4226 add( arg ); 4227 } 4228 } ); 4229 } )( arguments ); 4230 4231 if ( memory && !firing ) { 4232 fire(); 4233 } 4234 } 4235 return this; 4236 }, 4237 4238 // Remove a callback from the list 4239 remove: function() { 4240 jQuery.each( arguments, function( _, arg ) { 4241 var index; 4242 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 4243 list.splice( index, 1 ); 4244 4245 // Handle firing indexes 4246 if ( index <= firingIndex ) { 4247 firingIndex--; 4248 } 4249 } 4250 } ); 4251 return this; 4252 }, 4253 4254 // Check if a given callback is in the list. 4255 // If no argument is given, return whether or not list has callbacks attached. 4256 has: function( fn ) { 4257 return fn ? 4258 jQuery.inArray( fn, list ) > -1 : 4259 list.length > 0; 4260 }, 4261 4262 // Remove all callbacks from the list 4263 empty: function() { 4264 if ( list ) { 4265 list = []; 4266 } 4267 return this; 4268 }, 4269 4270 // Disable .fire and .add 4271 // Abort any current/pending executions 4272 // Clear all callbacks and values 4273 disable: function() { 4274 locked = queue = []; 4275 list = memory = ""; 4276 return this; 4277 }, 4278 disabled: function() { 4279 return !list; 4280 }, 4281 4282 // Disable .fire 4283 // Also disable .add unless we have memory (since it would have no effect) 4284 // Abort any pending executions 4285 lock: function() { 4286 locked = queue = []; 4287 if ( !memory && !firing ) { 4288 list = memory = ""; 4289 } 4290 return this; 4291 }, 4292 locked: function() { 4293 return !!locked; 4294 }, 4295 4296 // Call all callbacks with the given context and arguments 4297 fireWith: function( context, args ) { 4298 if ( !locked ) { 4299 args = args || []; 4300 args = [ context, args.slice ? args.slice() : args ]; 4301 queue.push( args ); 4302 if ( !firing ) { 4303 fire(); 4304 } 4305 } 4306 return this; 4307 }, 4308 4309 // Call all the callbacks with the given arguments 4310 fire: function() { 4311 self.fireWith( this, arguments ); 4312 return this; 4313 }, 4314 4315 // To know if the callbacks have already been called at least once 4316 fired: function() { 4317 return !!fired; 4318 } 4319 }; 4320 4321 return self; 4322}; 4323 4324 4325function Identity( v ) { 4326 return v; 4327} 4328function Thrower( ex ) { 4329 throw ex; 4330} 4331 4332function adoptValue( value, resolve, reject, noValue ) { 4333 var method; 4334 4335 try { 4336 4337 // Check for promise aspect first to privilege synchronous behavior 4338 if ( value && isFunction( ( method = value.promise ) ) ) { 4339 method.call( value ).done( resolve ).fail( reject ); 4340 4341 // Other thenables 4342 } else if ( value && isFunction( ( method = value.then ) ) ) { 4343 method.call( value, resolve, reject ); 4344 4345 // Other non-thenables 4346 } else { 4347 4348 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 4349 // * false: [ value ].slice( 0 ) => resolve( value ) 4350 // * true: [ value ].slice( 1 ) => resolve() 4351 resolve.apply( undefined, [ value ].slice( noValue ) ); 4352 } 4353 4354 // For Promises/A+, convert exceptions into rejections 4355 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 4356 // Deferred#then to conditionally suppress rejection. 4357 } catch ( value ) { 4358 4359 // Support: Android 4.0 only 4360 // Strict mode functions invoked without .call/.apply get global-object context 4361 reject.apply( undefined, [ value ] ); 4362 } 4363} 4364 4365jQuery.extend( { 4366 4367 Deferred: function( func ) { 4368 var tuples = [ 4369 4370 // action, add listener, callbacks, 4371 // ... .then handlers, argument index, [final state] 4372 [ "notify", "progress", jQuery.Callbacks( "memory" ), 4373 jQuery.Callbacks( "memory" ), 2 ], 4374 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 4375 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 4376 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 4377 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 4378 ], 4379 state = "pending", 4380 promise = { 4381 state: function() { 4382 return state; 4383 }, 4384 always: function() { 4385 deferred.done( arguments ).fail( arguments ); 4386 return this; 4387 }, 4388 "catch": function( fn ) { 4389 return promise.then( null, fn ); 4390 }, 4391 4392 // Keep pipe for back-compat 4393 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 4394 var fns = arguments; 4395 4396 return jQuery.Deferred( function( newDefer ) { 4397 jQuery.each( tuples, function( i, tuple ) { 4398 4399 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 4400 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 4401 4402 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 4403 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 4404 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 4405 deferred[ tuple[ 1 ] ]( function() { 4406 var returned = fn && fn.apply( this, arguments ); 4407 if ( returned && isFunction( returned.promise ) ) { 4408 returned.promise() 4409 .progress( newDefer.notify ) 4410 .done( newDefer.resolve ) 4411 .fail( newDefer.reject ); 4412 } else { 4413 newDefer[ tuple[ 0 ] + "With" ]( 4414 this, 4415 fn ? [ returned ] : arguments 4416 ); 4417 } 4418 } ); 4419 } ); 4420 fns = null; 4421 } ).promise(); 4422 }, 4423 then: function( onFulfilled, onRejected, onProgress ) { 4424 var maxDepth = 0; 4425 function resolve( depth, deferred, handler, special ) { 4426 return function() { 4427 var that = this, 4428 args = arguments, 4429 mightThrow = function() { 4430 var returned, then; 4431 4432 // Support: Promises/A+ section 2.3.3.3.3 4433 // https://promisesaplus.com/#point-59 4434 // Ignore double-resolution attempts 4435 if ( depth < maxDepth ) { 4436 return; 4437 } 4438 4439 returned = handler.apply( that, args ); 4440 4441 // Support: Promises/A+ section 2.3.1 4442 // https://promisesaplus.com/#point-48 4443 if ( returned === deferred.promise() ) { 4444 throw new TypeError( "Thenable self-resolution" ); 4445 } 4446 4447 // Support: Promises/A+ sections 2.3.3.1, 3.5 4448 // https://promisesaplus.com/#point-54 4449 // https://promisesaplus.com/#point-75 4450 // Retrieve `then` only once 4451 then = returned && 4452 4453 // Support: Promises/A+ section 2.3.4 4454 // https://promisesaplus.com/#point-64 4455 // Only check objects and functions for thenability 4456 ( typeof returned === "object" || 4457 typeof returned === "function" ) && 4458 returned.then; 4459 4460 // Handle a returned thenable 4461 if ( isFunction( then ) ) { 4462 4463 // Special processors (notify) just wait for resolution 4464 if ( special ) { 4465 then.call( 4466 returned, 4467 resolve( maxDepth, deferred, Identity, special ), 4468 resolve( maxDepth, deferred, Thrower, special ) 4469 ); 4470 4471 // Normal processors (resolve) also hook into progress 4472 } else { 4473 4474 // ...and disregard older resolution values 4475 maxDepth++; 4476 4477 then.call( 4478 returned, 4479 resolve( maxDepth, deferred, Identity, special ), 4480 resolve( maxDepth, deferred, Thrower, special ), 4481 resolve( maxDepth, deferred, Identity, 4482 deferred.notifyWith ) 4483 ); 4484 } 4485 4486 // Handle all other returned values 4487 } else { 4488 4489 // Only substitute handlers pass on context 4490 // and multiple values (non-spec behavior) 4491 if ( handler !== Identity ) { 4492 that = undefined; 4493 args = [ returned ]; 4494 } 4495 4496 // Process the value(s) 4497 // Default process is resolve 4498 ( special || deferred.resolveWith )( that, args ); 4499 } 4500 }, 4501 4502 // Only normal processors (resolve) catch and reject exceptions 4503 process = special ? 4504 mightThrow : 4505 function() { 4506 try { 4507 mightThrow(); 4508 } catch ( e ) { 4509 4510 if ( jQuery.Deferred.exceptionHook ) { 4511 jQuery.Deferred.exceptionHook( e, 4512 process.stackTrace ); 4513 } 4514 4515 // Support: Promises/A+ section 2.3.3.3.4.1 4516 // https://promisesaplus.com/#point-61 4517 // Ignore post-resolution exceptions 4518 if ( depth + 1 >= maxDepth ) { 4519 4520 // Only substitute handlers pass on context 4521 // and multiple values (non-spec behavior) 4522 if ( handler !== Thrower ) { 4523 that = undefined; 4524 args = [ e ]; 4525 } 4526 4527 deferred.rejectWith( that, args ); 4528 } 4529 } 4530 }; 4531 4532 // Support: Promises/A+ section 2.3.3.3.1 4533 // https://promisesaplus.com/#point-57 4534 // Re-resolve promises immediately to dodge false rejection from 4535 // subsequent errors 4536 if ( depth ) { 4537 process(); 4538 } else { 4539 4540 // Call an optional hook to record the stack, in case of exception 4541 // since it's otherwise lost when execution goes async 4542 if ( jQuery.Deferred.getStackHook ) { 4543 process.stackTrace = jQuery.Deferred.getStackHook(); 4544 } 4545 window.setTimeout( process ); 4546 } 4547 }; 4548 } 4549 4550 return jQuery.Deferred( function( newDefer ) { 4551 4552 // progress_handlers.add( ... ) 4553 tuples[ 0 ][ 3 ].add( 4554 resolve( 4555 0, 4556 newDefer, 4557 isFunction( onProgress ) ? 4558 onProgress : 4559 Identity, 4560 newDefer.notifyWith 4561 ) 4562 ); 4563 4564 // fulfilled_handlers.add( ... ) 4565 tuples[ 1 ][ 3 ].add( 4566 resolve( 4567 0, 4568 newDefer, 4569 isFunction( onFulfilled ) ? 4570 onFulfilled : 4571 Identity 4572 ) 4573 ); 4574 4575 // rejected_handlers.add( ... ) 4576 tuples[ 2 ][ 3 ].add( 4577 resolve( 4578 0, 4579 newDefer, 4580 isFunction( onRejected ) ? 4581 onRejected : 4582 Thrower 4583 ) 4584 ); 4585 } ).promise(); 4586 }, 4587 4588 // Get a promise for this deferred 4589 // If obj is provided, the promise aspect is added to the object 4590 promise: function( obj ) { 4591 return obj != null ? jQuery.extend( obj, promise ) : promise; 4592 } 4593 }, 4594 deferred = {}; 4595 4596 // Add list-specific methods 4597 jQuery.each( tuples, function( i, tuple ) { 4598 var list = tuple[ 2 ], 4599 stateString = tuple[ 5 ]; 4600 4601 // promise.progress = list.add 4602 // promise.done = list.add 4603 // promise.fail = list.add 4604 promise[ tuple[ 1 ] ] = list.add; 4605 4606 // Handle state 4607 if ( stateString ) { 4608 list.add( 4609 function() { 4610 4611 // state = "resolved" (i.e., fulfilled) 4612 // state = "rejected" 4613 state = stateString; 4614 }, 4615 4616 // rejected_callbacks.disable 4617 // fulfilled_callbacks.disable 4618 tuples[ 3 - i ][ 2 ].disable, 4619 4620 // rejected_handlers.disable 4621 // fulfilled_handlers.disable 4622 tuples[ 3 - i ][ 3 ].disable, 4623 4624 // progress_callbacks.lock 4625 tuples[ 0 ][ 2 ].lock, 4626 4627 // progress_handlers.lock 4628 tuples[ 0 ][ 3 ].lock 4629 ); 4630 } 4631 4632 // progress_handlers.fire 4633 // fulfilled_handlers.fire 4634 // rejected_handlers.fire 4635 list.add( tuple[ 3 ].fire ); 4636 4637 // deferred.notify = function() { deferred.notifyWith(...) } 4638 // deferred.resolve = function() { deferred.resolveWith(...) } 4639 // deferred.reject = function() { deferred.rejectWith(...) } 4640 deferred[ tuple[ 0 ] ] = function() { 4641 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 4642 return this; 4643 }; 4644 4645 // deferred.notifyWith = list.fireWith 4646 // deferred.resolveWith = list.fireWith 4647 // deferred.rejectWith = list.fireWith 4648 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 4649 } ); 4650 4651 // Make the deferred a promise 4652 promise.promise( deferred ); 4653 4654 // Call given func if any 4655 if ( func ) { 4656 func.call( deferred, deferred ); 4657 } 4658 4659 // All done! 4660 return deferred; 4661 }, 4662 4663 // Deferred helper 4664 when: function( singleValue ) { 4665 var 4666 4667 // count of uncompleted subordinates 4668 remaining = arguments.length, 4669 4670 // count of unprocessed arguments 4671 i = remaining, 4672 4673 // subordinate fulfillment data 4674 resolveContexts = Array( i ), 4675 resolveValues = slice.call( arguments ), 4676 4677 // the master Deferred 4678 master = jQuery.Deferred(), 4679 4680 // subordinate callback factory 4681 updateFunc = function( i ) { 4682 return function( value ) { 4683 resolveContexts[ i ] = this; 4684 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 4685 if ( !( --remaining ) ) { 4686 master.resolveWith( resolveContexts, resolveValues ); 4687 } 4688 }; 4689 }; 4690 4691 // Single- and empty arguments are adopted like Promise.resolve 4692 if ( remaining <= 1 ) { 4693 adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, 4694 !remaining ); 4695 4696 // Use .then() to unwrap secondary thenables (cf. gh-3000) 4697 if ( master.state() === "pending" || 4698 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 4699 4700 return master.then(); 4701 } 4702 } 4703 4704 // Multiple arguments are aggregated like Promise.all array elements 4705 while ( i-- ) { 4706 adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); 4707 } 4708 4709 return master.promise(); 4710 } 4711} ); 4712 4713 4714// These usually indicate a programmer mistake during development, 4715// warn about them ASAP rather than swallowing them by default. 4716var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 4717 4718jQuery.Deferred.exceptionHook = function( error, stack ) { 4719 4720 // Support: IE 8 - 9 only 4721 // Console exists when dev tools are open, which can happen at any time 4722 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 4723 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); 4724 } 4725}; 4726 4727 4728 4729 4730jQuery.readyException = function( error ) { 4731 window.setTimeout( function() { 4732 throw error; 4733 } ); 4734}; 4735 4736 4737 4738 4739// The deferred used on DOM ready 4740var readyList = jQuery.Deferred(); 4741 4742jQuery.fn.ready = function( fn ) { 4743 4744 readyList 4745 .then( fn ) 4746 4747 // Wrap jQuery.readyException in a function so that the lookup 4748 // happens at the time of error handling instead of callback 4749 // registration. 4750 .catch( function( error ) { 4751 jQuery.readyException( error ); 4752 } ); 4753 4754 return this; 4755}; 4756 4757jQuery.extend( { 4758 4759 // Is the DOM ready to be used? Set to true once it occurs. 4760 isReady: false, 4761 4762 // A counter to track how many items to wait for before 4763 // the ready event fires. See #6781 4764 readyWait: 1, 4765 4766 // Handle when the DOM is ready 4767 ready: function( wait ) { 4768 4769 // Abort if there are pending holds or we're already ready 4770 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 4771 return; 4772 } 4773 4774 // Remember that the DOM is ready 4775 jQuery.isReady = true; 4776 4777 // If a normal DOM Ready event fired, decrement, and wait if need be 4778 if ( wait !== true && --jQuery.readyWait > 0 ) { 4779 return; 4780 } 4781 4782 // If there are functions bound, to execute 4783 readyList.resolveWith( document, [ jQuery ] ); 4784 } 4785} ); 4786 4787jQuery.ready.then = readyList.then; 4788 4789// The ready event handler and self cleanup method 4790function completed() { 4791 document.removeEventListener( "DOMContentLoaded", completed ); 4792 window.removeEventListener( "load", completed ); 4793 jQuery.ready(); 4794} 4795 4796// Catch cases where $(document).ready() is called 4797// after the browser event has already occurred. 4798// Support: IE <=9 - 10 only 4799// Older IE sometimes signals "interactive" too soon 4800if ( document.readyState === "complete" || 4801 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 4802 4803 // Handle it asynchronously to allow scripts the opportunity to delay ready 4804 window.setTimeout( jQuery.ready ); 4805 4806} else { 4807 4808 // Use the handy event callback 4809 document.addEventListener( "DOMContentLoaded", completed ); 4810 4811 // A fallback to window.onload, that will always work 4812 window.addEventListener( "load", completed ); 4813} 4814 4815 4816 4817 4818// Multifunctional method to get and set values of a collection 4819// The value/s can optionally be executed if it's a function 4820var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 4821 var i = 0, 4822 len = elems.length, 4823 bulk = key == null; 4824 4825 // Sets many values 4826 if ( toType( key ) === "object" ) { 4827 chainable = true; 4828 for ( i in key ) { 4829 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 4830 } 4831 4832 // Sets one value 4833 } else if ( value !== undefined ) { 4834 chainable = true; 4835 4836 if ( !isFunction( value ) ) { 4837 raw = true; 4838 } 4839 4840 if ( bulk ) { 4841 4842 // Bulk operations run against the entire set 4843 if ( raw ) { 4844 fn.call( elems, value ); 4845 fn = null; 4846 4847 // ...except when executing function values 4848 } else { 4849 bulk = fn; 4850 fn = function( elem, key, value ) { 4851 return bulk.call( jQuery( elem ), value ); 4852 }; 4853 } 4854 } 4855 4856 if ( fn ) { 4857 for ( ; i < len; i++ ) { 4858 fn( 4859 elems[ i ], key, raw ? 4860 value : 4861 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 4862 ); 4863 } 4864 } 4865 } 4866 4867 if ( chainable ) { 4868 return elems; 4869 } 4870 4871 // Gets 4872 if ( bulk ) { 4873 return fn.call( elems ); 4874 } 4875 4876 return len ? fn( elems[ 0 ], key ) : emptyGet; 4877}; 4878 4879 4880// Matches dashed string for camelizing 4881var rmsPrefix = /^-ms-/, 4882 rdashAlpha = /-([a-z])/g; 4883 4884// Used by camelCase as callback to replace() 4885function fcamelCase( all, letter ) { 4886 return letter.toUpperCase(); 4887} 4888 4889// Convert dashed to camelCase; used by the css and data modules 4890// Support: IE <=9 - 11, Edge 12 - 15 4891// Microsoft forgot to hump their vendor prefix (#9572) 4892function camelCase( string ) { 4893 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 4894} 4895var acceptData = function( owner ) { 4896 4897 // Accepts only: 4898 // - Node 4899 // - Node.ELEMENT_NODE 4900 // - Node.DOCUMENT_NODE 4901 // - Object 4902 // - Any 4903 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 4904}; 4905 4906 4907 4908 4909function Data() { 4910 this.expando = jQuery.expando + Data.uid++; 4911} 4912 4913Data.uid = 1; 4914 4915Data.prototype = { 4916 4917 cache: function( owner ) { 4918 4919 // Check if the owner object already has a cache 4920 var value = owner[ this.expando ]; 4921 4922 // If not, create one 4923 if ( !value ) { 4924 value = {}; 4925 4926 // We can accept data for non-element nodes in modern browsers, 4927 // but we should not, see #8335. 4928 // Always return an empty object. 4929 if ( acceptData( owner ) ) { 4930 4931 // If it is a node unlikely to be stringify-ed or looped over 4932 // use plain assignment 4933 if ( owner.nodeType ) { 4934 owner[ this.expando ] = value; 4935 4936 // Otherwise secure it in a non-enumerable property 4937 // configurable must be true to allow the property to be 4938 // deleted when data is removed 4939 } else { 4940 Object.defineProperty( owner, this.expando, { 4941 value: value, 4942 configurable: true 4943 } ); 4944 } 4945 } 4946 } 4947 4948 return value; 4949 }, 4950 set: function( owner, data, value ) { 4951 var prop, 4952 cache = this.cache( owner ); 4953 4954 // Handle: [ owner, key, value ] args 4955 // Always use camelCase key (gh-2257) 4956 if ( typeof data === "string" ) { 4957 cache[ camelCase( data ) ] = value; 4958 4959 // Handle: [ owner, { properties } ] args 4960 } else { 4961 4962 // Copy the properties one-by-one to the cache object 4963 for ( prop in data ) { 4964 cache[ camelCase( prop ) ] = data[ prop ]; 4965 } 4966 } 4967 return cache; 4968 }, 4969 get: function( owner, key ) { 4970 return key === undefined ? 4971 this.cache( owner ) : 4972 4973 // Always use camelCase key (gh-2257) 4974 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 4975 }, 4976 access: function( owner, key, value ) { 4977 4978 // In cases where either: 4979 // 4980 // 1. No key was specified 4981 // 2. A string key was specified, but no value provided 4982 // 4983 // Take the "read" path and allow the get method to determine 4984 // which value to return, respectively either: 4985 // 4986 // 1. The entire cache object 4987 // 2. The data stored at the key 4988 // 4989 if ( key === undefined || 4990 ( ( key && typeof key === "string" ) && value === undefined ) ) { 4991 4992 return this.get( owner, key ); 4993 } 4994 4995 // When the key is not a string, or both a key and value 4996 // are specified, set or extend (existing objects) with either: 4997 // 4998 // 1. An object of properties 4999 // 2. A key and value 5000 // 5001 this.set( owner, key, value ); 5002 5003 // Since the "set" path can have two possible entry points 5004 // return the expected data based on which path was taken[*] 5005 return value !== undefined ? value : key; 5006 }, 5007 remove: function( owner, key ) { 5008 var i, 5009 cache = owner[ this.expando ]; 5010 5011 if ( cache === undefined ) { 5012 return; 5013 } 5014 5015 if ( key !== undefined ) { 5016 5017 // Support array or space separated string of keys 5018 if ( Array.isArray( key ) ) { 5019 5020 // If key is an array of keys... 5021 // We always set camelCase keys, so remove that. 5022 key = key.map( camelCase ); 5023 } else { 5024 key = camelCase( key ); 5025 5026 // If a key with the spaces exists, use it. 5027 // Otherwise, create an array by matching non-whitespace 5028 key = key in cache ? 5029 [ key ] : 5030 ( key.match( rnothtmlwhite ) || [] ); 5031 } 5032 5033 i = key.length; 5034 5035 while ( i-- ) { 5036 delete cache[ key[ i ] ]; 5037 } 5038 } 5039 5040 // Remove the expando if there's no more data 5041 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 5042 5043 // Support: Chrome <=35 - 45 5044 // Webkit & Blink performance suffers when deleting properties 5045 // from DOM nodes, so set to undefined instead 5046 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 5047 if ( owner.nodeType ) { 5048 owner[ this.expando ] = undefined; 5049 } else { 5050 delete owner[ this.expando ]; 5051 } 5052 } 5053 }, 5054 hasData: function( owner ) { 5055 var cache = owner[ this.expando ]; 5056 return cache !== undefined && !jQuery.isEmptyObject( cache ); 5057 } 5058}; 5059var dataPriv = new Data(); 5060 5061var dataUser = new Data(); 5062 5063 5064 5065// Implementation Summary 5066// 5067// 1. Enforce API surface and semantic compatibility with 1.9.x branch 5068// 2. Improve the module's maintainability by reducing the storage 5069// paths to a single mechanism. 5070// 3. Use the same single mechanism to support "private" and "user" data. 5071// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 5072// 5. Avoid exposing implementation details on user objects (eg. expando properties) 5073// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 5074 5075var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 5076 rmultiDash = /[A-Z]/g; 5077 5078function getData( data ) { 5079 if ( data === "true" ) { 5080 return true; 5081 } 5082 5083 if ( data === "false" ) { 5084 return false; 5085 } 5086 5087 if ( data === "null" ) { 5088 return null; 5089 } 5090 5091 // Only convert to a number if it doesn't change the string 5092 if ( data === +data + "" ) { 5093 return +data; 5094 } 5095 5096 if ( rbrace.test( data ) ) { 5097 return JSON.parse( data ); 5098 } 5099 5100 return data; 5101} 5102 5103function dataAttr( elem, key, data ) { 5104 var name; 5105 5106 // If nothing was found internally, try to fetch any 5107 // data from the HTML5 data-* attribute 5108 if ( data === undefined && elem.nodeType === 1 ) { 5109 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 5110 data = elem.getAttribute( name ); 5111 5112 if ( typeof data === "string" ) { 5113 try { 5114 data = getData( data ); 5115 } catch ( e ) {} 5116 5117 // Make sure we set the data so it isn't changed later 5118 dataUser.set( elem, key, data ); 5119 } else { 5120 data = undefined; 5121 } 5122 } 5123 return data; 5124} 5125 5126jQuery.extend( { 5127 hasData: function( elem ) { 5128 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 5129 }, 5130 5131 data: function( elem, name, data ) { 5132 return dataUser.access( elem, name, data ); 5133 }, 5134 5135 removeData: function( elem, name ) { 5136 dataUser.remove( elem, name ); 5137 }, 5138 5139 // TODO: Now that all calls to _data and _removeData have been replaced 5140 // with direct calls to dataPriv methods, these can be deprecated. 5141 _data: function( elem, name, data ) { 5142 return dataPriv.access( elem, name, data ); 5143 }, 5144 5145 _removeData: function( elem, name ) { 5146 dataPriv.remove( elem, name ); 5147 } 5148} ); 5149 5150jQuery.fn.extend( { 5151 data: function( key, value ) { 5152 var i, name, data, 5153 elem = this[ 0 ], 5154 attrs = elem && elem.attributes; 5155 5156 // Gets all values 5157 if ( key === undefined ) { 5158 if ( this.length ) { 5159 data = dataUser.get( elem ); 5160 5161 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 5162 i = attrs.length; 5163 while ( i-- ) { 5164 5165 // Support: IE 11 only 5166 // The attrs elements can be null (#14894) 5167 if ( attrs[ i ] ) { 5168 name = attrs[ i ].name; 5169 if ( name.indexOf( "data-" ) === 0 ) { 5170 name = camelCase( name.slice( 5 ) ); 5171 dataAttr( elem, name, data[ name ] ); 5172 } 5173 } 5174 } 5175 dataPriv.set( elem, "hasDataAttrs", true ); 5176 } 5177 } 5178 5179 return data; 5180 } 5181 5182 // Sets multiple values 5183 if ( typeof key === "object" ) { 5184 return this.each( function() { 5185 dataUser.set( this, key ); 5186 } ); 5187 } 5188 5189 return access( this, function( value ) { 5190 var data; 5191 5192 // The calling jQuery object (element matches) is not empty 5193 // (and therefore has an element appears at this[ 0 ]) and the 5194 // `value` parameter was not undefined. An empty jQuery object 5195 // will result in `undefined` for elem = this[ 0 ] which will 5196 // throw an exception if an attempt to read a data cache is made. 5197 if ( elem && value === undefined ) { 5198 5199 // Attempt to get data from the cache 5200 // The key will always be camelCased in Data 5201 data = dataUser.get( elem, key ); 5202 if ( data !== undefined ) { 5203 return data; 5204 } 5205 5206 // Attempt to "discover" the data in 5207 // HTML5 custom data-* attrs 5208 data = dataAttr( elem, key ); 5209 if ( data !== undefined ) { 5210 return data; 5211 } 5212 5213 // We tried really hard, but the data doesn't exist. 5214 return; 5215 } 5216 5217 // Set the data... 5218 this.each( function() { 5219 5220 // We always store the camelCased key 5221 dataUser.set( this, key, value ); 5222 } ); 5223 }, null, value, arguments.length > 1, null, true ); 5224 }, 5225 5226 removeData: function( key ) { 5227 return this.each( function() { 5228 dataUser.remove( this, key ); 5229 } ); 5230 } 5231} ); 5232 5233 5234jQuery.extend( { 5235 queue: function( elem, type, data ) { 5236 var queue; 5237 5238 if ( elem ) { 5239 type = ( type || "fx" ) + "queue"; 5240 queue = dataPriv.get( elem, type ); 5241 5242 // Speed up dequeue by getting out quickly if this is just a lookup 5243 if ( data ) { 5244 if ( !queue || Array.isArray( data ) ) { 5245 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 5246 } else { 5247 queue.push( data ); 5248 } 5249 } 5250 return queue || []; 5251 } 5252 }, 5253 5254 dequeue: function( elem, type ) { 5255 type = type || "fx"; 5256 5257 var queue = jQuery.queue( elem, type ), 5258 startLength = queue.length, 5259 fn = queue.shift(), 5260 hooks = jQuery._queueHooks( elem, type ), 5261 next = function() { 5262 jQuery.dequeue( elem, type ); 5263 }; 5264 5265 // If the fx queue is dequeued, always remove the progress sentinel 5266 if ( fn === "inprogress" ) { 5267 fn = queue.shift(); 5268 startLength--; 5269 } 5270 5271 if ( fn ) { 5272 5273 // Add a progress sentinel to prevent the fx queue from being 5274 // automatically dequeued 5275 if ( type === "fx" ) { 5276 queue.unshift( "inprogress" ); 5277 } 5278 5279 // Clear up the last queue stop function 5280 delete hooks.stop; 5281 fn.call( elem, next, hooks ); 5282 } 5283 5284 if ( !startLength && hooks ) { 5285 hooks.empty.fire(); 5286 } 5287 }, 5288 5289 // Not public - generate a queueHooks object, or return the current one 5290 _queueHooks: function( elem, type ) { 5291 var key = type + "queueHooks"; 5292 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 5293 empty: jQuery.Callbacks( "once memory" ).add( function() { 5294 dataPriv.remove( elem, [ type + "queue", key ] ); 5295 } ) 5296 } ); 5297 } 5298} ); 5299 5300jQuery.fn.extend( { 5301 queue: function( type, data ) { 5302 var setter = 2; 5303 5304 if ( typeof type !== "string" ) { 5305 data = type; 5306 type = "fx"; 5307 setter--; 5308 } 5309 5310 if ( arguments.length < setter ) { 5311 return jQuery.queue( this[ 0 ], type ); 5312 } 5313 5314 return data === undefined ? 5315 this : 5316 this.each( function() { 5317 var queue = jQuery.queue( this, type, data ); 5318 5319 // Ensure a hooks for this queue 5320 jQuery._queueHooks( this, type ); 5321 5322 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 5323 jQuery.dequeue( this, type ); 5324 } 5325 } ); 5326 }, 5327 dequeue: function( type ) { 5328 return this.each( function() { 5329 jQuery.dequeue( this, type ); 5330 } ); 5331 }, 5332 clearQueue: function( type ) { 5333 return this.queue( type || "fx", [] ); 5334 }, 5335 5336 // Get a promise resolved when queues of a certain type 5337 // are emptied (fx is the type by default) 5338 promise: function( type, obj ) { 5339 var tmp, 5340 count = 1, 5341 defer = jQuery.Deferred(), 5342 elements = this, 5343 i = this.length, 5344 resolve = function() { 5345 if ( !( --count ) ) { 5346 defer.resolveWith( elements, [ elements ] ); 5347 } 5348 }; 5349 5350 if ( typeof type !== "string" ) { 5351 obj = type; 5352 type = undefined; 5353 } 5354 type = type || "fx"; 5355 5356 while ( i-- ) { 5357 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 5358 if ( tmp && tmp.empty ) { 5359 count++; 5360 tmp.empty.add( resolve ); 5361 } 5362 } 5363 resolve(); 5364 return defer.promise( obj ); 5365 } 5366} ); 5367var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 5368 5369var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 5370 5371 5372var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 5373 5374var documentElement = document.documentElement; 5375 5376 5377 5378 var isAttached = function( elem ) { 5379 return jQuery.contains( elem.ownerDocument, elem ); 5380 }, 5381 composed = { composed: true }; 5382 5383 // Check attachment across shadow DOM boundaries when possible (gh-3504) 5384 if ( documentElement.attachShadow ) { 5385 isAttached = function( elem ) { 5386 return jQuery.contains( elem.ownerDocument, elem ) || 5387 elem.getRootNode( composed ) === elem.ownerDocument; 5388 }; 5389 } 5390var isHiddenWithinTree = function( elem, el ) { 5391 5392 // isHiddenWithinTree might be called from jQuery#filter function; 5393 // in that case, element will be second argument 5394 elem = el || elem; 5395 5396 // Inline style trumps all 5397 return elem.style.display === "none" || 5398 elem.style.display === "" && 5399 5400 // Otherwise, check computed style 5401 // Support: Firefox <=43 - 45 5402 // Disconnected elements can have computed display: none, so first confirm that elem is 5403 // in the document. 5404 isAttached( elem ) && 5405 5406 jQuery.css( elem, "display" ) === "none"; 5407 }; 5408 5409var swap = function( elem, options, callback, args ) { 5410 var ret, name, 5411 old = {}; 5412 5413 // Remember the old values, and insert the new ones 5414 for ( name in options ) { 5415 old[ name ] = elem.style[ name ]; 5416 elem.style[ name ] = options[ name ]; 5417 } 5418 5419 ret = callback.apply( elem, args || [] ); 5420 5421 // Revert the old values 5422 for ( name in options ) { 5423 elem.style[ name ] = old[ name ]; 5424 } 5425 5426 return ret; 5427}; 5428 5429 5430 5431 5432function adjustCSS( elem, prop, valueParts, tween ) { 5433 var adjusted, scale, 5434 maxIterations = 20, 5435 currentValue = tween ? 5436 function() { 5437 return tween.cur(); 5438 } : 5439 function() { 5440 return jQuery.css( elem, prop, "" ); 5441 }, 5442 initial = currentValue(), 5443 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 5444 5445 // Starting value computation is required for potential unit mismatches 5446 initialInUnit = elem.nodeType && 5447 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 5448 rcssNum.exec( jQuery.css( elem, prop ) ); 5449 5450 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 5451 5452 // Support: Firefox <=54 5453 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 5454 initial = initial / 2; 5455 5456 // Trust units reported by jQuery.css 5457 unit = unit || initialInUnit[ 3 ]; 5458 5459 // Iteratively approximate from a nonzero starting point 5460 initialInUnit = +initial || 1; 5461 5462 while ( maxIterations-- ) { 5463 5464 // Evaluate and update our best guess (doubling guesses that zero out). 5465 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 5466 jQuery.style( elem, prop, initialInUnit + unit ); 5467 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 5468 maxIterations = 0; 5469 } 5470 initialInUnit = initialInUnit / scale; 5471 5472 } 5473 5474 initialInUnit = initialInUnit * 2; 5475 jQuery.style( elem, prop, initialInUnit + unit ); 5476 5477 // Make sure we update the tween properties later on 5478 valueParts = valueParts || []; 5479 } 5480 5481 if ( valueParts ) { 5482 initialInUnit = +initialInUnit || +initial || 0; 5483 5484 // Apply relative offset (+=/-=) if specified 5485 adjusted = valueParts[ 1 ] ? 5486 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 5487 +valueParts[ 2 ]; 5488 if ( tween ) { 5489 tween.unit = unit; 5490 tween.start = initialInUnit; 5491 tween.end = adjusted; 5492 } 5493 } 5494 return adjusted; 5495} 5496 5497 5498var defaultDisplayMap = {}; 5499 5500function getDefaultDisplay( elem ) { 5501 var temp, 5502 doc = elem.ownerDocument, 5503 nodeName = elem.nodeName, 5504 display = defaultDisplayMap[ nodeName ]; 5505 5506 if ( display ) { 5507 return display; 5508 } 5509 5510 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 5511 display = jQuery.css( temp, "display" ); 5512 5513 temp.parentNode.removeChild( temp ); 5514 5515 if ( display === "none" ) { 5516 display = "block"; 5517 } 5518 defaultDisplayMap[ nodeName ] = display; 5519 5520 return display; 5521} 5522 5523function showHide( elements, show ) { 5524 var display, elem, 5525 values = [], 5526 index = 0, 5527 length = elements.length; 5528 5529 // Determine new display value for elements that need to change 5530 for ( ; index < length; index++ ) { 5531 elem = elements[ index ]; 5532 if ( !elem.style ) { 5533 continue; 5534 } 5535 5536 display = elem.style.display; 5537 if ( show ) { 5538 5539 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 5540 // check is required in this first loop unless we have a nonempty display value (either 5541 // inline or about-to-be-restored) 5542 if ( display === "none" ) { 5543 values[ index ] = dataPriv.get( elem, "display" ) || null; 5544 if ( !values[ index ] ) { 5545 elem.style.display = ""; 5546 } 5547 } 5548 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 5549 values[ index ] = getDefaultDisplay( elem ); 5550 } 5551 } else { 5552 if ( display !== "none" ) { 5553 values[ index ] = "none"; 5554 5555 // Remember what we're overwriting 5556 dataPriv.set( elem, "display", display ); 5557 } 5558 } 5559 } 5560 5561 // Set the display of the elements in a second loop to avoid constant reflow 5562 for ( index = 0; index < length; index++ ) { 5563 if ( values[ index ] != null ) { 5564 elements[ index ].style.display = values[ index ]; 5565 } 5566 } 5567 5568 return elements; 5569} 5570 5571jQuery.fn.extend( { 5572 show: function() { 5573 return showHide( this, true ); 5574 }, 5575 hide: function() { 5576 return showHide( this ); 5577 }, 5578 toggle: function( state ) { 5579 if ( typeof state === "boolean" ) { 5580 return state ? this.show() : this.hide(); 5581 } 5582 5583 return this.each( function() { 5584 if ( isHiddenWithinTree( this ) ) { 5585 jQuery( this ).show(); 5586 } else { 5587 jQuery( this ).hide(); 5588 } 5589 } ); 5590 } 5591} ); 5592var rcheckableType = ( /^(?:checkbox|radio)$/i ); 5593 5594var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 5595 5596var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 5597 5598 5599 5600// We have to close these tags to support XHTML (#13200) 5601var wrapMap = { 5602 5603 // Support: IE <=9 only 5604 option: [ 1, "<select multiple='multiple'>", "</select>" ], 5605 5606 // XHTML parsers do not magically insert elements in the 5607 // same way that tag soup parsers do. So we cannot shorten 5608 // this by omitting <tbody> or other required elements. 5609 thead: [ 1, "<table>", "</table>" ], 5610 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 5611 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 5612 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 5613 5614 _default: [ 0, "", "" ] 5615}; 5616 5617// Support: IE <=9 only 5618wrapMap.optgroup = wrapMap.option; 5619 5620wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 5621wrapMap.th = wrapMap.td; 5622 5623 5624function getAll( context, tag ) { 5625 5626 // Support: IE <=9 - 11 only 5627 // Use typeof to avoid zero-argument method invocation on host objects (#15151) 5628 var ret; 5629 5630 if ( typeof context.getElementsByTagName !== "undefined" ) { 5631 ret = context.getElementsByTagName( tag || "*" ); 5632 5633 } else if ( typeof context.querySelectorAll !== "undefined" ) { 5634 ret = context.querySelectorAll( tag || "*" ); 5635 5636 } else { 5637 ret = []; 5638 } 5639 5640 if ( tag === undefined || tag && nodeName( context, tag ) ) { 5641 return jQuery.merge( [ context ], ret ); 5642 } 5643 5644 return ret; 5645} 5646 5647 5648// Mark scripts as having already been evaluated 5649function setGlobalEval( elems, refElements ) { 5650 var i = 0, 5651 l = elems.length; 5652 5653 for ( ; i < l; i++ ) { 5654 dataPriv.set( 5655 elems[ i ], 5656 "globalEval", 5657 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 5658 ); 5659 } 5660} 5661 5662 5663var rhtml = /<|&#?\w+;/; 5664 5665function buildFragment( elems, context, scripts, selection, ignored ) { 5666 var elem, tmp, tag, wrap, attached, j, 5667 fragment = context.createDocumentFragment(), 5668 nodes = [], 5669 i = 0, 5670 l = elems.length; 5671 5672 for ( ; i < l; i++ ) { 5673 elem = elems[ i ]; 5674 5675 if ( elem || elem === 0 ) { 5676 5677 // Add nodes directly 5678 if ( toType( elem ) === "object" ) { 5679 5680 // Support: Android <=4.0 only, PhantomJS 1 only 5681 // push.apply(_, arraylike) throws on ancient WebKit 5682 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 5683 5684 // Convert non-html into a text node 5685 } else if ( !rhtml.test( elem ) ) { 5686 nodes.push( context.createTextNode( elem ) ); 5687 5688 // Convert html into DOM nodes 5689 } else { 5690 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 5691 5692 // Deserialize a standard representation 5693 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 5694 wrap = wrapMap[ tag ] || wrapMap._default; 5695 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 5696 5697 // Descend through wrappers to the right content 5698 j = wrap[ 0 ]; 5699 while ( j-- ) { 5700 tmp = tmp.lastChild; 5701 } 5702 5703 // Support: Android <=4.0 only, PhantomJS 1 only 5704 // push.apply(_, arraylike) throws on ancient WebKit 5705 jQuery.merge( nodes, tmp.childNodes ); 5706 5707 // Remember the top-level container 5708 tmp = fragment.firstChild; 5709 5710 // Ensure the created nodes are orphaned (#12392) 5711 tmp.textContent = ""; 5712 } 5713 } 5714 } 5715 5716 // Remove wrapper from fragment 5717 fragment.textContent = ""; 5718 5719 i = 0; 5720 while ( ( elem = nodes[ i++ ] ) ) { 5721 5722 // Skip elements already in the context collection (trac-4087) 5723 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 5724 if ( ignored ) { 5725 ignored.push( elem ); 5726 } 5727 continue; 5728 } 5729 5730 attached = isAttached( elem ); 5731 5732 // Append to fragment 5733 tmp = getAll( fragment.appendChild( elem ), "script" ); 5734 5735 // Preserve script evaluation history 5736 if ( attached ) { 5737 setGlobalEval( tmp ); 5738 } 5739 5740 // Capture executables 5741 if ( scripts ) { 5742 j = 0; 5743 while ( ( elem = tmp[ j++ ] ) ) { 5744 if ( rscriptType.test( elem.type || "" ) ) { 5745 scripts.push( elem ); 5746 } 5747 } 5748 } 5749 } 5750 5751 return fragment; 5752} 5753 5754 5755( function() { 5756 var fragment = document.createDocumentFragment(), 5757 div = fragment.appendChild( document.createElement( "div" ) ), 5758 input = document.createElement( "input" ); 5759 5760 // Support: Android 4.0 - 4.3 only 5761 // Check state lost if the name is set (#11217) 5762 // Support: Windows Web Apps (WWA) 5763 // `name` and `type` must use .setAttribute for WWA (#14901) 5764 input.setAttribute( "type", "radio" ); 5765 input.setAttribute( "checked", "checked" ); 5766 input.setAttribute( "name", "t" ); 5767 5768 div.appendChild( input ); 5769 5770 // Support: Android <=4.1 only 5771 // Older WebKit doesn't clone checked state correctly in fragments 5772 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 5773 5774 // Support: IE <=11 only 5775 // Make sure textarea (and checkbox) defaultValue is properly cloned 5776 div.innerHTML = "<textarea>x</textarea>"; 5777 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 5778} )(); 5779 5780 5781var 5782 rkeyEvent = /^key/, 5783 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, 5784 rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 5785 5786function returnTrue() { 5787 return true; 5788} 5789 5790function returnFalse() { 5791 return false; 5792} 5793 5794// Support: IE <=9 - 11+ 5795// focus() and blur() are asynchronous, except when they are no-op. 5796// So expect focus to be synchronous when the element is already active, 5797// and blur to be synchronous when the element is not already active. 5798// (focus and blur are always synchronous in other supported browsers, 5799// this just defines when we can count on it). 5800function expectSync( elem, type ) { 5801 return ( elem === safeActiveElement() ) === ( type === "focus" ); 5802} 5803 5804// Support: IE <=9 only 5805// Accessing document.activeElement can throw unexpectedly 5806// https://bugs.jquery.com/ticket/13393 5807function safeActiveElement() { 5808 try { 5809 return document.activeElement; 5810 } catch ( err ) { } 5811} 5812 5813function on( elem, types, selector, data, fn, one ) { 5814 var origFn, type; 5815 5816 // Types can be a map of types/handlers 5817 if ( typeof types === "object" ) { 5818 5819 // ( types-Object, selector, data ) 5820 if ( typeof selector !== "string" ) { 5821 5822 // ( types-Object, data ) 5823 data = data || selector; 5824 selector = undefined; 5825 } 5826 for ( type in types ) { 5827 on( elem, type, selector, data, types[ type ], one ); 5828 } 5829 return elem; 5830 } 5831 5832 if ( data == null && fn == null ) { 5833 5834 // ( types, fn ) 5835 fn = selector; 5836 data = selector = undefined; 5837 } else if ( fn == null ) { 5838 if ( typeof selector === "string" ) { 5839 5840 // ( types, selector, fn ) 5841 fn = data; 5842 data = undefined; 5843 } else { 5844 5845 // ( types, data, fn ) 5846 fn = data; 5847 data = selector; 5848 selector = undefined; 5849 } 5850 } 5851 if ( fn === false ) { 5852 fn = returnFalse; 5853 } else if ( !fn ) { 5854 return elem; 5855 } 5856 5857 if ( one === 1 ) { 5858 origFn = fn; 5859 fn = function( event ) { 5860 5861 // Can use an empty set, since event contains the info 5862 jQuery().off( event ); 5863 return origFn.apply( this, arguments ); 5864 }; 5865 5866 // Use same guid so caller can remove using origFn 5867 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 5868 } 5869 return elem.each( function() { 5870 jQuery.event.add( this, types, fn, data, selector ); 5871 } ); 5872} 5873 5874/* 5875 * Helper functions for managing events -- not part of the public interface. 5876 * Props to Dean Edwards' addEvent library for many of the ideas. 5877 */ 5878jQuery.event = { 5879 5880 global: {}, 5881 5882 add: function( elem, types, handler, data, selector ) { 5883 5884 var handleObjIn, eventHandle, tmp, 5885 events, t, handleObj, 5886 special, handlers, type, namespaces, origType, 5887 elemData = dataPriv.get( elem ); 5888 5889 // Don't attach events to noData or text/comment nodes (but allow plain objects) 5890 if ( !elemData ) { 5891 return; 5892 } 5893 5894 // Caller can pass in an object of custom data in lieu of the handler 5895 if ( handler.handler ) { 5896 handleObjIn = handler; 5897 handler = handleObjIn.handler; 5898 selector = handleObjIn.selector; 5899 } 5900 5901 // Ensure that invalid selectors throw exceptions at attach time 5902 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 5903 if ( selector ) { 5904 jQuery.find.matchesSelector( documentElement, selector ); 5905 } 5906 5907 // Make sure that the handler has a unique ID, used to find/remove it later 5908 if ( !handler.guid ) { 5909 handler.guid = jQuery.guid++; 5910 } 5911 5912 // Init the element's event structure and main handler, if this is the first 5913 if ( !( events = elemData.events ) ) { 5914 events = elemData.events = {}; 5915 } 5916 if ( !( eventHandle = elemData.handle ) ) { 5917 eventHandle = elemData.handle = function( e ) { 5918 5919 // Discard the second event of a jQuery.event.trigger() and 5920 // when an event is called after a page has unloaded 5921 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 5922 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 5923 }; 5924 } 5925 5926 // Handle multiple events separated by a space 5927 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5928 t = types.length; 5929 while ( t-- ) { 5930 tmp = rtypenamespace.exec( types[ t ] ) || []; 5931 type = origType = tmp[ 1 ]; 5932 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5933 5934 // There *must* be a type, no attaching namespace-only handlers 5935 if ( !type ) { 5936 continue; 5937 } 5938 5939 // If event changes its type, use the special event handlers for the changed type 5940 special = jQuery.event.special[ type ] || {}; 5941 5942 // If selector defined, determine special event api type, otherwise given type 5943 type = ( selector ? special.delegateType : special.bindType ) || type; 5944 5945 // Update special based on newly reset type 5946 special = jQuery.event.special[ type ] || {}; 5947 5948 // handleObj is passed to all event handlers 5949 handleObj = jQuery.extend( { 5950 type: type, 5951 origType: origType, 5952 data: data, 5953 handler: handler, 5954 guid: handler.guid, 5955 selector: selector, 5956 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 5957 namespace: namespaces.join( "." ) 5958 }, handleObjIn ); 5959 5960 // Init the event handler queue if we're the first 5961 if ( !( handlers = events[ type ] ) ) { 5962 handlers = events[ type ] = []; 5963 handlers.delegateCount = 0; 5964 5965 // Only use addEventListener if the special events handler returns false 5966 if ( !special.setup || 5967 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 5968 5969 if ( elem.addEventListener ) { 5970 elem.addEventListener( type, eventHandle ); 5971 } 5972 } 5973 } 5974 5975 if ( special.add ) { 5976 special.add.call( elem, handleObj ); 5977 5978 if ( !handleObj.handler.guid ) { 5979 handleObj.handler.guid = handler.guid; 5980 } 5981 } 5982 5983 // Add to the element's handler list, delegates in front 5984 if ( selector ) { 5985 handlers.splice( handlers.delegateCount++, 0, handleObj ); 5986 } else { 5987 handlers.push( handleObj ); 5988 } 5989 5990 // Keep track of which events have ever been used, for event optimization 5991 jQuery.event.global[ type ] = true; 5992 } 5993 5994 }, 5995 5996 // Detach an event or set of events from an element 5997 remove: function( elem, types, handler, selector, mappedTypes ) { 5998 5999 var j, origCount, tmp, 6000 events, t, handleObj, 6001 special, handlers, type, namespaces, origType, 6002 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 6003 6004 if ( !elemData || !( events = elemData.events ) ) { 6005 return; 6006 } 6007 6008 // Once for each type.namespace in types; type may be omitted 6009 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 6010 t = types.length; 6011 while ( t-- ) { 6012 tmp = rtypenamespace.exec( types[ t ] ) || []; 6013 type = origType = tmp[ 1 ]; 6014 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 6015 6016 // Unbind all events (on this namespace, if provided) for the element 6017 if ( !type ) { 6018 for ( type in events ) { 6019 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 6020 } 6021 continue; 6022 } 6023 6024 special = jQuery.event.special[ type ] || {}; 6025 type = ( selector ? special.delegateType : special.bindType ) || type; 6026 handlers = events[ type ] || []; 6027 tmp = tmp[ 2 ] && 6028 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 6029 6030 // Remove matching events 6031 origCount = j = handlers.length; 6032 while ( j-- ) { 6033 handleObj = handlers[ j ]; 6034 6035 if ( ( mappedTypes || origType === handleObj.origType ) && 6036 ( !handler || handler.guid === handleObj.guid ) && 6037 ( !tmp || tmp.test( handleObj.namespace ) ) && 6038 ( !selector || selector === handleObj.selector || 6039 selector === "**" && handleObj.selector ) ) { 6040 handlers.splice( j, 1 ); 6041 6042 if ( handleObj.selector ) { 6043 handlers.delegateCount--; 6044 } 6045 if ( special.remove ) { 6046 special.remove.call( elem, handleObj ); 6047 } 6048 } 6049 } 6050 6051 // Remove generic event handler if we removed something and no more handlers exist 6052 // (avoids potential for endless recursion during removal of special event handlers) 6053 if ( origCount && !handlers.length ) { 6054 if ( !special.teardown || 6055 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 6056 6057 jQuery.removeEvent( elem, type, elemData.handle ); 6058 } 6059 6060 delete events[ type ]; 6061 } 6062 } 6063 6064 // Remove data and the expando if it's no longer used 6065 if ( jQuery.isEmptyObject( events ) ) { 6066 dataPriv.remove( elem, "handle events" ); 6067 } 6068 }, 6069 6070 dispatch: function( nativeEvent ) { 6071 6072 // Make a writable jQuery.Event from the native event object 6073 var event = jQuery.event.fix( nativeEvent ); 6074 6075 var i, j, ret, matched, handleObj, handlerQueue, 6076 args = new Array( arguments.length ), 6077 handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], 6078 special = jQuery.event.special[ event.type ] || {}; 6079 6080 // Use the fix-ed jQuery.Event rather than the (read-only) native event 6081 args[ 0 ] = event; 6082 6083 for ( i = 1; i < arguments.length; i++ ) { 6084 args[ i ] = arguments[ i ]; 6085 } 6086 6087 event.delegateTarget = this; 6088 6089 // Call the preDispatch hook for the mapped type, and let it bail if desired 6090 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 6091 return; 6092 } 6093 6094 // Determine handlers 6095 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 6096 6097 // Run delegates first; they may want to stop propagation beneath us 6098 i = 0; 6099 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 6100 event.currentTarget = matched.elem; 6101 6102 j = 0; 6103 while ( ( handleObj = matched.handlers[ j++ ] ) && 6104 !event.isImmediatePropagationStopped() ) { 6105 6106 // If the event is namespaced, then each handler is only invoked if it is 6107 // specially universal or its namespaces are a superset of the event's. 6108 if ( !event.rnamespace || handleObj.namespace === false || 6109 event.rnamespace.test( handleObj.namespace ) ) { 6110 6111 event.handleObj = handleObj; 6112 event.data = handleObj.data; 6113 6114 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 6115 handleObj.handler ).apply( matched.elem, args ); 6116 6117 if ( ret !== undefined ) { 6118 if ( ( event.result = ret ) === false ) { 6119 event.preventDefault(); 6120 event.stopPropagation(); 6121 } 6122 } 6123 } 6124 } 6125 } 6126 6127 // Call the postDispatch hook for the mapped type 6128 if ( special.postDispatch ) { 6129 special.postDispatch.call( this, event ); 6130 } 6131 6132 return event.result; 6133 }, 6134 6135 handlers: function( event, handlers ) { 6136 var i, handleObj, sel, matchedHandlers, matchedSelectors, 6137 handlerQueue = [], 6138 delegateCount = handlers.delegateCount, 6139 cur = event.target; 6140 6141 // Find delegate handlers 6142 if ( delegateCount && 6143 6144 // Support: IE <=9 6145 // Black-hole SVG <use> instance trees (trac-13180) 6146 cur.nodeType && 6147 6148 // Support: Firefox <=42 6149 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 6150 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 6151 // Support: IE 11 only 6152 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 6153 !( event.type === "click" && event.button >= 1 ) ) { 6154 6155 for ( ; cur !== this; cur = cur.parentNode || this ) { 6156 6157 // Don't check non-elements (#13208) 6158 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 6159 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 6160 matchedHandlers = []; 6161 matchedSelectors = {}; 6162 for ( i = 0; i < delegateCount; i++ ) { 6163 handleObj = handlers[ i ]; 6164 6165 // Don't conflict with Object.prototype properties (#13203) 6166 sel = handleObj.selector + " "; 6167 6168 if ( matchedSelectors[ sel ] === undefined ) { 6169 matchedSelectors[ sel ] = handleObj.needsContext ? 6170 jQuery( sel, this ).index( cur ) > -1 : 6171 jQuery.find( sel, this, null, [ cur ] ).length; 6172 } 6173 if ( matchedSelectors[ sel ] ) { 6174 matchedHandlers.push( handleObj ); 6175 } 6176 } 6177 if ( matchedHandlers.length ) { 6178 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 6179 } 6180 } 6181 } 6182 } 6183 6184 // Add the remaining (directly-bound) handlers 6185 cur = this; 6186 if ( delegateCount < handlers.length ) { 6187 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 6188 } 6189 6190 return handlerQueue; 6191 }, 6192 6193 addProp: function( name, hook ) { 6194 Object.defineProperty( jQuery.Event.prototype, name, { 6195 enumerable: true, 6196 configurable: true, 6197 6198 get: isFunction( hook ) ? 6199 function() { 6200 if ( this.originalEvent ) { 6201 return hook( this.originalEvent ); 6202 } 6203 } : 6204 function() { 6205 if ( this.originalEvent ) { 6206 return this.originalEvent[ name ]; 6207 } 6208 }, 6209 6210 set: function( value ) { 6211 Object.defineProperty( this, name, { 6212 enumerable: true, 6213 configurable: true, 6214 writable: true, 6215 value: value 6216 } ); 6217 } 6218 } ); 6219 }, 6220 6221 fix: function( originalEvent ) { 6222 return originalEvent[ jQuery.expando ] ? 6223 originalEvent : 6224 new jQuery.Event( originalEvent ); 6225 }, 6226 6227 special: { 6228 load: { 6229 6230 // Prevent triggered image.load events from bubbling to window.load 6231 noBubble: true 6232 }, 6233 click: { 6234 6235 // Utilize native event to ensure correct state for checkable inputs 6236 setup: function( data ) { 6237 6238 // For mutual compressibility with _default, replace `this` access with a local var. 6239 // `|| data` is dead code meant only to preserve the variable through minification. 6240 var el = this || data; 6241 6242 // Claim the first handler 6243 if ( rcheckableType.test( el.type ) && 6244 el.click && nodeName( el, "input" ) && 6245 dataPriv.get( el, "click" ) === undefined ) { 6246 6247 // dataPriv.set( el, "click", ... ) 6248 leverageNative( el, "click", returnTrue ); 6249 } 6250 6251 // Return false to allow normal processing in the caller 6252 return false; 6253 }, 6254 trigger: function( data ) { 6255 6256 // For mutual compressibility with _default, replace `this` access with a local var. 6257 // `|| data` is dead code meant only to preserve the variable through minification. 6258 var el = this || data; 6259 6260 // Force setup before triggering a click 6261 if ( rcheckableType.test( el.type ) && 6262 el.click && nodeName( el, "input" ) && 6263 dataPriv.get( el, "click" ) === undefined ) { 6264 6265 leverageNative( el, "click" ); 6266 } 6267 6268 // Return non-false to allow normal event-path propagation 6269 return true; 6270 }, 6271 6272 // For cross-browser consistency, suppress native .click() on links 6273 // Also prevent it if we're currently inside a leveraged native-event stack 6274 _default: function( event ) { 6275 var target = event.target; 6276 return rcheckableType.test( target.type ) && 6277 target.click && nodeName( target, "input" ) && 6278 dataPriv.get( target, "click" ) || 6279 nodeName( target, "a" ); 6280 } 6281 }, 6282 6283 beforeunload: { 6284 postDispatch: function( event ) { 6285 6286 // Support: Firefox 20+ 6287 // Firefox doesn't alert if the returnValue field is not set. 6288 if ( event.result !== undefined && event.originalEvent ) { 6289 event.originalEvent.returnValue = event.result; 6290 } 6291 } 6292 } 6293 } 6294}; 6295 6296// Ensure the presence of an event listener that handles manually-triggered 6297// synthetic events by interrupting progress until reinvoked in response to 6298// *native* events that it fires directly, ensuring that state changes have 6299// already occurred before other listeners are invoked. 6300function leverageNative( el, type, expectSync ) { 6301 6302 // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add 6303 if ( !expectSync ) { 6304 jQuery.event.add( el, type, returnTrue ); 6305 return; 6306 } 6307 6308 // Register the controller as a special universal handler for all event namespaces 6309 dataPriv.set( el, type, false ); 6310 jQuery.event.add( el, type, { 6311 namespace: false, 6312 handler: function( event ) { 6313 var notAsync, result, 6314 saved = dataPriv.get( this, type ); 6315 6316 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 6317 6318 // Interrupt processing of the outer synthetic .trigger()ed event 6319 if ( !saved ) { 6320 6321 // Store arguments for use when handling the inner native event 6322 saved = slice.call( arguments ); 6323 dataPriv.set( this, type, saved ); 6324 6325 // Trigger the native event and capture its result 6326 // Support: IE <=9 - 11+ 6327 // focus() and blur() are asynchronous 6328 notAsync = expectSync( this, type ); 6329 this[ type ](); 6330 result = dataPriv.get( this, type ); 6331 if ( saved !== result || notAsync ) { 6332 dataPriv.set( this, type, false ); 6333 } else { 6334 result = undefined; 6335 } 6336 if ( saved !== result ) { 6337 6338 // Cancel the outer synthetic event 6339 event.stopImmediatePropagation(); 6340 event.preventDefault(); 6341 return result; 6342 } 6343 6344 // If this is an inner synthetic event for an event with a bubbling surrogate 6345 // (focus or blur), assume that the surrogate already propagated from triggering the 6346 // native event and prevent that from happening again here. 6347 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 6348 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 6349 // less bad than duplication. 6350 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 6351 event.stopPropagation(); 6352 } 6353 6354 // If this is a native event triggered above, everything is now in order 6355 // Fire an inner synthetic event with the original arguments 6356 } else if ( saved ) { 6357 6358 // ...and capture the result 6359 dataPriv.set( this, type, jQuery.event.trigger( 6360 6361 // Support: IE <=9 - 11+ 6362 // Extend with the prototype to reset the above stopImmediatePropagation() 6363 jQuery.extend( saved.shift(), jQuery.Event.prototype ), 6364 saved, 6365 this 6366 ) ); 6367 6368 // Abort handling of the native event 6369 event.stopImmediatePropagation(); 6370 } 6371 } 6372 } ); 6373} 6374 6375jQuery.removeEvent = function( elem, type, handle ) { 6376 6377 // This "if" is needed for plain objects 6378 if ( elem.removeEventListener ) { 6379 elem.removeEventListener( type, handle ); 6380 } 6381}; 6382 6383jQuery.Event = function( src, props ) { 6384 6385 // Allow instantiation without the 'new' keyword 6386 if ( !( this instanceof jQuery.Event ) ) { 6387 return new jQuery.Event( src, props ); 6388 } 6389 6390 // Event object 6391 if ( src && src.type ) { 6392 this.originalEvent = src; 6393 this.type = src.type; 6394 6395 // Events bubbling up the document may have been marked as prevented 6396 // by a handler lower down the tree; reflect the correct value. 6397 this.isDefaultPrevented = src.defaultPrevented || 6398 src.defaultPrevented === undefined && 6399 6400 // Support: Android <=2.3 only 6401 src.returnValue === false ? 6402 returnTrue : 6403 returnFalse; 6404 6405 // Create target properties 6406 // Support: Safari <=6 - 7 only 6407 // Target should not be a text node (#504, #13143) 6408 this.target = ( src.target && src.target.nodeType === 3 ) ? 6409 src.target.parentNode : 6410 src.target; 6411 6412 this.currentTarget = src.currentTarget; 6413 this.relatedTarget = src.relatedTarget; 6414 6415 // Event type 6416 } else { 6417 this.type = src; 6418 } 6419 6420 // Put explicitly provided properties onto the event object 6421 if ( props ) { 6422 jQuery.extend( this, props ); 6423 } 6424 6425 // Create a timestamp if incoming event doesn't have one 6426 this.timeStamp = src && src.timeStamp || Date.now(); 6427 6428 // Mark it as fixed 6429 this[ jQuery.expando ] = true; 6430}; 6431 6432// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 6433// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 6434jQuery.Event.prototype = { 6435 constructor: jQuery.Event, 6436 isDefaultPrevented: returnFalse, 6437 isPropagationStopped: returnFalse, 6438 isImmediatePropagationStopped: returnFalse, 6439 isSimulated: false, 6440 6441 preventDefault: function() { 6442 var e = this.originalEvent; 6443 6444 this.isDefaultPrevented = returnTrue; 6445 6446 if ( e && !this.isSimulated ) { 6447 e.preventDefault(); 6448 } 6449 }, 6450 stopPropagation: function() { 6451 var e = this.originalEvent; 6452 6453 this.isPropagationStopped = returnTrue; 6454 6455 if ( e && !this.isSimulated ) { 6456 e.stopPropagation(); 6457 } 6458 }, 6459 stopImmediatePropagation: function() { 6460 var e = this.originalEvent; 6461 6462 this.isImmediatePropagationStopped = returnTrue; 6463 6464 if ( e && !this.isSimulated ) { 6465 e.stopImmediatePropagation(); 6466 } 6467 6468 this.stopPropagation(); 6469 } 6470}; 6471 6472// Includes all common event props including KeyEvent and MouseEvent specific props 6473jQuery.each( { 6474 altKey: true, 6475 bubbles: true, 6476 cancelable: true, 6477 changedTouches: true, 6478 ctrlKey: true, 6479 detail: true, 6480 eventPhase: true, 6481 metaKey: true, 6482 pageX: true, 6483 pageY: true, 6484 shiftKey: true, 6485 view: true, 6486 "char": true, 6487 code: true, 6488 charCode: true, 6489 key: true, 6490 keyCode: true, 6491 button: true, 6492 buttons: true, 6493 clientX: true, 6494 clientY: true, 6495 offsetX: true, 6496 offsetY: true, 6497 pointerId: true, 6498 pointerType: true, 6499 screenX: true, 6500 screenY: true, 6501 targetTouches: true, 6502 toElement: true, 6503 touches: true, 6504 6505 which: function( event ) { 6506 var button = event.button; 6507 6508 // Add which for key events 6509 if ( event.which == null && rkeyEvent.test( event.type ) ) { 6510 return event.charCode != null ? event.charCode : event.keyCode; 6511 } 6512 6513 // Add which for click: 1 === left; 2 === middle; 3 === right 6514 if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { 6515 if ( button & 1 ) { 6516 return 1; 6517 } 6518 6519 if ( button & 2 ) { 6520 return 3; 6521 } 6522 6523 if ( button & 4 ) { 6524 return 2; 6525 } 6526 6527 return 0; 6528 } 6529 6530 return event.which; 6531 } 6532}, jQuery.event.addProp ); 6533 6534jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 6535 jQuery.event.special[ type ] = { 6536 6537 // Utilize native event if possible so blur/focus sequence is correct 6538 setup: function() { 6539 6540 // Claim the first handler 6541 // dataPriv.set( this, "focus", ... ) 6542 // dataPriv.set( this, "blur", ... ) 6543 leverageNative( this, type, expectSync ); 6544 6545 // Return false to allow normal processing in the caller 6546 return false; 6547 }, 6548 trigger: function() { 6549 6550 // Force setup before trigger 6551 leverageNative( this, type ); 6552 6553 // Return non-false to allow normal event-path propagation 6554 return true; 6555 }, 6556 6557 delegateType: delegateType 6558 }; 6559} ); 6560 6561// Create mouseenter/leave events using mouseover/out and event-time checks 6562// so that event delegation works in jQuery. 6563// Do the same for pointerenter/pointerleave and pointerover/pointerout 6564// 6565// Support: Safari 7 only 6566// Safari sends mouseenter too often; see: 6567// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 6568// for the description of the bug (it existed in older Chrome versions as well). 6569jQuery.each( { 6570 mouseenter: "mouseover", 6571 mouseleave: "mouseout", 6572 pointerenter: "pointerover", 6573 pointerleave: "pointerout" 6574}, function( orig, fix ) { 6575 jQuery.event.special[ orig ] = { 6576 delegateType: fix, 6577 bindType: fix, 6578 6579 handle: function( event ) { 6580 var ret, 6581 target = this, 6582 related = event.relatedTarget, 6583 handleObj = event.handleObj; 6584 6585 // For mouseenter/leave call the handler if related is outside the target. 6586 // NB: No relatedTarget if the mouse left/entered the browser window 6587 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 6588 event.type = handleObj.origType; 6589 ret = handleObj.handler.apply( this, arguments ); 6590 event.type = fix; 6591 } 6592 return ret; 6593 } 6594 }; 6595} ); 6596 6597jQuery.fn.extend( { 6598 6599 on: function( types, selector, data, fn ) { 6600 return on( this, types, selector, data, fn ); 6601 }, 6602 one: function( types, selector, data, fn ) { 6603 return on( this, types, selector, data, fn, 1 ); 6604 }, 6605 off: function( types, selector, fn ) { 6606 var handleObj, type; 6607 if ( types && types.preventDefault && types.handleObj ) { 6608 6609 // ( event ) dispatched jQuery.Event 6610 handleObj = types.handleObj; 6611 jQuery( types.delegateTarget ).off( 6612 handleObj.namespace ? 6613 handleObj.origType + "." + handleObj.namespace : 6614 handleObj.origType, 6615 handleObj.selector, 6616 handleObj.handler 6617 ); 6618 return this; 6619 } 6620 if ( typeof types === "object" ) { 6621 6622 // ( types-object [, selector] ) 6623 for ( type in types ) { 6624 this.off( type, selector, types[ type ] ); 6625 } 6626 return this; 6627 } 6628 if ( selector === false || typeof selector === "function" ) { 6629 6630 // ( types [, fn] ) 6631 fn = selector; 6632 selector = undefined; 6633 } 6634 if ( fn === false ) { 6635 fn = returnFalse; 6636 } 6637 return this.each( function() { 6638 jQuery.event.remove( this, types, fn, selector ); 6639 } ); 6640 } 6641} ); 6642 6643 6644var 6645 6646 /* eslint-disable max-len */ 6647 6648 // See https://github.com/eslint/eslint/issues/3229 6649 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, 6650 6651 /* eslint-enable */ 6652 6653 // Support: IE <=10 - 11, Edge 12 - 13 only 6654 // In IE/Edge using regex groups here causes severe slowdowns. 6655 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 6656 rnoInnerhtml = /<script|<style|<link/i, 6657 6658 // checked="checked" or checked 6659 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 6660 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; 6661 6662// Prefer a tbody over its parent table for containing new rows 6663function manipulationTarget( elem, content ) { 6664 if ( nodeName( elem, "table" ) && 6665 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 6666 6667 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 6668 } 6669 6670 return elem; 6671} 6672 6673// Replace/restore the type attribute of script elements for safe DOM manipulation 6674function disableScript( elem ) { 6675 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 6676 return elem; 6677} 6678function restoreScript( elem ) { 6679 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 6680 elem.type = elem.type.slice( 5 ); 6681 } else { 6682 elem.removeAttribute( "type" ); 6683 } 6684 6685 return elem; 6686} 6687 6688function cloneCopyEvent( src, dest ) { 6689 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; 6690 6691 if ( dest.nodeType !== 1 ) { 6692 return; 6693 } 6694 6695 // 1. Copy private data: events, handlers, etc. 6696 if ( dataPriv.hasData( src ) ) { 6697 pdataOld = dataPriv.access( src ); 6698 pdataCur = dataPriv.set( dest, pdataOld ); 6699 events = pdataOld.events; 6700 6701 if ( events ) { 6702 delete pdataCur.handle; 6703 pdataCur.events = {}; 6704 6705 for ( type in events ) { 6706 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 6707 jQuery.event.add( dest, type, events[ type ][ i ] ); 6708 } 6709 } 6710 } 6711 } 6712 6713 // 2. Copy user data 6714 if ( dataUser.hasData( src ) ) { 6715 udataOld = dataUser.access( src ); 6716 udataCur = jQuery.extend( {}, udataOld ); 6717 6718 dataUser.set( dest, udataCur ); 6719 } 6720} 6721 6722// Fix IE bugs, see support tests 6723function fixInput( src, dest ) { 6724 var nodeName = dest.nodeName.toLowerCase(); 6725 6726 // Fails to persist the checked state of a cloned checkbox or radio button. 6727 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 6728 dest.checked = src.checked; 6729 6730 // Fails to return the selected option to the default selected state when cloning options 6731 } else if ( nodeName === "input" || nodeName === "textarea" ) { 6732 dest.defaultValue = src.defaultValue; 6733 } 6734} 6735 6736function domManip( collection, args, callback, ignored ) { 6737 6738 // Flatten any nested arrays 6739 args = concat.apply( [], args ); 6740 6741 var fragment, first, scripts, hasScripts, node, doc, 6742 i = 0, 6743 l = collection.length, 6744 iNoClone = l - 1, 6745 value = args[ 0 ], 6746 valueIsFunction = isFunction( value ); 6747 6748 // We can't cloneNode fragments that contain checked, in WebKit 6749 if ( valueIsFunction || 6750 ( l > 1 && typeof value === "string" && 6751 !support.checkClone && rchecked.test( value ) ) ) { 6752 return collection.each( function( index ) { 6753 var self = collection.eq( index ); 6754 if ( valueIsFunction ) { 6755 args[ 0 ] = value.call( this, index, self.html() ); 6756 } 6757 domManip( self, args, callback, ignored ); 6758 } ); 6759 } 6760 6761 if ( l ) { 6762 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 6763 first = fragment.firstChild; 6764 6765 if ( fragment.childNodes.length === 1 ) { 6766 fragment = first; 6767 } 6768 6769 // Require either new content or an interest in ignored elements to invoke the callback 6770 if ( first || ignored ) { 6771 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 6772 hasScripts = scripts.length; 6773 6774 // Use the original fragment for the last item 6775 // instead of the first because it can end up 6776 // being emptied incorrectly in certain situations (#8070). 6777 for ( ; i < l; i++ ) { 6778 node = fragment; 6779 6780 if ( i !== iNoClone ) { 6781 node = jQuery.clone( node, true, true ); 6782 6783 // Keep references to cloned scripts for later restoration 6784 if ( hasScripts ) { 6785 6786 // Support: Android <=4.0 only, PhantomJS 1 only 6787 // push.apply(_, arraylike) throws on ancient WebKit 6788 jQuery.merge( scripts, getAll( node, "script" ) ); 6789 } 6790 } 6791 6792 callback.call( collection[ i ], node, i ); 6793 } 6794 6795 if ( hasScripts ) { 6796 doc = scripts[ scripts.length - 1 ].ownerDocument; 6797 6798 // Reenable scripts 6799 jQuery.map( scripts, restoreScript ); 6800 6801 // Evaluate executable scripts on first document insertion 6802 for ( i = 0; i < hasScripts; i++ ) { 6803 node = scripts[ i ]; 6804 if ( rscriptType.test( node.type || "" ) && 6805 !dataPriv.access( node, "globalEval" ) && 6806 jQuery.contains( doc, node ) ) { 6807 6808 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 6809 6810 // Optional AJAX dependency, but won't run scripts if not present 6811 if ( jQuery._evalUrl && !node.noModule ) { 6812 jQuery._evalUrl( node.src, { 6813 nonce: node.nonce || node.getAttribute( "nonce" ) 6814 } ); 6815 } 6816 } else { 6817 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 6818 } 6819 } 6820 } 6821 } 6822 } 6823 } 6824 6825 return collection; 6826} 6827 6828function remove( elem, selector, keepData ) { 6829 var node, 6830 nodes = selector ? jQuery.filter( selector, elem ) : elem, 6831 i = 0; 6832 6833 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 6834 if ( !keepData && node.nodeType === 1 ) { 6835 jQuery.cleanData( getAll( node ) ); 6836 } 6837 6838 if ( node.parentNode ) { 6839 if ( keepData && isAttached( node ) ) { 6840 setGlobalEval( getAll( node, "script" ) ); 6841 } 6842 node.parentNode.removeChild( node ); 6843 } 6844 } 6845 6846 return elem; 6847} 6848 6849jQuery.extend( { 6850 htmlPrefilter: function( html ) { 6851 return html.replace( rxhtmlTag, "<$1></$2>" ); 6852 }, 6853 6854 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 6855 var i, l, srcElements, destElements, 6856 clone = elem.cloneNode( true ), 6857 inPage = isAttached( elem ); 6858 6859 // Fix IE cloning issues 6860 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 6861 !jQuery.isXMLDoc( elem ) ) { 6862 6863 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 6864 destElements = getAll( clone ); 6865 srcElements = getAll( elem ); 6866 6867 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6868 fixInput( srcElements[ i ], destElements[ i ] ); 6869 } 6870 } 6871 6872 // Copy the events from the original to the clone 6873 if ( dataAndEvents ) { 6874 if ( deepDataAndEvents ) { 6875 srcElements = srcElements || getAll( elem ); 6876 destElements = destElements || getAll( clone ); 6877 6878 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6879 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 6880 } 6881 } else { 6882 cloneCopyEvent( elem, clone ); 6883 } 6884 } 6885 6886 // Preserve script evaluation history 6887 destElements = getAll( clone, "script" ); 6888 if ( destElements.length > 0 ) { 6889 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 6890 } 6891 6892 // Return the cloned set 6893 return clone; 6894 }, 6895 6896 cleanData: function( elems ) { 6897 var data, elem, type, 6898 special = jQuery.event.special, 6899 i = 0; 6900 6901 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 6902 if ( acceptData( elem ) ) { 6903 if ( ( data = elem[ dataPriv.expando ] ) ) { 6904 if ( data.events ) { 6905 for ( type in data.events ) { 6906 if ( special[ type ] ) { 6907 jQuery.event.remove( elem, type ); 6908 6909 // This is a shortcut to avoid jQuery.event.remove's overhead 6910 } else { 6911 jQuery.removeEvent( elem, type, data.handle ); 6912 } 6913 } 6914 } 6915 6916 // Support: Chrome <=35 - 45+ 6917 // Assign undefined instead of using delete, see Data#remove 6918 elem[ dataPriv.expando ] = undefined; 6919 } 6920 if ( elem[ dataUser.expando ] ) { 6921 6922 // Support: Chrome <=35 - 45+ 6923 // Assign undefined instead of using delete, see Data#remove 6924 elem[ dataUser.expando ] = undefined; 6925 } 6926 } 6927 } 6928 } 6929} ); 6930 6931jQuery.fn.extend( { 6932 detach: function( selector ) { 6933 return remove( this, selector, true ); 6934 }, 6935 6936 remove: function( selector ) { 6937 return remove( this, selector ); 6938 }, 6939 6940 text: function( value ) { 6941 return access( this, function( value ) { 6942 return value === undefined ? 6943 jQuery.text( this ) : 6944 this.empty().each( function() { 6945 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6946 this.textContent = value; 6947 } 6948 } ); 6949 }, null, value, arguments.length ); 6950 }, 6951 6952 append: function() { 6953 return domManip( this, arguments, function( elem ) { 6954 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6955 var target = manipulationTarget( this, elem ); 6956 target.appendChild( elem ); 6957 } 6958 } ); 6959 }, 6960 6961 prepend: function() { 6962 return domManip( this, arguments, function( elem ) { 6963 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6964 var target = manipulationTarget( this, elem ); 6965 target.insertBefore( elem, target.firstChild ); 6966 } 6967 } ); 6968 }, 6969 6970 before: function() { 6971 return domManip( this, arguments, function( elem ) { 6972 if ( this.parentNode ) { 6973 this.parentNode.insertBefore( elem, this ); 6974 } 6975 } ); 6976 }, 6977 6978 after: function() { 6979 return domManip( this, arguments, function( elem ) { 6980 if ( this.parentNode ) { 6981 this.parentNode.insertBefore( elem, this.nextSibling ); 6982 } 6983 } ); 6984 }, 6985 6986 empty: function() { 6987 var elem, 6988 i = 0; 6989 6990 for ( ; ( elem = this[ i ] ) != null; i++ ) { 6991 if ( elem.nodeType === 1 ) { 6992 6993 // Prevent memory leaks 6994 jQuery.cleanData( getAll( elem, false ) ); 6995 6996 // Remove any remaining nodes 6997 elem.textContent = ""; 6998 } 6999 } 7000 7001 return this; 7002 }, 7003 7004 clone: function( dataAndEvents, deepDataAndEvents ) { 7005 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 7006 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 7007 7008 return this.map( function() { 7009 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 7010 } ); 7011 }, 7012 7013 html: function( value ) { 7014 return access( this, function( value ) { 7015 var elem = this[ 0 ] || {}, 7016 i = 0, 7017 l = this.length; 7018 7019 if ( value === undefined && elem.nodeType === 1 ) { 7020 return elem.innerHTML; 7021 } 7022 7023 // See if we can take a shortcut and just use innerHTML 7024 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 7025 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 7026 7027 value = jQuery.htmlPrefilter( value ); 7028 7029 try { 7030 for ( ; i < l; i++ ) { 7031 elem = this[ i ] || {}; 7032 7033 // Remove element nodes and prevent memory leaks 7034 if ( elem.nodeType === 1 ) { 7035 jQuery.cleanData( getAll( elem, false ) ); 7036 elem.innerHTML = value; 7037 } 7038 } 7039 7040 elem = 0; 7041 7042 // If using innerHTML throws an exception, use the fallback method 7043 } catch ( e ) {} 7044 } 7045 7046 if ( elem ) { 7047 this.empty().append( value ); 7048 } 7049 }, null, value, arguments.length ); 7050 }, 7051 7052 replaceWith: function() { 7053 var ignored = []; 7054 7055 // Make the changes, replacing each non-ignored context element with the new content 7056 return domManip( this, arguments, function( elem ) { 7057 var parent = this.parentNode; 7058 7059 if ( jQuery.inArray( this, ignored ) < 0 ) { 7060 jQuery.cleanData( getAll( this ) ); 7061 if ( parent ) { 7062 parent.replaceChild( elem, this ); 7063 } 7064 } 7065 7066 // Force callback invocation 7067 }, ignored ); 7068 } 7069} ); 7070 7071jQuery.each( { 7072 appendTo: "append", 7073 prependTo: "prepend", 7074 insertBefore: "before", 7075 insertAfter: "after", 7076 replaceAll: "replaceWith" 7077}, function( name, original ) { 7078 jQuery.fn[ name ] = function( selector ) { 7079 var elems, 7080 ret = [], 7081 insert = jQuery( selector ), 7082 last = insert.length - 1, 7083 i = 0; 7084 7085 for ( ; i <= last; i++ ) { 7086 elems = i === last ? this : this.clone( true ); 7087 jQuery( insert[ i ] )[ original ]( elems ); 7088 7089 // Support: Android <=4.0 only, PhantomJS 1 only 7090 // .get() because push.apply(_, arraylike) throws on ancient WebKit 7091 push.apply( ret, elems.get() ); 7092 } 7093 7094 return this.pushStack( ret ); 7095 }; 7096} ); 7097var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 7098 7099var getStyles = function( elem ) { 7100 7101 // Support: IE <=11 only, Firefox <=30 (#15098, #14150) 7102 // IE throws on elements created in popups 7103 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 7104 var view = elem.ownerDocument.defaultView; 7105 7106 if ( !view || !view.opener ) { 7107 view = window; 7108 } 7109 7110 return view.getComputedStyle( elem ); 7111 }; 7112 7113var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 7114 7115 7116 7117( function() { 7118 7119 // Executing both pixelPosition & boxSizingReliable tests require only one layout 7120 // so they're executed at the same time to save the second computation. 7121 function computeStyleTests() { 7122 7123 // This is a singleton, we need to execute it only once 7124 if ( !div ) { 7125 return; 7126 } 7127 7128 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 7129 "margin-top:1px;padding:0;border:0"; 7130 div.style.cssText = 7131 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 7132 "margin:auto;border:1px;padding:1px;" + 7133 "width:60%;top:1%"; 7134 documentElement.appendChild( container ).appendChild( div ); 7135 7136 var divStyle = window.getComputedStyle( div ); 7137 pixelPositionVal = divStyle.top !== "1%"; 7138 7139 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 7140 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 7141 7142 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 7143 // Some styles come back with percentage values, even though they shouldn't 7144 div.style.right = "60%"; 7145 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 7146 7147 // Support: IE 9 - 11 only 7148 // Detect misreporting of content dimensions for box-sizing:border-box elements 7149 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 7150 7151 // Support: IE 9 only 7152 // Detect overflow:scroll screwiness (gh-3699) 7153 // Support: Chrome <=64 7154 // Don't get tricked when zoom affects offsetWidth (gh-4029) 7155 div.style.position = "absolute"; 7156 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 7157 7158 documentElement.removeChild( container ); 7159 7160 // Nullify the div so it wouldn't be stored in the memory and 7161 // it will also be a sign that checks already performed 7162 div = null; 7163 } 7164 7165 function roundPixelMeasures( measure ) { 7166 return Math.round( parseFloat( measure ) ); 7167 } 7168 7169 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 7170 reliableMarginLeftVal, 7171 container = document.createElement( "div" ), 7172 div = document.createElement( "div" ); 7173 7174 // Finish early in limited (non-browser) environments 7175 if ( !div.style ) { 7176 return; 7177 } 7178 7179 // Support: IE <=9 - 11 only 7180 // Style of cloned element affects source element cloned (#8908) 7181 div.style.backgroundClip = "content-box"; 7182 div.cloneNode( true ).style.backgroundClip = ""; 7183 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 7184 7185 jQuery.extend( support, { 7186 boxSizingReliable: function() { 7187 computeStyleTests(); 7188 return boxSizingReliableVal; 7189 }, 7190 pixelBoxStyles: function() { 7191 computeStyleTests(); 7192 return pixelBoxStylesVal; 7193 }, 7194 pixelPosition: function() { 7195 computeStyleTests(); 7196 return pixelPositionVal; 7197 }, 7198 reliableMarginLeft: function() { 7199 computeStyleTests(); 7200 return reliableMarginLeftVal; 7201 }, 7202 scrollboxSize: function() { 7203 computeStyleTests(); 7204 return scrollboxSizeVal; 7205 } 7206 } ); 7207} )(); 7208 7209 7210function curCSS( elem, name, computed ) { 7211 var width, minWidth, maxWidth, ret, 7212 7213 // Support: Firefox 51+ 7214 // Retrieving style before computed somehow 7215 // fixes an issue with getting wrong values 7216 // on detached elements 7217 style = elem.style; 7218 7219 computed = computed || getStyles( elem ); 7220 7221 // getPropertyValue is needed for: 7222 // .css('filter') (IE 9 only, #12537) 7223 // .css('--customProperty) (#3144) 7224 if ( computed ) { 7225 ret = computed.getPropertyValue( name ) || computed[ name ]; 7226 7227 if ( ret === "" && !isAttached( elem ) ) { 7228 ret = jQuery.style( elem, name ); 7229 } 7230 7231 // A tribute to the "awesome hack by Dean Edwards" 7232 // Android Browser returns percentage for some values, 7233 // but width seems to be reliably pixels. 7234 // This is against the CSSOM draft spec: 7235 // https://drafts.csswg.org/cssom/#resolved-values 7236 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 7237 7238 // Remember the original values 7239 width = style.width; 7240 minWidth = style.minWidth; 7241 maxWidth = style.maxWidth; 7242 7243 // Put in the new values to get a computed value out 7244 style.minWidth = style.maxWidth = style.width = ret; 7245 ret = computed.width; 7246 7247 // Revert the changed values 7248 style.width = width; 7249 style.minWidth = minWidth; 7250 style.maxWidth = maxWidth; 7251 } 7252 } 7253 7254 return ret !== undefined ? 7255 7256 // Support: IE <=9 - 11 only 7257 // IE returns zIndex value as an integer. 7258 ret + "" : 7259 ret; 7260} 7261 7262 7263function addGetHookIf( conditionFn, hookFn ) { 7264 7265 // Define the hook, we'll check on the first run if it's really needed. 7266 return { 7267 get: function() { 7268 if ( conditionFn() ) { 7269 7270 // Hook not needed (or it's not possible to use it due 7271 // to missing dependency), remove it. 7272 delete this.get; 7273 return; 7274 } 7275 7276 // Hook needed; redefine it so that the support test is not executed again. 7277 return ( this.get = hookFn ).apply( this, arguments ); 7278 } 7279 }; 7280} 7281 7282 7283var cssPrefixes = [ "Webkit", "Moz", "ms" ], 7284 emptyStyle = document.createElement( "div" ).style, 7285 vendorProps = {}; 7286 7287// Return a vendor-prefixed property or undefined 7288function vendorPropName( name ) { 7289 7290 // Check for vendor prefixed names 7291 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 7292 i = cssPrefixes.length; 7293 7294 while ( i-- ) { 7295 name = cssPrefixes[ i ] + capName; 7296 if ( name in emptyStyle ) { 7297 return name; 7298 } 7299 } 7300} 7301 7302// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 7303function finalPropName( name ) { 7304 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 7305 7306 if ( final ) { 7307 return final; 7308 } 7309 if ( name in emptyStyle ) { 7310 return name; 7311 } 7312 return vendorProps[ name ] = vendorPropName( name ) || name; 7313} 7314 7315 7316var 7317 7318 // Swappable if display is none or starts with table 7319 // except "table", "table-cell", or "table-caption" 7320 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 7321 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 7322 rcustomProp = /^--/, 7323 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 7324 cssNormalTransform = { 7325 letterSpacing: "0", 7326 fontWeight: "400" 7327 }; 7328 7329function setPositiveNumber( elem, value, subtract ) { 7330 7331 // Any relative (+/-) values have already been 7332 // normalized at this point 7333 var matches = rcssNum.exec( value ); 7334 return matches ? 7335 7336 // Guard against undefined "subtract", e.g., when used as in cssHooks 7337 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 7338 value; 7339} 7340 7341function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 7342 var i = dimension === "width" ? 1 : 0, 7343 extra = 0, 7344 delta = 0; 7345 7346 // Adjustment may not be necessary 7347 if ( box === ( isBorderBox ? "border" : "content" ) ) { 7348 return 0; 7349 } 7350 7351 for ( ; i < 4; i += 2 ) { 7352 7353 // Both box models exclude margin 7354 if ( box === "margin" ) { 7355 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 7356 } 7357 7358 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 7359 if ( !isBorderBox ) { 7360 7361 // Add padding 7362 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 7363 7364 // For "border" or "margin", add border 7365 if ( box !== "padding" ) { 7366 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 7367 7368 // But still keep track of it otherwise 7369 } else { 7370 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 7371 } 7372 7373 // If we get here with a border-box (content + padding + border), we're seeking "content" or 7374 // "padding" or "margin" 7375 } else { 7376 7377 // For "content", subtract padding 7378 if ( box === "content" ) { 7379 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 7380 } 7381 7382 // For "content" or "padding", subtract border 7383 if ( box !== "margin" ) { 7384 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 7385 } 7386 } 7387 } 7388 7389 // Account for positive content-box scroll gutter when requested by providing computedVal 7390 if ( !isBorderBox && computedVal >= 0 ) { 7391 7392 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 7393 // Assuming integer scroll gutter, subtract the rest and round down 7394 delta += Math.max( 0, Math.ceil( 7395 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 7396 computedVal - 7397 delta - 7398 extra - 7399 0.5 7400 7401 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 7402 // Use an explicit zero to avoid NaN (gh-3964) 7403 ) ) || 0; 7404 } 7405 7406 return delta; 7407} 7408 7409function getWidthOrHeight( elem, dimension, extra ) { 7410 7411 // Start with computed style 7412 var styles = getStyles( elem ), 7413 7414 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 7415 // Fake content-box until we know it's needed to know the true value. 7416 boxSizingNeeded = !support.boxSizingReliable() || extra, 7417 isBorderBox = boxSizingNeeded && 7418 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 7419 valueIsBorderBox = isBorderBox, 7420 7421 val = curCSS( elem, dimension, styles ), 7422 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 7423 7424 // Support: Firefox <=54 7425 // Return a confounding non-pixel value or feign ignorance, as appropriate. 7426 if ( rnumnonpx.test( val ) ) { 7427 if ( !extra ) { 7428 return val; 7429 } 7430 val = "auto"; 7431 } 7432 7433 7434 // Fall back to offsetWidth/offsetHeight when value is "auto" 7435 // This happens for inline elements with no explicit setting (gh-3571) 7436 // Support: Android <=4.1 - 4.3 only 7437 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 7438 // Support: IE 9-11 only 7439 // Also use offsetWidth/offsetHeight for when box sizing is unreliable 7440 // We use getClientRects() to check for hidden/disconnected. 7441 // In those cases, the computed value can be trusted to be border-box 7442 if ( ( !support.boxSizingReliable() && isBorderBox || 7443 val === "auto" || 7444 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 7445 elem.getClientRects().length ) { 7446 7447 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 7448 7449 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 7450 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 7451 // retrieved value as a content box dimension. 7452 valueIsBorderBox = offsetProp in elem; 7453 if ( valueIsBorderBox ) { 7454 val = elem[ offsetProp ]; 7455 } 7456 } 7457 7458 // Normalize "" and auto 7459 val = parseFloat( val ) || 0; 7460 7461 // Adjust for the element's box model 7462 return ( val + 7463 boxModelAdjustment( 7464 elem, 7465 dimension, 7466 extra || ( isBorderBox ? "border" : "content" ), 7467 valueIsBorderBox, 7468 styles, 7469 7470 // Provide the current computed size to request scroll gutter calculation (gh-3589) 7471 val 7472 ) 7473 ) + "px"; 7474} 7475 7476jQuery.extend( { 7477 7478 // Add in style property hooks for overriding the default 7479 // behavior of getting and setting a style property 7480 cssHooks: { 7481 opacity: { 7482 get: function( elem, computed ) { 7483 if ( computed ) { 7484 7485 // We should always get a number back from opacity 7486 var ret = curCSS( elem, "opacity" ); 7487 return ret === "" ? "1" : ret; 7488 } 7489 } 7490 } 7491 }, 7492 7493 // Don't automatically add "px" to these possibly-unitless properties 7494 cssNumber: { 7495 "animationIterationCount": true, 7496 "columnCount": true, 7497 "fillOpacity": true, 7498 "flexGrow": true, 7499 "flexShrink": true, 7500 "fontWeight": true, 7501 "gridArea": true, 7502 "gridColumn": true, 7503 "gridColumnEnd": true, 7504 "gridColumnStart": true, 7505 "gridRow": true, 7506 "gridRowEnd": true, 7507 "gridRowStart": true, 7508 "lineHeight": true, 7509 "opacity": true, 7510 "order": true, 7511 "orphans": true, 7512 "widows": true, 7513 "zIndex": true, 7514 "zoom": true 7515 }, 7516 7517 // Add in properties whose names you wish to fix before 7518 // setting or getting the value 7519 cssProps: {}, 7520 7521 // Get and set the style property on a DOM Node 7522 style: function( elem, name, value, extra ) { 7523 7524 // Don't set styles on text and comment nodes 7525 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 7526 return; 7527 } 7528 7529 // Make sure that we're working with the right name 7530 var ret, type, hooks, 7531 origName = camelCase( name ), 7532 isCustomProp = rcustomProp.test( name ), 7533 style = elem.style; 7534 7535 // Make sure that we're working with the right name. We don't 7536 // want to query the value if it is a CSS custom property 7537 // since they are user-defined. 7538 if ( !isCustomProp ) { 7539 name = finalPropName( origName ); 7540 } 7541 7542 // Gets hook for the prefixed version, then unprefixed version 7543 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 7544 7545 // Check if we're setting a value 7546 if ( value !== undefined ) { 7547 type = typeof value; 7548 7549 // Convert "+=" or "-=" to relative numbers (#7345) 7550 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 7551 value = adjustCSS( elem, name, ret ); 7552 7553 // Fixes bug #9237 7554 type = "number"; 7555 } 7556 7557 // Make sure that null and NaN values aren't set (#7116) 7558 if ( value == null || value !== value ) { 7559 return; 7560 } 7561 7562 // If a number was passed in, add the unit (except for certain CSS properties) 7563 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 7564 // "px" to a few hardcoded values. 7565 if ( type === "number" && !isCustomProp ) { 7566 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 7567 } 7568 7569 // background-* props affect original clone's values 7570 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 7571 style[ name ] = "inherit"; 7572 } 7573 7574 // If a hook was provided, use that value, otherwise just set the specified value 7575 if ( !hooks || !( "set" in hooks ) || 7576 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 7577 7578 if ( isCustomProp ) { 7579 style.setProperty( name, value ); 7580 } else { 7581 style[ name ] = value; 7582 } 7583 } 7584 7585 } else { 7586 7587 // If a hook was provided get the non-computed value from there 7588 if ( hooks && "get" in hooks && 7589 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 7590 7591 return ret; 7592 } 7593 7594 // Otherwise just get the value from the style object 7595 return style[ name ]; 7596 } 7597 }, 7598 7599 css: function( elem, name, extra, styles ) { 7600 var val, num, hooks, 7601 origName = camelCase( name ), 7602 isCustomProp = rcustomProp.test( name ); 7603 7604 // Make sure that we're working with the right name. We don't 7605 // want to modify the value if it is a CSS custom property 7606 // since they are user-defined. 7607 if ( !isCustomProp ) { 7608 name = finalPropName( origName ); 7609 } 7610 7611 // Try prefixed name followed by the unprefixed name 7612 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 7613 7614 // If a hook was provided get the computed value from there 7615 if ( hooks && "get" in hooks ) { 7616 val = hooks.get( elem, true, extra ); 7617 } 7618 7619 // Otherwise, if a way to get the computed value exists, use that 7620 if ( val === undefined ) { 7621 val = curCSS( elem, name, styles ); 7622 } 7623 7624 // Convert "normal" to computed value 7625 if ( val === "normal" && name in cssNormalTransform ) { 7626 val = cssNormalTransform[ name ]; 7627 } 7628 7629 // Make numeric if forced or a qualifier was provided and val looks numeric 7630 if ( extra === "" || extra ) { 7631 num = parseFloat( val ); 7632 return extra === true || isFinite( num ) ? num || 0 : val; 7633 } 7634 7635 return val; 7636 } 7637} ); 7638 7639jQuery.each( [ "height", "width" ], function( i, dimension ) { 7640 jQuery.cssHooks[ dimension ] = { 7641 get: function( elem, computed, extra ) { 7642 if ( computed ) { 7643 7644 // Certain elements can have dimension info if we invisibly show them 7645 // but it must have a current display style that would benefit 7646 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 7647 7648 // Support: Safari 8+ 7649 // Table columns in Safari have non-zero offsetWidth & zero 7650 // getBoundingClientRect().width unless display is changed. 7651 // Support: IE <=11 only 7652 // Running getBoundingClientRect on a disconnected node 7653 // in IE throws an error. 7654 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 7655 swap( elem, cssShow, function() { 7656 return getWidthOrHeight( elem, dimension, extra ); 7657 } ) : 7658 getWidthOrHeight( elem, dimension, extra ); 7659 } 7660 }, 7661 7662 set: function( elem, value, extra ) { 7663 var matches, 7664 styles = getStyles( elem ), 7665 7666 // Only read styles.position if the test has a chance to fail 7667 // to avoid forcing a reflow. 7668 scrollboxSizeBuggy = !support.scrollboxSize() && 7669 styles.position === "absolute", 7670 7671 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 7672 boxSizingNeeded = scrollboxSizeBuggy || extra, 7673 isBorderBox = boxSizingNeeded && 7674 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 7675 subtract = extra ? 7676 boxModelAdjustment( 7677 elem, 7678 dimension, 7679 extra, 7680 isBorderBox, 7681 styles 7682 ) : 7683 0; 7684 7685 // Account for unreliable border-box dimensions by comparing offset* to computed and 7686 // faking a content-box to get border and padding (gh-3699) 7687 if ( isBorderBox && scrollboxSizeBuggy ) { 7688 subtract -= Math.ceil( 7689 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 7690 parseFloat( styles[ dimension ] ) - 7691 boxModelAdjustment( elem, dimension, "border", false, styles ) - 7692 0.5 7693 ); 7694 } 7695 7696 // Convert to pixels if value adjustment is needed 7697 if ( subtract && ( matches = rcssNum.exec( value ) ) && 7698 ( matches[ 3 ] || "px" ) !== "px" ) { 7699 7700 elem.style[ dimension ] = value; 7701 value = jQuery.css( elem, dimension ); 7702 } 7703 7704 return setPositiveNumber( elem, value, subtract ); 7705 } 7706 }; 7707} ); 7708 7709jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 7710 function( elem, computed ) { 7711 if ( computed ) { 7712 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 7713 elem.getBoundingClientRect().left - 7714 swap( elem, { marginLeft: 0 }, function() { 7715 return elem.getBoundingClientRect().left; 7716 } ) 7717 ) + "px"; 7718 } 7719 } 7720); 7721 7722// These hooks are used by animate to expand properties 7723jQuery.each( { 7724 margin: "", 7725 padding: "", 7726 border: "Width" 7727}, function( prefix, suffix ) { 7728 jQuery.cssHooks[ prefix + suffix ] = { 7729 expand: function( value ) { 7730 var i = 0, 7731 expanded = {}, 7732 7733 // Assumes a single number if not a string 7734 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 7735 7736 for ( ; i < 4; i++ ) { 7737 expanded[ prefix + cssExpand[ i ] + suffix ] = 7738 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 7739 } 7740 7741 return expanded; 7742 } 7743 }; 7744 7745 if ( prefix !== "margin" ) { 7746 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 7747 } 7748} ); 7749 7750jQuery.fn.extend( { 7751 css: function( name, value ) { 7752 return access( this, function( elem, name, value ) { 7753 var styles, len, 7754 map = {}, 7755 i = 0; 7756 7757 if ( Array.isArray( name ) ) { 7758 styles = getStyles( elem ); 7759 len = name.length; 7760 7761 for ( ; i < len; i++ ) { 7762 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 7763 } 7764 7765 return map; 7766 } 7767 7768 return value !== undefined ? 7769 jQuery.style( elem, name, value ) : 7770 jQuery.css( elem, name ); 7771 }, name, value, arguments.length > 1 ); 7772 } 7773} ); 7774 7775 7776function Tween( elem, options, prop, end, easing ) { 7777 return new Tween.prototype.init( elem, options, prop, end, easing ); 7778} 7779jQuery.Tween = Tween; 7780 7781Tween.prototype = { 7782 constructor: Tween, 7783 init: function( elem, options, prop, end, easing, unit ) { 7784 this.elem = elem; 7785 this.prop = prop; 7786 this.easing = easing || jQuery.easing._default; 7787 this.options = options; 7788 this.start = this.now = this.cur(); 7789 this.end = end; 7790 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 7791 }, 7792 cur: function() { 7793 var hooks = Tween.propHooks[ this.prop ]; 7794 7795 return hooks && hooks.get ? 7796 hooks.get( this ) : 7797 Tween.propHooks._default.get( this ); 7798 }, 7799 run: function( percent ) { 7800 var eased, 7801 hooks = Tween.propHooks[ this.prop ]; 7802 7803 if ( this.options.duration ) { 7804 this.pos = eased = jQuery.easing[ this.easing ]( 7805 percent, this.options.duration * percent, 0, 1, this.options.duration 7806 ); 7807 } else { 7808 this.pos = eased = percent; 7809 } 7810 this.now = ( this.end - this.start ) * eased + this.start; 7811 7812 if ( this.options.step ) { 7813 this.options.step.call( this.elem, this.now, this ); 7814 } 7815 7816 if ( hooks && hooks.set ) { 7817 hooks.set( this ); 7818 } else { 7819 Tween.propHooks._default.set( this ); 7820 } 7821 return this; 7822 } 7823}; 7824 7825Tween.prototype.init.prototype = Tween.prototype; 7826 7827Tween.propHooks = { 7828 _default: { 7829 get: function( tween ) { 7830 var result; 7831 7832 // Use a property on the element directly when it is not a DOM element, 7833 // or when there is no matching style property that exists. 7834 if ( tween.elem.nodeType !== 1 || 7835 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 7836 return tween.elem[ tween.prop ]; 7837 } 7838 7839 // Passing an empty string as a 3rd parameter to .css will automatically 7840 // attempt a parseFloat and fallback to a string if the parse fails. 7841 // Simple values such as "10px" are parsed to Float; 7842 // complex values such as "rotate(1rad)" are returned as-is. 7843 result = jQuery.css( tween.elem, tween.prop, "" ); 7844 7845 // Empty strings, null, undefined and "auto" are converted to 0. 7846 return !result || result === "auto" ? 0 : result; 7847 }, 7848 set: function( tween ) { 7849 7850 // Use step hook for back compat. 7851 // Use cssHook if its there. 7852 // Use .style if available and use plain properties where available. 7853 if ( jQuery.fx.step[ tween.prop ] ) { 7854 jQuery.fx.step[ tween.prop ]( tween ); 7855 } else if ( tween.elem.nodeType === 1 && ( 7856 jQuery.cssHooks[ tween.prop ] || 7857 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { 7858 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 7859 } else { 7860 tween.elem[ tween.prop ] = tween.now; 7861 } 7862 } 7863 } 7864}; 7865 7866// Support: IE <=9 only 7867// Panic based approach to setting things on disconnected nodes 7868Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 7869 set: function( tween ) { 7870 if ( tween.elem.nodeType && tween.elem.parentNode ) { 7871 tween.elem[ tween.prop ] = tween.now; 7872 } 7873 } 7874}; 7875 7876jQuery.easing = { 7877 linear: function( p ) { 7878 return p; 7879 }, 7880 swing: function( p ) { 7881 return 0.5 - Math.cos( p * Math.PI ) / 2; 7882 }, 7883 _default: "swing" 7884}; 7885 7886jQuery.fx = Tween.prototype.init; 7887 7888// Back compat <1.8 extension point 7889jQuery.fx.step = {}; 7890 7891 7892 7893 7894var 7895 fxNow, inProgress, 7896 rfxtypes = /^(?:toggle|show|hide)$/, 7897 rrun = /queueHooks$/; 7898 7899function schedule() { 7900 if ( inProgress ) { 7901 if ( document.hidden === false && window.requestAnimationFrame ) { 7902 window.requestAnimationFrame( schedule ); 7903 } else { 7904 window.setTimeout( schedule, jQuery.fx.interval ); 7905 } 7906 7907 jQuery.fx.tick(); 7908 } 7909} 7910 7911// Animations created synchronously will run synchronously 7912function createFxNow() { 7913 window.setTimeout( function() { 7914 fxNow = undefined; 7915 } ); 7916 return ( fxNow = Date.now() ); 7917} 7918 7919// Generate parameters to create a standard animation 7920function genFx( type, includeWidth ) { 7921 var which, 7922 i = 0, 7923 attrs = { height: type }; 7924 7925 // If we include width, step value is 1 to do all cssExpand values, 7926 // otherwise step value is 2 to skip over Left and Right 7927 includeWidth = includeWidth ? 1 : 0; 7928 for ( ; i < 4; i += 2 - includeWidth ) { 7929 which = cssExpand[ i ]; 7930 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 7931 } 7932 7933 if ( includeWidth ) { 7934 attrs.opacity = attrs.width = type; 7935 } 7936 7937 return attrs; 7938} 7939 7940function createTween( value, prop, animation ) { 7941 var tween, 7942 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 7943 index = 0, 7944 length = collection.length; 7945 for ( ; index < length; index++ ) { 7946 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 7947 7948 // We're done with this property 7949 return tween; 7950 } 7951 } 7952} 7953 7954function defaultPrefilter( elem, props, opts ) { 7955 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 7956 isBox = "width" in props || "height" in props, 7957 anim = this, 7958 orig = {}, 7959 style = elem.style, 7960 hidden = elem.nodeType && isHiddenWithinTree( elem ), 7961 dataShow = dataPriv.get( elem, "fxshow" ); 7962 7963 // Queue-skipping animations hijack the fx hooks 7964 if ( !opts.queue ) { 7965 hooks = jQuery._queueHooks( elem, "fx" ); 7966 if ( hooks.unqueued == null ) { 7967 hooks.unqueued = 0; 7968 oldfire = hooks.empty.fire; 7969 hooks.empty.fire = function() { 7970 if ( !hooks.unqueued ) { 7971 oldfire(); 7972 } 7973 }; 7974 } 7975 hooks.unqueued++; 7976 7977 anim.always( function() { 7978 7979 // Ensure the complete handler is called before this completes 7980 anim.always( function() { 7981 hooks.unqueued--; 7982 if ( !jQuery.queue( elem, "fx" ).length ) { 7983 hooks.empty.fire(); 7984 } 7985 } ); 7986 } ); 7987 } 7988 7989 // Detect show/hide animations 7990 for ( prop in props ) { 7991 value = props[ prop ]; 7992 if ( rfxtypes.test( value ) ) { 7993 delete props[ prop ]; 7994 toggle = toggle || value === "toggle"; 7995 if ( value === ( hidden ? "hide" : "show" ) ) { 7996 7997 // Pretend to be hidden if this is a "show" and 7998 // there is still data from a stopped show/hide 7999 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 8000 hidden = true; 8001 8002 // Ignore all other no-op show/hide data 8003 } else { 8004 continue; 8005 } 8006 } 8007 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 8008 } 8009 } 8010 8011 // Bail out if this is a no-op like .hide().hide() 8012 propTween = !jQuery.isEmptyObject( props ); 8013 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 8014 return; 8015 } 8016 8017 // Restrict "overflow" and "display" styles during box animations 8018 if ( isBox && elem.nodeType === 1 ) { 8019 8020 // Support: IE <=9 - 11, Edge 12 - 15 8021 // Record all 3 overflow attributes because IE does not infer the shorthand 8022 // from identically-valued overflowX and overflowY and Edge just mirrors 8023 // the overflowX value there. 8024 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 8025 8026 // Identify a display type, preferring old show/hide data over the CSS cascade 8027 restoreDisplay = dataShow && dataShow.display; 8028 if ( restoreDisplay == null ) { 8029 restoreDisplay = dataPriv.get( elem, "display" ); 8030 } 8031 display = jQuery.css( elem, "display" ); 8032 if ( display === "none" ) { 8033 if ( restoreDisplay ) { 8034 display = restoreDisplay; 8035 } else { 8036 8037 // Get nonempty value(s) by temporarily forcing visibility 8038 showHide( [ elem ], true ); 8039 restoreDisplay = elem.style.display || restoreDisplay; 8040 display = jQuery.css( elem, "display" ); 8041 showHide( [ elem ] ); 8042 } 8043 } 8044 8045 // Animate inline elements as inline-block 8046 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 8047 if ( jQuery.css( elem, "float" ) === "none" ) { 8048 8049 // Restore the original display value at the end of pure show/hide animations 8050 if ( !propTween ) { 8051 anim.done( function() { 8052 style.display = restoreDisplay; 8053 } ); 8054 if ( restoreDisplay == null ) { 8055 display = style.display; 8056 restoreDisplay = display === "none" ? "" : display; 8057 } 8058 } 8059 style.display = "inline-block"; 8060 } 8061 } 8062 } 8063 8064 if ( opts.overflow ) { 8065 style.overflow = "hidden"; 8066 anim.always( function() { 8067 style.overflow = opts.overflow[ 0 ]; 8068 style.overflowX = opts.overflow[ 1 ]; 8069 style.overflowY = opts.overflow[ 2 ]; 8070 } ); 8071 } 8072 8073 // Implement show/hide animations 8074 propTween = false; 8075 for ( prop in orig ) { 8076 8077 // General show/hide setup for this element animation 8078 if ( !propTween ) { 8079 if ( dataShow ) { 8080 if ( "hidden" in dataShow ) { 8081 hidden = dataShow.hidden; 8082 } 8083 } else { 8084 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 8085 } 8086 8087 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 8088 if ( toggle ) { 8089 dataShow.hidden = !hidden; 8090 } 8091 8092 // Show elements before animating them 8093 if ( hidden ) { 8094 showHide( [ elem ], true ); 8095 } 8096 8097 /* eslint-disable no-loop-func */ 8098 8099 anim.done( function() { 8100 8101 /* eslint-enable no-loop-func */ 8102 8103 // The final step of a "hide" animation is actually hiding the element 8104 if ( !hidden ) { 8105 showHide( [ elem ] ); 8106 } 8107 dataPriv.remove( elem, "fxshow" ); 8108 for ( prop in orig ) { 8109 jQuery.style( elem, prop, orig[ prop ] ); 8110 } 8111 } ); 8112 } 8113 8114 // Per-property setup 8115 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 8116 if ( !( prop in dataShow ) ) { 8117 dataShow[ prop ] = propTween.start; 8118 if ( hidden ) { 8119 propTween.end = propTween.start; 8120 propTween.start = 0; 8121 } 8122 } 8123 } 8124} 8125 8126function propFilter( props, specialEasing ) { 8127 var index, name, easing, value, hooks; 8128 8129 // camelCase, specialEasing and expand cssHook pass 8130 for ( index in props ) { 8131 name = camelCase( index ); 8132 easing = specialEasing[ name ]; 8133 value = props[ index ]; 8134 if ( Array.isArray( value ) ) { 8135 easing = value[ 1 ]; 8136 value = props[ index ] = value[ 0 ]; 8137 } 8138 8139 if ( index !== name ) { 8140 props[ name ] = value; 8141 delete props[ index ]; 8142 } 8143 8144 hooks = jQuery.cssHooks[ name ]; 8145 if ( hooks && "expand" in hooks ) { 8146 value = hooks.expand( value ); 8147 delete props[ name ]; 8148 8149 // Not quite $.extend, this won't overwrite existing keys. 8150 // Reusing 'index' because we have the correct "name" 8151 for ( index in value ) { 8152 if ( !( index in props ) ) { 8153 props[ index ] = value[ index ]; 8154 specialEasing[ index ] = easing; 8155 } 8156 } 8157 } else { 8158 specialEasing[ name ] = easing; 8159 } 8160 } 8161} 8162 8163function Animation( elem, properties, options ) { 8164 var result, 8165 stopped, 8166 index = 0, 8167 length = Animation.prefilters.length, 8168 deferred = jQuery.Deferred().always( function() { 8169 8170 // Don't match elem in the :animated selector 8171 delete tick.elem; 8172 } ), 8173 tick = function() { 8174 if ( stopped ) { 8175 return false; 8176 } 8177 var currentTime = fxNow || createFxNow(), 8178 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 8179 8180 // Support: Android 2.3 only 8181 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) 8182 temp = remaining / animation.duration || 0, 8183 percent = 1 - temp, 8184 index = 0, 8185 length = animation.tweens.length; 8186 8187 for ( ; index < length; index++ ) { 8188 animation.tweens[ index ].run( percent ); 8189 } 8190 8191 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 8192 8193 // If there's more to do, yield 8194 if ( percent < 1 && length ) { 8195 return remaining; 8196 } 8197 8198 // If this was an empty animation, synthesize a final progress notification 8199 if ( !length ) { 8200 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 8201 } 8202 8203 // Resolve the animation and report its conclusion 8204 deferred.resolveWith( elem, [ animation ] ); 8205 return false; 8206 }, 8207 animation = deferred.promise( { 8208 elem: elem, 8209 props: jQuery.extend( {}, properties ), 8210 opts: jQuery.extend( true, { 8211 specialEasing: {}, 8212 easing: jQuery.easing._default 8213 }, options ), 8214 originalProperties: properties, 8215 originalOptions: options, 8216 startTime: fxNow || createFxNow(), 8217 duration: options.duration, 8218 tweens: [], 8219 createTween: function( prop, end ) { 8220 var tween = jQuery.Tween( elem, animation.opts, prop, end, 8221 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 8222 animation.tweens.push( tween ); 8223 return tween; 8224 }, 8225 stop: function( gotoEnd ) { 8226 var index = 0, 8227 8228 // If we are going to the end, we want to run all the tweens 8229 // otherwise we skip this part 8230 length = gotoEnd ? animation.tweens.length : 0; 8231 if ( stopped ) { 8232 return this; 8233 } 8234 stopped = true; 8235 for ( ; index < length; index++ ) { 8236 animation.tweens[ index ].run( 1 ); 8237 } 8238 8239 // Resolve when we played the last frame; otherwise, reject 8240 if ( gotoEnd ) { 8241 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 8242 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 8243 } else { 8244 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 8245 } 8246 return this; 8247 } 8248 } ), 8249 props = animation.props; 8250 8251 propFilter( props, animation.opts.specialEasing ); 8252 8253 for ( ; index < length; index++ ) { 8254 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 8255 if ( result ) { 8256 if ( isFunction( result.stop ) ) { 8257 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 8258 result.stop.bind( result ); 8259 } 8260 return result; 8261 } 8262 } 8263 8264 jQuery.map( props, createTween, animation ); 8265 8266 if ( isFunction( animation.opts.start ) ) { 8267 animation.opts.start.call( elem, animation ); 8268 } 8269 8270 // Attach callbacks from options 8271 animation 8272 .progress( animation.opts.progress ) 8273 .done( animation.opts.done, animation.opts.complete ) 8274 .fail( animation.opts.fail ) 8275 .always( animation.opts.always ); 8276 8277 jQuery.fx.timer( 8278 jQuery.extend( tick, { 8279 elem: elem, 8280 anim: animation, 8281 queue: animation.opts.queue 8282 } ) 8283 ); 8284 8285 return animation; 8286} 8287 8288jQuery.Animation = jQuery.extend( Animation, { 8289 8290 tweeners: { 8291 "*": [ function( prop, value ) { 8292 var tween = this.createTween( prop, value ); 8293 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 8294 return tween; 8295 } ] 8296 }, 8297 8298 tweener: function( props, callback ) { 8299 if ( isFunction( props ) ) { 8300 callback = props; 8301 props = [ "*" ]; 8302 } else { 8303 props = props.match( rnothtmlwhite ); 8304 } 8305 8306 var prop, 8307 index = 0, 8308 length = props.length; 8309 8310 for ( ; index < length; index++ ) { 8311 prop = props[ index ]; 8312 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 8313 Animation.tweeners[ prop ].unshift( callback ); 8314 } 8315 }, 8316 8317 prefilters: [ defaultPrefilter ], 8318 8319 prefilter: function( callback, prepend ) { 8320 if ( prepend ) { 8321 Animation.prefilters.unshift( callback ); 8322 } else { 8323 Animation.prefilters.push( callback ); 8324 } 8325 } 8326} ); 8327 8328jQuery.speed = function( speed, easing, fn ) { 8329 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 8330 complete: fn || !fn && easing || 8331 isFunction( speed ) && speed, 8332 duration: speed, 8333 easing: fn && easing || easing && !isFunction( easing ) && easing 8334 }; 8335 8336 // Go to the end state if fx are off 8337 if ( jQuery.fx.off ) { 8338 opt.duration = 0; 8339 8340 } else { 8341 if ( typeof opt.duration !== "number" ) { 8342 if ( opt.duration in jQuery.fx.speeds ) { 8343 opt.duration = jQuery.fx.speeds[ opt.duration ]; 8344 8345 } else { 8346 opt.duration = jQuery.fx.speeds._default; 8347 } 8348 } 8349 } 8350 8351 // Normalize opt.queue - true/undefined/null -> "fx" 8352 if ( opt.queue == null || opt.queue === true ) { 8353 opt.queue = "fx"; 8354 } 8355 8356 // Queueing 8357 opt.old = opt.complete; 8358 8359 opt.complete = function() { 8360 if ( isFunction( opt.old ) ) { 8361 opt.old.call( this ); 8362 } 8363 8364 if ( opt.queue ) { 8365 jQuery.dequeue( this, opt.queue ); 8366 } 8367 }; 8368 8369 return opt; 8370}; 8371 8372jQuery.fn.extend( { 8373 fadeTo: function( speed, to, easing, callback ) { 8374 8375 // Show any hidden elements after setting opacity to 0 8376 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 8377 8378 // Animate to the value specified 8379 .end().animate( { opacity: to }, speed, easing, callback ); 8380 }, 8381 animate: function( prop, speed, easing, callback ) { 8382 var empty = jQuery.isEmptyObject( prop ), 8383 optall = jQuery.speed( speed, easing, callback ), 8384 doAnimation = function() { 8385 8386 // Operate on a copy of prop so per-property easing won't be lost 8387 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 8388 8389 // Empty animations, or finishing resolves immediately 8390 if ( empty || dataPriv.get( this, "finish" ) ) { 8391 anim.stop( true ); 8392 } 8393 }; 8394 doAnimation.finish = doAnimation; 8395 8396 return empty || optall.queue === false ? 8397 this.each( doAnimation ) : 8398 this.queue( optall.queue, doAnimation ); 8399 }, 8400 stop: function( type, clearQueue, gotoEnd ) { 8401 var stopQueue = function( hooks ) { 8402 var stop = hooks.stop; 8403 delete hooks.stop; 8404 stop( gotoEnd ); 8405 }; 8406 8407 if ( typeof type !== "string" ) { 8408 gotoEnd = clearQueue; 8409 clearQueue = type; 8410 type = undefined; 8411 } 8412 if ( clearQueue && type !== false ) { 8413 this.queue( type || "fx", [] ); 8414 } 8415 8416 return this.each( function() { 8417 var dequeue = true, 8418 index = type != null && type + "queueHooks", 8419 timers = jQuery.timers, 8420 data = dataPriv.get( this ); 8421 8422 if ( index ) { 8423 if ( data[ index ] && data[ index ].stop ) { 8424 stopQueue( data[ index ] ); 8425 } 8426 } else { 8427 for ( index in data ) { 8428 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 8429 stopQueue( data[ index ] ); 8430 } 8431 } 8432 } 8433 8434 for ( index = timers.length; index--; ) { 8435 if ( timers[ index ].elem === this && 8436 ( type == null || timers[ index ].queue === type ) ) { 8437 8438 timers[ index ].anim.stop( gotoEnd ); 8439 dequeue = false; 8440 timers.splice( index, 1 ); 8441 } 8442 } 8443 8444 // Start the next in the queue if the last step wasn't forced. 8445 // Timers currently will call their complete callbacks, which 8446 // will dequeue but only if they were gotoEnd. 8447 if ( dequeue || !gotoEnd ) { 8448 jQuery.dequeue( this, type ); 8449 } 8450 } ); 8451 }, 8452 finish: function( type ) { 8453 if ( type !== false ) { 8454 type = type || "fx"; 8455 } 8456 return this.each( function() { 8457 var index, 8458 data = dataPriv.get( this ), 8459 queue = data[ type + "queue" ], 8460 hooks = data[ type + "queueHooks" ], 8461 timers = jQuery.timers, 8462 length = queue ? queue.length : 0; 8463 8464 // Enable finishing flag on private data 8465 data.finish = true; 8466 8467 // Empty the queue first 8468 jQuery.queue( this, type, [] ); 8469 8470 if ( hooks && hooks.stop ) { 8471 hooks.stop.call( this, true ); 8472 } 8473 8474 // Look for any active animations, and finish them 8475 for ( index = timers.length; index--; ) { 8476 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 8477 timers[ index ].anim.stop( true ); 8478 timers.splice( index, 1 ); 8479 } 8480 } 8481 8482 // Look for any animations in the old queue and finish them 8483 for ( index = 0; index < length; index++ ) { 8484 if ( queue[ index ] && queue[ index ].finish ) { 8485 queue[ index ].finish.call( this ); 8486 } 8487 } 8488 8489 // Turn off finishing flag 8490 delete data.finish; 8491 } ); 8492 } 8493} ); 8494 8495jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { 8496 var cssFn = jQuery.fn[ name ]; 8497 jQuery.fn[ name ] = function( speed, easing, callback ) { 8498 return speed == null || typeof speed === "boolean" ? 8499 cssFn.apply( this, arguments ) : 8500 this.animate( genFx( name, true ), speed, easing, callback ); 8501 }; 8502} ); 8503 8504// Generate shortcuts for custom animations 8505jQuery.each( { 8506 slideDown: genFx( "show" ), 8507 slideUp: genFx( "hide" ), 8508 slideToggle: genFx( "toggle" ), 8509 fadeIn: { opacity: "show" }, 8510 fadeOut: { opacity: "hide" }, 8511 fadeToggle: { opacity: "toggle" } 8512}, function( name, props ) { 8513 jQuery.fn[ name ] = function( speed, easing, callback ) { 8514 return this.animate( props, speed, easing, callback ); 8515 }; 8516} ); 8517 8518jQuery.timers = []; 8519jQuery.fx.tick = function() { 8520 var timer, 8521 i = 0, 8522 timers = jQuery.timers; 8523 8524 fxNow = Date.now(); 8525 8526 for ( ; i < timers.length; i++ ) { 8527 timer = timers[ i ]; 8528 8529 // Run the timer and safely remove it when done (allowing for external removal) 8530 if ( !timer() && timers[ i ] === timer ) { 8531 timers.splice( i--, 1 ); 8532 } 8533 } 8534 8535 if ( !timers.length ) { 8536 jQuery.fx.stop(); 8537 } 8538 fxNow = undefined; 8539}; 8540 8541jQuery.fx.timer = function( timer ) { 8542 jQuery.timers.push( timer ); 8543 jQuery.fx.start(); 8544}; 8545 8546jQuery.fx.interval = 13; 8547jQuery.fx.start = function() { 8548 if ( inProgress ) { 8549 return; 8550 } 8551 8552 inProgress = true; 8553 schedule(); 8554}; 8555 8556jQuery.fx.stop = function() { 8557 inProgress = null; 8558}; 8559 8560jQuery.fx.speeds = { 8561 slow: 600, 8562 fast: 200, 8563 8564 // Default speed 8565 _default: 400 8566}; 8567 8568 8569// Based off of the plugin by Clint Helfers, with permission. 8570// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ 8571jQuery.fn.delay = function( time, type ) { 8572 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 8573 type = type || "fx"; 8574 8575 return this.queue( type, function( next, hooks ) { 8576 var timeout = window.setTimeout( next, time ); 8577 hooks.stop = function() { 8578 window.clearTimeout( timeout ); 8579 }; 8580 } ); 8581}; 8582 8583 8584( function() { 8585 var input = document.createElement( "input" ), 8586 select = document.createElement( "select" ), 8587 opt = select.appendChild( document.createElement( "option" ) ); 8588 8589 input.type = "checkbox"; 8590 8591 // Support: Android <=4.3 only 8592 // Default value for a checkbox should be "on" 8593 support.checkOn = input.value !== ""; 8594 8595 // Support: IE <=11 only 8596 // Must access selectedIndex to make default options select 8597 support.optSelected = opt.selected; 8598 8599 // Support: IE <=11 only 8600 // An input loses its value after becoming a radio 8601 input = document.createElement( "input" ); 8602 input.value = "t"; 8603 input.type = "radio"; 8604 support.radioValue = input.value === "t"; 8605} )(); 8606 8607 8608var boolHook, 8609 attrHandle = jQuery.expr.attrHandle; 8610 8611jQuery.fn.extend( { 8612 attr: function( name, value ) { 8613 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 8614 }, 8615 8616 removeAttr: function( name ) { 8617 return this.each( function() { 8618 jQuery.removeAttr( this, name ); 8619 } ); 8620 } 8621} ); 8622 8623jQuery.extend( { 8624 attr: function( elem, name, value ) { 8625 var ret, hooks, 8626 nType = elem.nodeType; 8627 8628 // Don't get/set attributes on text, comment and attribute nodes 8629 if ( nType === 3 || nType === 8 || nType === 2 ) { 8630 return; 8631 } 8632 8633 // Fallback to prop when attributes are not supported 8634 if ( typeof elem.getAttribute === "undefined" ) { 8635 return jQuery.prop( elem, name, value ); 8636 } 8637 8638 // Attribute hooks are determined by the lowercase version 8639 // Grab necessary hook if one is defined 8640 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8641 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 8642 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 8643 } 8644 8645 if ( value !== undefined ) { 8646 if ( value === null ) { 8647 jQuery.removeAttr( elem, name ); 8648 return; 8649 } 8650 8651 if ( hooks && "set" in hooks && 8652 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8653 return ret; 8654 } 8655 8656 elem.setAttribute( name, value + "" ); 8657 return value; 8658 } 8659 8660 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8661 return ret; 8662 } 8663 8664 ret = jQuery.find.attr( elem, name ); 8665 8666 // Non-existent attributes return null, we normalize to undefined 8667 return ret == null ? undefined : ret; 8668 }, 8669 8670 attrHooks: { 8671 type: { 8672 set: function( elem, value ) { 8673 if ( !support.radioValue && value === "radio" && 8674 nodeName( elem, "input" ) ) { 8675 var val = elem.value; 8676 elem.setAttribute( "type", value ); 8677 if ( val ) { 8678 elem.value = val; 8679 } 8680 return value; 8681 } 8682 } 8683 } 8684 }, 8685 8686 removeAttr: function( elem, value ) { 8687 var name, 8688 i = 0, 8689 8690 // Attribute names can contain non-HTML whitespace characters 8691 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 8692 attrNames = value && value.match( rnothtmlwhite ); 8693 8694 if ( attrNames && elem.nodeType === 1 ) { 8695 while ( ( name = attrNames[ i++ ] ) ) { 8696 elem.removeAttribute( name ); 8697 } 8698 } 8699 } 8700} ); 8701 8702// Hooks for boolean attributes 8703boolHook = { 8704 set: function( elem, value, name ) { 8705 if ( value === false ) { 8706 8707 // Remove boolean attributes when set to false 8708 jQuery.removeAttr( elem, name ); 8709 } else { 8710 elem.setAttribute( name, name ); 8711 } 8712 return name; 8713 } 8714}; 8715 8716jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { 8717 var getter = attrHandle[ name ] || jQuery.find.attr; 8718 8719 attrHandle[ name ] = function( elem, name, isXML ) { 8720 var ret, handle, 8721 lowercaseName = name.toLowerCase(); 8722 8723 if ( !isXML ) { 8724 8725 // Avoid an infinite loop by temporarily removing this function from the getter 8726 handle = attrHandle[ lowercaseName ]; 8727 attrHandle[ lowercaseName ] = ret; 8728 ret = getter( elem, name, isXML ) != null ? 8729 lowercaseName : 8730 null; 8731 attrHandle[ lowercaseName ] = handle; 8732 } 8733 return ret; 8734 }; 8735} ); 8736 8737 8738 8739 8740var rfocusable = /^(?:input|select|textarea|button)$/i, 8741 rclickable = /^(?:a|area)$/i; 8742 8743jQuery.fn.extend( { 8744 prop: function( name, value ) { 8745 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 8746 }, 8747 8748 removeProp: function( name ) { 8749 return this.each( function() { 8750 delete this[ jQuery.propFix[ name ] || name ]; 8751 } ); 8752 } 8753} ); 8754 8755jQuery.extend( { 8756 prop: function( elem, name, value ) { 8757 var ret, hooks, 8758 nType = elem.nodeType; 8759 8760 // Don't get/set properties on text, comment and attribute nodes 8761 if ( nType === 3 || nType === 8 || nType === 2 ) { 8762 return; 8763 } 8764 8765 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8766 8767 // Fix name and attach hooks 8768 name = jQuery.propFix[ name ] || name; 8769 hooks = jQuery.propHooks[ name ]; 8770 } 8771 8772 if ( value !== undefined ) { 8773 if ( hooks && "set" in hooks && 8774 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8775 return ret; 8776 } 8777 8778 return ( elem[ name ] = value ); 8779 } 8780 8781 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8782 return ret; 8783 } 8784 8785 return elem[ name ]; 8786 }, 8787 8788 propHooks: { 8789 tabIndex: { 8790 get: function( elem ) { 8791 8792 // Support: IE <=9 - 11 only 8793 // elem.tabIndex doesn't always return the 8794 // correct value when it hasn't been explicitly set 8795 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 8796 // Use proper attribute retrieval(#12072) 8797 var tabindex = jQuery.find.attr( elem, "tabindex" ); 8798 8799 if ( tabindex ) { 8800 return parseInt( tabindex, 10 ); 8801 } 8802 8803 if ( 8804 rfocusable.test( elem.nodeName ) || 8805 rclickable.test( elem.nodeName ) && 8806 elem.href 8807 ) { 8808 return 0; 8809 } 8810 8811 return -1; 8812 } 8813 } 8814 }, 8815 8816 propFix: { 8817 "for": "htmlFor", 8818 "class": "className" 8819 } 8820} ); 8821 8822// Support: IE <=11 only 8823// Accessing the selectedIndex property 8824// forces the browser to respect setting selected 8825// on the option 8826// The getter ensures a default option is selected 8827// when in an optgroup 8828// eslint rule "no-unused-expressions" is disabled for this code 8829// since it considers such accessions noop 8830if ( !support.optSelected ) { 8831 jQuery.propHooks.selected = { 8832 get: function( elem ) { 8833 8834 /* eslint no-unused-expressions: "off" */ 8835 8836 var parent = elem.parentNode; 8837 if ( parent && parent.parentNode ) { 8838 parent.parentNode.selectedIndex; 8839 } 8840 return null; 8841 }, 8842 set: function( elem ) { 8843 8844 /* eslint no-unused-expressions: "off" */ 8845 8846 var parent = elem.parentNode; 8847 if ( parent ) { 8848 parent.selectedIndex; 8849 8850 if ( parent.parentNode ) { 8851 parent.parentNode.selectedIndex; 8852 } 8853 } 8854 } 8855 }; 8856} 8857 8858jQuery.each( [ 8859 "tabIndex", 8860 "readOnly", 8861 "maxLength", 8862 "cellSpacing", 8863 "cellPadding", 8864 "rowSpan", 8865 "colSpan", 8866 "useMap", 8867 "frameBorder", 8868 "contentEditable" 8869], function() { 8870 jQuery.propFix[ this.toLowerCase() ] = this; 8871} ); 8872 8873 8874 8875 8876 // Strip and collapse whitespace according to HTML spec 8877 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 8878 function stripAndCollapse( value ) { 8879 var tokens = value.match( rnothtmlwhite ) || []; 8880 return tokens.join( " " ); 8881 } 8882 8883 8884function getClass( elem ) { 8885 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 8886} 8887 8888function classesToArray( value ) { 8889 if ( Array.isArray( value ) ) { 8890 return value; 8891 } 8892 if ( typeof value === "string" ) { 8893 return value.match( rnothtmlwhite ) || []; 8894 } 8895 return []; 8896} 8897 8898jQuery.fn.extend( { 8899 addClass: function( value ) { 8900 var classes, elem, cur, curValue, clazz, j, finalValue, 8901 i = 0; 8902 8903 if ( isFunction( value ) ) { 8904 return this.each( function( j ) { 8905 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 8906 } ); 8907 } 8908 8909 classes = classesToArray( value ); 8910 8911 if ( classes.length ) { 8912 while ( ( elem = this[ i++ ] ) ) { 8913 curValue = getClass( elem ); 8914 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8915 8916 if ( cur ) { 8917 j = 0; 8918 while ( ( clazz = classes[ j++ ] ) ) { 8919 if ( cur.indexOf( " " + clazz + " " ) < 0 ) { 8920 cur += clazz + " "; 8921 } 8922 } 8923 8924 // Only assign if different to avoid unneeded rendering. 8925 finalValue = stripAndCollapse( cur ); 8926 if ( curValue !== finalValue ) { 8927 elem.setAttribute( "class", finalValue ); 8928 } 8929 } 8930 } 8931 } 8932 8933 return this; 8934 }, 8935 8936 removeClass: function( value ) { 8937 var classes, elem, cur, curValue, clazz, j, finalValue, 8938 i = 0; 8939 8940 if ( isFunction( value ) ) { 8941 return this.each( function( j ) { 8942 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 8943 } ); 8944 } 8945 8946 if ( !arguments.length ) { 8947 return this.attr( "class", "" ); 8948 } 8949 8950 classes = classesToArray( value ); 8951 8952 if ( classes.length ) { 8953 while ( ( elem = this[ i++ ] ) ) { 8954 curValue = getClass( elem ); 8955 8956 // This expression is here for better compressibility (see addClass) 8957 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8958 8959 if ( cur ) { 8960 j = 0; 8961 while ( ( clazz = classes[ j++ ] ) ) { 8962 8963 // Remove *all* instances 8964 while ( cur.indexOf( " " + clazz + " " ) > -1 ) { 8965 cur = cur.replace( " " + clazz + " ", " " ); 8966 } 8967 } 8968 8969 // Only assign if different to avoid unneeded rendering. 8970 finalValue = stripAndCollapse( cur ); 8971 if ( curValue !== finalValue ) { 8972 elem.setAttribute( "class", finalValue ); 8973 } 8974 } 8975 } 8976 } 8977 8978 return this; 8979 }, 8980 8981 toggleClass: function( value, stateVal ) { 8982 var type = typeof value, 8983 isValidValue = type === "string" || Array.isArray( value ); 8984 8985 if ( typeof stateVal === "boolean" && isValidValue ) { 8986 return stateVal ? this.addClass( value ) : this.removeClass( value ); 8987 } 8988 8989 if ( isFunction( value ) ) { 8990 return this.each( function( i ) { 8991 jQuery( this ).toggleClass( 8992 value.call( this, i, getClass( this ), stateVal ), 8993 stateVal 8994 ); 8995 } ); 8996 } 8997 8998 return this.each( function() { 8999 var className, i, self, classNames; 9000 9001 if ( isValidValue ) { 9002 9003 // Toggle individual class names 9004 i = 0; 9005 self = jQuery( this ); 9006 classNames = classesToArray( value ); 9007 9008 while ( ( className = classNames[ i++ ] ) ) { 9009 9010 // Check each className given, space separated list 9011 if ( self.hasClass( className ) ) { 9012 self.removeClass( className ); 9013 } else { 9014 self.addClass( className ); 9015 } 9016 } 9017 9018 // Toggle whole class name 9019 } else if ( value === undefined || type === "boolean" ) { 9020 className = getClass( this ); 9021 if ( className ) { 9022 9023 // Store className if set 9024 dataPriv.set( this, "__className__", className ); 9025 } 9026 9027 // If the element has a class name or if we're passed `false`, 9028 // then remove the whole classname (if there was one, the above saved it). 9029 // Otherwise bring back whatever was previously saved (if anything), 9030 // falling back to the empty string if nothing was stored. 9031 if ( this.setAttribute ) { 9032 this.setAttribute( "class", 9033 className || value === false ? 9034 "" : 9035 dataPriv.get( this, "__className__" ) || "" 9036 ); 9037 } 9038 } 9039 } ); 9040 }, 9041 9042 hasClass: function( selector ) { 9043 var className, elem, 9044 i = 0; 9045 9046 className = " " + selector + " "; 9047 while ( ( elem = this[ i++ ] ) ) { 9048 if ( elem.nodeType === 1 && 9049 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 9050 return true; 9051 } 9052 } 9053 9054 return false; 9055 } 9056} ); 9057 9058 9059 9060 9061var rreturn = /\r/g; 9062 9063jQuery.fn.extend( { 9064 val: function( value ) { 9065 var hooks, ret, valueIsFunction, 9066 elem = this[ 0 ]; 9067 9068 if ( !arguments.length ) { 9069 if ( elem ) { 9070 hooks = jQuery.valHooks[ elem.type ] || 9071 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 9072 9073 if ( hooks && 9074 "get" in hooks && 9075 ( ret = hooks.get( elem, "value" ) ) !== undefined 9076 ) { 9077 return ret; 9078 } 9079 9080 ret = elem.value; 9081 9082 // Handle most common string cases 9083 if ( typeof ret === "string" ) { 9084 return ret.replace( rreturn, "" ); 9085 } 9086 9087 // Handle cases where value is null/undef or number 9088 return ret == null ? "" : ret; 9089 } 9090 9091 return; 9092 } 9093 9094 valueIsFunction = isFunction( value ); 9095 9096 return this.each( function( i ) { 9097 var val; 9098 9099 if ( this.nodeType !== 1 ) { 9100 return; 9101 } 9102 9103 if ( valueIsFunction ) { 9104 val = value.call( this, i, jQuery( this ).val() ); 9105 } else { 9106 val = value; 9107 } 9108 9109 // Treat null/undefined as ""; convert numbers to string 9110 if ( val == null ) { 9111 val = ""; 9112 9113 } else if ( typeof val === "number" ) { 9114 val += ""; 9115 9116 } else if ( Array.isArray( val ) ) { 9117 val = jQuery.map( val, function( value ) { 9118 return value == null ? "" : value + ""; 9119 } ); 9120 } 9121 9122 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 9123 9124 // If set returns undefined, fall back to normal setting 9125 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 9126 this.value = val; 9127 } 9128 } ); 9129 } 9130} ); 9131 9132jQuery.extend( { 9133 valHooks: { 9134 option: { 9135 get: function( elem ) { 9136 9137 var val = jQuery.find.attr( elem, "value" ); 9138 return val != null ? 9139 val : 9140 9141 // Support: IE <=10 - 11 only 9142 // option.text throws exceptions (#14686, #14858) 9143 // Strip and collapse whitespace 9144 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 9145 stripAndCollapse( jQuery.text( elem ) ); 9146 } 9147 }, 9148 select: { 9149 get: function( elem ) { 9150 var value, option, i, 9151 options = elem.options, 9152 index = elem.selectedIndex, 9153 one = elem.type === "select-one", 9154 values = one ? null : [], 9155 max = one ? index + 1 : options.length; 9156 9157 if ( index < 0 ) { 9158 i = max; 9159 9160 } else { 9161 i = one ? index : 0; 9162 } 9163 9164 // Loop through all the selected options 9165 for ( ; i < max; i++ ) { 9166 option = options[ i ]; 9167 9168 // Support: IE <=9 only 9169 // IE8-9 doesn't update selected after form reset (#2551) 9170 if ( ( option.selected || i === index ) && 9171 9172 // Don't return options that are disabled or in a disabled optgroup 9173 !option.disabled && 9174 ( !option.parentNode.disabled || 9175 !nodeName( option.parentNode, "optgroup" ) ) ) { 9176 9177 // Get the specific value for the option 9178 value = jQuery( option ).val(); 9179 9180 // We don't need an array for one selects 9181 if ( one ) { 9182 return value; 9183 } 9184 9185 // Multi-Selects return an array 9186 values.push( value ); 9187 } 9188 } 9189 9190 return values; 9191 }, 9192 9193 set: function( elem, value ) { 9194 var optionSet, option, 9195 options = elem.options, 9196 values = jQuery.makeArray( value ), 9197 i = options.length; 9198 9199 while ( i-- ) { 9200 option = options[ i ]; 9201 9202 /* eslint-disable no-cond-assign */ 9203 9204 if ( option.selected = 9205 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 9206 ) { 9207 optionSet = true; 9208 } 9209 9210 /* eslint-enable no-cond-assign */ 9211 } 9212 9213 // Force browsers to behave consistently when non-matching value is set 9214 if ( !optionSet ) { 9215 elem.selectedIndex = -1; 9216 } 9217 return values; 9218 } 9219 } 9220 } 9221} ); 9222 9223// Radios and checkboxes getter/setter 9224jQuery.each( [ "radio", "checkbox" ], function() { 9225 jQuery.valHooks[ this ] = { 9226 set: function( elem, value ) { 9227 if ( Array.isArray( value ) ) { 9228 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 9229 } 9230 } 9231 }; 9232 if ( !support.checkOn ) { 9233 jQuery.valHooks[ this ].get = function( elem ) { 9234 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 9235 }; 9236 } 9237} ); 9238 9239 9240 9241 9242// Return jQuery for attributes-only inclusion 9243 9244 9245support.focusin = "onfocusin" in window; 9246 9247 9248var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 9249 stopPropagationCallback = function( e ) { 9250 e.stopPropagation(); 9251 }; 9252 9253jQuery.extend( jQuery.event, { 9254 9255 trigger: function( event, data, elem, onlyHandlers ) { 9256 9257 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 9258 eventPath = [ elem || document ], 9259 type = hasOwn.call( event, "type" ) ? event.type : event, 9260 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 9261 9262 cur = lastElement = tmp = elem = elem || document; 9263 9264 // Don't do events on text and comment nodes 9265 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 9266 return; 9267 } 9268 9269 // focus/blur morphs to focusin/out; ensure we're not firing them right now 9270 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 9271 return; 9272 } 9273 9274 if ( type.indexOf( "." ) > -1 ) { 9275 9276 // Namespaced trigger; create a regexp to match event type in handle() 9277 namespaces = type.split( "." ); 9278 type = namespaces.shift(); 9279 namespaces.sort(); 9280 } 9281 ontype = type.indexOf( ":" ) < 0 && "on" + type; 9282 9283 // Caller can pass in a jQuery.Event object, Object, or just an event type string 9284 event = event[ jQuery.expando ] ? 9285 event : 9286 new jQuery.Event( type, typeof event === "object" && event ); 9287 9288 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 9289 event.isTrigger = onlyHandlers ? 2 : 3; 9290 event.namespace = namespaces.join( "." ); 9291 event.rnamespace = event.namespace ? 9292 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 9293 null; 9294 9295 // Clean up the event in case it is being reused 9296 event.result = undefined; 9297 if ( !event.target ) { 9298 event.target = elem; 9299 } 9300 9301 // Clone any incoming data and prepend the event, creating the handler arg list 9302 data = data == null ? 9303 [ event ] : 9304 jQuery.makeArray( data, [ event ] ); 9305 9306 // Allow special events to draw outside the lines 9307 special = jQuery.event.special[ type ] || {}; 9308 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 9309 return; 9310 } 9311 9312 // Determine event propagation path in advance, per W3C events spec (#9951) 9313 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 9314 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 9315 9316 bubbleType = special.delegateType || type; 9317 if ( !rfocusMorph.test( bubbleType + type ) ) { 9318 cur = cur.parentNode; 9319 } 9320 for ( ; cur; cur = cur.parentNode ) { 9321 eventPath.push( cur ); 9322 tmp = cur; 9323 } 9324 9325 // Only add window if we got to document (e.g., not plain obj or detached DOM) 9326 if ( tmp === ( elem.ownerDocument || document ) ) { 9327 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 9328 } 9329 } 9330 9331 // Fire handlers on the event path 9332 i = 0; 9333 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 9334 lastElement = cur; 9335 event.type = i > 1 ? 9336 bubbleType : 9337 special.bindType || type; 9338 9339 // jQuery handler 9340 handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && 9341 dataPriv.get( cur, "handle" ); 9342 if ( handle ) { 9343 handle.apply( cur, data ); 9344 } 9345 9346 // Native handler 9347 handle = ontype && cur[ ontype ]; 9348 if ( handle && handle.apply && acceptData( cur ) ) { 9349 event.result = handle.apply( cur, data ); 9350 if ( event.result === false ) { 9351 event.preventDefault(); 9352 } 9353 } 9354 } 9355 event.type = type; 9356 9357 // If nobody prevented the default action, do it now 9358 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 9359 9360 if ( ( !special._default || 9361 special._default.apply( eventPath.pop(), data ) === false ) && 9362 acceptData( elem ) ) { 9363 9364 // Call a native DOM method on the target with the same name as the event. 9365 // Don't do default actions on window, that's where global variables be (#6170) 9366 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 9367 9368 // Don't re-trigger an onFOO event when we call its FOO() method 9369 tmp = elem[ ontype ]; 9370 9371 if ( tmp ) { 9372 elem[ ontype ] = null; 9373 } 9374 9375 // Prevent re-triggering of the same event, since we already bubbled it above 9376 jQuery.event.triggered = type; 9377 9378 if ( event.isPropagationStopped() ) { 9379 lastElement.addEventListener( type, stopPropagationCallback ); 9380 } 9381 9382 elem[ type ](); 9383 9384 if ( event.isPropagationStopped() ) { 9385 lastElement.removeEventListener( type, stopPropagationCallback ); 9386 } 9387 9388 jQuery.event.triggered = undefined; 9389 9390 if ( tmp ) { 9391 elem[ ontype ] = tmp; 9392 } 9393 } 9394 } 9395 } 9396 9397 return event.result; 9398 }, 9399 9400 // Piggyback on a donor event to simulate a different one 9401 // Used only for `focus(in | out)` events 9402 simulate: function( type, elem, event ) { 9403 var e = jQuery.extend( 9404 new jQuery.Event(), 9405 event, 9406 { 9407 type: type, 9408 isSimulated: true 9409 } 9410 ); 9411 9412 jQuery.event.trigger( e, null, elem ); 9413 } 9414 9415} ); 9416 9417jQuery.fn.extend( { 9418 9419 trigger: function( type, data ) { 9420 return this.each( function() { 9421 jQuery.event.trigger( type, data, this ); 9422 } ); 9423 }, 9424 triggerHandler: function( type, data ) { 9425 var elem = this[ 0 ]; 9426 if ( elem ) { 9427 return jQuery.event.trigger( type, data, elem, true ); 9428 } 9429 } 9430} ); 9431 9432 9433// Support: Firefox <=44 9434// Firefox doesn't have focus(in | out) events 9435// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 9436// 9437// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 9438// focus(in | out) events fire after focus & blur events, 9439// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 9440// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 9441if ( !support.focusin ) { 9442 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { 9443 9444 // Attach a single capturing handler on the document while someone wants focusin/focusout 9445 var handler = function( event ) { 9446 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); 9447 }; 9448 9449 jQuery.event.special[ fix ] = { 9450 setup: function() { 9451 var doc = this.ownerDocument || this, 9452 attaches = dataPriv.access( doc, fix ); 9453 9454 if ( !attaches ) { 9455 doc.addEventListener( orig, handler, true ); 9456 } 9457 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); 9458 }, 9459 teardown: function() { 9460 var doc = this.ownerDocument || this, 9461 attaches = dataPriv.access( doc, fix ) - 1; 9462 9463 if ( !attaches ) { 9464 doc.removeEventListener( orig, handler, true ); 9465 dataPriv.remove( doc, fix ); 9466 9467 } else { 9468 dataPriv.access( doc, fix, attaches ); 9469 } 9470 } 9471 }; 9472 } ); 9473} 9474var location = window.location; 9475 9476var nonce = Date.now(); 9477 9478var rquery = ( /\?/ ); 9479 9480 9481 9482// Cross-browser xml parsing 9483jQuery.parseXML = function( data ) { 9484 var xml; 9485 if ( !data || typeof data !== "string" ) { 9486 return null; 9487 } 9488 9489 // Support: IE 9 - 11 only 9490 // IE throws on parseFromString with invalid input. 9491 try { 9492 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 9493 } catch ( e ) { 9494 xml = undefined; 9495 } 9496 9497 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { 9498 jQuery.error( "Invalid XML: " + data ); 9499 } 9500 return xml; 9501}; 9502 9503 9504var 9505 rbracket = /\[\]$/, 9506 rCRLF = /\r?\n/g, 9507 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 9508 rsubmittable = /^(?:input|select|textarea|keygen)/i; 9509 9510function buildParams( prefix, obj, traditional, add ) { 9511 var name; 9512 9513 if ( Array.isArray( obj ) ) { 9514 9515 // Serialize array item. 9516 jQuery.each( obj, function( i, v ) { 9517 if ( traditional || rbracket.test( prefix ) ) { 9518 9519 // Treat each array item as a scalar. 9520 add( prefix, v ); 9521 9522 } else { 9523 9524 // Item is non-scalar (array or object), encode its numeric index. 9525 buildParams( 9526 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 9527 v, 9528 traditional, 9529 add 9530 ); 9531 } 9532 } ); 9533 9534 } else if ( !traditional && toType( obj ) === "object" ) { 9535 9536 // Serialize object item. 9537 for ( name in obj ) { 9538 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 9539 } 9540 9541 } else { 9542 9543 // Serialize scalar item. 9544 add( prefix, obj ); 9545 } 9546} 9547 9548// Serialize an array of form elements or a set of 9549// key/values into a query string 9550jQuery.param = function( a, traditional ) { 9551 var prefix, 9552 s = [], 9553 add = function( key, valueOrFunction ) { 9554 9555 // If value is a function, invoke it and use its return value 9556 var value = isFunction( valueOrFunction ) ? 9557 valueOrFunction() : 9558 valueOrFunction; 9559 9560 s[ s.length ] = encodeURIComponent( key ) + "=" + 9561 encodeURIComponent( value == null ? "" : value ); 9562 }; 9563 9564 if ( a == null ) { 9565 return ""; 9566 } 9567 9568 // If an array was passed in, assume that it is an array of form elements. 9569 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 9570 9571 // Serialize the form elements 9572 jQuery.each( a, function() { 9573 add( this.name, this.value ); 9574 } ); 9575 9576 } else { 9577 9578 // If traditional, encode the "old" way (the way 1.3.2 or older 9579 // did it), otherwise encode params recursively. 9580 for ( prefix in a ) { 9581 buildParams( prefix, a[ prefix ], traditional, add ); 9582 } 9583 } 9584 9585 // Return the resulting serialization 9586 return s.join( "&" ); 9587}; 9588 9589jQuery.fn.extend( { 9590 serialize: function() { 9591 return jQuery.param( this.serializeArray() ); 9592 }, 9593 serializeArray: function() { 9594 return this.map( function() { 9595 9596 // Can add propHook for "elements" to filter or add form elements 9597 var elements = jQuery.prop( this, "elements" ); 9598 return elements ? jQuery.makeArray( elements ) : this; 9599 } ) 9600 .filter( function() { 9601 var type = this.type; 9602 9603 // Use .is( ":disabled" ) so that fieldset[disabled] works 9604 return this.name && !jQuery( this ).is( ":disabled" ) && 9605 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 9606 ( this.checked || !rcheckableType.test( type ) ); 9607 } ) 9608 .map( function( i, elem ) { 9609 var val = jQuery( this ).val(); 9610 9611 if ( val == null ) { 9612 return null; 9613 } 9614 9615 if ( Array.isArray( val ) ) { 9616 return jQuery.map( val, function( val ) { 9617 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 9618 } ); 9619 } 9620 9621 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 9622 } ).get(); 9623 } 9624} ); 9625 9626 9627var 9628 r20 = /%20/g, 9629 rhash = /#.*$/, 9630 rantiCache = /([?&])_=[^&]*/, 9631 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 9632 9633 // #7653, #8125, #8152: local protocol detection 9634 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 9635 rnoContent = /^(?:GET|HEAD)$/, 9636 rprotocol = /^\/\//, 9637 9638 /* Prefilters 9639 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 9640 * 2) These are called: 9641 * - BEFORE asking for a transport 9642 * - AFTER param serialization (s.data is a string if s.processData is true) 9643 * 3) key is the dataType 9644 * 4) the catchall symbol "*" can be used 9645 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 9646 */ 9647 prefilters = {}, 9648 9649 /* Transports bindings 9650 * 1) key is the dataType 9651 * 2) the catchall symbol "*" can be used 9652 * 3) selection will start with transport dataType and THEN go to "*" if needed 9653 */ 9654 transports = {}, 9655 9656 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 9657 allTypes = "*/".concat( "*" ), 9658 9659 // Anchor tag for parsing the document origin 9660 originAnchor = document.createElement( "a" ); 9661 originAnchor.href = location.href; 9662 9663// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 9664function addToPrefiltersOrTransports( structure ) { 9665 9666 // dataTypeExpression is optional and defaults to "*" 9667 return function( dataTypeExpression, func ) { 9668 9669 if ( typeof dataTypeExpression !== "string" ) { 9670 func = dataTypeExpression; 9671 dataTypeExpression = "*"; 9672 } 9673 9674 var dataType, 9675 i = 0, 9676 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 9677 9678 if ( isFunction( func ) ) { 9679 9680 // For each dataType in the dataTypeExpression 9681 while ( ( dataType = dataTypes[ i++ ] ) ) { 9682 9683 // Prepend if requested 9684 if ( dataType[ 0 ] === "+" ) { 9685 dataType = dataType.slice( 1 ) || "*"; 9686 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 9687 9688 // Otherwise append 9689 } else { 9690 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 9691 } 9692 } 9693 } 9694 }; 9695} 9696 9697// Base inspection function for prefilters and transports 9698function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 9699 9700 var inspected = {}, 9701 seekingTransport = ( structure === transports ); 9702 9703 function inspect( dataType ) { 9704 var selected; 9705 inspected[ dataType ] = true; 9706 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 9707 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 9708 if ( typeof dataTypeOrTransport === "string" && 9709 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 9710 9711 options.dataTypes.unshift( dataTypeOrTransport ); 9712 inspect( dataTypeOrTransport ); 9713 return false; 9714 } else if ( seekingTransport ) { 9715 return !( selected = dataTypeOrTransport ); 9716 } 9717 } ); 9718 return selected; 9719 } 9720 9721 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 9722} 9723 9724// A special extend for ajax options 9725// that takes "flat" options (not to be deep extended) 9726// Fixes #9887 9727function ajaxExtend( target, src ) { 9728 var key, deep, 9729 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 9730 9731 for ( key in src ) { 9732 if ( src[ key ] !== undefined ) { 9733 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 9734 } 9735 } 9736 if ( deep ) { 9737 jQuery.extend( true, target, deep ); 9738 } 9739 9740 return target; 9741} 9742 9743/* Handles responses to an ajax request: 9744 * - finds the right dataType (mediates between content-type and expected dataType) 9745 * - returns the corresponding response 9746 */ 9747function ajaxHandleResponses( s, jqXHR, responses ) { 9748 9749 var ct, type, finalDataType, firstDataType, 9750 contents = s.contents, 9751 dataTypes = s.dataTypes; 9752 9753 // Remove auto dataType and get content-type in the process 9754 while ( dataTypes[ 0 ] === "*" ) { 9755 dataTypes.shift(); 9756 if ( ct === undefined ) { 9757 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 9758 } 9759 } 9760 9761 // Check if we're dealing with a known content-type 9762 if ( ct ) { 9763 for ( type in contents ) { 9764 if ( contents[ type ] && contents[ type ].test( ct ) ) { 9765 dataTypes.unshift( type ); 9766 break; 9767 } 9768 } 9769 } 9770 9771 // Check to see if we have a response for the expected dataType 9772 if ( dataTypes[ 0 ] in responses ) { 9773 finalDataType = dataTypes[ 0 ]; 9774 } else { 9775 9776 // Try convertible dataTypes 9777 for ( type in responses ) { 9778 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 9779 finalDataType = type; 9780 break; 9781 } 9782 if ( !firstDataType ) { 9783 firstDataType = type; 9784 } 9785 } 9786 9787 // Or just use first one 9788 finalDataType = finalDataType || firstDataType; 9789 } 9790 9791 // If we found a dataType 9792 // We add the dataType to the list if needed 9793 // and return the corresponding response 9794 if ( finalDataType ) { 9795 if ( finalDataType !== dataTypes[ 0 ] ) { 9796 dataTypes.unshift( finalDataType ); 9797 } 9798 return responses[ finalDataType ]; 9799 } 9800} 9801 9802/* Chain conversions given the request and the original response 9803 * Also sets the responseXXX fields on the jqXHR instance 9804 */ 9805function ajaxConvert( s, response, jqXHR, isSuccess ) { 9806 var conv2, current, conv, tmp, prev, 9807 converters = {}, 9808 9809 // Work with a copy of dataTypes in case we need to modify it for conversion 9810 dataTypes = s.dataTypes.slice(); 9811 9812 // Create converters map with lowercased keys 9813 if ( dataTypes[ 1 ] ) { 9814 for ( conv in s.converters ) { 9815 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 9816 } 9817 } 9818 9819 current = dataTypes.shift(); 9820 9821 // Convert to each sequential dataType 9822 while ( current ) { 9823 9824 if ( s.responseFields[ current ] ) { 9825 jqXHR[ s.responseFields[ current ] ] = response; 9826 } 9827 9828 // Apply the dataFilter if provided 9829 if ( !prev && isSuccess && s.dataFilter ) { 9830 response = s.dataFilter( response, s.dataType ); 9831 } 9832 9833 prev = current; 9834 current = dataTypes.shift(); 9835 9836 if ( current ) { 9837 9838 // There's only work to do if current dataType is non-auto 9839 if ( current === "*" ) { 9840 9841 current = prev; 9842 9843 // Convert response if prev dataType is non-auto and differs from current 9844 } else if ( prev !== "*" && prev !== current ) { 9845 9846 // Seek a direct converter 9847 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 9848 9849 // If none found, seek a pair 9850 if ( !conv ) { 9851 for ( conv2 in converters ) { 9852 9853 // If conv2 outputs current 9854 tmp = conv2.split( " " ); 9855 if ( tmp[ 1 ] === current ) { 9856 9857 // If prev can be converted to accepted input 9858 conv = converters[ prev + " " + tmp[ 0 ] ] || 9859 converters[ "* " + tmp[ 0 ] ]; 9860 if ( conv ) { 9861 9862 // Condense equivalence converters 9863 if ( conv === true ) { 9864 conv = converters[ conv2 ]; 9865 9866 // Otherwise, insert the intermediate dataType 9867 } else if ( converters[ conv2 ] !== true ) { 9868 current = tmp[ 0 ]; 9869 dataTypes.unshift( tmp[ 1 ] ); 9870 } 9871 break; 9872 } 9873 } 9874 } 9875 } 9876 9877 // Apply converter (if not an equivalence) 9878 if ( conv !== true ) { 9879 9880 // Unless errors are allowed to bubble, catch and return them 9881 if ( conv && s.throws ) { 9882 response = conv( response ); 9883 } else { 9884 try { 9885 response = conv( response ); 9886 } catch ( e ) { 9887 return { 9888 state: "parsererror", 9889 error: conv ? e : "No conversion from " + prev + " to " + current 9890 }; 9891 } 9892 } 9893 } 9894 } 9895 } 9896 } 9897 9898 return { state: "success", data: response }; 9899} 9900 9901jQuery.extend( { 9902 9903 // Counter for holding the number of active queries 9904 active: 0, 9905 9906 // Last-Modified header cache for next request 9907 lastModified: {}, 9908 etag: {}, 9909 9910 ajaxSettings: { 9911 url: location.href, 9912 type: "GET", 9913 isLocal: rlocalProtocol.test( location.protocol ), 9914 global: true, 9915 processData: true, 9916 async: true, 9917 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 9918 9919 /* 9920 timeout: 0, 9921 data: null, 9922 dataType: null, 9923 username: null, 9924 password: null, 9925 cache: null, 9926 throws: false, 9927 traditional: false, 9928 headers: {}, 9929 */ 9930 9931 accepts: { 9932 "*": allTypes, 9933 text: "text/plain", 9934 html: "text/html", 9935 xml: "application/xml, text/xml", 9936 json: "application/json, text/javascript" 9937 }, 9938 9939 contents: { 9940 xml: /\bxml\b/, 9941 html: /\bhtml/, 9942 json: /\bjson\b/ 9943 }, 9944 9945 responseFields: { 9946 xml: "responseXML", 9947 text: "responseText", 9948 json: "responseJSON" 9949 }, 9950 9951 // Data converters 9952 // Keys separate source (or catchall "*") and destination types with a single space 9953 converters: { 9954 9955 // Convert anything to text 9956 "* text": String, 9957 9958 // Text to html (true = no transformation) 9959 "text html": true, 9960 9961 // Evaluate text as a json expression 9962 "text json": JSON.parse, 9963 9964 // Parse text as xml 9965 "text xml": jQuery.parseXML 9966 }, 9967 9968 // For options that shouldn't be deep extended: 9969 // you can add your own custom options here if 9970 // and when you create one that shouldn't be 9971 // deep extended (see ajaxExtend) 9972 flatOptions: { 9973 url: true, 9974 context: true 9975 } 9976 }, 9977 9978 // Creates a full fledged settings object into target 9979 // with both ajaxSettings and settings fields. 9980 // If target is omitted, writes into ajaxSettings. 9981 ajaxSetup: function( target, settings ) { 9982 return settings ? 9983 9984 // Building a settings object 9985 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 9986 9987 // Extending ajaxSettings 9988 ajaxExtend( jQuery.ajaxSettings, target ); 9989 }, 9990 9991 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 9992 ajaxTransport: addToPrefiltersOrTransports( transports ), 9993 9994 // Main method 9995 ajax: function( url, options ) { 9996 9997 // If url is an object, simulate pre-1.5 signature 9998 if ( typeof url === "object" ) { 9999 options = url; 10000 url = undefined; 10001 } 10002 10003 // Force options to be an object 10004 options = options || {}; 10005 10006 var transport, 10007 10008 // URL without anti-cache param 10009 cacheURL, 10010 10011 // Response headers 10012 responseHeadersString, 10013 responseHeaders, 10014 10015 // timeout handle 10016 timeoutTimer, 10017 10018 // Url cleanup var 10019 urlAnchor, 10020 10021 // Request state (becomes false upon send and true upon completion) 10022 completed, 10023 10024 // To know if global events are to be dispatched 10025 fireGlobals, 10026 10027 // Loop variable 10028 i, 10029 10030 // uncached part of the url 10031 uncached, 10032 10033 // Create the final options object 10034 s = jQuery.ajaxSetup( {}, options ), 10035 10036 // Callbacks context 10037 callbackContext = s.context || s, 10038 10039 // Context for global events is callbackContext if it is a DOM node or jQuery collection 10040 globalEventContext = s.context && 10041 ( callbackContext.nodeType || callbackContext.jquery ) ? 10042 jQuery( callbackContext ) : 10043 jQuery.event, 10044 10045 // Deferreds 10046 deferred = jQuery.Deferred(), 10047 completeDeferred = jQuery.Callbacks( "once memory" ), 10048 10049 // Status-dependent callbacks 10050 statusCode = s.statusCode || {}, 10051 10052 // Headers (they are sent all at once) 10053 requestHeaders = {}, 10054 requestHeadersNames = {}, 10055 10056 // Default abort message 10057 strAbort = "canceled", 10058 10059 // Fake xhr 10060 jqXHR = { 10061 readyState: 0, 10062 10063 // Builds headers hashtable if needed 10064 getResponseHeader: function( key ) { 10065 var match; 10066 if ( completed ) { 10067 if ( !responseHeaders ) { 10068 responseHeaders = {}; 10069 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 10070 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 10071 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 10072 .concat( match[ 2 ] ); 10073 } 10074 } 10075 match = responseHeaders[ key.toLowerCase() + " " ]; 10076 } 10077 return match == null ? null : match.join( ", " ); 10078 }, 10079 10080 // Raw string 10081 getAllResponseHeaders: function() { 10082 return completed ? responseHeadersString : null; 10083 }, 10084 10085 // Caches the header 10086 setRequestHeader: function( name, value ) { 10087 if ( completed == null ) { 10088 name = requestHeadersNames[ name.toLowerCase() ] = 10089 requestHeadersNames[ name.toLowerCase() ] || name; 10090 requestHeaders[ name ] = value; 10091 } 10092 return this; 10093 }, 10094 10095 // Overrides response content-type header 10096 overrideMimeType: function( type ) { 10097 if ( completed == null ) { 10098 s.mimeType = type; 10099 } 10100 return this; 10101 }, 10102 10103 // Status-dependent callbacks 10104 statusCode: function( map ) { 10105 var code; 10106 if ( map ) { 10107 if ( completed ) { 10108 10109 // Execute the appropriate callbacks 10110 jqXHR.always( map[ jqXHR.status ] ); 10111 } else { 10112 10113 // Lazy-add the new callbacks in a way that preserves old ones 10114 for ( code in map ) { 10115 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 10116 } 10117 } 10118 } 10119 return this; 10120 }, 10121 10122 // Cancel the request 10123 abort: function( statusText ) { 10124 var finalText = statusText || strAbort; 10125 if ( transport ) { 10126 transport.abort( finalText ); 10127 } 10128 done( 0, finalText ); 10129 return this; 10130 } 10131 }; 10132 10133 // Attach deferreds 10134 deferred.promise( jqXHR ); 10135 10136 // Add protocol if not provided (prefilters might expect it) 10137 // Handle falsy url in the settings object (#10093: consistency with old signature) 10138 // We also use the url parameter if available 10139 s.url = ( ( url || s.url || location.href ) + "" ) 10140 .replace( rprotocol, location.protocol + "//" ); 10141 10142 // Alias method option to type as per ticket #12004 10143 s.type = options.method || options.type || s.method || s.type; 10144 10145 // Extract dataTypes list 10146 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 10147 10148 // A cross-domain request is in order when the origin doesn't match the current origin. 10149 if ( s.crossDomain == null ) { 10150 urlAnchor = document.createElement( "a" ); 10151 10152 // Support: IE <=8 - 11, Edge 12 - 15 10153 // IE throws exception on accessing the href property if url is malformed, 10154 // e.g. http://example.com:80x/ 10155 try { 10156 urlAnchor.href = s.url; 10157 10158 // Support: IE <=8 - 11 only 10159 // Anchor's host property isn't correctly set when s.url is relative 10160 urlAnchor.href = urlAnchor.href; 10161 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 10162 urlAnchor.protocol + "//" + urlAnchor.host; 10163 } catch ( e ) { 10164 10165 // If there is an error parsing the URL, assume it is crossDomain, 10166 // it can be rejected by the transport if it is invalid 10167 s.crossDomain = true; 10168 } 10169 } 10170 10171 // Convert data if not already a string 10172 if ( s.data && s.processData && typeof s.data !== "string" ) { 10173 s.data = jQuery.param( s.data, s.traditional ); 10174 } 10175 10176 // Apply prefilters 10177 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 10178 10179 // If request was aborted inside a prefilter, stop there 10180 if ( completed ) { 10181 return jqXHR; 10182 } 10183 10184 // We can fire global events as of now if asked to 10185 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) 10186 fireGlobals = jQuery.event && s.global; 10187 10188 // Watch for a new set of requests 10189 if ( fireGlobals && jQuery.active++ === 0 ) { 10190 jQuery.event.trigger( "ajaxStart" ); 10191 } 10192 10193 // Uppercase the type 10194 s.type = s.type.toUpperCase(); 10195 10196 // Determine if request has content 10197 s.hasContent = !rnoContent.test( s.type ); 10198 10199 // Save the URL in case we're toying with the If-Modified-Since 10200 // and/or If-None-Match header later on 10201 // Remove hash to simplify url manipulation 10202 cacheURL = s.url.replace( rhash, "" ); 10203 10204 // More options handling for requests with no content 10205 if ( !s.hasContent ) { 10206 10207 // Remember the hash so we can put it back 10208 uncached = s.url.slice( cacheURL.length ); 10209 10210 // If data is available and should be processed, append data to url 10211 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 10212 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 10213 10214 // #9682: remove data so that it's not used in an eventual retry 10215 delete s.data; 10216 } 10217 10218 // Add or update anti-cache param if needed 10219 if ( s.cache === false ) { 10220 cacheURL = cacheURL.replace( rantiCache, "$1" ); 10221 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; 10222 } 10223 10224 // Put hash and anti-cache on the URL that will be requested (gh-1732) 10225 s.url = cacheURL + uncached; 10226 10227 // Change '%20' to '+' if this is encoded form body content (gh-2658) 10228 } else if ( s.data && s.processData && 10229 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 10230 s.data = s.data.replace( r20, "+" ); 10231 } 10232 10233 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 10234 if ( s.ifModified ) { 10235 if ( jQuery.lastModified[ cacheURL ] ) { 10236 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 10237 } 10238 if ( jQuery.etag[ cacheURL ] ) { 10239 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 10240 } 10241 } 10242 10243 // Set the correct header, if data is being sent 10244 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 10245 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 10246 } 10247 10248 // Set the Accepts header for the server, depending on the dataType 10249 jqXHR.setRequestHeader( 10250 "Accept", 10251 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 10252 s.accepts[ s.dataTypes[ 0 ] ] + 10253 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 10254 s.accepts[ "*" ] 10255 ); 10256 10257 // Check for headers option 10258 for ( i in s.headers ) { 10259 jqXHR.setRequestHeader( i, s.headers[ i ] ); 10260 } 10261 10262 // Allow custom headers/mimetypes and early abort 10263 if ( s.beforeSend && 10264 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 10265 10266 // Abort if not done already and return 10267 return jqXHR.abort(); 10268 } 10269 10270 // Aborting is no longer a cancellation 10271 strAbort = "abort"; 10272 10273 // Install callbacks on deferreds 10274 completeDeferred.add( s.complete ); 10275 jqXHR.done( s.success ); 10276 jqXHR.fail( s.error ); 10277 10278 // Get transport 10279 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 10280 10281 // If no transport, we auto-abort 10282 if ( !transport ) { 10283 done( -1, "No Transport" ); 10284 } else { 10285 jqXHR.readyState = 1; 10286 10287 // Send global event 10288 if ( fireGlobals ) { 10289 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 10290 } 10291 10292 // If request was aborted inside ajaxSend, stop there 10293 if ( completed ) { 10294 return jqXHR; 10295 } 10296 10297 // Timeout 10298 if ( s.async && s.timeout > 0 ) { 10299 timeoutTimer = window.setTimeout( function() { 10300 jqXHR.abort( "timeout" ); 10301 }, s.timeout ); 10302 } 10303 10304 try { 10305 completed = false; 10306 transport.send( requestHeaders, done ); 10307 } catch ( e ) { 10308 10309 // Rethrow post-completion exceptions 10310 if ( completed ) { 10311 throw e; 10312 } 10313 10314 // Propagate others as results 10315 done( -1, e ); 10316 } 10317 } 10318 10319 // Callback for when everything is done 10320 function done( status, nativeStatusText, responses, headers ) { 10321 var isSuccess, success, error, response, modified, 10322 statusText = nativeStatusText; 10323 10324 // Ignore repeat invocations 10325 if ( completed ) { 10326 return; 10327 } 10328 10329 completed = true; 10330 10331 // Clear timeout if it exists 10332 if ( timeoutTimer ) { 10333 window.clearTimeout( timeoutTimer ); 10334 } 10335 10336 // Dereference transport for early garbage collection 10337 // (no matter how long the jqXHR object will be used) 10338 transport = undefined; 10339 10340 // Cache response headers 10341 responseHeadersString = headers || ""; 10342 10343 // Set readyState 10344 jqXHR.readyState = status > 0 ? 4 : 0; 10345 10346 // Determine if successful 10347 isSuccess = status >= 200 && status < 300 || status === 304; 10348 10349 // Get response data 10350 if ( responses ) { 10351 response = ajaxHandleResponses( s, jqXHR, responses ); 10352 } 10353 10354 // Convert no matter what (that way responseXXX fields are always set) 10355 response = ajaxConvert( s, response, jqXHR, isSuccess ); 10356 10357 // If successful, handle type chaining 10358 if ( isSuccess ) { 10359 10360 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 10361 if ( s.ifModified ) { 10362 modified = jqXHR.getResponseHeader( "Last-Modified" ); 10363 if ( modified ) { 10364 jQuery.lastModified[ cacheURL ] = modified; 10365 } 10366 modified = jqXHR.getResponseHeader( "etag" ); 10367 if ( modified ) { 10368 jQuery.etag[ cacheURL ] = modified; 10369 } 10370 } 10371 10372 // if no content 10373 if ( status === 204 || s.type === "HEAD" ) { 10374 statusText = "nocontent"; 10375 10376 // if not modified 10377 } else if ( status === 304 ) { 10378 statusText = "notmodified"; 10379 10380 // If we have data, let's convert it 10381 } else { 10382 statusText = response.state; 10383 success = response.data; 10384 error = response.error; 10385 isSuccess = !error; 10386 } 10387 } else { 10388 10389 // Extract error from statusText and normalize for non-aborts 10390 error = statusText; 10391 if ( status || !statusText ) { 10392 statusText = "error"; 10393 if ( status < 0 ) { 10394 status = 0; 10395 } 10396 } 10397 } 10398 10399 // Set data for the fake xhr object 10400 jqXHR.status = status; 10401 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 10402 10403 // Success/Error 10404 if ( isSuccess ) { 10405 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 10406 } else { 10407 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 10408 } 10409 10410 // Status-dependent callbacks 10411 jqXHR.statusCode( statusCode ); 10412 statusCode = undefined; 10413 10414 if ( fireGlobals ) { 10415 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 10416 [ jqXHR, s, isSuccess ? success : error ] ); 10417 } 10418 10419 // Complete 10420 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 10421 10422 if ( fireGlobals ) { 10423 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 10424 10425 // Handle the global AJAX counter 10426 if ( !( --jQuery.active ) ) { 10427 jQuery.event.trigger( "ajaxStop" ); 10428 } 10429 } 10430 } 10431 10432 return jqXHR; 10433 }, 10434 10435 getJSON: function( url, data, callback ) { 10436 return jQuery.get( url, data, callback, "json" ); 10437 }, 10438 10439 getScript: function( url, callback ) { 10440 return jQuery.get( url, undefined, callback, "script" ); 10441 } 10442} ); 10443 10444jQuery.each( [ "get", "post" ], function( i, method ) { 10445 jQuery[ method ] = function( url, data, callback, type ) { 10446 10447 // Shift arguments if data argument was omitted 10448 if ( isFunction( data ) ) { 10449 type = type || callback; 10450 callback = data; 10451 data = undefined; 10452 } 10453 10454 // The url can be an options object (which then must have .url) 10455 return jQuery.ajax( jQuery.extend( { 10456 url: url, 10457 type: method, 10458 dataType: type, 10459 data: data, 10460 success: callback 10461 }, jQuery.isPlainObject( url ) && url ) ); 10462 }; 10463} ); 10464 10465 10466jQuery._evalUrl = function( url, options ) { 10467 return jQuery.ajax( { 10468 url: url, 10469 10470 // Make this explicit, since user can override this through ajaxSetup (#11264) 10471 type: "GET", 10472 dataType: "script", 10473 cache: true, 10474 async: false, 10475 global: false, 10476 10477 // Only evaluate the response if it is successful (gh-4126) 10478 // dataFilter is not invoked for failure responses, so using it instead 10479 // of the default converter is kludgy but it works. 10480 converters: { 10481 "text script": function() {} 10482 }, 10483 dataFilter: function( response ) { 10484 jQuery.globalEval( response, options ); 10485 } 10486 } ); 10487}; 10488 10489 10490jQuery.fn.extend( { 10491 wrapAll: function( html ) { 10492 var wrap; 10493 10494 if ( this[ 0 ] ) { 10495 if ( isFunction( html ) ) { 10496 html = html.call( this[ 0 ] ); 10497 } 10498 10499 // The elements to wrap the target around 10500 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 10501 10502 if ( this[ 0 ].parentNode ) { 10503 wrap.insertBefore( this[ 0 ] ); 10504 } 10505 10506 wrap.map( function() { 10507 var elem = this; 10508 10509 while ( elem.firstElementChild ) { 10510 elem = elem.firstElementChild; 10511 } 10512 10513 return elem; 10514 } ).append( this ); 10515 } 10516 10517 return this; 10518 }, 10519 10520 wrapInner: function( html ) { 10521 if ( isFunction( html ) ) { 10522 return this.each( function( i ) { 10523 jQuery( this ).wrapInner( html.call( this, i ) ); 10524 } ); 10525 } 10526 10527 return this.each( function() { 10528 var self = jQuery( this ), 10529 contents = self.contents(); 10530 10531 if ( contents.length ) { 10532 contents.wrapAll( html ); 10533 10534 } else { 10535 self.append( html ); 10536 } 10537 } ); 10538 }, 10539 10540 wrap: function( html ) { 10541 var htmlIsFunction = isFunction( html ); 10542 10543 return this.each( function( i ) { 10544 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 10545 } ); 10546 }, 10547 10548 unwrap: function( selector ) { 10549 this.parent( selector ).not( "body" ).each( function() { 10550 jQuery( this ).replaceWith( this.childNodes ); 10551 } ); 10552 return this; 10553 } 10554} ); 10555 10556 10557jQuery.expr.pseudos.hidden = function( elem ) { 10558 return !jQuery.expr.pseudos.visible( elem ); 10559}; 10560jQuery.expr.pseudos.visible = function( elem ) { 10561 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 10562}; 10563 10564 10565 10566 10567jQuery.ajaxSettings.xhr = function() { 10568 try { 10569 return new window.XMLHttpRequest(); 10570 } catch ( e ) {} 10571}; 10572 10573var xhrSuccessStatus = { 10574 10575 // File protocol always yields status code 0, assume 200 10576 0: 200, 10577 10578 // Support: IE <=9 only 10579 // #1450: sometimes IE returns 1223 when it should be 204 10580 1223: 204 10581 }, 10582 xhrSupported = jQuery.ajaxSettings.xhr(); 10583 10584support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 10585support.ajax = xhrSupported = !!xhrSupported; 10586 10587jQuery.ajaxTransport( function( options ) { 10588 var callback, errorCallback; 10589 10590 // Cross domain only allowed if supported through XMLHttpRequest 10591 if ( support.cors || xhrSupported && !options.crossDomain ) { 10592 return { 10593 send: function( headers, complete ) { 10594 var i, 10595 xhr = options.xhr(); 10596 10597 xhr.open( 10598 options.type, 10599 options.url, 10600 options.async, 10601 options.username, 10602 options.password 10603 ); 10604 10605 // Apply custom fields if provided 10606 if ( options.xhrFields ) { 10607 for ( i in options.xhrFields ) { 10608 xhr[ i ] = options.xhrFields[ i ]; 10609 } 10610 } 10611 10612 // Override mime type if needed 10613 if ( options.mimeType && xhr.overrideMimeType ) { 10614 xhr.overrideMimeType( options.mimeType ); 10615 } 10616 10617 // X-Requested-With header 10618 // For cross-domain requests, seeing as conditions for a preflight are 10619 // akin to a jigsaw puzzle, we simply never set it to be sure. 10620 // (it can always be set on a per-request basis or even using ajaxSetup) 10621 // For same-domain requests, won't change header if already provided. 10622 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 10623 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 10624 } 10625 10626 // Set headers 10627 for ( i in headers ) { 10628 xhr.setRequestHeader( i, headers[ i ] ); 10629 } 10630 10631 // Callback 10632 callback = function( type ) { 10633 return function() { 10634 if ( callback ) { 10635 callback = errorCallback = xhr.onload = 10636 xhr.onerror = xhr.onabort = xhr.ontimeout = 10637 xhr.onreadystatechange = null; 10638 10639 if ( type === "abort" ) { 10640 xhr.abort(); 10641 } else if ( type === "error" ) { 10642 10643 // Support: IE <=9 only 10644 // On a manual native abort, IE9 throws 10645 // errors on any property access that is not readyState 10646 if ( typeof xhr.status !== "number" ) { 10647 complete( 0, "error" ); 10648 } else { 10649 complete( 10650 10651 // File: protocol always yields status 0; see #8605, #14207 10652 xhr.status, 10653 xhr.statusText 10654 ); 10655 } 10656 } else { 10657 complete( 10658 xhrSuccessStatus[ xhr.status ] || xhr.status, 10659 xhr.statusText, 10660 10661 // Support: IE <=9 only 10662 // IE9 has no XHR2 but throws on binary (trac-11426) 10663 // For XHR2 non-text, let the caller handle it (gh-2498) 10664 ( xhr.responseType || "text" ) !== "text" || 10665 typeof xhr.responseText !== "string" ? 10666 { binary: xhr.response } : 10667 { text: xhr.responseText }, 10668 xhr.getAllResponseHeaders() 10669 ); 10670 } 10671 } 10672 }; 10673 }; 10674 10675 // Listen to events 10676 xhr.onload = callback(); 10677 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 10678 10679 // Support: IE 9 only 10680 // Use onreadystatechange to replace onabort 10681 // to handle uncaught aborts 10682 if ( xhr.onabort !== undefined ) { 10683 xhr.onabort = errorCallback; 10684 } else { 10685 xhr.onreadystatechange = function() { 10686 10687 // Check readyState before timeout as it changes 10688 if ( xhr.readyState === 4 ) { 10689 10690 // Allow onerror to be called first, 10691 // but that will not handle a native abort 10692 // Also, save errorCallback to a variable 10693 // as xhr.onerror cannot be accessed 10694 window.setTimeout( function() { 10695 if ( callback ) { 10696 errorCallback(); 10697 } 10698 } ); 10699 } 10700 }; 10701 } 10702 10703 // Create the abort callback 10704 callback = callback( "abort" ); 10705 10706 try { 10707 10708 // Do send the request (this may raise an exception) 10709 xhr.send( options.hasContent && options.data || null ); 10710 } catch ( e ) { 10711 10712 // #14683: Only rethrow if this hasn't been notified as an error yet 10713 if ( callback ) { 10714 throw e; 10715 } 10716 } 10717 }, 10718 10719 abort: function() { 10720 if ( callback ) { 10721 callback(); 10722 } 10723 } 10724 }; 10725 } 10726} ); 10727 10728 10729 10730 10731// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 10732jQuery.ajaxPrefilter( function( s ) { 10733 if ( s.crossDomain ) { 10734 s.contents.script = false; 10735 } 10736} ); 10737 10738// Install script dataType 10739jQuery.ajaxSetup( { 10740 accepts: { 10741 script: "text/javascript, application/javascript, " + 10742 "application/ecmascript, application/x-ecmascript" 10743 }, 10744 contents: { 10745 script: /\b(?:java|ecma)script\b/ 10746 }, 10747 converters: { 10748 "text script": function( text ) { 10749 jQuery.globalEval( text ); 10750 return text; 10751 } 10752 } 10753} ); 10754 10755// Handle cache's special case and crossDomain 10756jQuery.ajaxPrefilter( "script", function( s ) { 10757 if ( s.cache === undefined ) { 10758 s.cache = false; 10759 } 10760 if ( s.crossDomain ) { 10761 s.type = "GET"; 10762 } 10763} ); 10764 10765// Bind script tag hack transport 10766jQuery.ajaxTransport( "script", function( s ) { 10767 10768 // This transport only deals with cross domain or forced-by-attrs requests 10769 if ( s.crossDomain || s.scriptAttrs ) { 10770 var script, callback; 10771 return { 10772 send: function( _, complete ) { 10773 script = jQuery( "<script>" ) 10774 .attr( s.scriptAttrs || {} ) 10775 .prop( { charset: s.scriptCharset, src: s.url } ) 10776 .on( "load error", callback = function( evt ) { 10777 script.remove(); 10778 callback = null; 10779 if ( evt ) { 10780 complete( evt.type === "error" ? 404 : 200, evt.type ); 10781 } 10782 } ); 10783 10784 // Use native DOM manipulation to avoid our domManip AJAX trickery 10785 document.head.appendChild( script[ 0 ] ); 10786 }, 10787 abort: function() { 10788 if ( callback ) { 10789 callback(); 10790 } 10791 } 10792 }; 10793 } 10794} ); 10795 10796 10797 10798 10799var oldCallbacks = [], 10800 rjsonp = /(=)\?(?=&|$)|\?\?/; 10801 10802// Default jsonp settings 10803jQuery.ajaxSetup( { 10804 jsonp: "callback", 10805 jsonpCallback: function() { 10806 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); 10807 this[ callback ] = true; 10808 return callback; 10809 } 10810} ); 10811 10812// Detect, normalize options and install callbacks for jsonp requests 10813jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 10814 10815 var callbackName, overwritten, responseContainer, 10816 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 10817 "url" : 10818 typeof s.data === "string" && 10819 ( s.contentType || "" ) 10820 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 10821 rjsonp.test( s.data ) && "data" 10822 ); 10823 10824 // Handle iff the expected data type is "jsonp" or we have a parameter to set 10825 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 10826 10827 // Get callback name, remembering preexisting value associated with it 10828 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 10829 s.jsonpCallback() : 10830 s.jsonpCallback; 10831 10832 // Insert callback into url or form data 10833 if ( jsonProp ) { 10834 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 10835 } else if ( s.jsonp !== false ) { 10836 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 10837 } 10838 10839 // Use data converter to retrieve json after script execution 10840 s.converters[ "script json" ] = function() { 10841 if ( !responseContainer ) { 10842 jQuery.error( callbackName + " was not called" ); 10843 } 10844 return responseContainer[ 0 ]; 10845 }; 10846 10847 // Force json dataType 10848 s.dataTypes[ 0 ] = "json"; 10849 10850 // Install callback 10851 overwritten = window[ callbackName ]; 10852 window[ callbackName ] = function() { 10853 responseContainer = arguments; 10854 }; 10855 10856 // Clean-up function (fires after converters) 10857 jqXHR.always( function() { 10858 10859 // If previous value didn't exist - remove it 10860 if ( overwritten === undefined ) { 10861 jQuery( window ).removeProp( callbackName ); 10862 10863 // Otherwise restore preexisting value 10864 } else { 10865 window[ callbackName ] = overwritten; 10866 } 10867 10868 // Save back as free 10869 if ( s[ callbackName ] ) { 10870 10871 // Make sure that re-using the options doesn't screw things around 10872 s.jsonpCallback = originalSettings.jsonpCallback; 10873 10874 // Save the callback name for future use 10875 oldCallbacks.push( callbackName ); 10876 } 10877 10878 // Call if it was a function and we have a response 10879 if ( responseContainer && isFunction( overwritten ) ) { 10880 overwritten( responseContainer[ 0 ] ); 10881 } 10882 10883 responseContainer = overwritten = undefined; 10884 } ); 10885 10886 // Delegate to script 10887 return "script"; 10888 } 10889} ); 10890 10891 10892 10893 10894// Support: Safari 8 only 10895// In Safari 8 documents created via document.implementation.createHTMLDocument 10896// collapse sibling forms: the second one becomes a child of the first one. 10897// Because of that, this security measure has to be disabled in Safari 8. 10898// https://bugs.webkit.org/show_bug.cgi?id=137337 10899support.createHTMLDocument = ( function() { 10900 var body = document.implementation.createHTMLDocument( "" ).body; 10901 body.innerHTML = "<form></form><form></form>"; 10902 return body.childNodes.length === 2; 10903} )(); 10904 10905 10906// Argument "data" should be string of html 10907// context (optional): If specified, the fragment will be created in this context, 10908// defaults to document 10909// keepScripts (optional): If true, will include scripts passed in the html string 10910jQuery.parseHTML = function( data, context, keepScripts ) { 10911 if ( typeof data !== "string" ) { 10912 return []; 10913 } 10914 if ( typeof context === "boolean" ) { 10915 keepScripts = context; 10916 context = false; 10917 } 10918 10919 var base, parsed, scripts; 10920 10921 if ( !context ) { 10922 10923 // Stop scripts or inline event handlers from being executed immediately 10924 // by using document.implementation 10925 if ( support.createHTMLDocument ) { 10926 context = document.implementation.createHTMLDocument( "" ); 10927 10928 // Set the base href for the created document 10929 // so any parsed elements with URLs 10930 // are based on the document's URL (gh-2965) 10931 base = context.createElement( "base" ); 10932 base.href = document.location.href; 10933 context.head.appendChild( base ); 10934 } else { 10935 context = document; 10936 } 10937 } 10938 10939 parsed = rsingleTag.exec( data ); 10940 scripts = !keepScripts && []; 10941 10942 // Single tag 10943 if ( parsed ) { 10944 return [ context.createElement( parsed[ 1 ] ) ]; 10945 } 10946 10947 parsed = buildFragment( [ data ], context, scripts ); 10948 10949 if ( scripts && scripts.length ) { 10950 jQuery( scripts ).remove(); 10951 } 10952 10953 return jQuery.merge( [], parsed.childNodes ); 10954}; 10955 10956 10957/** 10958 * Load a url into a page 10959 */ 10960jQuery.fn.load = function( url, params, callback ) { 10961 var selector, type, response, 10962 self = this, 10963 off = url.indexOf( " " ); 10964 10965 if ( off > -1 ) { 10966 selector = stripAndCollapse( url.slice( off ) ); 10967 url = url.slice( 0, off ); 10968 } 10969 10970 // If it's a function 10971 if ( isFunction( params ) ) { 10972 10973 // We assume that it's the callback 10974 callback = params; 10975 params = undefined; 10976 10977 // Otherwise, build a param string 10978 } else if ( params && typeof params === "object" ) { 10979 type = "POST"; 10980 } 10981 10982 // If we have elements to modify, make the request 10983 if ( self.length > 0 ) { 10984 jQuery.ajax( { 10985 url: url, 10986 10987 // If "type" variable is undefined, then "GET" method will be used. 10988 // Make value of this field explicit since 10989 // user can override it through ajaxSetup method 10990 type: type || "GET", 10991 dataType: "html", 10992 data: params 10993 } ).done( function( responseText ) { 10994 10995 // Save response for use in complete callback 10996 response = arguments; 10997 10998 self.html( selector ? 10999 11000 // If a selector was specified, locate the right elements in a dummy div 11001 // Exclude scripts to avoid IE 'Permission Denied' errors 11002 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 11003 11004 // Otherwise use the full result 11005 responseText ); 11006 11007 // If the request succeeds, this function gets "data", "status", "jqXHR" 11008 // but they are ignored because response was set above. 11009 // If it fails, this function gets "jqXHR", "status", "error" 11010 } ).always( callback && function( jqXHR, status ) { 11011 self.each( function() { 11012 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 11013 } ); 11014 } ); 11015 } 11016 11017 return this; 11018}; 11019 11020 11021 11022 11023// Attach a bunch of functions for handling common AJAX events 11024jQuery.each( [ 11025 "ajaxStart", 11026 "ajaxStop", 11027 "ajaxComplete", 11028 "ajaxError", 11029 "ajaxSuccess", 11030 "ajaxSend" 11031], function( i, type ) { 11032 jQuery.fn[ type ] = function( fn ) { 11033 return this.on( type, fn ); 11034 }; 11035} ); 11036 11037 11038 11039 11040jQuery.expr.pseudos.animated = function( elem ) { 11041 return jQuery.grep( jQuery.timers, function( fn ) { 11042 return elem === fn.elem; 11043 } ).length; 11044}; 11045 11046 11047 11048 11049jQuery.offset = { 11050 setOffset: function( elem, options, i ) { 11051 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 11052 position = jQuery.css( elem, "position" ), 11053 curElem = jQuery( elem ), 11054 props = {}; 11055 11056 // Set position first, in-case top/left are set even on static elem 11057 if ( position === "static" ) { 11058 elem.style.position = "relative"; 11059 } 11060 11061 curOffset = curElem.offset(); 11062 curCSSTop = jQuery.css( elem, "top" ); 11063 curCSSLeft = jQuery.css( elem, "left" ); 11064 calculatePosition = ( position === "absolute" || position === "fixed" ) && 11065 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 11066 11067 // Need to be able to calculate position if either 11068 // top or left is auto and position is either absolute or fixed 11069 if ( calculatePosition ) { 11070 curPosition = curElem.position(); 11071 curTop = curPosition.top; 11072 curLeft = curPosition.left; 11073 11074 } else { 11075 curTop = parseFloat( curCSSTop ) || 0; 11076 curLeft = parseFloat( curCSSLeft ) || 0; 11077 } 11078 11079 if ( isFunction( options ) ) { 11080 11081 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 11082 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 11083 } 11084 11085 if ( options.top != null ) { 11086 props.top = ( options.top - curOffset.top ) + curTop; 11087 } 11088 if ( options.left != null ) { 11089 props.left = ( options.left - curOffset.left ) + curLeft; 11090 } 11091 11092 if ( "using" in options ) { 11093 options.using.call( elem, props ); 11094 11095 } else { 11096 curElem.css( props ); 11097 } 11098 } 11099}; 11100 11101jQuery.fn.extend( { 11102 11103 // offset() relates an element's border box to the document origin 11104 offset: function( options ) { 11105 11106 // Preserve chaining for setter 11107 if ( arguments.length ) { 11108 return options === undefined ? 11109 this : 11110 this.each( function( i ) { 11111 jQuery.offset.setOffset( this, options, i ); 11112 } ); 11113 } 11114 11115 var rect, win, 11116 elem = this[ 0 ]; 11117 11118 if ( !elem ) { 11119 return; 11120 } 11121 11122 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 11123 // Support: IE <=11 only 11124 // Running getBoundingClientRect on a 11125 // disconnected node in IE throws an error 11126 if ( !elem.getClientRects().length ) { 11127 return { top: 0, left: 0 }; 11128 } 11129 11130 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 11131 rect = elem.getBoundingClientRect(); 11132 win = elem.ownerDocument.defaultView; 11133 return { 11134 top: rect.top + win.pageYOffset, 11135 left: rect.left + win.pageXOffset 11136 }; 11137 }, 11138 11139 // position() relates an element's margin box to its offset parent's padding box 11140 // This corresponds to the behavior of CSS absolute positioning 11141 position: function() { 11142 if ( !this[ 0 ] ) { 11143 return; 11144 } 11145 11146 var offsetParent, offset, doc, 11147 elem = this[ 0 ], 11148 parentOffset = { top: 0, left: 0 }; 11149 11150 // position:fixed elements are offset from the viewport, which itself always has zero offset 11151 if ( jQuery.css( elem, "position" ) === "fixed" ) { 11152 11153 // Assume position:fixed implies availability of getBoundingClientRect 11154 offset = elem.getBoundingClientRect(); 11155 11156 } else { 11157 offset = this.offset(); 11158 11159 // Account for the *real* offset parent, which can be the document or its root element 11160 // when a statically positioned element is identified 11161 doc = elem.ownerDocument; 11162 offsetParent = elem.offsetParent || doc.documentElement; 11163 while ( offsetParent && 11164 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 11165 jQuery.css( offsetParent, "position" ) === "static" ) { 11166 11167 offsetParent = offsetParent.parentNode; 11168 } 11169 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 11170 11171 // Incorporate borders into its offset, since they are outside its content origin 11172 parentOffset = jQuery( offsetParent ).offset(); 11173 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 11174 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 11175 } 11176 } 11177 11178 // Subtract parent offsets and element margins 11179 return { 11180 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 11181 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 11182 }; 11183 }, 11184 11185 // This method will return documentElement in the following cases: 11186 // 1) For the element inside the iframe without offsetParent, this method will return 11187 // documentElement of the parent window 11188 // 2) For the hidden or detached element 11189 // 3) For body or html element, i.e. in case of the html node - it will return itself 11190 // 11191 // but those exceptions were never presented as a real life use-cases 11192 // and might be considered as more preferable results. 11193 // 11194 // This logic, however, is not guaranteed and can change at any point in the future 11195 offsetParent: function() { 11196 return this.map( function() { 11197 var offsetParent = this.offsetParent; 11198 11199 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 11200 offsetParent = offsetParent.offsetParent; 11201 } 11202 11203 return offsetParent || documentElement; 11204 } ); 11205 } 11206} ); 11207 11208// Create scrollLeft and scrollTop methods 11209jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 11210 var top = "pageYOffset" === prop; 11211 11212 jQuery.fn[ method ] = function( val ) { 11213 return access( this, function( elem, method, val ) { 11214 11215 // Coalesce documents and windows 11216 var win; 11217 if ( isWindow( elem ) ) { 11218 win = elem; 11219 } else if ( elem.nodeType === 9 ) { 11220 win = elem.defaultView; 11221 } 11222 11223 if ( val === undefined ) { 11224 return win ? win[ prop ] : elem[ method ]; 11225 } 11226 11227 if ( win ) { 11228 win.scrollTo( 11229 !top ? val : win.pageXOffset, 11230 top ? val : win.pageYOffset 11231 ); 11232 11233 } else { 11234 elem[ method ] = val; 11235 } 11236 }, method, val, arguments.length ); 11237 }; 11238} ); 11239 11240// Support: Safari <=7 - 9.1, Chrome <=37 - 49 11241// Add the top/left cssHooks using jQuery.fn.position 11242// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 11243// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 11244// getComputedStyle returns percent when specified for top/left/bottom/right; 11245// rather than make the css module depend on the offset module, just check for it here 11246jQuery.each( [ "top", "left" ], function( i, prop ) { 11247 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 11248 function( elem, computed ) { 11249 if ( computed ) { 11250 computed = curCSS( elem, prop ); 11251 11252 // If curCSS returns percentage, fallback to offset 11253 return rnumnonpx.test( computed ) ? 11254 jQuery( elem ).position()[ prop ] + "px" : 11255 computed; 11256 } 11257 } 11258 ); 11259} ); 11260 11261 11262// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 11263jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 11264 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, 11265 function( defaultExtra, funcName ) { 11266 11267 // Margin is only for outerHeight, outerWidth 11268 jQuery.fn[ funcName ] = function( margin, value ) { 11269 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 11270 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 11271 11272 return access( this, function( elem, type, value ) { 11273 var doc; 11274 11275 if ( isWindow( elem ) ) { 11276 11277 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 11278 return funcName.indexOf( "outer" ) === 0 ? 11279 elem[ "inner" + name ] : 11280 elem.document.documentElement[ "client" + name ]; 11281 } 11282 11283 // Get document width or height 11284 if ( elem.nodeType === 9 ) { 11285 doc = elem.documentElement; 11286 11287 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 11288 // whichever is greatest 11289 return Math.max( 11290 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 11291 elem.body[ "offset" + name ], doc[ "offset" + name ], 11292 doc[ "client" + name ] 11293 ); 11294 } 11295 11296 return value === undefined ? 11297 11298 // Get width or height on the element, requesting but not forcing parseFloat 11299 jQuery.css( elem, type, extra ) : 11300 11301 // Set width or height on the element 11302 jQuery.style( elem, type, value, extra ); 11303 }, type, chainable ? margin : undefined, chainable ); 11304 }; 11305 } ); 11306} ); 11307 11308 11309jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + 11310 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 11311 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 11312 function( i, name ) { 11313 11314 // Handle event binding 11315 jQuery.fn[ name ] = function( data, fn ) { 11316 return arguments.length > 0 ? 11317 this.on( name, null, data, fn ) : 11318 this.trigger( name ); 11319 }; 11320} ); 11321 11322jQuery.fn.extend( { 11323 hover: function( fnOver, fnOut ) { 11324 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 11325 } 11326} ); 11327 11328 11329 11330 11331jQuery.fn.extend( { 11332 11333 bind: function( types, data, fn ) { 11334 return this.on( types, null, data, fn ); 11335 }, 11336 unbind: function( types, fn ) { 11337 return this.off( types, null, fn ); 11338 }, 11339 11340 delegate: function( selector, types, data, fn ) { 11341 return this.on( types, selector, data, fn ); 11342 }, 11343 undelegate: function( selector, types, fn ) { 11344 11345 // ( namespace ) or ( selector, types [, fn] ) 11346 return arguments.length === 1 ? 11347 this.off( selector, "**" ) : 11348 this.off( types, selector || "**", fn ); 11349 } 11350} ); 11351 11352// Bind a function to a context, optionally partially applying any 11353// arguments. 11354// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 11355// However, it is not slated for removal any time soon 11356jQuery.proxy = function( fn, context ) { 11357 var tmp, args, proxy; 11358 11359 if ( typeof context === "string" ) { 11360 tmp = fn[ context ]; 11361 context = fn; 11362 fn = tmp; 11363 } 11364 11365 // Quick check to determine if target is callable, in the spec 11366 // this throws a TypeError, but we will just return undefined. 11367 if ( !isFunction( fn ) ) { 11368 return undefined; 11369 } 11370 11371 // Simulated bind 11372 args = slice.call( arguments, 2 ); 11373 proxy = function() { 11374 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 11375 }; 11376 11377 // Set the guid of unique handler to the same of original handler, so it can be removed 11378 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 11379 11380 return proxy; 11381}; 11382 11383jQuery.holdReady = function( hold ) { 11384 if ( hold ) { 11385 jQuery.readyWait++; 11386 } else { 11387 jQuery.ready( true ); 11388 } 11389}; 11390jQuery.isArray = Array.isArray; 11391jQuery.parseJSON = JSON.parse; 11392jQuery.nodeName = nodeName; 11393jQuery.isFunction = isFunction; 11394jQuery.isWindow = isWindow; 11395jQuery.camelCase = camelCase; 11396jQuery.type = toType; 11397 11398jQuery.now = Date.now; 11399 11400jQuery.isNumeric = function( obj ) { 11401 11402 // As of jQuery 3.0, isNumeric is limited to 11403 // strings and numbers (primitives or objects) 11404 // that can be coerced to finite numbers (gh-2662) 11405 var type = jQuery.type( obj ); 11406 return ( type === "number" || type === "string" ) && 11407 11408 // parseFloat NaNs numeric-cast false positives ("") 11409 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 11410 // subtraction forces infinities to NaN 11411 !isNaN( obj - parseFloat( obj ) ); 11412}; 11413 11414 11415 11416 11417// Register as a named AMD module, since jQuery can be concatenated with other 11418// files that may use define, but not via a proper concatenation script that 11419// understands anonymous AMD modules. A named AMD is safest and most robust 11420// way to register. Lowercase jquery is used because AMD module names are 11421// derived from file names, and jQuery is normally delivered in a lowercase 11422// file name. Do this after creating the global so that if an AMD module wants 11423// to call noConflict to hide this version of jQuery, it will work. 11424 11425// Note that for maximum portability, libraries that are not jQuery should 11426// declare themselves as anonymous modules, and avoid setting a global if an 11427// AMD loader is present. jQuery is a special case. For more information, see 11428// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 11429 11430if ( true ) { 11431 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { 11432 return jQuery; 11433 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 11434 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 11435} 11436 11437 11438 11439 11440var 11441 11442 // Map over jQuery in case of overwrite 11443 _jQuery = window.jQuery, 11444 11445 // Map over the $ in case of overwrite 11446 _$ = window.$; 11447 11448jQuery.noConflict = function( deep ) { 11449 if ( window.$ === jQuery ) { 11450 window.$ = _$; 11451 } 11452 11453 if ( deep && window.jQuery === jQuery ) { 11454 window.jQuery = _jQuery; 11455 } 11456 11457 return jQuery; 11458}; 11459 11460// Expose jQuery and $ identifiers, even in AMD 11461// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 11462// and CommonJS for browser emulators (#13566) 11463if ( !noGlobal ) { 11464 window.jQuery = window.$ = jQuery; 11465} 11466 11467 11468 11469 11470return jQuery; 11471} ); 11472 11473 11474/***/ }), 11475
vendor: 88,704 bytes, lines 11476-14093
11476/***/ "./node_modules/popper.js/dist/esm/popper.js": 11477/*!***************************************************!*\ 11478 !*** ./node_modules/popper.js/dist/esm/popper.js ***! 11479 \***************************************************/ 11480/*! exports provided: default */ 11481/***/ (function(module, __webpack_exports__, __webpack_require__) { 11482 11483"use strict"; 11484__webpack_require__.r(__webpack_exports__); 11485/* WEBPACK VAR INJECTION */(function(global) {/**! 11486 * @fileOverview Kickass library to create and place poppers near their reference elements. 11487 * @version 1.15.0 11488 * @license 11489 * Copyright (c) 2016 Federico Zivolo and contributors 11490 * 11491 * Permission is hereby granted, free of charge, to any person obtaining a copy 11492 * of this software and associated documentation files (the "Software"), to deal 11493 * in the Software without restriction, including without limitation the rights 11494 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11495 * copies of the Software, and to permit persons to whom the Software is 11496 * furnished to do so, subject to the following conditions: 11497 * 11498 * The above copyright notice and this permission notice shall be included in all 11499 * copies or substantial portions of the Software. 11500 * 11501 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 11502 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11503 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 11504 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11505 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 11506 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 11507 * SOFTWARE. 11508 */ 11509var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined'; 11510 11511var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; 11512var timeoutDuration = 0; 11513for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { 11514 if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { 11515 timeoutDuration = 1; 11516 break; 11517 } 11518} 11519 11520function microtaskDebounce(fn) { 11521 var called = false; 11522 return function () { 11523 if (called) { 11524 return; 11525 } 11526 called = true; 11527 window.Promise.resolve().then(function () { 11528 called = false; 11529 fn(); 11530 }); 11531 }; 11532} 11533 11534function taskDebounce(fn) { 11535 var scheduled = false; 11536 return function () { 11537 if (!scheduled) { 11538 scheduled = true; 11539 setTimeout(function () { 11540 scheduled = false; 11541 fn(); 11542 }, timeoutDuration); 11543 } 11544 }; 11545} 11546 11547var supportsMicroTasks = isBrowser && window.Promise; 11548 11549/** 11550* Create a debounced version of a method, that's asynchronously deferred 11551* but called in the minimum time possible. 11552* 11553* @method 11554* @memberof Popper.Utils 11555* @argument {Function} fn 11556* @returns {Function} 11557*/ 11558var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce; 11559 11560/** 11561 * Check if the given variable is a function 11562 * @method 11563 * @memberof Popper.Utils 11564 * @argument {Any} functionToCheck - variable to check 11565 * @returns {Boolean} answer to: is a function? 11566 */ 11567function isFunction(functionToCheck) { 11568 var getType = {}; 11569 return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; 11570} 11571 11572/** 11573 * Get CSS computed property of the given element 11574 * @method 11575 * @memberof Popper.Utils 11576 * @argument {Eement} element 11577 * @argument {String} property 11578 */ 11579function getStyleComputedProperty(element, property) { 11580 if (element.nodeType !== 1) { 11581 return []; 11582 } 11583 // NOTE: 1 DOM access here 11584 var window = element.ownerDocument.defaultView; 11585 var css = window.getComputedStyle(element, null); 11586 return property ? css[property] : css; 11587} 11588 11589/** 11590 * Returns the parentNode or the host of the element 11591 * @method 11592 * @memberof Popper.Utils 11593 * @argument {Element} element 11594 * @returns {Element} parent 11595 */ 11596function getParentNode(element) { 11597 if (element.nodeName === 'HTML') { 11598 return element; 11599 } 11600 return element.parentNode || element.host; 11601} 11602 11603/** 11604 * Returns the scrolling parent of the given element 11605 * @method 11606 * @memberof Popper.Utils 11607 * @argument {Element} element 11608 * @returns {Element} scroll parent 11609 */ 11610function getScrollParent(element) { 11611 // Return body, `getScroll` will take care to get the correct `scrollTop` from it 11612 if (!element) { 11613 return document.body; 11614 } 11615 11616 switch (element.nodeName) { 11617 case 'HTML': 11618 case 'BODY': 11619 return element.ownerDocument.body; 11620 case '#document': 11621 return element.body; 11622 } 11623 11624 // Firefox want us to check `-x` and `-y` variations as well 11625 11626 var _getStyleComputedProp = getStyleComputedProperty(element), 11627 overflow = _getStyleComputedProp.overflow, 11628 overflowX = _getStyleComputedProp.overflowX, 11629 overflowY = _getStyleComputedProp.overflowY; 11630 11631 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { 11632 return element; 11633 } 11634 11635 return getScrollParent(getParentNode(element)); 11636} 11637 11638var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode); 11639var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent); 11640 11641/** 11642 * Determines if the browser is Internet Explorer 11643 * @method 11644 * @memberof Popper.Utils 11645 * @param {Number} version to check 11646 * @returns {Boolean} isIE 11647 */ 11648function isIE(version) { 11649 if (version === 11) { 11650 return isIE11; 11651 } 11652 if (version === 10) { 11653 return isIE10; 11654 } 11655 return isIE11 || isIE10; 11656} 11657 11658/** 11659 * Returns the offset parent of the given element 11660 * @method 11661 * @memberof Popper.Utils 11662 * @argument {Element} element 11663 * @returns {Element} offset parent 11664 */ 11665function getOffsetParent(element) { 11666 if (!element) { 11667 return document.documentElement; 11668 } 11669 11670 var noOffsetParent = isIE(10) ? document.body : null; 11671 11672 // NOTE: 1 DOM access here 11673 var offsetParent = element.offsetParent || null; 11674 // Skip hidden elements which don't have an offsetParent 11675 while (offsetParent === noOffsetParent && element.nextElementSibling) { 11676 offsetParent = (element = element.nextElementSibling).offsetParent; 11677 } 11678 11679 var nodeName = offsetParent && offsetParent.nodeName; 11680 11681 if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { 11682 return element ? element.ownerDocument.documentElement : document.documentElement; 11683 } 11684 11685 // .offsetParent will return the closest TH, TD or TABLE in case 11686 // no offsetParent is present, I hate this job... 11687 if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { 11688 return getOffsetParent(offsetParent); 11689 } 11690 11691 return offsetParent; 11692} 11693 11694function isOffsetContainer(element) { 11695 var nodeName = element.nodeName; 11696 11697 if (nodeName === 'BODY') { 11698 return false; 11699 } 11700 return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; 11701} 11702 11703/** 11704 * Finds the root node (document, shadowDOM root) of the given element 11705 * @method 11706 * @memberof Popper.Utils 11707 * @argument {Element} node 11708 * @returns {Element} root node 11709 */ 11710function getRoot(node) { 11711 if (node.parentNode !== null) { 11712 return getRoot(node.parentNode); 11713 } 11714 11715 return node; 11716} 11717 11718/** 11719 * Finds the offset parent common to the two provided nodes 11720 * @method 11721 * @memberof Popper.Utils 11722 * @argument {Element} element1 11723 * @argument {Element} element2 11724 * @returns {Element} common offset parent 11725 */ 11726function findCommonOffsetParent(element1, element2) { 11727 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 11728 if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { 11729 return document.documentElement; 11730 } 11731 11732 // Here we make sure to give as "start" the element that comes first in the DOM 11733 var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; 11734 var start = order ? element1 : element2; 11735 var end = order ? element2 : element1; 11736 11737 // Get common ancestor container 11738 var range = document.createRange(); 11739 range.setStart(start, 0); 11740 range.setEnd(end, 0); 11741 var commonAncestorContainer = range.commonAncestorContainer; 11742 11743 // Both nodes are inside #document 11744 11745 if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { 11746 if (isOffsetContainer(commonAncestorContainer)) { 11747 return commonAncestorContainer; 11748 } 11749 11750 return getOffsetParent(commonAncestorContainer); 11751 } 11752 11753 // one of the nodes is inside shadowDOM, find which one 11754 var element1root = getRoot(element1); 11755 if (element1root.host) { 11756 return findCommonOffsetParent(element1root.host, element2); 11757 } else { 11758 return findCommonOffsetParent(element1, getRoot(element2).host); 11759 } 11760} 11761 11762/** 11763 * Gets the scroll value of the given element in the given side (top and left) 11764 * @method 11765 * @memberof Popper.Utils 11766 * @argument {Element} element 11767 * @argument {String} side `top` or `left` 11768 * @returns {number} amount of scrolled pixels 11769 */ 11770function getScroll(element) { 11771 var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; 11772 11773 var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; 11774 var nodeName = element.nodeName; 11775 11776 if (nodeName === 'BODY' || nodeName === 'HTML') { 11777 var html = element.ownerDocument.documentElement; 11778 var scrollingElement = element.ownerDocument.scrollingElement || html; 11779 return scrollingElement[upperSide]; 11780 } 11781 11782 return element[upperSide]; 11783} 11784 11785/* 11786 * Sum or subtract the element scroll values (left and top) from a given rect object 11787 * @method 11788 * @memberof Popper.Utils 11789 * @param {Object} rect - Rect object you want to change 11790 * @param {HTMLElement} element - The element from the function reads the scroll values 11791 * @param {Boolean} subtract - set to true if you want to subtract the scroll values 11792 * @return {Object} rect - The modifier rect object 11793 */ 11794function includeScroll(rect, element) { 11795 var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 11796 11797 var scrollTop = getScroll(element, 'top'); 11798 var scrollLeft = getScroll(element, 'left'); 11799 var modifier = subtract ? -1 : 1; 11800 rect.top += scrollTop * modifier; 11801 rect.bottom += scrollTop * modifier; 11802 rect.left += scrollLeft * modifier; 11803 rect.right += scrollLeft * modifier; 11804 return rect; 11805} 11806 11807/* 11808 * Helper to detect borders of a given element 11809 * @method 11810 * @memberof Popper.Utils 11811 * @param {CSSStyleDeclaration} styles 11812 * Result of `getStyleComputedProperty` on the given element 11813 * @param {String} axis - `x` or `y` 11814 * @return {number} borders - The borders size of the given axis 11815 */ 11816 11817function getBordersSize(styles, axis) { 11818 var sideA = axis === 'x' ? 'Left' : 'Top'; 11819 var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; 11820 11821 return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10); 11822} 11823 11824function getSize(axis, body, html, computedStyle) { 11825 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); 11826} 11827 11828function getWindowSizes(document) { 11829 var body = document.body; 11830 var html = document.documentElement; 11831 var computedStyle = isIE(10) && getComputedStyle(html); 11832 11833 return { 11834 height: getSize('Height', body, html, computedStyle), 11835 width: getSize('Width', body, html, computedStyle) 11836 }; 11837} 11838 11839var classCallCheck = function (instance, Constructor) { 11840 if (!(instance instanceof Constructor)) { 11841 throw new TypeError("Cannot call a class as a function"); 11842 } 11843}; 11844 11845var createClass = function () { 11846 function defineProperties(target, props) { 11847 for (var i = 0; i < props.length; i++) { 11848 var descriptor = props[i]; 11849 descriptor.enumerable = descriptor.enumerable || false; 11850 descriptor.configurable = true; 11851 if ("value" in descriptor) descriptor.writable = true; 11852 Object.defineProperty(target, descriptor.key, descriptor); 11853 } 11854 } 11855 11856 return function (Constructor, protoProps, staticProps) { 11857 if (protoProps) defineProperties(Constructor.prototype, protoProps); 11858 if (staticProps) defineProperties(Constructor, staticProps); 11859 return Constructor; 11860 }; 11861}(); 11862 11863 11864 11865 11866 11867var defineProperty = function (obj, key, value) { 11868 if (key in obj) { 11869 Object.defineProperty(obj, key, { 11870 value: value, 11871 enumerable: true, 11872 configurable: true, 11873 writable: true 11874 }); 11875 } else { 11876 obj[key] = value; 11877 } 11878 11879 return obj; 11880}; 11881 11882var _extends = Object.assign || function (target) { 11883 for (var i = 1; i < arguments.length; i++) { 11884 var source = arguments[i]; 11885 11886 for (var key in source) { 11887 if (Object.prototype.hasOwnProperty.call(source, key)) { 11888 target[key] = source[key]; 11889 } 11890 } 11891 } 11892 11893 return target; 11894}; 11895 11896/** 11897 * Given element offsets, generate an output similar to getBoundingClientRect 11898 * @method 11899 * @memberof Popper.Utils 11900 * @argument {Object} offsets 11901 * @returns {Object} ClientRect like output 11902 */ 11903function getClientRect(offsets) { 11904 return _extends({}, offsets, { 11905 right: offsets.left + offsets.width, 11906 bottom: offsets.top + offsets.height 11907 }); 11908} 11909 11910/** 11911 * Get bounding client rect of given element 11912 * @method 11913 * @memberof Popper.Utils 11914 * @param {HTMLElement} element 11915 * @return {Object} client rect 11916 */ 11917function getBoundingClientRect(element) { 11918 var rect = {}; 11919 11920 // IE10 10 FIX: Please, don't ask, the element isn't 11921 // considered in DOM in some circumstances... 11922 // This isn't reproducible in IE10 compatibility mode of IE11 11923 try { 11924 if (isIE(10)) { 11925 rect = element.getBoundingClientRect(); 11926 var scrollTop = getScroll(element, 'top'); 11927 var scrollLeft = getScroll(element, 'left'); 11928 rect.top += scrollTop; 11929 rect.left += scrollLeft; 11930 rect.bottom += scrollTop; 11931 rect.right += scrollLeft; 11932 } else { 11933 rect = element.getBoundingClientRect(); 11934 } 11935 } catch (e) {} 11936 11937 var result = { 11938 left: rect.left, 11939 top: rect.top, 11940 width: rect.right - rect.left, 11941 height: rect.bottom - rect.top 11942 }; 11943 11944 // subtract scrollbar size from sizes 11945 var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {}; 11946 var width = sizes.width || element.clientWidth || result.right - result.left; 11947 var height = sizes.height || element.clientHeight || result.bottom - result.top; 11948 11949 var horizScrollbar = element.offsetWidth - width; 11950 var vertScrollbar = element.offsetHeight - height; 11951 11952 // if an hypothetical scrollbar is detected, we must be sure it's not a `border` 11953 // we make this check conditional for performance reasons 11954 if (horizScrollbar || vertScrollbar) { 11955 var styles = getStyleComputedProperty(element); 11956 horizScrollbar -= getBordersSize(styles, 'x'); 11957 vertScrollbar -= getBordersSize(styles, 'y'); 11958 11959 result.width -= horizScrollbar; 11960 result.height -= vertScrollbar; 11961 } 11962 11963 return getClientRect(result); 11964} 11965 11966function getOffsetRectRelativeToArbitraryNode(children, parent) { 11967 var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 11968 11969 var isIE10 = isIE(10); 11970 var isHTML = parent.nodeName === 'HTML'; 11971 var childrenRect = getBoundingClientRect(children); 11972 var parentRect = getBoundingClientRect(parent); 11973 var scrollParent = getScrollParent(children); 11974 11975 var styles = getStyleComputedProperty(parent); 11976 var borderTopWidth = parseFloat(styles.borderTopWidth, 10); 11977 var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10); 11978 11979 // In cases where the parent is fixed, we must ignore negative scroll in offset calc 11980 if (fixedPosition && isHTML) { 11981 parentRect.top = Math.max(parentRect.top, 0); 11982 parentRect.left = Math.max(parentRect.left, 0); 11983 } 11984 var offsets = getClientRect({ 11985 top: childrenRect.top - parentRect.top - borderTopWidth, 11986 left: childrenRect.left - parentRect.left - borderLeftWidth, 11987 width: childrenRect.width, 11988 height: childrenRect.height 11989 }); 11990 offsets.marginTop = 0; 11991 offsets.marginLeft = 0; 11992 11993 // Subtract margins of documentElement in case it's being used as parent 11994 // we do this only on HTML because it's the only element that behaves 11995 // differently when margins are applied to it. The margins are included in 11996 // the box of the documentElement, in the other cases not. 11997 if (!isIE10 && isHTML) { 11998 var marginTop = parseFloat(styles.marginTop, 10); 11999 var marginLeft = parseFloat(styles.marginLeft, 10); 12000 12001 offsets.top -= borderTopWidth - marginTop; 12002 offsets.bottom -= borderTopWidth - marginTop; 12003 offsets.left -= borderLeftWidth - marginLeft; 12004 offsets.right -= borderLeftWidth - marginLeft; 12005 12006 // Attach marginTop and marginLeft because in some circumstances we may need them 12007 offsets.marginTop = marginTop; 12008 offsets.marginLeft = marginLeft; 12009 } 12010 12011 if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { 12012 offsets = includeScroll(offsets, parent); 12013 } 12014 12015 return offsets; 12016} 12017 12018function getViewportOffsetRectRelativeToArtbitraryNode(element) { 12019 var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 12020 12021 var html = element.ownerDocument.documentElement; 12022 var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); 12023 var width = Math.max(html.clientWidth, window.innerWidth || 0); 12024 var height = Math.max(html.clientHeight, window.innerHeight || 0); 12025 12026 var scrollTop = !excludeScroll ? getScroll(html) : 0; 12027 var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0; 12028 12029 var offset = { 12030 top: scrollTop - relativeOffset.top + relativeOffset.marginTop, 12031 left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, 12032 width: width, 12033 height: height 12034 }; 12035 12036 return getClientRect(offset); 12037} 12038 12039/** 12040 * Check if the given element is fixed or is inside a fixed parent 12041 * @method 12042 * @memberof Popper.Utils 12043 * @argument {Element} element 12044 * @argument {Element} customContainer 12045 * @returns {Boolean} answer to "isFixed?" 12046 */ 12047function isFixed(element) { 12048 var nodeName = element.nodeName; 12049 if (nodeName === 'BODY' || nodeName === 'HTML') { 12050 return false; 12051 } 12052 if (getStyleComputedProperty(element, 'position') === 'fixed') { 12053 return true; 12054 } 12055 var parentNode = getParentNode(element); 12056 if (!parentNode) { 12057 return false; 12058 } 12059 return isFixed(parentNode); 12060} 12061 12062/** 12063 * Finds the first parent of an element that has a transformed property defined 12064 * @method 12065 * @memberof Popper.Utils 12066 * @argument {Element} element 12067 * @returns {Element} first transformed parent or documentElement 12068 */ 12069 12070function getFixedPositionOffsetParent(element) { 12071 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 12072 if (!element || !element.parentElement || isIE()) { 12073 return document.documentElement; 12074 } 12075 var el = element.parentElement; 12076 while (el && getStyleComputedProperty(el, 'transform') === 'none') { 12077 el = el.parentElement; 12078 } 12079 return el || document.documentElement; 12080} 12081 12082/** 12083 * Computed the boundaries limits and return them 12084 * @method 12085 * @memberof Popper.Utils 12086 * @param {HTMLElement} popper 12087 * @param {HTMLElement} reference 12088 * @param {number} padding 12089 * @param {HTMLElement} boundariesElement - Element used to define the boundaries 12090 * @param {Boolean} fixedPosition - Is in fixed position mode 12091 * @returns {Object} Coordinates of the boundaries 12092 */ 12093function getBoundaries(popper, reference, padding, boundariesElement) { 12094 var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; 12095 12096 // NOTE: 1 DOM access here 12097 12098 var boundaries = { top: 0, left: 0 }; 12099 var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference); 12100 12101 // Handle viewport case 12102 if (boundariesElement === 'viewport') { 12103 boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition); 12104 } else { 12105 // Handle other cases based on DOM element used as boundaries 12106 var boundariesNode = void 0; 12107 if (boundariesElement === 'scrollParent') { 12108 boundariesNode = getScrollParent(getParentNode(reference)); 12109 if (boundariesNode.nodeName === 'BODY') { 12110 boundariesNode = popper.ownerDocument.documentElement; 12111 } 12112 } else if (boundariesElement === 'window') { 12113 boundariesNode = popper.ownerDocument.documentElement; 12114 } else { 12115 boundariesNode = boundariesElement; 12116 } 12117 12118 var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); 12119 12120 // In case of HTML, we need a different computation 12121 if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { 12122 var _getWindowSizes = getWindowSizes(popper.ownerDocument), 12123 height = _getWindowSizes.height, 12124 width = _getWindowSizes.width; 12125 12126 boundaries.top += offsets.top - offsets.marginTop; 12127 boundaries.bottom = height + offsets.top; 12128 boundaries.left += offsets.left - offsets.marginLeft; 12129 boundaries.right = width + offsets.left; 12130 } else { 12131 // for all the other DOM elements, this one is good 12132 boundaries = offsets; 12133 } 12134 } 12135 12136 // Add paddings 12137 padding = padding || 0; 12138 var isPaddingNumber = typeof padding === 'number'; 12139 boundaries.left += isPaddingNumber ? padding : padding.left || 0; 12140 boundaries.top += isPaddingNumber ? padding : padding.top || 0; 12141 boundaries.right -= isPaddingNumber ? padding : padding.right || 0; 12142 boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; 12143 12144 return boundaries; 12145} 12146 12147function getArea(_ref) { 12148 var width = _ref.width, 12149 height = _ref.height; 12150 12151 return width * height; 12152} 12153 12154/** 12155 * Utility used to transform the `auto` placement to the placement with more 12156 * available space. 12157 * @method 12158 * @memberof Popper.Utils 12159 * @argument {Object} data - The data object generated by update method 12160 * @argument {Object} options - Modifiers configuration and options 12161 * @returns {Object} The data object, properly modified 12162 */ 12163function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { 12164 var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; 12165 12166 if (placement.indexOf('auto') === -1) { 12167 return placement; 12168 } 12169 12170 var boundaries = getBoundaries(popper, reference, padding, boundariesElement); 12171 12172 var rects = { 12173 top: { 12174 width: boundaries.width, 12175 height: refRect.top - boundaries.top 12176 }, 12177 right: { 12178 width: boundaries.right - refRect.right, 12179 height: boundaries.height 12180 }, 12181 bottom: { 12182 width: boundaries.width, 12183 height: boundaries.bottom - refRect.bottom 12184 }, 12185 left: { 12186 width: refRect.left - boundaries.left, 12187 height: boundaries.height 12188 } 12189 }; 12190 12191 var sortedAreas = Object.keys(rects).map(function (key) { 12192 return _extends({ 12193 key: key 12194 }, rects[key], { 12195 area: getArea(rects[key]) 12196 }); 12197 }).sort(function (a, b) { 12198 return b.area - a.area; 12199 }); 12200 12201 var filteredAreas = sortedAreas.filter(function (_ref2) { 12202 var width = _ref2.width, 12203 height = _ref2.height; 12204 return width >= popper.clientWidth && height >= popper.clientHeight; 12205 }); 12206 12207 var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; 12208 12209 var variation = placement.split('-')[1]; 12210 12211 return computedPlacement + (variation ? '-' + variation : ''); 12212} 12213 12214/** 12215 * Get offsets to the reference element 12216 * @method 12217 * @memberof Popper.Utils 12218 * @param {Object} state 12219 * @param {Element} popper - the popper element 12220 * @param {Element} reference - the reference element (the popper will be relative to this) 12221 * @param {Element} fixedPosition - is in fixed position mode 12222 * @returns {Object} An object containing the offsets which will be applied to the popper 12223 */ 12224function getReferenceOffsets(state, popper, reference) { 12225 var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 12226 12227 var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference); 12228 return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition); 12229} 12230 12231/** 12232 * Get the outer sizes of the given element (offset size + margins) 12233 * @method 12234 * @memberof Popper.Utils 12235 * @argument {Element} element 12236 * @returns {Object} object containing width and height properties 12237 */ 12238function getOuterSizes(element) { 12239 var window = element.ownerDocument.defaultView; 12240 var styles = window.getComputedStyle(element); 12241 var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0); 12242 var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0); 12243 var result = { 12244 width: element.offsetWidth + y, 12245 height: element.offsetHeight + x 12246 }; 12247 return result; 12248} 12249 12250/** 12251 * Get the opposite placement of the given one 12252 * @method 12253 * @memberof Popper.Utils 12254 * @argument {String} placement 12255 * @returns {String} flipped placement 12256 */ 12257function getOppositePlacement(placement) { 12258 var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; 12259 return placement.replace(/left|right|bottom|top/g, function (matched) { 12260 return hash[matched]; 12261 }); 12262} 12263 12264/** 12265 * Get offsets to the popper 12266 * @method 12267 * @memberof Popper.Utils 12268 * @param {Object} position - CSS position the Popper will get applied 12269 * @param {HTMLElement} popper - the popper element 12270 * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) 12271 * @param {String} placement - one of the valid placement options 12272 * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper 12273 */ 12274function getPopperOffsets(popper, referenceOffsets, placement) { 12275 placement = placement.split('-')[0]; 12276 12277 // Get popper node sizes 12278 var popperRect = getOuterSizes(popper); 12279 12280 // Add position, width and height to our offsets object 12281 var popperOffsets = { 12282 width: popperRect.width, 12283 height: popperRect.height 12284 }; 12285 12286 // depending by the popper placement we have to compute its offsets slightly differently 12287 var isHoriz = ['right', 'left'].indexOf(placement) !== -1; 12288 var mainSide = isHoriz ? 'top' : 'left'; 12289 var secondarySide = isHoriz ? 'left' : 'top'; 12290 var measurement = isHoriz ? 'height' : 'width'; 12291 var secondaryMeasurement = !isHoriz ? 'height' : 'width'; 12292 12293 popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; 12294 if (placement === secondarySide) { 12295 popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; 12296 } else { 12297 popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; 12298 } 12299 12300 return popperOffsets; 12301} 12302 12303/** 12304 * Mimics the `find` method of Array 12305 * @method 12306 * @memberof Popper.Utils 12307 * @argument {Array} arr 12308 * @argument prop 12309 * @argument value 12310 * @returns index or -1 12311 */ 12312function find(arr, check) { 12313 // use native find if supported 12314 if (Array.prototype.find) { 12315 return arr.find(check); 12316 } 12317 12318 // use `filter` to obtain the same behavior of `find` 12319 return arr.filter(check)[0]; 12320} 12321 12322/** 12323 * Return the index of the matching object 12324 * @method 12325 * @memberof Popper.Utils 12326 * @argument {Array} arr 12327 * @argument prop 12328 * @argument value 12329 * @returns index or -1 12330 */ 12331function findIndex(arr, prop, value) { 12332 // use native findIndex if supported 12333 if (Array.prototype.findIndex) { 12334 return arr.findIndex(function (cur) { 12335 return cur[prop] === value; 12336 }); 12337 } 12338 12339 // use `find` + `indexOf` if `findIndex` isn't supported 12340 var match = find(arr, function (obj) { 12341 return obj[prop] === value; 12342 }); 12343 return arr.indexOf(match); 12344} 12345 12346/** 12347 * Loop trough the list of modifiers and run them in order, 12348 * each of them will then edit the data object. 12349 * @method 12350 * @memberof Popper.Utils 12351 * @param {dataObject} data 12352 * @param {Array} modifiers 12353 * @param {String} ends - Optional modifier name used as stopper 12354 * @returns {dataObject} 12355 */ 12356function runModifiers(modifiers, data, ends) { 12357 var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); 12358 12359 modifiersToRun.forEach(function (modifier) { 12360 if (modifier['function']) { 12361 // eslint-disable-line dot-notation 12362 console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); 12363 } 12364 var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation 12365 if (modifier.enabled && isFunction(fn)) { 12366 // Add properties to offsets to make them a complete clientRect object 12367 // we do this before each modifier to make sure the previous one doesn't 12368 // mess with these values 12369 data.offsets.popper = getClientRect(data.offsets.popper); 12370 data.offsets.reference = getClientRect(data.offsets.reference); 12371 12372 data = fn(data, modifier); 12373 } 12374 }); 12375 12376 return data; 12377} 12378 12379/** 12380 * Updates the position of the popper, computing the new offsets and applying 12381 * the new style.<br /> 12382 * Prefer `scheduleUpdate` over `update` because of performance reasons. 12383 * @method 12384 * @memberof Popper 12385 */ 12386function update() { 12387 // if popper is destroyed, don't perform any further update 12388 if (this.state.isDestroyed) { 12389 return; 12390 } 12391 12392 var data = { 12393 instance: this, 12394 styles: {}, 12395 arrowStyles: {}, 12396 attributes: {}, 12397 flipped: false, 12398 offsets: {} 12399 }; 12400 12401 // compute reference element offsets 12402 data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); 12403 12404 // compute auto placement, store placement inside the data object, 12405 // modifiers will be able to edit `placement` if needed 12406 // and refer to originalPlacement to know the original value 12407 data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); 12408 12409 // store the computed placement inside `originalPlacement` 12410 data.originalPlacement = data.placement; 12411 12412 data.positionFixed = this.options.positionFixed; 12413 12414 // compute the popper offsets 12415 data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); 12416 12417 data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; 12418 12419 // run the modifiers 12420 data = runModifiers(this.modifiers, data); 12421 12422 // the first `update` will call `onCreate` callback 12423 // the other ones will call `onUpdate` callback 12424 if (!this.state.isCreated) { 12425 this.state.isCreated = true; 12426 this.options.onCreate(data); 12427 } else { 12428 this.options.onUpdate(data); 12429 } 12430} 12431 12432/** 12433 * Helper used to know if the given modifier is enabled. 12434 * @method 12435 * @memberof Popper.Utils 12436 * @returns {Boolean} 12437 */ 12438function isModifierEnabled(modifiers, modifierName) { 12439 return modifiers.some(function (_ref) { 12440 var name = _ref.name, 12441 enabled = _ref.enabled; 12442 return enabled && name === modifierName; 12443 }); 12444} 12445 12446/** 12447 * Get the prefixed supported property name 12448 * @method 12449 * @memberof Popper.Utils 12450 * @argument {String} property (camelCase) 12451 * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) 12452 */ 12453function getSupportedPropertyName(property) { 12454 var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; 12455 var upperProp = property.charAt(0).toUpperCase() + property.slice(1); 12456 12457 for (var i = 0; i < prefixes.length; i++) { 12458 var prefix = prefixes[i]; 12459 var toCheck = prefix ? '' + prefix + upperProp : property; 12460 if (typeof document.body.style[toCheck] !== 'undefined') { 12461 return toCheck; 12462 } 12463 } 12464 return null; 12465} 12466 12467/** 12468 * Destroys the popper. 12469 * @method 12470 * @memberof Popper 12471 */ 12472function destroy() { 12473 this.state.isDestroyed = true; 12474 12475 // touch DOM only if `applyStyle` modifier is enabled 12476 if (isModifierEnabled(this.modifiers, 'applyStyle')) { 12477 this.popper.removeAttribute('x-placement'); 12478 this.popper.style.position = ''; 12479 this.popper.style.top = ''; 12480 this.popper.style.left = ''; 12481 this.popper.style.right = ''; 12482 this.popper.style.bottom = ''; 12483 this.popper.style.willChange = ''; 12484 this.popper.style[getSupportedPropertyName('transform')] = ''; 12485 } 12486 12487 this.disableEventListeners(); 12488 12489 // remove the popper if user explicity asked for the deletion on destroy 12490 // do not use `remove` because IE11 doesn't support it 12491 if (this.options.removeOnDestroy) { 12492 this.popper.parentNode.removeChild(this.popper); 12493 } 12494 return this; 12495} 12496 12497/** 12498 * Get the window associated with the element 12499 * @argument {Element} element 12500 * @returns {Window} 12501 */ 12502function getWindow(element) { 12503 var ownerDocument = element.ownerDocument; 12504 return ownerDocument ? ownerDocument.defaultView : window; 12505} 12506 12507function attachToScrollParents(scrollParent, event, callback, scrollParents) { 12508 var isBody = scrollParent.nodeName === 'BODY'; 12509 var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; 12510 target.addEventListener(event, callback, { passive: true }); 12511 12512 if (!isBody) { 12513 attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); 12514 } 12515 scrollParents.push(target); 12516} 12517 12518/** 12519 * Setup needed event listeners used to update the popper position 12520 * @method 12521 * @memberof Popper.Utils 12522 * @private 12523 */ 12524function setupEventListeners(reference, options, state, updateBound) { 12525 // Resize event listener on window 12526 state.updateBound = updateBound; 12527 getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); 12528 12529 // Scroll event listener on scroll parents 12530 var scrollElement = getScrollParent(reference); 12531 attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); 12532 state.scrollElement = scrollElement; 12533 state.eventsEnabled = true; 12534 12535 return state; 12536} 12537 12538/** 12539 * It will add resize/scroll events and start recalculating 12540 * position of the popper element when they are triggered. 12541 * @method 12542 * @memberof Popper 12543 */ 12544function enableEventListeners() { 12545 if (!this.state.eventsEnabled) { 12546 this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); 12547 } 12548} 12549 12550/** 12551 * Remove event listeners used to update the popper position 12552 * @method 12553 * @memberof Popper.Utils 12554 * @private 12555 */ 12556function removeEventListeners(reference, state) { 12557 // Remove resize event listener on window 12558 getWindow(reference).removeEventListener('resize', state.updateBound); 12559 12560 // Remove scroll event listener on scroll parents 12561 state.scrollParents.forEach(function (target) { 12562 target.removeEventListener('scroll', state.updateBound); 12563 }); 12564 12565 // Reset state 12566 state.updateBound = null; 12567 state.scrollParents = []; 12568 state.scrollElement = null; 12569 state.eventsEnabled = false; 12570 return state; 12571} 12572 12573/** 12574 * It will remove resize/scroll events and won't recalculate popper position 12575 * when they are triggered. It also won't trigger `onUpdate` callback anymore, 12576 * unless you call `update` method manually. 12577 * @method 12578 * @memberof Popper 12579 */ 12580function disableEventListeners() { 12581 if (this.state.eventsEnabled) { 12582 cancelAnimationFrame(this.scheduleUpdate); 12583 this.state = removeEventListeners(this.reference, this.state); 12584 } 12585} 12586 12587/** 12588 * Tells if a given input is a number 12589 * @method 12590 * @memberof Popper.Utils 12591 * @param {*} input to check 12592 * @return {Boolean} 12593 */ 12594function isNumeric(n) { 12595 return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); 12596} 12597 12598/** 12599 * Set the style to the given popper 12600 * @method 12601 * @memberof Popper.Utils 12602 * @argument {Element} element - Element to apply the style to 12603 * @argument {Object} styles 12604 * Object with a list of properties and values which will be applied to the element 12605 */ 12606function setStyles(element, styles) { 12607 Object.keys(styles).forEach(function (prop) { 12608 var unit = ''; 12609 // add unit if the value is numeric and is one of the following 12610 if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { 12611 unit = 'px'; 12612 } 12613 element.style[prop] = styles[prop] + unit; 12614 }); 12615} 12616 12617/** 12618 * Set the attributes to the given popper 12619 * @method 12620 * @memberof Popper.Utils 12621 * @argument {Element} element - Element to apply the attributes to 12622 * @argument {Object} styles 12623 * Object with a list of properties and values which will be applied to the element 12624 */ 12625function setAttributes(element, attributes) { 12626 Object.keys(attributes).forEach(function (prop) { 12627 var value = attributes[prop]; 12628 if (value !== false) { 12629 element.setAttribute(prop, attributes[prop]); 12630 } else { 12631 element.removeAttribute(prop); 12632 } 12633 }); 12634} 12635 12636/** 12637 * @function 12638 * @memberof Modifiers 12639 * @argument {Object} data - The data object generated by `update` method 12640 * @argument {Object} data.styles - List of style properties - values to apply to popper element 12641 * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element 12642 * @argument {Object} options - Modifiers configuration and options 12643 * @returns {Object} The same data object 12644 */ 12645function applyStyle(data) { 12646 // any property present in `data.styles` will be applied to the popper, 12647 // in this way we can make the 3rd party modifiers add custom styles to it 12648 // Be aware, modifiers could override the properties defined in the previous 12649 // lines of this modifier! 12650 setStyles(data.instance.popper, data.styles); 12651 12652 // any property present in `data.attributes` will be applied to the popper, 12653 // they will be set as HTML attributes of the element 12654 setAttributes(data.instance.popper, data.attributes); 12655 12656 // if arrowElement is defined and arrowStyles has some properties 12657 if (data.arrowElement && Object.keys(data.arrowStyles).length) { 12658 setStyles(data.arrowElement, data.arrowStyles); 12659 } 12660 12661 return data; 12662} 12663 12664/** 12665 * Set the x-placement attribute before everything else because it could be used 12666 * to add margins to the popper margins needs to be calculated to get the 12667 * correct popper offsets. 12668 * @method 12669 * @memberof Popper.modifiers 12670 * @param {HTMLElement} reference - The reference element used to position the popper 12671 * @param {HTMLElement} popper - The HTML element used as popper 12672 * @param {Object} options - Popper.js options 12673 */ 12674function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { 12675 // compute reference element offsets 12676 var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed); 12677 12678 // compute auto placement, store placement inside the data object, 12679 // modifiers will be able to edit `placement` if needed 12680 // and refer to originalPlacement to know the original value 12681 var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); 12682 12683 popper.setAttribute('x-placement', placement); 12684 12685 // Apply `position` to popper before anything else because 12686 // without the position applied we can't guarantee correct computations 12687 setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' }); 12688 12689 return options; 12690} 12691 12692/** 12693 * @function 12694 * @memberof Popper.Utils 12695 * @argument {Object} data - The data object generated by `update` method 12696 * @argument {Boolean} shouldRound - If the offsets should be rounded at all 12697 * @returns {Object} The popper's position offsets rounded 12698 * 12699 * The tale of pixel-perfect positioning. It's still not 100% perfect, but as 12700 * good as it can be within reason. 12701 * Discussion here: https://github.com/FezVrasta/popper.js/pull/715 12702 * 12703 * Low DPI screens cause a popper to be blurry if not using full pixels (Safari 12704 * as well on High DPI screens). 12705 * 12706 * Firefox prefers no rounding for positioning and does not have blurriness on 12707 * high DPI screens. 12708 * 12709 * Only horizontal placement and left/right values need to be considered. 12710 */ 12711function getRoundedOffsets(data, shouldRound) { 12712 var _data$offsets = data.offsets, 12713 popper = _data$offsets.popper, 12714 reference = _data$offsets.reference; 12715 var round = Math.round, 12716 floor = Math.floor; 12717 12718 var noRound = function noRound(v) { 12719 return v; 12720 }; 12721 12722 var referenceWidth = round(reference.width); 12723 var popperWidth = round(popper.width); 12724 12725 var isVertical = ['left', 'right'].indexOf(data.placement) !== -1; 12726 var isVariation = data.placement.indexOf('-') !== -1; 12727 var sameWidthParity = referenceWidth % 2 === popperWidth % 2; 12728 var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1; 12729 12730 var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor; 12731 var verticalToInteger = !shouldRound ? noRound : round; 12732 12733 return { 12734 left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left), 12735 top: verticalToInteger(popper.top), 12736 bottom: verticalToInteger(popper.bottom), 12737 right: horizontalToInteger(popper.right) 12738 }; 12739} 12740 12741var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent); 12742 12743/** 12744 * @function 12745 * @memberof Modifiers 12746 * @argument {Object} data - The data object generated by `update` method 12747 * @argument {Object} options - Modifiers configuration and options 12748 * @returns {Object} The data object, properly modified 12749 */ 12750function computeStyle(data, options) { 12751 var x = options.x, 12752 y = options.y; 12753 var popper = data.offsets.popper; 12754 12755 // Remove this legacy support in Popper.js v2 12756 12757 var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { 12758 return modifier.name === 'applyStyle'; 12759 }).gpuAcceleration; 12760 if (legacyGpuAccelerationOption !== undefined) { 12761 console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); 12762 } 12763 var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; 12764 12765 var offsetParent = getOffsetParent(data.instance.popper); 12766 var offsetParentRect = getBoundingClientRect(offsetParent); 12767 12768 // Styles 12769 var styles = { 12770 position: popper.position 12771 }; 12772 12773 var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox); 12774 12775 var sideA = x === 'bottom' ? 'top' : 'bottom'; 12776 var sideB = y === 'right' ? 'left' : 'right'; 12777 12778 // if gpuAcceleration is set to `true` and transform is supported, 12779 // we use `translate3d` to apply the position to the popper we 12780 // automatically use the supported prefixed version if needed 12781 var prefixedProperty = getSupportedPropertyName('transform'); 12782 12783 // now, let's make a step back and look at this code closely (wtf?) 12784 // If the content of the popper grows once it's been positioned, it 12785 // may happen that the popper gets misplaced because of the new content 12786 // overflowing its reference element 12787 // To avoid this problem, we provide two options (x and y), which allow 12788 // the consumer to define the offset origin. 12789 // If we position a popper on top of a reference element, we can set 12790 // `x` to `top` to make the popper grow towards its top instead of 12791 // its bottom. 12792 var left = void 0, 12793 top = void 0; 12794 if (sideA === 'bottom') { 12795 // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar) 12796 // and not the bottom of the html element 12797 if (offsetParent.nodeName === 'HTML') { 12798 top = -offsetParent.clientHeight + offsets.bottom; 12799 } else { 12800 top = -offsetParentRect.height + offsets.bottom; 12801 } 12802 } else { 12803 top = offsets.top; 12804 } 12805 if (sideB === 'right') { 12806 if (offsetParent.nodeName === 'HTML') { 12807 left = -offsetParent.clientWidth + offsets.right; 12808 } else { 12809 left = -offsetParentRect.width + offsets.right; 12810 } 12811 } else { 12812 left = offsets.left; 12813 } 12814 if (gpuAcceleration && prefixedProperty) { 12815 styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; 12816 styles[sideA] = 0; 12817 styles[sideB] = 0; 12818 styles.willChange = 'transform'; 12819 } else { 12820 // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties 12821 var invertTop = sideA === 'bottom' ? -1 : 1; 12822 var invertLeft = sideB === 'right' ? -1 : 1; 12823 styles[sideA] = top * invertTop; 12824 styles[sideB] = left * invertLeft; 12825 styles.willChange = sideA + ', ' + sideB; 12826 } 12827 12828 // Attributes 12829 var attributes = { 12830 'x-placement': data.placement 12831 }; 12832 12833 // Update `data` attributes, styles and arrowStyles 12834 data.attributes = _extends({}, attributes, data.attributes); 12835 data.styles = _extends({}, styles, data.styles); 12836 data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); 12837 12838 return data; 12839} 12840 12841/** 12842 * Helper used to know if the given modifier depends from another one.<br /> 12843 * It checks if the needed modifier is listed and enabled. 12844 * @method 12845 * @memberof Popper.Utils 12846 * @param {Array} modifiers - list of modifiers 12847 * @param {String} requestingName - name of requesting modifier 12848 * @param {String} requestedName - name of requested modifier 12849 * @returns {Boolean} 12850 */ 12851function isModifierRequired(modifiers, requestingName, requestedName) { 12852 var requesting = find(modifiers, function (_ref) { 12853 var name = _ref.name; 12854 return name === requestingName; 12855 }); 12856 12857 var isRequired = !!requesting && modifiers.some(function (modifier) { 12858 return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; 12859 }); 12860 12861 if (!isRequired) { 12862 var _requesting = '`' + requestingName + '`'; 12863 var requested = '`' + requestedName + '`'; 12864 console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); 12865 } 12866 return isRequired; 12867} 12868 12869/** 12870 * @function 12871 * @memberof Modifiers 12872 * @argument {Object} data - The data object generated by update method 12873 * @argument {Object} options - Modifiers configuration and options 12874 * @returns {Object} The data object, properly modified 12875 */ 12876function arrow(data, options) { 12877 var _data$offsets$arrow; 12878 12879 // arrow depends on keepTogether in order to work 12880 if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { 12881 return data; 12882 } 12883 12884 var arrowElement = options.element; 12885 12886 // if arrowElement is a string, suppose it's a CSS selector 12887 if (typeof arrowElement === 'string') { 12888 arrowElement = data.instance.popper.querySelector(arrowElement); 12889 12890 // if arrowElement is not found, don't run the modifier 12891 if (!arrowElement) { 12892 return data; 12893 } 12894 } else { 12895 // if the arrowElement isn't a query selector we must check that the 12896 // provided DOM node is child of its popper node 12897 if (!data.instance.popper.contains(arrowElement)) { 12898 console.warn('WARNING: `arrow.element` must be child of its popper element!'); 12899 return data; 12900 } 12901 } 12902 12903 var placement = data.placement.split('-')[0]; 12904 var _data$offsets = data.offsets, 12905 popper = _data$offsets.popper, 12906 reference = _data$offsets.reference; 12907 12908 var isVertical = ['left', 'right'].indexOf(placement) !== -1; 12909 12910 var len = isVertical ? 'height' : 'width'; 12911 var sideCapitalized = isVertical ? 'Top' : 'Left'; 12912 var side = sideCapitalized.toLowerCase(); 12913 var altSide = isVertical ? 'left' : 'top'; 12914 var opSide = isVertical ? 'bottom' : 'right'; 12915 var arrowElementSize = getOuterSizes(arrowElement)[len]; 12916 12917 // 12918 // extends keepTogether behavior making sure the popper and its 12919 // reference have enough pixels in conjunction 12920 // 12921 12922 // top/left side 12923 if (reference[opSide] - arrowElementSize < popper[side]) { 12924 data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); 12925 } 12926 // bottom/right side 12927 if (reference[side] + arrowElementSize > popper[opSide]) { 12928 data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; 12929 } 12930 data.offsets.popper = getClientRect(data.offsets.popper); 12931 12932 // compute center of the popper 12933 var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; 12934 12935 // Compute the sideValue using the updated popper offsets 12936 // take popper margin in account because we don't have this info available 12937 var css = getStyleComputedProperty(data.instance.popper); 12938 var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10); 12939 var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10); 12940 var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; 12941 12942 // prevent arrowElement from being placed not contiguously to its popper 12943 sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); 12944 12945 data.arrowElement = arrowElement; 12946 data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow); 12947 12948 return data; 12949} 12950 12951/** 12952 * Get the opposite placement variation of the given one 12953 * @method 12954 * @memberof Popper.Utils 12955 * @argument {String} placement variation 12956 * @returns {String} flipped placement variation 12957 */ 12958function getOppositeVariation(variation) { 12959 if (variation === 'end') { 12960 return 'start'; 12961 } else if (variation === 'start') { 12962 return 'end'; 12963 } 12964 return variation; 12965} 12966 12967/** 12968 * List of accepted placements to use as values of the `placement` option.<br /> 12969 * Valid placements are: 12970 * - `auto` 12971 * - `top` 12972 * - `right` 12973 * - `bottom` 12974 * - `left` 12975 * 12976 * Each placement can have a variation from this list: 12977 * - `-start` 12978 * - `-end` 12979 * 12980 * Variations are interpreted easily if you think of them as the left to right 12981 * written languages. Horizontally (`top` and `bottom`), `start` is left and `end` 12982 * is right.<br /> 12983 * Vertically (`left` and `right`), `start` is top and `end` is bottom. 12984 * 12985 * Some valid examples are: 12986 * - `top-end` (on top of reference, right aligned) 12987 * - `right-start` (on right of reference, top aligned) 12988 * - `bottom` (on bottom, centered) 12989 * - `auto-end` (on the side with more space available, alignment depends by placement) 12990 * 12991 * @static 12992 * @type {Array} 12993 * @enum {String} 12994 * @readonly 12995 * @method placements 12996 * @memberof Popper 12997 */ 12998var 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']; 12999 13000// Get rid of `auto` `auto-start` and `auto-end` 13001var validPlacements = placements.slice(3); 13002 13003/** 13004 * Given an initial placement, returns all the subsequent placements 13005 * clockwise (or counter-clockwise). 13006 * 13007 * @method 13008 * @memberof Popper.Utils 13009 * @argument {String} placement - A valid placement (it accepts variations) 13010 * @argument {Boolean} counter - Set to true to walk the placements counterclockwise 13011 * @returns {Array} placements including their variations 13012 */ 13013function clockwise(placement) { 13014 var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 13015 13016 var index = validPlacements.indexOf(placement); 13017 var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); 13018 return counter ? arr.reverse() : arr; 13019} 13020 13021var BEHAVIORS = { 13022 FLIP: 'flip', 13023 CLOCKWISE: 'clockwise', 13024 COUNTERCLOCKWISE: 'counterclockwise' 13025}; 13026 13027/** 13028 * @function 13029 * @memberof Modifiers 13030 * @argument {Object} data - The data object generated by update method 13031 * @argument {Object} options - Modifiers configuration and options 13032 * @returns {Object} The data object, properly modified 13033 */ 13034function flip(data, options) { 13035 // if `inner` modifier is enabled, we can't use the `flip` modifier 13036 if (isModifierEnabled(data.instance.modifiers, 'inner')) { 13037 return data; 13038 } 13039 13040 if (data.flipped && data.placement === data.originalPlacement) { 13041 // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides 13042 return data; 13043 } 13044 13045 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed); 13046 13047 var placement = data.placement.split('-')[0]; 13048 var placementOpposite = getOppositePlacement(placement); 13049 var variation = data.placement.split('-')[1] || ''; 13050 13051 var flipOrder = []; 13052 13053 switch (options.behavior) { 13054 case BEHAVIORS.FLIP: 13055 flipOrder = [placement, placementOpposite]; 13056 break; 13057 case BEHAVIORS.CLOCKWISE: 13058 flipOrder = clockwise(placement); 13059 break; 13060 case BEHAVIORS.COUNTERCLOCKWISE: 13061 flipOrder = clockwise(placement, true); 13062 break; 13063 default: 13064 flipOrder = options.behavior; 13065 } 13066 13067 flipOrder.forEach(function (step, index) { 13068 if (placement !== step || flipOrder.length === index + 1) { 13069 return data; 13070 } 13071 13072 placement = data.placement.split('-')[0]; 13073 placementOpposite = getOppositePlacement(placement); 13074 13075 var popperOffsets = data.offsets.popper; 13076 var refOffsets = data.offsets.reference; 13077 13078 // using floor because the reference offsets may contain decimals we are not going to consider here 13079 var floor = Math.floor; 13080 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); 13081 13082 var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); 13083 var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); 13084 var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); 13085 var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); 13086 13087 var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; 13088 13089 // flip the variation if required 13090 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 13091 13092 // flips variation if reference element overflows boundaries 13093 var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom); 13094 13095 // flips variation if popper content overflows boundaries 13096 var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop); 13097 13098 var flippedVariation = flippedVariationByRef || flippedVariationByContent; 13099 13100 if (overlapsRef || overflowsBoundaries || flippedVariation) { 13101 // this boolean to detect any flip loop 13102 data.flipped = true; 13103 13104 if (overlapsRef || overflowsBoundaries) { 13105 placement = flipOrder[index + 1]; 13106 } 13107 13108 if (flippedVariation) { 13109 variation = getOppositeVariation(variation); 13110 } 13111 13112 data.placement = placement + (variation ? '-' + variation : ''); 13113 13114 // this object contains `position`, we want to preserve it along with 13115 // any additional property we may add in the future 13116 data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); 13117 13118 data = runModifiers(data.instance.modifiers, data, 'flip'); 13119 } 13120 }); 13121 return data; 13122} 13123 13124/** 13125 * @function 13126 * @memberof Modifiers 13127 * @argument {Object} data - The data object generated by update method 13128 * @argument {Object} options - Modifiers configuration and options 13129 * @returns {Object} The data object, properly modified 13130 */ 13131function keepTogether(data) { 13132 var _data$offsets = data.offsets, 13133 popper = _data$offsets.popper, 13134 reference = _data$offsets.reference; 13135 13136 var placement = data.placement.split('-')[0]; 13137 var floor = Math.floor; 13138 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 13139 var side = isVertical ? 'right' : 'bottom'; 13140 var opSide = isVertical ? 'left' : 'top'; 13141 var measurement = isVertical ? 'width' : 'height'; 13142 13143 if (popper[side] < floor(reference[opSide])) { 13144 data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; 13145 } 13146 if (popper[opSide] > floor(reference[side])) { 13147 data.offsets.popper[opSide] = floor(reference[side]); 13148 } 13149 13150 return data; 13151} 13152 13153/** 13154 * Converts a string containing value + unit into a px value number 13155 * @function 13156 * @memberof {modifiers~offset} 13157 * @private 13158 * @argument {String} str - Value + unit string 13159 * @argument {String} measurement - `height` or `width` 13160 * @argument {Object} popperOffsets 13161 * @argument {Object} referenceOffsets 13162 * @returns {Number|String} 13163 * Value in pixels, or original string if no values were extracted 13164 */ 13165function toValue(str, measurement, popperOffsets, referenceOffsets) { 13166 // separate value from unit 13167 var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); 13168 var value = +split[1]; 13169 var unit = split[2]; 13170 13171 // If it's not a number it's an operator, I guess 13172 if (!value) { 13173 return str; 13174 } 13175 13176 if (unit.indexOf('%') === 0) { 13177 var element = void 0; 13178 switch (unit) { 13179 case '%p': 13180 element = popperOffsets; 13181 break; 13182 case '%': 13183 case '%r': 13184 default: 13185 element = referenceOffsets; 13186 } 13187 13188 var rect = getClientRect(element); 13189 return rect[measurement] / 100 * value; 13190 } else if (unit === 'vh' || unit === 'vw') { 13191 // if is a vh or vw, we calculate the size based on the viewport 13192 var size = void 0; 13193 if (unit === 'vh') { 13194 size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); 13195 } else { 13196 size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 13197 } 13198 return size / 100 * value; 13199 } else { 13200 // if is an explicit pixel unit, we get rid of the unit and keep the value 13201 // if is an implicit unit, it's px, and we return just the value 13202 return value; 13203 } 13204} 13205 13206/** 13207 * Parse an `offset` string to extrapolate `x` and `y` numeric offsets. 13208 * @function 13209 * @memberof {modifiers~offset} 13210 * @private 13211 * @argument {String} offset 13212 * @argument {Object} popperOffsets 13213 * @argument {Object} referenceOffsets 13214 * @argument {String} basePlacement 13215 * @returns {Array} a two cells array with x and y offsets in numbers 13216 */ 13217function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { 13218 var offsets = [0, 0]; 13219 13220 // Use height if placement is left or right and index is 0 otherwise use width 13221 // in this way the first offset will use an axis and the second one 13222 // will use the other one 13223 var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; 13224 13225 // Split the offset string to obtain a list of values and operands 13226 // The regex addresses values with the plus or minus sign in front (+10, -20, etc) 13227 var fragments = offset.split(/(\+|\-)/).map(function (frag) { 13228 return frag.trim(); 13229 }); 13230 13231 // Detect if the offset string contains a pair of values or a single one 13232 // they could be separated by comma or space 13233 var divider = fragments.indexOf(find(fragments, function (frag) { 13234 return frag.search(/,|\s/) !== -1; 13235 })); 13236 13237 if (fragments[divider] && fragments[divider].indexOf(',') === -1) { 13238 console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); 13239 } 13240 13241 // If divider is found, we divide the list of values and operands to divide 13242 // them by ofset X and Y. 13243 var splitRegex = /\s*,\s*|\s+/; 13244 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]; 13245 13246 // Convert the values with units to absolute pixels to allow our computations 13247 ops = ops.map(function (op, index) { 13248 // Most of the units rely on the orientation of the popper 13249 var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; 13250 var mergeWithPrevious = false; 13251 return op 13252 // This aggregates any `+` or `-` sign that aren't considered operators 13253 // e.g.: 10 + +5 => [10, +, +5] 13254 .reduce(function (a, b) { 13255 if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { 13256 a[a.length - 1] = b; 13257 mergeWithPrevious = true; 13258 return a; 13259 } else if (mergeWithPrevious) { 13260 a[a.length - 1] += b; 13261 mergeWithPrevious = false; 13262 return a; 13263 } else { 13264 return a.concat(b); 13265 } 13266 }, []) 13267 // Here we convert the string values into number values (in px) 13268 .map(function (str) { 13269 return toValue(str, measurement, popperOffsets, referenceOffsets); 13270 }); 13271 }); 13272 13273 // Loop trough the offsets arrays and execute the operations 13274 ops.forEach(function (op, index) { 13275 op.forEach(function (frag, index2) { 13276 if (isNumeric(frag)) { 13277 offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); 13278 } 13279 }); 13280 }); 13281 return offsets; 13282} 13283 13284/** 13285 * @function 13286 * @memberof Modifiers 13287 * @argument {Object} data - The data object generated by update method 13288 * @argument {Object} options - Modifiers configuration and options 13289 * @argument {Number|String} options.offset=0 13290 * The offset value as described in the modifier description 13291 * @returns {Object} The data object, properly modified 13292 */ 13293function offset(data, _ref) { 13294 var offset = _ref.offset; 13295 var placement = data.placement, 13296 _data$offsets = data.offsets, 13297 popper = _data$offsets.popper, 13298 reference = _data$offsets.reference; 13299 13300 var basePlacement = placement.split('-')[0]; 13301 13302 var offsets = void 0; 13303 if (isNumeric(+offset)) { 13304 offsets = [+offset, 0]; 13305 } else { 13306 offsets = parseOffset(offset, popper, reference, basePlacement); 13307 } 13308 13309 if (basePlacement === 'left') { 13310 popper.top += offsets[0]; 13311 popper.left -= offsets[1]; 13312 } else if (basePlacement === 'right') { 13313 popper.top += offsets[0]; 13314 popper.left += offsets[1]; 13315 } else if (basePlacement === 'top') { 13316 popper.left += offsets[0]; 13317 popper.top -= offsets[1]; 13318 } else if (basePlacement === 'bottom') { 13319 popper.left += offsets[0]; 13320 popper.top += offsets[1]; 13321 } 13322 13323 data.popper = popper; 13324 return data; 13325} 13326 13327/** 13328 * @function 13329 * @memberof Modifiers 13330 * @argument {Object} data - The data object generated by `update` method 13331 * @argument {Object} options - Modifiers configuration and options 13332 * @returns {Object} The data object, properly modified 13333 */ 13334function preventOverflow(data, options) { 13335 var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); 13336 13337 // If offsetParent is the reference element, we really want to 13338 // go one step up and use the next offsetParent as reference to 13339 // avoid to make this modifier completely useless and look like broken 13340 if (data.instance.reference === boundariesElement) { 13341 boundariesElement = getOffsetParent(boundariesElement); 13342 } 13343 13344 // NOTE: DOM access here 13345 // resets the popper's position so that the document size can be calculated excluding 13346 // the size of the popper element itself 13347 var transformProp = getSupportedPropertyName('transform'); 13348 var popperStyles = data.instance.popper.style; // assignment to help minification 13349 var top = popperStyles.top, 13350 left = popperStyles.left, 13351 transform = popperStyles[transformProp]; 13352 13353 popperStyles.top = ''; 13354 popperStyles.left = ''; 13355 popperStyles[transformProp] = ''; 13356 13357 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed); 13358 13359 // NOTE: DOM access here 13360 // restores the original style properties after the offsets have been computed 13361 popperStyles.top = top; 13362 popperStyles.left = left; 13363 popperStyles[transformProp] = transform; 13364 13365 options.boundaries = boundaries; 13366 13367 var order = options.priority; 13368 var popper = data.offsets.popper; 13369 13370 var check = { 13371 primary: function primary(placement) { 13372 var value = popper[placement]; 13373 if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { 13374 value = Math.max(popper[placement], boundaries[placement]); 13375 } 13376 return defineProperty({}, placement, value); 13377 }, 13378 secondary: function secondary(placement) { 13379 var mainSide = placement === 'right' ? 'left' : 'top'; 13380 var value = popper[mainSide]; 13381 if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { 13382 value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); 13383 } 13384 return defineProperty({}, mainSide, value); 13385 } 13386 }; 13387 13388 order.forEach(function (placement) { 13389 var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; 13390 popper = _extends({}, popper, check[side](placement)); 13391 }); 13392 13393 data.offsets.popper = popper; 13394 13395 return data; 13396} 13397 13398/** 13399 * @function 13400 * @memberof Modifiers 13401 * @argument {Object} data - The data object generated by `update` method 13402 * @argument {Object} options - Modifiers configuration and options 13403 * @returns {Object} The data object, properly modified 13404 */ 13405function shift(data) { 13406 var placement = data.placement; 13407 var basePlacement = placement.split('-')[0]; 13408 var shiftvariation = placement.split('-')[1]; 13409 13410 // if shift shiftvariation is specified, run the modifier 13411 if (shiftvariation) { 13412 var _data$offsets = data.offsets, 13413 reference = _data$offsets.reference, 13414 popper = _data$offsets.popper; 13415 13416 var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; 13417 var side = isVertical ? 'left' : 'top'; 13418 var measurement = isVertical ? 'width' : 'height'; 13419 13420 var shiftOffsets = { 13421 start: defineProperty({}, side, reference[side]), 13422 end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) 13423 }; 13424 13425 data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); 13426 } 13427 13428 return data; 13429} 13430 13431/** 13432 * @function 13433 * @memberof Modifiers 13434 * @argument {Object} data - The data object generated by update method 13435 * @argument {Object} options - Modifiers configuration and options 13436 * @returns {Object} The data object, properly modified 13437 */ 13438function hide(data) { 13439 if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { 13440 return data; 13441 } 13442 13443 var refRect = data.offsets.reference; 13444 var bound = find(data.instance.modifiers, function (modifier) { 13445 return modifier.name === 'preventOverflow'; 13446 }).boundaries; 13447 13448 if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { 13449 // Avoid unnecessary DOM access if visibility hasn't changed 13450 if (data.hide === true) { 13451 return data; 13452 } 13453 13454 data.hide = true; 13455 data.attributes['x-out-of-boundaries'] = ''; 13456 } else { 13457 // Avoid unnecessary DOM access if visibility hasn't changed 13458 if (data.hide === false) { 13459 return data; 13460 } 13461 13462 data.hide = false; 13463 data.attributes['x-out-of-boundaries'] = false; 13464 } 13465 13466 return data; 13467} 13468 13469/** 13470 * @function 13471 * @memberof Modifiers 13472 * @argument {Object} data - The data object generated by `update` method 13473 * @argument {Object} options - Modifiers configuration and options 13474 * @returns {Object} The data object, properly modified 13475 */ 13476function inner(data) { 13477 var placement = data.placement; 13478 var basePlacement = placement.split('-')[0]; 13479 var _data$offsets = data.offsets, 13480 popper = _data$offsets.popper, 13481 reference = _data$offsets.reference; 13482 13483 var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; 13484 13485 var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; 13486 13487 popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); 13488 13489 data.placement = getOppositePlacement(placement); 13490 data.offsets.popper = getClientRect(popper); 13491 13492 return data; 13493} 13494 13495/** 13496 * Modifier function, each modifier can have a function of this type assigned 13497 * to its `fn` property.<br /> 13498 * These functions will be called on each update, this means that you must 13499 * make sure they are performant enough to avoid performance bottlenecks. 13500 * 13501 * @function ModifierFn 13502 * @argument {dataObject} data - The data object generated by `update` method 13503 * @argument {Object} options - Modifiers configuration and options 13504 * @returns {dataObject} The data object, properly modified 13505 */ 13506 13507/** 13508 * Modifiers are plugins used to alter the behavior of your poppers.<br /> 13509 * Popper.js uses a set of 9 modifiers to provide all the basic functionalities 13510 * needed by the library. 13511 * 13512 * Usually you don't want to override the `order`, `fn` and `onLoad` props. 13513 * All the other properties are configurations that could be tweaked. 13514 * @namespace modifiers 13515 */ 13516var modifiers = { 13517 /** 13518 * Modifier used to shift the popper on the start or end of its reference 13519 * element.<br /> 13520 * It will read the variation of the `placement` property.<br /> 13521 * It can be one either `-end` or `-start`. 13522 * @memberof modifiers 13523 * @inner 13524 */ 13525 shift: { 13526 /** @prop {number} order=100 - Index used to define the order of execution */ 13527 order: 100, 13528 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13529 enabled: true, 13530 /** @prop {ModifierFn} */ 13531 fn: shift 13532 }, 13533 13534 /** 13535 * The `offset` modifier can shift your popper on both its axis. 13536 * 13537 * It accepts the following units: 13538 * - `px` or unit-less, interpreted as pixels 13539 * - `%` or `%r`, percentage relative to the length of the reference element 13540 * - `%p`, percentage relative to the length of the popper element 13541 * - `vw`, CSS viewport width unit 13542 * - `vh`, CSS viewport height unit 13543 * 13544 * For length is intended the main axis relative to the placement of the popper.<br /> 13545 * This means that if the placement is `top` or `bottom`, the length will be the 13546 * `width`. In case of `left` or `right`, it will be the `height`. 13547 * 13548 * You can provide a single value (as `Number` or `String`), or a pair of values 13549 * as `String` divided by a comma or one (or more) white spaces.<br /> 13550 * The latter is a deprecated method because it leads to confusion and will be 13551 * removed in v2.<br /> 13552 * Additionally, it accepts additions and subtractions between different units. 13553 * Note that multiplications and divisions aren't supported. 13554 * 13555 * Valid examples are: 13556 * ``` 13557 * 10 13558 * '10%' 13559 * '10, 10' 13560 * '10%, 10' 13561 * '10 + 10%' 13562 * '10 - 5vh + 3%' 13563 * '-10px + 5vh, 5px - 6%' 13564 * ``` 13565 * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap 13566 * > with their reference element, unfortunately, you will have to disable the `flip` modifier. 13567 * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373). 13568 * 13569 * @memberof modifiers 13570 * @inner 13571 */ 13572 offset: { 13573 /** @prop {number} order=200 - Index used to define the order of execution */ 13574 order: 200, 13575 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13576 enabled: true, 13577 /** @prop {ModifierFn} */ 13578 fn: offset, 13579 /** @prop {Number|String} offset=0 13580 * The offset value as described in the modifier description 13581 */ 13582 offset: 0 13583 }, 13584 13585 /** 13586 * Modifier used to prevent the popper from being positioned outside the boundary. 13587 * 13588 * A scenario exists where the reference itself is not within the boundaries.<br /> 13589 * We can say it has "escaped the boundaries" — or just "escaped".<br /> 13590 * In this case we need to decide whether the popper should either: 13591 * 13592 * - detach from the reference and remain "trapped" in the boundaries, or 13593 * - if it should ignore the boundary and "escape with its reference" 13594 * 13595 * When `escapeWithReference` is set to`true` and reference is completely 13596 * outside its boundaries, the popper will overflow (or completely leave) 13597 * the boundaries in order to remain attached to the edge of the reference. 13598 * 13599 * @memberof modifiers 13600 * @inner 13601 */ 13602 preventOverflow: { 13603 /** @prop {number} order=300 - Index used to define the order of execution */ 13604 order: 300, 13605 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13606 enabled: true, 13607 /** @prop {ModifierFn} */ 13608 fn: preventOverflow, 13609 /** 13610 * @prop {Array} [priority=['left','right','top','bottom']] 13611 * Popper will try to prevent overflow following these priorities by default, 13612 * then, it could overflow on the left and on top of the `boundariesElement` 13613 */ 13614 priority: ['left', 'right', 'top', 'bottom'], 13615 /** 13616 * @prop {number} padding=5 13617 * Amount of pixel used to define a minimum distance between the boundaries 13618 * and the popper. This makes sure the popper always has a little padding 13619 * between the edges of its container 13620 */ 13621 padding: 5, 13622 /** 13623 * @prop {String|HTMLElement} boundariesElement='scrollParent' 13624 * Boundaries used by the modifier. Can be `scrollParent`, `window`, 13625 * `viewport` or any DOM element. 13626 */ 13627 boundariesElement: 'scrollParent' 13628 }, 13629 13630 /** 13631 * Modifier used to make sure the reference and its popper stay near each other 13632 * without leaving any gap between the two. Especially useful when the arrow is 13633 * enabled and you want to ensure that it points to its reference element. 13634 * It cares only about the first axis. You can still have poppers with margin 13635 * between the popper and its reference element. 13636 * @memberof modifiers 13637 * @inner 13638 */ 13639 keepTogether: { 13640 /** @prop {number} order=400 - Index used to define the order of execution */ 13641 order: 400, 13642 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13643 enabled: true, 13644 /** @prop {ModifierFn} */ 13645 fn: keepTogether 13646 }, 13647 13648 /** 13649 * This modifier is used to move the `arrowElement` of the popper to make 13650 * sure it is positioned between the reference element and its popper element. 13651 * It will read the outer size of the `arrowElement` node to detect how many 13652 * pixels of conjunction are needed. 13653 * 13654 * It has no effect if no `arrowElement` is provided. 13655 * @memberof modifiers 13656 * @inner 13657 */ 13658 arrow: { 13659 /** @prop {number} order=500 - Index used to define the order of execution */ 13660 order: 500, 13661 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13662 enabled: true, 13663 /** @prop {ModifierFn} */ 13664 fn: arrow, 13665 /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ 13666 element: '[x-arrow]' 13667 }, 13668 13669 /** 13670 * Modifier used to flip the popper's placement when it starts to overlap its 13671 * reference element. 13672 * 13673 * Requires the `preventOverflow` modifier before it in order to work. 13674 * 13675 * **NOTE:** this modifier will interrupt the current update cycle and will 13676 * restart it if it detects the need to flip the placement. 13677 * @memberof modifiers 13678 * @inner 13679 */ 13680 flip: { 13681 /** @prop {number} order=600 - Index used to define the order of execution */ 13682 order: 600, 13683 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13684 enabled: true, 13685 /** @prop {ModifierFn} */ 13686 fn: flip, 13687 /** 13688 * @prop {String|Array} behavior='flip' 13689 * The behavior used to change the popper's placement. It can be one of 13690 * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid 13691 * placements (with optional variations) 13692 */ 13693 behavior: 'flip', 13694 /** 13695 * @prop {number} padding=5 13696 * The popper will flip if it hits the edges of the `boundariesElement` 13697 */ 13698 padding: 5, 13699 /** 13700 * @prop {String|HTMLElement} boundariesElement='viewport' 13701 * The element which will define the boundaries of the popper position. 13702 * The popper will never be placed outside of the defined boundaries 13703 * (except if `keepTogether` is enabled) 13704 */ 13705 boundariesElement: 'viewport', 13706 /** 13707 * @prop {Boolean} flipVariations=false 13708 * The popper will switch placement variation between `-start` and `-end` when 13709 * the reference element overlaps its boundaries. 13710 * 13711 * The original placement should have a set variation. 13712 */ 13713 flipVariations: false, 13714 /** 13715 * @prop {Boolean} flipVariationsByContent=false 13716 * The popper will switch placement variation between `-start` and `-end` when 13717 * the popper element overlaps its reference boundaries. 13718 * 13719 * The original placement should have a set variation. 13720 */ 13721 flipVariationsByContent: false 13722 }, 13723 13724 /** 13725 * Modifier used to make the popper flow toward the inner of the reference element. 13726 * By default, when this modifier is disabled, the popper will be placed outside 13727 * the reference element. 13728 * @memberof modifiers 13729 * @inner 13730 */ 13731 inner: { 13732 /** @prop {number} order=700 - Index used to define the order of execution */ 13733 order: 700, 13734 /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ 13735 enabled: false, 13736 /** @prop {ModifierFn} */ 13737 fn: inner 13738 }, 13739 13740 /** 13741 * Modifier used to hide the popper when its reference element is outside of the 13742 * popper boundaries. It will set a `x-out-of-boundaries` attribute which can 13743 * be used to hide with a CSS selector the popper when its reference is 13744 * out of boundaries. 13745 * 13746 * Requires the `preventOverflow` modifier before it in order to work. 13747 * @memberof modifiers 13748 * @inner 13749 */ 13750 hide: { 13751 /** @prop {number} order=800 - Index used to define the order of execution */ 13752 order: 800, 13753 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13754 enabled: true, 13755 /** @prop {ModifierFn} */ 13756 fn: hide 13757 }, 13758 13759 /** 13760 * Computes the style that will be applied to the popper element to gets 13761 * properly positioned. 13762 * 13763 * Note that this modifier will not touch the DOM, it just prepares the styles 13764 * so that `applyStyle` modifier can apply it. This separation is useful 13765 * in case you need to replace `applyStyle` with a custom implementation. 13766 * 13767 * This modifier has `850` as `order` value to maintain backward compatibility 13768 * with previous versions of Popper.js. Expect the modifiers ordering method 13769 * to change in future major versions of the library. 13770 * 13771 * @memberof modifiers 13772 * @inner 13773 */ 13774 computeStyle: { 13775 /** @prop {number} order=850 - Index used to define the order of execution */ 13776 order: 850, 13777 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13778 enabled: true, 13779 /** @prop {ModifierFn} */ 13780 fn: computeStyle, 13781 /** 13782 * @prop {Boolean} gpuAcceleration=true 13783 * If true, it uses the CSS 3D transformation to position the popper. 13784 * Otherwise, it will use the `top` and `left` properties 13785 */ 13786 gpuAcceleration: true, 13787 /** 13788 * @prop {string} [x='bottom'] 13789 * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. 13790 * Change this if your popper should grow in a direction different from `bottom` 13791 */ 13792 x: 'bottom', 13793 /** 13794 * @prop {string} [x='left'] 13795 * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. 13796 * Change this if your popper should grow in a direction different from `right` 13797 */ 13798 y: 'right' 13799 }, 13800 13801 /** 13802 * Applies the computed styles to the popper element. 13803 * 13804 * All the DOM manipulations are limited to this modifier. This is useful in case 13805 * you want to integrate Popper.js inside a framework or view library and you 13806 * want to delegate all the DOM manipulations to it. 13807 * 13808 * Note that if you disable this modifier, you must make sure the popper element 13809 * has its position set to `absolute` before Popper.js can do its work! 13810 * 13811 * Just disable this modifier and define your own to achieve the desired effect. 13812 * 13813 * @memberof modifiers 13814 * @inner 13815 */ 13816 applyStyle: { 13817 /** @prop {number} order=900 - Index used to define the order of execution */ 13818 order: 900, 13819 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13820 enabled: true, 13821 /** @prop {ModifierFn} */ 13822 fn: applyStyle, 13823 /** @prop {Function} */ 13824 onLoad: applyStyleOnLoad, 13825 /** 13826 * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier 13827 * @prop {Boolean} gpuAcceleration=true 13828 * If true, it uses the CSS 3D transformation to position the popper. 13829 * Otherwise, it will use the `top` and `left` properties 13830 */ 13831 gpuAcceleration: undefined 13832 } 13833}; 13834 13835/** 13836 * The `dataObject` is an object containing all the information used by Popper.js. 13837 * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks. 13838 * @name dataObject 13839 * @property {Object} data.instance The Popper.js instance 13840 * @property {String} data.placement Placement applied to popper 13841 * @property {String} data.originalPlacement Placement originally defined on init 13842 * @property {Boolean} data.flipped True if popper has been flipped by flip modifier 13843 * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper 13844 * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier 13845 * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`) 13846 * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`) 13847 * @property {Object} data.boundaries Offsets of the popper boundaries 13848 * @property {Object} data.offsets The measurements of popper, reference and arrow elements 13849 * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values 13850 * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values 13851 * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 13852 */ 13853 13854/** 13855 * Default options provided to Popper.js constructor.<br /> 13856 * These can be overridden using the `options` argument of Popper.js.<br /> 13857 * To override an option, simply pass an object with the same 13858 * structure of the `options` object, as the 3rd argument. For example: 13859 * ``` 13860 * new Popper(ref, pop, { 13861 * modifiers: { 13862 * preventOverflow: { enabled: false } 13863 * } 13864 * }) 13865 * ``` 13866 * @type {Object} 13867 * @static 13868 * @memberof Popper 13869 */ 13870var Defaults = { 13871 /** 13872 * Popper's placement. 13873 * @prop {Popper.placements} placement='bottom' 13874 */ 13875 placement: 'bottom', 13876 13877 /** 13878 * Set this to true if you want popper to position it self in 'fixed' mode 13879 * @prop {Boolean} positionFixed=false 13880 */ 13881 positionFixed: false, 13882 13883 /** 13884 * Whether events (resize, scroll) are initially enabled. 13885 * @prop {Boolean} eventsEnabled=true 13886 */ 13887 eventsEnabled: true, 13888 13889 /** 13890 * Set to true if you want to automatically remove the popper when 13891 * you call the `destroy` method. 13892 * @prop {Boolean} removeOnDestroy=false 13893 */ 13894 removeOnDestroy: false, 13895 13896 /** 13897 * Callback called when the popper is created.<br /> 13898 * By default, it is set to no-op.<br /> 13899 * Access Popper.js instance with `data.instance`. 13900 * @prop {onCreate} 13901 */ 13902 onCreate: function onCreate() {}, 13903 13904 /** 13905 * Callback called when the popper is updated. This callback is not called 13906 * on the initialization/creation of the popper, but only on subsequent 13907 * updates.<br /> 13908 * By default, it is set to no-op.<br /> 13909 * Access Popper.js instance with `data.instance`. 13910 * @prop {onUpdate} 13911 */ 13912 onUpdate: function onUpdate() {}, 13913 13914 /** 13915 * List of modifiers used to modify the offsets before they are applied to the popper. 13916 * They provide most of the functionalities of Popper.js. 13917 * @prop {modifiers} 13918 */ 13919 modifiers: modifiers 13920}; 13921 13922/** 13923 * @callback onCreate 13924 * @param {dataObject} data 13925 */ 13926 13927/** 13928 * @callback onUpdate 13929 * @param {dataObject} data 13930 */ 13931 13932// Utils 13933// Methods 13934var Popper = function () { 13935 /** 13936 * Creates a new Popper.js instance. 13937 * @class Popper 13938 * @param {Element|referenceObject} reference - The reference element used to position the popper 13939 * @param {Element} popper - The HTML / XML element used as the popper 13940 * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) 13941 * @return {Object} instance - The generated Popper.js instance 13942 */ 13943 function Popper(reference, popper) { 13944 var _this = this; 13945 13946 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 13947 classCallCheck(this, Popper); 13948 13949 this.scheduleUpdate = function () { 13950 return requestAnimationFrame(_this.update); 13951 }; 13952 13953 // make update() debounced, so that it only runs at most once-per-tick 13954 this.update = debounce(this.update.bind(this)); 13955 13956 // with {} we create a new object with the options inside it 13957 this.options = _extends({}, Popper.Defaults, options); 13958 13959 // init state 13960 this.state = { 13961 isDestroyed: false, 13962 isCreated: false, 13963 scrollParents: [] 13964 }; 13965 13966 // get reference and popper elements (allow jQuery wrappers) 13967 this.reference = reference && reference.jquery ? reference[0] : reference; 13968 this.popper = popper && popper.jquery ? popper[0] : popper; 13969 13970 // Deep merge modifiers options 13971 this.options.modifiers = {}; 13972 Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { 13973 _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); 13974 }); 13975 13976 // Refactoring modifiers' list (Object => Array) 13977 this.modifiers = Object.keys(this.options.modifiers).map(function (name) { 13978 return _extends({ 13979 name: name 13980 }, _this.options.modifiers[name]); 13981 }) 13982 // sort the modifiers by order 13983 .sort(function (a, b) { 13984 return a.order - b.order; 13985 }); 13986 13987 // modifiers have the ability to execute arbitrary code when Popper.js get inited 13988 // such code is executed in the same order of its modifier 13989 // they could add new properties to their options configuration 13990 // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! 13991 this.modifiers.forEach(function (modifierOptions) { 13992 if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { 13993 modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); 13994 } 13995 }); 13996 13997 // fire the first update to position the popper in the right place 13998 this.update(); 13999 14000 var eventsEnabled = this.options.eventsEnabled; 14001 if (eventsEnabled) { 14002 // setup event listeners, they will take care of update the position in specific situations 14003 this.enableEventListeners(); 14004 } 14005 14006 this.state.eventsEnabled = eventsEnabled; 14007 } 14008 14009 // We can't use class properties because they don't get listed in the 14010 // class prototype and break stuff like Sinon stubs 14011 14012 14013 createClass(Popper, [{ 14014 key: 'update', 14015 value: function update$$1() { 14016 return update.call(this); 14017 } 14018 }, { 14019 key: 'destroy', 14020 value: function destroy$$1() { 14021 return destroy.call(this); 14022 } 14023 }, { 14024 key: 'enableEventListeners', 14025 value: function enableEventListeners$$1() { 14026 return enableEventListeners.call(this); 14027 } 14028 }, { 14029 key: 'disableEventListeners', 14030 value: function disableEventListeners$$1() { 14031 return disableEventListeners.call(this); 14032 } 14033 14034 /** 14035 * Schedules an update. It will run on the next UI update available. 14036 * @method scheduleUpdate 14037 * @memberof Popper 14038 */ 14039 14040 14041 /** 14042 * Collection of utilities useful when writing custom modifiers. 14043 * Starting from version 1.7, this method is available only if you 14044 * include `popper-utils.js` before `popper.js`. 14045 * 14046 * **DEPRECATION**: This way to access PopperUtils is deprecated 14047 * and will be removed in v2! Use the PopperUtils module directly instead. 14048 * Due to the high instability of the methods contained in Utils, we can't 14049 * guarantee them to follow semver. Use them at your own risk! 14050 * @static 14051 * @private 14052 * @type {Object} 14053 * @deprecated since version 1.8 14054 * @member Utils 14055 * @memberof Popper 14056 */ 14057 14058 }]); 14059 return Popper; 14060}(); 14061 14062/** 14063 * The `referenceObject` is an object that provides an interface compatible with Popper.js 14064 * and lets you use it as replacement of a real DOM node.<br /> 14065 * You can use this method to position a popper relatively to a set of coordinates 14066 * in case you don't have a DOM node to use as reference. 14067 * 14068 * ``` 14069 * new Popper(referenceObject, popperNode); 14070 * ``` 14071 * 14072 * NB: This feature isn't supported in Internet Explorer 10. 14073 * @name referenceObject 14074 * @property {Function} data.getBoundingClientRect 14075 * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. 14076 * @property {number} data.clientWidth 14077 * An ES6 getter that will return the width of the virtual reference element. 14078 * @property {number} data.clientHeight 14079 * An ES6 getter that will return the height of the virtual reference element. 14080 */ 14081 14082 14083Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils; 14084Popper.placements = placements; 14085Popper.Defaults = Defaults; 14086 14087/* harmony default export */ __webpack_exports__["default"] = (Popper); 14088//# sourceMappingURL=popper.js.map 14089 14090/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) 14091 14092/***/ }), 14093
vendor: 724 bytes, lines 14094-14124
14094/***/ "./node_modules/webpack/buildin/global.js": 14095/*!***********************************!*\ 14096 !*** (webpack)/buildin/global.js ***! 14097 \***********************************/ 14098/*! no static exports found */ 14099/***/ (function(module, exports) { 14100 14101var g; 14102 14103// This works in non-strict mode 14104g = (function() { 14105 return this; 14106})(); 14107 14108try { 14109 // This works if eval is allowed (see CSP) 14110 g = g || new Function("return this")(); 14111} catch (e) { 14112 // This works if the window reference is available 14113 if (typeof window === "object") g = window; 14114} 14115 14116// g can still be undefined, but nothing to do about it... 14117// We return undefined, instead of nothing here, so it's 14118// easier to handle this case. if(!global) { ...} 14119 14120module.exports = g; 14121 14122 14123/***/ }), 14124
14125/***/ "./src/app.js": 14126/*!********************!*\ 14127 !*** ./src/app.js ***! 14128 \********************/ 14129/*! no exports provided */ 14130/***/ (function(module, __webpack_exports__, __webpack_require__) { 14131 14132"use strict"; 14133__webpack_require__.r(__webpack_exports__); 14134/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); 14135/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 14136/* harmony import */ var bootstrap_js_dist_util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! bootstrap/js/dist/util */ "./node_modules/bootstrap/js/dist/util.js"); 14137/* harmony import */ var bootstrap_js_dist_util__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(bootstrap_js_dist_util__WEBPACK_IMPORTED_MODULE_1__); 14138/* harmony import */ var bootstrap_js_dist_dropdown__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! bootstrap/js/dist/dropdown */ "./node_modules/bootstrap/js/dist/dropdown.js"); 14139/* harmony import */ var bootstrap_js_dist_dropdown__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(bootstrap_js_dist_dropdown__WEBPACK_IMPORTED_MODULE_2__); 14140/* harmony import */ var _scss_app_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./scss/app.scss */ "./src/scss/app.scss"); 14141/* harmony import */ var _scss_app_scss__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_scss_app_scss__WEBPACK_IMPORTED_MODULE_3__); 14142 14143 14144 14145 14146 14147 14148 14149window.$ = jquery__WEBPACK_IMPORTED_MODULE_0___default.a; 14150window.jQuery = jquery__WEBPACK_IMPORTED_MODULE_0___default.a; 14151 14152jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).ready(function(){ 14153 14154 // Referenties slideshow 14155 function startSlickslider(){ 14156 console.log('slick slider'); 14157 jquery__WEBPACK_IMPORTED_MODULE_0___default()('.referenties__container').slick({ 14158 slidesToShow: 6, 14159 autoplay: true, 14160 autoplaySpeed: 1000, 14161 responsive: [ 14162 { 14163 breakpoint: 1024, 14164 settings: { 14165 slidesToShow: 4, 14166 slidesToScroll: 1, 14167 infinite: true, 14168 } 14169 }, 14170 { 14171 breakpoint: 600, 14172 settings: { 14173 slidesToShow: 2, 14174 slidesToScroll: 2 14175 } 14176 }, 14177 { 14178 breakpoint: 480, 14179 settings: { 14180 slidesToShow: 2, 14181 slidesToScroll: 1 14182 } 14183 } 14184 // You can unslick at a given breakpoint now by adding: 14185 // settings: "unslick" 14186 // instead of a settings object 14187 ] 14188 }); 14189 } 14190 14191 // ScrollSpy 14192 function startScrollSpy(){ 14193 //$('#wr360container_wr360_view1_playerid').removeClass('container'); 14194 jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').data().scrollspy.options.offset = 0; 14195 14196 // Smooth Scroll ScrollSpy 14197 jquery__WEBPACK_IMPORTED_MODULE_0___default()(".list-group a[href^='#']").on('click', function(e) { 14198 14199 // prevent default anchor click behavior 14200 e.preventDefault(); 14201 14202 // store hash 14203 var hash = this.hash; 14204 14205 // animate 14206 jquery__WEBPACK_IMPORTED_MODULE_0___default()('html, body').animate({ 14207 scrollTop: jquery__WEBPACK_IMPORTED_MODULE_0___default()(hash).offset().top - 200 14208 }, 300, function(){ 14209 14210 // when done, add hash to url 14211 // (default click behaviour) 14212 window.location.hash = hash; 14213 }); 14214 }); 14215 } 14216 14217 14218 // Fire ze functions 14219 startSlickslider(); 14220 startScrollSpy(); 14221}); 14222 14223/***/ }), 14224
14225/***/ "./src/scss/app.scss": 14226/*!***************************!*\ 14227 !*** ./src/scss/app.scss ***! 14228 \***************************/ 14229/*! no static exports found */ 14230/***/ (function(module, exports, __webpack_require__) { 14231 14232// extracted by mini-css-extract-plugin 14233 14234/***/ })
14234 14235 14236/******/ }); 14237//# sourceMappingURL=bundle.js.map
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.