You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

7023 lines
223 KiB

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