UNPKG

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