bootstrap.js 108 KB

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