bootstrap.js 109 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831
  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. // ----------------------------------------------------------------------
  1761. // the following methods are used to handle overflowing modals
  1762. // todo (fat): these should probably be refactored out of modal.js
  1763. // ----------------------------------------------------------------------
  1764. Modal.prototype._adjustDialog = function _adjustDialog() {
  1765. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  1766. if (!this._isBodyOverflowing && isModalOverflowing) {
  1767. this._element.style.paddingLeft = this._scrollbarWidth + 'px';
  1768. }
  1769. if (this._isBodyOverflowing && !isModalOverflowing) {
  1770. this._element.style.paddingRight = this._scrollbarWidth + 'px';
  1771. }
  1772. };
  1773. Modal.prototype._resetAdjustments = function _resetAdjustments() {
  1774. this._element.style.paddingLeft = '';
  1775. this._element.style.paddingRight = '';
  1776. };
  1777. Modal.prototype._checkScrollbar = function _checkScrollbar() {
  1778. this._isBodyOverflowing = document.body.clientWidth < window.innerWidth;
  1779. this._scrollbarWidth = this._getScrollbarWidth();
  1780. };
  1781. Modal.prototype._setScrollbar = function _setScrollbar() {
  1782. var _this18 = this;
  1783. if (this._isBodyOverflowing) {
  1784. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  1785. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  1786. // Adjust fixed content padding
  1787. $(Selector.FIXED_CONTENT).each(function (index, element) {
  1788. var actualPadding = $(element)[0].style.paddingRight;
  1789. var calculatedPadding = $(element).css('padding-right');
  1790. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this18._scrollbarWidth + 'px');
  1791. });
  1792. // Adjust navbar-toggler margin
  1793. $(Selector.NAVBAR_TOGGLER).each(function (index, element) {
  1794. var actualMargin = $(element)[0].style.marginRight;
  1795. var calculatedMargin = $(element).css('margin-right');
  1796. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this18._scrollbarWidth + 'px');
  1797. });
  1798. // Adjust body padding
  1799. var actualPadding = document.body.style.paddingRight;
  1800. var calculatedPadding = $('body').css('padding-right');
  1801. $('body').data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + 'px');
  1802. }
  1803. };
  1804. Modal.prototype._resetScrollbar = function _resetScrollbar() {
  1805. // Restore fixed content padding
  1806. $(Selector.FIXED_CONTENT).each(function (index, element) {
  1807. var padding = $(element).data('padding-right');
  1808. if (typeof padding !== 'undefined') {
  1809. $(element).css('padding-right', padding).removeData('padding-right');
  1810. }
  1811. });
  1812. // Restore navbar-toggler margin
  1813. $(Selector.NAVBAR_TOGGLER).each(function (index, element) {
  1814. var margin = $(element).data('margin-right');
  1815. if (typeof margin !== 'undefined') {
  1816. $(element).css('margin-right', margin).removeData('margin-right');
  1817. }
  1818. });
  1819. // Restore body padding
  1820. var padding = $('body').data('padding-right');
  1821. if (typeof padding !== 'undefined') {
  1822. $('body').css('padding-right', padding).removeData('padding-right');
  1823. }
  1824. };
  1825. Modal.prototype._getScrollbarWidth = function _getScrollbarWidth() {
  1826. // thx d.walsh
  1827. var scrollDiv = document.createElement('div');
  1828. scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
  1829. document.body.appendChild(scrollDiv);
  1830. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  1831. document.body.removeChild(scrollDiv);
  1832. return scrollbarWidth;
  1833. };
  1834. // static
  1835. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  1836. return this.each(function () {
  1837. var data = $(this).data(DATA_KEY);
  1838. var _config = $.extend({}, Modal.Default, $(this).data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config);
  1839. if (!data) {
  1840. data = new Modal(this, _config);
  1841. $(this).data(DATA_KEY, data);
  1842. }
  1843. if (typeof config === 'string') {
  1844. if (data[config] === undefined) {
  1845. throw new Error('No method named "' + config + '"');
  1846. }
  1847. data[config](relatedTarget);
  1848. } else if (_config.show) {
  1849. data.show(relatedTarget);
  1850. }
  1851. });
  1852. };
  1853. _createClass(Modal, null, [{
  1854. key: 'VERSION',
  1855. get: function get() {
  1856. return VERSION;
  1857. }
  1858. }, {
  1859. key: 'Default',
  1860. get: function get() {
  1861. return Default;
  1862. }
  1863. }]);
  1864. return Modal;
  1865. }();
  1866. /**
  1867. * ------------------------------------------------------------------------
  1868. * Data Api implementation
  1869. * ------------------------------------------------------------------------
  1870. */
  1871. $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  1872. var _this19 = this;
  1873. var target = void 0;
  1874. var selector = Util.getSelectorFromElement(this);
  1875. if (selector) {
  1876. target = $(selector)[0];
  1877. }
  1878. var config = $(target).data(DATA_KEY) ? 'toggle' : $.extend({}, $(target).data(), $(this).data());
  1879. if (this.tagName === 'A' || this.tagName === 'AREA') {
  1880. event.preventDefault();
  1881. }
  1882. var $target = $(target).one(Event.SHOW, function (showEvent) {
  1883. if (showEvent.isDefaultPrevented()) {
  1884. // only register focus restorer if modal will actually get shown
  1885. return;
  1886. }
  1887. $target.one(Event.HIDDEN, function () {
  1888. if ($(_this19).is(':visible')) {
  1889. _this19.focus();
  1890. }
  1891. });
  1892. });
  1893. Modal._jQueryInterface.call($(target), config, this);
  1894. });
  1895. /**
  1896. * ------------------------------------------------------------------------
  1897. * jQuery
  1898. * ------------------------------------------------------------------------
  1899. */
  1900. $.fn[NAME] = Modal._jQueryInterface;
  1901. $.fn[NAME].Constructor = Modal;
  1902. $.fn[NAME].noConflict = function () {
  1903. $.fn[NAME] = JQUERY_NO_CONFLICT;
  1904. return Modal._jQueryInterface;
  1905. };
  1906. return Modal;
  1907. }(jQuery);
  1908. /**
  1909. * --------------------------------------------------------------------------
  1910. * Bootstrap (v4.0.0-beta): scrollspy.js
  1911. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1912. * --------------------------------------------------------------------------
  1913. */
  1914. var ScrollSpy = function ($) {
  1915. /**
  1916. * ------------------------------------------------------------------------
  1917. * Constants
  1918. * ------------------------------------------------------------------------
  1919. */
  1920. var NAME = 'scrollspy';
  1921. var VERSION = '4.0.0-beta';
  1922. var DATA_KEY = 'bs.scrollspy';
  1923. var EVENT_KEY = '.' + DATA_KEY;
  1924. var DATA_API_KEY = '.data-api';
  1925. var JQUERY_NO_CONFLICT = $.fn[NAME];
  1926. var Default = {
  1927. offset: 10,
  1928. method: 'auto',
  1929. target: ''
  1930. };
  1931. var DefaultType = {
  1932. offset: 'number',
  1933. method: 'string',
  1934. target: '(string|element)'
  1935. };
  1936. var Event = {
  1937. ACTIVATE: 'activate' + EVENT_KEY,
  1938. SCROLL: 'scroll' + EVENT_KEY,
  1939. LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY
  1940. };
  1941. var ClassName = {
  1942. DROPDOWN_ITEM: 'dropdown-item',
  1943. DROPDOWN_MENU: 'dropdown-menu',
  1944. ACTIVE: 'active'
  1945. };
  1946. var Selector = {
  1947. DATA_SPY: '[data-spy="scroll"]',
  1948. ACTIVE: '.active',
  1949. NAV_LIST_GROUP: '.nav, .list-group',
  1950. NAV_LINKS: '.nav-link',
  1951. LIST_ITEMS: '.list-group-item',
  1952. DROPDOWN: '.dropdown',
  1953. DROPDOWN_ITEMS: '.dropdown-item',
  1954. DROPDOWN_TOGGLE: '.dropdown-toggle'
  1955. };
  1956. var OffsetMethod = {
  1957. OFFSET: 'offset',
  1958. POSITION: 'position'
  1959. /**
  1960. * ------------------------------------------------------------------------
  1961. * Class Definition
  1962. * ------------------------------------------------------------------------
  1963. */
  1964. };
  1965. var ScrollSpy = function () {
  1966. function ScrollSpy(element, config) {
  1967. var _this20 = this;
  1968. _classCallCheck(this, ScrollSpy);
  1969. this._element = element;
  1970. this._scrollElement = element.tagName === 'BODY' ? window : element;
  1971. this._config = this._getConfig(config);
  1972. this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.LIST_ITEMS + ',') + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS);
  1973. this._offsets = [];
  1974. this._targets = [];
  1975. this._activeTarget = null;
  1976. this._scrollHeight = 0;
  1977. $(this._scrollElement).on(Event.SCROLL, function (event) {
  1978. return _this20._process(event);
  1979. });
  1980. this.refresh();
  1981. this._process();
  1982. }
  1983. // getters
  1984. // public
  1985. ScrollSpy.prototype.refresh = function refresh() {
  1986. var _this21 = this;
  1987. var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET;
  1988. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  1989. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  1990. this._offsets = [];
  1991. this._targets = [];
  1992. this._scrollHeight = this._getScrollHeight();
  1993. var targets = $.makeArray($(this._selector));
  1994. targets.map(function (element) {
  1995. var target = void 0;
  1996. var targetSelector = Util.getSelectorFromElement(element);
  1997. if (targetSelector) {
  1998. target = $(targetSelector)[0];
  1999. }
  2000. if (target) {
  2001. var targetBCR = target.getBoundingClientRect();
  2002. if (targetBCR.width || targetBCR.height) {
  2003. // todo (fat): remove sketch reliance on jQuery position/offset
  2004. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  2005. }
  2006. }
  2007. return null;
  2008. }).filter(function (item) {
  2009. return item;
  2010. }).sort(function (a, b) {
  2011. return a[0] - b[0];
  2012. }).forEach(function (item) {
  2013. _this21._offsets.push(item[0]);
  2014. _this21._targets.push(item[1]);
  2015. });
  2016. };
  2017. ScrollSpy.prototype.dispose = function dispose() {
  2018. $.removeData(this._element, DATA_KEY);
  2019. $(this._scrollElement).off(EVENT_KEY);
  2020. this._element = null;
  2021. this._scrollElement = null;
  2022. this._config = null;
  2023. this._selector = null;
  2024. this._offsets = null;
  2025. this._targets = null;
  2026. this._activeTarget = null;
  2027. this._scrollHeight = null;
  2028. };
  2029. // private
  2030. ScrollSpy.prototype._getConfig = function _getConfig(config) {
  2031. config = $.extend({}, Default, config);
  2032. if (typeof config.target !== 'string') {
  2033. var id = $(config.target).attr('id');
  2034. if (!id) {
  2035. id = Util.getUID(NAME);
  2036. $(config.target).attr('id', id);
  2037. }
  2038. config.target = '#' + id;
  2039. }
  2040. Util.typeCheckConfig(NAME, config, DefaultType);
  2041. return config;
  2042. };
  2043. ScrollSpy.prototype._getScrollTop = function _getScrollTop() {
  2044. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  2045. };
  2046. ScrollSpy.prototype._getScrollHeight = function _getScrollHeight() {
  2047. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  2048. };
  2049. ScrollSpy.prototype._getOffsetHeight = function _getOffsetHeight() {
  2050. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  2051. };
  2052. ScrollSpy.prototype._process = function _process() {
  2053. var scrollTop = this._getScrollTop() + this._config.offset;
  2054. var scrollHeight = this._getScrollHeight();
  2055. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  2056. if (this._scrollHeight !== scrollHeight) {
  2057. this.refresh();
  2058. }
  2059. if (scrollTop >= maxScroll) {
  2060. var target = this._targets[this._targets.length - 1];
  2061. if (this._activeTarget !== target) {
  2062. this._activate(target);
  2063. }
  2064. return;
  2065. }
  2066. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  2067. this._activeTarget = null;
  2068. this._clear();
  2069. return;
  2070. }
  2071. for (var i = this._offsets.length; i--;) {
  2072. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (this._offsets[i + 1] === undefined || scrollTop < this._offsets[i + 1]);
  2073. if (isActiveTarget) {
  2074. this._activate(this._targets[i]);
  2075. }
  2076. }
  2077. };
  2078. ScrollSpy.prototype._activate = function _activate(target) {
  2079. this._activeTarget = target;
  2080. this._clear();
  2081. var queries = this._selector.split(',');
  2082. queries = queries.map(function (selector) {
  2083. return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]');
  2084. });
  2085. var $link = $(queries.join(','));
  2086. if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
  2087. $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
  2088. $link.addClass(ClassName.ACTIVE);
  2089. } else {
  2090. // Set triggered link as active
  2091. $link.addClass(ClassName.ACTIVE);
  2092. // Set triggered links parents as active
  2093. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  2094. $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_LINKS + ', ' + Selector.LIST_ITEMS).addClass(ClassName.ACTIVE);
  2095. }
  2096. $(this._scrollElement).trigger(Event.ACTIVATE, {
  2097. relatedTarget: target
  2098. });
  2099. };
  2100. ScrollSpy.prototype._clear = function _clear() {
  2101. $(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
  2102. };
  2103. // static
  2104. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  2105. return this.each(function () {
  2106. var data = $(this).data(DATA_KEY);
  2107. var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config;
  2108. if (!data) {
  2109. data = new ScrollSpy(this, _config);
  2110. $(this).data(DATA_KEY, data);
  2111. }
  2112. if (typeof config === 'string') {
  2113. if (data[config] === undefined) {
  2114. throw new Error('No method named "' + config + '"');
  2115. }
  2116. data[config]();
  2117. }
  2118. });
  2119. };
  2120. _createClass(ScrollSpy, null, [{
  2121. key: 'VERSION',
  2122. get: function get() {
  2123. return VERSION;
  2124. }
  2125. }, {
  2126. key: 'Default',
  2127. get: function get() {
  2128. return Default;
  2129. }
  2130. }]);
  2131. return ScrollSpy;
  2132. }();
  2133. /**
  2134. * ------------------------------------------------------------------------
  2135. * Data Api implementation
  2136. * ------------------------------------------------------------------------
  2137. */
  2138. $(window).on(Event.LOAD_DATA_API, function () {
  2139. var scrollSpys = $.makeArray($(Selector.DATA_SPY));
  2140. for (var i = scrollSpys.length; i--;) {
  2141. var $spy = $(scrollSpys[i]);
  2142. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  2143. }
  2144. });
  2145. /**
  2146. * ------------------------------------------------------------------------
  2147. * jQuery
  2148. * ------------------------------------------------------------------------
  2149. */
  2150. $.fn[NAME] = ScrollSpy._jQueryInterface;
  2151. $.fn[NAME].Constructor = ScrollSpy;
  2152. $.fn[NAME].noConflict = function () {
  2153. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2154. return ScrollSpy._jQueryInterface;
  2155. };
  2156. return ScrollSpy;
  2157. }(jQuery);
  2158. /**
  2159. * --------------------------------------------------------------------------
  2160. * Bootstrap (v4.0.0-beta): tab.js
  2161. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2162. * --------------------------------------------------------------------------
  2163. */
  2164. var Tab = function ($) {
  2165. /**
  2166. * ------------------------------------------------------------------------
  2167. * Constants
  2168. * ------------------------------------------------------------------------
  2169. */
  2170. var NAME = 'tab';
  2171. var VERSION = '4.0.0-beta';
  2172. var DATA_KEY = 'bs.tab';
  2173. var EVENT_KEY = '.' + DATA_KEY;
  2174. var DATA_API_KEY = '.data-api';
  2175. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2176. var TRANSITION_DURATION = 150;
  2177. var Event = {
  2178. HIDE: 'hide' + EVENT_KEY,
  2179. HIDDEN: 'hidden' + EVENT_KEY,
  2180. SHOW: 'show' + EVENT_KEY,
  2181. SHOWN: 'shown' + EVENT_KEY,
  2182. CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
  2183. };
  2184. var ClassName = {
  2185. DROPDOWN_MENU: 'dropdown-menu',
  2186. ACTIVE: 'active',
  2187. DISABLED: 'disabled',
  2188. FADE: 'fade',
  2189. SHOW: 'show'
  2190. };
  2191. var Selector = {
  2192. DROPDOWN: '.dropdown',
  2193. NAV_LIST_GROUP: '.nav, .list-group',
  2194. ACTIVE: '.active',
  2195. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  2196. DROPDOWN_TOGGLE: '.dropdown-toggle',
  2197. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  2198. /**
  2199. * ------------------------------------------------------------------------
  2200. * Class Definition
  2201. * ------------------------------------------------------------------------
  2202. */
  2203. };
  2204. var Tab = function () {
  2205. function Tab(element) {
  2206. _classCallCheck(this, Tab);
  2207. this._element = element;
  2208. }
  2209. // getters
  2210. // public
  2211. Tab.prototype.show = function show() {
  2212. var _this22 = this;
  2213. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE) || $(this._element).hasClass(ClassName.DISABLED)) {
  2214. return;
  2215. }
  2216. var target = void 0;
  2217. var previous = void 0;
  2218. var listElement = $(this._element).closest(Selector.NAV_LIST_GROUP)[0];
  2219. var selector = Util.getSelectorFromElement(this._element);
  2220. if (listElement) {
  2221. previous = $.makeArray($(listElement).find(Selector.ACTIVE));
  2222. previous = previous[previous.length - 1];
  2223. }
  2224. var hideEvent = $.Event(Event.HIDE, {
  2225. relatedTarget: this._element
  2226. });
  2227. var showEvent = $.Event(Event.SHOW, {
  2228. relatedTarget: previous
  2229. });
  2230. if (previous) {
  2231. $(previous).trigger(hideEvent);
  2232. }
  2233. $(this._element).trigger(showEvent);
  2234. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  2235. return;
  2236. }
  2237. if (selector) {
  2238. target = $(selector)[0];
  2239. }
  2240. this._activate(this._element, listElement);
  2241. var complete = function complete() {
  2242. var hiddenEvent = $.Event(Event.HIDDEN, {
  2243. relatedTarget: _this22._element
  2244. });
  2245. var shownEvent = $.Event(Event.SHOWN, {
  2246. relatedTarget: previous
  2247. });
  2248. $(previous).trigger(hiddenEvent);
  2249. $(_this22._element).trigger(shownEvent);
  2250. };
  2251. if (target) {
  2252. this._activate(target, target.parentNode, complete);
  2253. } else {
  2254. complete();
  2255. }
  2256. };
  2257. Tab.prototype.dispose = function dispose() {
  2258. $.removeData(this._element, DATA_KEY);
  2259. this._element = null;
  2260. };
  2261. // private
  2262. Tab.prototype._activate = function _activate(element, container, callback) {
  2263. var _this23 = this;
  2264. var active = $(container).find(Selector.ACTIVE)[0];
  2265. var isTransitioning = callback && Util.supportsTransitionEnd() && active && $(active).hasClass(ClassName.FADE);
  2266. var complete = function complete() {
  2267. return _this23._transitionComplete(element, active, isTransitioning, callback);
  2268. };
  2269. if (active && isTransitioning) {
  2270. $(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  2271. } else {
  2272. complete();
  2273. }
  2274. if (active) {
  2275. $(active).removeClass(ClassName.SHOW);
  2276. }
  2277. };
  2278. Tab.prototype._transitionComplete = function _transitionComplete(element, active, isTransitioning, callback) {
  2279. if (active) {
  2280. $(active).removeClass(ClassName.ACTIVE);
  2281. var dropdownChild = $(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
  2282. if (dropdownChild) {
  2283. $(dropdownChild).removeClass(ClassName.ACTIVE);
  2284. }
  2285. active.setAttribute('aria-expanded', false);
  2286. }
  2287. $(element).addClass(ClassName.ACTIVE);
  2288. element.setAttribute('aria-expanded', true);
  2289. if (isTransitioning) {
  2290. Util.reflow(element);
  2291. $(element).addClass(ClassName.SHOW);
  2292. } else {
  2293. $(element).removeClass(ClassName.FADE);
  2294. }
  2295. if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
  2296. var dropdownElement = $(element).closest(Selector.DROPDOWN)[0];
  2297. if (dropdownElement) {
  2298. $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
  2299. }
  2300. element.setAttribute('aria-expanded', true);
  2301. }
  2302. if (callback) {
  2303. callback();
  2304. }
  2305. };
  2306. // static
  2307. Tab._jQueryInterface = function _jQueryInterface(config) {
  2308. return this.each(function () {
  2309. var $this = $(this);
  2310. var data = $this.data(DATA_KEY);
  2311. if (!data) {
  2312. data = new Tab(this);
  2313. $this.data(DATA_KEY, data);
  2314. }
  2315. if (typeof config === 'string') {
  2316. if (data[config] === undefined) {
  2317. throw new Error('No method named "' + config + '"');
  2318. }
  2319. data[config]();
  2320. }
  2321. });
  2322. };
  2323. _createClass(Tab, null, [{
  2324. key: 'VERSION',
  2325. get: function get() {
  2326. return VERSION;
  2327. }
  2328. }]);
  2329. return Tab;
  2330. }();
  2331. /**
  2332. * ------------------------------------------------------------------------
  2333. * Data Api implementation
  2334. * ------------------------------------------------------------------------
  2335. */
  2336. $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
  2337. event.preventDefault();
  2338. Tab._jQueryInterface.call($(this), 'show');
  2339. });
  2340. /**
  2341. * ------------------------------------------------------------------------
  2342. * jQuery
  2343. * ------------------------------------------------------------------------
  2344. */
  2345. $.fn[NAME] = Tab._jQueryInterface;
  2346. $.fn[NAME].Constructor = Tab;
  2347. $.fn[NAME].noConflict = function () {
  2348. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2349. return Tab._jQueryInterface;
  2350. };
  2351. return Tab;
  2352. }(jQuery);
  2353. /* global Popper */
  2354. /**
  2355. * --------------------------------------------------------------------------
  2356. * Bootstrap (v4.0.0-beta): tooltip.js
  2357. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2358. * --------------------------------------------------------------------------
  2359. */
  2360. var Tooltip = function ($) {
  2361. /**
  2362. * Check for Popper dependency
  2363. * Popper - https://popper.js.org
  2364. */
  2365. if (typeof Popper === 'undefined') {
  2366. throw new Error('Bootstrap tooltips require Popper.js (https://popper.js.org)');
  2367. }
  2368. /**
  2369. * ------------------------------------------------------------------------
  2370. * Constants
  2371. * ------------------------------------------------------------------------
  2372. */
  2373. var NAME = 'tooltip';
  2374. var VERSION = '4.0.0-beta';
  2375. var DATA_KEY = 'bs.tooltip';
  2376. var EVENT_KEY = '.' + DATA_KEY;
  2377. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2378. var TRANSITION_DURATION = 150;
  2379. var CLASS_PREFIX = 'bs-tooltip';
  2380. var BSCLS_PREFIX_REGEX = new RegExp('(^|\\s)' + CLASS_PREFIX + '\\S+', 'g');
  2381. var DefaultType = {
  2382. animation: 'boolean',
  2383. template: 'string',
  2384. title: '(string|element|function)',
  2385. trigger: 'string',
  2386. delay: '(number|object)',
  2387. html: 'boolean',
  2388. selector: '(string|boolean)',
  2389. placement: '(string|function)',
  2390. offset: '(number|string)',
  2391. container: '(string|element|boolean)',
  2392. fallbackPlacement: '(string|array)'
  2393. };
  2394. var AttachmentMap = {
  2395. AUTO: 'auto',
  2396. TOP: 'top',
  2397. RIGHT: 'right',
  2398. BOTTOM: 'bottom',
  2399. LEFT: 'left'
  2400. };
  2401. var Default = {
  2402. animation: true,
  2403. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  2404. trigger: 'hover focus',
  2405. title: '',
  2406. delay: 0,
  2407. html: false,
  2408. selector: false,
  2409. placement: 'top',
  2410. offset: 0,
  2411. container: false,
  2412. fallbackPlacement: 'flip'
  2413. };
  2414. var HoverState = {
  2415. SHOW: 'show',
  2416. OUT: 'out'
  2417. };
  2418. var Event = {
  2419. HIDE: 'hide' + EVENT_KEY,
  2420. HIDDEN: 'hidden' + EVENT_KEY,
  2421. SHOW: 'show' + EVENT_KEY,
  2422. SHOWN: 'shown' + EVENT_KEY,
  2423. INSERTED: 'inserted' + EVENT_KEY,
  2424. CLICK: 'click' + EVENT_KEY,
  2425. FOCUSIN: 'focusin' + EVENT_KEY,
  2426. FOCUSOUT: 'focusout' + EVENT_KEY,
  2427. MOUSEENTER: 'mouseenter' + EVENT_KEY,
  2428. MOUSELEAVE: 'mouseleave' + EVENT_KEY
  2429. };
  2430. var ClassName = {
  2431. FADE: 'fade',
  2432. SHOW: 'show'
  2433. };
  2434. var Selector = {
  2435. TOOLTIP: '.tooltip',
  2436. TOOLTIP_INNER: '.tooltip-inner',
  2437. ARROW: '.arrow'
  2438. };
  2439. var Trigger = {
  2440. HOVER: 'hover',
  2441. FOCUS: 'focus',
  2442. CLICK: 'click',
  2443. MANUAL: 'manual'
  2444. /**
  2445. * ------------------------------------------------------------------------
  2446. * Class Definition
  2447. * ------------------------------------------------------------------------
  2448. */
  2449. };
  2450. var Tooltip = function () {
  2451. function Tooltip(element, config) {
  2452. _classCallCheck(this, Tooltip);
  2453. // private
  2454. this._isEnabled = true;
  2455. this._timeout = 0;
  2456. this._hoverState = '';
  2457. this._activeTrigger = {};
  2458. this._popper = null;
  2459. // protected
  2460. this.element = element;
  2461. this.config = this._getConfig(config);
  2462. this.tip = null;
  2463. this._setListeners();
  2464. }
  2465. // getters
  2466. // public
  2467. Tooltip.prototype.enable = function enable() {
  2468. this._isEnabled = true;
  2469. };
  2470. Tooltip.prototype.disable = function disable() {
  2471. this._isEnabled = false;
  2472. };
  2473. Tooltip.prototype.toggleEnabled = function toggleEnabled() {
  2474. this._isEnabled = !this._isEnabled;
  2475. };
  2476. Tooltip.prototype.toggle = function toggle(event) {
  2477. if (event) {
  2478. var dataKey = this.constructor.DATA_KEY;
  2479. var context = $(event.currentTarget).data(dataKey);
  2480. if (!context) {
  2481. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  2482. $(event.currentTarget).data(dataKey, context);
  2483. }
  2484. context._activeTrigger.click = !context._activeTrigger.click;
  2485. if (context._isWithActiveTrigger()) {
  2486. context._enter(null, context);
  2487. } else {
  2488. context._leave(null, context);
  2489. }
  2490. } else {
  2491. if ($(this.getTipElement()).hasClass(ClassName.SHOW)) {
  2492. this._leave(null, this);
  2493. return;
  2494. }
  2495. this._enter(null, this);
  2496. }
  2497. };
  2498. Tooltip.prototype.dispose = function dispose() {
  2499. clearTimeout(this._timeout);
  2500. $.removeData(this.element, this.constructor.DATA_KEY);
  2501. $(this.element).off(this.constructor.EVENT_KEY);
  2502. $(this.element).closest('.modal').off('hide.bs.modal');
  2503. if (this.tip) {
  2504. $(this.tip).remove();
  2505. }
  2506. this._isEnabled = null;
  2507. this._timeout = null;
  2508. this._hoverState = null;
  2509. this._activeTrigger = null;
  2510. if (this._popper !== null) {
  2511. this._popper.destroy();
  2512. }
  2513. this._popper = null;
  2514. this.element = null;
  2515. this.config = null;
  2516. this.tip = null;
  2517. };
  2518. Tooltip.prototype.show = function show() {
  2519. var _this24 = this;
  2520. if ($(this.element).css('display') === 'none') {
  2521. throw new Error('Please use show on visible elements');
  2522. }
  2523. var showEvent = $.Event(this.constructor.Event.SHOW);
  2524. if (this.isWithContent() && this._isEnabled) {
  2525. $(this.element).trigger(showEvent);
  2526. var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element);
  2527. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  2528. return;
  2529. }
  2530. var tip = this.getTipElement();
  2531. var tipId = Util.getUID(this.constructor.NAME);
  2532. tip.setAttribute('id', tipId);
  2533. this.element.setAttribute('aria-describedby', tipId);
  2534. this.setContent();
  2535. if (this.config.animation) {
  2536. $(tip).addClass(ClassName.FADE);
  2537. }
  2538. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  2539. var attachment = this._getAttachment(placement);
  2540. this.addAttachmentClass(attachment);
  2541. var container = this.config.container === false ? document.body : $(this.config.container);
  2542. $(tip).data(this.constructor.DATA_KEY, this);
  2543. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  2544. $(tip).appendTo(container);
  2545. }
  2546. $(this.element).trigger(this.constructor.Event.INSERTED);
  2547. this._popper = new Popper(this.element, tip, {
  2548. placement: attachment,
  2549. modifiers: {
  2550. offset: {
  2551. offset: this.config.offset
  2552. },
  2553. flip: {
  2554. behavior: this.config.fallbackPlacement
  2555. },
  2556. arrow: {
  2557. element: Selector.ARROW
  2558. }
  2559. },
  2560. onCreate: function onCreate(data) {
  2561. if (data.originalPlacement !== data.placement) {
  2562. _this24._handlePopperPlacementChange(data);
  2563. }
  2564. },
  2565. onUpdate: function onUpdate(data) {
  2566. _this24._handlePopperPlacementChange(data);
  2567. }
  2568. });
  2569. $(tip).addClass(ClassName.SHOW);
  2570. // if this is a touch-enabled device we add extra
  2571. // empty mouseover listeners to the body's immediate children;
  2572. // only needed because of broken event delegation on iOS
  2573. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  2574. if ('ontouchstart' in document.documentElement) {
  2575. $('body').children().on('mouseover', null, $.noop);
  2576. }
  2577. var complete = function complete() {
  2578. if (_this24.config.animation) {
  2579. _this24._fixTransition();
  2580. }
  2581. var prevHoverState = _this24._hoverState;
  2582. _this24._hoverState = null;
  2583. $(_this24.element).trigger(_this24.constructor.Event.SHOWN);
  2584. if (prevHoverState === HoverState.OUT) {
  2585. _this24._leave(null, _this24);
  2586. }
  2587. };
  2588. if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
  2589. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION);
  2590. } else {
  2591. complete();
  2592. }
  2593. }
  2594. };
  2595. Tooltip.prototype.hide = function hide(callback) {
  2596. var _this25 = this;
  2597. var tip = this.getTipElement();
  2598. var hideEvent = $.Event(this.constructor.Event.HIDE);
  2599. var complete = function complete() {
  2600. if (_this25._hoverState !== HoverState.SHOW && tip.parentNode) {
  2601. tip.parentNode.removeChild(tip);
  2602. }
  2603. _this25._cleanTipClass();
  2604. _this25.element.removeAttribute('aria-describedby');
  2605. $(_this25.element).trigger(_this25.constructor.Event.HIDDEN);
  2606. if (_this25._popper !== null) {
  2607. _this25._popper.destroy();
  2608. }
  2609. if (callback) {
  2610. callback();
  2611. }
  2612. };
  2613. $(this.element).trigger(hideEvent);
  2614. if (hideEvent.isDefaultPrevented()) {
  2615. return;
  2616. }
  2617. $(tip).removeClass(ClassName.SHOW);
  2618. // if this is a touch-enabled device we remove the extra
  2619. // empty mouseover listeners we added for iOS support
  2620. if ('ontouchstart' in document.documentElement) {
  2621. $('body').children().off('mouseover', null, $.noop);
  2622. }
  2623. this._activeTrigger[Trigger.CLICK] = false;
  2624. this._activeTrigger[Trigger.FOCUS] = false;
  2625. this._activeTrigger[Trigger.HOVER] = false;
  2626. if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
  2627. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
  2628. } else {
  2629. complete();
  2630. }
  2631. this._hoverState = '';
  2632. };
  2633. Tooltip.prototype.update = function update() {
  2634. if (this._popper !== null) {
  2635. this._popper.scheduleUpdate();
  2636. }
  2637. };
  2638. // protected
  2639. Tooltip.prototype.isWithContent = function isWithContent() {
  2640. return Boolean(this.getTitle());
  2641. };
  2642. Tooltip.prototype.addAttachmentClass = function addAttachmentClass(attachment) {
  2643. $(this.getTipElement()).addClass(CLASS_PREFIX + '-' + attachment);
  2644. };
  2645. Tooltip.prototype.getTipElement = function getTipElement() {
  2646. return this.tip = this.tip || $(this.config.template)[0];
  2647. };
  2648. Tooltip.prototype.setContent = function setContent() {
  2649. var $tip = $(this.getTipElement());
  2650. this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle());
  2651. $tip.removeClass(ClassName.FADE + ' ' + ClassName.SHOW);
  2652. };
  2653. Tooltip.prototype.setElementContent = function setElementContent($element, content) {
  2654. var html = this.config.html;
  2655. if ((typeof content === 'undefined' ? 'undefined' : _typeof(content)) === 'object' && (content.nodeType || content.jquery)) {
  2656. // content is a DOM node or a jQuery
  2657. if (html) {
  2658. if (!$(content).parent().is($element)) {
  2659. $element.empty().append(content);
  2660. }
  2661. } else {
  2662. $element.text($(content).text());
  2663. }
  2664. } else {
  2665. $element[html ? 'html' : 'text'](content);
  2666. }
  2667. };
  2668. Tooltip.prototype.getTitle = function getTitle() {
  2669. var title = this.element.getAttribute('data-original-title');
  2670. if (!title) {
  2671. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  2672. }
  2673. return title;
  2674. };
  2675. // private
  2676. Tooltip.prototype._getAttachment = function _getAttachment(placement) {
  2677. return AttachmentMap[placement.toUpperCase()];
  2678. };
  2679. Tooltip.prototype._setListeners = function _setListeners() {
  2680. var _this26 = this;
  2681. var triggers = this.config.trigger.split(' ');
  2682. triggers.forEach(function (trigger) {
  2683. if (trigger === 'click') {
  2684. $(_this26.element).on(_this26.constructor.Event.CLICK, _this26.config.selector, function (event) {
  2685. return _this26.toggle(event);
  2686. });
  2687. } else if (trigger !== Trigger.MANUAL) {
  2688. var eventIn = trigger === Trigger.HOVER ? _this26.constructor.Event.MOUSEENTER : _this26.constructor.Event.FOCUSIN;
  2689. var eventOut = trigger === Trigger.HOVER ? _this26.constructor.Event.MOUSELEAVE : _this26.constructor.Event.FOCUSOUT;
  2690. $(_this26.element).on(eventIn, _this26.config.selector, function (event) {
  2691. return _this26._enter(event);
  2692. }).on(eventOut, _this26.config.selector, function (event) {
  2693. return _this26._leave(event);
  2694. });
  2695. }
  2696. $(_this26.element).closest('.modal').on('hide.bs.modal', function () {
  2697. return _this26.hide();
  2698. });
  2699. });
  2700. if (this.config.selector) {
  2701. this.config = $.extend({}, this.config, {
  2702. trigger: 'manual',
  2703. selector: ''
  2704. });
  2705. } else {
  2706. this._fixTitle();
  2707. }
  2708. };
  2709. Tooltip.prototype._fixTitle = function _fixTitle() {
  2710. var titleType = _typeof(this.element.getAttribute('data-original-title'));
  2711. if (this.element.getAttribute('title') || titleType !== 'string') {
  2712. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  2713. this.element.setAttribute('title', '');
  2714. }
  2715. };
  2716. Tooltip.prototype._enter = function _enter(event, context) {
  2717. var dataKey = this.constructor.DATA_KEY;
  2718. context = context || $(event.currentTarget).data(dataKey);
  2719. if (!context) {
  2720. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  2721. $(event.currentTarget).data(dataKey, context);
  2722. }
  2723. if (event) {
  2724. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  2725. }
  2726. if ($(context.getTipElement()).hasClass(ClassName.SHOW) || context._hoverState === HoverState.SHOW) {
  2727. context._hoverState = HoverState.SHOW;
  2728. return;
  2729. }
  2730. clearTimeout(context._timeout);
  2731. context._hoverState = HoverState.SHOW;
  2732. if (!context.config.delay || !context.config.delay.show) {
  2733. context.show();
  2734. return;
  2735. }
  2736. context._timeout = setTimeout(function () {
  2737. if (context._hoverState === HoverState.SHOW) {
  2738. context.show();
  2739. }
  2740. }, context.config.delay.show);
  2741. };
  2742. Tooltip.prototype._leave = function _leave(event, context) {
  2743. var dataKey = this.constructor.DATA_KEY;
  2744. context = context || $(event.currentTarget).data(dataKey);
  2745. if (!context) {
  2746. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  2747. $(event.currentTarget).data(dataKey, context);
  2748. }
  2749. if (event) {
  2750. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  2751. }
  2752. if (context._isWithActiveTrigger()) {
  2753. return;
  2754. }
  2755. clearTimeout(context._timeout);
  2756. context._hoverState = HoverState.OUT;
  2757. if (!context.config.delay || !context.config.delay.hide) {
  2758. context.hide();
  2759. return;
  2760. }
  2761. context._timeout = setTimeout(function () {
  2762. if (context._hoverState === HoverState.OUT) {
  2763. context.hide();
  2764. }
  2765. }, context.config.delay.hide);
  2766. };
  2767. Tooltip.prototype._isWithActiveTrigger = function _isWithActiveTrigger() {
  2768. for (var trigger in this._activeTrigger) {
  2769. if (this._activeTrigger[trigger]) {
  2770. return true;
  2771. }
  2772. }
  2773. return false;
  2774. };
  2775. Tooltip.prototype._getConfig = function _getConfig(config) {
  2776. config = $.extend({}, this.constructor.Default, $(this.element).data(), config);
  2777. if (config.delay && typeof config.delay === 'number') {
  2778. config.delay = {
  2779. show: config.delay,
  2780. hide: config.delay
  2781. };
  2782. }
  2783. if (config.title && typeof config.title === 'number') {
  2784. config.title = config.title.toString();
  2785. }
  2786. if (config.content && typeof config.content === 'number') {
  2787. config.content = config.content.toString();
  2788. }
  2789. Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
  2790. return config;
  2791. };
  2792. Tooltip.prototype._getDelegateConfig = function _getDelegateConfig() {
  2793. var config = {};
  2794. if (this.config) {
  2795. for (var key in this.config) {
  2796. if (this.constructor.Default[key] !== this.config[key]) {
  2797. config[key] = this.config[key];
  2798. }
  2799. }
  2800. }
  2801. return config;
  2802. };
  2803. Tooltip.prototype._cleanTipClass = function _cleanTipClass() {
  2804. var $tip = $(this.getTipElement());
  2805. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  2806. if (tabClass !== null && tabClass.length > 0) {
  2807. $tip.removeClass(tabClass.join(''));
  2808. }
  2809. };
  2810. Tooltip.prototype._handlePopperPlacementChange = function _handlePopperPlacementChange(data) {
  2811. this._cleanTipClass();
  2812. this.addAttachmentClass(this._getAttachment(data.placement));
  2813. };
  2814. Tooltip.prototype._fixTransition = function _fixTransition() {
  2815. var tip = this.getTipElement();
  2816. var initConfigAnimation = this.config.animation;
  2817. if (tip.getAttribute('x-placement') !== null) {
  2818. return;
  2819. }
  2820. $(tip).removeClass(ClassName.FADE);
  2821. this.config.animation = false;
  2822. this.hide();
  2823. this.show();
  2824. this.config.animation = initConfigAnimation;
  2825. };
  2826. // static
  2827. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  2828. return this.each(function () {
  2829. var data = $(this).data(DATA_KEY);
  2830. var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config;
  2831. if (!data && /dispose|hide/.test(config)) {
  2832. return;
  2833. }
  2834. if (!data) {
  2835. data = new Tooltip(this, _config);
  2836. $(this).data(DATA_KEY, data);
  2837. }
  2838. if (typeof config === 'string') {
  2839. if (data[config] === undefined) {
  2840. throw new Error('No method named "' + config + '"');
  2841. }
  2842. data[config]();
  2843. }
  2844. });
  2845. };
  2846. _createClass(Tooltip, null, [{
  2847. key: 'VERSION',
  2848. get: function get() {
  2849. return VERSION;
  2850. }
  2851. }, {
  2852. key: 'Default',
  2853. get: function get() {
  2854. return Default;
  2855. }
  2856. }, {
  2857. key: 'NAME',
  2858. get: function get() {
  2859. return NAME;
  2860. }
  2861. }, {
  2862. key: 'DATA_KEY',
  2863. get: function get() {
  2864. return DATA_KEY;
  2865. }
  2866. }, {
  2867. key: 'Event',
  2868. get: function get() {
  2869. return Event;
  2870. }
  2871. }, {
  2872. key: 'EVENT_KEY',
  2873. get: function get() {
  2874. return EVENT_KEY;
  2875. }
  2876. }, {
  2877. key: 'DefaultType',
  2878. get: function get() {
  2879. return DefaultType;
  2880. }
  2881. }]);
  2882. return Tooltip;
  2883. }();
  2884. /**
  2885. * ------------------------------------------------------------------------
  2886. * jQuery
  2887. * ------------------------------------------------------------------------
  2888. */
  2889. $.fn[NAME] = Tooltip._jQueryInterface;
  2890. $.fn[NAME].Constructor = Tooltip;
  2891. $.fn[NAME].noConflict = function () {
  2892. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2893. return Tooltip._jQueryInterface;
  2894. };
  2895. return Tooltip;
  2896. }(jQuery);
  2897. /**
  2898. * --------------------------------------------------------------------------
  2899. * Bootstrap (v4.0.0-beta): popover.js
  2900. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2901. * --------------------------------------------------------------------------
  2902. */
  2903. var Popover = function ($) {
  2904. /**
  2905. * ------------------------------------------------------------------------
  2906. * Constants
  2907. * ------------------------------------------------------------------------
  2908. */
  2909. var NAME = 'popover';
  2910. var VERSION = '4.0.0-beta';
  2911. var DATA_KEY = 'bs.popover';
  2912. var EVENT_KEY = '.' + DATA_KEY;
  2913. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2914. var CLASS_PREFIX = 'bs-popover';
  2915. var BSCLS_PREFIX_REGEX = new RegExp('(^|\\s)' + CLASS_PREFIX + '\\S+', 'g');
  2916. var Default = $.extend({}, Tooltip.Default, {
  2917. placement: 'right',
  2918. trigger: 'click',
  2919. content: '',
  2920. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  2921. });
  2922. var DefaultType = $.extend({}, Tooltip.DefaultType, {
  2923. content: '(string|element|function)'
  2924. });
  2925. var ClassName = {
  2926. FADE: 'fade',
  2927. SHOW: 'show'
  2928. };
  2929. var Selector = {
  2930. TITLE: '.popover-header',
  2931. CONTENT: '.popover-body'
  2932. };
  2933. var Event = {
  2934. HIDE: 'hide' + EVENT_KEY,
  2935. HIDDEN: 'hidden' + EVENT_KEY,
  2936. SHOW: 'show' + EVENT_KEY,
  2937. SHOWN: 'shown' + EVENT_KEY,
  2938. INSERTED: 'inserted' + EVENT_KEY,
  2939. CLICK: 'click' + EVENT_KEY,
  2940. FOCUSIN: 'focusin' + EVENT_KEY,
  2941. FOCUSOUT: 'focusout' + EVENT_KEY,
  2942. MOUSEENTER: 'mouseenter' + EVENT_KEY,
  2943. MOUSELEAVE: 'mouseleave' + EVENT_KEY
  2944. /**
  2945. * ------------------------------------------------------------------------
  2946. * Class Definition
  2947. * ------------------------------------------------------------------------
  2948. */
  2949. };
  2950. var Popover = function (_Tooltip) {
  2951. _inherits(Popover, _Tooltip);
  2952. function Popover() {
  2953. _classCallCheck(this, Popover);
  2954. return _possibleConstructorReturn(this, _Tooltip.apply(this, arguments));
  2955. }
  2956. // overrides
  2957. Popover.prototype.isWithContent = function isWithContent() {
  2958. return this.getTitle() || this._getContent();
  2959. };
  2960. Popover.prototype.addAttachmentClass = function addAttachmentClass(attachment) {
  2961. $(this.getTipElement()).addClass(CLASS_PREFIX + '-' + attachment);
  2962. };
  2963. Popover.prototype.getTipElement = function getTipElement() {
  2964. return this.tip = this.tip || $(this.config.template)[0];
  2965. };
  2966. Popover.prototype.setContent = function setContent() {
  2967. var $tip = $(this.getTipElement());
  2968. // we use append for html objects to maintain js events
  2969. this.setElementContent($tip.find(Selector.TITLE), this.getTitle());
  2970. this.setElementContent($tip.find(Selector.CONTENT), this._getContent());
  2971. $tip.removeClass(ClassName.FADE + ' ' + ClassName.SHOW);
  2972. };
  2973. // private
  2974. Popover.prototype._getContent = function _getContent() {
  2975. return this.element.getAttribute('data-content') || (typeof this.config.content === 'function' ? this.config.content.call(this.element) : this.config.content);
  2976. };
  2977. Popover.prototype._cleanTipClass = function _cleanTipClass() {
  2978. var $tip = $(this.getTipElement());
  2979. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  2980. if (tabClass !== null && tabClass.length > 0) {
  2981. $tip.removeClass(tabClass.join(''));
  2982. }
  2983. };
  2984. // static
  2985. Popover._jQueryInterface = function _jQueryInterface(config) {
  2986. return this.each(function () {
  2987. var data = $(this).data(DATA_KEY);
  2988. var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' ? config : null;
  2989. if (!data && /destroy|hide/.test(config)) {
  2990. return;
  2991. }
  2992. if (!data) {
  2993. data = new Popover(this, _config);
  2994. $(this).data(DATA_KEY, data);
  2995. }
  2996. if (typeof config === 'string') {
  2997. if (data[config] === undefined) {
  2998. throw new Error('No method named "' + config + '"');
  2999. }
  3000. data[config]();
  3001. }
  3002. });
  3003. };
  3004. _createClass(Popover, null, [{
  3005. key: 'VERSION',
  3006. // getters
  3007. get: function get() {
  3008. return VERSION;
  3009. }
  3010. }, {
  3011. key: 'Default',
  3012. get: function get() {
  3013. return Default;
  3014. }
  3015. }, {
  3016. key: 'NAME',
  3017. get: function get() {
  3018. return NAME;
  3019. }
  3020. }, {
  3021. key: 'DATA_KEY',
  3022. get: function get() {
  3023. return DATA_KEY;
  3024. }
  3025. }, {
  3026. key: 'Event',
  3027. get: function get() {
  3028. return Event;
  3029. }
  3030. }, {
  3031. key: 'EVENT_KEY',
  3032. get: function get() {
  3033. return EVENT_KEY;
  3034. }
  3035. }, {
  3036. key: 'DefaultType',
  3037. get: function get() {
  3038. return DefaultType;
  3039. }
  3040. }]);
  3041. return Popover;
  3042. }(Tooltip);
  3043. /**
  3044. * ------------------------------------------------------------------------
  3045. * jQuery
  3046. * ------------------------------------------------------------------------
  3047. */
  3048. $.fn[NAME] = Popover._jQueryInterface;
  3049. $.fn[NAME].Constructor = Popover;
  3050. $.fn[NAME].noConflict = function () {
  3051. $.fn[NAME] = JQUERY_NO_CONFLICT;
  3052. return Popover._jQueryInterface;
  3053. };
  3054. return Popover;
  3055. }(jQuery);
  3056. })();