bootstrap.js 94 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430
  1. /*!
  2. * Bootstrap v4.0.0-alpha.4 (https://getbootstrap.com)
  3. * Copyright 2011-2016 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  4. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5. */
  6. if (typeof jQuery === 'undefined') {
  7. throw new Error('Bootstrap\'s JavaScript requires jQuery')
  8. }
  9. +function ($) {
  10. var version = $.fn.jquery.split(' ')[0].split('.')
  11. if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] >= 4)) {
  12. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0')
  13. }
  14. }(jQuery);
  15. +function () {
  16. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  17. 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; }; }();
  18. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  19. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  20. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  21. /**
  22. * --------------------------------------------------------------------------
  23. * Bootstrap (v4.0.0-alpha.4): util.js
  24. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  25. * --------------------------------------------------------------------------
  26. */
  27. var Util = function ($) {
  28. /**
  29. * ------------------------------------------------------------------------
  30. * Private TransitionEnd Helpers
  31. * ------------------------------------------------------------------------
  32. */
  33. var transition = false;
  34. var MAX_UID = 1000000;
  35. var TransitionEndEvent = {
  36. WebkitTransition: 'webkitTransitionEnd',
  37. MozTransition: 'transitionend',
  38. OTransition: 'oTransitionEnd otransitionend',
  39. transition: 'transitionend'
  40. };
  41. // shoutout AngusCroll (https://goo.gl/pxwQGp)
  42. function toType(obj) {
  43. return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
  44. }
  45. function isElement(obj) {
  46. return (obj[0] || obj).nodeType;
  47. }
  48. function getSpecialTransitionEndEvent() {
  49. return {
  50. bindType: transition.end,
  51. delegateType: transition.end,
  52. handle: function handle(event) {
  53. if ($(event.target).is(this)) {
  54. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  55. }
  56. return undefined;
  57. }
  58. };
  59. }
  60. function transitionEndTest() {
  61. if (window.QUnit) {
  62. return false;
  63. }
  64. var el = document.createElement('bootstrap');
  65. for (var name in TransitionEndEvent) {
  66. if (el.style[name] !== undefined) {
  67. return { end: TransitionEndEvent[name] };
  68. }
  69. }
  70. return false;
  71. }
  72. function transitionEndEmulator(duration) {
  73. var _this = this;
  74. var called = false;
  75. $(this).one(Util.TRANSITION_END, function () {
  76. called = true;
  77. });
  78. setTimeout(function () {
  79. if (!called) {
  80. Util.triggerTransitionEnd(_this);
  81. }
  82. }, duration);
  83. return this;
  84. }
  85. function setTransitionEndSupport() {
  86. transition = transitionEndTest();
  87. $.fn.emulateTransitionEnd = transitionEndEmulator;
  88. if (Util.supportsTransitionEnd()) {
  89. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  90. }
  91. }
  92. /**
  93. * --------------------------------------------------------------------------
  94. * Public Util Api
  95. * --------------------------------------------------------------------------
  96. */
  97. var Util = {
  98. TRANSITION_END: 'bsTransitionEnd',
  99. getUID: function getUID(prefix) {
  100. do {
  101. /* eslint-disable no-bitwise */
  102. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  103. /* eslint-enable no-bitwise */
  104. } while (document.getElementById(prefix));
  105. return prefix;
  106. },
  107. getSelectorFromElement: function getSelectorFromElement(element) {
  108. var selector = element.getAttribute('data-target');
  109. if (!selector) {
  110. selector = element.getAttribute('href') || '';
  111. selector = /^#[a-z]/i.test(selector) ? selector : null;
  112. }
  113. return selector;
  114. },
  115. reflow: function reflow(element) {
  116. new Function('bs', 'return bs')(element.offsetHeight);
  117. },
  118. triggerTransitionEnd: function triggerTransitionEnd(element) {
  119. $(element).trigger(transition.end);
  120. },
  121. supportsTransitionEnd: function supportsTransitionEnd() {
  122. return Boolean(transition);
  123. },
  124. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  125. for (var property in configTypes) {
  126. if (configTypes.hasOwnProperty(property)) {
  127. var expectedTypes = configTypes[property];
  128. var value = config[property];
  129. var valueType = void 0;
  130. if (value && isElement(value)) {
  131. valueType = 'element';
  132. } else {
  133. valueType = toType(value);
  134. }
  135. if (!new RegExp(expectedTypes).test(valueType)) {
  136. throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".'));
  137. }
  138. }
  139. }
  140. }
  141. };
  142. setTransitionEndSupport();
  143. return Util;
  144. }(jQuery);
  145. /**
  146. * --------------------------------------------------------------------------
  147. * Bootstrap (v4.0.0-alpha.4): alert.js
  148. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  149. * --------------------------------------------------------------------------
  150. */
  151. var Alert = function ($) {
  152. /**
  153. * ------------------------------------------------------------------------
  154. * Constants
  155. * ------------------------------------------------------------------------
  156. */
  157. var NAME = 'alert';
  158. var VERSION = '4.0.0-alpha.4';
  159. var DATA_KEY = 'bs.alert';
  160. var EVENT_KEY = '.' + DATA_KEY;
  161. var DATA_API_KEY = '.data-api';
  162. var JQUERY_NO_CONFLICT = $.fn[NAME];
  163. var TRANSITION_DURATION = 150;
  164. var Selector = {
  165. DISMISS: '[data-dismiss="alert"]'
  166. };
  167. var Event = {
  168. CLOSE: 'close' + EVENT_KEY,
  169. CLOSED: 'closed' + EVENT_KEY,
  170. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  171. };
  172. var ClassName = {
  173. ALERT: 'alert',
  174. FADE: 'fade',
  175. IN: 'in'
  176. };
  177. /**
  178. * ------------------------------------------------------------------------
  179. * Class Definition
  180. * ------------------------------------------------------------------------
  181. */
  182. var Alert = function () {
  183. function Alert(element) {
  184. _classCallCheck(this, Alert);
  185. this._element = element;
  186. }
  187. // getters
  188. // public
  189. Alert.prototype.close = function close(element) {
  190. element = element || this._element;
  191. var rootElement = this._getRootElement(element);
  192. var customEvent = this._triggerCloseEvent(rootElement);
  193. if (customEvent.isDefaultPrevented()) {
  194. return;
  195. }
  196. this._removeElement(rootElement);
  197. };
  198. Alert.prototype.dispose = function dispose() {
  199. $.removeData(this._element, DATA_KEY);
  200. this._element = null;
  201. };
  202. // private
  203. Alert.prototype._getRootElement = function _getRootElement(element) {
  204. var selector = Util.getSelectorFromElement(element);
  205. var parent = false;
  206. if (selector) {
  207. parent = $(selector)[0];
  208. }
  209. if (!parent) {
  210. parent = $(element).closest('.' + ClassName.ALERT)[0];
  211. }
  212. return parent;
  213. };
  214. Alert.prototype._triggerCloseEvent = function _triggerCloseEvent(element) {
  215. var closeEvent = $.Event(Event.CLOSE);
  216. $(element).trigger(closeEvent);
  217. return closeEvent;
  218. };
  219. Alert.prototype._removeElement = function _removeElement(element) {
  220. $(element).removeClass(ClassName.IN);
  221. if (!Util.supportsTransitionEnd() || !$(element).hasClass(ClassName.FADE)) {
  222. this._destroyElement(element);
  223. return;
  224. }
  225. $(element).one(Util.TRANSITION_END, $.proxy(this._destroyElement, this, element)).emulateTransitionEnd(TRANSITION_DURATION);
  226. };
  227. Alert.prototype._destroyElement = function _destroyElement(element) {
  228. $(element).detach().trigger(Event.CLOSED).remove();
  229. };
  230. // static
  231. Alert._jQueryInterface = function _jQueryInterface(config) {
  232. return this.each(function () {
  233. var $element = $(this);
  234. var data = $element.data(DATA_KEY);
  235. if (!data) {
  236. data = new Alert(this);
  237. $element.data(DATA_KEY, data);
  238. }
  239. if (config === 'close') {
  240. data[config](this);
  241. }
  242. });
  243. };
  244. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  245. return function (event) {
  246. if (event) {
  247. event.preventDefault();
  248. }
  249. alertInstance.close(this);
  250. };
  251. };
  252. _createClass(Alert, null, [{
  253. key: 'VERSION',
  254. get: function get() {
  255. return VERSION;
  256. }
  257. }]);
  258. return Alert;
  259. }();
  260. /**
  261. * ------------------------------------------------------------------------
  262. * Data Api implementation
  263. * ------------------------------------------------------------------------
  264. */
  265. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  266. /**
  267. * ------------------------------------------------------------------------
  268. * jQuery
  269. * ------------------------------------------------------------------------
  270. */
  271. $.fn[NAME] = Alert._jQueryInterface;
  272. $.fn[NAME].Constructor = Alert;
  273. $.fn[NAME].noConflict = function () {
  274. $.fn[NAME] = JQUERY_NO_CONFLICT;
  275. return Alert._jQueryInterface;
  276. };
  277. return Alert;
  278. }(jQuery);
  279. /**
  280. * --------------------------------------------------------------------------
  281. * Bootstrap (v4.0.0-alpha.4): button.js
  282. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  283. * --------------------------------------------------------------------------
  284. */
  285. var Button = function ($) {
  286. /**
  287. * ------------------------------------------------------------------------
  288. * Constants
  289. * ------------------------------------------------------------------------
  290. */
  291. var NAME = 'button';
  292. var VERSION = '4.0.0-alpha.4';
  293. var DATA_KEY = 'bs.button';
  294. var EVENT_KEY = '.' + DATA_KEY;
  295. var DATA_API_KEY = '.data-api';
  296. var JQUERY_NO_CONFLICT = $.fn[NAME];
  297. var ClassName = {
  298. ACTIVE: 'active',
  299. BUTTON: 'btn',
  300. FOCUS: 'focus'
  301. };
  302. var Selector = {
  303. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  304. DATA_TOGGLE: '[data-toggle="buttons"]',
  305. INPUT: 'input',
  306. ACTIVE: '.active',
  307. BUTTON: '.btn'
  308. };
  309. var Event = {
  310. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
  311. FOCUS_BLUR_DATA_API: 'focus' + EVENT_KEY + DATA_API_KEY + ' ' + ('blur' + EVENT_KEY + DATA_API_KEY)
  312. };
  313. /**
  314. * ------------------------------------------------------------------------
  315. * Class Definition
  316. * ------------------------------------------------------------------------
  317. */
  318. var Button = function () {
  319. function Button(element) {
  320. _classCallCheck(this, Button);
  321. this._element = element;
  322. }
  323. // getters
  324. // public
  325. Button.prototype.toggle = function toggle() {
  326. var triggerChangeEvent = true;
  327. var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0];
  328. if (rootElement) {
  329. var input = $(this._element).find(Selector.INPUT)[0];
  330. if (input) {
  331. if (input.type === 'radio') {
  332. if (input.checked && $(this._element).hasClass(ClassName.ACTIVE)) {
  333. triggerChangeEvent = false;
  334. } else {
  335. var activeElement = $(rootElement).find(Selector.ACTIVE)[0];
  336. if (activeElement) {
  337. $(activeElement).removeClass(ClassName.ACTIVE);
  338. }
  339. }
  340. }
  341. if (triggerChangeEvent) {
  342. input.checked = !$(this._element).hasClass(ClassName.ACTIVE);
  343. $(this._element).trigger('change');
  344. }
  345. input.focus();
  346. }
  347. } else {
  348. this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE));
  349. }
  350. if (triggerChangeEvent) {
  351. $(this._element).toggleClass(ClassName.ACTIVE);
  352. }
  353. };
  354. Button.prototype.dispose = function dispose() {
  355. $.removeData(this._element, DATA_KEY);
  356. this._element = null;
  357. };
  358. // static
  359. Button._jQueryInterface = function _jQueryInterface(config) {
  360. return this.each(function () {
  361. var data = $(this).data(DATA_KEY);
  362. if (!data) {
  363. data = new Button(this);
  364. $(this).data(DATA_KEY, data);
  365. }
  366. if (config === 'toggle') {
  367. data[config]();
  368. }
  369. });
  370. };
  371. _createClass(Button, null, [{
  372. key: 'VERSION',
  373. get: function get() {
  374. return VERSION;
  375. }
  376. }]);
  377. return Button;
  378. }();
  379. /**
  380. * ------------------------------------------------------------------------
  381. * Data Api implementation
  382. * ------------------------------------------------------------------------
  383. */
  384. $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
  385. event.preventDefault();
  386. var button = event.target;
  387. if (!$(button).hasClass(ClassName.BUTTON)) {
  388. button = $(button).closest(Selector.BUTTON);
  389. }
  390. Button._jQueryInterface.call($(button), 'toggle');
  391. }).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
  392. var button = $(event.target).closest(Selector.BUTTON)[0];
  393. $(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
  394. });
  395. /**
  396. * ------------------------------------------------------------------------
  397. * jQuery
  398. * ------------------------------------------------------------------------
  399. */
  400. $.fn[NAME] = Button._jQueryInterface;
  401. $.fn[NAME].Constructor = Button;
  402. $.fn[NAME].noConflict = function () {
  403. $.fn[NAME] = JQUERY_NO_CONFLICT;
  404. return Button._jQueryInterface;
  405. };
  406. return Button;
  407. }(jQuery);
  408. /**
  409. * --------------------------------------------------------------------------
  410. * Bootstrap (v4.0.0-alpha.4): carousel.js
  411. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  412. * --------------------------------------------------------------------------
  413. */
  414. var Carousel = function ($) {
  415. /**
  416. * ------------------------------------------------------------------------
  417. * Constants
  418. * ------------------------------------------------------------------------
  419. */
  420. var NAME = 'carousel';
  421. var VERSION = '4.0.0-alpha.4';
  422. var DATA_KEY = 'bs.carousel';
  423. var EVENT_KEY = '.' + DATA_KEY;
  424. var DATA_API_KEY = '.data-api';
  425. var JQUERY_NO_CONFLICT = $.fn[NAME];
  426. var TRANSITION_DURATION = 600;
  427. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  428. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  429. var Default = {
  430. interval: 5000,
  431. keyboard: true,
  432. slide: false,
  433. pause: 'hover',
  434. wrap: true
  435. };
  436. var DefaultType = {
  437. interval: '(number|boolean)',
  438. keyboard: 'boolean',
  439. slide: '(boolean|string)',
  440. pause: '(string|boolean)',
  441. wrap: 'boolean'
  442. };
  443. var Direction = {
  444. NEXT: 'next',
  445. PREVIOUS: 'prev'
  446. };
  447. var Event = {
  448. SLIDE: 'slide' + EVENT_KEY,
  449. SLID: 'slid' + EVENT_KEY,
  450. KEYDOWN: 'keydown' + EVENT_KEY,
  451. MOUSEENTER: 'mouseenter' + EVENT_KEY,
  452. MOUSELEAVE: 'mouseleave' + EVENT_KEY,
  453. LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY,
  454. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  455. };
  456. var ClassName = {
  457. CAROUSEL: 'carousel',
  458. ACTIVE: 'active',
  459. SLIDE: 'slide',
  460. RIGHT: 'right',
  461. LEFT: 'left',
  462. ITEM: 'carousel-item'
  463. };
  464. var Selector = {
  465. ACTIVE: '.active',
  466. ACTIVE_ITEM: '.active.carousel-item',
  467. ITEM: '.carousel-item',
  468. NEXT_PREV: '.next, .prev',
  469. INDICATORS: '.carousel-indicators',
  470. DATA_SLIDE: '[data-slide], [data-slide-to]',
  471. DATA_RIDE: '[data-ride="carousel"]'
  472. };
  473. /**
  474. * ------------------------------------------------------------------------
  475. * Class Definition
  476. * ------------------------------------------------------------------------
  477. */
  478. var Carousel = function () {
  479. function Carousel(element, config) {
  480. _classCallCheck(this, Carousel);
  481. this._items = null;
  482. this._interval = null;
  483. this._activeElement = null;
  484. this._isPaused = false;
  485. this._isSliding = false;
  486. this._config = this._getConfig(config);
  487. this._element = $(element)[0];
  488. this._indicatorsElement = $(this._element).find(Selector.INDICATORS)[0];
  489. this._addEventListeners();
  490. }
  491. // getters
  492. // public
  493. Carousel.prototype.next = function next() {
  494. if (!this._isSliding) {
  495. this._slide(Direction.NEXT);
  496. }
  497. };
  498. Carousel.prototype.nextWhenVisible = function nextWhenVisible() {
  499. // Don't call next when the page isn't visible
  500. if (!document.hidden) {
  501. this.next();
  502. }
  503. };
  504. Carousel.prototype.prev = function prev() {
  505. if (!this._isSliding) {
  506. this._slide(Direction.PREVIOUS);
  507. }
  508. };
  509. Carousel.prototype.pause = function pause(event) {
  510. if (!event) {
  511. this._isPaused = true;
  512. }
  513. if ($(this._element).find(Selector.NEXT_PREV)[0] && Util.supportsTransitionEnd()) {
  514. Util.triggerTransitionEnd(this._element);
  515. this.cycle(true);
  516. }
  517. clearInterval(this._interval);
  518. this._interval = null;
  519. };
  520. Carousel.prototype.cycle = function cycle(event) {
  521. if (!event) {
  522. this._isPaused = false;
  523. }
  524. if (this._interval) {
  525. clearInterval(this._interval);
  526. this._interval = null;
  527. }
  528. if (this._config.interval && !this._isPaused) {
  529. this._interval = setInterval($.proxy(document.visibilityState ? this.nextWhenVisible : this.next, this), this._config.interval);
  530. }
  531. };
  532. Carousel.prototype.to = function to(index) {
  533. var _this2 = this;
  534. this._activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0];
  535. var activeIndex = this._getItemIndex(this._activeElement);
  536. if (index > this._items.length - 1 || index < 0) {
  537. return;
  538. }
  539. if (this._isSliding) {
  540. $(this._element).one(Event.SLID, function () {
  541. return _this2.to(index);
  542. });
  543. return;
  544. }
  545. if (activeIndex === index) {
  546. this.pause();
  547. this.cycle();
  548. return;
  549. }
  550. var direction = index > activeIndex ? Direction.NEXT : Direction.PREVIOUS;
  551. this._slide(direction, this._items[index]);
  552. };
  553. Carousel.prototype.dispose = function dispose() {
  554. $(this._element).off(EVENT_KEY);
  555. $.removeData(this._element, DATA_KEY);
  556. this._items = null;
  557. this._config = null;
  558. this._element = null;
  559. this._interval = null;
  560. this._isPaused = null;
  561. this._isSliding = null;
  562. this._activeElement = null;
  563. this._indicatorsElement = null;
  564. };
  565. // private
  566. Carousel.prototype._getConfig = function _getConfig(config) {
  567. config = $.extend({}, Default, config);
  568. Util.typeCheckConfig(NAME, config, DefaultType);
  569. return config;
  570. };
  571. Carousel.prototype._addEventListeners = function _addEventListeners() {
  572. if (this._config.keyboard) {
  573. $(this._element).on(Event.KEYDOWN, $.proxy(this._keydown, this));
  574. }
  575. if (this._config.pause === 'hover' && !('ontouchstart' in document.documentElement)) {
  576. $(this._element).on(Event.MOUSEENTER, $.proxy(this.pause, this)).on(Event.MOUSELEAVE, $.proxy(this.cycle, this));
  577. }
  578. };
  579. Carousel.prototype._keydown = function _keydown(event) {
  580. event.preventDefault();
  581. if (/input|textarea/i.test(event.target.tagName)) {
  582. return;
  583. }
  584. switch (event.which) {
  585. case ARROW_LEFT_KEYCODE:
  586. this.prev();
  587. break;
  588. case ARROW_RIGHT_KEYCODE:
  589. this.next();
  590. break;
  591. default:
  592. return;
  593. }
  594. };
  595. Carousel.prototype._getItemIndex = function _getItemIndex(element) {
  596. this._items = $.makeArray($(element).parent().find(Selector.ITEM));
  597. return this._items.indexOf(element);
  598. };
  599. Carousel.prototype._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  600. var isNextDirection = direction === Direction.NEXT;
  601. var isPrevDirection = direction === Direction.PREVIOUS;
  602. var activeIndex = this._getItemIndex(activeElement);
  603. var lastItemIndex = this._items.length - 1;
  604. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  605. if (isGoingToWrap && !this._config.wrap) {
  606. return activeElement;
  607. }
  608. var delta = direction === Direction.PREVIOUS ? -1 : 1;
  609. var itemIndex = (activeIndex + delta) % this._items.length;
  610. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  611. };
  612. Carousel.prototype._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, directionalClassname) {
  613. var slideEvent = $.Event(Event.SLIDE, {
  614. relatedTarget: relatedTarget,
  615. direction: directionalClassname
  616. });
  617. $(this._element).trigger(slideEvent);
  618. return slideEvent;
  619. };
  620. Carousel.prototype._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  621. if (this._indicatorsElement) {
  622. $(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
  623. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  624. if (nextIndicator) {
  625. $(nextIndicator).addClass(ClassName.ACTIVE);
  626. }
  627. }
  628. };
  629. Carousel.prototype._slide = function _slide(direction, element) {
  630. var _this3 = this;
  631. var activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0];
  632. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  633. var isCycling = Boolean(this._interval);
  634. var directionalClassName = direction === Direction.NEXT ? ClassName.LEFT : ClassName.RIGHT;
  635. if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) {
  636. this._isSliding = false;
  637. return;
  638. }
  639. var slideEvent = this._triggerSlideEvent(nextElement, directionalClassName);
  640. if (slideEvent.isDefaultPrevented()) {
  641. return;
  642. }
  643. if (!activeElement || !nextElement) {
  644. // some weirdness is happening, so we bail
  645. return;
  646. }
  647. this._isSliding = true;
  648. if (isCycling) {
  649. this.pause();
  650. }
  651. this._setActiveIndicatorElement(nextElement);
  652. var slidEvent = $.Event(Event.SLID, {
  653. relatedTarget: nextElement,
  654. direction: directionalClassName
  655. });
  656. if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.SLIDE)) {
  657. $(nextElement).addClass(direction);
  658. Util.reflow(nextElement);
  659. $(activeElement).addClass(directionalClassName);
  660. $(nextElement).addClass(directionalClassName);
  661. $(activeElement).one(Util.TRANSITION_END, function () {
  662. $(nextElement).removeClass(directionalClassName).removeClass(direction);
  663. $(nextElement).addClass(ClassName.ACTIVE);
  664. $(activeElement).removeClass(ClassName.ACTIVE).removeClass(direction).removeClass(directionalClassName);
  665. _this3._isSliding = false;
  666. setTimeout(function () {
  667. return $(_this3._element).trigger(slidEvent);
  668. }, 0);
  669. }).emulateTransitionEnd(TRANSITION_DURATION);
  670. } else {
  671. $(activeElement).removeClass(ClassName.ACTIVE);
  672. $(nextElement).addClass(ClassName.ACTIVE);
  673. this._isSliding = false;
  674. $(this._element).trigger(slidEvent);
  675. }
  676. if (isCycling) {
  677. this.cycle();
  678. }
  679. };
  680. // static
  681. Carousel._jQueryInterface = function _jQueryInterface(config) {
  682. return this.each(function () {
  683. var data = $(this).data(DATA_KEY);
  684. var _config = $.extend({}, Default, $(this).data());
  685. if ((typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object') {
  686. $.extend(_config, config);
  687. }
  688. var action = typeof config === 'string' ? config : _config.slide;
  689. if (!data) {
  690. data = new Carousel(this, _config);
  691. $(this).data(DATA_KEY, data);
  692. }
  693. if (typeof config === 'number') {
  694. data.to(config);
  695. } else if (typeof action === 'string') {
  696. if (data[action] === undefined) {
  697. throw new Error('No method named "' + action + '"');
  698. }
  699. data[action]();
  700. } else if (_config.interval) {
  701. data.pause();
  702. data.cycle();
  703. }
  704. });
  705. };
  706. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  707. var selector = Util.getSelectorFromElement(this);
  708. if (!selector) {
  709. return;
  710. }
  711. var target = $(selector)[0];
  712. if (!target || !$(target).hasClass(ClassName.CAROUSEL)) {
  713. return;
  714. }
  715. var config = $.extend({}, $(target).data(), $(this).data());
  716. var slideIndex = this.getAttribute('data-slide-to');
  717. if (slideIndex) {
  718. config.interval = false;
  719. }
  720. Carousel._jQueryInterface.call($(target), config);
  721. if (slideIndex) {
  722. $(target).data(DATA_KEY).to(slideIndex);
  723. }
  724. event.preventDefault();
  725. };
  726. _createClass(Carousel, null, [{
  727. key: 'VERSION',
  728. get: function get() {
  729. return VERSION;
  730. }
  731. }, {
  732. key: 'Default',
  733. get: function get() {
  734. return Default;
  735. }
  736. }]);
  737. return Carousel;
  738. }();
  739. /**
  740. * ------------------------------------------------------------------------
  741. * Data Api implementation
  742. * ------------------------------------------------------------------------
  743. */
  744. $(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
  745. $(window).on(Event.LOAD_DATA_API, function () {
  746. $(Selector.DATA_RIDE).each(function () {
  747. var $carousel = $(this);
  748. Carousel._jQueryInterface.call($carousel, $carousel.data());
  749. });
  750. });
  751. /**
  752. * ------------------------------------------------------------------------
  753. * jQuery
  754. * ------------------------------------------------------------------------
  755. */
  756. $.fn[NAME] = Carousel._jQueryInterface;
  757. $.fn[NAME].Constructor = Carousel;
  758. $.fn[NAME].noConflict = function () {
  759. $.fn[NAME] = JQUERY_NO_CONFLICT;
  760. return Carousel._jQueryInterface;
  761. };
  762. return Carousel;
  763. }(jQuery);
  764. /**
  765. * --------------------------------------------------------------------------
  766. * Bootstrap (v4.0.0-alpha.4): collapse.js
  767. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  768. * --------------------------------------------------------------------------
  769. */
  770. var Collapse = function ($) {
  771. /**
  772. * ------------------------------------------------------------------------
  773. * Constants
  774. * ------------------------------------------------------------------------
  775. */
  776. var NAME = 'collapse';
  777. var VERSION = '4.0.0-alpha.4';
  778. var DATA_KEY = 'bs.collapse';
  779. var EVENT_KEY = '.' + DATA_KEY;
  780. var DATA_API_KEY = '.data-api';
  781. var JQUERY_NO_CONFLICT = $.fn[NAME];
  782. var TRANSITION_DURATION = 600;
  783. var Default = {
  784. toggle: true,
  785. parent: ''
  786. };
  787. var DefaultType = {
  788. toggle: 'boolean',
  789. parent: 'string'
  790. };
  791. var Event = {
  792. SHOW: 'show' + EVENT_KEY,
  793. SHOWN: 'shown' + EVENT_KEY,
  794. HIDE: 'hide' + EVENT_KEY,
  795. HIDDEN: 'hidden' + EVENT_KEY,
  796. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  797. };
  798. var ClassName = {
  799. IN: 'in',
  800. COLLAPSE: 'collapse',
  801. COLLAPSING: 'collapsing',
  802. COLLAPSED: 'collapsed'
  803. };
  804. var Dimension = {
  805. WIDTH: 'width',
  806. HEIGHT: 'height'
  807. };
  808. var Selector = {
  809. ACTIVES: '.panel > .in, .panel > .collapsing',
  810. DATA_TOGGLE: '[data-toggle="collapse"]'
  811. };
  812. /**
  813. * ------------------------------------------------------------------------
  814. * Class Definition
  815. * ------------------------------------------------------------------------
  816. */
  817. var Collapse = function () {
  818. function Collapse(element, config) {
  819. _classCallCheck(this, Collapse);
  820. this._isTransitioning = false;
  821. this._element = element;
  822. this._config = this._getConfig(config);
  823. this._triggerArray = $.makeArray($('[data-toggle="collapse"][href="#' + element.id + '"],' + ('[data-toggle="collapse"][data-target="#' + element.id + '"]')));
  824. this._parent = this._config.parent ? this._getParent() : null;
  825. if (!this._config.parent) {
  826. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  827. }
  828. if (this._config.toggle) {
  829. this.toggle();
  830. }
  831. }
  832. // getters
  833. // public
  834. Collapse.prototype.toggle = function toggle() {
  835. if ($(this._element).hasClass(ClassName.IN)) {
  836. this.hide();
  837. } else {
  838. this.show();
  839. }
  840. };
  841. Collapse.prototype.show = function show() {
  842. var _this4 = this;
  843. if (this._isTransitioning || $(this._element).hasClass(ClassName.IN)) {
  844. return;
  845. }
  846. var actives = void 0;
  847. var activesData = void 0;
  848. if (this._parent) {
  849. actives = $.makeArray($(Selector.ACTIVES));
  850. if (!actives.length) {
  851. actives = null;
  852. }
  853. }
  854. if (actives) {
  855. activesData = $(actives).data(DATA_KEY);
  856. if (activesData && activesData._isTransitioning) {
  857. return;
  858. }
  859. }
  860. var startEvent = $.Event(Event.SHOW);
  861. $(this._element).trigger(startEvent);
  862. if (startEvent.isDefaultPrevented()) {
  863. return;
  864. }
  865. if (actives) {
  866. Collapse._jQueryInterface.call($(actives), 'hide');
  867. if (!activesData) {
  868. $(actives).data(DATA_KEY, null);
  869. }
  870. }
  871. var dimension = this._getDimension();
  872. $(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
  873. this._element.style[dimension] = 0;
  874. this._element.setAttribute('aria-expanded', true);
  875. if (this._triggerArray.length) {
  876. $(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
  877. }
  878. this.setTransitioning(true);
  879. var complete = function complete() {
  880. $(_this4._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.IN);
  881. _this4._element.style[dimension] = '';
  882. _this4.setTransitioning(false);
  883. $(_this4._element).trigger(Event.SHOWN);
  884. };
  885. if (!Util.supportsTransitionEnd()) {
  886. complete();
  887. return;
  888. }
  889. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  890. var scrollSize = 'scroll' + capitalizedDimension;
  891. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  892. this._element.style[dimension] = this._element[scrollSize] + 'px';
  893. };
  894. Collapse.prototype.hide = function hide() {
  895. var _this5 = this;
  896. if (this._isTransitioning || !$(this._element).hasClass(ClassName.IN)) {
  897. return;
  898. }
  899. var startEvent = $.Event(Event.HIDE);
  900. $(this._element).trigger(startEvent);
  901. if (startEvent.isDefaultPrevented()) {
  902. return;
  903. }
  904. var dimension = this._getDimension();
  905. var offsetDimension = dimension === Dimension.WIDTH ? 'offsetWidth' : 'offsetHeight';
  906. this._element.style[dimension] = this._element[offsetDimension] + 'px';
  907. Util.reflow(this._element);
  908. $(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.IN);
  909. this._element.setAttribute('aria-expanded', false);
  910. if (this._triggerArray.length) {
  911. $(this._triggerArray).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
  912. }
  913. this.setTransitioning(true);
  914. var complete = function complete() {
  915. _this5.setTransitioning(false);
  916. $(_this5._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
  917. };
  918. this._element.style[dimension] = '';
  919. if (!Util.supportsTransitionEnd()) {
  920. complete();
  921. return;
  922. }
  923. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  924. };
  925. Collapse.prototype.setTransitioning = function setTransitioning(isTransitioning) {
  926. this._isTransitioning = isTransitioning;
  927. };
  928. Collapse.prototype.dispose = function dispose() {
  929. $.removeData(this._element, DATA_KEY);
  930. this._config = null;
  931. this._parent = null;
  932. this._element = null;
  933. this._triggerArray = null;
  934. this._isTransitioning = null;
  935. };
  936. // private
  937. Collapse.prototype._getConfig = function _getConfig(config) {
  938. config = $.extend({}, Default, config);
  939. config.toggle = Boolean(config.toggle); // coerce string values
  940. Util.typeCheckConfig(NAME, config, DefaultType);
  941. return config;
  942. };
  943. Collapse.prototype._getDimension = function _getDimension() {
  944. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  945. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  946. };
  947. Collapse.prototype._getParent = function _getParent() {
  948. var _this6 = this;
  949. var parent = $(this._config.parent)[0];
  950. var selector = '[data-toggle="collapse"][data-parent="' + this._config.parent + '"]';
  951. $(parent).find(selector).each(function (i, element) {
  952. _this6._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  953. });
  954. return parent;
  955. };
  956. Collapse.prototype._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  957. if (element) {
  958. var isOpen = $(element).hasClass(ClassName.IN);
  959. element.setAttribute('aria-expanded', isOpen);
  960. if (triggerArray.length) {
  961. $(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  962. }
  963. }
  964. };
  965. // static
  966. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  967. var selector = Util.getSelectorFromElement(element);
  968. return selector ? $(selector)[0] : null;
  969. };
  970. Collapse._jQueryInterface = function _jQueryInterface(config) {
  971. return this.each(function () {
  972. var $this = $(this);
  973. var data = $this.data(DATA_KEY);
  974. var _config = $.extend({}, Default, $this.data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config);
  975. if (!data && _config.toggle && /show|hide/.test(config)) {
  976. _config.toggle = false;
  977. }
  978. if (!data) {
  979. data = new Collapse(this, _config);
  980. $this.data(DATA_KEY, data);
  981. }
  982. if (typeof config === 'string') {
  983. if (data[config] === undefined) {
  984. throw new Error('No method named "' + config + '"');
  985. }
  986. data[config]();
  987. }
  988. });
  989. };
  990. _createClass(Collapse, null, [{
  991. key: 'VERSION',
  992. get: function get() {
  993. return VERSION;
  994. }
  995. }, {
  996. key: 'Default',
  997. get: function get() {
  998. return Default;
  999. }
  1000. }]);
  1001. return Collapse;
  1002. }();
  1003. /**
  1004. * ------------------------------------------------------------------------
  1005. * Data Api implementation
  1006. * ------------------------------------------------------------------------
  1007. */
  1008. $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  1009. event.preventDefault();
  1010. var target = Collapse._getTargetFromElement(this);
  1011. var data = $(target).data(DATA_KEY);
  1012. var config = data ? 'toggle' : $(this).data();
  1013. Collapse._jQueryInterface.call($(target), config);
  1014. });
  1015. /**
  1016. * ------------------------------------------------------------------------
  1017. * jQuery
  1018. * ------------------------------------------------------------------------
  1019. */
  1020. $.fn[NAME] = Collapse._jQueryInterface;
  1021. $.fn[NAME].Constructor = Collapse;
  1022. $.fn[NAME].noConflict = function () {
  1023. $.fn[NAME] = JQUERY_NO_CONFLICT;
  1024. return Collapse._jQueryInterface;
  1025. };
  1026. return Collapse;
  1027. }(jQuery);
  1028. /**
  1029. * --------------------------------------------------------------------------
  1030. * Bootstrap (v4.0.0-alpha.4): dropdown.js
  1031. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1032. * --------------------------------------------------------------------------
  1033. */
  1034. var Dropdown = function ($) {
  1035. /**
  1036. * ------------------------------------------------------------------------
  1037. * Constants
  1038. * ------------------------------------------------------------------------
  1039. */
  1040. var NAME = 'dropdown';
  1041. var VERSION = '4.0.0-alpha.4';
  1042. var DATA_KEY = 'bs.dropdown';
  1043. var EVENT_KEY = '.' + DATA_KEY;
  1044. var DATA_API_KEY = '.data-api';
  1045. var JQUERY_NO_CONFLICT = $.fn[NAME];
  1046. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  1047. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  1048. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  1049. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  1050. var Event = {
  1051. HIDE: 'hide' + EVENT_KEY,
  1052. HIDDEN: 'hidden' + EVENT_KEY,
  1053. SHOW: 'show' + EVENT_KEY,
  1054. SHOWN: 'shown' + EVENT_KEY,
  1055. CLICK: 'click' + EVENT_KEY,
  1056. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
  1057. KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + DATA_API_KEY
  1058. };
  1059. var ClassName = {
  1060. BACKDROP: 'dropdown-backdrop',
  1061. DISABLED: 'disabled',
  1062. OPEN: 'open'
  1063. };
  1064. var Selector = {
  1065. BACKDROP: '.dropdown-backdrop',
  1066. DATA_TOGGLE: '[data-toggle="dropdown"]',
  1067. FORM_CHILD: '.dropdown form',
  1068. ROLE_MENU: '[role="menu"]',
  1069. ROLE_LISTBOX: '[role="listbox"]',
  1070. NAVBAR_NAV: '.navbar-nav',
  1071. VISIBLE_ITEMS: '[role="menu"] li:not(.disabled) a, ' + '[role="listbox"] li:not(.disabled) a'
  1072. };
  1073. /**
  1074. * ------------------------------------------------------------------------
  1075. * Class Definition
  1076. * ------------------------------------------------------------------------
  1077. */
  1078. var Dropdown = function () {
  1079. function Dropdown(element) {
  1080. _classCallCheck(this, Dropdown);
  1081. this._element = element;
  1082. this._addEventListeners();
  1083. }
  1084. // getters
  1085. // public
  1086. Dropdown.prototype.toggle = function toggle() {
  1087. if (this.disabled || $(this).hasClass(ClassName.DISABLED)) {
  1088. return false;
  1089. }
  1090. var parent = Dropdown._getParentFromElement(this);
  1091. var isActive = $(parent).hasClass(ClassName.OPEN);
  1092. Dropdown._clearMenus();
  1093. if (isActive) {
  1094. return false;
  1095. }
  1096. if ('ontouchstart' in document.documentElement && !$(parent).closest(Selector.NAVBAR_NAV).length) {
  1097. // if mobile we use a backdrop because click events don't delegate
  1098. var dropdown = document.createElement('div');
  1099. dropdown.className = ClassName.BACKDROP;
  1100. $(dropdown).insertBefore(this);
  1101. $(dropdown).on('click', Dropdown._clearMenus);
  1102. }
  1103. var relatedTarget = { relatedTarget: this };
  1104. var showEvent = $.Event(Event.SHOW, relatedTarget);
  1105. $(parent).trigger(showEvent);
  1106. if (showEvent.isDefaultPrevented()) {
  1107. return false;
  1108. }
  1109. this.focus();
  1110. this.setAttribute('aria-expanded', 'true');
  1111. $(parent).toggleClass(ClassName.OPEN);
  1112. $(parent).trigger($.Event(Event.SHOWN, relatedTarget));
  1113. return false;
  1114. };
  1115. Dropdown.prototype.dispose = function dispose() {
  1116. $.removeData(this._element, DATA_KEY);
  1117. $(this._element).off(EVENT_KEY);
  1118. this._element = null;
  1119. };
  1120. // private
  1121. Dropdown.prototype._addEventListeners = function _addEventListeners() {
  1122. $(this._element).on(Event.CLICK, this.toggle);
  1123. };
  1124. // static
  1125. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  1126. return this.each(function () {
  1127. var data = $(this).data(DATA_KEY);
  1128. if (!data) {
  1129. $(this).data(DATA_KEY, data = new Dropdown(this));
  1130. }
  1131. if (typeof config === 'string') {
  1132. if (data[config] === undefined) {
  1133. throw new Error('No method named "' + config + '"');
  1134. }
  1135. data[config].call(this);
  1136. }
  1137. });
  1138. };
  1139. Dropdown._clearMenus = function _clearMenus(event) {
  1140. if (event && event.which === RIGHT_MOUSE_BUTTON_WHICH) {
  1141. return;
  1142. }
  1143. var backdrop = $(Selector.BACKDROP)[0];
  1144. if (backdrop) {
  1145. backdrop.parentNode.removeChild(backdrop);
  1146. }
  1147. var toggles = $.makeArray($(Selector.DATA_TOGGLE));
  1148. for (var i = 0; i < toggles.length; i++) {
  1149. var parent = Dropdown._getParentFromElement(toggles[i]);
  1150. var relatedTarget = { relatedTarget: toggles[i] };
  1151. if (!$(parent).hasClass(ClassName.OPEN)) {
  1152. continue;
  1153. }
  1154. if (event && event.type === 'click' && /input|textarea/i.test(event.target.tagName) && $.contains(parent, event.target)) {
  1155. continue;
  1156. }
  1157. var hideEvent = $.Event(Event.HIDE, relatedTarget);
  1158. $(parent).trigger(hideEvent);
  1159. if (hideEvent.isDefaultPrevented()) {
  1160. continue;
  1161. }
  1162. toggles[i].setAttribute('aria-expanded', 'false');
  1163. $(parent).removeClass(ClassName.OPEN).trigger($.Event(Event.HIDDEN, relatedTarget));
  1164. }
  1165. };
  1166. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  1167. var parent = void 0;
  1168. var selector = Util.getSelectorFromElement(element);
  1169. if (selector) {
  1170. parent = $(selector)[0];
  1171. }
  1172. return parent || element.parentNode;
  1173. };
  1174. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  1175. if (!/(38|40|27|32)/.test(event.which) || /input|textarea/i.test(event.target.tagName)) {
  1176. return;
  1177. }
  1178. event.preventDefault();
  1179. event.stopPropagation();
  1180. if (this.disabled || $(this).hasClass(ClassName.DISABLED)) {
  1181. return;
  1182. }
  1183. var parent = Dropdown._getParentFromElement(this);
  1184. var isActive = $(parent).hasClass(ClassName.OPEN);
  1185. if (!isActive && event.which !== ESCAPE_KEYCODE || isActive && event.which === ESCAPE_KEYCODE) {
  1186. if (event.which === ESCAPE_KEYCODE) {
  1187. var toggle = $(parent).find(Selector.DATA_TOGGLE)[0];
  1188. $(toggle).trigger('focus');
  1189. }
  1190. $(this).trigger('click');
  1191. return;
  1192. }
  1193. var items = $.makeArray($(Selector.VISIBLE_ITEMS));
  1194. items = items.filter(function (item) {
  1195. return item.offsetWidth || item.offsetHeight;
  1196. });
  1197. if (!items.length) {
  1198. return;
  1199. }
  1200. var index = items.indexOf(event.target);
  1201. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  1202. // up
  1203. index--;
  1204. }
  1205. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  1206. // down
  1207. index++;
  1208. }
  1209. if (index < 0) {
  1210. index = 0;
  1211. }
  1212. items[index].focus();
  1213. };
  1214. _createClass(Dropdown, null, [{
  1215. key: 'VERSION',
  1216. get: function get() {
  1217. return VERSION;
  1218. }
  1219. }]);
  1220. return Dropdown;
  1221. }();
  1222. /**
  1223. * ------------------------------------------------------------------------
  1224. * Data Api implementation
  1225. * ------------------------------------------------------------------------
  1226. */
  1227. $(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_MENU, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_LISTBOX, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, Dropdown.prototype.toggle).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
  1228. e.stopPropagation();
  1229. });
  1230. /**
  1231. * ------------------------------------------------------------------------
  1232. * jQuery
  1233. * ------------------------------------------------------------------------
  1234. */
  1235. $.fn[NAME] = Dropdown._jQueryInterface;
  1236. $.fn[NAME].Constructor = Dropdown;
  1237. $.fn[NAME].noConflict = function () {
  1238. $.fn[NAME] = JQUERY_NO_CONFLICT;
  1239. return Dropdown._jQueryInterface;
  1240. };
  1241. return Dropdown;
  1242. }(jQuery);
  1243. /**
  1244. * --------------------------------------------------------------------------
  1245. * Bootstrap (v4.0.0-alpha.4): modal.js
  1246. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1247. * --------------------------------------------------------------------------
  1248. */
  1249. var Modal = function ($) {
  1250. /**
  1251. * ------------------------------------------------------------------------
  1252. * Constants
  1253. * ------------------------------------------------------------------------
  1254. */
  1255. var NAME = 'modal';
  1256. var VERSION = '4.0.0-alpha.4';
  1257. var DATA_KEY = 'bs.modal';
  1258. var EVENT_KEY = '.' + DATA_KEY;
  1259. var DATA_API_KEY = '.data-api';
  1260. var JQUERY_NO_CONFLICT = $.fn[NAME];
  1261. var TRANSITION_DURATION = 300;
  1262. var BACKDROP_TRANSITION_DURATION = 150;
  1263. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  1264. var Default = {
  1265. backdrop: true,
  1266. keyboard: true,
  1267. focus: true,
  1268. show: true
  1269. };
  1270. var DefaultType = {
  1271. backdrop: '(boolean|string)',
  1272. keyboard: 'boolean',
  1273. focus: 'boolean',
  1274. show: 'boolean'
  1275. };
  1276. var Event = {
  1277. HIDE: 'hide' + EVENT_KEY,
  1278. HIDDEN: 'hidden' + EVENT_KEY,
  1279. SHOW: 'show' + EVENT_KEY,
  1280. SHOWN: 'shown' + EVENT_KEY,
  1281. FOCUSIN: 'focusin' + EVENT_KEY,
  1282. RESIZE: 'resize' + EVENT_KEY,
  1283. CLICK_DISMISS: 'click.dismiss' + EVENT_KEY,
  1284. KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY,
  1285. MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY,
  1286. MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY,
  1287. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  1288. };
  1289. var ClassName = {
  1290. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  1291. BACKDROP: 'modal-backdrop',
  1292. OPEN: 'modal-open',
  1293. FADE: 'fade',
  1294. IN: 'in'
  1295. };
  1296. var Selector = {
  1297. DIALOG: '.modal-dialog',
  1298. DATA_TOGGLE: '[data-toggle="modal"]',
  1299. DATA_DISMISS: '[data-dismiss="modal"]',
  1300. FIXED_CONTENT: '.navbar-fixed-top, .navbar-fixed-bottom, .is-fixed'
  1301. };
  1302. /**
  1303. * ------------------------------------------------------------------------
  1304. * Class Definition
  1305. * ------------------------------------------------------------------------
  1306. */
  1307. var Modal = function () {
  1308. function Modal(element, config) {
  1309. _classCallCheck(this, Modal);
  1310. this._config = this._getConfig(config);
  1311. this._element = element;
  1312. this._dialog = $(element).find(Selector.DIALOG)[0];
  1313. this._backdrop = null;
  1314. this._isShown = false;
  1315. this._isBodyOverflowing = false;
  1316. this._ignoreBackdropClick = false;
  1317. this._originalBodyPadding = 0;
  1318. this._scrollbarWidth = 0;
  1319. }
  1320. // getters
  1321. // public
  1322. Modal.prototype.toggle = function toggle(relatedTarget) {
  1323. return this._isShown ? this.hide() : this.show(relatedTarget);
  1324. };
  1325. Modal.prototype.show = function show(relatedTarget) {
  1326. var _this7 = this;
  1327. var showEvent = $.Event(Event.SHOW, {
  1328. relatedTarget: relatedTarget
  1329. });
  1330. $(this._element).trigger(showEvent);
  1331. if (this._isShown || showEvent.isDefaultPrevented()) {
  1332. return;
  1333. }
  1334. this._isShown = true;
  1335. this._checkScrollbar();
  1336. this._setScrollbar();
  1337. $(document.body).addClass(ClassName.OPEN);
  1338. this._setEscapeEvent();
  1339. this._setResizeEvent();
  1340. $(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, $.proxy(this.hide, this));
  1341. $(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
  1342. $(_this7._element).one(Event.MOUSEUP_DISMISS, function (event) {
  1343. if ($(event.target).is(_this7._element)) {
  1344. _this7._ignoreBackdropClick = true;
  1345. }
  1346. });
  1347. });
  1348. this._showBackdrop($.proxy(this._showElement, this, relatedTarget));
  1349. };
  1350. Modal.prototype.hide = function hide(event) {
  1351. if (event) {
  1352. event.preventDefault();
  1353. }
  1354. var hideEvent = $.Event(Event.HIDE);
  1355. $(this._element).trigger(hideEvent);
  1356. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  1357. return;
  1358. }
  1359. this._isShown = false;
  1360. this._setEscapeEvent();
  1361. this._setResizeEvent();
  1362. $(document).off(Event.FOCUSIN);
  1363. $(this._element).removeClass(ClassName.IN);
  1364. $(this._element).off(Event.CLICK_DISMISS);
  1365. $(this._dialog).off(Event.MOUSEDOWN_DISMISS);
  1366. if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
  1367. $(this._element).one(Util.TRANSITION_END, $.proxy(this._hideModal, this)).emulateTransitionEnd(TRANSITION_DURATION);
  1368. } else {
  1369. this._hideModal();
  1370. }
  1371. };
  1372. Modal.prototype.dispose = function dispose() {
  1373. $.removeData(this._element, DATA_KEY);
  1374. $(window).off(EVENT_KEY);
  1375. $(document).off(EVENT_KEY);
  1376. $(this._element).off(EVENT_KEY);
  1377. $(this._backdrop).off(EVENT_KEY);
  1378. this._config = null;
  1379. this._element = null;
  1380. this._dialog = null;
  1381. this._backdrop = null;
  1382. this._isShown = null;
  1383. this._isBodyOverflowing = null;
  1384. this._ignoreBackdropClick = null;
  1385. this._originalBodyPadding = null;
  1386. this._scrollbarWidth = null;
  1387. };
  1388. // private
  1389. Modal.prototype._getConfig = function _getConfig(config) {
  1390. config = $.extend({}, Default, config);
  1391. Util.typeCheckConfig(NAME, config, DefaultType);
  1392. return config;
  1393. };
  1394. Modal.prototype._showElement = function _showElement(relatedTarget) {
  1395. var _this8 = this;
  1396. var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
  1397. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  1398. // don't move modals dom position
  1399. document.body.appendChild(this._element);
  1400. }
  1401. this._element.style.display = 'block';
  1402. this._element.removeAttribute('aria-hidden');
  1403. this._element.scrollTop = 0;
  1404. if (transition) {
  1405. Util.reflow(this._element);
  1406. }
  1407. $(this._element).addClass(ClassName.IN);
  1408. if (this._config.focus) {
  1409. this._enforceFocus();
  1410. }
  1411. var shownEvent = $.Event(Event.SHOWN, {
  1412. relatedTarget: relatedTarget
  1413. });
  1414. var transitionComplete = function transitionComplete() {
  1415. if (_this8._config.focus) {
  1416. _this8._element.focus();
  1417. }
  1418. $(_this8._element).trigger(shownEvent);
  1419. };
  1420. if (transition) {
  1421. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION);
  1422. } else {
  1423. transitionComplete();
  1424. }
  1425. };
  1426. Modal.prototype._enforceFocus = function _enforceFocus() {
  1427. var _this9 = this;
  1428. $(document).off(Event.FOCUSIN) // guard against infinite focus loop
  1429. .on(Event.FOCUSIN, function (event) {
  1430. if (document !== event.target && _this9._element !== event.target && !$(_this9._element).has(event.target).length) {
  1431. _this9._element.focus();
  1432. }
  1433. });
  1434. };
  1435. Modal.prototype._setEscapeEvent = function _setEscapeEvent() {
  1436. var _this10 = this;
  1437. if (this._isShown && this._config.keyboard) {
  1438. $(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
  1439. if (event.which === ESCAPE_KEYCODE) {
  1440. _this10.hide();
  1441. }
  1442. });
  1443. } else if (!this._isShown) {
  1444. $(this._element).off(Event.KEYDOWN_DISMISS);
  1445. }
  1446. };
  1447. Modal.prototype._setResizeEvent = function _setResizeEvent() {
  1448. if (this._isShown) {
  1449. $(window).on(Event.RESIZE, $.proxy(this._handleUpdate, this));
  1450. } else {
  1451. $(window).off(Event.RESIZE);
  1452. }
  1453. };
  1454. Modal.prototype._hideModal = function _hideModal() {
  1455. var _this11 = this;
  1456. this._element.style.display = 'none';
  1457. this._element.setAttribute('aria-hidden', 'true');
  1458. this._showBackdrop(function () {
  1459. $(document.body).removeClass(ClassName.OPEN);
  1460. _this11._resetAdjustments();
  1461. _this11._resetScrollbar();
  1462. $(_this11._element).trigger(Event.HIDDEN);
  1463. });
  1464. };
  1465. Modal.prototype._removeBackdrop = function _removeBackdrop() {
  1466. if (this._backdrop) {
  1467. $(this._backdrop).remove();
  1468. this._backdrop = null;
  1469. }
  1470. };
  1471. Modal.prototype._showBackdrop = function _showBackdrop(callback) {
  1472. var _this12 = this;
  1473. var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
  1474. if (this._isShown && this._config.backdrop) {
  1475. var doAnimate = Util.supportsTransitionEnd() && animate;
  1476. this._backdrop = document.createElement('div');
  1477. this._backdrop.className = ClassName.BACKDROP;
  1478. if (animate) {
  1479. $(this._backdrop).addClass(animate);
  1480. }
  1481. $(this._backdrop).appendTo(document.body);
  1482. $(this._element).on(Event.CLICK_DISMISS, function (event) {
  1483. if (_this12._ignoreBackdropClick) {
  1484. _this12._ignoreBackdropClick = false;
  1485. return;
  1486. }
  1487. if (event.target !== event.currentTarget) {
  1488. return;
  1489. }
  1490. if (_this12._config.backdrop === 'static') {
  1491. _this12._element.focus();
  1492. } else {
  1493. _this12.hide();
  1494. }
  1495. });
  1496. if (doAnimate) {
  1497. Util.reflow(this._backdrop);
  1498. }
  1499. $(this._backdrop).addClass(ClassName.IN);
  1500. if (!callback) {
  1501. return;
  1502. }
  1503. if (!doAnimate) {
  1504. callback();
  1505. return;
  1506. }
  1507. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
  1508. } else if (!this._isShown && this._backdrop) {
  1509. $(this._backdrop).removeClass(ClassName.IN);
  1510. var callbackRemove = function callbackRemove() {
  1511. _this12._removeBackdrop();
  1512. if (callback) {
  1513. callback();
  1514. }
  1515. };
  1516. if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
  1517. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
  1518. } else {
  1519. callbackRemove();
  1520. }
  1521. } else if (callback) {
  1522. callback();
  1523. }
  1524. };
  1525. // ----------------------------------------------------------------------
  1526. // the following methods are used to handle overflowing modals
  1527. // todo (fat): these should probably be refactored out of modal.js
  1528. // ----------------------------------------------------------------------
  1529. Modal.prototype._handleUpdate = function _handleUpdate() {
  1530. this._adjustDialog();
  1531. };
  1532. Modal.prototype._adjustDialog = function _adjustDialog() {
  1533. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  1534. if (!this._isBodyOverflowing && isModalOverflowing) {
  1535. this._element.style.paddingLeft = this._scrollbarWidth + 'px';
  1536. }
  1537. if (this._isBodyOverflowing && !isModalOverflowing) {
  1538. this._element.style.paddingRight = this._scrollbarWidth + 'px';
  1539. }
  1540. };
  1541. Modal.prototype._resetAdjustments = function _resetAdjustments() {
  1542. this._element.style.paddingLeft = '';
  1543. this._element.style.paddingRight = '';
  1544. };
  1545. Modal.prototype._checkScrollbar = function _checkScrollbar() {
  1546. this._isBodyOverflowing = document.body.clientWidth < window.innerWidth;
  1547. this._scrollbarWidth = this._getScrollbarWidth();
  1548. };
  1549. Modal.prototype._setScrollbar = function _setScrollbar() {
  1550. var bodyPadding = parseInt($(Selector.FIXED_CONTENT).css('padding-right') || 0, 10);
  1551. this._originalBodyPadding = document.body.style.paddingRight || '';
  1552. if (this._isBodyOverflowing) {
  1553. document.body.style.paddingRight = bodyPadding + this._scrollbarWidth + 'px';
  1554. }
  1555. };
  1556. Modal.prototype._resetScrollbar = function _resetScrollbar() {
  1557. document.body.style.paddingRight = this._originalBodyPadding;
  1558. };
  1559. Modal.prototype._getScrollbarWidth = function _getScrollbarWidth() {
  1560. // thx d.walsh
  1561. var scrollDiv = document.createElement('div');
  1562. scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
  1563. document.body.appendChild(scrollDiv);
  1564. var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
  1565. document.body.removeChild(scrollDiv);
  1566. return scrollbarWidth;
  1567. };
  1568. // static
  1569. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  1570. return this.each(function () {
  1571. var data = $(this).data(DATA_KEY);
  1572. var _config = $.extend({}, Modal.Default, $(this).data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config);
  1573. if (!data) {
  1574. data = new Modal(this, _config);
  1575. $(this).data(DATA_KEY, data);
  1576. }
  1577. if (typeof config === 'string') {
  1578. if (data[config] === undefined) {
  1579. throw new Error('No method named "' + config + '"');
  1580. }
  1581. data[config](relatedTarget);
  1582. } else if (_config.show) {
  1583. data.show(relatedTarget);
  1584. }
  1585. });
  1586. };
  1587. _createClass(Modal, null, [{
  1588. key: 'VERSION',
  1589. get: function get() {
  1590. return VERSION;
  1591. }
  1592. }, {
  1593. key: 'Default',
  1594. get: function get() {
  1595. return Default;
  1596. }
  1597. }]);
  1598. return Modal;
  1599. }();
  1600. /**
  1601. * ------------------------------------------------------------------------
  1602. * Data Api implementation
  1603. * ------------------------------------------------------------------------
  1604. */
  1605. $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  1606. var _this13 = this;
  1607. var target = void 0;
  1608. var selector = Util.getSelectorFromElement(this);
  1609. if (selector) {
  1610. target = $(selector)[0];
  1611. }
  1612. var config = $(target).data(DATA_KEY) ? 'toggle' : $.extend({}, $(target).data(), $(this).data());
  1613. if (this.tagName === 'A') {
  1614. event.preventDefault();
  1615. }
  1616. var $target = $(target).one(Event.SHOW, function (showEvent) {
  1617. if (showEvent.isDefaultPrevented()) {
  1618. // only register focus restorer if modal will actually get shown
  1619. return;
  1620. }
  1621. $target.one(Event.HIDDEN, function () {
  1622. if ($(_this13).is(':visible')) {
  1623. _this13.focus();
  1624. }
  1625. });
  1626. });
  1627. Modal._jQueryInterface.call($(target), config, this);
  1628. });
  1629. /**
  1630. * ------------------------------------------------------------------------
  1631. * jQuery
  1632. * ------------------------------------------------------------------------
  1633. */
  1634. $.fn[NAME] = Modal._jQueryInterface;
  1635. $.fn[NAME].Constructor = Modal;
  1636. $.fn[NAME].noConflict = function () {
  1637. $.fn[NAME] = JQUERY_NO_CONFLICT;
  1638. return Modal._jQueryInterface;
  1639. };
  1640. return Modal;
  1641. }(jQuery);
  1642. /**
  1643. * --------------------------------------------------------------------------
  1644. * Bootstrap (v4.0.0-alpha.4): scrollspy.js
  1645. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1646. * --------------------------------------------------------------------------
  1647. */
  1648. var ScrollSpy = function ($) {
  1649. /**
  1650. * ------------------------------------------------------------------------
  1651. * Constants
  1652. * ------------------------------------------------------------------------
  1653. */
  1654. var NAME = 'scrollspy';
  1655. var VERSION = '4.0.0-alpha.4';
  1656. var DATA_KEY = 'bs.scrollspy';
  1657. var EVENT_KEY = '.' + DATA_KEY;
  1658. var DATA_API_KEY = '.data-api';
  1659. var JQUERY_NO_CONFLICT = $.fn[NAME];
  1660. var Default = {
  1661. offset: 10,
  1662. method: 'auto',
  1663. target: ''
  1664. };
  1665. var DefaultType = {
  1666. offset: 'number',
  1667. method: 'string',
  1668. target: '(string|element)'
  1669. };
  1670. var Event = {
  1671. ACTIVATE: 'activate' + EVENT_KEY,
  1672. SCROLL: 'scroll' + EVENT_KEY,
  1673. LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY
  1674. };
  1675. var ClassName = {
  1676. DROPDOWN_ITEM: 'dropdown-item',
  1677. DROPDOWN_MENU: 'dropdown-menu',
  1678. NAV_LINK: 'nav-link',
  1679. NAV: 'nav',
  1680. ACTIVE: 'active'
  1681. };
  1682. var Selector = {
  1683. DATA_SPY: '[data-spy="scroll"]',
  1684. ACTIVE: '.active',
  1685. LIST_ITEM: '.list-item',
  1686. LI: 'li',
  1687. LI_DROPDOWN: 'li.dropdown',
  1688. NAV_LINKS: '.nav-link',
  1689. DROPDOWN: '.dropdown',
  1690. DROPDOWN_ITEMS: '.dropdown-item',
  1691. DROPDOWN_TOGGLE: '.dropdown-toggle'
  1692. };
  1693. var OffsetMethod = {
  1694. OFFSET: 'offset',
  1695. POSITION: 'position'
  1696. };
  1697. /**
  1698. * ------------------------------------------------------------------------
  1699. * Class Definition
  1700. * ------------------------------------------------------------------------
  1701. */
  1702. var ScrollSpy = function () {
  1703. function ScrollSpy(element, config) {
  1704. _classCallCheck(this, ScrollSpy);
  1705. this._element = element;
  1706. this._scrollElement = element.tagName === 'BODY' ? window : element;
  1707. this._config = this._getConfig(config);
  1708. this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS);
  1709. this._offsets = [];
  1710. this._targets = [];
  1711. this._activeTarget = null;
  1712. this._scrollHeight = 0;
  1713. $(this._scrollElement).on(Event.SCROLL, $.proxy(this._process, this));
  1714. this.refresh();
  1715. this._process();
  1716. }
  1717. // getters
  1718. // public
  1719. ScrollSpy.prototype.refresh = function refresh() {
  1720. var _this14 = this;
  1721. var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET;
  1722. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  1723. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  1724. this._offsets = [];
  1725. this._targets = [];
  1726. this._scrollHeight = this._getScrollHeight();
  1727. var targets = $.makeArray($(this._selector));
  1728. targets.map(function (element) {
  1729. var target = void 0;
  1730. var targetSelector = Util.getSelectorFromElement(element);
  1731. if (targetSelector) {
  1732. target = $(targetSelector)[0];
  1733. }
  1734. if (target && (target.offsetWidth || target.offsetHeight)) {
  1735. // todo (fat): remove sketch reliance on jQuery position/offset
  1736. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  1737. }
  1738. return null;
  1739. }).filter(function (item) {
  1740. return item;
  1741. }).sort(function (a, b) {
  1742. return a[0] - b[0];
  1743. }).forEach(function (item) {
  1744. _this14._offsets.push(item[0]);
  1745. _this14._targets.push(item[1]);
  1746. });
  1747. };
  1748. ScrollSpy.prototype.dispose = function dispose() {
  1749. $.removeData(this._element, DATA_KEY);
  1750. $(this._scrollElement).off(EVENT_KEY);
  1751. this._element = null;
  1752. this._scrollElement = null;
  1753. this._config = null;
  1754. this._selector = null;
  1755. this._offsets = null;
  1756. this._targets = null;
  1757. this._activeTarget = null;
  1758. this._scrollHeight = null;
  1759. };
  1760. // private
  1761. ScrollSpy.prototype._getConfig = function _getConfig(config) {
  1762. config = $.extend({}, Default, config);
  1763. if (typeof config.target !== 'string') {
  1764. var id = $(config.target).attr('id');
  1765. if (!id) {
  1766. id = Util.getUID(NAME);
  1767. $(config.target).attr('id', id);
  1768. }
  1769. config.target = '#' + id;
  1770. }
  1771. Util.typeCheckConfig(NAME, config, DefaultType);
  1772. return config;
  1773. };
  1774. ScrollSpy.prototype._getScrollTop = function _getScrollTop() {
  1775. return this._scrollElement === window ? this._scrollElement.scrollY : this._scrollElement.scrollTop;
  1776. };
  1777. ScrollSpy.prototype._getScrollHeight = function _getScrollHeight() {
  1778. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  1779. };
  1780. ScrollSpy.prototype._process = function _process() {
  1781. var scrollTop = this._getScrollTop() + this._config.offset;
  1782. var scrollHeight = this._getScrollHeight();
  1783. var maxScroll = this._config.offset + scrollHeight - this._scrollElement.offsetHeight;
  1784. if (this._scrollHeight !== scrollHeight) {
  1785. this.refresh();
  1786. }
  1787. if (scrollTop >= maxScroll) {
  1788. var target = this._targets[this._targets.length - 1];
  1789. if (this._activeTarget !== target) {
  1790. this._activate(target);
  1791. }
  1792. }
  1793. if (this._activeTarget && scrollTop < this._offsets[0]) {
  1794. this._activeTarget = null;
  1795. this._clear();
  1796. return;
  1797. }
  1798. for (var i = this._offsets.length; i--;) {
  1799. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (this._offsets[i + 1] === undefined || scrollTop < this._offsets[i + 1]);
  1800. if (isActiveTarget) {
  1801. this._activate(this._targets[i]);
  1802. }
  1803. }
  1804. };
  1805. ScrollSpy.prototype._activate = function _activate(target) {
  1806. this._activeTarget = target;
  1807. this._clear();
  1808. var queries = this._selector.split(',');
  1809. queries = queries.map(function (selector) {
  1810. return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]');
  1811. });
  1812. var $link = $(queries.join(','));
  1813. if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
  1814. $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
  1815. $link.addClass(ClassName.ACTIVE);
  1816. } else {
  1817. // todo (fat) this is kinda sus...
  1818. // recursively add actives to tested nav-links
  1819. $link.parents(Selector.LI).find(Selector.NAV_LINKS).addClass(ClassName.ACTIVE);
  1820. }
  1821. $(this._scrollElement).trigger(Event.ACTIVATE, {
  1822. relatedTarget: target
  1823. });
  1824. };
  1825. ScrollSpy.prototype._clear = function _clear() {
  1826. $(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
  1827. };
  1828. // static
  1829. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  1830. return this.each(function () {
  1831. var data = $(this).data(DATA_KEY);
  1832. var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config || null;
  1833. if (!data) {
  1834. data = new ScrollSpy(this, _config);
  1835. $(this).data(DATA_KEY, data);
  1836. }
  1837. if (typeof config === 'string') {
  1838. if (data[config] === undefined) {
  1839. throw new Error('No method named "' + config + '"');
  1840. }
  1841. data[config]();
  1842. }
  1843. });
  1844. };
  1845. _createClass(ScrollSpy, null, [{
  1846. key: 'VERSION',
  1847. get: function get() {
  1848. return VERSION;
  1849. }
  1850. }, {
  1851. key: 'Default',
  1852. get: function get() {
  1853. return Default;
  1854. }
  1855. }]);
  1856. return ScrollSpy;
  1857. }();
  1858. /**
  1859. * ------------------------------------------------------------------------
  1860. * Data Api implementation
  1861. * ------------------------------------------------------------------------
  1862. */
  1863. $(window).on(Event.LOAD_DATA_API, function () {
  1864. var scrollSpys = $.makeArray($(Selector.DATA_SPY));
  1865. for (var i = scrollSpys.length; i--;) {
  1866. var $spy = $(scrollSpys[i]);
  1867. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  1868. }
  1869. });
  1870. /**
  1871. * ------------------------------------------------------------------------
  1872. * jQuery
  1873. * ------------------------------------------------------------------------
  1874. */
  1875. $.fn[NAME] = ScrollSpy._jQueryInterface;
  1876. $.fn[NAME].Constructor = ScrollSpy;
  1877. $.fn[NAME].noConflict = function () {
  1878. $.fn[NAME] = JQUERY_NO_CONFLICT;
  1879. return ScrollSpy._jQueryInterface;
  1880. };
  1881. return ScrollSpy;
  1882. }(jQuery);
  1883. /**
  1884. * --------------------------------------------------------------------------
  1885. * Bootstrap (v4.0.0-alpha.4): tab.js
  1886. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1887. * --------------------------------------------------------------------------
  1888. */
  1889. var Tab = function ($) {
  1890. /**
  1891. * ------------------------------------------------------------------------
  1892. * Constants
  1893. * ------------------------------------------------------------------------
  1894. */
  1895. var NAME = 'tab';
  1896. var VERSION = '4.0.0-alpha.4';
  1897. var DATA_KEY = 'bs.tab';
  1898. var EVENT_KEY = '.' + DATA_KEY;
  1899. var DATA_API_KEY = '.data-api';
  1900. var JQUERY_NO_CONFLICT = $.fn[NAME];
  1901. var TRANSITION_DURATION = 150;
  1902. var Event = {
  1903. HIDE: 'hide' + EVENT_KEY,
  1904. HIDDEN: 'hidden' + EVENT_KEY,
  1905. SHOW: 'show' + EVENT_KEY,
  1906. SHOWN: 'shown' + EVENT_KEY,
  1907. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  1908. };
  1909. var ClassName = {
  1910. DROPDOWN_MENU: 'dropdown-menu',
  1911. ACTIVE: 'active',
  1912. FADE: 'fade',
  1913. IN: 'in'
  1914. };
  1915. var Selector = {
  1916. A: 'a',
  1917. LI: 'li',
  1918. DROPDOWN: '.dropdown',
  1919. UL: 'ul:not(.dropdown-menu)',
  1920. FADE_CHILD: '> .nav-item .fade, > .fade',
  1921. ACTIVE: '.active',
  1922. ACTIVE_CHILD: '> .nav-item > .active, > .active',
  1923. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"]',
  1924. DROPDOWN_TOGGLE: '.dropdown-toggle',
  1925. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  1926. };
  1927. /**
  1928. * ------------------------------------------------------------------------
  1929. * Class Definition
  1930. * ------------------------------------------------------------------------
  1931. */
  1932. var Tab = function () {
  1933. function Tab(element) {
  1934. _classCallCheck(this, Tab);
  1935. this._element = element;
  1936. }
  1937. // getters
  1938. // public
  1939. Tab.prototype.show = function show() {
  1940. var _this15 = this;
  1941. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE)) {
  1942. return;
  1943. }
  1944. var target = void 0;
  1945. var previous = void 0;
  1946. var ulElement = $(this._element).closest(Selector.UL)[0];
  1947. var selector = Util.getSelectorFromElement(this._element);
  1948. if (ulElement) {
  1949. previous = $.makeArray($(ulElement).find(Selector.ACTIVE));
  1950. previous = previous[previous.length - 1];
  1951. }
  1952. var hideEvent = $.Event(Event.HIDE, {
  1953. relatedTarget: this._element
  1954. });
  1955. var showEvent = $.Event(Event.SHOW, {
  1956. relatedTarget: previous
  1957. });
  1958. if (previous) {
  1959. $(previous).trigger(hideEvent);
  1960. }
  1961. $(this._element).trigger(showEvent);
  1962. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  1963. return;
  1964. }
  1965. if (selector) {
  1966. target = $(selector)[0];
  1967. }
  1968. this._activate(this._element, ulElement);
  1969. var complete = function complete() {
  1970. var hiddenEvent = $.Event(Event.HIDDEN, {
  1971. relatedTarget: _this15._element
  1972. });
  1973. var shownEvent = $.Event(Event.SHOWN, {
  1974. relatedTarget: previous
  1975. });
  1976. $(previous).trigger(hiddenEvent);
  1977. $(_this15._element).trigger(shownEvent);
  1978. };
  1979. if (target) {
  1980. this._activate(target, target.parentNode, complete);
  1981. } else {
  1982. complete();
  1983. }
  1984. };
  1985. Tab.prototype.dispose = function dispose() {
  1986. $.removeClass(this._element, DATA_KEY);
  1987. this._element = null;
  1988. };
  1989. // private
  1990. Tab.prototype._activate = function _activate(element, container, callback) {
  1991. var active = $(container).find(Selector.ACTIVE_CHILD)[0];
  1992. var isTransitioning = callback && Util.supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || Boolean($(container).find(Selector.FADE_CHILD)[0]));
  1993. var complete = $.proxy(this._transitionComplete, this, element, active, isTransitioning, callback);
  1994. if (active && isTransitioning) {
  1995. $(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  1996. } else {
  1997. complete();
  1998. }
  1999. if (active) {
  2000. $(active).removeClass(ClassName.IN);
  2001. }
  2002. };
  2003. Tab.prototype._transitionComplete = function _transitionComplete(element, active, isTransitioning, callback) {
  2004. if (active) {
  2005. $(active).removeClass(ClassName.ACTIVE);
  2006. var dropdownChild = $(active).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
  2007. if (dropdownChild) {
  2008. $(dropdownChild).removeClass(ClassName.ACTIVE);
  2009. }
  2010. active.setAttribute('aria-expanded', false);
  2011. }
  2012. $(element).addClass(ClassName.ACTIVE);
  2013. element.setAttribute('aria-expanded', true);
  2014. if (isTransitioning) {
  2015. Util.reflow(element);
  2016. $(element).addClass(ClassName.IN);
  2017. } else {
  2018. $(element).removeClass(ClassName.FADE);
  2019. }
  2020. if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
  2021. var dropdownElement = $(element).closest(Selector.DROPDOWN)[0];
  2022. if (dropdownElement) {
  2023. $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
  2024. }
  2025. element.setAttribute('aria-expanded', true);
  2026. }
  2027. if (callback) {
  2028. callback();
  2029. }
  2030. };
  2031. // static
  2032. Tab._jQueryInterface = function _jQueryInterface(config) {
  2033. return this.each(function () {
  2034. var $this = $(this);
  2035. var data = $this.data(DATA_KEY);
  2036. if (!data) {
  2037. data = data = new Tab(this);
  2038. $this.data(DATA_KEY, data);
  2039. }
  2040. if (typeof config === 'string') {
  2041. if (data[config] === undefined) {
  2042. throw new Error('No method named "' + config + '"');
  2043. }
  2044. data[config]();
  2045. }
  2046. });
  2047. };
  2048. _createClass(Tab, null, [{
  2049. key: 'VERSION',
  2050. get: function get() {
  2051. return VERSION;
  2052. }
  2053. }]);
  2054. return Tab;
  2055. }();
  2056. /**
  2057. * ------------------------------------------------------------------------
  2058. * Data Api implementation
  2059. * ------------------------------------------------------------------------
  2060. */
  2061. $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  2062. event.preventDefault();
  2063. Tab._jQueryInterface.call($(this), 'show');
  2064. });
  2065. /**
  2066. * ------------------------------------------------------------------------
  2067. * jQuery
  2068. * ------------------------------------------------------------------------
  2069. */
  2070. $.fn[NAME] = Tab._jQueryInterface;
  2071. $.fn[NAME].Constructor = Tab;
  2072. $.fn[NAME].noConflict = function () {
  2073. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2074. return Tab._jQueryInterface;
  2075. };
  2076. return Tab;
  2077. }(jQuery);
  2078. /* global Tether */
  2079. /**
  2080. * --------------------------------------------------------------------------
  2081. * Bootstrap (v4.0.0-alpha.4): tooltip.js
  2082. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2083. * --------------------------------------------------------------------------
  2084. */
  2085. var Tooltip = function ($) {
  2086. /**
  2087. * Check for Tether dependency
  2088. * Tether - http://tether.io/
  2089. */
  2090. if (window.Tether === undefined) {
  2091. throw new Error('Bootstrap tooltips require Tether (http://tether.io/)');
  2092. }
  2093. /**
  2094. * ------------------------------------------------------------------------
  2095. * Constants
  2096. * ------------------------------------------------------------------------
  2097. */
  2098. var NAME = 'tooltip';
  2099. var VERSION = '4.0.0-alpha.4';
  2100. var DATA_KEY = 'bs.tooltip';
  2101. var EVENT_KEY = '.' + DATA_KEY;
  2102. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2103. var TRANSITION_DURATION = 150;
  2104. var CLASS_PREFIX = 'bs-tether';
  2105. var Default = {
  2106. animation: true,
  2107. template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-inner"></div></div>',
  2108. trigger: 'hover focus',
  2109. title: '',
  2110. delay: 0,
  2111. html: false,
  2112. selector: false,
  2113. placement: 'top',
  2114. offset: '0 0',
  2115. constraints: []
  2116. };
  2117. var DefaultType = {
  2118. animation: 'boolean',
  2119. template: 'string',
  2120. title: '(string|element|function)',
  2121. trigger: 'string',
  2122. delay: '(number|object)',
  2123. html: 'boolean',
  2124. selector: '(string|boolean)',
  2125. placement: '(string|function)',
  2126. offset: 'string',
  2127. constraints: 'array'
  2128. };
  2129. var AttachmentMap = {
  2130. TOP: 'bottom center',
  2131. RIGHT: 'middle left',
  2132. BOTTOM: 'top center',
  2133. LEFT: 'middle right'
  2134. };
  2135. var HoverState = {
  2136. IN: 'in',
  2137. OUT: 'out'
  2138. };
  2139. var Event = {
  2140. HIDE: 'hide' + EVENT_KEY,
  2141. HIDDEN: 'hidden' + EVENT_KEY,
  2142. SHOW: 'show' + EVENT_KEY,
  2143. SHOWN: 'shown' + EVENT_KEY,
  2144. INSERTED: 'inserted' + EVENT_KEY,
  2145. CLICK: 'click' + EVENT_KEY,
  2146. FOCUSIN: 'focusin' + EVENT_KEY,
  2147. FOCUSOUT: 'focusout' + EVENT_KEY,
  2148. MOUSEENTER: 'mouseenter' + EVENT_KEY,
  2149. MOUSELEAVE: 'mouseleave' + EVENT_KEY
  2150. };
  2151. var ClassName = {
  2152. FADE: 'fade',
  2153. IN: 'in'
  2154. };
  2155. var Selector = {
  2156. TOOLTIP: '.tooltip',
  2157. TOOLTIP_INNER: '.tooltip-inner'
  2158. };
  2159. var TetherClass = {
  2160. element: false,
  2161. enabled: false
  2162. };
  2163. var Trigger = {
  2164. HOVER: 'hover',
  2165. FOCUS: 'focus',
  2166. CLICK: 'click',
  2167. MANUAL: 'manual'
  2168. };
  2169. /**
  2170. * ------------------------------------------------------------------------
  2171. * Class Definition
  2172. * ------------------------------------------------------------------------
  2173. */
  2174. var Tooltip = function () {
  2175. function Tooltip(element, config) {
  2176. _classCallCheck(this, Tooltip);
  2177. // private
  2178. this._isEnabled = true;
  2179. this._timeout = 0;
  2180. this._hoverState = '';
  2181. this._activeTrigger = {};
  2182. this._tether = null;
  2183. // protected
  2184. this.element = element;
  2185. this.config = this._getConfig(config);
  2186. this.tip = null;
  2187. this._setListeners();
  2188. }
  2189. // getters
  2190. // public
  2191. Tooltip.prototype.enable = function enable() {
  2192. this._isEnabled = true;
  2193. };
  2194. Tooltip.prototype.disable = function disable() {
  2195. this._isEnabled = false;
  2196. };
  2197. Tooltip.prototype.toggleEnabled = function toggleEnabled() {
  2198. this._isEnabled = !this._isEnabled;
  2199. };
  2200. Tooltip.prototype.toggle = function toggle(event) {
  2201. if (event) {
  2202. var dataKey = this.constructor.DATA_KEY;
  2203. var context = $(event.currentTarget).data(dataKey);
  2204. if (!context) {
  2205. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  2206. $(event.currentTarget).data(dataKey, context);
  2207. }
  2208. context._activeTrigger.click = !context._activeTrigger.click;
  2209. if (context._isWithActiveTrigger()) {
  2210. context._enter(null, context);
  2211. } else {
  2212. context._leave(null, context);
  2213. }
  2214. } else {
  2215. if ($(this.getTipElement()).hasClass(ClassName.IN)) {
  2216. this._leave(null, this);
  2217. return;
  2218. }
  2219. this._enter(null, this);
  2220. }
  2221. };
  2222. Tooltip.prototype.dispose = function dispose() {
  2223. clearTimeout(this._timeout);
  2224. this.cleanupTether();
  2225. $.removeData(this.element, this.constructor.DATA_KEY);
  2226. $(this.element).off(this.constructor.EVENT_KEY);
  2227. if (this.tip) {
  2228. $(this.tip).remove();
  2229. }
  2230. this._isEnabled = null;
  2231. this._timeout = null;
  2232. this._hoverState = null;
  2233. this._activeTrigger = null;
  2234. this._tether = null;
  2235. this.element = null;
  2236. this.config = null;
  2237. this.tip = null;
  2238. };
  2239. Tooltip.prototype.show = function show() {
  2240. var _this16 = this;
  2241. var showEvent = $.Event(this.constructor.Event.SHOW);
  2242. if (this.isWithContent() && this._isEnabled) {
  2243. $(this.element).trigger(showEvent);
  2244. var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element);
  2245. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  2246. return;
  2247. }
  2248. var tip = this.getTipElement();
  2249. var tipId = Util.getUID(this.constructor.NAME);
  2250. tip.setAttribute('id', tipId);
  2251. this.element.setAttribute('aria-describedby', tipId);
  2252. this.setContent();
  2253. if (this.config.animation) {
  2254. $(tip).addClass(ClassName.FADE);
  2255. }
  2256. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  2257. var attachment = this._getAttachment(placement);
  2258. $(tip).data(this.constructor.DATA_KEY, this).appendTo(document.body);
  2259. $(this.element).trigger(this.constructor.Event.INSERTED);
  2260. this._tether = new Tether({
  2261. attachment: attachment,
  2262. element: tip,
  2263. target: this.element,
  2264. classes: TetherClass,
  2265. classPrefix: CLASS_PREFIX,
  2266. offset: this.config.offset,
  2267. constraints: this.config.constraints,
  2268. addTargetClasses: false
  2269. });
  2270. Util.reflow(tip);
  2271. this._tether.position();
  2272. $(tip).addClass(ClassName.IN);
  2273. var complete = function complete() {
  2274. var prevHoverState = _this16._hoverState;
  2275. _this16._hoverState = null;
  2276. $(_this16.element).trigger(_this16.constructor.Event.SHOWN);
  2277. if (prevHoverState === HoverState.OUT) {
  2278. _this16._leave(null, _this16);
  2279. }
  2280. };
  2281. if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
  2282. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION);
  2283. return;
  2284. }
  2285. complete();
  2286. }
  2287. };
  2288. Tooltip.prototype.hide = function hide(callback) {
  2289. var _this17 = this;
  2290. var tip = this.getTipElement();
  2291. var hideEvent = $.Event(this.constructor.Event.HIDE);
  2292. var complete = function complete() {
  2293. if (_this17._hoverState !== HoverState.IN && tip.parentNode) {
  2294. tip.parentNode.removeChild(tip);
  2295. }
  2296. _this17.element.removeAttribute('aria-describedby');
  2297. $(_this17.element).trigger(_this17.constructor.Event.HIDDEN);
  2298. _this17.cleanupTether();
  2299. if (callback) {
  2300. callback();
  2301. }
  2302. };
  2303. $(this.element).trigger(hideEvent);
  2304. if (hideEvent.isDefaultPrevented()) {
  2305. return;
  2306. }
  2307. $(tip).removeClass(ClassName.IN);
  2308. if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
  2309. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  2310. } else {
  2311. complete();
  2312. }
  2313. this._hoverState = '';
  2314. };
  2315. // protected
  2316. Tooltip.prototype.isWithContent = function isWithContent() {
  2317. return Boolean(this.getTitle());
  2318. };
  2319. Tooltip.prototype.getTipElement = function getTipElement() {
  2320. return this.tip = this.tip || $(this.config.template)[0];
  2321. };
  2322. Tooltip.prototype.setContent = function setContent() {
  2323. var $tip = $(this.getTipElement());
  2324. this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle());
  2325. $tip.removeClass(ClassName.FADE).removeClass(ClassName.IN);
  2326. this.cleanupTether();
  2327. };
  2328. Tooltip.prototype.setElementContent = function setElementContent($element, content) {
  2329. var html = this.config.html;
  2330. if ((typeof content === 'undefined' ? 'undefined' : _typeof(content)) === 'object' && (content.nodeType || content.jquery)) {
  2331. // content is a DOM node or a jQuery
  2332. if (html) {
  2333. if (!$(content).parent().is($element)) {
  2334. $element.empty().append(content);
  2335. }
  2336. } else {
  2337. $element.text($(content).text());
  2338. }
  2339. } else {
  2340. $element[html ? 'html' : 'text'](content);
  2341. }
  2342. };
  2343. Tooltip.prototype.getTitle = function getTitle() {
  2344. var title = this.element.getAttribute('data-original-title');
  2345. if (!title) {
  2346. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  2347. }
  2348. return title;
  2349. };
  2350. Tooltip.prototype.cleanupTether = function cleanupTether() {
  2351. if (this._tether) {
  2352. this._tether.destroy();
  2353. }
  2354. };
  2355. // private
  2356. Tooltip.prototype._getAttachment = function _getAttachment(placement) {
  2357. return AttachmentMap[placement.toUpperCase()];
  2358. };
  2359. Tooltip.prototype._setListeners = function _setListeners() {
  2360. var _this18 = this;
  2361. var triggers = this.config.trigger.split(' ');
  2362. triggers.forEach(function (trigger) {
  2363. if (trigger === 'click') {
  2364. $(_this18.element).on(_this18.constructor.Event.CLICK, _this18.config.selector, $.proxy(_this18.toggle, _this18));
  2365. } else if (trigger !== Trigger.MANUAL) {
  2366. var eventIn = trigger === Trigger.HOVER ? _this18.constructor.Event.MOUSEENTER : _this18.constructor.Event.FOCUSIN;
  2367. var eventOut = trigger === Trigger.HOVER ? _this18.constructor.Event.MOUSELEAVE : _this18.constructor.Event.FOCUSOUT;
  2368. $(_this18.element).on(eventIn, _this18.config.selector, $.proxy(_this18._enter, _this18)).on(eventOut, _this18.config.selector, $.proxy(_this18._leave, _this18));
  2369. }
  2370. });
  2371. if (this.config.selector) {
  2372. this.config = $.extend({}, this.config, {
  2373. trigger: 'manual',
  2374. selector: ''
  2375. });
  2376. } else {
  2377. this._fixTitle();
  2378. }
  2379. };
  2380. Tooltip.prototype._fixTitle = function _fixTitle() {
  2381. var titleType = _typeof(this.element.getAttribute('data-original-title'));
  2382. if (this.element.getAttribute('title') || titleType !== 'string') {
  2383. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  2384. this.element.setAttribute('title', '');
  2385. }
  2386. };
  2387. Tooltip.prototype._enter = function _enter(event, context) {
  2388. var dataKey = this.constructor.DATA_KEY;
  2389. context = context || $(event.currentTarget).data(dataKey);
  2390. if (!context) {
  2391. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  2392. $(event.currentTarget).data(dataKey, context);
  2393. }
  2394. if (event) {
  2395. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  2396. }
  2397. if ($(context.getTipElement()).hasClass(ClassName.IN) || context._hoverState === HoverState.IN) {
  2398. context._hoverState = HoverState.IN;
  2399. return;
  2400. }
  2401. clearTimeout(context._timeout);
  2402. context._hoverState = HoverState.IN;
  2403. if (!context.config.delay || !context.config.delay.show) {
  2404. context.show();
  2405. return;
  2406. }
  2407. context._timeout = setTimeout(function () {
  2408. if (context._hoverState === HoverState.IN) {
  2409. context.show();
  2410. }
  2411. }, context.config.delay.show);
  2412. };
  2413. Tooltip.prototype._leave = function _leave(event, context) {
  2414. var dataKey = this.constructor.DATA_KEY;
  2415. context = context || $(event.currentTarget).data(dataKey);
  2416. if (!context) {
  2417. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  2418. $(event.currentTarget).data(dataKey, context);
  2419. }
  2420. if (event) {
  2421. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  2422. }
  2423. if (context._isWithActiveTrigger()) {
  2424. return;
  2425. }
  2426. clearTimeout(context._timeout);
  2427. context._hoverState = HoverState.OUT;
  2428. if (!context.config.delay || !context.config.delay.hide) {
  2429. context.hide();
  2430. return;
  2431. }
  2432. context._timeout = setTimeout(function () {
  2433. if (context._hoverState === HoverState.OUT) {
  2434. context.hide();
  2435. }
  2436. }, context.config.delay.hide);
  2437. };
  2438. Tooltip.prototype._isWithActiveTrigger = function _isWithActiveTrigger() {
  2439. for (var trigger in this._activeTrigger) {
  2440. if (this._activeTrigger[trigger]) {
  2441. return true;
  2442. }
  2443. }
  2444. return false;
  2445. };
  2446. Tooltip.prototype._getConfig = function _getConfig(config) {
  2447. config = $.extend({}, this.constructor.Default, $(this.element).data(), config);
  2448. if (config.delay && typeof config.delay === 'number') {
  2449. config.delay = {
  2450. show: config.delay,
  2451. hide: config.delay
  2452. };
  2453. }
  2454. Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
  2455. return config;
  2456. };
  2457. Tooltip.prototype._getDelegateConfig = function _getDelegateConfig() {
  2458. var config = {};
  2459. if (this.config) {
  2460. for (var key in this.config) {
  2461. if (this.constructor.Default[key] !== this.config[key]) {
  2462. config[key] = this.config[key];
  2463. }
  2464. }
  2465. }
  2466. return config;
  2467. };
  2468. // static
  2469. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  2470. return this.each(function () {
  2471. var data = $(this).data(DATA_KEY);
  2472. var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' ? config : null;
  2473. if (!data && /destroy|hide/.test(config)) {
  2474. return;
  2475. }
  2476. if (!data) {
  2477. data = new Tooltip(this, _config);
  2478. $(this).data(DATA_KEY, data);
  2479. }
  2480. if (typeof config === 'string') {
  2481. if (data[config] === undefined) {
  2482. throw new Error('No method named "' + config + '"');
  2483. }
  2484. data[config]();
  2485. }
  2486. });
  2487. };
  2488. _createClass(Tooltip, null, [{
  2489. key: 'VERSION',
  2490. get: function get() {
  2491. return VERSION;
  2492. }
  2493. }, {
  2494. key: 'Default',
  2495. get: function get() {
  2496. return Default;
  2497. }
  2498. }, {
  2499. key: 'NAME',
  2500. get: function get() {
  2501. return NAME;
  2502. }
  2503. }, {
  2504. key: 'DATA_KEY',
  2505. get: function get() {
  2506. return DATA_KEY;
  2507. }
  2508. }, {
  2509. key: 'Event',
  2510. get: function get() {
  2511. return Event;
  2512. }
  2513. }, {
  2514. key: 'EVENT_KEY',
  2515. get: function get() {
  2516. return EVENT_KEY;
  2517. }
  2518. }, {
  2519. key: 'DefaultType',
  2520. get: function get() {
  2521. return DefaultType;
  2522. }
  2523. }]);
  2524. return Tooltip;
  2525. }();
  2526. /**
  2527. * ------------------------------------------------------------------------
  2528. * jQuery
  2529. * ------------------------------------------------------------------------
  2530. */
  2531. $.fn[NAME] = Tooltip._jQueryInterface;
  2532. $.fn[NAME].Constructor = Tooltip;
  2533. $.fn[NAME].noConflict = function () {
  2534. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2535. return Tooltip._jQueryInterface;
  2536. };
  2537. return Tooltip;
  2538. }(jQuery);
  2539. /**
  2540. * --------------------------------------------------------------------------
  2541. * Bootstrap (v4.0.0-alpha.4): popover.js
  2542. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2543. * --------------------------------------------------------------------------
  2544. */
  2545. var Popover = function ($) {
  2546. /**
  2547. * ------------------------------------------------------------------------
  2548. * Constants
  2549. * ------------------------------------------------------------------------
  2550. */
  2551. var NAME = 'popover';
  2552. var VERSION = '4.0.0-alpha.4';
  2553. var DATA_KEY = 'bs.popover';
  2554. var EVENT_KEY = '.' + DATA_KEY;
  2555. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2556. var Default = $.extend({}, Tooltip.Default, {
  2557. placement: 'right',
  2558. trigger: 'click',
  2559. content: '',
  2560. template: '<div class="popover" role="tooltip">' + '<h3 class="popover-title"></h3>' + '<div class="popover-content"></div></div>'
  2561. });
  2562. var DefaultType = $.extend({}, Tooltip.DefaultType, {
  2563. content: '(string|element|function)'
  2564. });
  2565. var ClassName = {
  2566. FADE: 'fade',
  2567. IN: 'in'
  2568. };
  2569. var Selector = {
  2570. TITLE: '.popover-title',
  2571. CONTENT: '.popover-content'
  2572. };
  2573. var Event = {
  2574. HIDE: 'hide' + EVENT_KEY,
  2575. HIDDEN: 'hidden' + EVENT_KEY,
  2576. SHOW: 'show' + EVENT_KEY,
  2577. SHOWN: 'shown' + EVENT_KEY,
  2578. INSERTED: 'inserted' + EVENT_KEY,
  2579. CLICK: 'click' + EVENT_KEY,
  2580. FOCUSIN: 'focusin' + EVENT_KEY,
  2581. FOCUSOUT: 'focusout' + EVENT_KEY,
  2582. MOUSEENTER: 'mouseenter' + EVENT_KEY,
  2583. MOUSELEAVE: 'mouseleave' + EVENT_KEY
  2584. };
  2585. /**
  2586. * ------------------------------------------------------------------------
  2587. * Class Definition
  2588. * ------------------------------------------------------------------------
  2589. */
  2590. var Popover = function (_Tooltip) {
  2591. _inherits(Popover, _Tooltip);
  2592. function Popover() {
  2593. _classCallCheck(this, Popover);
  2594. return _possibleConstructorReturn(this, _Tooltip.apply(this, arguments));
  2595. }
  2596. // overrides
  2597. Popover.prototype.isWithContent = function isWithContent() {
  2598. return this.getTitle() || this._getContent();
  2599. };
  2600. Popover.prototype.getTipElement = function getTipElement() {
  2601. return this.tip = this.tip || $(this.config.template)[0];
  2602. };
  2603. Popover.prototype.setContent = function setContent() {
  2604. var $tip = $(this.getTipElement());
  2605. // we use append for html objects to maintain js events
  2606. this.setElementContent($tip.find(Selector.TITLE), this.getTitle());
  2607. this.setElementContent($tip.find(Selector.CONTENT), this._getContent());
  2608. $tip.removeClass(ClassName.FADE).removeClass(ClassName.IN);
  2609. this.cleanupTether();
  2610. };
  2611. // private
  2612. Popover.prototype._getContent = function _getContent() {
  2613. return this.element.getAttribute('data-content') || (typeof this.config.content === 'function' ? this.config.content.call(this.element) : this.config.content);
  2614. };
  2615. // static
  2616. Popover._jQueryInterface = function _jQueryInterface(config) {
  2617. return this.each(function () {
  2618. var data = $(this).data(DATA_KEY);
  2619. var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' ? config : null;
  2620. if (!data && /destroy|hide/.test(config)) {
  2621. return;
  2622. }
  2623. if (!data) {
  2624. data = new Popover(this, _config);
  2625. $(this).data(DATA_KEY, data);
  2626. }
  2627. if (typeof config === 'string') {
  2628. if (data[config] === undefined) {
  2629. throw new Error('No method named "' + config + '"');
  2630. }
  2631. data[config]();
  2632. }
  2633. });
  2634. };
  2635. _createClass(Popover, null, [{
  2636. key: 'VERSION',
  2637. // getters
  2638. get: function get() {
  2639. return VERSION;
  2640. }
  2641. }, {
  2642. key: 'Default',
  2643. get: function get() {
  2644. return Default;
  2645. }
  2646. }, {
  2647. key: 'NAME',
  2648. get: function get() {
  2649. return NAME;
  2650. }
  2651. }, {
  2652. key: 'DATA_KEY',
  2653. get: function get() {
  2654. return DATA_KEY;
  2655. }
  2656. }, {
  2657. key: 'Event',
  2658. get: function get() {
  2659. return Event;
  2660. }
  2661. }, {
  2662. key: 'EVENT_KEY',
  2663. get: function get() {
  2664. return EVENT_KEY;
  2665. }
  2666. }, {
  2667. key: 'DefaultType',
  2668. get: function get() {
  2669. return DefaultType;
  2670. }
  2671. }]);
  2672. return Popover;
  2673. }(Tooltip);
  2674. /**
  2675. * ------------------------------------------------------------------------
  2676. * jQuery
  2677. * ------------------------------------------------------------------------
  2678. */
  2679. $.fn[NAME] = Popover._jQueryInterface;
  2680. $.fn[NAME].Constructor = Popover;
  2681. $.fn[NAME].noConflict = function () {
  2682. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2683. return Popover._jQueryInterface;
  2684. };
  2685. return Popover;
  2686. }(jQuery);
  2687. }();