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, { 40/******/ configurable: false, 41/******/ enumerable: true, 42/******/ get: getter 43/******/ }); 44/******/ } 45/******/ }; 46/******/ 47/******/ // getDefaultExport function for compatibility with non-harmony modules 48/******/ __webpack_require__.n = function(module) { 49/******/ var getter = module && module.__esModule ? 50/******/ function getDefault() { return module['default']; } : 51/******/ function getModuleExports() { return module; }; 52/******/ __webpack_require__.d(getter, 'a', getter); 53/******/ return getter; 54/******/ }; 55/******/ 56/******/ // Object.prototype.hasOwnProperty.call 57/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58/******/ 59/******/ // __webpack_public_path__ 60/******/ __webpack_require__.p = "/wp-content/themes/samesh/dist/"; 61/******/ 62/******/ // Load entry module and return exports 63/******/ return __webpack_require__(__webpack_require__.s = 1); 64/******/ }) 65/************************************************************************/ 66/******/ ([ 67/* 0 */ 68/***/ (function(module, exports) { 69 70module.exports = jQuery; 71 72/***/ }), 73/* 1 */ 74/***/ (function(module, exports, __webpack_require__) { 75 76__webpack_require__(2); 77module.exports = __webpack_require__(12); 78 79 80/***/ }), 81/* 2 */ 82/***/ (function(module, __webpack_exports__, __webpack_require__) { 83 84"use strict"; 85Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); 86/* WEBPACK VAR INJECTION */(function(jQuery, $) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0); 87/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__); 88/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__autoload_bootstrap_js__ = __webpack_require__(3); 89/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_Router__ = __webpack_require__(7); 90/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__routes_common__ = __webpack_require__(9); 91/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__routes_home__ = __webpack_require__(10); 92/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__routes_about__ = __webpack_require__(11); 93// import external dependencies 94 95 96// Import everything from autoload 97 98 99// import local dependencies 100 101 102 103 104 105/** Populate Router instance with DOM routes */ 106var routes = new __WEBPACK_IMPORTED_MODULE_2__util_Router__["a" /* default */]({ 107 // All pages 108 common: __WEBPACK_IMPORTED_MODULE_3__routes_common__["a" /* default */], 109 // Home page 110 home: __WEBPACK_IMPORTED_MODULE_4__routes_home__["a" /* default */], 111 // About Us page, note the change from about-us to aboutUs. 112 aboutUs: __WEBPACK_IMPORTED_MODULE_5__routes_about__["a" /* default */], 113}); 114 115// Load Events 116jQuery(document).ready(function () { return routes.loadEvents(); }); 117 118// FAQ Questions 119var acc = document.getElementsByClassName('accordion'); 120var i; 121 122for (i = 0; i < acc.length; i++) { 123 acc[i].addEventListener('click', function() { 124 this.classList.toggle('active'); 125 var panel = this.nextElementSibling; 126 if (panel.style.maxHeight) { 127 panel.style.maxHeight = null; 128 } else { 129 panel.style.maxHeight = panel.scrollHeight + 'px'; 130 } 131 }); 132} 133 134// Home page slider 135jQuery('.homepageSlider').slick({ 136 dots: true, 137 infinite: true, 138 speed: 500, 139 fade: true, 140 cssEase: 'linear',
141 arrows: false, 142 autoplay: true, 143 autoplaySpeed: 5000, 144 dotsClass: 'customHomeDots', 145}).on('setPosition', function (event, slick) { 146 slick.$slides.css('height', slick.$slideTrack.height() + 'px'); 147}); 148 149var $dropdown = $('.dropdown'); 150 var $dropdownToggle = $('.dropdown-toggle'); 151 var $dropdownMenu = $('.dropdown-menu'); 152 var showClass = 'show'; 153 154 jQuery(window).on('load resize', function() { 155 if (this.matchMedia('(min-width: 768px)').matches) { 156 $dropdown.hover( 157 function() { 158 var $this = $(this); 159 $this.addClass(showClass); 160 $this.find($dropdownToggle).attr('aria-expanded', 'true'); 161 $this.find($dropdownMenu).addClass(showClass); 162 }, 163 function() { 164 var $this = $(this); 165 $this.removeClass(showClass); 166 $this.find($dropdownToggle).attr('aria-expanded', 'false'); 167 $this.find($dropdownMenu).removeClass(showClass); 168 } 169 ); 170 } else { 171 $dropdown.off('mouseenter mouseleave'); 172 } 173 }); 174 175/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(0), __webpack_require__(0))) 176 177/***/ }), 178/* 3 */ 179/***/ (function(module, __webpack_exports__, __webpack_require__) { 180 181"use strict"; 182/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bootstrap__ = __webpack_require__(4); 183/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_bootstrap___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_bootstrap__); 184// `sage preset` installed this file automatically. 185// Running `sage preset` again could result in automatic deletion of this file. 186// Because of this, we do not recommend editing this file. 187 188 189 190/***/ }), 191/* 4 */ 192/***/ (function(module, exports, __webpack_require__) { 193 194/*! 195 * Bootstrap v4.3.1 (https://getbootstrap.com/) 196 * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 197 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 198 */ 199(function (global, factory) { 200 true ? factory(exports, __webpack_require__(0), __webpack_require__(5)) : 201 typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) : 202 (global = global || self, factory(global.bootstrap = {}, global.jQuery, global.Popper)); 203}(this, function (exports, $, Popper) { 'use strict'; 204 205 $ = $ && $.hasOwnProperty('default') ? $['default'] : $; 206 Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper; 207 208 function _defineProperties(target, props) { 209 for (var i = 0; i < props.length; i++) { 210 var descriptor = props[i]; 211 descriptor.enumerable = descriptor.enumerable || false; 212 descriptor.configurable = true; 213 if ("value" in descriptor) { descriptor.writable = true; } 214 Object.defineProperty(target, descriptor.key, descriptor); 215 } 216 } 217 218 function _createClass(Constructor, protoProps, staticProps) { 219 if (protoProps) { _defineProperties(Constructor.prototype, protoProps); } 220 if (staticProps) { _defineProperties(Constructor, staticProps); } 221 return Constructor; 222 } 223 224 function _defineProperty(obj, key, value) { 225 if (key in obj) { 226 Object.defineProperty(obj, key, { 227 value: value, 228 enumerable: true, 229 configurable: true, 230 writable: true 231 }); 232 } else { 233 obj[key] = value; 234 } 235 236 return obj; 237 } 238 239 function _objectSpread(target) { 240 var arguments$1 = arguments; 241 242 for (var i = 1; i < arguments.length; i++) { 243 var source = arguments$1[i] != null ? arguments$1[i] : {}; 244 var ownKeys = Object.keys(source); 245 246 if (typeof Object.getOwnPropertySymbols === 'function') { 247 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { 248 return Object.getOwnPropertyDescriptor(source, sym).enumerable; 249 })); 250 } 251 252 ownKeys.forEach(function (key) { 253 _defineProperty(target, key, source[key]); 254 }); 255 } 256 257 return target; 258 } 259 260 function _inheritsLoose(subClass, superClass) { 261 subClass.prototype = Object.create(superClass.prototype); 262 subClass.prototype.constructor = subClass; 263 subClass.__proto__ = superClass; 264 } 265 266 /** 267 * -------------------------------------------------------------------------- 268 * Bootstrap (v4.3.1): util.js 269 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 270 * -------------------------------------------------------------------------- 271 */ 272 /** 273 * ------------------------------------------------------------------------ 274 * Private TransitionEnd Helpers 275 * ------------------------------------------------------------------------ 276 */ 277 278 var TRANSITION_END = 'transitionend'; 279 var MAX_UID = 1000000; 280 var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp) 281 282 function toType(obj) { 283 return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); 284 } 285 286 function getSpecialTransitionEndEvent() { 287 return { 288 bindType: TRANSITION_END, 289 delegateType: TRANSITION_END, 290 handle: function handle(event) { 291 if ($(event.target).is(this)) { 292 return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params 293 } 294 295 return undefined; // eslint-disable-line no-undefined 296 } 297 }; 298 } 299 300 function transitionEndEmulator(duration) { 301 var _this = this; 302 303 var called = false;
vendor: 5,614 bytes, lines 304-488
304 $(this).one(Util.TRANSITION_END, function () { 305 called = true; 306 }); 307 setTimeout(function () { 308 if (!called) { 309 Util.triggerTransitionEnd(_this); 310 } 311 }, duration); 312 return this; 313 } 314 315 function setTransitionEndSupport() { 316 $.fn.emulateTransitionEnd = transitionEndEmulator; 317 $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); 318 } 319 /** 320 * -------------------------------------------------------------------------- 321 * Public Util Api 322 * -------------------------------------------------------------------------- 323 */ 324 325 326 var Util = { 327 TRANSITION_END: 'bsTransitionEnd', 328 getUID: function getUID(prefix) { 329 do { 330 // eslint-disable-next-line no-bitwise 331 prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here 332 } while (document.getElementById(prefix)); 333 334 return prefix; 335 }, 336 getSelectorFromElement: function getSelectorFromElement(element) { 337 var selector = element.getAttribute('data-target'); 338 339 if (!selector || selector === '#') { 340 var hrefAttr = element.getAttribute('href'); 341 selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''; 342 } 343 344 try { 345 return document.querySelector(selector) ? selector : null; 346 } catch (err) { 347 return null; 348 } 349 }, 350 getTransitionDurationFromElement: function getTransitionDurationFromElement(element) { 351 if (!element) { 352 return 0; 353 } // Get transition-duration of the element 354 355 356 var transitionDuration = $(element).css('transition-duration'); 357 var transitionDelay = $(element).css('transition-delay'); 358 var floatTransitionDuration = parseFloat(transitionDuration); 359 var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found 360 361 if (!floatTransitionDuration && !floatTransitionDelay) { 362 return 0; 363 } // If multiple durations are defined, take the first 364 365 366 transitionDuration = transitionDuration.split(',')[0]; 367 transitionDelay = transitionDelay.split(',')[0]; 368 return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 369 }, 370 reflow: function reflow(element) { 371 return element.offsetHeight; 372 }, 373 triggerTransitionEnd: function triggerTransitionEnd(element) { 374 $(element).trigger(TRANSITION_END); 375 }, 376 // TODO: Remove in v5 377 supportsTransitionEnd: function supportsTransitionEnd() { 378 return Boolean(TRANSITION_END); 379 }, 380 isElement: function isElement(obj) { 381 return (obj[0] || obj).nodeType; 382 }, 383 typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { 384 for (var property in configTypes) { 385 if (Object.prototype.hasOwnProperty.call(configTypes, property)) { 386 var expectedTypes = configTypes[property]; 387 var value = config[property]; 388 var valueType = value && Util.isElement(value) ? 'element' : toType(value); 389 390 if (!new RegExp(expectedTypes).test(valueType)) { 391 throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\".")); 392 } 393 } 394 } 395 }, 396 findShadowRoot: function findShadowRoot(element) { 397 if (!document.documentElement.attachShadow) { 398 return null; 399 } // Can find the shadow root otherwise it'll return the document 400 401 402 if (typeof element.getRootNode === 'function') { 403 var root = element.getRootNode(); 404 return root instanceof ShadowRoot ? root : null; 405 } 406 407 if (element instanceof ShadowRoot) { 408 return element; 409 } // when we don't find a shadow root 410 411 412 if (!element.parentNode) { 413 return null; 414 } 415 416 return Util.findShadowRoot(element.parentNode); 417 } 418 }; 419 setTransitionEndSupport(); 420 421 /** 422 * ------------------------------------------------------------------------ 423 * Constants 424 * ------------------------------------------------------------------------ 425 */ 426 427 var NAME = 'alert'; 428 var VERSION = '4.3.1'; 429 var DATA_KEY = 'bs.alert'; 430 var EVENT_KEY = "." + DATA_KEY; 431 var DATA_API_KEY = '.data-api'; 432 var JQUERY_NO_CONFLICT = $.fn[NAME]; 433 var Selector = { 434 DISMISS: '[data-dismiss="alert"]' 435 }; 436 var Event = { 437 CLOSE: "close" + EVENT_KEY, 438 CLOSED: "closed" + EVENT_KEY, 439 CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY 440 }; 441 var ClassName = { 442 ALERT: 'alert', 443 FADE: 'fade', 444 SHOW: 'show' 445 /** 446 * ------------------------------------------------------------------------ 447 * Class Definition 448 * ------------------------------------------------------------------------ 449 */ 450 451 }; 452 453 var Alert = 454 /*#__PURE__*/ 455 function () { 456 function Alert(element) { 457 this._element = element; 458 } // Getters 459 460 461 var _proto = Alert.prototype; 462 463 // Public 464 _proto.close = function close(element) { 465 var rootElement = this._element; 466 467 if (element) { 468 rootElement = this._getRootElement(element); 469 } 470 471 var customEvent = this._triggerCloseEvent(rootElement); 472 473 if (customEvent.isDefaultPrevented()) { 474 return; 475 } 476 477 this._removeElement(rootElement); 478 }; 479 480 _proto.dispose = function dispose() { 481 $.removeData(this._element, DATA_KEY); 482 this._element = null; 483 } // Private 484 ; 485 486 _proto._getRootElement = function _getRootElement(element) { 487 var selector = Util.getSelectorFromElement(element); 488 var parent = false;
489 490 if (selector) { 491 parent = document.querySelector(selector); 492 } 493 494 if (!parent) { 495 parent = $(element).closest("." + ClassName.ALERT)[0]; 496 } 497 498 return parent; 499 }; 500 501 _proto._triggerCloseEvent = function _triggerCloseEvent(element) { 502 var closeEvent = $.Event(Event.CLOSE); 503 $(element).trigger(closeEvent); 504 return closeEvent; 505 }; 506 507 _proto._removeElement = function _removeElement(element) { 508 var _this = this; 509 510 $(element).removeClass(ClassName.SHOW); 511 512 if (!$(element).hasClass(ClassName.FADE)) { 513 this._destroyElement(element); 514 515 return; 516 } 517 518 var transitionDuration = Util.getTransitionDurationFromElement(element); 519 $(element).one(Util.TRANSITION_END, function (event) { 520 return _this._destroyElement(element, event); 521 }).emulateTransitionEnd(transitionDuration); 522 }; 523 524 _proto._destroyElement = function _destroyElement(element) { 525 $(element).detach().trigger(Event.CLOSED).remove(); 526 } // Static 527 ; 528 529 Alert._jQueryInterface = function _jQueryInterface(config) { 530 return this.each(function () { 531 var $element = $(this); 532 var data = $element.data(DATA_KEY); 533 534 if (!data) { 535 data = new Alert(this); 536 $element.data(DATA_KEY, data); 537 } 538 539 if (config === 'close') { 540 data[config](this); 541 } 542 }); 543 }; 544 545 Alert._handleDismiss = function _handleDismiss(alertInstance) { 546 return function (event) { 547 if (event) { 548 event.preventDefault(); 549 } 550 551 alertInstance.close(this); 552 }; 553 }; 554 555 _createClass(Alert, null, [{ 556 key: "VERSION", 557 get: function get() { 558 return VERSION; 559 } 560 }]); 561 562 return Alert; 563 }(); 564 /** 565 * ------------------------------------------------------------------------ 566 * Data Api implementation 567 * ------------------------------------------------------------------------ 568 */ 569 570 571 $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert())); 572 /** 573 * ------------------------------------------------------------------------ 574 * jQuery 575 * ------------------------------------------------------------------------ 576 */ 577 578 $.fn[NAME] = Alert._jQueryInterface; 579 $.fn[NAME].Constructor = Alert; 580 581 $.fn[NAME].noConflict = function () { 582 $.fn[NAME] = JQUERY_NO_CONFLICT; 583 return Alert._jQueryInterface; 584 }; 585 586 /** 587 * ------------------------------------------------------------------------ 588 * Constants 589 * ------------------------------------------------------------------------ 590 */ 591 592 var NAME$1 = 'button'; 593 var VERSION$1 = '4.3.1'; 594 var DATA_KEY$1 = 'bs.button'; 595 var EVENT_KEY$1 = "." + DATA_KEY$1; 596 var DATA_API_KEY$1 = '.data-api'; 597 var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1]; 598 var ClassName$1 = { 599 ACTIVE: 'active', 600 BUTTON: 'btn', 601 FOCUS: 'focus' 602 }; 603 var Selector$1 = { 604 DATA_TOGGLE_CARROT: '[data-toggle^="button"]', 605 DATA_TOGGLE: '[data-toggle="buttons"]', 606 INPUT: 'input:not([type="hidden"])', 607 ACTIVE: '.active', 608 BUTTON: '.btn' 609 }; 610 var Event$1 = { 611 CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1, 612 FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1) 613 /** 614 * ------------------------------------------------------------------------ 615 * Class Definition 616 * ------------------------------------------------------------------------ 617 */ 618 619 }; 620 621 var Button = 622 /*#__PURE__*/ 623 function () { 624 function Button(element) { 625 this._element = element; 626 } // Getters 627 628 629 var _proto = Button.prototype; 630 631 // Public 632 _proto.toggle = function toggle() { 633 var triggerChangeEvent = true; 634 var addAriaPressed = true; 635 var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLE)[0]; 636 637 if (rootElement) { 638 var input = this._element.querySelector(Selector$1.INPUT); 639 640 if (input) { 641 if (input.type === 'radio') { 642 if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) { 643 triggerChangeEvent = false;
vendor: 4,952 bytes, lines 644-813
644 } else { 645 var activeElement = rootElement.querySelector(Selector$1.ACTIVE); 646 647 if (activeElement) { 648 $(activeElement).removeClass(ClassName$1.ACTIVE); 649 } 650 } 651 } 652 653 if (triggerChangeEvent) { 654 if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) { 655 return; 656 } 657 658 input.checked = !this._element.classList.contains(ClassName$1.ACTIVE); 659 $(input).trigger('change'); 660 } 661 662 input.focus(); 663 addAriaPressed = false; 664 } 665 } 666 667 if (addAriaPressed) { 668 this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE)); 669 } 670 671 if (triggerChangeEvent) { 672 $(this._element).toggleClass(ClassName$1.ACTIVE); 673 } 674 }; 675 676 _proto.dispose = function dispose() { 677 $.removeData(this._element, DATA_KEY$1); 678 this._element = null; 679 } // Static 680 ; 681 682 Button._jQueryInterface = function _jQueryInterface(config) { 683 return this.each(function () { 684 var data = $(this).data(DATA_KEY$1); 685 686 if (!data) { 687 data = new Button(this); 688 $(this).data(DATA_KEY$1, data); 689 } 690 691 if (config === 'toggle') { 692 data[config](); 693 } 694 }); 695 }; 696 697 _createClass(Button, null, [{ 698 key: "VERSION", 699 get: function get() { 700 return VERSION$1; 701 } 702 }]); 703 704 return Button; 705 }(); 706 /** 707 * ------------------------------------------------------------------------ 708 * Data Api implementation 709 * ------------------------------------------------------------------------ 710 */ 711 712 713 $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) { 714 event.preventDefault(); 715 var button = event.target; 716 717 if (!$(button).hasClass(ClassName$1.BUTTON)) { 718 button = $(button).closest(Selector$1.BUTTON); 719 } 720 721 Button._jQueryInterface.call($(button), 'toggle'); 722 }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) { 723 var button = $(event.target).closest(Selector$1.BUTTON)[0]; 724 $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type)); 725 }); 726 /** 727 * ------------------------------------------------------------------------ 728 * jQuery 729 * ------------------------------------------------------------------------ 730 */ 731 732 $.fn[NAME$1] = Button._jQueryInterface; 733 $.fn[NAME$1].Constructor = Button; 734 735 $.fn[NAME$1].noConflict = function () { 736 $.fn[NAME$1] = JQUERY_NO_CONFLICT$1; 737 return Button._jQueryInterface; 738 }; 739 740 /** 741 * ------------------------------------------------------------------------ 742 * Constants 743 * ------------------------------------------------------------------------ 744 */ 745 746 var NAME$2 = 'carousel'; 747 var VERSION$2 = '4.3.1'; 748 var DATA_KEY$2 = 'bs.carousel'; 749 var EVENT_KEY$2 = "." + DATA_KEY$2; 750 var DATA_API_KEY$2 = '.data-api'; 751 var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2]; 752 var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key 753 754 var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key 755 756 var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch 757 758 var SWIPE_THRESHOLD = 40; 759 var Default = { 760 interval: 5000, 761 keyboard: true, 762 slide: false, 763 pause: 'hover', 764 wrap: true, 765 touch: true 766 }; 767 var DefaultType = { 768 interval: '(number|boolean)', 769 keyboard: 'boolean', 770 slide: '(boolean|string)', 771 pause: '(string|boolean)', 772 wrap: 'boolean', 773 touch: 'boolean' 774 }; 775 var Direction = { 776 NEXT: 'next', 777 PREV: 'prev', 778 LEFT: 'left', 779 RIGHT: 'right' 780 }; 781 var Event$2 = { 782 SLIDE: "slide" + EVENT_KEY$2, 783 SLID: "slid" + EVENT_KEY$2, 784 KEYDOWN: "keydown" + EVENT_KEY$2, 785 MOUSEENTER: "mouseenter" + EVENT_KEY$2, 786 MOUSELEAVE: "mouseleave" + EVENT_KEY$2, 787 TOUCHSTART: "touchstart" + EVENT_KEY$2, 788 TOUCHMOVE: "touchmove" + EVENT_KEY$2, 789 TOUCHEND: "touchend" + EVENT_KEY$2, 790 POINTERDOWN: "pointerdown" + EVENT_KEY$2, 791 POINTERUP: "pointerup" + EVENT_KEY$2, 792 DRAG_START: "dragstart" + EVENT_KEY$2, 793 LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2, 794 CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2 795 }; 796 var ClassName$2 = { 797 CAROUSEL: 'carousel', 798 ACTIVE: 'active', 799 SLIDE: 'slide', 800 RIGHT: 'carousel-item-right', 801 LEFT: 'carousel-item-left', 802 NEXT: 'carousel-item-next', 803 PREV: 'carousel-item-prev', 804 ITEM: 'carousel-item', 805 POINTER_EVENT: 'pointer-event' 806 }; 807 var Selector$2 = { 808 ACTIVE: '.active', 809 ACTIVE_ITEM: '.active.carousel-item', 810 ITEM: '.carousel-item', 811 ITEM_IMG: '.carousel-item img', 812 NEXT_PREV: '.carousel-item-next, .carousel-item-prev', 813 INDICATORS: '.carousel-indicators',
814 DATA_SLIDE: '[data-slide], [data-slide-to]', 815 DATA_RIDE: '[data-ride="carousel"]' 816 }; 817 var PointerType = { 818 TOUCH: 'touch', 819 PEN: 'pen' 820 /** 821 * ------------------------------------------------------------------------ 822 * Class Definition 823 * ------------------------------------------------------------------------ 824 */ 825 826 }; 827 828 var Carousel = 829 /*#__PURE__*/ 830 function () { 831 function Carousel(element, config) { 832 this._items = null; 833 this._interval = null; 834 this._activeElement = null; 835 this._isPaused = false; 836 this._isSliding = false; 837 this.touchTimeout = null; 838 this.touchStartX = 0; 839 this.touchDeltaX = 0; 840 this._config = this._getConfig(config); 841 this._element = element; 842 this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS); 843 this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; 844 this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent); 845 846 this._addEventListeners(); 847 } // Getters 848 849 850 var _proto = Carousel.prototype; 851 852 // Public 853 _proto.next = function next() { 854 if (!this._isSliding) { 855 this._slide(Direction.NEXT); 856 } 857 }; 858 859 _proto.nextWhenVisible = function nextWhenVisible() { 860 // Don't call next when the page isn't visible 861 // or the carousel or its parent isn't visible 862 if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') { 863 this.next(); 864 } 865 }; 866 867 _proto.prev = function prev() { 868 if (!this._isSliding) { 869 this._slide(Direction.PREV); 870 } 871 }; 872 873 _proto.pause = function pause(event) { 874 if (!event) { 875 this._isPaused = true; 876 } 877 878 if (this._element.querySelector(Selector$2.NEXT_PREV)) { 879 Util.triggerTransitionEnd(this._element); 880 this.cycle(true); 881 } 882 883 clearInterval(this._interval); 884 this._interval = null; 885 }; 886 887 _proto.cycle = function cycle(event) { 888 if (!event) { 889 this._isPaused = false; 890 } 891 892 if (this._interval) { 893 clearInterval(this._interval); 894 this._interval = null; 895 } 896 897 if (this._config.interval && !this._isPaused) { 898 this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); 899 } 900 }; 901 902 _proto.to = function to(index) { 903 var _this = this; 904 905 this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM); 906 907 var activeIndex = this._getItemIndex(this._activeElement); 908 909 if (index > this._items.length - 1 || index < 0) { 910 return; 911 } 912 913 if (this._isSliding) { 914 $(this._element).one(Event$2.SLID, function () { 915 return _this.to(index); 916 }); 917 return; 918 } 919 920 if (activeIndex === index) { 921 this.pause(); 922 this.cycle(); 923 return; 924 } 925 926 var direction = index > activeIndex ? Direction.NEXT : Direction.PREV; 927 928 this._slide(direction, this._items[index]); 929 }; 930 931 _proto.dispose = function dispose() { 932 $(this._element).off(EVENT_KEY$2); 933 $.removeData(this._element, DATA_KEY$2); 934 this._items = null; 935 this._config = null; 936 this._element = null; 937 this._interval = null; 938 this._isPaused = null; 939 this._isSliding = null; 940 this._activeElement = null; 941 this._indicatorsElement = null; 942 } // Private 943 ; 944 945 _proto._getConfig = function _getConfig(config) { 946 config = _objectSpread({}, Default, config); 947 Util.typeCheckConfig(NAME$2, config, DefaultType); 948 return config; 949 }; 950 951 _proto._handleSwipe = function _handleSwipe() { 952 var absDeltax = Math.abs(this.touchDeltaX); 953 954 if (absDeltax <= SWIPE_THRESHOLD) { 955 return; 956 } 957 958 var direction = absDeltax / this.touchDeltaX; // swipe left 959 960 if (direction > 0) { 961 this.prev(); 962 } // swipe right 963 964 965 if (direction < 0) { 966 this.next(); 967 } 968 }; 969 970 _proto._addEventListeners = function _addEventListeners() { 971 var _this2 = this; 972 973 if (this._config.keyboard) { 974 $(this._element).on(Event$2.KEYDOWN, function (event) { 975 return _this2._keydown(event); 976 }); 977 } 978 979 if (this._config.pause === 'hover') { 980 $(this._element).on(Event$2.MOUSEENTER, function (event) { 981 return _this2.pause(event); 982 }).on(Event$2.MOUSELEAVE, function (event) { 983 return _this2.cycle(event); 984 }); 985 } 986 987 if (this._config.touch) { 988 this._addTouchEventListeners(); 989 } 990 }; 991 992 _proto._addTouchEventListeners = function _addTouchEventListeners() { 993 var _this3 = this; 994 995 if (!this._touchSupported) { 996 return; 997 } 998 999 var start = function start(event) { 1000 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 1001 _this3.touchStartX = event.originalEvent.clientX; 1002 } else if (!_this3._pointerEvent) { 1003 _this3.touchStartX = event.originalEvent.touches[0].clientX; 1004 } 1005 }; 1006 1007 var move = function move(event) { 1008 // ensure swiping with one touch and not pinching 1009 if (event.originalEvent.touches && event.originalEvent.touches.length > 1) { 1010 _this3.touchDeltaX = 0; 1011 } else { 1012 _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX; 1013 } 1014 }; 1015 1016 var end = function end(event) { 1017 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 1018 _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX; 1019 } 1020 1021 _this3._handleSwipe(); 1022 1023 if (_this3._config.pause === 'hover') {
1024 // If it's a touch-enabled device, mouseenter/leave are fired as 1025 // part of the mouse compatibility events on first tap - the carousel 1026 // would stop cycling until user tapped out of it; 1027 // here, we listen for touchend, explicitly pause the carousel 1028 // (as if it's the second time we tap on it, mouseenter compat event 1029 // is NOT fired) and after a timeout (to allow for mouse compatibility 1030 // events to fire) we explicitly restart cycling 1031 _this3.pause(); 1032 1033 if (_this3.touchTimeout) { 1034 clearTimeout(_this3.touchTimeout); 1035 } 1036 1037 _this3.touchTimeout = setTimeout(function (event) { 1038 return _this3.cycle(event); 1039 }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval); 1040 } 1041 }; 1042 1043 $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) { 1044 return e.preventDefault(); 1045 }); 1046 1047 if (this._pointerEvent) { 1048 $(this._element).on(Event$2.POINTERDOWN, function (event) { 1049 return start(event); 1050 }); 1051 $(this._element).on(Event$2.POINTERUP, function (event) { 1052 return end(event); 1053 }); 1054 1055 this._element.classList.add(ClassName$2.POINTER_EVENT); 1056 } else { 1057 $(this._element).on(Event$2.TOUCHSTART, function (event) { 1058 return start(event); 1059 }); 1060 $(this._element).on(Event$2.TOUCHMOVE, function (event) { 1061 return move(event); 1062 }); 1063 $(this._element).on(Event$2.TOUCHEND, function (event) { 1064 return end(event); 1065 }); 1066 } 1067 }; 1068 1069 _proto._keydown = function _keydown(event) { 1070 if (/input|textarea/i.test(event.target.tagName)) { 1071 return; 1072 } 1073 1074 switch (event.which) { 1075 case ARROW_LEFT_KEYCODE: 1076 event.preventDefault(); 1077 this.prev(); 1078 break; 1079 1080 case ARROW_RIGHT_KEYCODE: 1081 event.preventDefault(); 1082 this.next(); 1083 break; 1084 1085 default: 1086 } 1087 }; 1088 1089 _proto._getItemIndex = function _getItemIndex(element) { 1090 this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : []; 1091 return this._items.indexOf(element); 1092 }; 1093 1094 _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) { 1095 var isNextDirection = direction === Direction.NEXT; 1096 var isPrevDirection = direction === Direction.PREV; 1097 1098 var activeIndex = this._getItemIndex(activeElement); 1099 1100 var lastItemIndex = this._items.length - 1; 1101 var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; 1102 1103 if (isGoingToWrap && !this._config.wrap) { 1104 return activeElement; 1105 } 1106 1107 var delta = direction === Direction.PREV ? -1 : 1; 1108 var itemIndex = (activeIndex + delta) % this._items.length; 1109 return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; 1110 }; 1111 1112 _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { 1113 var targetIndex = this._getItemIndex(relatedTarget); 1114 1115 var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM)); 1116 1117 var slideEvent = $.Event(Event$2.SLIDE, { 1118 relatedTarget: relatedTarget, 1119 direction: eventDirectionName, 1120 from: fromIndex, 1121 to: targetIndex 1122 }); 1123 $(this._element).trigger(slideEvent); 1124 return slideEvent; 1125 }; 1126 1127 _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { 1128 if (this._indicatorsElement) { 1129 var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE)); 1130 $(indicators).removeClass(ClassName$2.ACTIVE); 1131 1132 var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; 1133 1134 if (nextIndicator) { 1135 $(nextIndicator).addClass(ClassName$2.ACTIVE); 1136 } 1137 } 1138 }; 1139 1140 _proto._slide = function _slide(direction, element) { 1141 var _this4 = this; 1142 1143 var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM); 1144 1145 var activeElementIndex = this._getItemIndex(activeElement); 1146 1147 var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); 1148 1149 var nextElementIndex = this._getItemIndex(nextElement); 1150 1151 var isCycling = Boolean(this._interval); 1152 var directionalClassName; 1153 var orderClassName; 1154 var eventDirectionName; 1155 1156 if (direction === Direction.NEXT) { 1157 directionalClassName = ClassName$2.LEFT; 1158 orderClassName = ClassName$2.NEXT; 1159 eventDirectionName = Direction.LEFT; 1160 } else { 1161 directionalClassName = ClassName$2.RIGHT; 1162 orderClassName = ClassName$2.PREV; 1163 eventDirectionName = Direction.RIGHT; 1164 } 1165 1166 if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) { 1167 this._isSliding = false;
1168 return; 1169 } 1170 1171 var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); 1172 1173 if (slideEvent.isDefaultPrevented()) { 1174 return; 1175 } 1176 1177 if (!activeElement || !nextElement) { 1178 // Some weirdness is happening, so we bail 1179 return; 1180 } 1181 1182 this._isSliding = true; 1183 1184 if (isCycling) { 1185 this.pause(); 1186 } 1187 1188 this._setActiveIndicatorElement(nextElement); 1189 1190 var slidEvent = $.Event(Event$2.SLID, { 1191 relatedTarget: nextElement, 1192 direction: eventDirectionName, 1193 from: activeElementIndex, 1194 to: nextElementIndex 1195 }); 1196 1197 if ($(this._element).hasClass(ClassName$2.SLIDE)) { 1198 $(nextElement).addClass(orderClassName); 1199 Util.reflow(nextElement); 1200 $(activeElement).addClass(directionalClassName); 1201 $(nextElement).addClass(directionalClassName); 1202 var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10); 1203 1204 if (nextElementInterval) { 1205 this._config.defaultInterval = this._config.defaultInterval || this._config.interval; 1206 this._config.interval = nextElementInterval; 1207 } else { 1208 this._config.interval = this._config.defaultInterval || this._config.interval; 1209 } 1210 1211 var transitionDuration = Util.getTransitionDurationFromElement(activeElement); 1212 $(activeElement).one(Util.TRANSITION_END, function () { 1213 $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE); 1214 $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName); 1215 _this4._isSliding = false; 1216 setTimeout(function () { 1217 return $(_this4._element).trigger(slidEvent); 1218 }, 0); 1219 }).emulateTransitionEnd(transitionDuration); 1220 } else { 1221 $(activeElement).removeClass(ClassName$2.ACTIVE); 1222 $(nextElement).addClass(ClassName$2.ACTIVE); 1223 this._isSliding = false; 1224 $(this._element).trigger(slidEvent); 1225 } 1226 1227 if (isCycling) { 1228 this.cycle(); 1229 } 1230 } // Static 1231 ; 1232 1233 Carousel._jQueryInterface = function _jQueryInterface(config) { 1234 return this.each(function () { 1235 var data = $(this).data(DATA_KEY$2); 1236 1237 var _config = _objectSpread({}, Default, $(this).data()); 1238 1239 if (typeof config === 'object') { 1240 _config = _objectSpread({}, _config, config); 1241 } 1242 1243 var action = typeof config === 'string' ? config : _config.slide; 1244 1245 if (!data) { 1246 data = new Carousel(this, _config); 1247 $(this).data(DATA_KEY$2, data); 1248 } 1249 1250 if (typeof config === 'number') { 1251 data.to(config); 1252 } else if (typeof action === 'string') { 1253 if (typeof data[action] === 'undefined') { 1254 throw new TypeError("No method named \"" + action + "\""); 1255 } 1256 1257 data[action](); 1258 } else if (_config.interval && _config.ride) { 1259 data.pause(); 1260 data.cycle(); 1261 } 1262 }); 1263 }; 1264 1265 Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { 1266 var selector = Util.getSelectorFromElement(this); 1267 1268 if (!selector) { 1269 return; 1270 } 1271 1272 var target = $(selector)[0]; 1273 1274 if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) { 1275 return; 1276 } 1277 1278 var config = _objectSpread({}, $(target).data(), $(this).data()); 1279 1280 var slideIndex = this.getAttribute('data-slide-to'); 1281 1282 if (slideIndex) { 1283 config.interval = false; 1284 } 1285 1286 Carousel._jQueryInterface.call($(target), config); 1287 1288 if (slideIndex) { 1289 $(target).data(DATA_KEY$2).to(slideIndex); 1290 } 1291 1292 event.preventDefault(); 1293 }; 1294 1295 _createClass(Carousel, null, [{ 1296 key: "VERSION", 1297 get: function get() { 1298 return VERSION$2; 1299 } 1300 }, { 1301 key: "Default", 1302 get: function get() { 1303 return Default; 1304 } 1305 }]); 1306 1307 return Carousel; 1308 }(); 1309 /** 1310 * ------------------------------------------------------------------------ 1311 * Data Api implementation 1312 * ------------------------------------------------------------------------ 1313 */ 1314 1315 1316 $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler); 1317 $(window).on(Event$2.LOAD_DATA_API, function () { 1318 var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE)); 1319 1320 for (var i = 0, len = carousels.length; i < len; i++) {
1321 var $carousel = $(carousels[i]); 1322 1323 Carousel._jQueryInterface.call($carousel, $carousel.data()); 1324 } 1325 }); 1326 /** 1327 * ------------------------------------------------------------------------ 1328 * jQuery 1329 * ------------------------------------------------------------------------ 1330 */ 1331 1332 $.fn[NAME$2] = Carousel._jQueryInterface; 1333 $.fn[NAME$2].Constructor = Carousel; 1334 1335 $.fn[NAME$2].noConflict = function () { 1336 $.fn[NAME$2] = JQUERY_NO_CONFLICT$2; 1337 return Carousel._jQueryInterface; 1338 }; 1339 1340 /** 1341 * ------------------------------------------------------------------------ 1342 * Constants 1343 * ------------------------------------------------------------------------ 1344 */ 1345 1346 var NAME$3 = 'collapse'; 1347 var VERSION$3 = '4.3.1'; 1348 var DATA_KEY$3 = 'bs.collapse'; 1349 var EVENT_KEY$3 = "." + DATA_KEY$3; 1350 var DATA_API_KEY$3 = '.data-api'; 1351 var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3]; 1352 var Default$1 = { 1353 toggle: true, 1354 parent: '' 1355 }; 1356 var DefaultType$1 = { 1357 toggle: 'boolean', 1358 parent: '(string|element)' 1359 }; 1360 var Event$3 = { 1361 SHOW: "show" + EVENT_KEY$3, 1362 SHOWN: "shown" + EVENT_KEY$3, 1363 HIDE: "hide" + EVENT_KEY$3, 1364 HIDDEN: "hidden" + EVENT_KEY$3, 1365 CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3 1366 }; 1367 var ClassName$3 = { 1368 SHOW: 'show', 1369 COLLAPSE: 'collapse', 1370 COLLAPSING: 'collapsing', 1371 COLLAPSED: 'collapsed' 1372 }; 1373 var Dimension = { 1374 WIDTH: 'width', 1375 HEIGHT: 'height' 1376 }; 1377 var Selector$3 = { 1378 ACTIVES: '.show, .collapsing', 1379 DATA_TOGGLE: '[data-toggle="collapse"]' 1380 /** 1381 * ------------------------------------------------------------------------ 1382 * Class Definition 1383 * ------------------------------------------------------------------------ 1384 */ 1385 1386 }; 1387 1388 var Collapse = 1389 /*#__PURE__*/ 1390 function () { 1391 function Collapse(element, config) { 1392 var this$1 = this; 1393 1394 this._isTransitioning = false; 1395 this._element = element; 1396 this._config = this._getConfig(config); 1397 this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); 1398 var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE)); 1399 1400 for (var i = 0, len = toggleList.length; i < len; i++) { 1401 var elem = toggleList[i]; 1402 var selector = Util.getSelectorFromElement(elem); 1403 var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) { 1404 return foundElem === element; 1405 }); 1406 1407 if (selector !== null && filterElement.length > 0) { 1408 this$1._selector = selector; 1409 1410 this$1._triggerArray.push(elem); 1411 } 1412 } 1413 1414 this._parent = this._config.parent ? this._getParent() : null; 1415 1416 if (!this._config.parent) { 1417 this._addAriaAndCollapsedClass(this._element, this._triggerArray); 1418 } 1419 1420 if (this._config.toggle) { 1421 this.toggle(); 1422 } 1423 } // Getters 1424 1425 1426 var _proto = Collapse.prototype; 1427 1428 // Public 1429 _proto.toggle = function toggle() { 1430 if ($(this._element).hasClass(ClassName$3.SHOW)) { 1431 this.hide(); 1432 } else { 1433 this.show(); 1434 } 1435 }; 1436 1437 _proto.show = function show() { 1438 var _this = this; 1439 1440 if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) { 1441 return; 1442 } 1443 1444 var actives; 1445 var activesData; 1446 1447 if (this._parent) { 1448 actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) { 1449 if (typeof _this._config.parent === 'string') { 1450 return elem.getAttribute('data-parent') === _this._config.parent; 1451 } 1452 1453 return elem.classList.contains(ClassName$3.COLLAPSE); 1454 }); 1455 1456 if (actives.length === 0) { 1457 actives = null; 1458 } 1459 } 1460 1461 if (actives) { 1462 activesData = $(actives).not(this._selector).data(DATA_KEY$3); 1463 1464 if (activesData && activesData._isTransitioning) { 1465 return; 1466 } 1467 } 1468 1469 var startEvent = $.Event(Event$3.SHOW); 1470 $(this._element).trigger(startEvent); 1471 1472 if (startEvent.isDefaultPrevented()) { 1473 return; 1474 } 1475 1476 if (actives) { 1477 Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide'); 1478 1479 if (!activesData) { 1480 $(actives).data(DATA_KEY$3, null); 1481 } 1482 } 1483 1484 var dimension = this._getDimension(); 1485 1486 $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING); 1487 this._element.style[dimension] = 0; 1488 1489 if (this._triggerArray.length) { 1490 $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true); 1491 } 1492 1493 this.setTransitioning(true); 1494 1495 var complete = function complete() { 1496 $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW); 1497 _this._element.style[dimension] = ''; 1498 1499 _this.setTransitioning(false); 1500 1501 $(_this._element).trigger(Event$3.SHOWN); 1502 }; 1503 1504 var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 1505 var scrollSize = "scroll" + capitalizedDimension; 1506 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 1507 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 1508 this._element.style[dimension] = this._element[scrollSize] + "px"; 1509 }; 1510 1511 _proto.hide = function hide() { 1512 var this$1 = this; 1513 1514 var _this2 = this; 1515 1516 if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) { 1517 return; 1518 } 1519 1520 var startEvent = $.Event(Event$3.HIDE); 1521 $(this._element).trigger(startEvent); 1522 1523 if (startEvent.isDefaultPrevented()) { 1524 return; 1525 } 1526 1527 var dimension = this._getDimension(); 1528 1529 this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; 1530 Util.reflow(this._element); 1531 $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW); 1532 var triggerArrayLength = this._triggerArray.length; 1533 1534 if (triggerArrayLength > 0) { 1535 for (var i = 0; i < triggerArrayLength; i++) { 1536 var trigger = this$1._triggerArray[i]; 1537 var selector = Util.getSelectorFromElement(trigger); 1538 1539 if (selector !== null) { 1540 var $elem = $([].slice.call(document.querySelectorAll(selector))); 1541 1542 if (!$elem.hasClass(ClassName$3.SHOW)) { 1543 $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false); 1544 } 1545 } 1546 } 1547 } 1548 1549 this.setTransitioning(true); 1550 1551 var complete = function complete() { 1552 _this2.setTransitioning(false); 1553 1554 $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN); 1555 }; 1556 1557 this._element.style[dimension] = ''; 1558 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 1559 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 1560 }; 1561 1562 _proto.setTransitioning = function setTransitioning(isTransitioning) { 1563 this._isTransitioning = isTransitioning; 1564 }; 1565 1566 _proto.dispose = function dispose() { 1567 $.removeData(this._element, DATA_KEY$3); 1568 this._config = null; 1569 this._parent = null; 1570 this._element = null; 1571 this._triggerArray = null; 1572 this._isTransitioning = null; 1573 } // Private 1574 ; 1575 1576 _proto._getConfig = function _getConfig(config) { 1577 config = _objectSpread({}, Default$1, config); 1578 config.toggle = Boolean(config.toggle); // Coerce string values 1579 1580 Util.typeCheckConfig(NAME$3, config, DefaultType$1); 1581 return config; 1582 }; 1583 1584 _proto._getDimension = function _getDimension() { 1585 var hasWidth = $(this._element).hasClass(Dimension.WIDTH); 1586 return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT; 1587 }; 1588 1589 _proto._getParent = function _getParent() { 1590 var _this3 = this; 1591 1592 var parent; 1593 1594 if (Util.isElement(this._config.parent)) { 1595 parent = this._config.parent; // It's a jQuery object 1596 1597 if (typeof this._config.parent.jquery !== 'undefined') { 1598 parent = this._config.parent[0]; 1599 } 1600 } else { 1601 parent = document.querySelector(this._config.parent); 1602 } 1603 1604 var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; 1605 var children = [].slice.call(parent.querySelectorAll(selector)); 1606 $(children).each(function (i, element) { 1607 _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); 1608 }); 1609 return parent; 1610 }; 1611 1612 _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { 1613 var isOpen = $(element).hasClass(ClassName$3.SHOW); 1614 1615 if (triggerArray.length) { 1616 $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen); 1617 } 1618 } // Static 1619 ; 1620 1621 Collapse._getTargetFromElement = function _getTargetFromElement(element) { 1622 var selector = Util.getSelectorFromElement(element); 1623 return selector ? document.querySelector(selector) : null; 1624 }; 1625 1626 Collapse._jQueryInterface = function _jQueryInterface(config) { 1627 return this.each(function () { 1628 var $this = $(this); 1629 var data = $this.data(DATA_KEY$3); 1630 1631 var _config = _objectSpread({}, Default$1, $this.data(), typeof config === 'object' && config ? config : {}); 1632 1633 if (!data && _config.toggle && /show|hide/.test(config)) { 1634 _config.toggle = false;
1635 } 1636 1637 if (!data) { 1638 data = new Collapse(this, _config); 1639 $this.data(DATA_KEY$3, data); 1640 } 1641 1642 if (typeof config === 'string') { 1643 if (typeof data[config] === 'undefined') { 1644 throw new TypeError("No method named \"" + config + "\""); 1645 } 1646 1647 data[config](); 1648 } 1649 }); 1650 }; 1651 1652 _createClass(Collapse, null, [{ 1653 key: "VERSION", 1654 get: function get() { 1655 return VERSION$3; 1656 } 1657 }, { 1658 key: "Default", 1659 get: function get() { 1660 return Default$1; 1661 } 1662 }]); 1663 1664 return Collapse; 1665 }(); 1666 /** 1667 * ------------------------------------------------------------------------ 1668 * Data Api implementation 1669 * ------------------------------------------------------------------------ 1670 */ 1671 1672 1673 $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) { 1674 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 1675 if (event.currentTarget.tagName === 'A') { 1676 event.preventDefault(); 1677 } 1678 1679 var $trigger = $(this); 1680 var selector = Util.getSelectorFromElement(this); 1681 var selectors = [].slice.call(document.querySelectorAll(selector)); 1682 $(selectors).each(function () { 1683 var $target = $(this); 1684 var data = $target.data(DATA_KEY$3); 1685 var config = data ? 'toggle' : $trigger.data(); 1686 1687 Collapse._jQueryInterface.call($target, config); 1688 }); 1689 }); 1690 /** 1691 * ------------------------------------------------------------------------ 1692 * jQuery 1693 * ------------------------------------------------------------------------ 1694 */ 1695 1696 $.fn[NAME$3] = Collapse._jQueryInterface; 1697 $.fn[NAME$3].Constructor = Collapse; 1698 1699 $.fn[NAME$3].noConflict = function () { 1700 $.fn[NAME$3] = JQUERY_NO_CONFLICT$3; 1701 return Collapse._jQueryInterface; 1702 }; 1703 1704 /** 1705 * ------------------------------------------------------------------------ 1706 * Constants 1707 * ------------------------------------------------------------------------ 1708 */ 1709 1710 var NAME$4 = 'dropdown'; 1711 var VERSION$4 = '4.3.1'; 1712 var DATA_KEY$4 = 'bs.dropdown'; 1713 var EVENT_KEY$4 = "." + DATA_KEY$4; 1714 var DATA_API_KEY$4 = '.data-api'; 1715 var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4]; 1716 var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key 1717 1718 var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key 1719 1720 var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key 1721 1722 var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key 1723 1724 var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key 1725 1726 var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) 1727 1728 var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE); 1729 var Event$4 = { 1730 HIDE: "hide" + EVENT_KEY$4, 1731 HIDDEN: "hidden" + EVENT_KEY$4, 1732 SHOW: "show" + EVENT_KEY$4, 1733 SHOWN: "shown" + EVENT_KEY$4, 1734 CLICK: "click" + EVENT_KEY$4, 1735 CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4, 1736 KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4, 1737 KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4 1738 }; 1739 var ClassName$4 = { 1740 DISABLED: 'disabled', 1741 SHOW: 'show', 1742 DROPUP: 'dropup', 1743 DROPRIGHT: 'dropright', 1744 DROPLEFT: 'dropleft', 1745 MENURIGHT: 'dropdown-menu-right', 1746 MENULEFT: 'dropdown-menu-left', 1747 POSITION_STATIC: 'position-static' 1748 }; 1749 var Selector$4 = { 1750 DATA_TOGGLE: '[data-toggle="dropdown"]', 1751 FORM_CHILD: '.dropdown form', 1752 MENU: '.dropdown-menu', 1753 NAVBAR_NAV: '.navbar-nav', 1754 VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)' 1755 }; 1756 var AttachmentMap = { 1757 TOP: 'top-start', 1758 TOPEND: 'top-end', 1759 BOTTOM: 'bottom-start', 1760 BOTTOMEND: 'bottom-end', 1761 RIGHT: 'right-start', 1762 RIGHTEND: 'right-end', 1763 LEFT: 'left-start', 1764 LEFTEND: 'left-end' 1765 }; 1766 var Default$2 = { 1767 offset: 0, 1768 flip: true, 1769 boundary: 'scrollParent', 1770 reference: 'toggle', 1771 display: 'dynamic' 1772 }; 1773 var DefaultType$2 = { 1774 offset: '(number|string|function)', 1775 flip: 'boolean', 1776 boundary: '(string|element)', 1777 reference: '(string|element)', 1778 display: 'string' 1779 /** 1780 * ------------------------------------------------------------------------ 1781 * Class Definition 1782 * ------------------------------------------------------------------------ 1783 */ 1784 1785 }; 1786 1787 var Dropdown = 1788 /*#__PURE__*/ 1789 function () { 1790 function Dropdown(element, config) { 1791 this._element = element; 1792 this._popper = null; 1793 this._config = this._getConfig(config); 1794 this._menu = this._getMenuElement(); 1795 this._inNavbar = this._detectNavbar(); 1796 1797 this._addEventListeners(); 1798 } // Getters 1799 1800 1801 var _proto = Dropdown.prototype; 1802 1803 // Public
1804 _proto.toggle = function toggle() { 1805 if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) { 1806 return; 1807 } 1808 1809 var parent = Dropdown._getParentFromElement(this._element); 1810 1811 var isActive = $(this._menu).hasClass(ClassName$4.SHOW); 1812 1813 Dropdown._clearMenus(); 1814 1815 if (isActive) { 1816 return; 1817 } 1818 1819 var relatedTarget = { 1820 relatedTarget: this._element 1821 }; 1822 var showEvent = $.Event(Event$4.SHOW, relatedTarget); 1823 $(parent).trigger(showEvent); 1824 1825 if (showEvent.isDefaultPrevented()) { 1826 return; 1827 } // Disable totally Popper.js for Dropdown in Navbar 1828 1829 1830 if (!this._inNavbar) { 1831 /** 1832 * Check for Popper dependency 1833 * Popper - https://popper.js.org 1834 */ 1835 if (typeof Popper === 'undefined') { 1836 throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)'); 1837 } 1838 1839 var referenceElement = this._element; 1840 1841 if (this._config.reference === 'parent') { 1842 referenceElement = parent; 1843 } else if (Util.isElement(this._config.reference)) { 1844 referenceElement = this._config.reference; // Check if it's jQuery element 1845 1846 if (typeof this._config.reference.jquery !== 'undefined') { 1847 referenceElement = this._config.reference[0]; 1848 } 1849 } // If boundary is not `scrollParent`, then set position to `static` 1850 // to allow the menu to "escape" the scroll parent's boundaries 1851 // https://github.com/twbs/bootstrap/issues/24251 1852 1853 1854 if (this._config.boundary !== 'scrollParent') { 1855 $(parent).addClass(ClassName$4.POSITION_STATIC); 1856 } 1857 1858 this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig()); 1859 } // If this is a touch-enabled device we add extra 1860 // empty mouseover listeners to the body's immediate children; 1861 // only needed because of broken event delegation on iOS 1862 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 1863 1864 1865 if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) { 1866 $(document.body).children().on('mouseover', null, $.noop); 1867 } 1868 1869 this._element.focus(); 1870 1871 this._element.setAttribute('aria-expanded', true); 1872 1873 $(this._menu).toggleClass(ClassName$4.SHOW); 1874 $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget)); 1875 }; 1876 1877 _proto.show = function show() { 1878 if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) { 1879 return; 1880 } 1881 1882 var relatedTarget = { 1883 relatedTarget: this._element 1884 }; 1885 var showEvent = $.Event(Event$4.SHOW, relatedTarget); 1886 1887 var parent = Dropdown._getParentFromElement(this._element); 1888 1889 $(parent).trigger(showEvent); 1890 1891 if (showEvent.isDefaultPrevented()) { 1892 return; 1893 } 1894 1895 $(this._menu).toggleClass(ClassName$4.SHOW); 1896 $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget)); 1897 }; 1898 1899 _proto.hide = function hide() { 1900 if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) { 1901 return; 1902 } 1903 1904 var relatedTarget = { 1905 relatedTarget: this._element 1906 }; 1907 var hideEvent = $.Event(Event$4.HIDE, relatedTarget); 1908 1909 var parent = Dropdown._getParentFromElement(this._element); 1910 1911 $(parent).trigger(hideEvent); 1912 1913 if (hideEvent.isDefaultPrevented()) { 1914 return; 1915 } 1916 1917 $(this._menu).toggleClass(ClassName$4.SHOW); 1918 $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget)); 1919 }; 1920 1921 _proto.dispose = function dispose() { 1922 $.removeData(this._element, DATA_KEY$4); 1923 $(this._element).off(EVENT_KEY$4); 1924 this._element = null; 1925 this._menu = null; 1926 1927 if (this._popper !== null) { 1928 this._popper.destroy(); 1929 1930 this._popper = null; 1931 } 1932 }; 1933
1934 _proto.update = function update() { 1935 this._inNavbar = this._detectNavbar(); 1936 1937 if (this._popper !== null) { 1938 this._popper.scheduleUpdate(); 1939 } 1940 } // Private 1941 ; 1942 1943 _proto._addEventListeners = function _addEventListeners() { 1944 var _this = this; 1945 1946 $(this._element).on(Event$4.CLICK, function (event) { 1947 event.preventDefault(); 1948 event.stopPropagation(); 1949 1950 _this.toggle(); 1951 }); 1952 }; 1953 1954 _proto._getConfig = function _getConfig(config) { 1955 config = _objectSpread({}, this.constructor.Default, $(this._element).data(), config); 1956 Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType); 1957 return config; 1958 }; 1959 1960 _proto._getMenuElement = function _getMenuElement() { 1961 if (!this._menu) { 1962 var parent = Dropdown._getParentFromElement(this._element); 1963 1964 if (parent) { 1965 this._menu = parent.querySelector(Selector$4.MENU); 1966 } 1967 } 1968 1969 return this._menu; 1970 }; 1971 1972 _proto._getPlacement = function _getPlacement() { 1973 var $parentDropdown = $(this._element.parentNode); 1974 var placement = AttachmentMap.BOTTOM; // Handle dropup 1975 1976 if ($parentDropdown.hasClass(ClassName$4.DROPUP)) { 1977 placement = AttachmentMap.TOP; 1978 1979 if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) { 1980 placement = AttachmentMap.TOPEND; 1981 } 1982 } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) { 1983 placement = AttachmentMap.RIGHT; 1984 } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) { 1985 placement = AttachmentMap.LEFT; 1986 } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) { 1987 placement = AttachmentMap.BOTTOMEND; 1988 } 1989 1990 return placement; 1991 }; 1992 1993 _proto._detectNavbar = function _detectNavbar() { 1994 return $(this._element).closest('.navbar').length > 0; 1995 }; 1996 1997 _proto._getOffset = function _getOffset() { 1998 var _this2 = this; 1999 2000 var offset = {}; 2001 2002 if (typeof this._config.offset === 'function') { 2003 offset.fn = function (data) { 2004 data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {}); 2005 return data; 2006 }; 2007 } else { 2008 offset.offset = this._config.offset; 2009 } 2010 2011 return offset; 2012 }; 2013 2014 _proto._getPopperConfig = function _getPopperConfig() { 2015 var popperConfig = { 2016 placement: this._getPlacement(), 2017 modifiers: { 2018 offset: this._getOffset(), 2019 flip: { 2020 enabled: this._config.flip 2021 }, 2022 preventOverflow: { 2023 boundariesElement: this._config.boundary 2024 } 2025 } // Disable Popper.js if we have a static display 2026 2027 }; 2028 2029 if (this._config.display === 'static') { 2030 popperConfig.modifiers.applyStyle = { 2031 enabled: false 2032 }; 2033 } 2034 2035 return popperConfig; 2036 } // Static 2037 ; 2038 2039 Dropdown._jQueryInterface = function _jQueryInterface(config) { 2040 return this.each(function () { 2041 var data = $(this).data(DATA_KEY$4); 2042 2043 var _config = typeof config === 'object' ? config : null; 2044 2045 if (!data) { 2046 data = new Dropdown(this, _config); 2047 $(this).data(DATA_KEY$4, data); 2048 } 2049 2050 if (typeof config === 'string') { 2051 if (typeof data[config] === 'undefined') { 2052 throw new TypeError("No method named \"" + config + "\""); 2053 } 2054 2055 data[config](); 2056 } 2057 }); 2058 }; 2059 2060 Dropdown._clearMenus = function _clearMenus(event) { 2061 if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) { 2062 return; 2063 } 2064 2065 var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE)); 2066 2067 for (var i = 0, len = toggles.length; i < len; i++) { 2068 var parent = Dropdown._getParentFromElement(toggles[i]); 2069 2070 var context = $(toggles[i]).data(DATA_KEY$4); 2071 var relatedTarget = { 2072 relatedTarget: toggles[i] 2073 }; 2074 2075 if (event && event.type === 'click') { 2076 relatedTarget.clickEvent = event; 2077 } 2078 2079 if (!context) { 2080 continue; 2081 } 2082 2083 var dropdownMenu = context._menu; 2084 2085 if (!$(parent).hasClass(ClassName$4.SHOW)) { 2086 continue; 2087 } 2088 2089 if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) { 2090 continue; 2091 } 2092 2093 var hideEvent = $.Event(Event$4.HIDE, relatedTarget); 2094 $(parent).trigger(hideEvent); 2095 2096 if (hideEvent.isDefaultPrevented()) { 2097 continue; 2098 } // If this is a touch-enabled device we remove the extra 2099 // empty mouseover listeners we added for iOS support 2100 2101 2102 if ('ontouchstart' in document.documentElement) { 2103 $(document.body).children().off('mouseover', null, $.noop); 2104 } 2105 2106 toggles[i].setAttribute('aria-expanded', 'false'); 2107 $(dropdownMenu).removeClass(ClassName$4.SHOW); 2108 $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget)); 2109 } 2110 }; 2111 2112 Dropdown._getParentFromElement = function _getParentFromElement(element) { 2113 var parent; 2114 var selector = Util.getSelectorFromElement(element); 2115 2116 if (selector) { 2117 parent = document.querySelector(selector); 2118 } 2119 2120 return parent || element.parentNode; 2121 } // eslint-disable-next-line complexity 2122 ; 2123 2124 Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { 2125 // If not input/textarea: 2126 // - And not a key in REGEXP_KEYDOWN => not a dropdown command 2127 // If input/textarea: 2128 // - If space key => not a dropdown command 2129 // - If key is other than escape 2130 // - If key is not up or down => not a dropdown command 2131 // - If trigger inside the menu =>
2131 not a dropdown command 2132 if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) { 2133 return; 2134 } 2135 2136 event.preventDefault(); 2137 event.stopPropagation(); 2138 2139 if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) { 2140 return; 2141 } 2142 2143 var parent = Dropdown._getParentFromElement(this); 2144 2145 var isActive = $(parent).hasClass(ClassName$4.SHOW); 2146 2147 if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { 2148 if (event.which === ESCAPE_KEYCODE) { 2149 var toggle = parent.querySelector(Selector$4.DATA_TOGGLE); 2150 $(toggle).trigger('focus'); 2151 } 2152 2153 $(this).trigger('click'); 2154 return; 2155 } 2156 2157 var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)); 2158 2159 if (items.length === 0) { 2160 return; 2161 } 2162 2163 var index = items.indexOf(event.target); 2164 2165 if (event.which === ARROW_UP_KEYCODE && index > 0) { 2166 // Up 2167 index--; 2168 } 2169 2170 if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { 2171 // Down 2172 index++; 2173 } 2174 2175 if (index < 0) { 2176 index = 0; 2177 } 2178 2179 items[index].focus(); 2180 }; 2181 2182 _createClass(Dropdown, null, [{ 2183 key: "VERSION", 2184 get: function get() { 2185 return VERSION$4; 2186 } 2187 }, { 2188 key: "Default", 2189 get: function get() { 2190 return Default$2; 2191 } 2192 }, { 2193 key: "DefaultType", 2194 get: function get() { 2195 return DefaultType$2; 2196 } 2197 }]); 2198 2199 return Dropdown; 2200 }(); 2201 /** 2202 * ------------------------------------------------------------------------ 2203 * Data Api implementation 2204 * ------------------------------------------------------------------------ 2205 */ 2206 2207 2208 $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) { 2209 event.preventDefault(); 2210 event.stopPropagation(); 2211 2212 Dropdown._jQueryInterface.call($(this), 'toggle'); 2213 }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) { 2214 e.stopPropagation(); 2215 }); 2216 /** 2217 * ------------------------------------------------------------------------ 2218 * jQuery 2219 * ------------------------------------------------------------------------ 2220 */ 2221 2222 $.fn[NAME$4] = Dropdown._jQueryInterface; 2223 $.fn[NAME$4].Constructor = Dropdown; 2224 2225 $.fn[NAME$4].noConflict = function () { 2226 $.fn[NAME$4] = JQUERY_NO_CONFLICT$4; 2227 return Dropdown._jQueryInterface; 2228 }; 2229 2230 /** 2231 * ------------------------------------------------------------------------ 2232 * Constants 2233 * ------------------------------------------------------------------------ 2234 */ 2235 2236 var NAME$5 = 'modal'; 2237 var VERSION$5 = '4.3.1'; 2238 var DATA_KEY$5 = 'bs.modal'; 2239 var EVENT_KEY$5 = "." + DATA_KEY$5; 2240 var DATA_API_KEY$5 = '.data-api'; 2241 var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5]; 2242 var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key 2243 2244 var Default$3 = { 2245 backdrop: true, 2246 keyboard: true, 2247 focus: true, 2248 show: true 2249 }; 2250 var DefaultType$3 = { 2251 backdrop: '(boolean|string)', 2252 keyboard: 'boolean', 2253 focus: 'boolean', 2254 show: 'boolean' 2255 }; 2256 var Event$5 = { 2257 HIDE: "hide" + EVENT_KEY$5, 2258 HIDDEN: "hidden" + EVENT_KEY$5, 2259 SHOW: "show" + EVENT_KEY$5, 2260 SHOWN: "shown" + EVENT_KEY$5, 2261 FOCUSIN: "focusin" + EVENT_KEY$5, 2262 RESIZE: "resize" + EVENT_KEY$5, 2263 CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5, 2264 KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5, 2265 MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5, 2266 MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5, 2267 CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5 2268 }; 2269 var ClassName$5 = {
2270 SCROLLABLE: 'modal-dialog-scrollable', 2271 SCROLLBAR_MEASURER: 'modal-scrollbar-measure', 2272 BACKDROP: 'modal-backdrop', 2273 OPEN: 'modal-open', 2274 FADE: 'fade', 2275 SHOW: 'show' 2276 }; 2277 var Selector$5 = { 2278 DIALOG: '.modal-dialog', 2279 MODAL_BODY: '.modal-body', 2280 DATA_TOGGLE: '[data-toggle="modal"]', 2281 DATA_DISMISS: '[data-dismiss="modal"]', 2282 FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top', 2283 STICKY_CONTENT: '.sticky-top' 2284 /** 2285 * ------------------------------------------------------------------------ 2286 * Class Definition 2287 * ------------------------------------------------------------------------ 2288 */ 2289 2290 }; 2291 2292 var Modal = 2293 /*#__PURE__*/ 2294 function () { 2295 function Modal(element, config) { 2296 this._config = this._getConfig(config); 2297 this._element = element; 2298 this._dialog = element.querySelector(Selector$5.DIALOG); 2299 this._backdrop = null; 2300 this._isShown = false; 2301 this._isBodyOverflowing = false; 2302 this._ignoreBackdropClick = false; 2303 this._isTransitioning = false; 2304 this._scrollbarWidth = 0; 2305 } // Getters 2306 2307 2308 var _proto = Modal.prototype; 2309 2310 // Public 2311 _proto.toggle = function toggle(relatedTarget) { 2312 return this._isShown ? this.hide() : this.show(relatedTarget); 2313 }; 2314 2315 _proto.show = function show(relatedTarget) { 2316 var _this = this; 2317 2318 if (this._isShown || this._isTransitioning) { 2319 return; 2320 } 2321 2322 if ($(this._element).hasClass(ClassName$5.FADE)) { 2323 this._isTransitioning = true; 2324 } 2325 2326 var showEvent = $.Event(Event$5.SHOW, { 2327 relatedTarget: relatedTarget 2328 }); 2329 $(this._element).trigger(showEvent); 2330 2331 if (this._isShown || showEvent.isDefaultPrevented()) { 2332 return; 2333 } 2334 2335 this._isShown = true; 2336 2337 this._checkScrollbar(); 2338 2339 this._setScrollbar(); 2340 2341 this._adjustDialog(); 2342 2343 this._setEscapeEvent(); 2344 2345 this._setResizeEvent(); 2346 2347 $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) { 2348 return _this.hide(event); 2349 }); 2350 $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () { 2351 $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) { 2352 if ($(event.target).is(_this._element)) { 2353 _this._ignoreBackdropClick = true; 2354 } 2355 }); 2356 }); 2357 2358 this._showBackdrop(function () { 2359 return _this._showElement(relatedTarget); 2360 }); 2361 }; 2362 2363 _proto.hide = function hide(event) { 2364 var _this2 = this; 2365 2366 if (event) { 2367 event.preventDefault(); 2368 } 2369 2370 if (!this._isShown || this._isTransitioning) { 2371 return; 2372 } 2373 2374 var hideEvent = $.Event(Event$5.HIDE); 2375 $(this._element).trigger(hideEvent); 2376 2377 if (!this._isShown || hideEvent.isDefaultPrevented()) { 2378 return; 2379 } 2380 2381 this._isShown = false; 2382 var transition = $(this._element).hasClass(ClassName$5.FADE); 2383 2384 if (transition) { 2385 this._isTransitioning = true; 2386 } 2387 2388 this._setEscapeEvent(); 2389 2390 this._setResizeEvent(); 2391 2392 $(document).off(Event$5.FOCUSIN); 2393 $(this._element).removeClass(ClassName$5.SHOW); 2394 $(this._element).off(Event$5.CLICK_DISMISS); 2395 $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS); 2396 2397 if (transition) { 2398 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 2399 $(this._element).one(Util.TRANSITION_END, function (event) { 2400 return _this2._hideModal(event); 2401 }).emulateTransitionEnd(transitionDuration); 2402 } else { 2403 this._hideModal(); 2404 } 2405 }; 2406 2407 _proto.dispose = function dispose() { 2408 [window, this._element, this._dialog].forEach(function (htmlElement) { 2409 return $(htmlElement).off(EVENT_KEY$5); 2410 }); 2411 /** 2412 * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API` 2413 * Do not move `document` in `htmlElements` array 2414 * It will remove `Event.CLICK_DATA_API` event that should remain 2415 */ 2416 2417 $(document).off(Event$5.FOCUSIN); 2418 $.removeData(this._element, DATA_KEY$5); 2419 this._config = null; 2420 this._element = null; 2421 this._dialog = null; 2422 this._backdrop = null; 2423 this._isShown = null; 2424 this._isBodyOverflowing = null; 2425 this._ignoreBackdropClick = null; 2426 this._isTransitioning = null; 2427 this._scrollbarWidth = null; 2428 }; 2429 2430 _proto.handleUpdate = function handleUpdate() { 2431 this._adjustDialog(); 2432 } // Private 2433 ; 2434 2435 _proto._getConfig = function _getConfig(config) { 2436 config = _objectSpread({}, Default$3, config); 2437 Util.typeCheckConfig(NAME$5, config, DefaultType$3); 2438 return config; 2439 }; 2440 2441 _proto._showElement = function _showElement(relatedTarget) { 2442 var _this3 = this; 2443 2444 var transition = $(this._element).hasClass(ClassName$5.FADE); 2445 2446 if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { 2447 // Don't move modal's DOM position 2448 document.body.appendChild(this._element); 2449 } 2450 2451 this._element.style.display = 'block'; 2452 2453 this._element.removeAttribute('aria-hidden'); 2454 2455 this._element.setAttribute('aria-modal', true); 2456 2457 if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE)) { 2458 this._dialog.querySelector(Selector$5.MODAL_BODY).scrollTop = 0; 2459 } else { 2460 this._element.scrollTop = 0; 2461 } 2462 2463 if (transition) { 2464 Util.reflow(this._element); 2465 } 2466 2467 $(this._element).addClass(ClassName$5.SHOW); 2468 2469 if (this._config.focus) { 2470 this._enforceFocus(); 2471 } 2472 2473 var shownEvent = $.Event(Event$5.SHOWN, { 2474 relatedTarget: relatedTarget 2475 }); 2476 2477 var transitionComplete = function transitionComplete() { 2478 if (_this3._config.focus) { 2479 _this3._element.focus(); 2480 } 2481 2482 _this3._isTransitioning = false;
2483 $(_this3._element).trigger(shownEvent); 2484 }; 2485 2486 if (transition) { 2487 var transitionDuration = Util.getTransitionDurationFromElement(this._dialog); 2488 $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration); 2489 } else { 2490 transitionComplete(); 2491 } 2492 }; 2493 2494 _proto._enforceFocus = function _enforceFocus() { 2495 var _this4 = this; 2496 2497 $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop 2498 .on(Event$5.FOCUSIN, function (event) { 2499 if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) { 2500 _this4._element.focus(); 2501 } 2502 }); 2503 }; 2504 2505 _proto._setEscapeEvent = function _setEscapeEvent() { 2506 var _this5 = this; 2507 2508 if (this._isShown && this._config.keyboard) { 2509 $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) { 2510 if (event.which === ESCAPE_KEYCODE$1) { 2511 event.preventDefault(); 2512 2513 _this5.hide(); 2514 } 2515 }); 2516 } else if (!this._isShown) { 2517 $(this._element).off(Event$5.KEYDOWN_DISMISS); 2518 } 2519 }; 2520 2521 _proto._setResizeEvent = function _setResizeEvent() { 2522 var _this6 = this; 2523 2524 if (this._isShown) { 2525 $(window).on(Event$5.RESIZE, function (event) { 2526 return _this6.handleUpdate(event); 2527 }); 2528 } else { 2529 $(window).off(Event$5.RESIZE); 2530 } 2531 }; 2532 2533 _proto._hideModal = function _hideModal() { 2534 var _this7 = this; 2535 2536 this._element.style.display = 'none'; 2537 2538 this._element.setAttribute('aria-hidden', true); 2539 2540 this._element.removeAttribute('aria-modal'); 2541 2542 this._isTransitioning = false; 2543 2544 this._showBackdrop(function () { 2545 $(document.body).removeClass(ClassName$5.OPEN); 2546 2547 _this7._resetAdjustments(); 2548 2549 _this7._resetScrollbar(); 2550 2551 $(_this7._element).trigger(Event$5.HIDDEN); 2552 }); 2553 }; 2554 2555 _proto._removeBackdrop = function _removeBackdrop() { 2556 if (this._backdrop) { 2557 $(this._backdrop).remove(); 2558 this._backdrop = null; 2559 } 2560 }; 2561 2562 _proto._showBackdrop = function _showBackdrop(callback) { 2563 var _this8 = this; 2564 2565 var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : ''; 2566 2567 if (this._isShown && this._config.backdrop) { 2568 this._backdrop = document.createElement('div'); 2569 this._backdrop.className = ClassName$5.BACKDROP; 2570 2571 if (animate) { 2572 this._backdrop.classList.add(animate); 2573 } 2574 2575 $(this._backdrop).appendTo(document.body); 2576 $(this._element).on(Event$5.CLICK_DISMISS, function (event) { 2577 if (_this8._ignoreBackdropClick) { 2578 _this8._ignoreBackdropClick = false; 2579 return; 2580 } 2581 2582 if (event.target !== event.currentTarget) { 2583 return; 2584 } 2585 2586 if (_this8._config.backdrop === 'static') { 2587 _this8._element.focus(); 2588 } else { 2589 _this8.hide(); 2590 } 2591 }); 2592 2593 if (animate) { 2594 Util.reflow(this._backdrop); 2595 } 2596 2597 $(this._backdrop).addClass(ClassName$5.SHOW); 2598 2599 if (!callback) { 2600 return; 2601 } 2602 2603 if (!animate) { 2604 callback(); 2605 return; 2606 } 2607 2608 var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 2609 $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration); 2610 } else if (!this._isShown && this._backdrop) { 2611 $(this._backdrop).removeClass(ClassName$5.SHOW); 2612 2613 var callbackRemove = function callbackRemove() { 2614 _this8._removeBackdrop(); 2615 2616 if (callback) { 2617 callback(); 2618 } 2619 }; 2620 2621 if ($(this._element).hasClass(ClassName$5.FADE)) { 2622 var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 2623 2624 $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration); 2625 } else { 2626 callbackRemove(); 2627 } 2628 } else if (callback) { 2629 callback(); 2630 } 2631 } // ---------------------------------------------------------------------- 2632 // the following methods are used to handle overflowing modals 2633 // todo (fat): these should probably be refactored out of modal.js 2634 // ---------------------------------------------------------------------- 2635 ; 2636
2637 _proto._adjustDialog = function _adjustDialog() { 2638 var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 2639 2640 if (!this._isBodyOverflowing && isModalOverflowing) { 2641 this._element.style.paddingLeft = this._scrollbarWidth + "px"; 2642 } 2643 2644 if (this._isBodyOverflowing && !isModalOverflowing) { 2645 this._element.style.paddingRight = this._scrollbarWidth + "px"; 2646 } 2647 }; 2648 2649 _proto._resetAdjustments = function _resetAdjustments() { 2650 this._element.style.paddingLeft = ''; 2651 this._element.style.paddingRight = ''; 2652 }; 2653 2654 _proto._checkScrollbar = function _checkScrollbar() { 2655 var rect = document.body.getBoundingClientRect(); 2656 this._isBodyOverflowing = rect.left + rect.right < window.innerWidth; 2657 this._scrollbarWidth = this._getScrollbarWidth(); 2658 }; 2659 2660 _proto._setScrollbar = function _setScrollbar() { 2661 var _this9 = this; 2662 2663 if (this._isBodyOverflowing) { 2664 // Note: DOMNode.style.paddingRight returns the actual value or '' if not set 2665 // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set 2666 var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT)); 2667 var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding 2668 2669 $(fixedContent).each(function (index, element) { 2670 var actualPadding = element.style.paddingRight; 2671 var calculatedPadding = $(element).css('padding-right'); 2672 $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px"); 2673 }); // Adjust sticky content margin 2674 2675 $(stickyContent).each(function (index, element) { 2676 var actualMargin = element.style.marginRight; 2677 var calculatedMargin = $(element).css('margin-right'); 2678 $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px"); 2679 }); // Adjust body padding 2680 2681 var actualPadding = document.body.style.paddingRight; 2682 var calculatedPadding = $(document.body).css('padding-right'); 2683 $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px"); 2684 } 2685 2686 $(document.body).addClass(ClassName$5.OPEN); 2687 }; 2688 2689 _proto._resetScrollbar = function _resetScrollbar() { 2690 // Restore fixed content padding 2691 var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT)); 2692 $(fixedContent).each(function (index, element) { 2693 var padding = $(element).data('padding-right'); 2694 $(element).removeData('padding-right'); 2695 element.style.paddingRight = padding ? padding : ''; 2696 }); // Restore sticky content 2697 2698 var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT)); 2699 $(elements).each(function (index, element) { 2700 var margin = $(element).data('margin-right'); 2701 2702 if (typeof margin !== 'undefined') { 2703 $(element).css('margin-right', margin).removeData('margin-right'); 2704 } 2705 }); // Restore body padding 2706 2707 var padding = $(document.body).data('padding-right'); 2708 $(document.body).removeData('padding-right'); 2709 document.body.style.paddingRight = padding ? padding : ''; 2710 }; 2711 2712 _proto._getScrollbarWidth = function _getScrollbarWidth() { 2713 // thx d.walsh 2714 var scrollDiv = document.createElement('div'); 2715 scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER; 2716 document.body.appendChild(scrollDiv); 2717 var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; 2718 document.body.removeChild(scrollDiv); 2719 return scrollbarWidth; 2720 } // Static 2721 ; 2722 2723 Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { 2724 return this.each(function () { 2725 var data = $(this).data(DATA_KEY$5); 2726 2727 var _config = _objectSpread({}, Default$3, $(this).data(), typeof config === 'object' && config ? config : {}); 2728 2729 if (!data) { 2730 data = new Modal(this, _config); 2731 $(this).data(DATA_KEY$5, data); 2732 } 2733 2734 if (typeof config === 'string') { 2735 if (typeof data[config] === 'undefined') {
2736 throw new TypeError("No method named \"" + config + "\""); 2737 } 2738 2739 data[config](relatedTarget); 2740 } else if (_config.show) { 2741 data.show(relatedTarget); 2742 } 2743 }); 2744 }; 2745 2746 _createClass(Modal, null, [{ 2747 key: "VERSION", 2748 get: function get() { 2749 return VERSION$5; 2750 } 2751 }, { 2752 key: "Default", 2753 get: function get() { 2754 return Default$3; 2755 } 2756 }]); 2757 2758 return Modal; 2759 }(); 2760 /** 2761 * ------------------------------------------------------------------------ 2762 * Data Api implementation 2763 * ------------------------------------------------------------------------ 2764 */ 2765 2766 2767 $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) { 2768 var _this10 = this; 2769 2770 var target; 2771 var selector = Util.getSelectorFromElement(this); 2772 2773 if (selector) { 2774 target = document.querySelector(selector); 2775 } 2776 2777 var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread({}, $(target).data(), $(this).data()); 2778 2779 if (this.tagName === 'A' || this.tagName === 'AREA') { 2780 event.preventDefault(); 2781 } 2782 2783 var $target = $(target).one(Event$5.SHOW, function (showEvent) { 2784 if (showEvent.isDefaultPrevented()) { 2785 // Only register focus restorer if modal will actually get shown 2786 return; 2787 } 2788 2789 $target.one(Event$5.HIDDEN, function () { 2790 if ($(_this10).is(':visible')) { 2791 _this10.focus(); 2792 } 2793 }); 2794 }); 2795 2796 Modal._jQueryInterface.call($(target), config, this); 2797 }); 2798 /** 2799 * ------------------------------------------------------------------------ 2800 * jQuery 2801 * ------------------------------------------------------------------------ 2802 */ 2803 2804 $.fn[NAME$5] = Modal._jQueryInterface; 2805 $.fn[NAME$5].Constructor = Modal; 2806 2807 $.fn[NAME$5].noConflict = function () { 2808 $.fn[NAME$5] = JQUERY_NO_CONFLICT$5; 2809 return Modal._jQueryInterface; 2810 }; 2811 2812 /** 2813 * -------------------------------------------------------------------------- 2814 * Bootstrap (v4.3.1): tools/sanitizer.js 2815 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 2816 * -------------------------------------------------------------------------- 2817 */ 2818 var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']; 2819 var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 2820 var DefaultWhitelist = { 2821 // Global attributes allowed on any supplied element below. 2822 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 2823 a: ['target', 'href', 'title', 'rel'], 2824 area: [], 2825 b: [], 2826 br: [], 2827 col: [], 2828 code: [], 2829 div: [], 2830 em: [], 2831 hr: [], 2832 h1: [], 2833 h2: [], 2834 h3: [], 2835 h4: [], 2836 h5: [], 2837 h6: [], 2838 i: [], 2839 img: ['src', 'alt', 'title', 'width', 'height'], 2840 li: [], 2841 ol: [], 2842 p: [], 2843 pre: [], 2844 s: [], 2845 small: [], 2846 span: [], 2847 sub: [], 2848 sup: [], 2849 strong: [], 2850 u: [], 2851 ul: [] 2852 /** 2853 * A pattern that recognizes a commonly useful subset of URLs that are safe. 2854 * 2855 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 2856 */ 2857 2858 }; 2859 var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi; 2860 /** 2861 * A pattern that matches safe data URLs. Only matches image, video and audio types. 2862 * 2863 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 2864 */ 2865 2866 var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i; 2867 2868 function allowedAttribute(attr, allowedAttributeList) { 2869 var attrName = attr.nodeName.toLowerCase(); 2870 2871 if (allowedAttributeList.indexOf(attrName) !== -1) { 2872 if (uriAttrs.indexOf(attrName) !== -1) { 2873 return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)); 2874 } 2875 2876 return true; 2877 } 2878 2879 var regExp = allowedAttributeList.filter(function (attrRegex) {
vendor: 4,930 bytes, lines 2880-3061
2880 return attrRegex instanceof RegExp; 2881 }); // Check if a regular expression validates the attribute. 2882 2883 for (var i = 0, l = regExp.length; i < l; i++) { 2884 if (attrName.match(regExp[i])) { 2885 return true; 2886 } 2887 } 2888 2889 return false; 2890 } 2891 2892 function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { 2893 if (unsafeHtml.length === 0) { 2894 return unsafeHtml; 2895 } 2896 2897 if (sanitizeFn && typeof sanitizeFn === 'function') { 2898 return sanitizeFn(unsafeHtml); 2899 } 2900 2901 var domParser = new window.DOMParser(); 2902 var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); 2903 var whitelistKeys = Object.keys(whiteList); 2904 var elements = [].slice.call(createdDocument.body.querySelectorAll('*')); 2905 2906 var _loop = function _loop(i, len) { 2907 var el = elements[i]; 2908 var elName = el.nodeName.toLowerCase(); 2909 2910 if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) { 2911 el.parentNode.removeChild(el); 2912 return "continue"; 2913 } 2914 2915 var attributeList = [].slice.call(el.attributes); 2916 var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); 2917 attributeList.forEach(function (attr) { 2918 if (!allowedAttribute(attr, whitelistedAttributes)) { 2919 el.removeAttribute(attr.nodeName); 2920 } 2921 }); 2922 }; 2923 2924 for (var i = 0, len = elements.length; i < len; i++) { 2925 var _ret = _loop(i, len); 2926 2927 if (_ret === "continue") { continue; } 2928 } 2929 2930 return createdDocument.body.innerHTML; 2931 } 2932 2933 /** 2934 * ------------------------------------------------------------------------ 2935 * Constants 2936 * ------------------------------------------------------------------------ 2937 */ 2938 2939 var NAME$6 = 'tooltip'; 2940 var VERSION$6 = '4.3.1'; 2941 var DATA_KEY$6 = 'bs.tooltip'; 2942 var EVENT_KEY$6 = "." + DATA_KEY$6; 2943 var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6]; 2944 var CLASS_PREFIX = 'bs-tooltip'; 2945 var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); 2946 var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; 2947 var DefaultType$4 = { 2948 animation: 'boolean', 2949 template: 'string', 2950 title: '(string|element|function)', 2951 trigger: 'string', 2952 delay: '(number|object)', 2953 html: 'boolean', 2954 selector: '(string|boolean)', 2955 placement: '(string|function)', 2956 offset: '(number|string|function)', 2957 container: '(string|element|boolean)', 2958 fallbackPlacement: '(string|array)', 2959 boundary: '(string|element)', 2960 sanitize: 'boolean', 2961 sanitizeFn: '(null|function)', 2962 whiteList: 'object' 2963 }; 2964 var AttachmentMap$1 = { 2965 AUTO: 'auto', 2966 TOP: 'top', 2967 RIGHT: 'right', 2968 BOTTOM: 'bottom', 2969 LEFT: 'left' 2970 }; 2971 var Default$4 = { 2972 animation: true, 2973 template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>', 2974 trigger: 'hover focus', 2975 title: '', 2976 delay: 0, 2977 html: false, 2978 selector: false, 2979 placement: 'top', 2980 offset: 0, 2981 container: false, 2982 fallbackPlacement: 'flip', 2983 boundary: 'scrollParent', 2984 sanitize: true, 2985 sanitizeFn: null, 2986 whiteList: DefaultWhitelist 2987 }; 2988 var HoverState = { 2989 SHOW: 'show', 2990 OUT: 'out' 2991 }; 2992 var Event$6 = { 2993 HIDE: "hide" + EVENT_KEY$6, 2994 HIDDEN: "hidden" + EVENT_KEY$6, 2995 SHOW: "show" + EVENT_KEY$6, 2996 SHOWN: "shown" + EVENT_KEY$6, 2997 INSERTED: "inserted" + EVENT_KEY$6, 2998 CLICK: "click" + EVENT_KEY$6, 2999 FOCUSIN: "focusin" + EVENT_KEY$6, 3000 FOCUSOUT: "focusout" + EVENT_KEY$6, 3001 MOUSEENTER: "mouseenter" + EVENT_KEY$6, 3002 MOUSELEAVE: "mouseleave" + EVENT_KEY$6 3003 }; 3004 var ClassName$6 = { 3005 FADE: 'fade', 3006 SHOW: 'show' 3007 }; 3008 var Selector$6 = { 3009 TOOLTIP: '.tooltip', 3010 TOOLTIP_INNER: '.tooltip-inner', 3011 ARROW: '.arrow' 3012 }; 3013 var Trigger = { 3014 HOVER: 'hover', 3015 FOCUS: 'focus', 3016 CLICK: 'click', 3017 MANUAL: 'manual' 3018 /** 3019 * ------------------------------------------------------------------------ 3020 * Class Definition 3021 * ------------------------------------------------------------------------ 3022 */ 3023 3024 }; 3025 3026 var Tooltip = 3027 /*#__PURE__*/ 3028 function () { 3029 function Tooltip(element, config) { 3030 /** 3031 * Check for Popper dependency 3032 * Popper - https://popper.js.org 3033 */ 3034 if (typeof Popper === 'undefined') { 3035 throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)'); 3036 } // private 3037 3038 3039 this._isEnabled = true; 3040 this._timeout = 0; 3041 this._hoverState = ''; 3042 this._activeTrigger = {}; 3043 this._popper = null; // Protected 3044 3045 this.element = element; 3046 this.config = this._getConfig(config); 3047 this.tip = null; 3048 3049 this._setListeners(); 3050 } // Getters 3051 3052 3053 var _proto = Tooltip.prototype; 3054 3055 // Public 3056 _proto.enable = function enable() { 3057 this._isEnabled = true; 3058 }; 3059 3060 _proto.disable = function disable() { 3061 this._isEnabled = false;
3062 }; 3063 3064 _proto.toggleEnabled = function toggleEnabled() { 3065 this._isEnabled = !this._isEnabled; 3066 }; 3067 3068 _proto.toggle = function toggle(event) { 3069 if (!this._isEnabled) { 3070 return; 3071 } 3072 3073 if (event) { 3074 var dataKey = this.constructor.DATA_KEY; 3075 var context = $(event.currentTarget).data(dataKey); 3076 3077 if (!context) { 3078 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 3079 $(event.currentTarget).data(dataKey, context); 3080 } 3081 3082 context._activeTrigger.click = !context._activeTrigger.click; 3083 3084 if (context._isWithActiveTrigger()) { 3085 context._enter(null, context); 3086 } else { 3087 context._leave(null, context); 3088 } 3089 } else { 3090 if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) { 3091 this._leave(null, this); 3092 3093 return; 3094 } 3095 3096 this._enter(null, this); 3097 } 3098 }; 3099 3100 _proto.dispose = function dispose() { 3101 clearTimeout(this._timeout); 3102 $.removeData(this.element, this.constructor.DATA_KEY); 3103 $(this.element).off(this.constructor.EVENT_KEY); 3104 $(this.element).closest('.modal').off('hide.bs.modal'); 3105 3106 if (this.tip) { 3107 $(this.tip).remove(); 3108 } 3109 3110 this._isEnabled = null; 3111 this._timeout = null; 3112 this._hoverState = null; 3113 this._activeTrigger = null; 3114 3115 if (this._popper !== null) { 3116 this._popper.destroy(); 3117 } 3118 3119 this._popper = null; 3120 this.element = null; 3121 this.config = null; 3122 this.tip = null; 3123 }; 3124 3125 _proto.show = function show() { 3126 var _this = this; 3127 3128 if ($(this.element).css('display') === 'none') { 3129 throw new Error('Please use show on visible elements'); 3130 } 3131 3132 var showEvent = $.Event(this.constructor.Event.SHOW); 3133 3134 if (this.isWithContent() && this._isEnabled) { 3135 $(this.element).trigger(showEvent); 3136 var shadowRoot = Util.findShadowRoot(this.element); 3137 var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element); 3138 3139 if (showEvent.isDefaultPrevented() || !isInTheDom) { 3140 return; 3141 } 3142 3143 var tip = this.getTipElement(); 3144 var tipId = Util.getUID(this.constructor.NAME);
3145 tip.setAttribute('id', tipId); 3146 this.element.setAttribute('aria-describedby', tipId); 3147 this.setContent(); 3148 3149 if (this.config.animation) { 3150 $(tip).addClass(ClassName$6.FADE); 3151 } 3152 3153 var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; 3154 3155 var attachment = this._getAttachment(placement); 3156 3157 this.addAttachmentClass(attachment); 3158 3159 var container = this._getContainer(); 3160 3161 $(tip).data(this.constructor.DATA_KEY, this); 3162 3163 if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) { 3164 $(tip).appendTo(container); 3165 } 3166 3167 $(this.element).trigger(this.constructor.Event.INSERTED); 3168 this._popper = new Popper(this.element, tip, { 3169 placement: attachment, 3170 modifiers: { 3171 offset: this._getOffset(), 3172 flip: { 3173 behavior: this.config.fallbackPlacement 3174 }, 3175 arrow: { 3176 element: Selector$6.ARROW 3177 }, 3178 preventOverflow: { 3179 boundariesElement: this.config.boundary 3180 } 3181 }, 3182 onCreate: function onCreate(data) { 3183 if (data.originalPlacement !== data.placement) { 3184 _this._handlePopperPlacementChange(data); 3185 } 3186 }, 3187 onUpdate: function onUpdate(data) { 3188 return _this._handlePopperPlacementChange(data); 3189 } 3190 }); 3191 $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra 3192 // empty mouseover listeners to the body's immediate children; 3193 // only needed because of broken event delegation on iOS 3194 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 3195 3196 if ('ontouchstart' in document.documentElement) { 3197 $(document.body).children().on('mouseover', null, $.noop); 3198 } 3199 3200 var complete = function complete() { 3201 if (_this.config.animation) { 3202 _this._fixTransition(); 3203 } 3204 3205 var prevHoverState = _this._hoverState; 3206 _this._hoverState = null; 3207 $(_this.element).trigger(_this.constructor.Event.SHOWN); 3208 3209 if (prevHoverState === HoverState.OUT) { 3210 _this._leave(null, _this); 3211 } 3212 }; 3213 3214 if ($(this.tip).hasClass(ClassName$6.FADE)) { 3215 var transitionDuration = Util.getTransitionDurationFromElement(this.tip); 3216 $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 3217 } else { 3218 complete(); 3219 } 3220 } 3221 }; 3222 3223 _proto.hide = function hide(callback) { 3224 var _this2 = this; 3225 3226 var tip = this.getTipElement(); 3227 var hideEvent = $.Event(this.constructor.Event.HIDE); 3228 3229 var complete = function complete() { 3230 if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) { 3231 tip.parentNode.removeChild(tip); 3232 } 3233 3234 _this2._cleanTipClass(); 3235 3236 _this2.element.removeAttribute('aria-describedby'); 3237 3238 $(_this2.element).trigger(_this2.constructor.Event.HIDDEN); 3239 3240 if (_this2._popper !== null) { 3241 _this2._popper.destroy(); 3242 } 3243 3244 if (callback) { 3245 callback(); 3246 } 3247 }; 3248 3249 $(this.element).trigger(hideEvent); 3250 3251 if (hideEvent.isDefaultPrevented()) { 3252 return; 3253 } 3254 3255 $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra 3256 // empty mouseover listeners we added for iOS support 3257 3258 if ('ontouchstart' in document.documentElement) { 3259 $(document.body).children().off('mouseover', null, $.noop); 3260 } 3261 3262 this._activeTrigger[Trigger.CLICK] = false; 3263 this._activeTrigger[Trigger.FOCUS] = false; 3264 this._activeTrigger[Trigger.HOVER] = false; 3265 3266 if ($(this.tip).hasClass(ClassName$6.FADE)) { 3267 var transitionDuration = Util.getTransitionDurationFromElement(tip); 3268 $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 3269 } else { 3270 complete(); 3271 } 3272 3273 this._hoverState = ''; 3274 }; 3275
3276 _proto.update = function update() { 3277 if (this._popper !== null) { 3278 this._popper.scheduleUpdate(); 3279 } 3280 } // Protected 3281 ; 3282 3283 _proto.isWithContent = function isWithContent() { 3284 return Boolean(this.getTitle()); 3285 }; 3286 3287 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 3288 $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); 3289 }; 3290 3291 _proto.getTipElement = function getTipElement() { 3292 this.tip = this.tip || $(this.config.template)[0]; 3293 return this.tip; 3294 }; 3295 3296 _proto.setContent = function setContent() { 3297 var tip = this.getTipElement(); 3298 this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle()); 3299 $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW); 3300 }; 3301 3302 _proto.setElementContent = function setElementContent($element, content) { 3303 if (typeof content === 'object' && (content.nodeType || content.jquery)) { 3304 // Content is a DOM node or a jQuery 3305 if (this.config.html) { 3306 if (!$(content).parent().is($element)) { 3307 $element.empty().append(content); 3308 } 3309 } else { 3310 $element.text($(content).text()); 3311 } 3312 3313 return; 3314 } 3315 3316 if (this.config.html) { 3317 if (this.config.sanitize) { 3318 content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn); 3319 } 3320 3321 $element.html(content); 3322 } else { 3323 $element.text(content); 3324 } 3325 }; 3326 3327 _proto.getTitle = function getTitle() { 3328 var title = this.element.getAttribute('data-original-title'); 3329 3330 if (!title) { 3331 title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; 3332 } 3333 3334 return title; 3335 } // Private 3336 ; 3337 3338 _proto._getOffset = function _getOffset() { 3339 var _this3 = this; 3340 3341 var offset = {}; 3342 3343 if (typeof this.config.offset === 'function') { 3344 offset.fn = function (data) { 3345 data.offsets = _objectSpread({}, data.offsets, _this3.config.offset(data.offsets, _this3.element) || {}); 3346 return data; 3347 }; 3348 } else { 3349 offset.offset = this.config.offset; 3350 } 3351 3352 return offset; 3353 }; 3354 3355 _proto._getContainer = function _getContainer() { 3356 if (this.config.container === false) { 3357 return document.body; 3358 } 3359 3360 if (Util.isElement(this.config.container)) { 3361 return $(this.config.container); 3362 } 3363 3364 return $(document).find(this.config.container); 3365 }; 3366 3367 _proto._getAttachment = function _getAttachment(placement) { 3368 return AttachmentMap$1[placement.toUpperCase()]; 3369 }; 3370 3371 _proto._setListeners = function _setListeners() { 3372 var _this4 = this; 3373 3374 var triggers = this.config.trigger.split(' '); 3375 triggers.forEach(function (trigger) { 3376 if (trigger === 'click') { 3377 $(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, function (event) { 3378 return _this4.toggle(event); 3379 }); 3380 } else if (trigger !== Trigger.MANUAL) { 3381 var eventIn = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN; 3382 var eventOut = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT; 3383 $(_this4.element).on(eventIn, _this4.config.selector, function (event) { 3384 return _this4._enter(event); 3385 }).on(eventOut, _this4.config.selector, function (event) { 3386 return _this4._leave(event); 3387 }); 3388 } 3389 }); 3390 $(this.element).closest('.modal').on('hide.bs.modal', function () { 3391 if (_this4.element) { 3392 _this4.hide(); 3393 } 3394 }); 3395 3396 if (this.config.selector) { 3397 this.config = _objectSpread({}, this.config, { 3398 trigger: 'manual', 3399 selector: '' 3400 }); 3401 } else { 3402 this._fixTitle(); 3403 } 3404 }; 3405 3406 _proto._fixTitle = function _fixTitle() { 3407 var titleType = typeof this.element.getAttribute('data-original-title'); 3408 3409 if (this.element.getAttribute('title') || titleType !== 'string') { 3410 this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); 3411 this.element.setAttribute('title', ''); 3412 } 3413 }; 3414 3415 _proto._enter = function _enter(event, context) { 3416 var dataKey = this.constructor.DATA_KEY; 3417 context = context || $(event.currentTarget).data(dataKey); 3418 3419 if (!context) { 3420 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 3421 $(event.currentTarget).data(dataKey, context); 3422 } 3423 3424 if (event) { 3425 context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true; 3426 } 3427 3428 if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) { 3429 context._hoverState = HoverState.SHOW; 3430 return; 3431 } 3432 3433 clearTimeout(context._timeout); 3434 context._hoverState = HoverState.SHOW; 3435 3436 if (!context.config.delay || !context.config.delay.show) { 3437 context.show(); 3438 return; 3439 } 3440 3441 context._timeout = setTimeout(function () { 3442 if (context._hoverState === HoverState.SHOW) { 3443 context.show(); 3444 } 3445 }, context.config.delay.show); 3446 }; 3447 3448 _proto._leave = function _leave(event, context) { 3449 var dataKey = this.constructor.DATA_KEY; 3450 context = context || $(event.currentTarget).data(dataKey); 3451 3452 if (!context) { 3453 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 3454 $(event.currentTarget).data(dataKey, context); 3455 } 3456 3457 if (event) { 3458 context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
3459 } 3460 3461 if (context._isWithActiveTrigger()) { 3462 return; 3463 } 3464 3465 clearTimeout(context._timeout); 3466 context._hoverState = HoverState.OUT; 3467 3468 if (!context.config.delay || !context.config.delay.hide) { 3469 context.hide(); 3470 return; 3471 } 3472 3473 context._timeout = setTimeout(function () { 3474 if (context._hoverState === HoverState.OUT) { 3475 context.hide(); 3476 } 3477 }, context.config.delay.hide); 3478 }; 3479 3480 _proto._isWithActiveTrigger = function _isWithActiveTrigger() { 3481 var this$1 = this; 3482 3483 for (var trigger in this$1._activeTrigger) { 3484 if (this$1._activeTrigger[trigger]) { 3485 return true; 3486 } 3487 } 3488 3489 return false; 3490 }; 3491 3492 _proto._getConfig = function _getConfig(config) { 3493 var dataAttributes = $(this.element).data(); 3494 Object.keys(dataAttributes).forEach(function (dataAttr) { 3495 if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) { 3496 delete dataAttributes[dataAttr]; 3497 } 3498 }); 3499 config = _objectSpread({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {}); 3500 3501 if (typeof config.delay === 'number') { 3502 config.delay = { 3503 show: config.delay, 3504 hide: config.delay 3505 }; 3506 } 3507 3508 if (typeof config.title === 'number') { 3509 config.title = config.title.toString(); 3510 } 3511 3512 if (typeof config.content === 'number') { 3513 config.content = config.content.toString(); 3514 } 3515 3516 Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType); 3517 3518 if (config.sanitize) { 3519 config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn); 3520 } 3521 3522 return config; 3523 }; 3524 3525 _proto._getDelegateConfig = function _getDelegateConfig() { 3526 var this$1 = this; 3527 3528 var config = {}; 3529 3530 if (this.config) { 3531 for (var key in this$1.config) { 3532 if (this$1.constructor.Default[key] !== this$1.config[key]) { 3533 config[key] = this$1.config[key]; 3534 } 3535 } 3536 } 3537 3538 return config; 3539 }; 3540 3541 _proto._cleanTipClass = function _cleanTipClass() { 3542 var $tip = $(this.getTipElement()); 3543 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); 3544 3545 if (tabClass !== null && tabClass.length) { 3546 $tip.removeClass(tabClass.join('')); 3547 } 3548 }; 3549 3550 _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) { 3551 var popperInstance = popperData.instance; 3552 this.tip = popperInstance.popper; 3553 3554 this._cleanTipClass(); 3555 3556 this.addAttachmentClass(this._getAttachment(popperData.placement)); 3557 }; 3558 3559 _proto._fixTransition = function _fixTransition() { 3560 var tip = this.getTipElement(); 3561 var initConfigAnimation = this.config.animation; 3562 3563 if (tip.getAttribute('x-placement') !== null) { 3564 return; 3565 } 3566 3567 $(tip).removeClass(ClassName$6.FADE); 3568 this.config.animation = false; 3569 this.hide(); 3570 this.show(); 3571 this.config.animation = initConfigAnimation; 3572 } // Static 3573 ; 3574 3575 Tooltip._jQueryInterface = function _jQueryInterface(config) { 3576 return this.each(function () { 3577 var data = $(this).data(DATA_KEY$6); 3578 3579 var _config = typeof config === 'object' && config; 3580 3581 if (!data && /dispose|hide/.test(config)) { 3582 return; 3583 } 3584 3585 if (!data) { 3586 data = new Tooltip(this, _config); 3587 $(this).data(DATA_KEY$6, data); 3588 } 3589 3590 if (typeof config === 'string') { 3591 if (typeof data[config] === 'undefined') { 3592 throw new TypeError("No method named \"" + config + "\""); 3593 } 3594 3595 data[config](); 3596 } 3597 }); 3598 }; 3599 3600 _createClass(Tooltip, null, [{ 3601 key: "VERSION", 3602 get: function get() { 3603 return VERSION$6; 3604 } 3605 }, { 3606 key: "Default", 3607 get: function get() { 3608 return Default$4; 3609 } 3610 }, { 3611 key: "NAME", 3612 get: function get() { 3613 return NAME$6; 3614 } 3615 }, { 3616 key: "DATA_KEY", 3617 get: function get() { 3618 return DATA_KEY$6; 3619 } 3620 }, {
3621 key: "Event", 3622 get: function get() { 3623 return Event$6; 3624 } 3625 }, { 3626 key: "EVENT_KEY", 3627 get: function get() { 3628 return EVENT_KEY$6; 3629 } 3630 }, { 3631 key: "DefaultType", 3632 get: function get() { 3633 return DefaultType$4; 3634 } 3635 }]); 3636 3637 return Tooltip; 3638 }(); 3639 /** 3640 * ------------------------------------------------------------------------ 3641 * jQuery 3642 * ------------------------------------------------------------------------ 3643 */ 3644 3645 3646 $.fn[NAME$6] = Tooltip._jQueryInterface; 3647 $.fn[NAME$6].Constructor = Tooltip; 3648 3649 $.fn[NAME$6].noConflict = function () { 3650 $.fn[NAME$6] = JQUERY_NO_CONFLICT$6; 3651 return Tooltip._jQueryInterface; 3652 }; 3653 3654 /** 3655 * ------------------------------------------------------------------------ 3656 * Constants 3657 * ------------------------------------------------------------------------ 3658 */ 3659 3660 var NAME$7 = 'popover'; 3661 var VERSION$7 = '4.3.1'; 3662 var DATA_KEY$7 = 'bs.popover'; 3663 var EVENT_KEY$7 = "." + DATA_KEY$7; 3664 var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7]; 3665 var CLASS_PREFIX$1 = 'bs-popover'; 3666 var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g'); 3667 3668 var Default$5 = _objectSpread({}, Tooltip.Default, { 3669 placement: 'right', 3670 trigger: 'click', 3671 content: '', 3672 template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' 3673 }); 3674 3675 var DefaultType$5 = _objectSpread({}, Tooltip.DefaultType, { 3676 content: '(string|element|function)' 3677 }); 3678 3679 var ClassName$7 = { 3680 FADE: 'fade', 3681 SHOW: 'show' 3682 }; 3683 var Selector$7 = { 3684 TITLE: '.popover-header', 3685 CONTENT: '.popover-body' 3686 }; 3687 var Event$7 = { 3688 HIDE: "hide" + EVENT_KEY$7, 3689 HIDDEN: "hidden" + EVENT_KEY$7, 3690 SHOW: "show" + EVENT_KEY$7, 3691 SHOWN: "shown" + EVENT_KEY$7, 3692 INSERTED: "inserted" + EVENT_KEY$7, 3693 CLICK: "click" + EVENT_KEY$7, 3694 FOCUSIN: "focusin" + EVENT_KEY$7, 3695 FOCUSOUT: "focusout" + EVENT_KEY$7, 3696 MOUSEENTER: "mouseenter" + EVENT_KEY$7, 3697 MOUSELEAVE: "mouseleave" + EVENT_KEY$7 3698 /** 3699 * ------------------------------------------------------------------------ 3700 * Class Definition 3701 * ------------------------------------------------------------------------ 3702 */ 3703 3704 }; 3705 3706 var Popover = 3707 /*#__PURE__*/ 3708 function (_Tooltip) { 3709 _inheritsLoose(Popover, _Tooltip); 3710 3711 function Popover() { 3712 return _Tooltip.apply(this, arguments) || this; 3713 } 3714 3715 var _proto = Popover.prototype; 3716 3717 // Overrides 3718 _proto.isWithContent = function isWithContent() { 3719 return this.getTitle() || this._getContent(); 3720 }; 3721 3722 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 3723 $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment); 3724 }; 3725 3726 _proto.getTipElement = function getTipElement() { 3727 this.tip = this.tip || $(this.config.template)[0]; 3728 return this.tip; 3729 }; 3730 3731 _proto.setContent = function setContent() { 3732 var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events 3733 3734 this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle()); 3735 3736 var content = this._getContent(); 3737 3738 if (typeof content === 'function') { 3739 content = content.call(this.element); 3740 } 3741 3742 this.setElementContent($tip.find(Selector$7.CONTENT), content); 3743 $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW); 3744 } // Private 3745 ; 3746 3747 _proto._getContent = function _getContent() { 3748 return this.element.getAttribute('data-content') || this.config.content; 3749 }; 3750 3751 _proto._cleanTipClass = function _cleanTipClass() { 3752 var $tip = $(this.getTipElement()); 3753 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1); 3754 3755 if (tabClass !== null && tabClass.length > 0) { 3756 $tip.removeClass(tabClass.join('')); 3757 } 3758 } // Static 3759 ; 3760 3761 Popover._jQueryInterface = function _jQueryInterface(config) { 3762 return this.each(function () { 3763 var data = $(this).data(DATA_KEY$7); 3764 3765 var _config = typeof config === 'object' ? config : null; 3766 3767 if (!data && /dispose|hide/.test(config)) { 3768 return; 3769 } 3770 3771 if (!data) { 3772 data = new Popover(this, _config); 3773 $(this).data(DATA_KEY$7, data); 3774 } 3775 3776 if (typeof config === 'string') { 3777 if (typeof data[config] === 'undefined') {
3778 throw new TypeError("No method named \"" + config + "\""); 3779 } 3780 3781 data[config](); 3782 } 3783 }); 3784 }; 3785 3786 _createClass(Popover, null, [{ 3787 key: "VERSION", 3788 // Getters 3789 get: function get() { 3790 return VERSION$7; 3791 } 3792 }, { 3793 key: "Default", 3794 get: function get() { 3795 return Default$5; 3796 } 3797 }, { 3798 key: "NAME", 3799 get: function get() { 3800 return NAME$7; 3801 } 3802 }, { 3803 key: "DATA_KEY", 3804 get: function get() { 3805 return DATA_KEY$7; 3806 } 3807 }, { 3808 key: "Event", 3809 get: function get() { 3810 return Event$7; 3811 } 3812 }, { 3813 key: "EVENT_KEY", 3814 get: function get() { 3815 return EVENT_KEY$7; 3816 } 3817 }, { 3818 key: "DefaultType", 3819 get: function get() { 3820 return DefaultType$5; 3821 } 3822 }]); 3823 3824 return Popover; 3825 }(Tooltip); 3826 /** 3827 * ------------------------------------------------------------------------ 3828 * jQuery 3829 * ------------------------------------------------------------------------ 3830 */ 3831 3832 3833 $.fn[NAME$7] = Popover._jQueryInterface; 3834 $.fn[NAME$7].Constructor = Popover; 3835 3836 $.fn[NAME$7].noConflict = function () { 3837 $.fn[NAME$7] = JQUERY_NO_CONFLICT$7; 3838 return Popover._jQueryInterface; 3839 }; 3840 3841 /** 3842 * ------------------------------------------------------------------------ 3843 * Constants 3844 * ------------------------------------------------------------------------ 3845 */ 3846 3847 var NAME$8 = 'scrollspy'; 3848 var VERSION$8 = '4.3.1'; 3849 var DATA_KEY$8 = 'bs.scrollspy'; 3850 var EVENT_KEY$8 = "." + DATA_KEY$8; 3851 var DATA_API_KEY$6 = '.data-api'; 3852 var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8]; 3853 var Default$6 = { 3854 offset: 10, 3855 method: 'auto', 3856 target: '' 3857 }; 3858 var DefaultType$6 = { 3859 offset: 'number', 3860 method: 'string', 3861 target: '(string|element)' 3862 }; 3863 var Event$8 = { 3864 ACTIVATE: "activate" + EVENT_KEY$8, 3865 SCROLL: "scroll" + EVENT_KEY$8, 3866 LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6 3867 }; 3868 var ClassName$8 = { 3869 DROPDOWN_ITEM: 'dropdown-item', 3870 DROPDOWN_MENU: 'dropdown-menu', 3871 ACTIVE: 'active' 3872 }; 3873 var Selector$8 = { 3874 DATA_SPY: '[data-spy="scroll"]', 3875 ACTIVE: '.active', 3876 NAV_LIST_GROUP: '.nav, .list-group', 3877 NAV_LINKS: '.nav-link', 3878 NAV_ITEMS: '.nav-item', 3879 LIST_ITEMS: '.list-group-item', 3880 DROPDOWN: '.dropdown', 3881 DROPDOWN_ITEMS: '.dropdown-item', 3882 DROPDOWN_TOGGLE: '.dropdown-toggle' 3883 }; 3884 var OffsetMethod = { 3885 OFFSET: 'offset', 3886 POSITION: 'position' 3887 /** 3888 * ------------------------------------------------------------------------ 3889 * Class Definition 3890 * ------------------------------------------------------------------------ 3891 */ 3892 3893 }; 3894 3895 var ScrollSpy = 3896 /*#__PURE__*/ 3897 function () { 3898 function ScrollSpy(element, config) { 3899 var _this = this; 3900 3901 this._element = element; 3902 this._scrollElement = element.tagName === 'BODY' ? window : element; 3903 this._config = this._getConfig(config); 3904 this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS); 3905 this._offsets = []; 3906 this._targets = []; 3907 this._activeTarget = null; 3908 this._scrollHeight = 0; 3909 $(this._scrollElement).on(Event$8.SCROLL, function (event) { 3910 return _this._process(event); 3911 }); 3912 this.refresh(); 3913 3914 this._process(); 3915 } // Getters 3916 3917 3918 var _proto = ScrollSpy.prototype; 3919 3920 // Public 3921 _proto.refresh = function refresh() { 3922 var _this2 = this; 3923 3924 var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION; 3925 var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; 3926 var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0; 3927 this._offsets = []; 3928 this._targets = []; 3929 this._scrollHeight = this._getScrollHeight(); 3930 var targets = [].slice.call(document.querySelectorAll(this._selector)); 3931 targets.map(function (element) { 3932 var target; 3933 var targetSelector = Util.getSelectorFromElement(element); 3934
3935 if (targetSelector) { 3936 target = document.querySelector(targetSelector); 3937 } 3938 3939 if (target) { 3940 var targetBCR = target.getBoundingClientRect(); 3941 3942 if (targetBCR.width || targetBCR.height) { 3943 // TODO (fat): remove sketch reliance on jQuery position/offset 3944 return [$(target)[offsetMethod]().top + offsetBase, targetSelector]; 3945 } 3946 } 3947 3948 return null; 3949 }).filter(function (item) { 3950 return item; 3951 }).sort(function (a, b) { 3952 return a[0] - b[0]; 3953 }).forEach(function (item) { 3954 _this2._offsets.push(item[0]); 3955 3956 _this2._targets.push(item[1]); 3957 }); 3958 }; 3959 3960 _proto.dispose = function dispose() { 3961 $.removeData(this._element, DATA_KEY$8); 3962 $(this._scrollElement).off(EVENT_KEY$8); 3963 this._element = null; 3964 this._scrollElement = null; 3965 this._config = null; 3966 this._selector = null; 3967 this._offsets = null; 3968 this._targets = null; 3969 this._activeTarget = null; 3970 this._scrollHeight = null; 3971 } // Private 3972 ; 3973 3974 _proto._getConfig = function _getConfig(config) { 3975 config = _objectSpread({}, Default$6, typeof config === 'object' && config ? config : {}); 3976 3977 if (typeof config.target !== 'string') { 3978 var id = $(config.target).attr('id'); 3979 3980 if (!id) { 3981 id = Util.getUID(NAME$8); 3982 $(config.target).attr('id', id); 3983 } 3984 3985 config.target = "#" + id; 3986 } 3987 3988 Util.typeCheckConfig(NAME$8, config, DefaultType$6); 3989 return config; 3990 }; 3991 3992 _proto._getScrollTop = function _getScrollTop() { 3993 return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; 3994 }; 3995 3996 _proto._getScrollHeight = function _getScrollHeight() { 3997 return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); 3998 }; 3999 4000 _proto._getOffsetHeight = function _getOffsetHeight() { 4001 return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; 4002 }; 4003 4004 _proto._process = function _process() { 4005 var this$1 = this; 4006 4007 var scrollTop = this._getScrollTop() + this._config.offset; 4008 4009 var scrollHeight = this._getScrollHeight(); 4010 4011 var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); 4012 4013 if (this._scrollHeight !== scrollHeight) { 4014 this.refresh(); 4015 } 4016 4017 if (scrollTop >= maxScroll) { 4018 var target = this._targets[this._targets.length - 1]; 4019 4020 if (this._activeTarget !== target) { 4021 this._activate(target); 4022 } 4023 4024 return; 4025 } 4026 4027 if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { 4028 this._activeTarget = null; 4029 4030 this._clear(); 4031 4032 return; 4033 } 4034 4035 var offsetLength = this._offsets.length; 4036 4037 for (var i = offsetLength; i--;) { 4038 var isActiveTarget = this$1._activeTarget !== this$1._targets[i] && scrollTop >= this$1._offsets[i] && (typeof this$1._offsets[i + 1] === 'undefined' || scrollTop < this$1._offsets[i + 1]); 4039 4040 if (isActiveTarget) { 4041 this$1._activate(this$1._targets[i]); 4042 } 4043 } 4044 }; 4045 4046 _proto._activate = function _activate(target) { 4047 this._activeTarget = target; 4048 4049 this._clear(); 4050 4051 var queries = this._selector.split(',').map(function (selector) { 4052 return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]"; 4053 }); 4054 4055 var $link = $([].slice.call(document.querySelectorAll(queries.join(',')))); 4056 4057 if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) { 4058 $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE); 4059 $link.addClass(ClassName$8.ACTIVE); 4060 } else { 4061 // Set triggered link as active 4062 $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active 4063 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 4064 4065 $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.
4065LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item 4066 4067 $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE); 4068 } 4069 4070 $(this._scrollElement).trigger(Event$8.ACTIVATE, { 4071 relatedTarget: target 4072 }); 4073 }; 4074 4075 _proto._clear = function _clear() { 4076 [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) { 4077 return node.classList.contains(ClassName$8.ACTIVE); 4078 }).forEach(function (node) { 4079 return node.classList.remove(ClassName$8.ACTIVE); 4080 }); 4081 } // Static 4082 ; 4083 4084 ScrollSpy._jQueryInterface = function _jQueryInterface(config) { 4085 return this.each(function () { 4086 var data = $(this).data(DATA_KEY$8); 4087 4088 var _config = typeof config === 'object' && config; 4089 4090 if (!data) { 4091 data = new ScrollSpy(this, _config); 4092 $(this).data(DATA_KEY$8, data); 4093 } 4094 4095 if (typeof config === 'string') { 4096 if (typeof data[config] === 'undefined') { 4097 throw new TypeError("No method named \"" + config + "\""); 4098 } 4099 4100 data[config](); 4101 } 4102 }); 4103 }; 4104 4105 _createClass(ScrollSpy, null, [{ 4106 key: "VERSION", 4107 get: function get() { 4108 return VERSION$8; 4109 } 4110 }, { 4111 key: "Default", 4112 get: function get() { 4113 return Default$6; 4114 } 4115 }]); 4116 4117 return ScrollSpy; 4118 }(); 4119 /** 4120 * ------------------------------------------------------------------------ 4121 * Data Api implementation 4122 * ------------------------------------------------------------------------ 4123 */ 4124 4125 4126 $(window).on(Event$8.LOAD_DATA_API, function () { 4127 var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY)); 4128 var scrollSpysLength = scrollSpys.length; 4129 4130 for (var i = scrollSpysLength; i--;) { 4131 var $spy = $(scrollSpys[i]); 4132 4133 ScrollSpy._jQueryInterface.call($spy, $spy.data()); 4134 } 4135 }); 4136 /** 4137 * ------------------------------------------------------------------------ 4138 * jQuery 4139 * ------------------------------------------------------------------------ 4140 */ 4141 4142 $.fn[NAME$8] = ScrollSpy._jQueryInterface; 4143 $.fn[NAME$8].Constructor = ScrollSpy; 4144 4145 $.fn[NAME$8].noConflict = function () { 4146 $.fn[NAME$8] = JQUERY_NO_CONFLICT$8; 4147 return ScrollSpy._jQueryInterface; 4148 }; 4149 4150 /** 4151 * ------------------------------------------------------------------------ 4152 * Constants 4153 * ------------------------------------------------------------------------ 4154 */ 4155 4156 var NAME$9 = 'tab'; 4157 var VERSION$9 = '4.3.1'; 4158 var DATA_KEY$9 = 'bs.tab'; 4159 var EVENT_KEY$9 = "." + DATA_KEY$9; 4160 var DATA_API_KEY$7 = '.data-api'; 4161 var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9]; 4162 var Event$9 = { 4163 HIDE: "hide" + EVENT_KEY$9, 4164 HIDDEN: "hidden" + EVENT_KEY$9, 4165 SHOW: "show" + EVENT_KEY$9, 4166 SHOWN: "shown" + EVENT_KEY$9, 4167 CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7 4168 }; 4169 var ClassName$9 = { 4170 DROPDOWN_MENU: 'dropdown-menu', 4171 ACTIVE: 'active', 4172 DISABLED: 'disabled', 4173 FADE: 'fade', 4174 SHOW: 'show' 4175 }; 4176 var Selector$9 = { 4177 DROPDOWN: '.dropdown', 4178 NAV_LIST_GROUP: '.nav, .list-group', 4179 ACTIVE: '.active', 4180 ACTIVE_UL: '> li > .active', 4181 DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]', 4182 DROPDOWN_TOGGLE: '.dropdown-toggle', 4183 DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active' 4184 /** 4185 * ------------------------------------------------------------------------ 4186 * Class Definition 4187 * ------------------------------------------------------------------------ 4188 */ 4189 4190 }; 4191 4192 var Tab = 4193 /*#__PURE__*/ 4194 function () { 4195 function Tab(element) { 4196 this._element = element; 4197 } // Getters 4198 4199 4200 var _proto = Tab.prototype; 4201 4202 // Public 4203 _proto.show = function show() { 4204 var _this = this; 4205 4206 if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) { 4207 return; 4208 } 4209 4210 var target; 4211 var previous; 4212 var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0]; 4213 var selector = Util.getSelectorFromElement(this._element); 4214 4215 if (listElement) { 4216 var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE; 4217 previous = $.makeArray($(listElement).find(itemSelector)); 4218 previous = previous[previous.length - 1]; 4219 } 4220 4221 var hideEvent = $.Event(Event$9.HIDE, { 4222 relatedTarget: this._element 4223 }); 4224 var showEvent = $.Event(Event$9.SHOW, { 4225 relatedTarget: previous 4226 }); 4227 4228 if (previous) { 4229 $(previous).trigger(hideEvent); 4230 } 4231 4232 $(this._element).trigger(showEvent); 4233 4234 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { 4235 return; 4236 } 4237 4238 if (selector) { 4239 target = document.querySelector(selector); 4240 } 4241 4242 this._activate(this._element, listElement); 4243 4244 var complete = function complete() { 4245 var hiddenEvent = $.Event(Event$9.HIDDEN, { 4246 relatedTarget: _this._element 4247 }); 4248 var shownEvent = $.Event(Event$9.SHOWN, { 4249 relatedTarget: previous 4250 }); 4251 $(previous).trigger(hiddenEvent); 4252 $(_this._element).trigger(shownEvent); 4253 }; 4254 4255 if (target) { 4256 this._activate(target, target.parentNode, complete); 4257 } else { 4258 complete(); 4259 } 4260 }; 4261 4262 _proto.dispose = function dispose() { 4263 $.removeData(this._element, DATA_KEY$9); 4264 this._element = null; 4265 } // Private 4266 ; 4267 4268 _proto._activate = function _activate(element, container, callback) { 4269 var _this2 = this; 4270 4271 var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE); 4272 var active = activeElements[0]; 4273 var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE); 4274 4275 var complete = function complete() { 4276 return _this2._transitionComplete(element, active, callback); 4277 }; 4278 4279 if (active && isTransitioning) { 4280 var transitionDuration = Util.getTransitionDurationFromElement(active); 4281 $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 4282 } else { 4283 complete(); 4284 } 4285 }; 4286 4287 _proto._transitionComplete = function _transitionComplete(element, active, callback) { 4288 if (active) { 4289 $(active).removeClass(ClassName$9.ACTIVE);
4290 var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0]; 4291 4292 if (dropdownChild) { 4293 $(dropdownChild).removeClass(ClassName$9.ACTIVE); 4294 } 4295 4296 if (active.getAttribute('role') === 'tab') { 4297 active.setAttribute('aria-selected', false); 4298 } 4299 } 4300 4301 $(element).addClass(ClassName$9.ACTIVE); 4302 4303 if (element.getAttribute('role') === 'tab') { 4304 element.setAttribute('aria-selected', true); 4305 } 4306 4307 Util.reflow(element); 4308 4309 if (element.classList.contains(ClassName$9.FADE)) { 4310 element.classList.add(ClassName$9.SHOW); 4311 } 4312 4313 if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) { 4314 var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0]; 4315 4316 if (dropdownElement) { 4317 var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE)); 4318 $(dropdownToggleList).addClass(ClassName$9.ACTIVE); 4319 } 4320 4321 element.setAttribute('aria-expanded', true); 4322 } 4323 4324 if (callback) { 4325 callback(); 4326 } 4327 } // Static 4328 ; 4329 4330 Tab._jQueryInterface = function _jQueryInterface(config) { 4331 return this.each(function () { 4332 var $this = $(this); 4333 var data = $this.data(DATA_KEY$9); 4334 4335 if (!data) { 4336 data = new Tab(this); 4337 $this.data(DATA_KEY$9, data); 4338 } 4339 4340 if (typeof config === 'string') { 4341 if (typeof data[config] === 'undefined') { 4342 throw new TypeError("No method named \"" + config + "\""); 4343 } 4344 4345 data[config](); 4346 } 4347 }); 4348 }; 4349 4350 _createClass(Tab, null, [{ 4351 key: "VERSION", 4352 get: function get() { 4353 return VERSION$9; 4354 } 4355 }]); 4356 4357 return Tab; 4358 }(); 4359 /** 4360 * ------------------------------------------------------------------------ 4361 * Data Api implementation 4362 * ------------------------------------------------------------------------ 4363 */ 4364 4365 4366 $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) { 4367 event.preventDefault(); 4368 4369 Tab._jQueryInterface.call($(this), 'show'); 4370 }); 4371 /** 4372 * ------------------------------------------------------------------------ 4373 * jQuery 4374 * ------------------------------------------------------------------------ 4375 */ 4376 4377 $.fn[NAME$9] = Tab._jQueryInterface; 4378 $.fn[NAME$9].Constructor = Tab; 4379 4380 $.fn[NAME$9].noConflict = function () { 4381 $.fn[NAME$9] = JQUERY_NO_CONFLICT$9; 4382 return Tab._jQueryInterface; 4383 }; 4384 4385 /** 4386 * ------------------------------------------------------------------------ 4387 * Constants 4388 * ------------------------------------------------------------------------ 4389 */ 4390 4391 var NAME$a = 'toast'; 4392 var VERSION$a = '4.3.1'; 4393 var DATA_KEY$a = 'bs.toast'; 4394 var EVENT_KEY$a = "." + DATA_KEY$a; 4395 var JQUERY_NO_CONFLICT$a = $.fn[NAME$a]; 4396 var Event$a = { 4397 CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a, 4398 HIDE: "hide" + EVENT_KEY$a, 4399 HIDDEN: "hidden" + EVENT_KEY$a, 4400 SHOW: "show" + EVENT_KEY$a, 4401 SHOWN: "shown" + EVENT_KEY$a 4402 }; 4403 var ClassName$a = { 4404 FADE: 'fade', 4405 HIDE: 'hide', 4406 SHOW: 'show', 4407 SHOWING: 'showing' 4408 }; 4409 var DefaultType$7 = { 4410 animation: 'boolean', 4411 autohide: 'boolean', 4412 delay: 'number' 4413 }; 4414 var Default$7 = { 4415 animation: true, 4416 autohide: true, 4417 delay: 500 4418 }; 4419 var Selector$a = { 4420 DATA_DISMISS: '[data-dismiss="toast"]' 4421 /** 4422 * ------------------------------------------------------------------------ 4423 * Class Definition 4424 * ------------------------------------------------------------------------ 4425 */ 4426 4427 }; 4428 4429 var Toast = 4430 /*#__PURE__*/ 4431 function () { 4432 function Toast(element, config) { 4433 this._element = element; 4434 this._config = this._getConfig(config); 4435 this._timeout = null; 4436 4437 this._setListeners(); 4438 } // Getters 4439 4440 4441 var _proto = Toast.prototype; 4442 4443 // Public 4444 _proto.show = function show() { 4445 var _this = this; 4446 4447 $(this._element).trigger(Event$a.SHOW); 4448 4449 if (this._config.animation) { 4450 this._element.classList.add(ClassName$a.FADE); 4451 } 4452 4453 var complete = function complete() { 4454 _this._element.classList.remove(ClassName$a.SHOWING); 4455 4456 _this._element.classList.add(ClassName$a.SHOW); 4457 4458 $(_this._element).trigger(Event$a.SHOWN); 4459 4460 if (_this._config.autohide) { 4461 _this.hide(); 4462 } 4463 }; 4464 4465 this._element.classList.remove(ClassName$a.HIDE); 4466 4467 this._element.classList.add(ClassName$a.SHOWING); 4468 4469 if (this._config.animation) { 4470 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 4471 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 4472 } else { 4473 complete(); 4474 } 4475 }; 4476 4477 _proto.hide = function hide(withoutTimeout) { 4478 var _this2 = this; 4479 4480 if (!this._element.classList.contains(ClassName$a.SHOW)) { 4481 return; 4482 } 4483 4484 $(this._element).trigger(Event$a.HIDE); 4485 4486 if (withoutTimeout) { 4487 this._close(); 4488 } else { 4489 this._timeout = setTimeout(function () { 4490 _this2._close(); 4491 }, this._config.delay); 4492 } 4493 }; 4494 4495 _proto.dispose = function dispose() { 4496 clearTimeout(this._timeout); 4497 this._timeout = null; 4498 4499 if (this._element.classList.contains(ClassName$a.SHOW)) { 4500 this._element.classList.remove(ClassName$a.SHOW); 4501 } 4502 4503 $(this._element).off(Event$a.CLICK_DISMISS); 4504 $.removeData(this._element, DATA_KEY$a); 4505 this._element = null; 4506 this._config = null; 4507 } // Private 4508 ; 4509 4510 _proto._getConfig = function _getConfig(config) { 4511 config = _objectSpread({}, Default$7, $(this._element).data(), typeof config === 'object' && config ? config : {}); 4512 Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType); 4513 return config; 4514 }; 4515 4516 _proto._setListeners = function _setListeners() { 4517 var _this3 = this; 4518 4519 $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () { 4520 return _this3.hide(true); 4521 }); 4522 }; 4523 4524 _proto._close = function _close() { 4525 var _this4 = this; 4526 4527 var complete = function complete() { 4528 _this4._element.classList.add(ClassName$a.HIDE); 4529 4530 $(_this4._element).trigger(Event$a.HIDDEN); 4531 }; 4532 4533 this._element.classList.remove(ClassName$a.SHOW); 4534 4535 if (this._config.animation) { 4536 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 4537 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 4538 } else { 4539 complete(); 4540 } 4541 } // Static 4542 ; 4543 4544 Toast._jQueryInterface = function _jQueryInterface(config) { 4545 return this.each(function () { 4546 var $element = $(this); 4547 var data = $element.data(DATA_KEY$a); 4548 4549 var _config = typeof config === 'object' && config; 4550 4551 if (!data) { 4552 data = new Toast(this, _config); 4553 $element.data(DATA_KEY$a, data); 4554 } 4555 4556 if (typeof config === 'string') { 4557 if (typeof data[config] === 'undefined') {
4558 throw new TypeError("No method named \"" + config + "\""); 4559 } 4560 4561 data[config](this); 4562 } 4563 }); 4564 }; 4565 4566 _createClass(Toast, null, [{ 4567 key: "VERSION", 4568 get: function get() { 4569 return VERSION$a; 4570 } 4571 }, { 4572 key: "DefaultType", 4573 get: function get() { 4574 return DefaultType$7; 4575 } 4576 }, { 4577 key: "Default", 4578 get: function get() { 4579 return Default$7; 4580 } 4581 }]); 4582 4583 return Toast; 4584 }(); 4585 /** 4586 * ------------------------------------------------------------------------ 4587 * jQuery 4588 * ------------------------------------------------------------------------ 4589 */ 4590 4591 4592 $.fn[NAME$a] = Toast._jQueryInterface; 4593 $.fn[NAME$a].Constructor = Toast; 4594 4595 $.fn[NAME$a].noConflict = function () { 4596 $.fn[NAME$a] = JQUERY_NO_CONFLICT$a; 4597 return Toast._jQueryInterface; 4598 }; 4599 4600 /** 4601 * -------------------------------------------------------------------------- 4602 * Bootstrap (v4.3.1): index.js 4603 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 4604 * -------------------------------------------------------------------------- 4605 */ 4606 4607 (function () { 4608 if (typeof $ === 'undefined') { 4609 throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.'); 4610 } 4611 4612 var version = $.fn.jquery.split(' ')[0].split('.'); 4613 var minMajor = 1; 4614 var ltMajor = 2; 4615 var minMinor = 9; 4616 var minPatch = 1; 4617 var maxMajor = 4; 4618 4619 if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) { 4620 throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0'); 4621 } 4622 })(); 4623 4624 exports.Util = Util; 4625 exports.Alert = Alert; 4626 exports.Button = Button; 4627 exports.Carousel = Carousel; 4628 exports.Collapse = Collapse; 4629 exports.Dropdown = Dropdown; 4630 exports.Modal = Modal; 4631 exports.Popover = Popover; 4632 exports.Scrollspy = ScrollSpy; 4633 exports.Tab = Tab; 4634 exports.Toast = Toast; 4635 exports.Tooltip = Tooltip; 4636 4637 Object.defineProperty(exports, '__esModule', { value: true }); 4638 4639})); 4640//# sourceMappingURL=bootstrap.js.map 4641 4642 4643/***/ }), 4644/* 5 */ 4645/***/ (function(module, __webpack_exports__, __webpack_require__) { 4646 4647"use strict"; 4648Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); 4649/* WEBPACK VAR INJECTION */(function(global) {/**! 4650 * @fileOverview Kickass library to create and place poppers near their reference elements. 4651 * @version 1.15.0 4652 * @license 4653 * Copyright (c) 2016 Federico Zivolo and contributors 4654 * 4655 * Permission is hereby granted, free of charge, to any person obtaining a copy 4656 * of this software and associated documentation files (the "Software"), to deal 4657 * in the Software without restriction, including without limitation the rights 4658 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4659 * copies of the Software, and to permit persons to whom the Software is 4660 * furnished to do so, subject to the following conditions: 4661 * 4662 * The above copyright notice and this permission notice shall be included in all 4663 * copies or substantial portions of the Software. 4664 * 4665 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4666 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4667 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4668 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4669 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4670 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 4671 * SOFTWARE. 4672 */
vendor: 86,744 bytes, lines 4672-7250
4672 4673var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined'; 4674 4675var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; 4676var timeoutDuration = 0; 4677for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { 4678 if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { 4679 timeoutDuration = 1; 4680 break; 4681 } 4682} 4683 4684function microtaskDebounce(fn) { 4685 var called = false; 4686 return function () { 4687 if (called) { 4688 return; 4689 } 4690 called = true; 4691 window.Promise.resolve().then(function () { 4692 called = false; 4693 fn(); 4694 }); 4695 }; 4696} 4697 4698function taskDebounce(fn) { 4699 var scheduled = false; 4700 return function () { 4701 if (!scheduled) { 4702 scheduled = true; 4703 setTimeout(function () { 4704 scheduled = false; 4705 fn(); 4706 }, timeoutDuration); 4707 } 4708 }; 4709} 4710 4711var supportsMicroTasks = isBrowser && window.Promise; 4712 4713/** 4714* Create a debounced version of a method, that's asynchronously deferred 4715* but called in the minimum time possible. 4716* 4717* @method 4718* @memberof Popper.Utils 4719* @argument {Function} fn 4720* @returns {Function} 4721*/ 4722var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce; 4723 4724/** 4725 * Check if the given variable is a function 4726 * @method 4727 * @memberof Popper.Utils 4728 * @argument {Any} functionToCheck - variable to check 4729 * @returns {Boolean} answer to: is a function? 4730 */ 4731function isFunction(functionToCheck) { 4732 var getType = {}; 4733 return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; 4734} 4735 4736/** 4737 * Get CSS computed property of the given element 4738 * @method 4739 * @memberof Popper.Utils 4740 * @argument {Eement} element 4741 * @argument {String} property 4742 */ 4743function getStyleComputedProperty(element, property) { 4744 if (element.nodeType !== 1) { 4745 return []; 4746 } 4747 // NOTE: 1 DOM access here 4748 var window = element.ownerDocument.defaultView; 4749 var css = window.getComputedStyle(element, null); 4750 return property ? css[property] : css; 4751} 4752 4753/** 4754 * Returns the parentNode or the host of the element 4755 * @method 4756 * @memberof Popper.Utils 4757 * @argument {Element} element 4758 * @returns {Element} parent 4759 */ 4760function getParentNode(element) { 4761 if (element.nodeName === 'HTML') { 4762 return element; 4763 } 4764 return element.parentNode || element.host; 4765} 4766 4767/** 4768 * Returns the scrolling parent of the given element 4769 * @method 4770 * @memberof Popper.Utils 4771 * @argument {Element} element 4772 * @returns {Element} scroll parent 4773 */ 4774function getScrollParent(element) { 4775 // Return body, `getScroll` will take care to get the correct `scrollTop` from it 4776 if (!element) { 4777 return document.body; 4778 } 4779 4780 switch (element.nodeName) { 4781 case 'HTML': 4782 case 'BODY': 4783 return element.ownerDocument.body; 4784 case '#document': 4785 return element.body; 4786 } 4787 4788 // Firefox want us to check `-x` and `-y` variations as well 4789 4790 var _getStyleComputedProp = getStyleComputedProperty(element), 4791 overflow = _getStyleComputedProp.overflow, 4792 overflowX = _getStyleComputedProp.overflowX, 4793 overflowY = _getStyleComputedProp.overflowY; 4794 4795 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { 4796 return element; 4797 } 4798 4799 return getScrollParent(getParentNode(element)); 4800} 4801 4802var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode); 4803var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent); 4804 4805/** 4806 * Determines if the browser is Internet Explorer 4807 * @method 4808 * @memberof Popper.Utils 4809 * @param {Number} version to check 4810 * @returns {Boolean} isIE 4811 */ 4812function isIE(version) { 4813 if (version === 11) { 4814 return isIE11; 4815 } 4816 if (version === 10) { 4817 return isIE10; 4818 } 4819 return isIE11 || isIE10; 4820} 4821 4822/** 4823 * Returns the offset parent of the given element 4824 * @method 4825 * @memberof Popper.Utils 4826 * @argument {Element} element 4827 * @returns {Element} offset parent 4828 */ 4829function getOffsetParent(element) { 4830 if (!element) { 4831 return document.documentElement; 4832 } 4833 4834 var noOffsetParent = isIE(10) ? document.body : null; 4835 4836 // NOTE: 1 DOM access here 4837 var offsetParent = element.offsetParent || null; 4838 // Skip hidden elements which don't have an offsetParent 4839 while (offsetParent === noOffsetParent && element.nextElementSibling) { 4840 offsetParent = (element = element.nextElementSibling).offsetParent; 4841 } 4842 4843 var nodeName = offsetParent && offsetParent.nodeName; 4844 4845 if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { 4846 return element ? element.ownerDocument.documentElement : document.documentElement; 4847 } 4848 4849 // .offsetParent will return the closest TH, TD or TABLE in case 4850 // no offsetParent is present, I hate this job... 4851 if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { 4852 return getOffsetParent(offsetParent); 4853 } 4854 4855 return offsetParent; 4856} 4857 4858function isOffsetContainer(element) { 4859 var nodeName = element.nodeName; 4860 4861 if (nodeName === 'BODY') { 4862 return false; 4863 } 4864 return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; 4865} 4866 4867/** 4868 * Finds the root node (document, shadowDOM root) of the given element 4869 * @method 4870 * @memberof Popper.Utils 4871 * @argument {Element} node 4872 * @returns {Element} root node 4873 */ 4874function getRoot(node) { 4875 if (node.parentNode !== null) { 4876 return getRoot(node.parentNode); 4877 } 4878 4879 return node; 4880} 4881 4882/** 4883 * Finds the offset parent common to the two provided nodes 4884 * @method 4885 * @memberof Popper.Utils 4886 * @argument {Element} element1 4887 * @argument {Element} element2 4888 * @returns {Element} common offset parent 4889 */ 4890function findCommonOffsetParent(element1, element2) { 4891 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 4892 if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { 4893 return document.documentElement; 4894 } 4895 4896 // Here we make sure to give as "start" the element that comes first in the DOM 4897 var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; 4898 var start = order ? element1 : element2; 4899 var end = order ? element2 : element1; 4900 4901 // Get common ancestor container 4902 var range = document.createRange(); 4903 range.setStart(start, 0); 4904 range.setEnd(end, 0); 4905 var commonAncestorContainer = range.commonAncestorContainer; 4906 4907 // Both nodes are inside #document 4908 4909 if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { 4910 if (isOffsetContainer(commonAncestorContainer)) { 4911 return commonAncestorContainer; 4912 } 4913 4914 return getOffsetParent(commonAncestorContainer); 4915 } 4916 4917 // one of the nodes is inside shadowDOM, find which one 4918 var element1root = getRoot(element1); 4919 if (element1root.host) { 4920 return findCommonOffsetParent(element1root.host, element2); 4921 } else { 4922 return findCommonOffsetParent(element1, getRoot(element2).host); 4923 } 4924} 4925 4926/** 4927 * Gets the scroll value of the given element in the given side (top and left) 4928 * @method 4929 * @memberof Popper.Utils 4930 * @argument {Element} element 4931 * @argument {String} side `top` or `left` 4932 * @returns {number} amount of scrolled pixels 4933 */ 4934function getScroll(element) { 4935 var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; 4936 4937 var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; 4938 var nodeName = element.nodeName; 4939 4940 if (nodeName === 'BODY' || nodeName === 'HTML') { 4941 var html = element.ownerDocument.documentElement; 4942 var scrollingElement = element.ownerDocument.scrollingElement || html; 4943 return scrollingElement[upperSide]; 4944 } 4945 4946 return element[upperSide]; 4947} 4948 4949/* 4950 * Sum or subtract the element scroll values (left and top) from a given rect object 4951 * @method 4952 * @memberof Popper.Utils 4953 * @param {Object} rect - Rect object you want to change 4954 * @param {HTMLElement} element - The element from the function reads the scroll values 4955 * @param {Boolean} subtract - set to true if you want to subtract the scroll values 4956 * @return {Object} rect - The modifier rect object 4957 */ 4958function includeScroll(rect, element) { 4959 var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 4960 4961 var scrollTop = getScroll(element, 'top'); 4962 var scrollLeft = getScroll(element, 'left'); 4963 var modifier = subtract ? -1 : 1; 4964 rect.top += scrollTop * modifier; 4965 rect.bottom += scrollTop * modifier; 4966 rect.left += scrollLeft * modifier; 4967 rect.right += scrollLeft * modifier; 4968 return rect; 4969} 4970 4971/* 4972 * Helper to detect borders of a given element 4973 * @method 4974 * @memberof Popper.Utils 4975 * @param {CSSStyleDeclaration} styles 4976 * Result of `getStyleComputedProperty` on the given element 4977 * @param {String} axis - `x` or `y` 4978 * @return {number} borders - The borders size of the given axis 4979 */ 4980 4981function getBordersSize(styles, axis) { 4982 var sideA = axis === 'x' ? 'Left' : 'Top'; 4983 var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; 4984 4985 return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10); 4986} 4987 4988function getSize(axis, body, html, computedStyle) { 4989 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); 4990} 4991 4992function getWindowSizes(document) { 4993 var body = document.body; 4994 var html = document.documentElement; 4995 var computedStyle = isIE(10) && getComputedStyle(html); 4996 4997 return { 4998 height: getSize('Height', body, html, computedStyle), 4999 width: getSize('Width', body, html, computedStyle) 5000 }; 5001} 5002 5003var classCallCheck = function (instance, Constructor) { 5004 if (!(instance instanceof Constructor)) { 5005 throw new TypeError("Cannot call a class as a function"); 5006 } 5007}; 5008 5009var createClass = function () { 5010 function defineProperties(target, props) { 5011 for (var i = 0; i < props.length; i++) { 5012 var descriptor = props[i]; 5013 descriptor.enumerable = descriptor.enumerable || false; 5014 descriptor.configurable = true; 5015 if ("value" in descriptor) descriptor.writable = true; 5016 Object.defineProperty(target, descriptor.key, descriptor); 5017 } 5018 } 5019 5020 return function (Constructor, protoProps, staticProps) { 5021 if (protoProps) defineProperties(Constructor.prototype, protoProps); 5022 if (staticProps) defineProperties(Constructor, staticProps); 5023 return Constructor; 5024 }; 5025}(); 5026 5027 5028 5029 5030 5031var defineProperty = function (obj, key, value) { 5032 if (key in obj) { 5033 Object.defineProperty(obj, key, { 5034 value: value, 5035 enumerable: true, 5036 configurable: true, 5037 writable: true 5038 }); 5039 } else { 5040 obj[key] = value; 5041 } 5042 5043 return obj; 5044}; 5045 5046var _extends = Object.assign || function (target) { 5047 for (var i = 1; i < arguments.length; i++) { 5048 var source = arguments[i]; 5049 5050 for (var key in source) { 5051 if (Object.prototype.hasOwnProperty.call(source, key)) { 5052 target[key] = source[key]; 5053 } 5054 } 5055 } 5056 5057 return target; 5058}; 5059 5060/** 5061 * Given element offsets, generate an output similar to getBoundingClientRect 5062 * @method 5063 * @memberof Popper.Utils 5064 * @argument {Object} offsets 5065 * @returns {Object} ClientRect like output 5066 */ 5067function getClientRect(offsets) { 5068 return _extends({}, offsets, { 5069 right: offsets.left + offsets.width, 5070 bottom: offsets.top + offsets.height 5071 }); 5072} 5073 5074/** 5075 * Get bounding client rect of given element 5076 * @method 5077 * @memberof Popper.Utils 5078 * @param {HTMLElement} element 5079 * @return {Object} client rect 5080 */ 5081function getBoundingClientRect(element) { 5082 var rect = {}; 5083 5084 // IE10 10 FIX: Please, don't ask, the element isn't 5085 // considered in DOM in some circumstances... 5086 // This isn't reproducible in IE10 compatibility mode of IE11 5087 try { 5088 if (isIE(10)) { 5089 rect = element.getBoundingClientRect(); 5090 var scrollTop = getScroll(element, 'top'); 5091 var scrollLeft = getScroll(element, 'left'); 5092 rect.top += scrollTop; 5093 rect.left += scrollLeft; 5094 rect.bottom += scrollTop; 5095 rect.right += scrollLeft; 5096 } else { 5097 rect = element.getBoundingClientRect(); 5098 } 5099 } catch (e) {} 5100 5101 var result = { 5102 left: rect.left, 5103 top: rect.top, 5104 width: rect.right - rect.left, 5105 height: rect.bottom - rect.top 5106 }; 5107 5108 // subtract scrollbar size from sizes 5109 var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {}; 5110 var width = sizes.width || element.clientWidth || result.right - result.left; 5111 var height = sizes.height || element.clientHeight || result.bottom - result.top; 5112 5113 var horizScrollbar = element.offsetWidth - width; 5114 var vertScrollbar = element.offsetHeight - height; 5115 5116 // if an hypothetical scrollbar is detected, we must be sure it's not a `border` 5117 // we make this check conditional for performance reasons 5118 if (horizScrollbar || vertScrollbar) { 5119 var styles = getStyleComputedProperty(element); 5120 horizScrollbar -= getBordersSize(styles, 'x'); 5121 vertScrollbar -= getBordersSize(styles, 'y'); 5122 5123 result.width -= horizScrollbar; 5124 result.height -= vertScrollbar; 5125 } 5126 5127 return getClientRect(result); 5128} 5129 5130function getOffsetRectRelativeToArbitraryNode(children, parent) { 5131 var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 5132 5133 var isIE10 = isIE(10); 5134 var isHTML = parent.nodeName === 'HTML'; 5135 var childrenRect = getBoundingClientRect(children); 5136 var parentRect = getBoundingClientRect(parent); 5137 var scrollParent = getScrollParent(children); 5138 5139 var styles = getStyleComputedProperty(parent); 5140 var borderTopWidth = parseFloat(styles.borderTopWidth, 10); 5141 var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10); 5142 5143 // In cases where the parent is fixed, we must ignore negative scroll in offset calc 5144 if (fixedPosition && isHTML) { 5145 parentRect.top = Math.max(parentRect.top, 0); 5146 parentRect.left = Math.max(parentRect.left, 0); 5147 } 5148 var offsets = getClientRect({ 5149 top: childrenRect.top - parentRect.top - borderTopWidth, 5150 left: childrenRect.left - parentRect.left - borderLeftWidth, 5151 width: childrenRect.width, 5152 height: childrenRect.height 5153 }); 5154 offsets.marginTop = 0; 5155 offsets.marginLeft = 0; 5156 5157 // Subtract margins of documentElement in case it's being used as parent 5158 // we do this only on HTML because it's the only element that behaves 5159 // differently when margins are applied to it. The margins are included in 5160 // the box of the documentElement, in the other cases not. 5161 if (!isIE10 && isHTML) { 5162 var marginTop = parseFloat(styles.marginTop, 10); 5163 var marginLeft = parseFloat(styles.marginLeft, 10); 5164 5165 offsets.top -= borderTopWidth - marginTop; 5166 offsets.bottom -= borderTopWidth - marginTop; 5167 offsets.left -= borderLeftWidth - marginLeft; 5168 offsets.right -= borderLeftWidth - marginLeft; 5169 5170 // Attach marginTop and marginLeft because in some circumstances we may need them 5171 offsets.marginTop = marginTop; 5172 offsets.marginLeft = marginLeft; 5173 } 5174 5175 if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { 5176 offsets = includeScroll(offsets, parent); 5177 } 5178 5179 return offsets; 5180} 5181 5182function getViewportOffsetRectRelativeToArtbitraryNode(element) { 5183 var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 5184 5185 var html = element.ownerDocument.documentElement; 5186 var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); 5187 var width = Math.max(html.clientWidth, window.innerWidth || 0); 5188 var height = Math.max(html.clientHeight, window.innerHeight || 0); 5189 5190 var scrollTop = !excludeScroll ? getScroll(html) : 0; 5191 var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0; 5192 5193 var offset = { 5194 top: scrollTop - relativeOffset.top + relativeOffset.marginTop, 5195 left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, 5196 width: width, 5197 height: height 5198 }; 5199 5200 return getClientRect(offset); 5201} 5202 5203/** 5204 * Check if the given element is fixed or is inside a fixed parent 5205 * @method 5206 * @memberof Popper.Utils 5207 * @argument {Element} element 5208 * @argument {Element} customContainer 5209 * @returns {Boolean} answer to "isFixed?" 5210 */ 5211function isFixed(element) { 5212 var nodeName = element.nodeName; 5213 if (nodeName === 'BODY' || nodeName === 'HTML') { 5214 return false; 5215 } 5216 if (getStyleComputedProperty(element, 'position') === 'fixed') { 5217 return true; 5218 } 5219 var parentNode = getParentNode(element); 5220 if (!parentNode) { 5221 return false; 5222 } 5223 return isFixed(parentNode); 5224} 5225 5226/** 5227 * Finds the first parent of an element that has a transformed property defined 5228 * @method 5229 * @memberof Popper.Utils 5230 * @argument {Element} element 5231 * @returns {Element} first transformed parent or documentElement 5232 */ 5233 5234function getFixedPositionOffsetParent(element) { 5235 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 5236 if (!element || !element.parentElement || isIE()) { 5237 return document.documentElement; 5238 } 5239 var el = element.parentElement; 5240 while (el && getStyleComputedProperty(el, 'transform') === 'none') { 5241 el = el.parentElement; 5242 } 5243 return el || document.documentElement; 5244} 5245 5246/** 5247 * Computed the boundaries limits and return them 5248 * @method 5249 * @memberof Popper.Utils 5250 * @param {HTMLElement} popper 5251 * @param {HTMLElement} reference 5252 * @param {number} padding 5253 * @param {HTMLElement} boundariesElement - Element used to define the boundaries 5254 * @param {Boolean} fixedPosition - Is in fixed position mode 5255 * @returns {Object} Coordinates of the boundaries 5256 */ 5257function getBoundaries(popper, reference, padding, boundariesElement) { 5258 var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; 5259 5260 // NOTE: 1 DOM access here 5261 5262 var boundaries = { top: 0, left: 0 }; 5263 var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference); 5264 5265 // Handle viewport case 5266 if (boundariesElement === 'viewport') { 5267 boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition); 5268 } else { 5269 // Handle other cases based on DOM element used as boundaries 5270 var boundariesNode = void 0; 5271 if (boundariesElement === 'scrollParent') { 5272 boundariesNode = getScrollParent(getParentNode(reference)); 5273 if (boundariesNode.nodeName === 'BODY') { 5274 boundariesNode = popper.ownerDocument.documentElement; 5275 } 5276 } else if (boundariesElement === 'window') { 5277 boundariesNode = popper.ownerDocument.documentElement; 5278 } else { 5279 boundariesNode = boundariesElement; 5280 } 5281 5282 var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); 5283 5284 // In case of HTML, we need a different computation 5285 if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { 5286 var _getWindowSizes = getWindowSizes(popper.ownerDocument), 5287 height = _getWindowSizes.height, 5288 width = _getWindowSizes.width; 5289 5290 boundaries.top += offsets.top - offsets.marginTop; 5291 boundaries.bottom = height + offsets.top; 5292 boundaries.left += offsets.left - offsets.marginLeft; 5293 boundaries.right = width + offsets.left; 5294 } else { 5295 // for all the other DOM elements, this one is good 5296 boundaries = offsets; 5297 } 5298 } 5299 5300 // Add paddings 5301 padding = padding || 0; 5302 var isPaddingNumber = typeof padding === 'number'; 5303 boundaries.left += isPaddingNumber ? padding : padding.left || 0; 5304 boundaries.top += isPaddingNumber ? padding : padding.top || 0; 5305 boundaries.right -= isPaddingNumber ? padding : padding.right || 0; 5306 boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; 5307 5308 return boundaries; 5309} 5310 5311function getArea(_ref) { 5312 var width = _ref.width, 5313 height = _ref.height; 5314 5315 return width * height; 5316} 5317 5318/** 5319 * Utility used to transform the `auto` placement to the placement with more 5320 * available space. 5321 * @method 5322 * @memberof Popper.Utils 5323 * @argument {Object} data - The data object generated by update method 5324 * @argument {Object} options - Modifiers configuration and options 5325 * @returns {Object} The data object, properly modified 5326 */ 5327function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { 5328 var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; 5329 5330 if (placement.indexOf('auto') === -1) { 5331 return placement; 5332 } 5333 5334 var boundaries = getBoundaries(popper, reference, padding, boundariesElement); 5335 5336 var rects = { 5337 top: { 5338 width: boundaries.width, 5339 height: refRect.top - boundaries.top 5340 }, 5341 right: { 5342 width: boundaries.right - refRect.right, 5343 height: boundaries.height 5344 }, 5345 bottom: { 5346 width: boundaries.width, 5347 height: boundaries.bottom - refRect.bottom 5348 }, 5349 left: { 5350 width: refRect.left - boundaries.left, 5351 height: boundaries.height 5352 } 5353 }; 5354 5355 var sortedAreas = Object.keys(rects).map(function (key) { 5356 return _extends({ 5357 key: key 5358 }, rects[key], { 5359 area: getArea(rects[key]) 5360 }); 5361 }).sort(function (a, b) { 5362 return b.area - a.area; 5363 }); 5364 5365 var filteredAreas = sortedAreas.filter(function (_ref2) { 5366 var width = _ref2.width, 5367 height = _ref2.height; 5368 return width >= popper.clientWidth && height >= popper.clientHeight; 5369 }); 5370 5371 var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; 5372 5373 var variation = placement.split('-')[1]; 5374 5375 return computedPlacement + (variation ? '-' + variation : ''); 5376} 5377 5378/** 5379 * Get offsets to the reference element 5380 * @method 5381 * @memberof Popper.Utils 5382 * @param {Object} state 5383 * @param {Element} popper - the popper element 5384 * @param {Element} reference - the reference element (the popper will be relative to this) 5385 * @param {Element} fixedPosition - is in fixed position mode 5386 * @returns {Object} An object containing the offsets which will be applied to the popper 5387 */ 5388function getReferenceOffsets(state, popper, reference) { 5389 var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 5390 5391 var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference); 5392 return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition); 5393} 5394 5395/** 5396 * Get the outer sizes of the given element (offset size + margins) 5397 * @method 5398 * @memberof Popper.Utils 5399 * @argument {Element} element 5400 * @returns {Object} object containing width and height properties 5401 */ 5402function getOuterSizes(element) { 5403 var window = element.ownerDocument.defaultView; 5404 var styles = window.getComputedStyle(element); 5405 var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0); 5406 var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0); 5407 var result = { 5408 width: element.offsetWidth + y, 5409 height: element.offsetHeight + x 5410 }; 5411 return result; 5412} 5413 5414/** 5415 * Get the opposite placement of the given one 5416 * @method 5417 * @memberof Popper.Utils 5418 * @argument {String} placement 5419 * @returns {String} flipped placement 5420 */ 5421function getOppositePlacement(placement) { 5422 var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; 5423 return placement.replace(/left|right|bottom|top/g, function (matched) { 5424 return hash[matched]; 5425 }); 5426} 5427 5428/** 5429 * Get offsets to the popper 5430 * @method 5431 * @memberof Popper.Utils 5432 * @param {Object} position - CSS position the Popper will get applied 5433 * @param {HTMLElement} popper - the popper element 5434 * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) 5435 * @param {String} placement - one of the valid placement options 5436 * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper 5437 */ 5438function getPopperOffsets(popper, referenceOffsets, placement) { 5439 placement = placement.split('-')[0]; 5440 5441 // Get popper node sizes 5442 var popperRect = getOuterSizes(popper); 5443 5444 // Add position, width and height to our offsets object 5445 var popperOffsets = { 5446 width: popperRect.width, 5447 height: popperRect.height 5448 }; 5449 5450 // depending by the popper placement we have to compute its offsets slightly differently 5451 var isHoriz = ['right', 'left'].indexOf(placement) !== -1; 5452 var mainSide = isHoriz ? 'top' : 'left'; 5453 var secondarySide = isHoriz ? 'left' : 'top'; 5454 var measurement = isHoriz ? 'height' : 'width'; 5455 var secondaryMeasurement = !isHoriz ? 'height' : 'width'; 5456 5457 popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; 5458 if (placement === secondarySide) { 5459 popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; 5460 } else { 5461 popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; 5462 } 5463 5464 return popperOffsets; 5465} 5466 5467/** 5468 * Mimics the `find` method of Array 5469 * @method 5470 * @memberof Popper.Utils 5471 * @argument {Array} arr 5472 * @argument prop 5473 * @argument value 5474 * @returns index or -1 5475 */ 5476function find(arr, check) { 5477 // use native find if supported 5478 if (Array.prototype.find) { 5479 return arr.find(check); 5480 } 5481 5482 // use `filter` to obtain the same behavior of `find` 5483 return arr.filter(check)[0]; 5484} 5485 5486/** 5487 * Return the index of the matching object 5488 * @method 5489 * @memberof Popper.Utils 5490 * @argument {Array} arr 5491 * @argument prop 5492 * @argument value 5493 * @returns index or -1 5494 */ 5495function findIndex(arr, prop, value) { 5496 // use native findIndex if supported 5497 if (Array.prototype.findIndex) { 5498 return arr.findIndex(function (cur) { 5499 return cur[prop] === value; 5500 }); 5501 } 5502 5503 // use `find` + `indexOf` if `findIndex` isn't supported 5504 var match = find(arr, function (obj) { 5505 return obj[prop] === value; 5506 }); 5507 return arr.indexOf(match); 5508} 5509 5510/** 5511 * Loop trough the list of modifiers and run them in order, 5512 * each of them will then edit the data object. 5513 * @method 5514 * @memberof Popper.Utils 5515 * @param {dataObject} data 5516 * @param {Array} modifiers 5517 * @param {String} ends - Optional modifier name used as stopper 5518 * @returns {dataObject} 5519 */ 5520function runModifiers(modifiers, data, ends) { 5521 var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); 5522 5523 modifiersToRun.forEach(function (modifier) { 5524 if (modifier['function']) { 5525 // eslint-disable-line dot-notation 5526 console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); 5527 } 5528 var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation 5529 if (modifier.enabled && isFunction(fn)) { 5530 // Add properties to offsets to make them a complete clientRect object 5531 // we do this before each modifier to make sure the previous one doesn't 5532 // mess with these values 5533 data.offsets.popper = getClientRect(data.offsets.popper); 5534 data.offsets.reference = getClientRect(data.offsets.reference); 5535 5536 data = fn(data, modifier); 5537 } 5538 }); 5539 5540 return data; 5541} 5542 5543/** 5544 * Updates the position of the popper, computing the new offsets and applying 5545 * the new style.<br /> 5546 * Prefer `scheduleUpdate` over `update` because of performance reasons. 5547 * @method 5548 * @memberof Popper 5549 */ 5550function update() { 5551 // if popper is destroyed, don't perform any further update 5552 if (this.state.isDestroyed) { 5553 return; 5554 } 5555 5556 var data = { 5557 instance: this, 5558 styles: {}, 5559 arrowStyles: {}, 5560 attributes: {}, 5561 flipped: false, 5562 offsets: {} 5563 }; 5564 5565 // compute reference element offsets 5566 data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); 5567 5568 // compute auto placement, store placement inside the data object, 5569 // modifiers will be able to edit `placement` if needed 5570 // and refer to originalPlacement to know the original value 5571 data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); 5572 5573 // store the computed placement inside `originalPlacement` 5574 data.originalPlacement = data.placement; 5575 5576 data.positionFixed = this.options.positionFixed; 5577 5578 // compute the popper offsets 5579 data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); 5580 5581 data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; 5582 5583 // run the modifiers 5584 data = runModifiers(this.modifiers, data); 5585 5586 // the first `update` will call `onCreate` callback 5587 // the other ones will call `onUpdate` callback 5588 if (!this.state.isCreated) { 5589 this.state.isCreated = true; 5590 this.options.onCreate(data); 5591 } else { 5592 this.options.onUpdate(data); 5593 } 5594} 5595 5596/** 5597 * Helper used to know if the given modifier is enabled. 5598 * @method 5599 * @memberof Popper.Utils 5600 * @returns {Boolean} 5601 */ 5602function isModifierEnabled(modifiers, modifierName) { 5603 return modifiers.some(function (_ref) { 5604 var name = _ref.name, 5605 enabled = _ref.enabled; 5606 return enabled && name === modifierName; 5607 }); 5608} 5609 5610/** 5611 * Get the prefixed supported property name 5612 * @method 5613 * @memberof Popper.Utils 5614 * @argument {String} property (camelCase) 5615 * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) 5616 */ 5617function getSupportedPropertyName(property) { 5618 var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; 5619 var upperProp = property.charAt(0).toUpperCase() + property.slice(1); 5620 5621 for (var i = 0; i < prefixes.length; i++) { 5622 var prefix = prefixes[i]; 5623 var toCheck = prefix ? '' + prefix + upperProp : property; 5624 if (typeof document.body.style[toCheck] !== 'undefined') { 5625 return toCheck; 5626 } 5627 } 5628 return null; 5629} 5630 5631/** 5632 * Destroys the popper. 5633 * @method 5634 * @memberof Popper 5635 */ 5636function destroy() { 5637 this.state.isDestroyed = true; 5638 5639 // touch DOM only if `applyStyle` modifier is enabled 5640 if (isModifierEnabled(this.modifiers, 'applyStyle')) { 5641 this.popper.removeAttribute('x-placement'); 5642 this.popper.style.position = ''; 5643 this.popper.style.top = ''; 5644 this.popper.style.left = ''; 5645 this.popper.style.right = ''; 5646 this.popper.style.bottom = ''; 5647 this.popper.style.willChange = ''; 5648 this.popper.style[getSupportedPropertyName('transform')] = ''; 5649 } 5650 5651 this.disableEventListeners(); 5652 5653 // remove the popper if user explicity asked for the deletion on destroy 5654 // do not use `remove` because IE11 doesn't support it 5655 if (this.options.removeOnDestroy) { 5656 this.popper.parentNode.removeChild(this.popper); 5657 } 5658 return this; 5659} 5660 5661/** 5662 * Get the window associated with the element 5663 * @argument {Element} element 5664 * @returns {Window} 5665 */ 5666function getWindow(element) { 5667 var ownerDocument = element.ownerDocument; 5668 return ownerDocument ? ownerDocument.defaultView : window; 5669} 5670 5671function attachToScrollParents(scrollParent, event, callback, scrollParents) { 5672 var isBody = scrollParent.nodeName === 'BODY'; 5673 var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; 5674 target.addEventListener(event, callback, { passive: true }); 5675 5676 if (!isBody) { 5677 attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); 5678 } 5679 scrollParents.push(target); 5680} 5681 5682/** 5683 * Setup needed event listeners used to update the popper position 5684 * @method 5685 * @memberof Popper.Utils 5686 * @private 5687 */ 5688function setupEventListeners(reference, options, state, updateBound) { 5689 // Resize event listener on window 5690 state.updateBound = updateBound; 5691 getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); 5692 5693 // Scroll event listener on scroll parents 5694 var scrollElement = getScrollParent(reference); 5695 attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); 5696 state.scrollElement = scrollElement; 5697 state.eventsEnabled = true; 5698 5699 return state; 5700} 5701 5702/** 5703 * It will add resize/scroll events and start recalculating 5704 * position of the popper element when they are triggered. 5705 * @method 5706 * @memberof Popper 5707 */ 5708function enableEventListeners() { 5709 if (!this.state.eventsEnabled) { 5710 this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); 5711 } 5712} 5713 5714/** 5715 * Remove event listeners used to update the popper position 5716 * @method 5717 * @memberof Popper.Utils 5718 * @private 5719 */ 5720function removeEventListeners(reference, state) { 5721 // Remove resize event listener on window 5722 getWindow(reference).removeEventListener('resize', state.updateBound); 5723 5724 // Remove scroll event listener on scroll parents 5725 state.scrollParents.forEach(function (target) { 5726 target.removeEventListener('scroll', state.updateBound); 5727 }); 5728 5729 // Reset state 5730 state.updateBound = null; 5731 state.scrollParents = []; 5732 state.scrollElement = null; 5733 state.eventsEnabled = false; 5734 return state; 5735} 5736 5737/** 5738 * It will remove resize/scroll events and won't recalculate popper position 5739 * when they are triggered. It also won't trigger `onUpdate` callback anymore, 5740 * unless you call `update` method manually. 5741 * @method 5742 * @memberof Popper 5743 */ 5744function disableEventListeners() { 5745 if (this.state.eventsEnabled) { 5746 cancelAnimationFrame(this.scheduleUpdate); 5747 this.state = removeEventListeners(this.reference, this.state); 5748 } 5749} 5750 5751/** 5752 * Tells if a given input is a number 5753 * @method 5754 * @memberof Popper.Utils 5755 * @param {*} input to check 5756 * @return {Boolean} 5757 */ 5758function isNumeric(n) { 5759 return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); 5760} 5761 5762/** 5763 * Set the style to the given popper 5764 * @method 5765 * @memberof Popper.Utils 5766 * @argument {Element} element - Element to apply the style to 5767 * @argument {Object} styles 5768 * Object with a list of properties and values which will be applied to the element 5769 */ 5770function setStyles(element, styles) { 5771 Object.keys(styles).forEach(function (prop) { 5772 var unit = ''; 5773 // add unit if the value is numeric and is one of the following 5774 if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { 5775 unit = 'px'; 5776 } 5777 element.style[prop] = styles[prop] + unit; 5778 }); 5779} 5780 5781/** 5782 * Set the attributes to the given popper 5783 * @method 5784 * @memberof Popper.Utils 5785 * @argument {Element} element - Element to apply the attributes to 5786 * @argument {Object} styles 5787 * Object with a list of properties and values which will be applied to the element 5788 */ 5789function setAttributes(element, attributes) { 5790 Object.keys(attributes).forEach(function (prop) { 5791 var value = attributes[prop]; 5792 if (value !== false) { 5793 element.setAttribute(prop, attributes[prop]); 5794 } else { 5795 element.removeAttribute(prop); 5796 } 5797 }); 5798} 5799 5800/** 5801 * @function 5802 * @memberof Modifiers 5803 * @argument {Object} data - The data object generated by `update` method 5804 * @argument {Object} data.styles - List of style properties - values to apply to popper element 5805 * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element 5806 * @argument {Object} options - Modifiers configuration and options 5807 * @returns {Object} The same data object 5808 */ 5809function applyStyle(data) { 5810 // any property present in `data.styles` will be applied to the popper, 5811 // in this way we can make the 3rd party modifiers add custom styles to it 5812 // Be aware, modifiers could override the properties defined in the previous 5813 // lines of this modifier! 5814 setStyles(data.instance.popper, data.styles); 5815 5816 // any property present in `data.attributes` will be applied to the popper, 5817 // they will be set as HTML attributes of the element 5818 setAttributes(data.instance.popper, data.attributes); 5819 5820 // if arrowElement is defined and arrowStyles has some properties 5821 if (data.arrowElement && Object.keys(data.arrowStyles).length) { 5822 setStyles(data.arrowElement, data.arrowStyles); 5823 } 5824 5825 return data; 5826} 5827 5828/** 5829 * Set the x-placement attribute before everything else because it could be used 5830 * to add margins to the popper margins needs to be calculated to get the 5831 * correct popper offsets. 5832 * @method 5833 * @memberof Popper.modifiers 5834 * @param {HTMLElement} reference - The reference element used to position the popper 5835 * @param {HTMLElement} popper - The HTML element used as popper 5836 * @param {Object} options - Popper.js options 5837 */ 5838function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { 5839 // compute reference element offsets 5840 var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed); 5841 5842 // compute auto placement, store placement inside the data object, 5843 // modifiers will be able to edit `placement` if needed 5844 // and refer to originalPlacement to know the original value 5845 var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); 5846 5847 popper.setAttribute('x-placement', placement); 5848 5849 // Apply `position` to popper before anything else because 5850 // without the position applied we can't guarantee correct computations 5851 setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' }); 5852 5853 return options; 5854} 5855 5856/** 5857 * @function 5858 * @memberof Popper.Utils 5859 * @argument {Object} data - The data object generated by `update` method 5860 * @argument {Boolean} shouldRound - If the offsets should be rounded at all 5861 * @returns {Object} The popper's position offsets rounded 5862 * 5863 * The tale of pixel-perfect positioning. It's still not 100% perfect, but as 5864 * good as it can be within reason. 5865 * Discussion here: https://github.com/FezVrasta/popper.js/pull/715 5866 * 5867 * Low DPI screens cause a popper to be blurry if not using full pixels (Safari 5868 * as well on High DPI screens). 5869 * 5870 * Firefox prefers no rounding for positioning and does not have blurriness on 5871 * high DPI screens. 5872 * 5873 * Only horizontal placement and left/right values need to be considered. 5874 */ 5875function getRoundedOffsets(data, shouldRound) { 5876 var _data$offsets = data.offsets, 5877 popper = _data$offsets.popper, 5878 reference = _data$offsets.reference; 5879 var round = Math.round, 5880 floor = Math.floor; 5881 5882 var noRound = function noRound(v) { 5883 return v; 5884 }; 5885 5886 var referenceWidth = round(reference.width); 5887 var popperWidth = round(popper.width); 5888 5889 var isVertical = ['left', 'right'].indexOf(data.placement) !== -1; 5890 var isVariation = data.placement.indexOf('-') !== -1; 5891 var sameWidthParity = referenceWidth % 2 === popperWidth % 2; 5892 var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1; 5893 5894 var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor; 5895 var verticalToInteger = !shouldRound ? noRound : round; 5896 5897 return { 5898 left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left), 5899 top: verticalToInteger(popper.top), 5900 bottom: verticalToInteger(popper.bottom), 5901 right: horizontalToInteger(popper.right) 5902 }; 5903} 5904 5905var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent); 5906 5907/** 5908 * @function 5909 * @memberof Modifiers 5910 * @argument {Object} data - The data object generated by `update` method 5911 * @argument {Object} options - Modifiers configuration and options 5912 * @returns {Object} The data object, properly modified 5913 */ 5914function computeStyle(data, options) { 5915 var x = options.x, 5916 y = options.y; 5917 var popper = data.offsets.popper; 5918 5919 // Remove this legacy support in Popper.js v2 5920 5921 var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { 5922 return modifier.name === 'applyStyle'; 5923 }).gpuAcceleration; 5924 if (legacyGpuAccelerationOption !== undefined) { 5925 console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); 5926 } 5927 var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; 5928 5929 var offsetParent = getOffsetParent(data.instance.popper); 5930 var offsetParentRect = getBoundingClientRect(offsetParent); 5931 5932 // Styles 5933 var styles = { 5934 position: popper.position 5935 }; 5936 5937 var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox); 5938 5939 var sideA = x === 'bottom' ? 'top' : 'bottom'; 5940 var sideB = y === 'right' ? 'left' : 'right'; 5941 5942 // if gpuAcceleration is set to `true` and transform is supported, 5943 // we use `translate3d` to apply the position to the popper we 5944 // automatically use the supported prefixed version if needed 5945 var prefixedProperty = getSupportedPropertyName('transform'); 5946 5947 // now, let's make a step back and look at this code closely (wtf?) 5948 // If the content of the popper grows once it's been positioned, it 5949 // may happen that the popper gets misplaced because of the new content 5950 // overflowing its reference element 5951 // To avoid this problem, we provide two options (x and y), which allow 5952 // the consumer to define the offset origin. 5953 // If we position a popper on top of a reference element, we can set 5954 // `x` to `top` to make the popper grow towards its top instead of 5955 // its bottom. 5956 var left = void 0, 5957 top = void 0; 5958 if (sideA === 'bottom') { 5959 // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar) 5960 // and not the bottom of the html element 5961 if (offsetParent.nodeName === 'HTML') { 5962 top = -offsetParent.clientHeight + offsets.bottom; 5963 } else { 5964 top = -offsetParentRect.height + offsets.bottom; 5965 } 5966 } else { 5967 top = offsets.top; 5968 } 5969 if (sideB === 'right') { 5970 if (offsetParent.nodeName === 'HTML') { 5971 left = -offsetParent.clientWidth + offsets.right; 5972 } else { 5973 left = -offsetParentRect.width + offsets.right; 5974 } 5975 } else { 5976 left = offsets.left; 5977 } 5978 if (gpuAcceleration && prefixedProperty) { 5979 styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; 5980 styles[sideA] = 0; 5981 styles[sideB] = 0; 5982 styles.willChange = 'transform'; 5983 } else { 5984 // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties 5985 var invertTop = sideA === 'bottom' ? -1 : 1; 5986 var invertLeft = sideB === 'right' ? -1 : 1; 5987 styles[sideA] = top * invertTop; 5988 styles[sideB] = left * invertLeft; 5989 styles.willChange = sideA + ', ' + sideB; 5990 } 5991 5992 // Attributes 5993 var attributes = { 5994 'x-placement': data.placement 5995 }; 5996 5997 // Update `data` attributes, styles and arrowStyles 5998 data.attributes = _extends({}, attributes, data.attributes); 5999 data.styles = _extends({}, styles, data.styles); 6000 data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); 6001 6002 return data; 6003} 6004 6005/** 6006 * Helper used to know if the given modifier depends from another one.<br /> 6007 * It checks if the needed modifier is listed and enabled. 6008 * @method 6009 * @memberof Popper.Utils 6010 * @param {Array} modifiers - list of modifiers 6011 * @param {String} requestingName - name of requesting modifier 6012 * @param {String} requestedName - name of requested modifier 6013 * @returns {Boolean} 6014 */ 6015function isModifierRequired(modifiers, requestingName, requestedName) { 6016 var requesting = find(modifiers, function (_ref) { 6017 var name = _ref.name; 6018 return name === requestingName; 6019 }); 6020 6021 var isRequired = !!requesting && modifiers.some(function (modifier) { 6022 return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; 6023 }); 6024 6025 if (!isRequired) { 6026 var _requesting = '`' + requestingName + '`'; 6027 var requested = '`' + requestedName + '`'; 6028 console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); 6029 } 6030 return isRequired; 6031} 6032 6033/** 6034 * @function 6035 * @memberof Modifiers 6036 * @argument {Object} data - The data object generated by update method 6037 * @argument {Object} options - Modifiers configuration and options 6038 * @returns {Object} The data object, properly modified 6039 */ 6040function arrow(data, options) { 6041 var _data$offsets$arrow; 6042 6043 // arrow depends on keepTogether in order to work 6044 if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { 6045 return data; 6046 } 6047 6048 var arrowElement = options.element; 6049 6050 // if arrowElement is a string, suppose it's a CSS selector 6051 if (typeof arrowElement === 'string') { 6052 arrowElement = data.instance.popper.querySelector(arrowElement); 6053 6054 // if arrowElement is not found, don't run the modifier 6055 if (!arrowElement) { 6056 return data; 6057 } 6058 } else { 6059 // if the arrowElement isn't a query selector we must check that the 6060 // provided DOM node is child of its popper node 6061 if (!data.instance.popper.contains(arrowElement)) { 6062 console.warn('WARNING: `arrow.element` must be child of its popper element!'); 6063 return data; 6064 } 6065 } 6066 6067 var placement = data.placement.split('-')[0]; 6068 var _data$offsets = data.offsets, 6069 popper = _data$offsets.popper, 6070 reference = _data$offsets.reference; 6071 6072 var isVertical = ['left', 'right'].indexOf(placement) !== -1; 6073 6074 var len = isVertical ? 'height' : 'width'; 6075 var sideCapitalized = isVertical ? 'Top' : 'Left'; 6076 var side = sideCapitalized.toLowerCase(); 6077 var altSide = isVertical ? 'left' : 'top'; 6078 var opSide = isVertical ? 'bottom' : 'right'; 6079 var arrowElementSize = getOuterSizes(arrowElement)[len]; 6080 6081 // 6082 // extends keepTogether behavior making sure the popper and its 6083 // reference have enough pixels in conjunction 6084 // 6085 6086 // top/left side 6087 if (reference[opSide] - arrowElementSize < popper[side]) { 6088 data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); 6089 } 6090 // bottom/right side 6091 if (reference[side] + arrowElementSize > popper[opSide]) { 6092 data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; 6093 } 6094 data.offsets.popper = getClientRect(data.offsets.popper); 6095 6096 // compute center of the popper 6097 var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; 6098 6099 // Compute the sideValue using the updated popper offsets 6100 // take popper margin in account because we don't have this info available 6101 var css = getStyleComputedProperty(data.instance.popper); 6102 var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10); 6103 var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10); 6104 var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; 6105 6106 // prevent arrowElement from being placed not contiguously to its popper 6107 sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); 6108 6109 data.arrowElement = arrowElement; 6110 data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow); 6111 6112 return data; 6113} 6114 6115/** 6116 * Get the opposite placement variation of the given one 6117 * @method 6118 * @memberof Popper.Utils 6119 * @argument {String} placement variation 6120 * @returns {String} flipped placement variation 6121 */ 6122function getOppositeVariation(variation) { 6123 if (variation === 'end') { 6124 return 'start'; 6125 } else if (variation === 'start') { 6126 return 'end'; 6127 } 6128 return variation; 6129} 6130 6131/** 6132 * List of accepted placements to use as values of the `placement` option.<br /> 6133 * Valid placements are: 6134 * - `auto` 6135 * - `top` 6136 * - `right` 6137 * - `bottom` 6138 * - `left` 6139 * 6140 * Each placement can have a variation from this list: 6141 * - `-start` 6142 * - `-end` 6143 * 6144 * Variations are interpreted easily if you think of them as the left to right 6145 * written languages. Horizontally (`top` and `bottom`), `start` is left and `end` 6146 * is right.<br /> 6147 * Vertically (`left` and `right`), `start` is top and `end` is bottom. 6148 * 6149 * Some valid examples are: 6150 * - `top-end` (on top of reference, right aligned) 6151 * - `right-start` (on right of reference, top aligned) 6152 * - `bottom` (on bottom, centered) 6153 * - `auto-end` (on the side with more space available, alignment depends by placement) 6154 * 6155 * @static 6156 * @type {Array} 6157 * @enum {String} 6158 * @readonly 6159 * @method placements 6160 * @memberof Popper 6161 */ 6162var 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']; 6163 6164// Get rid of `auto` `auto-start` and `auto-end` 6165var validPlacements = placements.slice(3); 6166 6167/** 6168 * Given an initial placement, returns all the subsequent placements 6169 * clockwise (or counter-clockwise). 6170 * 6171 * @method 6172 * @memberof Popper.Utils 6173 * @argument {String} placement - A valid placement (it accepts variations) 6174 * @argument {Boolean} counter - Set to true to walk the placements counterclockwise 6175 * @returns {Array} placements including their variations 6176 */ 6177function clockwise(placement) { 6178 var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 6179 6180 var index = validPlacements.indexOf(placement); 6181 var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); 6182 return counter ? arr.reverse() : arr; 6183} 6184 6185var BEHAVIORS = { 6186 FLIP: 'flip', 6187 CLOCKWISE: 'clockwise', 6188 COUNTERCLOCKWISE: 'counterclockwise' 6189}; 6190 6191/** 6192 * @function 6193 * @memberof Modifiers 6194 * @argument {Object} data - The data object generated by update method 6195 * @argument {Object} options - Modifiers configuration and options 6196 * @returns {Object} The data object, properly modified 6197 */ 6198function flip(data, options) { 6199 // if `inner` modifier is enabled, we can't use the `flip` modifier 6200 if (isModifierEnabled(data.instance.modifiers, 'inner')) { 6201 return data; 6202 } 6203 6204 if (data.flipped && data.placement === data.originalPlacement) { 6205 // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides 6206 return data; 6207 } 6208 6209 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed); 6210 6211 var placement = data.placement.split('-')[0]; 6212 var placementOpposite = getOppositePlacement(placement); 6213 var variation = data.placement.split('-')[1] || ''; 6214 6215 var flipOrder = []; 6216 6217 switch (options.behavior) { 6218 case BEHAVIORS.FLIP: 6219 flipOrder = [placement, placementOpposite]; 6220 break; 6221 case BEHAVIORS.CLOCKWISE: 6222 flipOrder = clockwise(placement); 6223 break; 6224 case BEHAVIORS.COUNTERCLOCKWISE: 6225 flipOrder = clockwise(placement, true); 6226 break; 6227 default: 6228 flipOrder = options.behavior; 6229 } 6230 6231 flipOrder.forEach(function (step, index) { 6232 if (placement !== step || flipOrder.length === index + 1) { 6233 return data; 6234 } 6235 6236 placement = data.placement.split('-')[0]; 6237 placementOpposite = getOppositePlacement(placement); 6238 6239 var popperOffsets = data.offsets.popper; 6240 var refOffsets = data.offsets.reference; 6241 6242 // using floor because the reference offsets may contain decimals we are not going to consider here 6243 var floor = Math.floor; 6244 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); 6245 6246 var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); 6247 var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); 6248 var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); 6249 var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); 6250 6251 var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; 6252 6253 // flip the variation if required 6254 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 6255 6256 // flips variation if reference element overflows boundaries 6257 var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom); 6258 6259 // flips variation if popper content overflows boundaries 6260 var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop); 6261 6262 var flippedVariation = flippedVariationByRef || flippedVariationByContent; 6263 6264 if (overlapsRef || overflowsBoundaries || flippedVariation) { 6265 // this boolean to detect any flip loop 6266 data.flipped = true; 6267 6268 if (overlapsRef || overflowsBoundaries) { 6269 placement = flipOrder[index + 1]; 6270 } 6271 6272 if (flippedVariation) { 6273 variation = getOppositeVariation(variation); 6274 } 6275 6276 data.placement = placement + (variation ? '-' + variation : ''); 6277 6278 // this object contains `position`, we want to preserve it along with 6279 // any additional property we may add in the future 6280 data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); 6281 6282 data = runModifiers(data.instance.modifiers, data, 'flip'); 6283 } 6284 }); 6285 return data; 6286} 6287 6288/** 6289 * @function 6290 * @memberof Modifiers 6291 * @argument {Object} data - The data object generated by update method 6292 * @argument {Object} options - Modifiers configuration and options 6293 * @returns {Object} The data object, properly modified 6294 */ 6295function keepTogether(data) { 6296 var _data$offsets = data.offsets, 6297 popper = _data$offsets.popper, 6298 reference = _data$offsets.reference; 6299 6300 var placement = data.placement.split('-')[0]; 6301 var floor = Math.floor; 6302 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 6303 var side = isVertical ? 'right' : 'bottom'; 6304 var opSide = isVertical ? 'left' : 'top'; 6305 var measurement = isVertical ? 'width' : 'height'; 6306 6307 if (popper[side] < floor(reference[opSide])) { 6308 data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; 6309 } 6310 if (popper[opSide] > floor(reference[side])) { 6311 data.offsets.popper[opSide] = floor(reference[side]); 6312 } 6313 6314 return data; 6315} 6316 6317/** 6318 * Converts a string containing value + unit into a px value number 6319 * @function 6320 * @memberof {modifiers~offset} 6321 * @private 6322 * @argument {String} str - Value + unit string 6323 * @argument {String} measurement - `height` or `width` 6324 * @argument {Object} popperOffsets 6325 * @argument {Object} referenceOffsets 6326 * @returns {Number|String} 6327 * Value in pixels, or original string if no values were extracted 6328 */ 6329function toValue(str, measurement, popperOffsets, referenceOffsets) { 6330 // separate value from unit 6331 var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); 6332 var value = +split[1]; 6333 var unit = split[2]; 6334 6335 // If it's not a number it's an operator, I guess 6336 if (!value) { 6337 return str; 6338 } 6339 6340 if (unit.indexOf('%') === 0) { 6341 var element = void 0; 6342 switch (unit) { 6343 case '%p': 6344 element = popperOffsets; 6345 break; 6346 case '%': 6347 case '%r': 6348 default: 6349 element = referenceOffsets; 6350 } 6351 6352 var rect = getClientRect(element); 6353 return rect[measurement] / 100 * value; 6354 } else if (unit === 'vh' || unit === 'vw') { 6355 // if is a vh or vw, we calculate the size based on the viewport 6356 var size = void 0; 6357 if (unit === 'vh') { 6358 size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); 6359 } else { 6360 size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 6361 } 6362 return size / 100 * value; 6363 } else { 6364 // if is an explicit pixel unit, we get rid of the unit and keep the value 6365 // if is an implicit unit, it's px, and we return just the value 6366 return value; 6367 } 6368} 6369 6370/** 6371 * Parse an `offset` string to extrapolate `x` and `y` numeric offsets. 6372 * @function 6373 * @memberof {modifiers~offset} 6374 * @private 6375 * @argument {String} offset 6376 * @argument {Object} popperOffsets 6377 * @argument {Object} referenceOffsets 6378 * @argument {String} basePlacement 6379 * @returns {Array} a two cells array with x and y offsets in numbers 6380 */ 6381function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { 6382 var offsets = [0, 0]; 6383 6384 // Use height if placement is left or right and index is 0 otherwise use width 6385 // in this way the first offset will use an axis and the second one 6386 // will use the other one 6387 var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; 6388 6389 // Split the offset string to obtain a list of values and operands 6390 // The regex addresses values with the plus or minus sign in front (+10, -20, etc) 6391 var fragments = offset.split(/(\+|\-)/).map(function (frag) { 6392 return frag.trim(); 6393 }); 6394 6395 // Detect if the offset string contains a pair of values or a single one 6396 // they could be separated by comma or space 6397 var divider = fragments.indexOf(find(fragments, function (frag) { 6398 return frag.search(/,|\s/) !== -1; 6399 })); 6400 6401 if (fragments[divider] && fragments[divider].indexOf(',') === -1) { 6402 console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); 6403 } 6404 6405 // If divider is found, we divide the list of values and operands to divide 6406 // them by ofset X and Y. 6407 var splitRegex = /\s*,\s*|\s+/; 6408 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]; 6409 6410 // Convert the values with units to absolute pixels to allow our computations 6411 ops = ops.map(function (op, index) { 6412 // Most of the units rely on the orientation of the popper 6413 var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; 6414 var mergeWithPrevious = false; 6415 return op 6416 // This aggregates any `+` or `-` sign that aren't considered operators 6417 // e.g.: 10 + +5 => [10, +, +5] 6418 .reduce(function (a, b) { 6419 if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { 6420 a[a.length - 1] = b; 6421 mergeWithPrevious = true; 6422 return a; 6423 } else if (mergeWithPrevious) { 6424 a[a.length - 1] += b; 6425 mergeWithPrevious = false; 6426 return a; 6427 } else { 6428 return a.concat(b); 6429 } 6430 }, []) 6431 // Here we convert the string values into number values (in px) 6432 .map(function (str) { 6433 return toValue(str, measurement, popperOffsets, referenceOffsets); 6434 }); 6435 }); 6436 6437 // Loop trough the offsets arrays and execute the operations 6438 ops.forEach(function (op, index) { 6439 op.forEach(function (frag, index2) { 6440 if (isNumeric(frag)) { 6441 offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); 6442 } 6443 }); 6444 }); 6445 return offsets; 6446} 6447 6448/** 6449 * @function 6450 * @memberof Modifiers 6451 * @argument {Object} data - The data object generated by update method 6452 * @argument {Object} options - Modifiers configuration and options 6453 * @argument {Number|String} options.offset=0 6454 * The offset value as described in the modifier description 6455 * @returns {Object} The data object, properly modified 6456 */ 6457function offset(data, _ref) { 6458 var offset = _ref.offset; 6459 var placement = data.placement, 6460 _data$offsets = data.offsets, 6461 popper = _data$offsets.popper, 6462 reference = _data$offsets.reference; 6463 6464 var basePlacement = placement.split('-')[0]; 6465 6466 var offsets = void 0; 6467 if (isNumeric(+offset)) { 6468 offsets = [+offset, 0]; 6469 } else { 6470 offsets = parseOffset(offset, popper, reference, basePlacement); 6471 } 6472 6473 if (basePlacement === 'left') { 6474 popper.top += offsets[0]; 6475 popper.left -= offsets[1]; 6476 } else if (basePlacement === 'right') { 6477 popper.top += offsets[0]; 6478 popper.left += offsets[1]; 6479 } else if (basePlacement === 'top') { 6480 popper.left += offsets[0]; 6481 popper.top -= offsets[1]; 6482 } else if (basePlacement === 'bottom') { 6483 popper.left += offsets[0]; 6484 popper.top += offsets[1]; 6485 } 6486 6487 data.popper = popper; 6488 return data; 6489} 6490 6491/** 6492 * @function 6493 * @memberof Modifiers 6494 * @argument {Object} data - The data object generated by `update` method 6495 * @argument {Object} options - Modifiers configuration and options 6496 * @returns {Object} The data object, properly modified 6497 */ 6498function preventOverflow(data, options) { 6499 var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); 6500 6501 // If offsetParent is the reference element, we really want to 6502 // go one step up and use the next offsetParent as reference to 6503 // avoid to make this modifier completely useless and look like broken 6504 if (data.instance.reference === boundariesElement) { 6505 boundariesElement = getOffsetParent(boundariesElement); 6506 } 6507 6508 // NOTE: DOM access here 6509 // resets the popper's position so that the document size can be calculated excluding 6510 // the size of the popper element itself 6511 var transformProp = getSupportedPropertyName('transform'); 6512 var popperStyles = data.instance.popper.style; // assignment to help minification 6513 var top = popperStyles.top, 6514 left = popperStyles.left, 6515 transform = popperStyles[transformProp]; 6516 6517 popperStyles.top = ''; 6518 popperStyles.left = ''; 6519 popperStyles[transformProp] = ''; 6520 6521 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed); 6522 6523 // NOTE: DOM access here 6524 // restores the original style properties after the offsets have been computed 6525 popperStyles.top = top; 6526 popperStyles.left = left; 6527 popperStyles[transformProp] = transform; 6528 6529 options.boundaries = boundaries; 6530 6531 var order = options.priority; 6532 var popper = data.offsets.popper; 6533 6534 var check = { 6535 primary: function primary(placement) { 6536 var value = popper[placement]; 6537 if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { 6538 value = Math.max(popper[placement], boundaries[placement]); 6539 } 6540 return defineProperty({}, placement, value); 6541 }, 6542 secondary: function secondary(placement) { 6543 var mainSide = placement === 'right' ? 'left' : 'top'; 6544 var value = popper[mainSide]; 6545 if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { 6546 value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); 6547 } 6548 return defineProperty({}, mainSide, value); 6549 } 6550 }; 6551 6552 order.forEach(function (placement) { 6553 var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; 6554 popper = _extends({}, popper, check[side](placement)); 6555 }); 6556 6557 data.offsets.popper = popper; 6558 6559 return data; 6560} 6561 6562/** 6563 * @function 6564 * @memberof Modifiers 6565 * @argument {Object} data - The data object generated by `update` method 6566 * @argument {Object} options - Modifiers configuration and options 6567 * @returns {Object} The data object, properly modified 6568 */ 6569function shift(data) { 6570 var placement = data.placement; 6571 var basePlacement = placement.split('-')[0]; 6572 var shiftvariation = placement.split('-')[1]; 6573 6574 // if shift shiftvariation is specified, run the modifier 6575 if (shiftvariation) { 6576 var _data$offsets = data.offsets, 6577 reference = _data$offsets.reference, 6578 popper = _data$offsets.popper; 6579 6580 var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; 6581 var side = isVertical ? 'left' : 'top'; 6582 var measurement = isVertical ? 'width' : 'height'; 6583 6584 var shiftOffsets = { 6585 start: defineProperty({}, side, reference[side]), 6586 end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) 6587 }; 6588 6589 data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); 6590 } 6591 6592 return data; 6593} 6594 6595/** 6596 * @function 6597 * @memberof Modifiers 6598 * @argument {Object} data - The data object generated by update method 6599 * @argument {Object} options - Modifiers configuration and options 6600 * @returns {Object} The data object, properly modified 6601 */ 6602function hide(data) { 6603 if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { 6604 return data; 6605 } 6606 6607 var refRect = data.offsets.reference; 6608 var bound = find(data.instance.modifiers, function (modifier) { 6609 return modifier.name === 'preventOverflow'; 6610 }).boundaries; 6611 6612 if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { 6613 // Avoid unnecessary DOM access if visibility hasn't changed 6614 if (data.hide === true) { 6615 return data; 6616 } 6617 6618 data.hide = true; 6619 data.attributes['x-out-of-boundaries'] = ''; 6620 } else { 6621 // Avoid unnecessary DOM access if visibility hasn't changed 6622 if (data.hide === false) { 6623 return data; 6624 } 6625 6626 data.hide = false; 6627 data.attributes['x-out-of-boundaries'] = false; 6628 } 6629 6630 return data; 6631} 6632 6633/** 6634 * @function 6635 * @memberof Modifiers 6636 * @argument {Object} data - The data object generated by `update` method 6637 * @argument {Object} options - Modifiers configuration and options 6638 * @returns {Object} The data object, properly modified 6639 */ 6640function inner(data) { 6641 var placement = data.placement; 6642 var basePlacement = placement.split('-')[0]; 6643 var _data$offsets = data.offsets, 6644 popper = _data$offsets.popper, 6645 reference = _data$offsets.reference; 6646 6647 var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; 6648 6649 var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; 6650 6651 popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); 6652 6653 data.placement = getOppositePlacement(placement); 6654 data.offsets.popper = getClientRect(popper); 6655 6656 return data; 6657} 6658 6659/** 6660 * Modifier function, each modifier can have a function of this type assigned 6661 * to its `fn` property.<br /> 6662 * These functions will be called on each update, this means that you must 6663 * make sure they are performant enough to avoid performance bottlenecks. 6664 * 6665 * @function ModifierFn 6666 * @argument {dataObject} data - The data object generated by `update` method 6667 * @argument {Object} options - Modifiers configuration and options 6668 * @returns {dataObject} The data object, properly modified 6669 */ 6670 6671/** 6672 * Modifiers are plugins used to alter the behavior of your poppers.<br /> 6673 * Popper.js uses a set of 9 modifiers to provide all the basic functionalities 6674 * needed by the library. 6675 * 6676 * Usually you don't want to override the `order`, `fn` and `onLoad` props. 6677 * All the other properties are configurations that could be tweaked. 6678 * @namespace modifiers 6679 */ 6680var modifiers = { 6681 /** 6682 * Modifier used to shift the popper on the start or end of its reference 6683 * element.<br /> 6684 * It will read the variation of the `placement` property.<br /> 6685 * It can be one either `-end` or `-start`. 6686 * @memberof modifiers 6687 * @inner 6688 */ 6689 shift: { 6690 /** @prop {number} order=100 - Index used to define the order of execution */ 6691 order: 100, 6692 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 6693 enabled: true, 6694 /** @prop {ModifierFn} */ 6695 fn: shift 6696 }, 6697 6698 /** 6699 * The `offset` modifier can shift your popper on both its axis. 6700 * 6701 * It accepts the following units: 6702 * - `px` or unit-less, interpreted as pixels 6703 * - `%` or `%r`, percentage relative to the length of the reference element 6704 * - `%p`, percentage relative to the length of the popper element 6705 * - `vw`, CSS viewport width unit 6706 * - `vh`, CSS viewport height unit 6707 * 6708 * For length is intended the main axis relative to the placement of the popper.<br /> 6709 * This means that if the placement is `top` or `bottom`, the length will be the 6710 * `width`. In case of `left` or `right`, it will be the `height`. 6711 * 6712 * You can provide a single value (as `Number` or `String`), or a pair of values 6713 * as `String` divided by a comma or one (or more) white spaces.<br /> 6714 * The latter is a deprecated method because it leads to confusion and will be 6715 * removed in v2.<br /> 6716 * Additionally, it accepts additions and subtractions between different units. 6717 * Note that multiplications and divisions aren't supported. 6718 * 6719 * Valid examples are: 6720 * ``` 6721 * 10 6722 * '10%' 6723 * '10, 10' 6724 * '10%, 10' 6725 * '10 + 10%' 6726 * '10 - 5vh + 3%' 6727 * '-10px + 5vh, 5px - 6%' 6728 * ``` 6729 * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap 6730 * > with their reference element, unfortunately, you will have to disable the `flip` modifier. 6731 * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373). 6732 * 6733 * @memberof modifiers 6734 * @inner 6735 */ 6736 offset: { 6737 /** @prop {number} order=200 - Index used to define the order of execution */ 6738 order: 200, 6739 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 6740 enabled: true, 6741 /** @prop {ModifierFn} */ 6742 fn: offset, 6743 /** @prop {Number|String} offset=0 6744 * The offset value as described in the modifier description 6745 */ 6746 offset: 0 6747 }, 6748 6749 /** 6750 * Modifier used to prevent the popper from being positioned outside the boundary. 6751 * 6752 * A scenario exists where the reference itself is not within the boundaries.<br /> 6753 * We can say it has "escaped the boundaries" — or just "escaped".<br /> 6754 * In this case we need to decide whether the popper should either: 6755 * 6756 * - detach from the reference and remain "trapped" in the boundaries, or 6757 * - if it should ignore the boundary and "escape with its reference" 6758 * 6759 * When `escapeWithReference` is set to`true` and reference is completely 6760 * outside its boundaries, the popper will overflow (or completely leave) 6761 * the boundaries in order to remain attached to the edge of the reference. 6762 * 6763 * @memberof modifiers 6764 * @inner 6765 */ 6766 preventOverflow: { 6767 /** @prop {number} order=300 - Index used to define the order of execution */ 6768 order: 300, 6769 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 6770 enabled: true, 6771 /** @prop {ModifierFn} */ 6772 fn: preventOverflow, 6773 /** 6774 * @prop {Array} [priority=['left','right','top','bottom']] 6775 * Popper will try to prevent overflow following these priorities by default, 6776 * then, it could overflow on the left and on top of the `boundariesElement` 6777 */ 6778 priority: ['left', 'right', 'top', 'bottom'], 6779 /** 6780 * @prop {number} padding=5 6781 * Amount of pixel used to define a minimum distance between the boundaries 6782 * and the popper. This makes sure the popper always has a little padding 6783 * between the edges of its container 6784 */ 6785 padding: 5, 6786 /** 6787 * @prop {String|HTMLElement} boundariesElement='scrollParent' 6788 * Boundaries used by the modifier. Can be `scrollParent`, `window`, 6789 * `viewport` or any DOM element. 6790 */ 6791 boundariesElement: 'scrollParent' 6792 }, 6793 6794 /** 6795 * Modifier used to make sure the reference and its popper stay near each other 6796 * without leaving any gap between the two. Especially useful when the arrow is 6797 * enabled and you want to ensure that it points to its reference element. 6798 * It cares only about the first axis. You can still have poppers with margin 6799 * between the popper and its reference element. 6800 * @memberof modifiers 6801 * @inner 6802 */ 6803 keepTogether: { 6804 /** @prop {number} order=400 - Index used to define the order of execution */ 6805 order: 400, 6806 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 6807 enabled: true, 6808 /** @prop {ModifierFn} */ 6809 fn: keepTogether 6810 }, 6811 6812 /** 6813 * This modifier is used to move the `arrowElement` of the popper to make 6814 * sure it is positioned between the reference element and its popper element. 6815 * It will read the outer size of the `arrowElement` node to detect how many 6816 * pixels of conjunction are needed. 6817 * 6818 * It has no effect if no `arrowElement` is provided. 6819 * @memberof modifiers 6820 * @inner 6821 */ 6822 arrow: { 6823 /** @prop {number} order=500 - Index used to define the order of execution */ 6824 order: 500, 6825 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 6826 enabled: true, 6827 /** @prop {ModifierFn} */ 6828 fn: arrow, 6829 /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ 6830 element: '[x-arrow]' 6831 }, 6832 6833 /** 6834 * Modifier used to flip the popper's placement when it starts to overlap its 6835 * reference element. 6836 * 6837 * Requires the `preventOverflow` modifier before it in order to work. 6838 * 6839 * **NOTE:** this modifier will interrupt the current update cycle and will 6840 * restart it if it detects the need to flip the placement. 6841 * @memberof modifiers 6842 * @inner 6843 */ 6844 flip: { 6845 /** @prop {number} order=600 - Index used to define the order of execution */ 6846 order: 600, 6847 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 6848 enabled: true, 6849 /** @prop {ModifierFn} */ 6850 fn: flip, 6851 /** 6852 * @prop {String|Array} behavior='flip' 6853 * The behavior used to change the popper's placement. It can be one of 6854 * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid 6855 * placements (with optional variations) 6856 */ 6857 behavior: 'flip', 6858 /** 6859 * @prop {number} padding=5 6860 * The popper will flip if it hits the edges of the `boundariesElement` 6861 */ 6862 padding: 5, 6863 /** 6864 * @prop {String|HTMLElement} boundariesElement='viewport' 6865 * The element which will define the boundaries of the popper position. 6866 * The popper will never be placed outside of the defined boundaries 6867 * (except if `keepTogether` is enabled) 6868 */ 6869 boundariesElement: 'viewport', 6870 /** 6871 * @prop {Boolean} flipVariations=false 6872 * The popper will switch placement variation between `-start` and `-end` when 6873 * the reference element overlaps its boundaries. 6874 * 6875 * The original placement should have a set variation. 6876 */ 6877 flipVariations: false, 6878 /** 6879 * @prop {Boolean} flipVariationsByContent=false 6880 * The popper will switch placement variation between `-start` and `-end` when 6881 * the popper element overlaps its reference boundaries. 6882 * 6883 * The original placement should have a set variation. 6884 */ 6885 flipVariationsByContent: false 6886 }, 6887 6888 /** 6889 * Modifier used to make the popper flow toward the inner of the reference element. 6890 * By default, when this modifier is disabled, the popper will be placed outside 6891 * the reference element. 6892 * @memberof modifiers 6893 * @inner 6894 */ 6895 inner: { 6896 /** @prop {number} order=700 - Index used to define the order of execution */ 6897 order: 700, 6898 /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ 6899 enabled: false, 6900 /** @prop {ModifierFn} */ 6901 fn: inner 6902 }, 6903 6904 /** 6905 * Modifier used to hide the popper when its reference element is outside of the 6906 * popper boundaries. It will set a `x-out-of-boundaries` attribute which can 6907 * be used to hide with a CSS selector the popper when its reference is 6908 * out of boundaries. 6909 * 6910 * Requires the `preventOverflow` modifier before it in order to work. 6911 * @memberof modifiers 6912 * @inner 6913 */ 6914 hide: { 6915 /** @prop {number} order=800 - Index used to define the order of execution */ 6916 order: 800, 6917 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 6918 enabled: true, 6919 /** @prop {ModifierFn} */ 6920 fn: hide 6921 }, 6922 6923 /** 6924 * Computes the style that will be applied to the popper element to gets 6925 * properly positioned. 6926 * 6927 * Note that this modifier will not touch the DOM, it just prepares the styles 6928 * so that `applyStyle` modifier can apply it. This separation is useful 6929 * in case you need to replace `applyStyle` with a custom implementation. 6930 * 6931 * This modifier has `850` as `order` value to maintain backward compatibility 6932 * with previous versions of Popper.js. Expect the modifiers ordering method 6933 * to change in future major versions of the library. 6934 * 6935 * @memberof modifiers 6936 * @inner 6937 */ 6938 computeStyle: { 6939 /** @prop {number} order=850 - Index used to define the order of execution */ 6940 order: 850, 6941 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 6942 enabled: true, 6943 /** @prop {ModifierFn} */ 6944 fn: computeStyle, 6945 /** 6946 * @prop {Boolean} gpuAcceleration=true 6947 * If true, it uses the CSS 3D transformation to position the popper. 6948 * Otherwise, it will use the `top` and `left` properties 6949 */ 6950 gpuAcceleration: true, 6951 /** 6952 * @prop {string} [x='bottom'] 6953 * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. 6954 * Change this if your popper should grow in a direction different from `bottom` 6955 */ 6956 x: 'bottom', 6957 /** 6958 * @prop {string} [x='left'] 6959 * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. 6960 * Change this if your popper should grow in a direction different from `right` 6961 */ 6962 y: 'right' 6963 }, 6964 6965 /** 6966 * Applies the computed styles to the popper element. 6967 * 6968 * All the DOM manipulations are limited to this modifier. This is useful in case 6969 * you want to integrate Popper.js inside a framework or view library and you 6970 * want to delegate all the DOM manipulations to it. 6971 * 6972 * Note that if you disable this modifier, you must make sure the popper element 6973 * has its position set to `absolute` before Popper.js can do its work! 6974 * 6975 * Just disable this modifier and define your own to achieve the desired effect. 6976 * 6977 * @memberof modifiers 6978 * @inner 6979 */ 6980 applyStyle: { 6981 /** @prop {number} order=900 - Index used to define the order of execution */ 6982 order: 900, 6983 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 6984 enabled: true, 6985 /** @prop {ModifierFn} */ 6986 fn: applyStyle, 6987 /** @prop {Function} */ 6988 onLoad: applyStyleOnLoad, 6989 /** 6990 * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier 6991 * @prop {Boolean} gpuAcceleration=true 6992 * If true, it uses the CSS 3D transformation to position the popper. 6993 * Otherwise, it will use the `top` and `left` properties 6994 */ 6995 gpuAcceleration: undefined 6996 } 6997}; 6998 6999/** 7000 * The `dataObject` is an object containing all the information used by Popper.js. 7001 * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks. 7002 * @name dataObject 7003 * @property {Object} data.instance The Popper.js instance 7004 * @property {String} data.placement Placement applied to popper 7005 * @property {String} data.originalPlacement Placement originally defined on init 7006 * @property {Boolean} data.flipped True if popper has been flipped by flip modifier 7007 * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper 7008 * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier 7009 * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`) 7010 * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`) 7011 * @property {Object} data.boundaries Offsets of the popper boundaries 7012 * @property {Object} data.offsets The measurements of popper, reference and arrow elements 7013 * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values 7014 * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values 7015 * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 7016 */ 7017 7018/** 7019 * Default options provided to Popper.js constructor.<br /> 7020 * These can be overridden using the `options` argument of Popper.js.<br /> 7021 * To override an option, simply pass an object with the same 7022 * structure of the `options` object, as the 3rd argument. For example: 7023 * ``` 7024 * new Popper(ref, pop, { 7025 * modifiers: { 7026 * preventOverflow: { enabled: false } 7027 * } 7028 * }) 7029 * ``` 7030 * @type {Object} 7031 * @static 7032 * @memberof Popper 7033 */ 7034var Defaults = { 7035 /** 7036 * Popper's placement. 7037 * @prop {Popper.placements} placement='bottom' 7038 */ 7039 placement: 'bottom', 7040 7041 /** 7042 * Set this to true if you want popper to position it self in 'fixed' mode 7043 * @prop {Boolean} positionFixed=false 7044 */ 7045 positionFixed: false, 7046 7047 /** 7048 * Whether events (resize, scroll) are initially enabled. 7049 * @prop {Boolean} eventsEnabled=true 7050 */ 7051 eventsEnabled: true, 7052 7053 /** 7054 * Set to true if you want to automatically remove the popper when 7055 * you call the `destroy` method. 7056 * @prop {Boolean} removeOnDestroy=false 7057 */ 7058 removeOnDestroy: false, 7059 7060 /** 7061 * Callback called when the popper is created.<br /> 7062 * By default, it is set to no-op.<br /> 7063 * Access Popper.js instance with `data.instance`. 7064 * @prop {onCreate} 7065 */ 7066 onCreate: function onCreate() {}, 7067 7068 /** 7069 * Callback called when the popper is updated. This callback is not called 7070 * on the initialization/creation of the popper, but only on subsequent 7071 * updates.<br /> 7072 * By default, it is set to no-op.<br /> 7073 * Access Popper.js instance with `data.instance`. 7074 * @prop {onUpdate} 7075 */ 7076 onUpdate: function onUpdate() {}, 7077 7078 /** 7079 * List of modifiers used to modify the offsets before they are applied to the popper. 7080 * They provide most of the functionalities of Popper.js. 7081 * @prop {modifiers} 7082 */ 7083 modifiers: modifiers 7084}; 7085 7086/** 7087 * @callback onCreate 7088 * @param {dataObject} data 7089 */ 7090 7091/** 7092 * @callback onUpdate 7093 * @param {dataObject} data 7094 */ 7095 7096// Utils 7097// Methods 7098var Popper = function () { 7099 /** 7100 * Creates a new Popper.js instance. 7101 * @class Popper 7102 * @param {Element|referenceObject} reference - The reference element used to position the popper 7103 * @param {Element} popper - The HTML / XML element used as the popper 7104 * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) 7105 * @return {Object} instance - The generated Popper.js instance 7106 */ 7107 function Popper(reference, popper) { 7108 var _this = this; 7109 7110 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 7111 classCallCheck(this, Popper); 7112 7113 this.scheduleUpdate = function () { 7114 return requestAnimationFrame(_this.update); 7115 }; 7116 7117 // make update() debounced, so that it only runs at most once-per-tick 7118 this.update = debounce(this.update.bind(this)); 7119 7120 // with {} we create a new object with the options inside it 7121 this.options = _extends({}, Popper.Defaults, options); 7122 7123 // init state 7124 this.state = { 7125 isDestroyed: false, 7126 isCreated: false, 7127 scrollParents: [] 7128 }; 7129 7130 // get reference and popper elements (allow jQuery wrappers) 7131 this.reference = reference && reference.jquery ? reference[0] : reference; 7132 this.popper = popper && popper.jquery ? popper[0] : popper; 7133 7134 // Deep merge modifiers options 7135 this.options.modifiers = {}; 7136 Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { 7137 _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); 7138 }); 7139 7140 // Refactoring modifiers' list (Object => Array) 7141 this.modifiers = Object.keys(this.options.modifiers).map(function (name) { 7142 return _extends({ 7143 name: name 7144 }, _this.options.modifiers[name]); 7145 }) 7146 // sort the modifiers by order 7147 .sort(function (a, b) { 7148 return a.order - b.order; 7149 }); 7150 7151 // modifiers have the ability to execute arbitrary code when Popper.js get inited 7152 // such code is executed in the same order of its modifier 7153 // they could add new properties to their options configuration 7154 // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! 7155 this.modifiers.forEach(function (modifierOptions) { 7156 if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { 7157 modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); 7158 } 7159 }); 7160 7161 // fire the first update to position the popper in the right place 7162 this.update(); 7163 7164 var eventsEnabled = this.options.eventsEnabled; 7165 if (eventsEnabled) { 7166 // setup event listeners, they will take care of update the position in specific situations 7167 this.enableEventListeners(); 7168 } 7169 7170 this.state.eventsEnabled = eventsEnabled; 7171 } 7172 7173 // We can't use class properties because they don't get listed in the 7174 // class prototype and break stuff like Sinon stubs 7175 7176 7177 createClass(Popper, [{ 7178 key: 'update', 7179 value: function update$$1() { 7180 return update.call(this); 7181 } 7182 }, { 7183 key: 'destroy', 7184 value: function destroy$$1() { 7185 return destroy.call(this); 7186 } 7187 }, { 7188 key: 'enableEventListeners', 7189 value: function enableEventListeners$$1() { 7190 return enableEventListeners.call(this); 7191 } 7192 }, { 7193 key: 'disableEventListeners', 7194 value: function disableEventListeners$$1() { 7195 return disableEventListeners.call(this); 7196 } 7197 7198 /** 7199 * Schedules an update. It will run on the next UI update available. 7200 * @method scheduleUpdate 7201 * @memberof Popper 7202 */ 7203 7204 7205 /** 7206 * Collection of utilities useful when writing custom modifiers. 7207 * Starting from version 1.7, this method is available only if you 7208 * include `popper-utils.js` before `popper.js`. 7209 * 7210 * **DEPRECATION**: This way to access PopperUtils is deprecated 7211 * and will be removed in v2! Use the PopperUtils module directly instead. 7212 * Due to the high instability of the methods contained in Utils, we can't 7213 * guarantee them to follow semver. Use them at your own risk! 7214 * @static 7215 * @private 7216 * @type {Object} 7217 * @deprecated since version 1.8 7218 * @member Utils 7219 * @memberof Popper 7220 */ 7221 7222 }]); 7223 return Popper; 7224}(); 7225 7226/** 7227 * The `referenceObject` is an object that provides an interface compatible with Popper.js 7228 * and lets you use it as replacement of a real DOM node.<br /> 7229 * You can use this method to position a popper relatively to a set of coordinates 7230 * in case you don't have a DOM node to use as reference. 7231 * 7232 * ``` 7233 * new Popper(referenceObject, popperNode); 7234 * ``` 7235 * 7236 * NB: This feature isn't supported in Internet Explorer 10. 7237 * @name referenceObject 7238 * @property {Function} data.getBoundingClientRect 7239 * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. 7240 * @property {number} data.clientWidth 7241 * An ES6 getter that will return the width of the virtual reference element. 7242 * @property {number} data.clientHeight 7243 * An ES6 getter that will return the height of the virtual reference element. 7244 */ 7245 7246 7247Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils; 7248Popper.placements = placements; 7249Popper.Defaults = Defaults; 7250
7251/* harmony default export */ __webpack_exports__["default"] = (Popper); 7252//# sourceMappingURL=popper.js.map 7253 7254/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(6))) 7255 7256/***/ }), 7257/* 6 */ 7258/***/ (function(module, exports) { 7259 7260var g; 7261 7262// This works in non-strict mode 7263g = (function() { 7264 return this; 7265})(); 7266 7267try { 7268 // This works if eval is allowed (see CSP) 7269 g = g || Function("return this")() || (1,eval)("this"); 7270} catch(e) { 7271 // This works if the window reference is available 7272 if(typeof window === "object") 7273 g = window; 7274} 7275 7276// g can still be undefined, but nothing to do about it... 7277// We return undefined, instead of nothing here, so it's 7278// easier to handle this case. if(!global) { ...} 7279 7280module.exports = g; 7281 7282 7283/***/ }), 7284/* 7 */ 7285/***/ (function(module, __webpack_exports__, __webpack_require__) { 7286 7287"use strict"; 7288/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__camelCase__ = __webpack_require__(8); 7289 7290 7291/** 7292 * DOM-based Routing 7293 * 7294 * Based on {@link http://goo.gl/EUTi53|Markup-based Unobtrusive Comprehensive DOM-ready Execution} by Paul Irish 7295 * 7296 * The routing fires all common scripts, followed by the page specific scripts. 7297 * Add additional events for more control over timing e.g. a finalize event 7298 */ 7299var Router = function Router(routes) { 7300 this.routes = routes; 7301}; 7302 7303/** 7304 * Fire Router events 7305 * @param {string} route DOM-based route derived from body classes (`<body class="...">`) 7306 * @param {string} [event] Events on the route. By default, `init` and `finalize` events are called. 7307 * @param {string} [arg] Any custom argument to be passed to the event. 7308 */ 7309Router.prototype.fire = function fire (route, event, arg) { 7310 if ( event === void 0 ) event = 'init'; 7311 7312 document.dispatchEvent(new CustomEvent('routed', { 7313 bubbles: true, 7314 detail: { 7315 route: route, 7316 fn: event, 7317 }, 7318 })); 7319 7320 var fire = route !== '' && this.routes[route] && typeof this.routes[route][event] === 'function'; 7321 if (fire) { 7322 this.routes[route][event](arg); 7323 } 7324}; 7325 7326/** 7327 * Automatically load and fire Router events 7328 * 7329 * Events are fired in the following order: 7330 ** common init 7331 ** page-specific init 7332 ** page-specific finalize 7333 ** common finalize 7334 */ 7335Router.prototype.loadEvents = function loadEvents () { 7336 var this$1 = this; 7337 7338 // Fire common init JS 7339 this.fire('common'); 7340 7341 // Fire page-specific init JS, and then finalize JS 7342 document.body.className 7343 .toLowerCase() 7344 .replace(/-/g, '_') 7345 .split(/\s+/) 7346 .map(__WEBPACK_IMPORTED_MODULE_0__camelCase__["a" /* default */]) 7347 .forEach(function (className) { 7348 this$1.fire(className); 7349 this$1.fire(className, 'finalize'); 7350 }); 7351 7352 // Fire common finalize JS 7353 this.fire('common', 'finalize'); 7354}; 7355 7356/* harmony default export */ __webpack_exports__["a"] = (Router); 7357 7358 7359/***/ }), 7360/* 8 */ 7361/***/ (function(module, __webpack_exports__, __webpack_require__) { 7362 7363"use strict"; 7364/** 7365 * the most terrible camelizer on the internet, guaranteed! 7366 * @param {string} str String that isn't camel-case, e.g., CAMeL_CaSEiS-harD 7367 * @return {string} String converted to camel-case, e.g., camelCaseIsHard 7368 */ 7369/* harmony default export */ __webpack_exports__["a"] = (function (str) { return ("" + (str.charAt(0).toLowerCase()) + (str.replace(/[\W_]/g, '|').split('|') 7370 .map(function (part) { return ("" + (part.charAt(0).toUpperCase()) + (part.slice(1))); }) 7371 .join('') 7372 .slice(1))); });; 7373 7374 7375/***/ }), 7376/* 9 */ 7377/***/ (function(module, __webpack_exports__, __webpack_require__) { 7378 7379"use strict"; 7380/* harmony default export */ __webpack_exports__["a"] = ({ 7381 init: function init() { 7382 // JavaScript to be fired on all pages 7383 }, 7384 finalize: function finalize() { 7385 // JavaScript to be fired on all pages, after page specific JS is fired 7386 }, 7387}); 7388 7389 7390/***/ }), 7391/* 10 */ 7392/***/ (function(module, __webpack_exports__, __webpack_require__) { 7393 7394"use strict"; 7395/* harmony default export */ __webpack_exports__["a"] = ({ 7396 init: function init() { 7397 // JavaScript to be fired on the home page 7398 }, 7399 finalize: function finalize() { 7400 // JavaScript to be fired on the home page, after the init JS 7401 7402 }, 7403}); 7404 7405 7406/***/ }), 7407/* 11 */ 7408/***/ (function(module, __webpack_exports__, __webpack_require__) { 7409 7410"use strict"; 7411/* harmony default export */ __webpack_exports__["a"] = ({
7412 init: function init() { 7413 // JavaScript to be fired on the about us page 7414 }, 7415}); 7416 7417 7418/***/ }), 7419/* 12 */ 7420/***/ (function(module, exports) { 7421 7422// removed by extract-text-webpack-plugin 7423 7424/***/ }) 7425/******/ ]); 7426//# sourceMappingURL=main.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.