'use strict'; var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } /** * -------------------------------------------------------------------------- * Bootstrap (v4.0.0-alpha.2): tab.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ var Tab = (function ($) { /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var NAME = 'tab'; var VERSION = '4.0.0-alpha.2'; var DATA_KEY = 'bs.tab'; var EVENT_KEY = '.' + DATA_KEY; var DATA_API_KEY = '.data-api'; var JQUERY_NO_CONFLICT = $.fn[NAME]; var TRANSITION_DURATION = 150; var Event = { HIDE: 'hide' + EVENT_KEY, HIDDEN: 'hidden' + EVENT_KEY, SHOW: 'show' + EVENT_KEY, SHOWN: 'shown' + EVENT_KEY, CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY }; var ClassName = { DROPDOWN_MENU: 'dropdown-menu', ACTIVE: 'active', FADE: 'fade', IN: 'in' }; var Selector = { A: 'a', LI: 'li', DROPDOWN: '.dropdown', UL: 'ul:not(.dropdown-menu)', FADE_CHILD: '> .nav-item .fade, > .fade', ACTIVE: '.active', ACTIVE_CHILD: '> .nav-item > .active, > .active', DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"]', DROPDOWN_TOGGLE: '.dropdown-toggle', DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active' }; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ var Tab = (function () { function Tab(element) { _classCallCheck(this, Tab); this._element = element; } /** * ------------------------------------------------------------------------ * Data Api implementation * ------------------------------------------------------------------------ */ // getters _createClass(Tab, [{ key: 'show', // public value: function show() { var _this = this; if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE)) { return; } var target = undefined; var previous = undefined; var ulElement = $(this._element).closest(Selector.UL)[0]; var selector = Util.getSelectorFromElement(this._element); if (ulElement) { previous = $.makeArray($(ulElement).find(Selector.ACTIVE)); previous = previous[previous.length - 1]; } var hideEvent = $.Event(Event.HIDE, { relatedTarget: this._element }); var showEvent = $.Event(Event.SHOW, { relatedTarget: previous }); if (previous) { $(previous).trigger(hideEvent); } $(this._element).trigger(showEvent); if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { return; } if (selector) { target = $(selector)[0]; } this._activate(this._element, ulElement); var complete = function complete() { var hiddenEvent = $.Event(Event.HIDDEN, { relatedTarget: _this._element }); var shownEvent = $.Event(Event.SHOWN, { relatedTarget: previous }); $(previous).trigger(hiddenEvent); $(_this._element).trigger(shownEvent); }; if (target) { this._activate(target, target.parentNode, complete); } else { complete(); } } }, { key: 'dispose', value: function dispose() { $.removeClass(this._element, DATA_KEY); this._element = null; } // private }, { key: '_activate', value: function _activate(element, container, callback) { var active = $(container).find(Selector.ACTIVE_CHILD)[0]; var isTransitioning = callback && Util.supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || Boolean($(container).find(Selector.FADE_CHILD)[0])); var complete = $.proxy(this._transitionComplete, this, element, active, isTransitioning, callback); if (active && isTransitioning) { $(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); } else { complete(); } if (active) { $(active).removeClass(ClassName.IN); } } }, { key: '_transitionComplete', value: function _transitionComplete(element, active, isTransitioning, callback) { if (active) { $(active).removeClass(ClassName.ACTIVE); var dropdownChild = $(active).find(Selector.DROPDOWN_ACTIVE_CHILD)[0]; if (dropdownChild) { $(dropdownChild).removeClass(ClassName.ACTIVE); } active.setAttribute('aria-expanded', false); } $(element).addClass(ClassName.ACTIVE); element.setAttribute('aria-expanded', true); if (isTransitioning) { Util.reflow(element); $(element).addClass(ClassName.IN); } else { $(element).removeClass(ClassName.FADE); } if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) { var dropdownElement = $(element).closest(Selector.DROPDOWN)[0]; if (dropdownElement) { $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); } element.setAttribute('aria-expanded', true); } if (callback) { callback(); } } // static }], [{ key: '_jQueryInterface', value: function _jQueryInterface(config) { return this.each(function () { var $this = $(this); var data = $this.data(DATA_KEY); if (!data) { data = data = new Tab(this); $this.data(DATA_KEY, data); } if (typeof config === 'string') { if (data[config] === undefined) { throw new Error('No method named "' + config + '"'); } data[config](); } }); } }, { key: 'VERSION', get: function get() { return VERSION; } }]); return Tab; })(); $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { event.preventDefault(); Tab._jQueryInterface.call($(this), 'show'); }); /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ */ $.fn[NAME] = Tab._jQueryInterface; $.fn[NAME].Constructor = Tab; $.fn[NAME].noConflict = function () { $.fn[NAME] = JQUERY_NO_CONFLICT; return Tab._jQueryInterface; }; return Tab; })(jQuery); /** * -------------------------------------------------------------------------- * Bootstrap (v4.0.0-alpha.2): util.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ 'use strict'; var Util = (function ($) { /** * ------------------------------------------------------------------------ * Private TransitionEnd Helpers * ------------------------------------------------------------------------ */ var transition = false; var TransitionEndEvent = { WebkitTransition: 'webkitTransitionEnd', MozTransition: 'transitionend', OTransition: 'oTransitionEnd otransitionend', transition: 'transitionend' }; // shoutout AngusCroll (https://goo.gl/pxwQGp) function toType(obj) { return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase(); } function isElement(obj) { return (obj[0] || obj).nodeType; } function getSpecialTransitionEndEvent() { return { bindType: transition.end, delegateType: transition.end, handle: function handle(event) { if ($(event.target).is(this)) { return event.handleObj.handler.apply(this, arguments); } } }; } function transitionEndTest() { if (window.QUnit) { return false; } var el = document.createElement('bootstrap'); for (var _name in TransitionEndEvent) { if (el.style[_name] !== undefined) { return { end: TransitionEndEvent[_name] }; } } return false; } function transitionEndEmulator(duration) { var _this = this; var called = false; $(this).one(Util.TRANSITION_END, function () { called = true; }); setTimeout(function () { if (!called) { Util.triggerTransitionEnd(_this); } }, duration); return this; } function setTransitionEndSupport() { transition = transitionEndTest(); $.fn.emulateTransitionEnd = transitionEndEmulator; if (Util.supportsTransitionEnd()) { $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); } } /** * -------------------------------------------------------------------------- * Public Util Api * -------------------------------------------------------------------------- */ var Util = { TRANSITION_END: 'bsTransitionEnd', getUID: function getUID(prefix) { do { /* eslint-disable no-bitwise */ prefix += ~ ~(Math.random() * 1000000); // "~~" acts like a faster Math.floor() here /* eslint-enable no-bitwise */ } while (document.getElementById(prefix)); return prefix; }, getSelectorFromElement: function getSelectorFromElement(element) { var selector = element.getAttribute('data-target'); if (!selector) { selector = element.getAttribute('href') || ''; selector = /^#[a-z]/i.test(selector) ? selector : null; } return selector; }, reflow: function reflow(element) { new Function('bs', 'return bs')(element.offsetHeight); }, triggerTransitionEnd: function triggerTransitionEnd(element) { $(element).trigger(transition.end); }, supportsTransitionEnd: function supportsTransitionEnd() { return Boolean(transition); }, typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { for (var property in configTypes) { if (configTypes.hasOwnProperty(property)) { var expectedTypes = configTypes[property]; var value = config[property]; var valueType = undefined; if (value && isElement(value)) { valueType = 'element'; } else { valueType = toType(value); } if (!new RegExp(expectedTypes).test(valueType)) { throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".')); } } } } }; setTransitionEndSupport(); return Util; })(jQuery);