/js/bootstrap.js

https://bitbucket.org/denissilva/cgpdi_admin · JavaScript · 3894 lines · 2797 code · 743 blank · 354 comment · 447 complexity · d810a38ca2781735a27cba0625a027db MD5 · raw file

Large files are truncated click here to view the full file

  1. /*!
  2. * Bootstrap v4.0.0 (https://getbootstrap.com)
  3. * Copyright 2011-2018 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  4. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery'), require('popper.js')) :
  8. typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) :
  9. (factory((global.bootstrap = {}),global.jQuery,global.Popper));
  10. }(this, (function (exports,$,Popper) { 'use strict';
  11. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  12. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  13. function _defineProperties(target, props) {
  14. for (var i = 0; i < props.length; i++) {
  15. var descriptor = props[i];
  16. descriptor.enumerable = descriptor.enumerable || false;
  17. descriptor.configurable = true;
  18. if ("value" in descriptor) descriptor.writable = true;
  19. Object.defineProperty(target, descriptor.key, descriptor);
  20. }
  21. }
  22. function _createClass(Constructor, protoProps, staticProps) {
  23. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  24. if (staticProps) _defineProperties(Constructor, staticProps);
  25. return Constructor;
  26. }
  27. function _extends() {
  28. _extends = Object.assign || function (target) {
  29. for (var i = 1; i < arguments.length; i++) {
  30. var source = arguments[i];
  31. for (var key in source) {
  32. if (Object.prototype.hasOwnProperty.call(source, key)) {
  33. target[key] = source[key];
  34. }
  35. }
  36. }
  37. return target;
  38. };
  39. return _extends.apply(this, arguments);
  40. }
  41. function _inheritsLoose(subClass, superClass) {
  42. subClass.prototype = Object.create(superClass.prototype);
  43. subClass.prototype.constructor = subClass;
  44. subClass.__proto__ = superClass;
  45. }
  46. /**
  47. * --------------------------------------------------------------------------
  48. * Bootstrap (v4.0.0): util.js
  49. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  50. * --------------------------------------------------------------------------
  51. */
  52. var Util = function ($$$1) {
  53. /**
  54. * ------------------------------------------------------------------------
  55. * Private TransitionEnd Helpers
  56. * ------------------------------------------------------------------------
  57. */
  58. var transition = false;
  59. var MAX_UID = 1000000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  60. function toType(obj) {
  61. return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
  62. }
  63. function getSpecialTransitionEndEvent() {
  64. return {
  65. bindType: transition.end,
  66. delegateType: transition.end,
  67. handle: function handle(event) {
  68. if ($$$1(event.target).is(this)) {
  69. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  70. }
  71. return undefined; // eslint-disable-line no-undefined
  72. }
  73. };
  74. }
  75. function transitionEndTest() {
  76. if (typeof window !== 'undefined' && window.QUnit) {
  77. return false;
  78. }
  79. return {
  80. end: 'transitionend'
  81. };
  82. }
  83. function transitionEndEmulator(duration) {
  84. var _this = this;
  85. var called = false;
  86. $$$1(this).one(Util.TRANSITION_END, function () {
  87. called = true;
  88. });
  89. setTimeout(function () {
  90. if (!called) {
  91. Util.triggerTransitionEnd(_this);
  92. }
  93. }, duration);
  94. return this;
  95. }
  96. function setTransitionEndSupport() {
  97. transition = transitionEndTest();
  98. $$$1.fn.emulateTransitionEnd = transitionEndEmulator;
  99. if (Util.supportsTransitionEnd()) {
  100. $$$1.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  101. }
  102. }
  103. function escapeId(selector) {
  104. // We escape IDs in case of special selectors (selector = '#myId:something')
  105. // $.escapeSelector does not exist in jQuery < 3
  106. selector = typeof $$$1.escapeSelector === 'function' ? $$$1.escapeSelector(selector).substr(1) : selector.replace(/(:|\.|\[|\]|,|=|@)/g, '\\$1');
  107. return selector;
  108. }
  109. /**
  110. * --------------------------------------------------------------------------
  111. * Public Util Api
  112. * --------------------------------------------------------------------------
  113. */
  114. var Util = {
  115. TRANSITION_END: 'bsTransitionEnd',
  116. getUID: function getUID(prefix) {
  117. do {
  118. // eslint-disable-next-line no-bitwise
  119. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  120. } while (document.getElementById(prefix));
  121. return prefix;
  122. },
  123. getSelectorFromElement: function getSelectorFromElement(element) {
  124. var selector = element.getAttribute('data-target');
  125. if (!selector || selector === '#') {
  126. selector = element.getAttribute('href') || '';
  127. } // If it's an ID
  128. if (selector.charAt(0) === '#') {
  129. selector = escapeId(selector);
  130. }
  131. try {
  132. var $selector = $$$1(document).find(selector);
  133. return $selector.length > 0 ? selector : null;
  134. } catch (err) {
  135. return null;
  136. }
  137. },
  138. reflow: function reflow(element) {
  139. return element.offsetHeight;
  140. },
  141. triggerTransitionEnd: function triggerTransitionEnd(element) {
  142. $$$1(element).trigger(transition.end);
  143. },
  144. supportsTransitionEnd: function supportsTransitionEnd() {
  145. return Boolean(transition);
  146. },
  147. isElement: function isElement(obj) {
  148. return (obj[0] || obj).nodeType;
  149. },
  150. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  151. for (var property in configTypes) {
  152. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  153. var expectedTypes = configTypes[property];
  154. var value = config[property];
  155. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  156. if (!new RegExp(expectedTypes).test(valueType)) {
  157. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  158. }
  159. }
  160. }
  161. }
  162. };
  163. setTransitionEndSupport();
  164. return Util;
  165. }($);
  166. /**
  167. * --------------------------------------------------------------------------
  168. * Bootstrap (v4.0.0): alert.js
  169. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  170. * --------------------------------------------------------------------------
  171. */
  172. var Alert = function ($$$1) {
  173. /**
  174. * ------------------------------------------------------------------------
  175. * Constants
  176. * ------------------------------------------------------------------------
  177. */
  178. var NAME = 'alert';
  179. var VERSION = '4.0.0';
  180. var DATA_KEY = 'bs.alert';
  181. var EVENT_KEY = "." + DATA_KEY;
  182. var DATA_API_KEY = '.data-api';
  183. var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
  184. var TRANSITION_DURATION = 150;
  185. var Selector = {
  186. DISMISS: '[data-dismiss="alert"]'
  187. };
  188. var Event = {
  189. CLOSE: "close" + EVENT_KEY,
  190. CLOSED: "closed" + EVENT_KEY,
  191. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  192. };
  193. var ClassName = {
  194. ALERT: 'alert',
  195. FADE: 'fade',
  196. SHOW: 'show'
  197. /**
  198. * ------------------------------------------------------------------------
  199. * Class Definition
  200. * ------------------------------------------------------------------------
  201. */
  202. };
  203. var Alert =
  204. /*#__PURE__*/
  205. function () {
  206. function Alert(element) {
  207. this._element = element;
  208. } // Getters
  209. var _proto = Alert.prototype;
  210. // Public
  211. _proto.close = function close(element) {
  212. element = element || this._element;
  213. var rootElement = this._getRootElement(element);
  214. var customEvent = this._triggerCloseEvent(rootElement);
  215. if (customEvent.isDefaultPrevented()) {
  216. return;
  217. }
  218. this._removeElement(rootElement);
  219. };
  220. _proto.dispose = function dispose() {
  221. $$$1.removeData(this._element, DATA_KEY);
  222. this._element = null;
  223. }; // Private
  224. _proto._getRootElement = function _getRootElement(element) {
  225. var selector = Util.getSelectorFromElement(element);
  226. var parent = false;
  227. if (selector) {
  228. parent = $$$1(selector)[0];
  229. }
  230. if (!parent) {
  231. parent = $$$1(element).closest("." + ClassName.ALERT)[0];
  232. }
  233. return parent;
  234. };
  235. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  236. var closeEvent = $$$1.Event(Event.CLOSE);
  237. $$$1(element).trigger(closeEvent);
  238. return closeEvent;
  239. };
  240. _proto._removeElement = function _removeElement(element) {
  241. var _this = this;
  242. $$$1(element).removeClass(ClassName.SHOW);
  243. if (!Util.supportsTransitionEnd() || !$$$1(element).hasClass(ClassName.FADE)) {
  244. this._destroyElement(element);
  245. return;
  246. }
  247. $$$1(element).one(Util.TRANSITION_END, function (event) {
  248. return _this._destroyElement(element, event);
  249. }).emulateTransitionEnd(TRANSITION_DURATION);
  250. };
  251. _proto._destroyElement = function _destroyElement(element) {
  252. $$$1(element).detach().trigger(Event.CLOSED).remove();
  253. }; // Static
  254. Alert._jQueryInterface = function _jQueryInterface(config) {
  255. return this.each(function () {
  256. var $element = $$$1(this);
  257. var data = $element.data(DATA_KEY);
  258. if (!data) {
  259. data = new Alert(this);
  260. $element.data(DATA_KEY, data);
  261. }
  262. if (config === 'close') {
  263. data[config](this);
  264. }
  265. });
  266. };
  267. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  268. return function (event) {
  269. if (event) {
  270. event.preventDefault();
  271. }
  272. alertInstance.close(this);
  273. };
  274. };
  275. _createClass(Alert, null, [{
  276. key: "VERSION",
  277. get: function get() {
  278. return VERSION;
  279. }
  280. }]);
  281. return Alert;
  282. }();
  283. /**
  284. * ------------------------------------------------------------------------
  285. * Data Api implementation
  286. * ------------------------------------------------------------------------
  287. */
  288. $$$1(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  289. /**
  290. * ------------------------------------------------------------------------
  291. * jQuery
  292. * ------------------------------------------------------------------------
  293. */
  294. $$$1.fn[NAME] = Alert._jQueryInterface;
  295. $$$1.fn[NAME].Constructor = Alert;
  296. $$$1.fn[NAME].noConflict = function () {
  297. $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
  298. return Alert._jQueryInterface;
  299. };
  300. return Alert;
  301. }($);
  302. /**
  303. * --------------------------------------------------------------------------
  304. * Bootstrap (v4.0.0): button.js
  305. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  306. * --------------------------------------------------------------------------
  307. */
  308. var Button = function ($$$1) {
  309. /**
  310. * ------------------------------------------------------------------------
  311. * Constants
  312. * ------------------------------------------------------------------------
  313. */
  314. var NAME = 'button';
  315. var VERSION = '4.0.0';
  316. var DATA_KEY = 'bs.button';
  317. var EVENT_KEY = "." + DATA_KEY;
  318. var DATA_API_KEY = '.data-api';
  319. var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
  320. var ClassName = {
  321. ACTIVE: 'active',
  322. BUTTON: 'btn',
  323. FOCUS: 'focus'
  324. };
  325. var Selector = {
  326. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  327. DATA_TOGGLE: '[data-toggle="buttons"]',
  328. INPUT: 'input',
  329. ACTIVE: '.active',
  330. BUTTON: '.btn'
  331. };
  332. var Event = {
  333. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY,
  334. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY + DATA_API_KEY + " " + ("blur" + EVENT_KEY + DATA_API_KEY)
  335. /**
  336. * ------------------------------------------------------------------------
  337. * Class Definition
  338. * ------------------------------------------------------------------------
  339. */
  340. };
  341. var Button =
  342. /*#__PURE__*/
  343. function () {
  344. function Button(element) {
  345. this._element = element;
  346. } // Getters
  347. var _proto = Button.prototype;
  348. // Public
  349. _proto.toggle = function toggle() {
  350. var triggerChangeEvent = true;
  351. var addAriaPressed = true;
  352. var rootElement = $$$1(this._element).closest(Selector.DATA_TOGGLE)[0];
  353. if (rootElement) {
  354. var input = $$$1(this._element).find(Selector.INPUT)[0];
  355. if (input) {
  356. if (input.type === 'radio') {
  357. if (input.checked && $$$1(this._element).hasClass(ClassName.ACTIVE)) {
  358. triggerChangeEvent = false;
  359. } else {
  360. var activeElement = $$$1(rootElement).find(Selector.ACTIVE)[0];
  361. if (activeElement) {
  362. $$$1(activeElement).removeClass(ClassName.ACTIVE);
  363. }
  364. }
  365. }
  366. if (triggerChangeEvent) {
  367. if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
  368. return;
  369. }
  370. input.checked = !$$$1(this._element).hasClass(ClassName.ACTIVE);
  371. $$$1(input).trigger('change');
  372. }
  373. input.focus();
  374. addAriaPressed = false;
  375. }
  376. }
  377. if (addAriaPressed) {
  378. this._element.setAttribute('aria-pressed', !$$$1(this._element).hasClass(ClassName.ACTIVE));
  379. }
  380. if (triggerChangeEvent) {
  381. $$$1(this._element).toggleClass(ClassName.ACTIVE);
  382. }
  383. };
  384. _proto.dispose = function dispose() {
  385. $$$1.removeData(this._element, DATA_KEY);
  386. this._element = null;
  387. }; // Static
  388. Button._jQueryInterface = function _jQueryInterface(config) {
  389. return this.each(function () {
  390. var data = $$$1(this).data(DATA_KEY);
  391. if (!data) {
  392. data = new Button(this);
  393. $$$1(this).data(DATA_KEY, data);
  394. }
  395. if (config === 'toggle') {
  396. data[config]();
  397. }
  398. });
  399. };
  400. _createClass(Button, null, [{
  401. key: "VERSION",
  402. get: function get() {
  403. return VERSION;
  404. }
  405. }]);
  406. return Button;
  407. }();
  408. /**
  409. * ------------------------------------------------------------------------
  410. * Data Api implementation
  411. * ------------------------------------------------------------------------
  412. */
  413. $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
  414. event.preventDefault();
  415. var button = event.target;
  416. if (!$$$1(button).hasClass(ClassName.BUTTON)) {
  417. button = $$$1(button).closest(Selector.BUTTON);
  418. }
  419. Button._jQueryInterface.call($$$1(button), 'toggle');
  420. }).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
  421. var button = $$$1(event.target).closest(Selector.BUTTON)[0];
  422. $$$1(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
  423. });
  424. /**
  425. * ------------------------------------------------------------------------
  426. * jQuery
  427. * ------------------------------------------------------------------------
  428. */
  429. $$$1.fn[NAME] = Button._jQueryInterface;
  430. $$$1.fn[NAME].Constructor = Button;
  431. $$$1.fn[NAME].noConflict = function () {
  432. $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
  433. return Button._jQueryInterface;
  434. };
  435. return Button;
  436. }($);
  437. /**
  438. * --------------------------------------------------------------------------
  439. * Bootstrap (v4.0.0): carousel.js
  440. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  441. * --------------------------------------------------------------------------
  442. */
  443. var Carousel = function ($$$1) {
  444. /**
  445. * ------------------------------------------------------------------------
  446. * Constants
  447. * ------------------------------------------------------------------------
  448. */
  449. var NAME = 'carousel';
  450. var VERSION = '4.0.0';
  451. var DATA_KEY = 'bs.carousel';
  452. var EVENT_KEY = "." + DATA_KEY;
  453. var DATA_API_KEY = '.data-api';
  454. var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
  455. var TRANSITION_DURATION = 600;
  456. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  457. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  458. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  459. var Default = {
  460. interval: 5000,
  461. keyboard: true,
  462. slide: false,
  463. pause: 'hover',
  464. wrap: true
  465. };
  466. var DefaultType = {
  467. interval: '(number|boolean)',
  468. keyboard: 'boolean',
  469. slide: '(boolean|string)',
  470. pause: '(string|boolean)',
  471. wrap: 'boolean'
  472. };
  473. var Direction = {
  474. NEXT: 'next',
  475. PREV: 'prev',
  476. LEFT: 'left',
  477. RIGHT: 'right'
  478. };
  479. var Event = {
  480. SLIDE: "slide" + EVENT_KEY,
  481. SLID: "slid" + EVENT_KEY,
  482. KEYDOWN: "keydown" + EVENT_KEY,
  483. MOUSEENTER: "mouseenter" + EVENT_KEY,
  484. MOUSELEAVE: "mouseleave" + EVENT_KEY,
  485. TOUCHEND: "touchend" + EVENT_KEY,
  486. LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY,
  487. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  488. };
  489. var ClassName = {
  490. CAROUSEL: 'carousel',
  491. ACTIVE: 'active',
  492. SLIDE: 'slide',
  493. RIGHT: 'carousel-item-right',
  494. LEFT: 'carousel-item-left',
  495. NEXT: 'carousel-item-next',
  496. PREV: 'carousel-item-prev',
  497. ITEM: 'carousel-item'
  498. };
  499. var Selector = {
  500. ACTIVE: '.active',
  501. ACTIVE_ITEM: '.active.carousel-item',
  502. ITEM: '.carousel-item',
  503. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  504. INDICATORS: '.carousel-indicators',
  505. DATA_SLIDE: '[data-slide], [data-slide-to]',
  506. DATA_RIDE: '[data-ride="carousel"]'
  507. /**
  508. * ------------------------------------------------------------------------
  509. * Class Definition
  510. * ------------------------------------------------------------------------
  511. */
  512. };
  513. var Carousel =
  514. /*#__PURE__*/
  515. function () {
  516. function Carousel(element, config) {
  517. this._items = null;
  518. this._interval = null;
  519. this._activeElement = null;
  520. this._isPaused = false;
  521. this._isSliding = false;
  522. this.touchTimeout = null;
  523. this._config = this._getConfig(config);
  524. this._element = $$$1(element)[0];
  525. this._indicatorsElement = $$$1(this._element).find(Selector.INDICATORS)[0];
  526. this._addEventListeners();
  527. } // Getters
  528. var _proto = Carousel.prototype;
  529. // Public
  530. _proto.next = function next() {
  531. if (!this._isSliding) {
  532. this._slide(Direction.NEXT);
  533. }
  534. };
  535. _proto.nextWhenVisible = function nextWhenVisible() {
  536. // Don't call next when the page isn't visible
  537. // or the carousel or its parent isn't visible
  538. if (!document.hidden && $$$1(this._element).is(':visible') && $$$1(this._element).css('visibility') !== 'hidden') {
  539. this.next();
  540. }
  541. };
  542. _proto.prev = function prev() {
  543. if (!this._isSliding) {
  544. this._slide(Direction.PREV);
  545. }
  546. };
  547. _proto.pause = function pause(event) {
  548. if (!event) {
  549. this._isPaused = true;
  550. }
  551. if ($$$1(this._element).find(Selector.NEXT_PREV)[0] && Util.supportsTransitionEnd()) {
  552. Util.triggerTransitionEnd(this._element);
  553. this.cycle(true);
  554. }
  555. clearInterval(this._interval);
  556. this._interval = null;
  557. };
  558. _proto.cycle = function cycle(event) {
  559. if (!event) {
  560. this._isPaused = false;
  561. }
  562. if (this._interval) {
  563. clearInterval(this._interval);
  564. this._interval = null;
  565. }
  566. if (this._config.interval && !this._isPaused) {
  567. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  568. }
  569. };
  570. _proto.to = function to(index) {
  571. var _this = this;
  572. this._activeElement = $$$1(this._element).find(Selector.ACTIVE_ITEM)[0];
  573. var activeIndex = this._getItemIndex(this._activeElement);
  574. if (index > this._items.length - 1 || index < 0) {
  575. return;
  576. }
  577. if (this._isSliding) {
  578. $$$1(this._element).one(Event.SLID, function () {
  579. return _this.to(index);
  580. });
  581. return;
  582. }
  583. if (activeIndex === index) {
  584. this.pause();
  585. this.cycle();
  586. return;
  587. }
  588. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  589. this._slide(direction, this._items[index]);
  590. };
  591. _proto.dispose = function dispose() {
  592. $$$1(this._element).off(EVENT_KEY);
  593. $$$1.removeData(this._element, DATA_KEY);
  594. this._items = null;
  595. this._config = null;
  596. this._element = null;
  597. this._interval = null;
  598. this._isPaused = null;
  599. this._isSliding = null;
  600. this._activeElement = null;
  601. this._indicatorsElement = null;
  602. }; // Private
  603. _proto._getConfig = function _getConfig(config) {
  604. config = _extends({}, Default, config);
  605. Util.typeCheckConfig(NAME, config, DefaultType);
  606. return config;
  607. };
  608. _proto._addEventListeners = function _addEventListeners() {
  609. var _this2 = this;
  610. if (this._config.keyboard) {
  611. $$$1(this._element).on(Event.KEYDOWN, function (event) {
  612. return _this2._keydown(event);
  613. });
  614. }
  615. if (this._config.pause === 'hover') {
  616. $$$1(this._element).on(Event.MOUSEENTER, function (event) {
  617. return _this2.pause(event);
  618. }).on(Event.MOUSELEAVE, function (event) {
  619. return _this2.cycle(event);
  620. });
  621. if ('ontouchstart' in document.documentElement) {
  622. // If it's a touch-enabled device, mouseenter/leave are fired as
  623. // part of the mouse compatibility events on first tap - the carousel
  624. // would stop cycling until user tapped out of it;
  625. // here, we listen for touchend, explicitly pause the carousel
  626. // (as if it's the second time we tap on it, mouseenter compat event
  627. // is NOT fired) and after a timeout (to allow for mouse compatibility
  628. // events to fire) we explicitly restart cycling
  629. $$$1(this._element).on(Event.TOUCHEND, function () {
  630. _this2.pause();
  631. if (_this2.touchTimeout) {
  632. clearTimeout(_this2.touchTimeout);
  633. }
  634. _this2.touchTimeout = setTimeout(function (event) {
  635. return _this2.cycle(event);
  636. }, TOUCHEVENT_COMPAT_WAIT + _this2._config.interval);
  637. });
  638. }
  639. }
  640. };
  641. _proto._keydown = function _keydown(event) {
  642. if (/input|textarea/i.test(event.target.tagName)) {
  643. return;
  644. }
  645. switch (event.which) {
  646. case ARROW_LEFT_KEYCODE:
  647. event.preventDefault();
  648. this.prev();
  649. break;
  650. case ARROW_RIGHT_KEYCODE:
  651. event.preventDefault();
  652. this.next();
  653. break;
  654. default:
  655. }
  656. };
  657. _proto._getItemIndex = function _getItemIndex(element) {
  658. this._items = $$$1.makeArray($$$1(element).parent().find(Selector.ITEM));
  659. return this._items.indexOf(element);
  660. };
  661. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  662. var isNextDirection = direction === Direction.NEXT;
  663. var isPrevDirection = direction === Direction.PREV;
  664. var activeIndex = this._getItemIndex(activeElement);
  665. var lastItemIndex = this._items.length - 1;
  666. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  667. if (isGoingToWrap && !this._config.wrap) {
  668. return activeElement;
  669. }
  670. var delta = direction === Direction.PREV ? -1 : 1;
  671. var itemIndex = (activeIndex + delta) % this._items.length;
  672. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  673. };
  674. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  675. var targetIndex = this._getItemIndex(relatedTarget);
  676. var fromIndex = this._getItemIndex($$$1(this._element).find(Selector.ACTIVE_ITEM)[0]);
  677. var slideEvent = $$$1.Event(Event.SLIDE, {
  678. relatedTarget: relatedTarget,
  679. direction: eventDirectionName,
  680. from: fromIndex,
  681. to: targetIndex
  682. });
  683. $$$1(this._element).trigger(slideEvent);
  684. return slideEvent;
  685. };
  686. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  687. if (this._indicatorsElement) {
  688. $$$1(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
  689. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  690. if (nextIndicator) {
  691. $$$1(nextIndicator).addClass(ClassName.ACTIVE);
  692. }
  693. }
  694. };
  695. _proto._slide = function _slide(direction, element) {
  696. var _this3 = this;
  697. var activeElement = $$$1(this._element).find(Selector.ACTIVE_ITEM)[0];
  698. var activeElementIndex = this._getItemIndex(activeElement);
  699. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  700. var nextElementIndex = this._getItemIndex(nextElement);
  701. var isCycling = Boolean(this._interval);
  702. var directionalClassName;
  703. var orderClassName;
  704. var eventDirectionName;
  705. if (direction === Direction.NEXT) {
  706. directionalClassName = ClassName.LEFT;
  707. orderClassName = ClassName.NEXT;
  708. eventDirectionName = Direction.LEFT;
  709. } else {
  710. directionalClassName = ClassName.RIGHT;
  711. orderClassName = ClassName.PREV;
  712. eventDirectionName = Direction.RIGHT;
  713. }
  714. if (nextElement && $$$1(nextElement).hasClass(ClassName.ACTIVE)) {
  715. this._isSliding = false;
  716. return;
  717. }
  718. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  719. if (slideEvent.isDefaultPrevented()) {
  720. return;
  721. }
  722. if (!activeElement || !nextElement) {
  723. // Some weirdness is happening, so we bail
  724. return;
  725. }
  726. this._isSliding = true;
  727. if (isCycling) {
  728. this.pause();
  729. }
  730. this._setActiveIndicatorElement(nextElement);
  731. var slidEvent = $$$1.Event(Event.SLID, {
  732. relatedTarget: nextElement,
  733. direction: eventDirectionName,
  734. from: activeElementIndex,
  735. to: nextElementIndex
  736. });
  737. if (Util.supportsTransitionEnd() && $$$1(this._element).hasClass(ClassName.SLIDE)) {
  738. $$$1(nextElement).addClass(orderClassName);
  739. Util.reflow(nextElement);
  740. $$$1(activeElement).addClass(directionalClassName);
  741. $$$1(nextElement).addClass(directionalClassName);
  742. $$$1(activeElement).one(Util.TRANSITION_END, function () {
  743. $$$1(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName.ACTIVE);
  744. $$$1(activeElement).removeClass(ClassName.ACTIVE + " " + orderClassName + " " + directionalClassName);
  745. _this3._isSliding = false;
  746. setTimeout(function () {
  747. return $$$1(_this3._element).trigger(slidEvent);
  748. }, 0);
  749. }).emulateTransitionEnd(TRANSITION_DURATION);
  750. } else {
  751. $$$1(activeElement).removeClass(ClassName.ACTIVE);
  752. $$$1(nextElement).addClass(ClassName.ACTIVE);
  753. this._isSliding = false;
  754. $$$1(this._element).trigger(slidEvent);
  755. }
  756. if (isCycling) {
  757. this.cycle();
  758. }
  759. }; // Static
  760. Carousel._jQueryInterface = function _jQueryInterface(config) {
  761. return this.each(function () {
  762. var data = $$$1(this).data(DATA_KEY);
  763. var _config = _extends({}, Default, $$$1(this).data());
  764. if (typeof config === 'object') {
  765. _config = _extends({}, _config, config);
  766. }
  767. var action = typeof config === 'string' ? config : _config.slide;
  768. if (!data) {
  769. data = new Carousel(this, _config);
  770. $$$1(this).data(DATA_KEY, data);
  771. }
  772. if (typeof config === 'number') {
  773. data.to(config);
  774. } else if (typeof action === 'string') {
  775. if (typeof data[action] === 'undefined') {
  776. throw new TypeError("No method named \"" + action + "\"");
  777. }
  778. data[action]();
  779. } else if (_config.interval) {
  780. data.pause();
  781. data.cycle();
  782. }
  783. });
  784. };
  785. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  786. var selector = Util.getSelectorFromElement(this);
  787. if (!selector) {
  788. return;
  789. }
  790. var target = $$$1(selector)[0];
  791. if (!target || !$$$1(target).hasClass(ClassName.CAROUSEL)) {
  792. return;
  793. }
  794. var config = _extends({}, $$$1(target).data(), $$$1(this).data());
  795. var slideIndex = this.getAttribute('data-slide-to');
  796. if (slideIndex) {
  797. config.interval = false;
  798. }
  799. Carousel._jQueryInterface.call($$$1(target), config);
  800. if (slideIndex) {
  801. $$$1(target).data(DATA_KEY).to(slideIndex);
  802. }
  803. event.preventDefault();
  804. };
  805. _createClass(Carousel, null, [{
  806. key: "VERSION",
  807. get: function get() {
  808. return VERSION;
  809. }
  810. }, {
  811. key: "Default",
  812. get: function get() {
  813. return Default;
  814. }
  815. }]);
  816. return Carousel;
  817. }();
  818. /**
  819. * ------------------------------------------------------------------------
  820. * Data Api implementation
  821. * ------------------------------------------------------------------------
  822. */
  823. $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
  824. $$$1(window).on(Event.LOAD_DATA_API, function () {
  825. $$$1(Selector.DATA_RIDE).each(function () {
  826. var $carousel = $$$1(this);
  827. Carousel._jQueryInterface.call($carousel, $carousel.data());
  828. });
  829. });
  830. /**
  831. * ------------------------------------------------------------------------
  832. * jQuery
  833. * ------------------------------------------------------------------------
  834. */
  835. $$$1.fn[NAME] = Carousel._jQueryInterface;
  836. $$$1.fn[NAME].Constructor = Carousel;
  837. $$$1.fn[NAME].noConflict = function () {
  838. $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
  839. return Carousel._jQueryInterface;
  840. };
  841. return Carousel;
  842. }($);
  843. /**
  844. * --------------------------------------------------------------------------
  845. * Bootstrap (v4.0.0): collapse.js
  846. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  847. * --------------------------------------------------------------------------
  848. */
  849. var Collapse = function ($$$1) {
  850. /**
  851. * ------------------------------------------------------------------------
  852. * Constants
  853. * ------------------------------------------------------------------------
  854. */
  855. var NAME = 'collapse';
  856. var VERSION = '4.0.0';
  857. var DATA_KEY = 'bs.collapse';
  858. var EVENT_KEY = "." + DATA_KEY;
  859. var DATA_API_KEY = '.data-api';
  860. var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
  861. var TRANSITION_DURATION = 600;
  862. var Default = {
  863. toggle: true,
  864. parent: ''
  865. };
  866. var DefaultType = {
  867. toggle: 'boolean',
  868. parent: '(string|element)'
  869. };
  870. var Event = {
  871. SHOW: "show" + EVENT_KEY,
  872. SHOWN: "shown" + EVENT_KEY,
  873. HIDE: "hide" + EVENT_KEY,
  874. HIDDEN: "hidden" + EVENT_KEY,
  875. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  876. };
  877. var ClassName = {
  878. SHOW: 'show',
  879. COLLAPSE: 'collapse',
  880. COLLAPSING: 'collapsing',
  881. COLLAPSED: 'collapsed'
  882. };
  883. var Dimension = {
  884. WIDTH: 'width',
  885. HEIGHT: 'height'
  886. };
  887. var Selector = {
  888. ACTIVES: '.show, .collapsing',
  889. DATA_TOGGLE: '[data-toggle="collapse"]'
  890. /**
  891. * ------------------------------------------------------------------------
  892. * Class Definition
  893. * ------------------------------------------------------------------------
  894. */
  895. };
  896. var Collapse =
  897. /*#__PURE__*/
  898. function () {
  899. function Collapse(element, config) {
  900. this._isTransitioning = false;
  901. this._element = element;
  902. this._config = this._getConfig(config);
  903. this._triggerArray = $$$1.makeArray($$$1("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  904. var tabToggles = $$$1(Selector.DATA_TOGGLE);
  905. for (var i = 0; i < tabToggles.length; i++) {
  906. var elem = tabToggles[i];
  907. var selector = Util.getSelectorFromElement(elem);
  908. if (selector !== null && $$$1(selector).filter(element).length > 0) {
  909. this._selector = selector;
  910. this._triggerArray.push(elem);
  911. }
  912. }
  913. this._parent = this._config.parent ? this._getParent() : null;
  914. if (!this._config.parent) {
  915. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  916. }
  917. if (this._config.toggle) {
  918. this.toggle();
  919. }
  920. } // Getters
  921. var _proto = Collapse.prototype;
  922. // Public
  923. _proto.toggle = function toggle() {
  924. if ($$$1(this._element).hasClass(ClassName.SHOW)) {
  925. this.hide();
  926. } else {
  927. this.show();
  928. }
  929. };
  930. _proto.show = function show() {
  931. var _this = this;
  932. if (this._isTransitioning || $$$1(this._element).hasClass(ClassName.SHOW)) {
  933. return;
  934. }
  935. var actives;
  936. var activesData;
  937. if (this._parent) {
  938. actives = $$$1.makeArray($$$1(this._parent).find(Selector.ACTIVES).filter("[data-parent=\"" + this._config.parent + "\"]"));
  939. if (actives.length === 0) {
  940. actives = null;
  941. }
  942. }
  943. if (actives) {
  944. activesData = $$$1(actives).not(this._selector).data(DATA_KEY);
  945. if (activesData && activesData._isTransitioning) {
  946. return;
  947. }
  948. }
  949. var startEvent = $$$1.Event(Event.SHOW);
  950. $$$1(this._element).trigger(startEvent);
  951. if (startEvent.isDefaultPrevented()) {
  952. return;
  953. }
  954. if (actives) {
  955. Collapse._jQueryInterface.call($$$1(actives).not(this._selector), 'hide');
  956. if (!activesData) {
  957. $$$1(actives).data(DATA_KEY, null);
  958. }
  959. }
  960. var dimension = this._getDimension();
  961. $$$1(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
  962. this._element.style[dimension] = 0;
  963. if (this._triggerArray.length > 0) {
  964. $$$1(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
  965. }
  966. this.setTransitioning(true);
  967. var complete = function complete() {
  968. $$$1(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW);
  969. _this._element.style[dimension] = '';
  970. _this.setTransitioning(false);
  971. $$$1(_this._element).trigger(Event.SHOWN);
  972. };
  973. if (!Util.supportsTransitionEnd()) {
  974. complete();
  975. return;
  976. }
  977. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  978. var scrollSize = "scroll" + capitalizedDimension;
  979. $$$1(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  980. this._element.style[dimension] = this._element[scrollSize] + "px";
  981. };
  982. _proto.hide = function hide() {
  983. var _this2 = this;
  984. if (this._isTransitioning || !$$$1(this._element).hasClass(ClassName.SHOW)) {
  985. return;
  986. }
  987. var startEvent = $$$1.Event(Event.HIDE);
  988. $$$1(this._element).trigger(startEvent);
  989. if (startEvent.isDefaultPrevented()) {
  990. return;
  991. }
  992. var dimension = this._getDimension();
  993. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  994. Util.reflow(this._element);
  995. $$$1(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
  996. if (this._triggerArray.length > 0) {
  997. for (var i = 0; i < this._triggerArray.length; i++) {
  998. var trigger = this._triggerArray[i];
  999. var selector = Util.getSelectorFromElement(trigger);
  1000. if (selector !== null) {
  1001. var $elem = $$$1(selector);
  1002. if (!$elem.hasClass(ClassName.SHOW)) {
  1003. $$$1(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
  1004. }
  1005. }
  1006. }
  1007. }
  1008. this.setTransitioning(true);
  1009. var complete = function complete() {
  1010. _this2.setTransitioning(false);
  1011. $$$1(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
  1012. };
  1013. this._element.style[dimension] = '';
  1014. if (!Util.supportsTransitionEnd()) {
  1015. complete();
  1016. return;
  1017. }
  1018. $$$1(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  1019. };
  1020. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  1021. this._isTransitioning = isTransitioning;
  1022. };
  1023. _proto.dispose = function dispose() {
  1024. $$$1.removeData(this._element, DATA_KEY);
  1025. this._config = null;
  1026. this._parent = null;
  1027. this._element = null;
  1028. this._triggerArray = null;
  1029. this._isTransitioning = null;
  1030. }; // Private
  1031. _proto._getConfig = function _getConfig(config) {
  1032. config = _extends({}, Default, config);
  1033. config.toggle = Boolean(config.toggle); // Coerce string values
  1034. Util.typeCheckConfig(NAME, config, DefaultType);
  1035. return config;
  1036. };
  1037. _proto._getDimension = function _getDimension() {
  1038. var hasWidth = $$$1(this._element).hasClass(Dimension.WIDTH);
  1039. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  1040. };
  1041. _proto._getParent = function _getParent() {
  1042. var _this3 = this;
  1043. var parent = null;
  1044. if (Util.isElement(this._config.parent)) {
  1045. parent = this._config.parent; // It's a jQuery object
  1046. if (typeof this._config.parent.jquery !== 'undefined') {
  1047. parent = this._config.parent[0];
  1048. }
  1049. } else {
  1050. parent = $$$1(this._config.parent)[0];
  1051. }
  1052. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  1053. $$$1(parent).find(selector).each(function (i, element) {
  1054. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  1055. });
  1056. return parent;
  1057. };
  1058. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  1059. if (element) {
  1060. var isOpen = $$$1(element).hasClass(ClassName.SHOW);
  1061. if (triggerArray.length > 0) {
  1062. $$$1(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  1063. }
  1064. }
  1065. }; // Static
  1066. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  1067. var selector = Util.getSelectorFromElement(element);
  1068. return selector ? $$$1(selector)[0] : null;
  1069. };
  1070. Collapse._jQueryInterface = function _jQueryInterface(config) {
  1071. return this.each(function () {
  1072. var $this = $$$1(this);
  1073. var data = $this.data(DATA_KEY);
  1074. var _config = _extends({}, Default, $this.data(), typeof config === 'object' && config);
  1075. if (!data && _config.toggle && /show|hide/.test(config)) {
  1076. _config.toggle = false;
  1077. }
  1078. if (!data) {
  1079. data = new Collapse(this, _config);
  1080. $this.data(DATA_KEY, data);
  1081. }
  1082. if (typeof config === 'string') {
  1083. if (typeof data[config] === 'undefined') {
  1084. throw new TypeError("No method named \"" + config + "\"");
  1085. }
  1086. data[config]();
  1087. }
  1088. });
  1089. };
  1090. _createClass(Collapse, null, [{
  1091. key: "VERSION",
  1092. get: function get() {
  1093. return VERSION;
  1094. }
  1095. }, {
  1096. key: "Default",
  1097. get: function get() {
  1098. return Default;
  1099. }
  1100. }]);
  1101. return Collapse;
  1102. }();
  1103. /**
  1104. * ------------------------------------------------------------------------
  1105. * Data Api implementation
  1106. * ------------------------------------------------------------------------
  1107. */
  1108. $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  1109. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  1110. if (event.currentTarget.tagName === 'A') {
  1111. event.preventDefault();
  1112. }
  1113. var $trigger = $$$1(this);
  1114. var selector = Util.getSelectorFromElement(this);
  1115. $$$1(selector).each(function () {
  1116. var $target = $$$1(this);
  1117. var data = $target.data(DATA_KEY);
  1118. var config = data ? 'toggle' : $trigger.data();
  1119. Collapse._jQueryInterface.call($target, config);
  1120. });
  1121. });
  1122. /**
  1123. * ------------------------------------------------------------------------
  1124. * jQuery
  1125. * ------------------------------------------------------------------------
  1126. */
  1127. $$$1.fn[NAME] = Collapse._jQueryInterface;
  1128. $$$1.fn[NAME].Constructor = Collapse;
  1129. $$$1.fn[NAME].noConflict = function () {
  1130. $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
  1131. return Collapse._jQueryInterface;
  1132. };
  1133. return Collapse;
  1134. }($);
  1135. /**
  1136. * --------------------------------------------------------------------------
  1137. * Bootstrap (v4.0.0): dropdown.js
  1138. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1139. * --------------------------------------------------------------------------
  1140. */
  1141. var Dropdown = function ($$$1) {
  1142. /**
  1143. * ------------------------------------------------------------------------
  1144. * Constants
  1145. * ------------------------------------------------------------------------
  1146. */
  1147. var NAME = 'dropdown';
  1148. var VERSION = '4.0.0';
  1149. var DATA_KEY = 'bs.dropdown';
  1150. var EVENT_KEY = "." + DATA_KEY;
  1151. var DATA_API_KEY = '.data-api';
  1152. var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
  1153. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  1154. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  1155. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  1156. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  1157. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  1158. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  1159. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  1160. var Event = {
  1161. HIDE: "hide" + EVENT_KEY,
  1162. HIDDEN: "hidden" + EVENT_KEY,
  1163. SHOW: "show" + EVENT_KEY,
  1164. SHOWN: "shown" + EVENT_KEY,
  1165. CLICK: "click" + EVENT_KEY,
  1166. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY,
  1167. KEYDOWN_DATA_API: "keydown" + EVENT_KEY + DATA_API_KEY,
  1168. KEYUP_DATA_API: "keyup" + EVENT_KEY + DATA_API_KEY
  1169. };
  1170. var ClassName = {
  1171. DISABLED: 'disabled',
  1172. SHOW: 'show',
  1173. DROPUP: 'dropup',
  1174. DROPRIGHT: 'dropright',
  1175. DROPLEFT: 'dropleft',
  1176. MENURIGHT: 'dropdown-menu-right',
  1177. MENULEFT: 'dropdown-menu-left',
  1178. POSITION_STATIC: 'position-static'
  1179. };
  1180. var Selector = {
  1181. DATA_TOGGLE: '[data-toggle="dropdown"]',
  1182. FORM_CHILD: '.dropdown form',
  1183. MENU: '.dropdown-menu',
  1184. NAVBAR_NAV: '.navbar-nav',
  1185. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled)'
  1186. };
  1187. var AttachmentMap = {
  1188. TOP: 'top-start',
  1189. TOPEND: 'top-end',
  1190. BOTTOM: 'bottom-start',
  1191. BOTTOMEND: 'bottom-end',
  1192. RIGHT: 'right-start',
  1193. RIGHTEND: 'right-end',
  1194. LEFT: 'left-start',
  1195. LEFTEND: 'left-end'
  1196. };
  1197. var Default = {
  1198. offset: 0,
  1199. flip: true,
  1200. boundary: 'scrollParent'
  1201. };
  1202. var DefaultType = {
  1203. offset: '(number|string|function)',
  1204. flip: 'boolean',
  1205. boundary: '(string|element)'
  1206. /**
  1207. * ------------------------------------------------------------------------
  1208. * Class Definition
  1209. * ------------------------------------------------------------------------
  1210. */
  1211. };
  1212. var Dropdown =
  1213. /*#__PURE__*/
  1214. function () {
  1215. function Dropdown(element, config) {
  1216. this._element = element;
  1217. this._popper = null;
  1218. this._config = this._getConfig(config);
  1219. this._menu = this._getMenuElement();
  1220. this._inNavbar = this._detectNavbar();
  1221. this._addEventListeners();
  1222. } // Getters
  1223. var _proto = Dropdown.prototype;
  1224. // Public
  1225. _proto.toggle = function toggle() {
  1226. if (this._element.disabled || $$$1(this._element).hasClass(ClassName.DISABLED)) {
  1227. return;
  1228. }
  1229. var parent = Dropdown._getParentFromElement(this._element);
  1230. var isActive = $$$1(this._menu).hasClass(ClassName.SHOW);
  1231. Dropdown._clearMenus();
  1232. if (isActive) {
  1233. return;
  1234. }
  1235. var relatedTarget = {
  1236. relatedTarget: this._element
  1237. };
  1238. var showEvent = $$$1.Event(Event.SHOW, relatedTarget);
  1239. $$$1(parent).trigger(showEvent);
  1240. if (showEvent.isDefaultPrevented()) {
  1241. return;
  1242. } // Disable totally Popper.js for Dropdown in Navbar
  1243. if (!this._inNavbar) {
  1244. /**
  1245. * Check for Popper dependency
  1246. * Popper - https://popper.js.org
  1247. */
  1248. if (typeof Popper === 'undefined') {
  1249. throw new TypeError('Bootstrap dropdown require Popper.js (https://popper.js.org)');
  1250. }
  1251. var element = this._element; // For dropup with alignment we use the parent as popper container
  1252. if ($$$1(parent).hasClass(ClassName.DROPUP)) {
  1253. if ($$$1(this._menu).hasClass(ClassName.MENULEFT) || $$$1(this._menu).hasClass(ClassName.MENURIGHT)) {
  1254. element = parent;
  1255. }
  1256. } // If boundary is not `scrollParent`, then set position to `static`
  1257. // to allow the menu to "escape" the scroll parent's boundaries
  1258. // https://github.com/twbs/bootstrap/issues/24251
  1259. if (this._config.boundary !== 'scrollParent') {
  1260. $$$1(parent).addClass(ClassName.POSITION_STATIC);
  1261. }
  1262. this._popper = new Popper(element, this._menu, this._getPopperConfig());
  1263. } // If this is a touch-enabled device we add extra
  1264. // empty mouseover listeners to the body's immediate children;
  1265. // only needed because of broken event delegation on iOS
  1266. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  1267. if ('ontouchstart' in document.documentElement && $$$1(parent).closest(Selector.NAVBAR_NAV).length === 0) {
  1268. $$$1('body').children().on('mouseover', null, $$$1.noop);
  1269. }
  1270. this._element.focus();
  1271. this._element.setAttribute('aria-expanded', true);
  1272. $$$1(this._menu).toggleClass(ClassName.SHOW);
  1273. $$$1(parent).toggleClass(ClassName.SHOW).trigger($$$1.Event(Event.SHOWN, relatedTarget));
  1274. };
  1275. _proto.dispose = function dispose() {
  1276. $$$1.removeData(this._element, DATA_KEY);
  1277. $$$1(this._element).off(EVENT_KEY);
  1278. this._element = null;
  1279. this._menu = null;
  1280. if (this._popper !== null) {
  1281. this._popper.destroy();
  1282. this._popper = null;
  1283. }
  1284. };
  1285. _proto.update = function update() {
  1286. this._inNavbar = this._detectNavbar();
  1287. if (this._popper !== null) {
  1288. this._popper.scheduleUpdate();
  1289. }
  1290. }; // Private
  1291. _proto._addEventListeners = function _addEventListeners() {
  1292. var _this = this;
  1293. $$$1(this._element).on(Event.CLICK, function (event) {
  1294. event.preventDefault();
  1295. event.stopPropagation();
  1296. _this.toggle();
  1297. });
  1298. };
  1299. _proto._getConfig = function _getConfig(config) {
  1300. config = _extends({}, this.constructor.Default, $$$1(this._element).data(), config);
  1301. Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
  1302. return config;
  1303. };
  1304. _proto._getMenuElement = function _getMenuElement() {
  1305. if (!this._menu) {
  1306. var parent = Dropdown._getParentFromElement(this._element);
  1307. this._menu = $$$1(parent).find(Selector.MENU)[0];
  1308. }
  1309. return this._menu;
  1310. };
  1311. _proto._getPlacement = function _getPlacement() {
  1312. var $parentDropdown = $$$1(this._element).parent();
  1313. var placement = AttachmentMap.BOTTOM; // Handle dropup
  1314. if ($parentDropdown.hasClass(ClassName.DROPUP)) {
  1315. placement = AttachmentMap.TOP;
  1316. if ($$$1(this._menu).hasClass(ClassName.MENURIGHT)) {
  1317. placement = AttachmentMap.TOPEND;
  1318. }
  1319. } else if ($parentDropdown.hasClass(ClassName.DROPRIGHT)) {
  1320. placement = AttachmentMap.RIGHT;
  1321. } else if ($parentDropdown.hasClass(ClassName.DROPLEFT)) {
  1322. placement = AttachmentMap.LEFT;
  1323. } else if ($$$1(this._menu).hasClass(ClassName.MENURIGHT)) {
  1324. placement = AttachmentMap.BOTTOMEND;
  1325. }
  1326. return placement;
  1327. };
  1328. _proto._detectNavbar = function _detectNavbar() {
  1329. return $$$1(this._element).closest('.navbar').length > 0;
  1330. };
  1331. _proto._getPopperConfig = function _getPopperConfig() {
  1332. var _this2 = this;
  1333. var offsetConf = {};
  1334. if (typeof this._config.offset === 'function') {
  1335. offsetConf.fn = function (data) {
  1336. data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets) || {});
  1337. return data;
  1338. };
  1339. } else {
  1340. offsetConf.offset = this._config.offset;
  1341. }
  1342. var popperConfig = {
  1343. placement: this._getPlacement(),
  1344. modifiers: {
  1345. offset: offsetConf,
  1346. flip: {
  1347. enabled: this._config.flip
  1348. },
  1349. preventOverflow: {
  1350. boundariesElement: this._config.boundary
  1351. }
  1352. }
  1353. };
  1354. return popperConfig;
  1355. }; // Static
  1356. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  1357. return this.each(function () {
  1358. var data = $$$1(this).data(DATA_KEY);
  1359. var _config = typeof config === 'object' ? config : null;
  1360. if (!data) {
  1361. data = new Dropdown(this, _config);
  1362. $$$1(this).data(DATA_KEY, data);
  1363. }
  1364. if (typeof config === 'string') {
  1365. if (typeof data[config] === 'undefined') {
  1366. throw new TypeError("No method named \"" + config + "\"");
  1367. }
  1368. data[config]();
  1369. }
  1370. });
  1371. };
  1372. Dropdown._clearMenus