bootstrap.js 153 KB
Newer Older
1
/*!
XhmikosR's avatar
XhmikosR committed
2
  * Bootstrap v4.3.1 (https://getbootstrap.com/)
Mark Otto's avatar
Mark Otto committed
3
  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
Mark Otto's avatar
dist    
Mark Otto committed
4
5
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  */
Mark Otto's avatar
dist    
Mark Otto committed
6
(function (global, factory) {
XhmikosR's avatar
Dist.    
XhmikosR committed
7
8
9
10
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('popper.js')) :
  typeof define === 'function' && define.amd ? define(['popper.js'], factory) :
  (global = global || self, global.bootstrap = factory(global.Popper));
}(this, function (Popper) { 'use strict';
Mark Otto's avatar
grunt    
Mark Otto committed
11

Mark Otto's avatar
Mark Otto committed
12
  Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
Jacob Thornton's avatar
Jacob Thornton committed
13

Mark Otto's avatar
dist    
Mark Otto committed
14
15
16
17
18
19
20
21
  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);
    }
Mark Otto's avatar
Mark Otto committed
22
23
  }

Mark Otto's avatar
dist    
Mark Otto committed
24
25
26
27
28
  function _createClass(Constructor, protoProps, staticProps) {
    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
    if (staticProps) _defineProperties(Constructor, staticProps);
    return Constructor;
  }
Mark Otto's avatar
dist    
Mark Otto committed
29

Mark Otto's avatar
dist    
Mark Otto committed
30
31
32
33
34
35
36
37
38
39
  function _defineProperty(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
Mark Otto's avatar
dist    
Mark Otto committed
40
41
    }

Mark Otto's avatar
dist    
Mark Otto committed
42
    return obj;
Jacob Thornton's avatar
Jacob Thornton committed
43
44
  }

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  function ownKeys(object, enumerableOnly) {
    var keys = Object.keys(object);

    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(object);
      if (enumerableOnly) symbols = symbols.filter(function (sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      });
      keys.push.apply(keys, symbols);
    }

    return keys;
  }

  function _objectSpread2(target) {
Mark Otto's avatar
dist    
Mark Otto committed
60
61
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i] != null ? arguments[i] : {};
Mark Otto's avatar
dist    
Mark Otto committed
62

63
64
65
66
67
68
69
70
71
72
      if (i % 2) {
        ownKeys(source, true).forEach(function (key) {
          _defineProperty(target, key, source[key]);
        });
      } else if (Object.getOwnPropertyDescriptors) {
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
      } else {
        ownKeys(source).forEach(function (key) {
          Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
        });
Jacob Thornton's avatar
Jacob Thornton committed
73
74
75
      }
    }

Mark Otto's avatar
dist    
Mark Otto committed
76
    return target;
Jacob Thornton's avatar
Jacob Thornton committed
77
78
  }

Mark Otto's avatar
dist    
Mark Otto committed
79
80
81
82
  function _inheritsLoose(subClass, superClass) {
    subClass.prototype = Object.create(superClass.prototype);
    subClass.prototype.constructor = subClass;
    subClass.__proto__ = superClass;
Jacob Thornton's avatar
Jacob Thornton committed
83
84
85
86
  }

  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
87
   * Bootstrap (v4.3.1): util/index.js
Mark Otto's avatar
dist    
Mark Otto committed
88
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
Jacob Thornton's avatar
Jacob Thornton committed
89
90
   * --------------------------------------------------------------------------
   */
XhmikosR's avatar
XhmikosR committed
91
92
  var MAX_UID = 1000000;
  var MILLISECONDS_MULTIPLIER = 1000;
XhmikosR's avatar
XhmikosR committed
93
  var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
XhmikosR's avatar
XhmikosR committed
94
95
96
97

  var toType = function toType(obj) {
    return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  };
XhmikosR's avatar
Dist    
XhmikosR committed
98
  /**
XhmikosR's avatar
XhmikosR committed
99
100
101
   * --------------------------------------------------------------------------
   * Public Util Api
   * --------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
102
   */
Mark Otto's avatar
dist    
Mark Otto committed
103

Jacob Thornton's avatar
Jacob Thornton committed
104

XhmikosR's avatar
XhmikosR committed
105
106
107
108
109
  var getUID = function getUID(prefix) {
    do {
      // eslint-disable-next-line no-bitwise
      prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
    } while (document.getElementById(prefix));
Mark Otto's avatar
dist    
Mark Otto committed
110

XhmikosR's avatar
XhmikosR committed
111
112
    return prefix;
  };
Mark Otto's avatar
dist    
Mark Otto committed
113

XhmikosR's avatar
XhmikosR committed
114
  var getSelector = function getSelector(element) {
XhmikosR's avatar
XhmikosR committed
115
116
117
118
    var selector = element.getAttribute('data-target');

    if (!selector || selector === '#') {
      var hrefAttr = element.getAttribute('href');
XhmikosR's avatar
XhmikosR committed
119
      selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
XhmikosR's avatar
XhmikosR committed
120
121
    }

XhmikosR's avatar
XhmikosR committed
122
123
124
125
126
127
128
    return selector;
  };

  var getSelectorFromElement = function getSelectorFromElement(element) {
    var selector = getSelector(element);

    if (selector) {
XhmikosR's avatar
XhmikosR committed
129
130
      return document.querySelector(selector) ? selector : null;
    }
XhmikosR's avatar
XhmikosR committed
131
132
133
134
135
136
137

    return null;
  };

  var getElementFromSelector = function getElementFromSelector(element) {
    var selector = getSelector(element);
    return selector ? document.querySelector(selector) : null;
XhmikosR's avatar
XhmikosR committed
138
139
140
141
142
143
  };

  var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
    if (!element) {
      return 0;
    } // Get transition-duration of the element
Jacob Thornton's avatar
Jacob Thornton committed
144

Mark Otto's avatar
dist    
Mark Otto committed
145

XhmikosR's avatar
XhmikosR committed
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
    var _window$getComputedSt = window.getComputedStyle(element),
        transitionDuration = _window$getComputedSt.transitionDuration,
        transitionDelay = _window$getComputedSt.transitionDelay;

    var floatTransitionDuration = parseFloat(transitionDuration);
    var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found

    if (!floatTransitionDuration && !floatTransitionDelay) {
      return 0;
    } // If multiple durations are defined, take the first


    transitionDuration = transitionDuration.split(',')[0];
    transitionDelay = transitionDelay.split(',')[0];
    return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  };

  var triggerTransitionEnd = function triggerTransitionEnd(element) {
XhmikosR's avatar
XhmikosR committed
164
165
166
    var evt = document.createEvent('HTMLEvents');
    evt.initEvent(TRANSITION_END, true, true);
    element.dispatchEvent(evt);
XhmikosR's avatar
XhmikosR committed
167
168
169
170
171
172
173
  };

  var isElement = function isElement(obj) {
    return (obj[0] || obj).nodeType;
  };

  var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
XhmikosR's avatar
Dist    
XhmikosR committed
174
    var called = false;
XhmikosR's avatar
XhmikosR committed
175
176
177
178
    var durationPadding = 5;
    var emulatedDuration = duration + durationPadding;

    function listener() {
XhmikosR's avatar
Dist    
XhmikosR committed
179
      called = true;
XhmikosR's avatar
XhmikosR committed
180
181
182
183
      element.removeEventListener(TRANSITION_END, listener);
    }

    element.addEventListener(TRANSITION_END, listener);
XhmikosR's avatar
Dist    
XhmikosR committed
184
185
    setTimeout(function () {
      if (!called) {
XhmikosR's avatar
XhmikosR committed
186
        triggerTransitionEnd(element);
XhmikosR's avatar
Dist    
XhmikosR committed
187
      }
XhmikosR's avatar
XhmikosR committed
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
    }, emulatedDuration);
  };

  var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
    Object.keys(configTypes).forEach(function (property) {
      var expectedTypes = configTypes[property];
      var value = config[property];
      var valueType = value && isElement(value) ? 'element' : toType(value);

      if (!new RegExp(expectedTypes).test(valueType)) {
        throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
      }
    });
  };

  var makeArray = function makeArray(nodeList) {
    if (!nodeList) {
      return [];
    }

    return [].slice.call(nodeList);
  };

  var isVisible = function isVisible(element) {
    if (!element) {
      return false;
    }

    if (element.style && element.parentNode && element.parentNode.style) {
      return element.style.display !== 'none' && element.parentNode.style.display !== 'none' && element.style.visibility !== 'hidden';
    }

    return false;
  };

  var findShadowRoot = function findShadowRoot(element) {
    if (!document.documentElement.attachShadow) {
      return null;
    } // Can find the shadow root otherwise it'll return the document


    if (typeof element.getRootNode === 'function') {
      var root = element.getRootNode();
      return root instanceof ShadowRoot ? root : null;
    }

    if (element instanceof ShadowRoot) {
      return element;
    } // when we don't find a shadow root


    if (!element.parentNode) {
      return null;
    }

    return findShadowRoot(element.parentNode);
  }; // eslint-disable-next-line no-empty-function


  var noop = function noop() {
    return function () {};
  };

  var reflow = function reflow(element) {
    return element.offsetHeight;
  };
Mark Otto's avatar
dist    
Mark Otto committed
254

XhmikosR's avatar
XhmikosR committed
255
256
257
258
259
260
261
262
263
264
265
  var getjQuery = function getjQuery() {
    var _window = window,
        jQuery = _window.jQuery;

    if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
      return jQuery;
    }

    return null;
  };

XhmikosR's avatar
Dist    
XhmikosR committed
266
267
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
268
269
   * Bootstrap (v4.3.1): dom/data.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
XhmikosR's avatar
Dist    
XhmikosR committed
270
271
   * --------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
272

XhmikosR's avatar
XhmikosR committed
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */
  var mapData = function () {
    var storeData = {};
    var id = 1;
    return {
      set: function set(element, key, data) {
        if (typeof element.key === 'undefined') {
          element.key = {
            key: key,
            id: id
          };
          id++;
        }

        storeData[element.key.id] = data;
      },
      get: function get(element, key) {
        if (!element || typeof element.key === 'undefined') {
          return null;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
297

XhmikosR's avatar
XhmikosR committed
298
        var keyProperties = element.key;
XhmikosR's avatar
Dist    
XhmikosR committed
299

XhmikosR's avatar
XhmikosR committed
300
301
302
303
304
305
306
307
308
309
        if (keyProperties.key === key) {
          return storeData[keyProperties.id];
        }

        return null;
      },
      delete: function _delete(element, key) {
        if (typeof element.key === 'undefined') {
          return;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
310

XhmikosR's avatar
XhmikosR committed
311
312
313
314
315
316
        var keyProperties = element.key;

        if (keyProperties.key === key) {
          delete storeData[keyProperties.id];
          delete element.key;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
317
      }
XhmikosR's avatar
XhmikosR committed
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
    };
  }();

  var Data = {
    setData: function setData(instance, key, data) {
      mapData.set(instance, key, data);
    },
    getData: function getData(instance, key) {
      return mapData.get(instance, key);
    },
    removeData: function removeData(instance, key) {
      mapData.delete(instance, key);
    }
  };

XhmikosR's avatar
XhmikosR committed
333
334
335
336
337
338
  /* istanbul ignore file */
  var _Element$prototype = Element.prototype,
      matches = _Element$prototype.matches,
      closest = _Element$prototype.closest;
  var find = Element.prototype.querySelectorAll;
  var findOne = Element.prototype.querySelector;
XhmikosR's avatar
XhmikosR committed
339

XhmikosR's avatar
XhmikosR committed
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
  var createCustomEvent = function createCustomEvent(eventName, params) {
    var cEvent = new CustomEvent(eventName, params);
    return cEvent;
  };

  if (typeof window.CustomEvent !== 'function') {
    createCustomEvent = function createCustomEvent(eventName, params) {
      params = params || {
        bubbles: false,
        cancelable: false,
        detail: null
      };
      var evt = document.createEvent('CustomEvent');
      evt.initCustomEvent(eventName, params.bubbles, params.cancelable, params.detail);
      return evt;
    };
  }
XhmikosR's avatar
XhmikosR committed
357

XhmikosR's avatar
XhmikosR committed
358
359
360
361
362
363
  var workingDefaultPrevented = function () {
    var e = document.createEvent('CustomEvent');
    e.initEvent('Bootstrap', true, true);
    e.preventDefault();
    return e.defaultPrevented;
  }();
XhmikosR's avatar
XhmikosR committed
364

XhmikosR's avatar
XhmikosR committed
365
366
  if (!workingDefaultPrevented) {
    var origPreventDefault = Event.prototype.preventDefault;
XhmikosR's avatar
Dist    
XhmikosR committed
367

XhmikosR's avatar
XhmikosR committed
368
369
370
    Event.prototype.preventDefault = function () {
      if (!this.cancelable) {
        return;
XhmikosR's avatar
XhmikosR committed
371
372
      }

XhmikosR's avatar
XhmikosR committed
373
374
375
376
377
378
379
380
381
      origPreventDefault.call(this);
      Object.defineProperty(this, 'defaultPrevented', {
        get: function get() {
          return true;
        },
        configurable: true
      });
    };
  } // MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached
XhmikosR's avatar
XhmikosR committed
382
383


XhmikosR's avatar
XhmikosR committed
384
385
386
387
388
389
390
391
392
393
394
395
  var defaultPreventedPreservedOnDispatch = function () {
    var e = createCustomEvent('Bootstrap', {
      cancelable: true
    });
    var element = document.createElement('div');
    element.addEventListener('Bootstrap', function () {
      return null;
    });
    e.preventDefault();
    element.dispatchEvent(e);
    return e.defaultPrevented;
  }();
XhmikosR's avatar
XhmikosR committed
396

XhmikosR's avatar
XhmikosR committed
397
398
399
  if (!matches) {
    matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
  }
XhmikosR's avatar
XhmikosR committed
400

XhmikosR's avatar
XhmikosR committed
401
402
403
  if (!closest) {
    closest = function closest(selector) {
      var element = this;
XhmikosR's avatar
XhmikosR committed
404

XhmikosR's avatar
XhmikosR committed
405
406
407
      do {
        if (matches.call(element, selector)) {
          return element;
XhmikosR's avatar
XhmikosR committed
408
409
        }

XhmikosR's avatar
XhmikosR committed
410
411
        element = element.parentElement || element.parentNode;
      } while (element !== null && element.nodeType === 1);
XhmikosR's avatar
XhmikosR committed
412

XhmikosR's avatar
XhmikosR committed
413
414
415
      return null;
    };
  }
XhmikosR's avatar
XhmikosR committed
416

XhmikosR's avatar
XhmikosR committed
417
  var scopeSelectorRegex = /:scope\b/;
XhmikosR's avatar
XhmikosR committed
418

XhmikosR's avatar
XhmikosR committed
419
420
  var supportScopeQuery = function () {
    var element = document.createElement('div');
XhmikosR's avatar
XhmikosR committed
421

XhmikosR's avatar
XhmikosR committed
422
423
424
425
    try {
      element.querySelectorAll(':scope *');
    } catch (error) {
      return false;
XhmikosR's avatar
XhmikosR committed
426
427
    }

XhmikosR's avatar
XhmikosR committed
428
    return true;
XhmikosR's avatar
XhmikosR committed
429
430
  }();

XhmikosR's avatar
XhmikosR committed
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
  if (!supportScopeQuery) {
    find = function find(selector) {
      if (!scopeSelectorRegex.test(selector)) {
        return this.querySelectorAll(selector);
      }

      var hasId = Boolean(this.id);

      if (!hasId) {
        this.id = getUID('scope');
      }

      var nodeList = null;

      try {
        selector = selector.replace(scopeSelectorRegex, "#" + this.id);
        nodeList = this.querySelectorAll(selector);
      } finally {
        if (!hasId) {
          this.removeAttribute('id');
        }
      }

      return nodeList;
    };

    findOne = function findOne(selector) {
      if (!scopeSelectorRegex.test(selector)) {
        return this.querySelector(selector);
      }

      var matches = find.call(this, selector);

      if (typeof matches[0] !== 'undefined') {
        return matches[0];
      }

      return null;
    };
  }

XhmikosR's avatar
XhmikosR committed
472
473
  /**
   * --------------------------------------------------------------------------
474
   * Bootstrap (v4.3.1): dom/event-handler.js
XhmikosR's avatar
XhmikosR committed
475
476
477
478
479
480
481
482
483
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

XhmikosR's avatar
XhmikosR committed
484
  var $ = getjQuery();
XhmikosR's avatar
XhmikosR committed
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
  var namespaceRegex = /[^.]*(?=\..*)\.|.*/;
  var stripNameRegex = /\..*/;
  var keyEventRegex = /^key/;
  var stripUidRegex = /::\d+$/;
  var eventRegistry = {}; // Events storage

  var uidEvent = 1;
  var customEvents = {
    mouseenter: 'mouseover',
    mouseleave: 'mouseout'
  };
  var nativeEvents = ['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll'];
  /**
   * ------------------------------------------------------------------------
   * Private methods
   * ------------------------------------------------------------------------
   */

  function getUidEvent(element, uid) {
    return uid && uid + "::" + uidEvent++ || element.uidEvent || uidEvent++;
  }

  function getEvent(element) {
    var uid = getUidEvent(element);
    element.uidEvent = uid;
XhmikosR's avatar
Dist.    
XhmikosR committed
510
511
    eventRegistry[uid] = eventRegistry[uid] || {};
    return eventRegistry[uid];
XhmikosR's avatar
XhmikosR committed
512
513
514
515
516
  }

  function fixEvent(event, element) {
    // Add which for key events
    if (event.which === null && keyEventRegex.test(event.type)) {
XhmikosR's avatar
Dist.    
XhmikosR committed
517
      event.which = event.charCode === null ? event.keyCode : event.charCode;
XhmikosR's avatar
XhmikosR committed
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
    }

    event.delegateTarget = element;
  }

  function bootstrapHandler(element, fn) {
    return function handler(event) {
      fixEvent(event, element);

      if (handler.oneOff) {
        EventHandler.off(element, event.type, fn);
      }

      return fn.apply(element, [event]);
    };
  }

  function bootstrapDelegationHandler(element, selector, fn) {
    return function handler(event) {
      var domElements = element.querySelectorAll(selector);

      for (var target = event.target; target && target !== this; target = target.parentNode) {
        for (var i = domElements.length; i--;) {
          if (domElements[i] === target) {
            fixEvent(event, target);

            if (handler.oneOff) {
              EventHandler.off(element, event.type, fn);
            }

            return fn.apply(target, [event]);
          }
        }
      } // To please ESLint


      return null;
    };
  }

  function findHandler(events, handler, delegationSelector) {
    if (delegationSelector === void 0) {
      delegationSelector = null;
    }

Mark Otto's avatar
dist v5    
Mark Otto committed
563
564
565
566
    var uidEventList = Object.keys(events);

    for (var i = 0, len = uidEventList.length; i < len; i++) {
      var event = events[uidEventList[i]];
XhmikosR's avatar
XhmikosR committed
567
568

      if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
Mark Otto's avatar
dist v5    
Mark Otto committed
569
        return event;
XhmikosR's avatar
XhmikosR committed
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
      }
    }

    return null;
  }

  function normalizeParams(originalTypeEvent, handler, delegationFn) {
    var delegation = typeof handler === 'string';
    var originalHandler = delegation ? delegationFn : handler; // allow to get the native events from namespaced events ('click.bs.button' --> 'click')

    var typeEvent = originalTypeEvent.replace(stripNameRegex, '');
    var custom = customEvents[typeEvent];

    if (custom) {
      typeEvent = custom;
    }

    var isNative = nativeEvents.indexOf(typeEvent) > -1;

    if (!isNative) {
      typeEvent = originalTypeEvent;
    }

    return [delegation, originalHandler, typeEvent];
  }

  function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
    if (typeof originalTypeEvent !== 'string' || !element) {
      return;
    }

    if (!handler) {
      handler = delegationFn;
      delegationFn = null;
    }

    var _normalizeParams = normalizeParams(originalTypeEvent, handler, delegationFn),
        delegation = _normalizeParams[0],
        originalHandler = _normalizeParams[1],
        typeEvent = _normalizeParams[2];

    var events = getEvent(element);
    var handlers = events[typeEvent] || (events[typeEvent] = {});
    var previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);

    if (previousFn) {
      previousFn.oneOff = previousFn.oneOff && oneOff;
      return;
    }

    var uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
XhmikosR's avatar
Dist.    
XhmikosR committed
621
    var fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
XhmikosR's avatar
XhmikosR committed
622
623
624
625
626
627
628
629
630
631
632
    fn.delegationSelector = delegation ? handler : null;
    fn.originalHandler = originalHandler;
    fn.oneOff = oneOff;
    fn.uidEvent = uid;
    handlers[uid] = fn;
    element.addEventListener(typeEvent, fn, delegation);
  }

  function removeHandler(element, events, typeEvent, handler, delegationSelector) {
    var fn = findHandler(events[typeEvent], handler, delegationSelector);

Mark Otto's avatar
dist v5    
Mark Otto committed
633
    if (!fn) {
XhmikosR's avatar
XhmikosR committed
634
635
636
637
638
639
640
641
642
643
644
645
646
      return;
    }

    element.removeEventListener(typeEvent, fn, Boolean(delegationSelector));
    delete events[typeEvent][fn.uidEvent];
  }

  function removeNamespacedHandlers(element, events, typeEvent, namespace) {
    var storeElementEvent = events[typeEvent] || {};
    Object.keys(storeElementEvent).forEach(function (handlerKey) {
      if (handlerKey.indexOf(namespace) > -1) {
        var event = storeElementEvent[handlerKey];
        removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
Mark Otto's avatar
Mark Otto committed
647
      }
XhmikosR's avatar
XhmikosR committed
648
649
650
651
652
653
    });
  }

  var EventHandler = {
    on: function on(element, event, handler, delegationFn) {
      addHandler(element, event, handler, delegationFn, false);
XhmikosR's avatar
Dist    
XhmikosR committed
654
    },
XhmikosR's avatar
XhmikosR committed
655
656
657
658
659
660
661
    one: function one(element, event, handler, delegationFn) {
      addHandler(element, event, handler, delegationFn, true);
    },
    off: function off(element, originalTypeEvent, handler, delegationFn) {
      if (typeof originalTypeEvent !== 'string' || !element) {
        return;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
662

XhmikosR's avatar
XhmikosR committed
663
664
665
666
      var _normalizeParams2 = normalizeParams(originalTypeEvent, handler, delegationFn),
          delegation = _normalizeParams2[0],
          originalHandler = _normalizeParams2[1],
          typeEvent = _normalizeParams2[2];
XhmikosR's avatar
Dist    
XhmikosR committed
667

XhmikosR's avatar
XhmikosR committed
668
669
670
      var inNamespace = typeEvent !== originalTypeEvent;
      var events = getEvent(element);
      var isNamespace = originalTypeEvent.charAt(0) === '.';
XhmikosR's avatar
Dist    
XhmikosR committed
671

XhmikosR's avatar
XhmikosR committed
672
673
674
675
676
      if (typeof originalHandler !== 'undefined') {
        // Simplest case: handler is passed, remove that listener ONLY.
        if (!events || !events[typeEvent]) {
          return;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
677

XhmikosR's avatar
XhmikosR committed
678
679
680
        removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
        return;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
681

XhmikosR's avatar
XhmikosR committed
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
      if (isNamespace) {
        Object.keys(events).forEach(function (elementEvent) {
          removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.substr(1));
        });
      }

      var storeElementEvent = events[typeEvent] || {};
      Object.keys(storeElementEvent).forEach(function (keyHandlers) {
        var handlerKey = keyHandlers.replace(stripUidRegex, '');

        if (!inNamespace || originalTypeEvent.indexOf(handlerKey) > -1) {
          var event = storeElementEvent[keyHandlers];
          removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
        }
      });
XhmikosR's avatar
Dist    
XhmikosR committed
697
    },
XhmikosR's avatar
XhmikosR committed
698
699
700
701
702
703
704
705
706
707
708
709
710
711
    trigger: function trigger(element, event, args) {
      if (typeof event !== 'string' || !element) {
        return null;
      }

      var typeEvent = event.replace(stripNameRegex, '');
      var inNamespace = event !== typeEvent;
      var isNative = nativeEvents.indexOf(typeEvent) > -1;
      var jQueryEvent;
      var bubbles = true;
      var nativeDispatch = true;
      var defaultPrevented = false;
      var evt = null;

XhmikosR's avatar
XhmikosR committed
712
713
714
      if (inNamespace && $) {
        jQueryEvent = $.Event(event, args);
        $(element).trigger(jQueryEvent);
XhmikosR's avatar
XhmikosR committed
715
716
717
718
719
720
721
722
723
        bubbles = !jQueryEvent.isPropagationStopped();
        nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
        defaultPrevented = jQueryEvent.isDefaultPrevented();
      }

      if (isNative) {
        evt = document.createEvent('HTMLEvents');
        evt.initEvent(typeEvent, bubbles, true);
      } else {
XhmikosR's avatar
XhmikosR committed
724
        evt = createCustomEvent(event, {
XhmikosR's avatar
XhmikosR committed
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
          bubbles: bubbles,
          cancelable: true
        });
      } // merge custom informations in our event


      if (typeof args !== 'undefined') {
        Object.keys(args).forEach(function (key) {
          Object.defineProperty(evt, key, {
            get: function get() {
              return args[key];
            }
          });
        });
      }

      if (defaultPrevented) {
        evt.preventDefault();

XhmikosR's avatar
XhmikosR committed
744
        if (!defaultPreventedPreservedOnDispatch) {
XhmikosR's avatar
XhmikosR committed
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
          Object.defineProperty(evt, 'defaultPrevented', {
            get: function get() {
              return true;
            }
          });
        }
      }

      if (nativeDispatch) {
        element.dispatchEvent(evt);
      }

      if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') {
        jQueryEvent.preventDefault();
      }

      return evt;
    }
  };

  /**
   * --------------------------------------------------------------------------
767
   * Bootstrap (v4.3.1): dom/selector-engine.js
XhmikosR's avatar
XhmikosR committed
768
769
770
771
772
773
774
775
776
777
778
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NODE_TEXT = 3;
  var SelectorEngine = {
XhmikosR's avatar
XhmikosR committed
779
780
    matches: function matches$1(element, selector) {
      return matches.call(element, selector);
XhmikosR's avatar
Dist    
XhmikosR committed
781
    },
XhmikosR's avatar
XhmikosR committed
782
    find: function find$1(selector, element) {
XhmikosR's avatar
XhmikosR committed
783
784
785
786
      if (element === void 0) {
        element = document.documentElement;
      }

XhmikosR's avatar
XhmikosR committed
787
      return find.call(element, selector);
XhmikosR's avatar
Dist    
XhmikosR committed
788
    },
XhmikosR's avatar
XhmikosR committed
789
    findOne: function findOne$1(selector, element) {
XhmikosR's avatar
XhmikosR committed
790
791
792
793
      if (element === void 0) {
        element = document.documentElement;
      }

XhmikosR's avatar
XhmikosR committed
794
      return findOne.call(element, selector);
XhmikosR's avatar
Dist    
XhmikosR committed
795
    },
XhmikosR's avatar
XhmikosR committed
796
797
798
799
800
801
802
    children: function children(element, selector) {
      var _this = this;

      var children = makeArray(element.children);
      return children.filter(function (child) {
        return _this.matches(child, selector);
      });
XhmikosR's avatar
Dist    
XhmikosR committed
803
    },
XhmikosR's avatar
XhmikosR committed
804
805
806
807
808
809
810
    parents: function parents(element, selector) {
      var parents = [];
      var ancestor = element.parentNode;

      while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
        if (this.matches(ancestor, selector)) {
          parents.push(ancestor);
Jacob Thornton's avatar
Jacob Thornton committed
811
        }
XhmikosR's avatar
XhmikosR committed
812
813

        ancestor = ancestor.parentNode;
Jacob Thornton's avatar
Jacob Thornton committed
814
      }
XhmikosR's avatar
XhmikosR committed
815
816

      return parents;
Mark Otto's avatar
dist    
Mark Otto committed
817
    },
XhmikosR's avatar
XhmikosR committed
818
819
    closest: function closest$1(element, selector) {
      return closest.call(element, selector);
XhmikosR's avatar
XhmikosR committed
820
821
822
823
    },
    prev: function prev(element, selector) {
      var siblings = [];
      var previous = element.previousSibling;
Mark Otto's avatar
dist    
Mark Otto committed
824

XhmikosR's avatar
XhmikosR committed
825
826
827
828
      while (previous && previous.nodeType === Node.ELEMENT_NODE && previous.nodeType !== NODE_TEXT) {
        if (this.matches(previous, selector)) {
          siblings.push(previous);
        }
Mark Otto's avatar
dist    
Mark Otto committed
829

XhmikosR's avatar
XhmikosR committed
830
        previous = previous.previousSibling;
Mark Otto's avatar
dist    
Mark Otto committed
831
832
      }

XhmikosR's avatar
XhmikosR committed
833
      return siblings;
XhmikosR's avatar
Dist    
XhmikosR committed
834
835
    }
  };
Mark Otto's avatar
dist    
Mark Otto committed
836

XhmikosR's avatar
Dist    
XhmikosR committed
837
838
839
840
841
842
843
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME = 'alert';
XhmikosR's avatar
XhmikosR committed
844
  var VERSION = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
845
846
847
848
849
850
  var DATA_KEY = 'bs.alert';
  var EVENT_KEY = "." + DATA_KEY;
  var DATA_API_KEY = '.data-api';
  var Selector = {
    DISMISS: '[data-dismiss="alert"]'
  };
XhmikosR's avatar
XhmikosR committed
851
  var Event$1 = {
XhmikosR's avatar
Dist    
XhmikosR committed
852
853
854
855
856
857
858
859
    CLOSE: "close" + EVENT_KEY,
    CLOSED: "closed" + EVENT_KEY,
    CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  };
  var ClassName = {
    ALERT: 'alert',
    FADE: 'fade',
    SHOW: 'show'
Mark Otto's avatar
dist    
Mark Otto committed
860
861
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
862
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
863
864
     * ------------------------------------------------------------------------
     */
Jacob Thornton's avatar
Jacob Thornton committed
865

XhmikosR's avatar
Dist    
XhmikosR committed
866
  };
Jacob Thornton's avatar
Jacob Thornton committed
867

XhmikosR's avatar
Dist    
XhmikosR committed
868
869
870
871
872
  var Alert =
  /*#__PURE__*/
  function () {
    function Alert(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
873
874
875
876

      if (this._element) {
        Data.setData(element, DATA_KEY, this);
      }
XhmikosR's avatar
Dist    
XhmikosR committed
877
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
878
879


XhmikosR's avatar
Dist    
XhmikosR committed
880
    var _proto = Alert.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
881

XhmikosR's avatar
Dist    
XhmikosR committed
882
883
884
    // Public
    _proto.close = function close(element) {
      var rootElement = this._element;
Jacob Thornton's avatar
Jacob Thornton committed
885

XhmikosR's avatar
Dist    
XhmikosR committed
886
887
888
      if (element) {
        rootElement = this._getRootElement(element);
      }
Mark Otto's avatar
dist    
Mark Otto committed
889

XhmikosR's avatar
Dist    
XhmikosR committed
890
      var customEvent = this._triggerCloseEvent(rootElement);
Mark Otto's avatar
grunt    
Mark Otto committed
891

XhmikosR's avatar
XhmikosR committed
892
      if (customEvent === null || customEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
893
894
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
895

XhmikosR's avatar
Dist    
XhmikosR committed
896
897
      this._removeElement(rootElement);
    };
Jacob Thornton's avatar
Jacob Thornton committed
898

XhmikosR's avatar
Dist    
XhmikosR committed
899
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
900
      Data.removeData(this._element, DATA_KEY);
XhmikosR's avatar
Dist    
XhmikosR committed
901
      this._element = null;
Mark Otto's avatar
Mark Otto committed
902
903
    } // Private
    ;
Jacob Thornton's avatar
Jacob Thornton committed
904

XhmikosR's avatar
Dist    
XhmikosR committed
905
    _proto._getRootElement = function _getRootElement(element) {
XhmikosR's avatar
XhmikosR committed
906
      var parent = getElementFromSelector(element);
Mark Otto's avatar
grunt    
Mark Otto committed
907

XhmikosR's avatar
Dist    
XhmikosR committed
908
      if (!parent) {
XhmikosR's avatar
XhmikosR committed
909
        parent = SelectorEngine.closest(element, "." + ClassName.ALERT);
XhmikosR's avatar
Dist    
XhmikosR committed
910
      }
Jacob Thornton's avatar
Jacob Thornton committed
911

XhmikosR's avatar
Dist    
XhmikosR committed
912
913
      return parent;
    };
Jacob Thornton's avatar
Jacob Thornton committed
914

XhmikosR's avatar
Dist    
XhmikosR committed
915
    _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
XhmikosR's avatar
XhmikosR committed
916
      return EventHandler.trigger(element, Event$1.CLOSE);
XhmikosR's avatar
Dist    
XhmikosR committed
917
    };
Jacob Thornton's avatar
Jacob Thornton committed
918

XhmikosR's avatar
Dist    
XhmikosR committed
919
920
    _proto._removeElement = function _removeElement(element) {
      var _this = this;
Mark Otto's avatar
grunt    
Mark Otto committed
921

XhmikosR's avatar
XhmikosR committed
922
      element.classList.remove(ClassName.SHOW);
Jacob Thornton's avatar
Jacob Thornton committed
923

XhmikosR's avatar
XhmikosR committed
924
      if (!element.classList.contains(ClassName.FADE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
925
        this._destroyElement(element);
Mark Otto's avatar
dist    
Mark Otto committed
926

XhmikosR's avatar
Dist    
XhmikosR committed
927
928
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
929

XhmikosR's avatar
XhmikosR committed
930
      var transitionDuration = getTransitionDurationFromElement(element);
931
932
      EventHandler.one(element, TRANSITION_END, function () {
        return _this._destroyElement(element);
XhmikosR's avatar
XhmikosR committed
933
934
      });
      emulateTransitionEnd(element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
935
    };
Jacob Thornton's avatar
Jacob Thornton committed
936

XhmikosR's avatar
Dist    
XhmikosR committed
937
    _proto._destroyElement = function _destroyElement(element) {
XhmikosR's avatar
XhmikosR committed
938
939
940
941
942
      if (element.parentNode) {
        element.parentNode.removeChild(element);
      }

      EventHandler.trigger(element, Event$1.CLOSED);
Mark Otto's avatar
Mark Otto committed
943
944
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
945

XhmikosR's avatar
XhmikosR committed
946
    Alert.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
947
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
948
        var data = Data.getData(this, DATA_KEY);
Jacob Thornton's avatar
Jacob Thornton committed
949

XhmikosR's avatar
Dist    
XhmikosR committed
950
951
952
        if (!data) {
          data = new Alert(this);
        }
Jacob Thornton's avatar
Jacob Thornton committed
953

XhmikosR's avatar
Dist    
XhmikosR committed
954
955
956
957
958
        if (config === 'close') {
          data[config](this);
        }
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
959

XhmikosR's avatar
XhmikosR committed
960
    Alert.handleDismiss = function handleDismiss(alertInstance) {
XhmikosR's avatar
Dist    
XhmikosR committed
961
962
963
964
      return function (event) {
        if (event) {
          event.preventDefault();
        }
Jacob Thornton's avatar
Jacob Thornton committed
965

XhmikosR's avatar
Dist    
XhmikosR committed
966
        alertInstance.close(this);
Mark Otto's avatar
grunt    
Mark Otto committed
967
      };
XhmikosR's avatar
Dist    
XhmikosR committed
968
    };
Mark Otto's avatar
grunt    
Mark Otto committed
969

XhmikosR's avatar
XhmikosR committed
970
    Alert.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
971
972
973
      return Data.getData(element, DATA_KEY);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
974
975
976
977
978
979
    _createClass(Alert, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION;
      }
    }]);
Jacob Thornton's avatar
Jacob Thornton committed
980

XhmikosR's avatar
Dist    
XhmikosR committed
981
982
983
984
985
986
987
    return Alert;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
988

Mark Otto's avatar
dist    
Mark Otto committed
989

XhmikosR's avatar
XhmikosR committed
990
991
  EventHandler.on(document, Event$1.CLICK_DATA_API, Selector.DISMISS, Alert.handleDismiss(new Alert()));
  var $$1 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
992
993
994
995
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
996
   * add .alert to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
997
   */
Jacob Thornton's avatar
Jacob Thornton committed
998

999
1000
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
1001
1002
1003
1004
  if ($$1) {
    var JQUERY_NO_CONFLICT = $$1.fn[NAME];
    $$1.fn[NAME] = Alert.jQueryInterface;
    $$1.fn[NAME].Constructor = Alert;
Jacob Thornton's avatar
Jacob Thornton committed
1005

XhmikosR's avatar
XhmikosR committed
1006
1007
1008
    $$1.fn[NAME].noConflict = function () {
      $$1.fn[NAME] = JQUERY_NO_CONFLICT;
      return Alert.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
1009
1010
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
1011

XhmikosR's avatar
Dist    
XhmikosR committed
1012
1013
1014
1015
1016
1017
1018
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$1 = 'button';
XhmikosR's avatar
XhmikosR committed
1019
  var VERSION$1 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
  var DATA_KEY$1 = 'bs.button';
  var EVENT_KEY$1 = "." + DATA_KEY$1;
  var DATA_API_KEY$1 = '.data-api';
  var ClassName$1 = {
    ACTIVE: 'active',
    BUTTON: 'btn',
    FOCUS: 'focus'
  };
  var Selector$1 = {
    DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
    DATA_TOGGLE: '[data-toggle="buttons"]',
Mark Otto's avatar
dist    
Mark Otto committed
1031
    INPUT: 'input:not([type="hidden"])',
XhmikosR's avatar
Dist    
XhmikosR committed
1032
1033
1034
    ACTIVE: '.active',
    BUTTON: '.btn'
  };
XhmikosR's avatar
XhmikosR committed
1035
  var Event$2 = {
XhmikosR's avatar
Dist    
XhmikosR committed
1036
    CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
XhmikosR's avatar
XhmikosR committed
1037
1038
    FOCUS_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1,
    BLUR_DATA_API: "blur" + EVENT_KEY$1 + DATA_API_KEY$1
Mark Otto's avatar
dist    
Mark Otto committed
1039
1040
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
1041
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
1042
1043
     * ------------------------------------------------------------------------
     */
Jacob Thornton's avatar
Jacob Thornton committed
1044

XhmikosR's avatar
Dist    
XhmikosR committed
1045
  };
Jacob Thornton's avatar
Jacob Thornton committed
1046

XhmikosR's avatar
Dist    
XhmikosR committed
1047
1048
1049
1050
1051
  var Button =
  /*#__PURE__*/
  function () {
    function Button(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
1052
      Data.setData(element, DATA_KEY$1, this);
XhmikosR's avatar
Dist    
XhmikosR committed
1053
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
1054
1055


XhmikosR's avatar
Dist    
XhmikosR committed
1056
    var _proto = Button.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
1057

XhmikosR's avatar
Dist    
XhmikosR committed
1058
1059
1060
1061
    // Public
    _proto.toggle = function toggle() {
      var triggerChangeEvent = true;
      var addAriaPressed = true;
XhmikosR's avatar
XhmikosR committed
1062
      var rootElement = SelectorEngine.closest(this._element, Selector$1.DATA_TOGGLE);
XhmikosR's avatar
Dist    
XhmikosR committed
1063
1064

      if (rootElement) {
XhmikosR's avatar
XhmikosR committed
1065
        var input = SelectorEngine.findOne(Selector$1.INPUT, this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
1066

XhmikosR's avatar
XhmikosR committed
1067
1068
1069
1070
1071
        if (input && input.type === 'radio') {
          if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
            triggerChangeEvent = false;
          } else {
            var activeElement = SelectorEngine.findOne(Selector$1.ACTIVE, rootElement);
Jacob Thornton's avatar
Jacob Thornton committed
1072

XhmikosR's avatar
XhmikosR committed
1073
1074
            if (activeElement) {
              activeElement.classList.remove(ClassName$1.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
1075
1076
            }
          }
Mark Otto's avatar
dist    
Mark Otto committed
1077

XhmikosR's avatar
Dist    
XhmikosR committed
1078
1079
1080
          if (triggerChangeEvent) {
            if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
              return;
Johann-S's avatar
build    
Johann-S committed
1081
            }
Mark Otto's avatar
dist    
Mark Otto committed
1082

XhmikosR's avatar
Dist    
XhmikosR committed
1083
            input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
XhmikosR's avatar
XhmikosR committed
1084
            EventHandler.trigger(input, 'change');
Jacob Thornton's avatar
Jacob Thornton committed
1085
1086
          }

XhmikosR's avatar
Dist    
XhmikosR committed
1087
1088
          input.focus();
          addAriaPressed = false;
Jacob Thornton's avatar
Jacob Thornton committed
1089
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1090
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1091

XhmikosR's avatar
Dist    
XhmikosR committed
1092
1093
1094
      if (addAriaPressed) {
        this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1095

XhmikosR's avatar
Dist    
XhmikosR committed
1096
      if (triggerChangeEvent) {
XhmikosR's avatar
XhmikosR committed
1097
        this._element.classList.toggle(ClassName$1.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
1098
1099
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1100

XhmikosR's avatar
Dist    
XhmikosR committed
1101
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
1102
      Data.removeData(this._element, DATA_KEY$1);
XhmikosR's avatar
Dist    
XhmikosR committed
1103
      this._element = null;
Mark Otto's avatar
Mark Otto committed
1104
1105
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
1106

XhmikosR's avatar
XhmikosR committed
1107
    Button.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
1108
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1109
        var data = Data.getData(this, DATA_KEY$1);
Jacob Thornton's avatar
Jacob Thornton committed
1110

XhmikosR's avatar
Dist    
XhmikosR committed
1111
1112
1113
        if (!data) {
          data = new Button(this);
        }
Mark Otto's avatar
grunt    
Mark Otto committed
1114

XhmikosR's avatar
Dist    
XhmikosR committed
1115
1116
        if (config === 'toggle') {
          data[config]();
Mark Otto's avatar
grunt    
Mark Otto committed
1117
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1118
1119
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
1120

XhmikosR's avatar
XhmikosR committed
1121
    Button.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
1122
1123
1124
      return Data.getData(element, DATA_KEY$1);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1125
1126
1127
1128
1129
1130
    _createClass(Button, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$1;
      }
    }]);
Mark Otto's avatar
dist    
Mark Otto committed
1131

XhmikosR's avatar
Dist    
XhmikosR committed
1132
1133
1134
1135
1136
1137
1138
    return Button;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
1139
1140


XhmikosR's avatar
XhmikosR committed
1141
  EventHandler.on(document, Event$2.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1142
1143
    event.preventDefault();
    var button = event.target;
Jacob Thornton's avatar
Jacob Thornton committed
1144

XhmikosR's avatar
XhmikosR committed
1145
1146
    if (!button.classList.contains(ClassName$1.BUTTON)) {
      button = SelectorEngine.closest(button, Selector$1.BUTTON);
XhmikosR's avatar
Dist    
XhmikosR committed
1147
    }
Mark Otto's avatar
dist    
Mark Otto committed
1148

XhmikosR's avatar
XhmikosR committed
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
    var data = Data.getData(button, DATA_KEY$1);

    if (!data) {
      data = new Button(button);
    }

    data.toggle();
  });
  EventHandler.on(document, Event$2.FOCUS_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
    var button = SelectorEngine.closest(event.target, Selector$1.BUTTON);
XhmikosR's avatar
XhmikosR committed
1159
1160
1161
1162

    if (button) {
      button.classList.add(ClassName$1.FOCUS);
    }
XhmikosR's avatar
XhmikosR committed
1163
1164
1165
  });
  EventHandler.on(document, Event$2.BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
    var button = SelectorEngine.closest(event.target, Selector$1.BUTTON);
XhmikosR's avatar
XhmikosR committed
1166
1167
1168
1169

    if (button) {
      button.classList.remove(ClassName$1.FOCUS);
    }
XhmikosR's avatar
Dist    
XhmikosR committed
1170
  });
XhmikosR's avatar
XhmikosR committed
1171
  var $$2 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
1172
1173
1174
1175
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
1176
1177
1178
   * add .button to jQuery only if jQuery is present
   */

1179
1180
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
1181
1182
1183
1184
  if ($$2) {
    var JQUERY_NO_CONFLICT$1 = $$2.fn[NAME$1];
    $$2.fn[NAME$1] = Button.jQueryInterface;
    $$2.fn[NAME$1].Constructor = Button;
XhmikosR's avatar
XhmikosR committed
1185

XhmikosR's avatar
XhmikosR committed
1186
1187
1188
    $$2.fn[NAME$1].noConflict = function () {
      $$2.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
      return Button.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
1189
1190
1191
1192
1193
1194
1195
1196
    };
  }

  /**
   * --------------------------------------------------------------------------
   * Bootstrap (v4.3.1): dom/manipulator.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
1197
   */
XhmikosR's avatar
XhmikosR committed
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
  function normalizeData(val) {
    if (val === 'true') {
      return true;
    }

    if (val === 'false') {
      return false;
    }

    if (val === Number(val).toString()) {
      return Number(val);
    }

    if (val === '' || val === 'null') {
      return null;
    }

    return val;
  }
Jacob Thornton's avatar
Jacob Thornton committed
1217

XhmikosR's avatar
XhmikosR committed
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
  function normalizeDataKey(key) {
    return key.replace(/[A-Z]/g, function (chr) {
      return chr.toLowerCase();
    });
  }

  var Manipulator = {
    setDataAttribute: function setDataAttribute(element, key, value) {
      element.setAttribute("data-" + normalizeDataKey(key), value);
    },
    removeDataAttribute: function removeDataAttribute(element, key) {
      element.removeAttribute("data-" + normalizeDataKey(key));
    },
    getDataAttributes: function getDataAttributes(element) {
      if (!element) {
        return {};
      }

1236
      var attributes = _objectSpread2({}, element.dataset);
XhmikosR's avatar
XhmikosR committed
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262

      Object.keys(attributes).forEach(function (key) {
        attributes[key] = normalizeData(attributes[key]);
      });
      return attributes;
    },
    getDataAttribute: function getDataAttribute(element, key) {
      return normalizeData(element.getAttribute("data-" + normalizeDataKey(key)));
    },
    offset: function offset(element) {
      var rect = element.getBoundingClientRect();
      return {
        top: rect.top + document.body.scrollTop,
        left: rect.left + document.body.scrollLeft
      };
    },
    position: function position(element) {
      return {
        top: element.offsetTop,
        left: element.offsetLeft
      };
    },
    toggleClass: function toggleClass(element, className) {
      if (!element) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1263

XhmikosR's avatar
XhmikosR committed
1264
1265
1266
1267
1268
1269
      if (element.classList.contains(className)) {
        element.classList.remove(className);
      } else {
        element.classList.add(className);
      }
    }
XhmikosR's avatar
Dist    
XhmikosR committed
1270
  };
Jacob Thornton's avatar
Jacob Thornton committed
1271
1272

  /**
XhmikosR's avatar
Dist    
XhmikosR committed
1273
1274
1275
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
Jacob Thornton's avatar
Jacob Thornton committed
1276
   */
Mark Otto's avatar
dist    
Mark Otto committed
1277

XhmikosR's avatar
Dist    
XhmikosR committed
1278
  var NAME$2 = 'carousel';
XhmikosR's avatar
XhmikosR committed
1279
  var VERSION$2 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
  var DATA_KEY$2 = 'bs.carousel';
  var EVENT_KEY$2 = "." + DATA_KEY$2;
  var DATA_API_KEY$2 = '.data-api';
  var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key

  var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key

  var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch

  var SWIPE_THRESHOLD = 40;
  var Default = {
    interval: 5000,
    keyboard: true,
    slide: false,
    pause: 'hover',
    wrap: true,
    touch: true
  };
  var DefaultType = {
    interval: '(number|boolean)',
    keyboard: 'boolean',
    slide: '(boolean|string)',
    pause: '(string|boolean)',
    wrap: 'boolean',
    touch: 'boolean'
  };
  var Direction = {
    NEXT: 'next',
    PREV: 'prev',
    LEFT: 'left',
    RIGHT: 'right'
  };
XhmikosR's avatar
XhmikosR committed
1312
  var Event$3 = {
XhmikosR's avatar
Dist    
XhmikosR committed
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
    SLIDE: "slide" + EVENT_KEY$2,
    SLID: "slid" + EVENT_KEY$2,
    KEYDOWN: "keydown" + EVENT_KEY$2,
    MOUSEENTER: "mouseenter" + EVENT_KEY$2,
    MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
    TOUCHSTART: "touchstart" + EVENT_KEY$2,
    TOUCHMOVE: "touchmove" + EVENT_KEY$2,
    TOUCHEND: "touchend" + EVENT_KEY$2,
    POINTERDOWN: "pointerdown" + EVENT_KEY$2,
    POINTERUP: "pointerup" + EVENT_KEY$2,
    DRAG_START: "dragstart" + EVENT_KEY$2,
    LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
    CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  };
  var ClassName$2 = {
    CAROUSEL: 'carousel',
    ACTIVE: 'active',
    SLIDE: 'slide',
    RIGHT: 'carousel-item-right',
    LEFT: 'carousel-item-left',
    NEXT: 'carousel-item-next',
    PREV: 'carousel-item-prev',
    ITEM: 'carousel-item',
    POINTER_EVENT: 'pointer-event'
  };
  var Selector$2 = {
    ACTIVE: '.active',
    ACTIVE_ITEM: '.active.carousel-item',
    ITEM: '.carousel-item',
    ITEM_IMG: '.carousel-item img',
    NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
    INDICATORS: '.carousel-indicators',
    DATA_SLIDE: '[data-slide], [data-slide-to]',
    DATA_RIDE: '[data-ride="carousel"]'
  };
  var PointerType = {
    TOUCH: 'touch',
    PEN: 'pen'
Mark Otto's avatar
dist    
Mark Otto committed
1351
1352
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
1353
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
1354
1355
     * ------------------------------------------------------------------------
     */
Mark Otto's avatar
dist    
Mark Otto committed
1356

XhmikosR's avatar
Dist    
XhmikosR committed
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
  };

  var Carousel =
  /*#__PURE__*/
  function () {
    function Carousel(element, config) {
      this._items = null;
      this._interval = null;
      this._activeElement = null;
      this._isPaused = false;
      this._isSliding = false;
      this.touchTimeout = null;
      this.touchStartX = 0;
      this.touchDeltaX = 0;
      this._config = this._getConfig(config);
      this._element = element;
XhmikosR's avatar
XhmikosR committed
1373
      this._indicatorsElement = SelectorEngine.findOne(Selector$2.INDICATORS, this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
1374
1375
1376
1377
      this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
      this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);

      this._addEventListeners();
XhmikosR's avatar
XhmikosR committed
1378
1379

      Data.setData(element, DATA_KEY$2, this);
XhmikosR's avatar
Dist    
XhmikosR committed
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
    } // Getters


    var _proto = Carousel.prototype;

    // Public
    _proto.next = function next() {
      if (!this._isSliding) {
        this._slide(Direction.NEXT);
      }
Mark Otto's avatar
dist    
Mark Otto committed
1390
    };
Jacob Thornton's avatar
Jacob Thornton committed
1391

XhmikosR's avatar
Dist    
XhmikosR committed
1392
1393
1394
    _proto.nextWhenVisible = function nextWhenVisible() {
      // Don't call next when the page isn't visible
      // or the carousel or its parent isn't visible
XhmikosR's avatar
XhmikosR committed
1395
      if (!document.hidden && isVisible(this._element)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1396
1397
        this.next();
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1398
1399
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1400
1401
1402
1403
1404
    _proto.prev = function prev() {
      if (!this._isSliding) {
        this._slide(Direction.PREV);
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1405

XhmikosR's avatar
Dist    
XhmikosR committed
1406
1407
1408
1409
    _proto.pause = function pause(event) {
      if (!event) {
        this._isPaused = true;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1410

XhmikosR's avatar
XhmikosR committed
1411
1412
      if (SelectorEngine.findOne(Selector$2.NEXT_PREV, this._element)) {
        triggerTransitionEnd(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
1413
1414
        this.cycle(true);
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1415

XhmikosR's avatar
Dist    
XhmikosR committed
1416
1417
1418
      clearInterval(this._interval);
      this._interval = null;
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1419

XhmikosR's avatar
Dist    
XhmikosR committed
1420
1421
1422
1423
    _proto.cycle = function cycle(event) {
      if (!event) {
        this._isPaused = false;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1424

XhmikosR's avatar
Dist    
XhmikosR committed
1425
      if (this._interval) {
Mark Otto's avatar
dist    
Mark Otto committed
1426
1427
        clearInterval(this._interval);
        this._interval = null;
XhmikosR's avatar
Dist    
XhmikosR committed
1428
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1429

XhmikosR's avatar
XhmikosR committed
1430
      if (this._config && this._config.interval && !this._isPaused) {
XhmikosR's avatar
Dist    
XhmikosR committed
1431
1432
1433
        this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1434

XhmikosR's avatar
Dist    
XhmikosR committed
1435
1436
    _proto.to = function to(index) {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
1437

XhmikosR's avatar
XhmikosR committed
1438
      this._activeElement = SelectorEngine.findOne(Selector$2.ACTIVE_ITEM, this._element);
Jacob Thornton's avatar
Jacob Thornton committed
1439

XhmikosR's avatar
Dist    
XhmikosR committed
1440
      var activeIndex = this._getItemIndex(this._activeElement);
Jacob Thornton's avatar
Jacob Thornton committed
1441

XhmikosR's avatar
Dist    
XhmikosR committed
1442
1443
1444
      if (index > this._items.length - 1 || index < 0) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1445

XhmikosR's avatar
Dist    
XhmikosR committed
1446
      if (this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1447
        EventHandler.one(this._element, Event$3.SLID, function () {
XhmikosR's avatar
Dist    
XhmikosR committed
1448
1449
1450
1451
          return _this.to(index);
        });
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1452

XhmikosR's avatar
Dist    
XhmikosR committed
1453
1454
1455
1456
1457
      if (activeIndex === index) {
        this.pause();
        this.cycle();
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1458

XhmikosR's avatar
Dist    
XhmikosR committed
1459
      var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
Mark Otto's avatar
dist    
Mark Otto committed
1460

XhmikosR's avatar
Dist    
XhmikosR committed
1461
1462
      this._slide(direction, this._items[index]);
    };
Mark Otto's avatar
dist    
Mark Otto committed
1463

XhmikosR's avatar
Dist    
XhmikosR committed
1464
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
1465
1466
      EventHandler.off(this._element, EVENT_KEY$2);
      Data.removeData(this._element, DATA_KEY$2);
XhmikosR's avatar
Dist    
XhmikosR committed
1467
1468
1469
1470
1471
1472
1473
1474
      this._items = null;
      this._config = null;
      this._element = null;
      this._interval = null;
      this._isPaused = null;
      this._isSliding = null;
      this._activeElement = null;
      this._indicatorsElement = null;
Mark Otto's avatar
Mark Otto committed
1475
1476
    } // Private
    ;
XhmikosR's avatar
Dist    
XhmikosR committed
1477
1478

    _proto._getConfig = function _getConfig(config) {
1479
      config = _objectSpread2({}, Default, {}, config);
XhmikosR's avatar
XhmikosR committed
1480
      typeCheckConfig(NAME$2, config, DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
1481
1482
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
1483

XhmikosR's avatar
Dist    
XhmikosR committed
1484
1485
    _proto._handleSwipe = function _handleSwipe() {
      var absDeltax = Math.abs(this.touchDeltaX);
Mark Otto's avatar
dist    
Mark Otto committed
1486

XhmikosR's avatar
Dist    
XhmikosR committed
1487
1488
1489
      if (absDeltax <= SWIPE_THRESHOLD) {
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1490

XhmikosR's avatar
XhmikosR committed
1491
1492
      var direction = absDeltax / this.touchDeltaX;
      this.touchDeltaX = 0; // swipe left
Jacob Thornton's avatar
Jacob Thornton committed
1493

XhmikosR's avatar
Dist    
XhmikosR committed
1494
1495
1496
      if (direction > 0) {
        this.prev();
      } // swipe right
Mark Otto's avatar
dist    
Mark Otto committed
1497
1498


XhmikosR's avatar
Dist    
XhmikosR committed
1499
1500
1501
1502
      if (direction < 0) {
        this.next();
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1503

XhmikosR's avatar
Dist    
XhmikosR committed
1504
1505
    _proto._addEventListeners = function _addEventListeners() {
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
1506

XhmikosR's avatar
Dist    
XhmikosR committed
1507
      if (this._config.keyboard) {
XhmikosR's avatar
XhmikosR committed
1508
        EventHandler.on(this._element, Event$3.KEYDOWN, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1509
1510
1511
          return _this2._keydown(event);
        });
      }
Mark Otto's avatar
dist    
Mark Otto committed
1512

XhmikosR's avatar
Dist    
XhmikosR committed
1513
      if (this._config.pause === 'hover') {
XhmikosR's avatar
XhmikosR committed
1514
        EventHandler.on(this._element, Event$3.MOUSEENTER, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1515
          return _this2.pause(event);
XhmikosR's avatar
XhmikosR committed
1516
1517
        });
        EventHandler.on(this._element, Event$3.MOUSELEAVE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1518
1519
1520
          return _this2.cycle(event);
        });
      }
Jacob Thornton's avatar
Jacob Thornton committed
1521

1522
      if (this._config.touch && this._touchSupported) {
Mark Otto's avatar
Mark Otto committed
1523
1524
        this._addTouchEventListeners();
      }
XhmikosR's avatar
Dist    
XhmikosR committed
1525
    };
Jacob Thornton's avatar
Jacob Thornton committed
1526

XhmikosR's avatar
Dist    
XhmikosR committed
1527
1528
    _proto._addTouchEventListeners = function _addTouchEventListeners() {
      var _this3 = this;
Mark Otto's avatar
dist    
Mark Otto committed
1529

XhmikosR's avatar
Dist    
XhmikosR committed
1530
      var start = function start(event) {
XhmikosR's avatar
XhmikosR committed
1531
1532
        if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
          _this3.touchStartX = event.clientX;
XhmikosR's avatar
Dist    
XhmikosR committed
1533
        } else if (!_this3._pointerEvent) {
XhmikosR's avatar
XhmikosR committed
1534
          _this3.touchStartX = event.touches[0].clientX;
Mark Otto's avatar
dist    
Mark Otto committed
1535
1536
        }
      };
Jacob Thornton's avatar
Jacob Thornton committed
1537

XhmikosR's avatar
Dist    
XhmikosR committed
1538
1539
      var move = function move(event) {
        // ensure swiping with one touch and not pinching
XhmikosR's avatar
XhmikosR committed
1540
        if (event.touches && event.touches.length > 1) {
XhmikosR's avatar
Dist    
XhmikosR committed
1541
1542
          _this3.touchDeltaX = 0;
        } else {
XhmikosR's avatar
XhmikosR committed
1543
          _this3.touchDeltaX = event.touches[0].clientX - _this3.touchStartX;
XhmikosR's avatar
Dist    
XhmikosR committed
1544
        }
Mark Otto's avatar
dist    
Mark Otto committed
1545
      };
Jacob Thornton's avatar
Jacob Thornton committed
1546

XhmikosR's avatar
Dist    
XhmikosR committed
1547
      var end = function end(event) {
XhmikosR's avatar
XhmikosR committed
1548
1549
        if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
          _this3.touchDeltaX = event.clientX - _this3.touchStartX;
XhmikosR's avatar
Dist    
XhmikosR committed
1550
        }
Jacob Thornton's avatar
Jacob Thornton committed
1551

XhmikosR's avatar
Dist    
XhmikosR committed
1552
        _this3._handleSwipe();
Mark Otto's avatar
dist    
Mark Otto committed
1553

XhmikosR's avatar
Dist    
XhmikosR committed
1554
1555
1556
1557
1558
1559
1560
1561
1562
        if (_this3._config.pause === 'hover') {
          // If it's a touch-enabled device, mouseenter/leave are fired as
          // part of the mouse compatibility events on first tap - the carousel
          // would stop cycling until user tapped out of it;
          // here, we listen for touchend, explicitly pause the carousel
          // (as if it's the second time we tap on it, mouseenter compat event
          // is NOT fired) and after a timeout (to allow for mouse compatibility
          // events to fire) we explicitly restart cycling
          _this3.pause();
Mark Otto's avatar
dist    
Mark Otto committed
1563

XhmikosR's avatar
Dist    
XhmikosR committed
1564
1565
1566
          if (_this3.touchTimeout) {
            clearTimeout(_this3.touchTimeout);
          }
Jacob Thornton's avatar
Jacob Thornton committed
1567

XhmikosR's avatar
Dist    
XhmikosR committed
1568
1569
1570
1571
          _this3.touchTimeout = setTimeout(function (event) {
            return _this3.cycle(event);
          }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
        }
Mark Otto's avatar
dist    
Mark Otto committed
1572
      };
Jacob Thornton's avatar
Jacob Thornton committed
1573

XhmikosR's avatar
XhmikosR committed
1574
1575
1576
1577
      makeArray(SelectorEngine.find(Selector$2.ITEM_IMG, this._element)).forEach(function (itemImg) {
        EventHandler.on(itemImg, Event$3.DRAG_START, function (e) {
          return e.preventDefault();
        });
XhmikosR's avatar
Dist    
XhmikosR committed
1578
      });
Jacob Thornton's avatar
Jacob Thornton committed
1579

XhmikosR's avatar
Dist    
XhmikosR committed
1580
      if (this._pointerEvent) {
XhmikosR's avatar
XhmikosR committed
1581
        EventHandler.on(this._element, Event$3.POINTERDOWN, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1582
1583
          return start(event);
        });
XhmikosR's avatar
XhmikosR committed
1584
        EventHandler.on(this._element, Event$3.POINTERUP, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1585
1586
          return end(event);
        });
Jacob Thornton's avatar
Jacob Thornton committed
1587

XhmikosR's avatar
Dist    
XhmikosR committed
1588
1589
        this._element.classList.add(ClassName$2.POINTER_EVENT);
      } else {
XhmikosR's avatar
XhmikosR committed
1590
        EventHandler.on(this._element, Event$3.TOUCHSTART, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1591
          return start(event);
Mark Otto's avatar
dist    
Mark Otto committed
1592
        });
XhmikosR's avatar
XhmikosR committed
1593
        EventHandler.on(this._element, Event$3.TOUCHMOVE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1594
1595
          return move(event);
        });
XhmikosR's avatar
XhmikosR committed
1596
        EventHandler.on(this._element, Event$3.TOUCHEND, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1597
1598
1599
1600
          return end(event);
        });
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1601

XhmikosR's avatar
Dist    
XhmikosR committed
1602
1603
1604
1605
    _proto._keydown = function _keydown(event) {
      if (/input|textarea/i.test(event.target.tagName)) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1606

XhmikosR's avatar
Dist    
XhmikosR committed
1607
1608
1609
1610
1611
      switch (event.which) {
        case ARROW_LEFT_KEYCODE:
          event.preventDefault();
          this.prev();
          break;
Mark Otto's avatar
dist    
Mark Otto committed
1612

XhmikosR's avatar
Dist    
XhmikosR committed
1613
1614
1615
1616
        case ARROW_RIGHT_KEYCODE:
          event.preventDefault();
          this.next();
          break;
Mark Otto's avatar
dist    
Mark Otto committed
1617

XhmikosR's avatar
Dist    
XhmikosR committed
1618
1619
1620
        default:
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1621

XhmikosR's avatar
Dist    
XhmikosR committed
1622
    _proto._getItemIndex = function _getItemIndex(element) {
XhmikosR's avatar
XhmikosR committed
1623
      this._items = element && element.parentNode ? makeArray(SelectorEngine.find(Selector$2.ITEM, element.parentNode)) : [];
XhmikosR's avatar
Dist    
XhmikosR committed
1624
1625
      return this._items.indexOf(element);
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1626

XhmikosR's avatar
Dist    
XhmikosR committed
1627
1628
1629
    _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
      var isNextDirection = direction === Direction.NEXT;
      var isPrevDirection = direction === Direction.PREV;
Mark Otto's avatar
grunt    
Mark Otto committed
1630

XhmikosR's avatar
Dist    
XhmikosR committed
1631
      var activeIndex = this._getItemIndex(activeElement);
Jacob Thornton's avatar
Jacob Thornton committed
1632

XhmikosR's avatar
Dist    
XhmikosR committed
1633
1634
      var lastItemIndex = this._items.length - 1;
      var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
Mark Otto's avatar
dist    
Mark Otto committed
1635

XhmikosR's avatar
Dist    
XhmikosR committed
1636
1637
1638
      if (isGoingToWrap && !this._config.wrap) {
        return activeElement;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1639

XhmikosR's avatar
Dist    
XhmikosR committed
1640
1641
1642
1643
      var delta = direction === Direction.PREV ? -1 : 1;
      var itemIndex = (activeIndex + delta) % this._items.length;
      return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
    };
Jacob Thornton's avatar
Jacob Thornton committed
1644

XhmikosR's avatar
Dist    
XhmikosR committed
1645
1646
    _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
      var targetIndex = this._getItemIndex(relatedTarget);
Mark Otto's avatar
grunt    
Mark Otto committed
1647

XhmikosR's avatar
XhmikosR committed
1648
      var fromIndex = this._getItemIndex(SelectorEngine.findOne(Selector$2.ACTIVE_ITEM, this._element));
Jacob Thornton's avatar
Jacob Thornton committed
1649

XhmikosR's avatar
XhmikosR committed
1650
      return EventHandler.trigger(this._element, Event$3.SLIDE, {
XhmikosR's avatar
Dist    
XhmikosR committed
1651
1652
1653
1654
1655
1656
        relatedTarget: relatedTarget,
        direction: eventDirectionName,
        from: fromIndex,
        to: targetIndex
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
1657

XhmikosR's avatar
Dist    
XhmikosR committed
1658
1659
    _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
      if (this._indicatorsElement) {
XhmikosR's avatar
XhmikosR committed
1660
1661
1662
1663
1664
        var indicators = SelectorEngine.find(Selector$2.ACTIVE, this._indicatorsElement);

        for (var i = 0; i < indicators.length; i++) {
          indicators[i].classList.remove(ClassName$2.ACTIVE);
        }
Jacob Thornton's avatar
Jacob Thornton committed
1665

XhmikosR's avatar
Dist    
XhmikosR committed
1666
        var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
Jacob Thornton's avatar
Jacob Thornton committed
1667

XhmikosR's avatar
Dist    
XhmikosR committed
1668
        if (nextIndicator) {
XhmikosR's avatar
XhmikosR committed
1669
          nextIndicator.classList.add(ClassName$2.ACTIVE);
Mark Otto's avatar
dist    
Mark Otto committed
1670
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1671
1672
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1673

XhmikosR's avatar
Dist    
XhmikosR committed
1674
1675
    _proto._slide = function _slide(direction, element) {
      var _this4 = this;
Jacob Thornton's avatar
Jacob Thornton committed
1676

XhmikosR's avatar
XhmikosR committed
1677
      var activeElement = SelectorEngine.findOne(Selector$2.ACTIVE_ITEM, this._element);
Mark Otto's avatar
dist    
Mark Otto committed
1678

XhmikosR's avatar
Dist    
XhmikosR committed
1679
      var activeElementIndex = this._getItemIndex(activeElement);
Mark Otto's avatar
dist    
Mark Otto committed
1680

XhmikosR's avatar
Dist    
XhmikosR committed
1681
      var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
Mark Otto's avatar
dist    
Mark Otto committed
1682

XhmikosR's avatar
Dist    
XhmikosR committed
1683
      var nextElementIndex = this._getItemIndex(nextElement);
Jacob Thornton's avatar
Jacob Thornton committed
1684

XhmikosR's avatar
Dist    
XhmikosR committed
1685
1686
1687
1688
      var isCycling = Boolean(this._interval);
      var directionalClassName;
      var orderClassName;
      var eventDirectionName;
Jacob Thornton's avatar
Jacob Thornton committed
1689

XhmikosR's avatar
Dist    
XhmikosR committed
1690
1691
1692
1693
1694
1695
1696
1697
1698
      if (direction === Direction.NEXT) {
        directionalClassName = ClassName$2.LEFT;
        orderClassName = ClassName$2.NEXT;
        eventDirectionName = Direction.LEFT;
      } else {
        directionalClassName = ClassName$2.RIGHT;
        orderClassName = ClassName$2.PREV;
        eventDirectionName = Direction.RIGHT;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1699

XhmikosR's avatar
XhmikosR committed
1700
      if (nextElement && nextElement.classList.contains(ClassName$2.ACTIVE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1701
1702
1703
        this._isSliding = false;
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1704

XhmikosR's avatar
Dist    
XhmikosR committed
1705
      var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
Mark Otto's avatar
dist    
Mark Otto committed
1706

XhmikosR's avatar
XhmikosR committed
1707
      if (slideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
1708
1709
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1710

XhmikosR's avatar
Dist    
XhmikosR committed
1711
1712
1713
1714
      if (!activeElement || !nextElement) {
        // Some weirdness is happening, so we bail
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1715

XhmikosR's avatar
Dist    
XhmikosR committed
1716
      this._isSliding = true;
Jacob Thornton's avatar
Jacob Thornton committed
1717

XhmikosR's avatar
Dist    
XhmikosR committed
1718
1719
1720
      if (isCycling) {
        this.pause();
      }
Mark Otto's avatar
dist    
Mark Otto committed
1721

XhmikosR's avatar
Dist    
XhmikosR committed
1722
      this._setActiveIndicatorElement(nextElement);
Mark Otto's avatar
dist    
Mark Otto committed
1723

XhmikosR's avatar
XhmikosR committed
1724
1725
1726
1727
1728
      if (this._element.classList.contains(ClassName$2.SLIDE)) {
        nextElement.classList.add(orderClassName);
        reflow(nextElement);
        activeElement.classList.add(directionalClassName);
        nextElement.classList.add(directionalClassName);
XhmikosR's avatar
Dist    
XhmikosR committed
1729
1730
1731
1732
1733
1734
1735
        var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);

        if (nextElementInterval) {
          this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
          this._config.interval = nextElementInterval;
        } else {
          this._config.interval = this._config.defaultInterval || this._config.interval;
Jacob Thornton's avatar
Jacob Thornton committed
1736
1737
        }

XhmikosR's avatar
XhmikosR committed
1738
1739
1740
1741
1742
1743
1744
1745
        var transitionDuration = getTransitionDurationFromElement(activeElement);
        EventHandler.one(activeElement, TRANSITION_END, function () {
          nextElement.classList.remove(directionalClassName);
          nextElement.classList.remove(orderClassName);
          nextElement.classList.add(ClassName$2.ACTIVE);
          activeElement.classList.remove(ClassName$2.ACTIVE);
          activeElement.classList.remove(orderClassName);
          activeElement.classList.remove(directionalClassName);
XhmikosR's avatar
Dist    
XhmikosR committed
1746
1747
          _this4._isSliding = false;
          setTimeout(function () {
XhmikosR's avatar
XhmikosR committed
1748
1749
1750
1751
1752
1753
            EventHandler.trigger(_this4._element, Event$3.SLID, {
              relatedTarget: nextElement,
              direction: eventDirectionName,
              from: activeElementIndex,
              to: nextElementIndex
            });
XhmikosR's avatar
Dist    
XhmikosR committed
1754
          }, 0);
XhmikosR's avatar
XhmikosR committed
1755
1756
        });
        emulateTransitionEnd(activeElement, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
1757
      } else {
XhmikosR's avatar
XhmikosR committed
1758
1759
        activeElement.classList.remove(ClassName$2.ACTIVE);
        nextElement.classList.add(ClassName$2.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
1760
        this._isSliding = false;
XhmikosR's avatar
XhmikosR committed
1761
1762
1763
1764
1765
1766
        EventHandler.trigger(this._element, Event$3.SLID, {
          relatedTarget: nextElement,
          direction: eventDirectionName,
          from: activeElementIndex,
          to: nextElementIndex
        });
XhmikosR's avatar
Dist    
XhmikosR committed
1767
1768
1769
1770
1771
      }

      if (isCycling) {
        this.cycle();
      }
Mark Otto's avatar
Mark Otto committed
1772
1773
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
1774

XhmikosR's avatar
XhmikosR committed
1775
    Carousel.carouselInterface = function carouselInterface(element, config) {
XhmikosR's avatar
XhmikosR committed
1776
      var data = Data.getData(element, DATA_KEY$2);
Jacob Thornton's avatar
Jacob Thornton committed
1777

1778
      var _config = _objectSpread2({}, Default, {}, Manipulator.getDataAttributes(element));
Jacob Thornton's avatar
Jacob Thornton committed
1779

XhmikosR's avatar
XhmikosR committed
1780
      if (typeof config === 'object') {
1781
        _config = _objectSpread2({}, _config, {}, config);
XhmikosR's avatar
XhmikosR committed
1782
      }
Jacob Thornton's avatar
Jacob Thornton committed
1783

XhmikosR's avatar
XhmikosR committed
1784
      var action = typeof config === 'string' ? config : _config.slide;
Jacob Thornton's avatar
Jacob Thornton committed
1785

XhmikosR's avatar
XhmikosR committed
1786
1787
1788
1789
1790
1791
1792
1793
      if (!data) {
        data = new Carousel(element, _config);
      }

      if (typeof config === 'number') {
        data.to(config);
      } else if (typeof action === 'string') {
        if (typeof data[action] === 'undefined') {
XhmikosR's avatar
Dist.    
XhmikosR committed
1794
          throw new TypeError("No method named \"" + action + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
1795
        }
Mark Otto's avatar
grunt    
Mark Otto committed
1796

XhmikosR's avatar
XhmikosR committed
1797
1798
1799
1800
1801
1802
        data[action]();
      } else if (_config.interval && _config.ride) {
        data.pause();
        data.cycle();
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1803

XhmikosR's avatar
XhmikosR committed
1804
    Carousel.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
XhmikosR committed
1805
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1806
        Carousel.carouselInterface(this, config);
XhmikosR's avatar
Dist    
XhmikosR committed
1807
1808
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1809

XhmikosR's avatar
XhmikosR committed
1810
1811
    Carousel.dataApiClickHandler = function dataApiClickHandler(event) {
      var target = getElementFromSelector(this);
Jacob Thornton's avatar
Jacob Thornton committed
1812

XhmikosR's avatar
XhmikosR committed
1813
      if (!target || !target.classList.contains(ClassName$2.CAROUSEL)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1814
1815
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1816

1817
      var config = _objectSpread2({}, Manipulator.getDataAttributes(target), {}, Manipulator.getDataAttributes(this));
Mark Otto's avatar
dist    
Mark Otto committed
1818

XhmikosR's avatar
Dist    
XhmikosR committed
1819
      var slideIndex = this.getAttribute('data-slide-to');
Mark Otto's avatar
dist    
Mark Otto committed
1820

XhmikosR's avatar
Dist    
XhmikosR committed
1821
1822
      if (slideIndex) {
        config.interval = false;
Mark Otto's avatar
dist    
Mark Otto committed
1823
      }
Mark Otto's avatar
dist    
Mark Otto committed
1824

XhmikosR's avatar
XhmikosR committed
1825
      Carousel.carouselInterface(target, config);
Jacob Thornton's avatar
Jacob Thornton committed
1826

XhmikosR's avatar
Dist    
XhmikosR committed
1827
      if (slideIndex) {
XhmikosR's avatar
XhmikosR committed
1828
        Data.getData(target, DATA_KEY$2).to(slideIndex);
XhmikosR's avatar
Dist    
XhmikosR committed
1829
1830
1831
      }

      event.preventDefault();
Mark Otto's avatar
dist    
Mark Otto committed
1832
    };
Jacob Thornton's avatar
Jacob Thornton committed
1833

XhmikosR's avatar
XhmikosR committed
1834
    Carousel.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
1835
1836
1837
      return Data.getData(element, DATA_KEY$2);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
    _createClass(Carousel, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$2;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default;
      }
    }]);

Mark Otto's avatar
dist    
Mark Otto committed
1850
    return Carousel;
XhmikosR's avatar
Dist    
XhmikosR committed
1851
1852
1853
1854
1855
1856
1857
1858
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


XhmikosR's avatar
XhmikosR committed
1859
  EventHandler.on(document, Event$3.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel.dataApiClickHandler);
XhmikosR's avatar
XhmikosR committed
1860
1861
  EventHandler.on(window, Event$3.LOAD_DATA_API, function () {
    var carousels = makeArray(SelectorEngine.find(Selector$2.DATA_RIDE));
XhmikosR's avatar
Dist    
XhmikosR committed
1862
1863

    for (var i = 0, len = carousels.length; i < len; i++) {
XhmikosR's avatar
XhmikosR committed
1864
      Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY$2));
XhmikosR's avatar
Dist    
XhmikosR committed
1865
1866
    }
  });
XhmikosR's avatar
XhmikosR committed
1867
  var $$3 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
1868
1869
1870
1871
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
1872
   * add .carousel to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
1873
1874
   */

1875
1876
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
1877
1878
1879
1880
  if ($$3) {
    var JQUERY_NO_CONFLICT$2 = $$3.fn[NAME$2];
    $$3.fn[NAME$2] = Carousel.jQueryInterface;
    $$3.fn[NAME$2].Constructor = Carousel;
XhmikosR's avatar
Dist    
XhmikosR committed
1881

XhmikosR's avatar
XhmikosR committed
1882
1883
1884
    $$3.fn[NAME$2].noConflict = function () {
      $$3.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
      return Carousel.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
1885
1886
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
1887

XhmikosR's avatar
Dist    
XhmikosR committed
1888
1889
1890
1891
1892
1893
1894
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$3 = 'collapse';
XhmikosR's avatar
XhmikosR committed
1895
  var VERSION$3 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
  var DATA_KEY$3 = 'bs.collapse';
  var EVENT_KEY$3 = "." + DATA_KEY$3;
  var DATA_API_KEY$3 = '.data-api';
  var Default$1 = {
    toggle: true,
    parent: ''
  };
  var DefaultType$1 = {
    toggle: 'boolean',
    parent: '(string|element)'
  };
XhmikosR's avatar
XhmikosR committed
1907
  var Event$4 = {
XhmikosR's avatar
Dist    
XhmikosR committed
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
    SHOW: "show" + EVENT_KEY$3,
    SHOWN: "shown" + EVENT_KEY$3,
    HIDE: "hide" + EVENT_KEY$3,
    HIDDEN: "hidden" + EVENT_KEY$3,
    CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  };
  var ClassName$3 = {
    SHOW: 'show',
    COLLAPSE: 'collapse',
    COLLAPSING: 'collapsing',
    COLLAPSED: 'collapsed'
  };
  var Dimension = {
    WIDTH: 'width',
    HEIGHT: 'height'
  };
  var Selector$3 = {
    ACTIVES: '.show, .collapsing',
    DATA_TOGGLE: '[data-toggle="collapse"]'
Mark Otto's avatar
dist    
Mark Otto committed
1927
1928
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
1929
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
1930
1931
     * ------------------------------------------------------------------------
     */
Jacob Thornton's avatar
Jacob Thornton committed
1932

XhmikosR's avatar
Dist    
XhmikosR committed
1933
1934
1935
1936
1937
1938
1939
1940
1941
  };

  var Collapse =
  /*#__PURE__*/
  function () {
    function Collapse(element, config) {
      this._isTransitioning = false;
      this._element = element;
      this._config = this._getConfig(config);
XhmikosR's avatar
XhmikosR committed
1942
1943
      this._triggerArray = makeArray(SelectorEngine.find("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
      var toggleList = makeArray(SelectorEngine.find(Selector$3.DATA_TOGGLE));
XhmikosR's avatar
Dist    
XhmikosR committed
1944
1945
1946

      for (var i = 0, len = toggleList.length; i < len; i++) {
        var elem = toggleList[i];
XhmikosR's avatar
XhmikosR committed
1947
1948
        var selector = getSelectorFromElement(elem);
        var filterElement = makeArray(SelectorEngine.find(selector)).filter(function (foundElem) {
XhmikosR's avatar
Dist    
XhmikosR committed
1949
1950
          return foundElem === element;
        });
Johann-S's avatar
build    
Johann-S committed
1951

XhmikosR's avatar
XhmikosR committed
1952
        if (selector !== null && filterElement.length) {
XhmikosR's avatar
Dist    
XhmikosR committed
1953
          this._selector = selector;
Jacob Thornton's avatar
Jacob Thornton committed
1954

XhmikosR's avatar
Dist    
XhmikosR committed
1955
          this._triggerArray.push(elem);
Mark Otto's avatar
dist    
Mark Otto committed
1956
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1957
      }
Jacob Thornton's avatar
Jacob Thornton committed
1958

XhmikosR's avatar
Dist    
XhmikosR committed
1959
      this._parent = this._config.parent ? this._getParent() : null;
Jacob Thornton's avatar
Jacob Thornton committed
1960

XhmikosR's avatar
Dist    
XhmikosR committed
1961
1962
1963
      if (!this._config.parent) {
        this._addAriaAndCollapsedClass(this._element, this._triggerArray);
      }
Jacob Thornton's avatar
Jacob Thornton committed
1964

XhmikosR's avatar
Dist    
XhmikosR committed
1965
1966
1967
      if (this._config.toggle) {
        this.toggle();
      }
XhmikosR's avatar
XhmikosR committed
1968
1969

      Data.setData(element, DATA_KEY$3, this);
XhmikosR's avatar
Dist    
XhmikosR committed
1970
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
1971
1972


XhmikosR's avatar
Dist    
XhmikosR committed
1973
    var _proto = Collapse.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
1974

XhmikosR's avatar
Dist    
XhmikosR committed
1975
1976
    // Public
    _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
1977
      if (this._element.classList.contains(ClassName$3.SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1978
1979
1980
1981
1982
        this.hide();
      } else {
        this.show();
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1983

XhmikosR's avatar
Dist    
XhmikosR committed
1984
1985
    _proto.show = function show() {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
1986

XhmikosR's avatar
XhmikosR committed
1987
      if (this._isTransitioning || this._element.classList.contains(ClassName$3.SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1988
1989
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1990

XhmikosR's avatar
Dist    
XhmikosR committed
1991
1992
      var actives;
      var activesData;
Mark Otto's avatar
dist    
Mark Otto committed
1993

XhmikosR's avatar
Dist    
XhmikosR committed
1994
      if (this._parent) {
XhmikosR's avatar
XhmikosR committed
1995
        actives = makeArray(SelectorEngine.find(Selector$3.ACTIVES, this._parent)).filter(function (elem) {
XhmikosR's avatar
Dist    
XhmikosR committed
1996
1997
          if (typeof _this._config.parent === 'string') {
            return elem.getAttribute('data-parent') === _this._config.parent;
Mark Otto's avatar
dist    
Mark Otto committed
1998
          }
Jacob Thornton's avatar
Jacob Thornton committed
1999

XhmikosR's avatar
Dist    
XhmikosR committed
2000
2001
          return elem.classList.contains(ClassName$3.COLLAPSE);
        });
Mark Otto's avatar
dist    
Mark Otto committed
2002

XhmikosR's avatar
Dist    
XhmikosR committed
2003
2004
        if (actives.length === 0) {
          actives = null;
Jacob Thornton's avatar
Jacob Thornton committed
2005
        }
XhmikosR's avatar
Dist    
XhmikosR committed
2006
      }
Jacob Thornton's avatar
Jacob Thornton committed
2007

XhmikosR's avatar
XhmikosR committed
2008
2009
      var container = SelectorEngine.findOne(this._selector);

XhmikosR's avatar
Dist    
XhmikosR committed
2010
      if (actives) {
XhmikosR's avatar
XhmikosR committed
2011
2012
2013
2014
        var tempActiveData = actives.filter(function (elem) {
          return container !== elem;
        });
        activesData = tempActiveData[0] ? Data.getData(tempActiveData[0], DATA_KEY$3) : null;
Mark Otto's avatar
dist    
Mark Otto committed
2015

XhmikosR's avatar
Dist    
XhmikosR committed
2016
        if (activesData && activesData._isTransitioning) {
Mark Otto's avatar
dist    
Mark Otto committed
2017
2018
          return;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
2019
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2020

XhmikosR's avatar
XhmikosR committed
2021
      var startEvent = EventHandler.trigger(this._element, Event$4.SHOW);
Mark Otto's avatar
dist    
Mark Otto committed
2022

XhmikosR's avatar
XhmikosR committed
2023
      if (startEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2024
2025
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2026

XhmikosR's avatar
Dist    
XhmikosR committed
2027
      if (actives) {
XhmikosR's avatar
XhmikosR committed
2028
2029
        actives.forEach(function (elemActive) {
          if (container !== elemActive) {
XhmikosR's avatar
XhmikosR committed
2030
            Collapse.collapseInterface(elemActive, 'hide');
XhmikosR's avatar
XhmikosR committed
2031
          }
Jacob Thornton's avatar
Jacob Thornton committed
2032

XhmikosR's avatar
XhmikosR committed
2033
2034
2035
2036
          if (!activesData) {
            Data.setData(elemActive, DATA_KEY$3, null);
          }
        });
XhmikosR's avatar
Dist    
XhmikosR committed
2037
      }
Jacob Thornton's avatar
Jacob Thornton committed
2038

XhmikosR's avatar
Dist    
XhmikosR committed
2039
      var dimension = this._getDimension();
Jacob Thornton's avatar
Jacob Thornton committed
2040

XhmikosR's avatar
XhmikosR committed
2041
2042
2043
2044
      this._element.classList.remove(ClassName$3.COLLAPSE);

      this._element.classList.add(ClassName$3.COLLAPSING);

XhmikosR's avatar
Dist    
XhmikosR committed
2045
2046
2047
      this._element.style[dimension] = 0;

      if (this._triggerArray.length) {
XhmikosR's avatar
XhmikosR committed
2048
2049
2050
2051
        this._triggerArray.forEach(function (element) {
          element.classList.remove(ClassName$3.COLLAPSED);
          element.setAttribute('aria-expanded', true);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
2052
      }
Jacob Thornton's avatar
Jacob Thornton committed
2053

XhmikosR's avatar
Dist    
XhmikosR committed
2054
      this.setTransitioning(true);
Jacob Thornton's avatar
Jacob Thornton committed
2055

XhmikosR's avatar
Dist    
XhmikosR committed
2056
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
2057
2058
2059
2060
2061
2062
        _this._element.classList.remove(ClassName$3.COLLAPSING);

        _this._element.classList.add(ClassName$3.COLLAPSE);

        _this._element.classList.add(ClassName$3.SHOW);

XhmikosR's avatar
Dist    
XhmikosR committed
2063
        _this._element.style[dimension] = '';
Jacob Thornton's avatar
Jacob Thornton committed
2064

XhmikosR's avatar
Dist    
XhmikosR committed
2065
2066
        _this.setTransitioning(false);

XhmikosR's avatar
XhmikosR committed
2067
        EventHandler.trigger(_this._element, Event$4.SHOWN);
Mark Otto's avatar
dist    
Mark Otto committed
2068
      };
Jacob Thornton's avatar
Jacob Thornton committed
2069

XhmikosR's avatar
Dist    
XhmikosR committed
2070
2071
      var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
      var scrollSize = "scroll" + capitalizedDimension;
XhmikosR's avatar
XhmikosR committed
2072
2073
2074
      var transitionDuration = getTransitionDurationFromElement(this._element);
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
2075
2076
      this._element.style[dimension] = this._element[scrollSize] + "px";
    };
Jacob Thornton's avatar
Jacob Thornton committed
2077

XhmikosR's avatar
Dist    
XhmikosR committed
2078
2079
    _proto.hide = function hide() {
      var _this2 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2080

XhmikosR's avatar
XhmikosR committed
2081
      if (this._isTransitioning || !this._element.classList.contains(ClassName$3.SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2082
2083
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
2084

XhmikosR's avatar
XhmikosR committed
2085
      var startEvent = EventHandler.trigger(this._element, Event$4.HIDE);
Jacob Thornton's avatar
Jacob Thornton committed
2086

XhmikosR's avatar
XhmikosR committed
2087
      if (startEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2088
2089
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2090

XhmikosR's avatar
Dist    
XhmikosR committed
2091
      var dimension = this._getDimension();
Jacob Thornton's avatar
Jacob Thornton committed
2092

XhmikosR's avatar
Dist    
XhmikosR committed
2093
      this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
XhmikosR's avatar
XhmikosR committed
2094
2095
2096
2097
2098
2099
2100
2101
      reflow(this._element);

      this._element.classList.add(ClassName$3.COLLAPSING);

      this._element.classList.remove(ClassName$3.COLLAPSE);

      this._element.classList.remove(ClassName$3.SHOW);

XhmikosR's avatar
Dist    
XhmikosR committed
2102
      var triggerArrayLength = this._triggerArray.length;
Mark Otto's avatar
dist    
Mark Otto committed
2103

XhmikosR's avatar
Dist    
XhmikosR committed
2104
2105
2106
      if (triggerArrayLength > 0) {
        for (var i = 0; i < triggerArrayLength; i++) {
          var trigger = this._triggerArray[i];
XhmikosR's avatar
XhmikosR committed
2107
          var elem = getElementFromSelector(trigger);
XhmikosR's avatar
Dist    
XhmikosR committed
2108

XhmikosR's avatar
XhmikosR committed
2109
2110
2111
          if (elem && !elem.classList.contains(ClassName$3.SHOW)) {
            trigger.classList.add(ClassName$3.COLLAPSED);
            trigger.setAttribute('aria-expanded', false);
Mark Otto's avatar
build    
Mark Otto committed
2112
2113
          }
        }
XhmikosR's avatar
Dist    
XhmikosR committed
2114
      }
Mark Otto's avatar
dist    
Mark Otto committed
2115

XhmikosR's avatar
Dist    
XhmikosR committed
2116
      this.setTransitioning(true);
Jacob Thornton's avatar
Jacob Thornton committed
2117

XhmikosR's avatar
Dist    
XhmikosR committed
2118
2119
      var complete = function complete() {
        _this2.setTransitioning(false);
Jacob Thornton's avatar
Jacob Thornton committed
2120

XhmikosR's avatar
XhmikosR committed
2121
2122
2123
2124
2125
        _this2._element.classList.remove(ClassName$3.COLLAPSING);

        _this2._element.classList.add(ClassName$3.COLLAPSE);

        EventHandler.trigger(_this2._element, Event$4.HIDDEN);
Mark Otto's avatar
dist    
Mark Otto committed
2126
      };
Jacob Thornton's avatar
Jacob Thornton committed
2127

XhmikosR's avatar
Dist    
XhmikosR committed
2128
      this._element.style[dimension] = '';
XhmikosR's avatar
XhmikosR committed
2129
2130
2131
      var transitionDuration = getTransitionDurationFromElement(this._element);
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
2132
    };
Jacob Thornton's avatar
Jacob Thornton committed
2133

XhmikosR's avatar
Dist    
XhmikosR committed
2134
2135
2136
    _proto.setTransitioning = function setTransitioning(isTransitioning) {
      this._isTransitioning = isTransitioning;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2137

XhmikosR's avatar
Dist    
XhmikosR committed
2138
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
2139
      Data.removeData(this._element, DATA_KEY$3);
XhmikosR's avatar
Dist    
XhmikosR committed
2140
2141
2142
2143
2144
      this._config = null;
      this._parent = null;
      this._element = null;
      this._triggerArray = null;
      this._isTransitioning = null;
Mark Otto's avatar
Mark Otto committed
2145
2146
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
2147

XhmikosR's avatar
Dist    
XhmikosR committed
2148
    _proto._getConfig = function _getConfig(config) {
2149
      config = _objectSpread2({}, Default$1, {}, config);
XhmikosR's avatar
Dist    
XhmikosR committed
2150
      config.toggle = Boolean(config.toggle); // Coerce string values
Mark Otto's avatar
grunt    
Mark Otto committed
2151

XhmikosR's avatar
XhmikosR committed
2152
      typeCheckConfig(NAME$3, config, DefaultType$1);
XhmikosR's avatar
Dist    
XhmikosR committed
2153
2154
      return config;
    };
Mark Otto's avatar
grunt    
Mark Otto committed
2155

XhmikosR's avatar
Dist    
XhmikosR committed
2156
    _proto._getDimension = function _getDimension() {
XhmikosR's avatar
XhmikosR committed
2157
2158
      var hasWidth = this._element.classList.contains(Dimension.WIDTH);

XhmikosR's avatar
Dist    
XhmikosR committed
2159
2160
      return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
    };
Mark Otto's avatar
grunt    
Mark Otto committed
2161

XhmikosR's avatar
Dist    
XhmikosR committed
2162
2163
    _proto._getParent = function _getParent() {
      var _this3 = this;
Mark Otto's avatar
grunt    
Mark Otto committed
2164

XhmikosR's avatar
Dist.    
XhmikosR committed
2165
      var parent = this._config.parent;
Mark Otto's avatar
dist    
Mark Otto committed
2166

XhmikosR's avatar
Dist.    
XhmikosR committed
2167
2168
2169
2170
      if (isElement(parent)) {
        // it's a jQuery object
        if (typeof parent.jquery !== 'undefined' || typeof parent[0] !== 'undefined') {
          parent = parent[0];
XhmikosR's avatar
Dist    
XhmikosR committed
2171
2172
        }
      } else {
XhmikosR's avatar
Dist.    
XhmikosR committed
2173
        parent = SelectorEngine.findOne(parent);
XhmikosR's avatar
Dist    
XhmikosR committed
2174
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2175

XhmikosR's avatar
Dist.    
XhmikosR committed
2176
      var selector = "[data-toggle=\"collapse\"][data-parent=\"" + parent + "\"]";
XhmikosR's avatar
XhmikosR committed
2177
      makeArray(SelectorEngine.find(selector, parent)).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
2178
        var selected = getElementFromSelector(element);
2179
2180

        _this3._addAriaAndCollapsedClass(selected, [element]);
XhmikosR's avatar
Dist    
XhmikosR committed
2181
2182
2183
      });
      return parent;
    };
Mark Otto's avatar
grunt    
Mark Otto committed
2184

XhmikosR's avatar
Dist    
XhmikosR committed
2185
    _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
XhmikosR's avatar
XhmikosR committed
2186
2187
2188
2189
2190
      if (element) {
        var isOpen = element.classList.contains(ClassName$3.SHOW);

        if (triggerArray.length) {
          triggerArray.forEach(function (elem) {
XhmikosR's avatar
Dist.    
XhmikosR committed
2191
            if (isOpen) {
XhmikosR's avatar
XhmikosR committed
2192
              elem.classList.remove(ClassName$3.COLLAPSED);
XhmikosR's avatar
Dist.    
XhmikosR committed
2193
2194
            } else {
              elem.classList.add(ClassName$3.COLLAPSED);
XhmikosR's avatar
XhmikosR committed
2195
            }
Jacob Thornton's avatar
Jacob Thornton committed
2196

XhmikosR's avatar
XhmikosR committed
2197
2198
2199
            elem.setAttribute('aria-expanded', isOpen);
          });
        }
XhmikosR's avatar
Dist    
XhmikosR committed
2200
      }
Mark Otto's avatar
Mark Otto committed
2201
2202
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
2203

XhmikosR's avatar
XhmikosR committed
2204
    Collapse.collapseInterface = function collapseInterface(element, config) {
XhmikosR's avatar
XhmikosR committed
2205
      var data = Data.getData(element, DATA_KEY$3);
Jacob Thornton's avatar
Jacob Thornton committed
2206

2207
      var _config = _objectSpread2({}, Default$1, {}, Manipulator.getDataAttributes(element), {}, typeof config === 'object' && config ? config : {});
Mark Otto's avatar
grunt    
Mark Otto committed
2208

XhmikosR's avatar
XhmikosR committed
2209
2210
2211
      if (!data && _config.toggle && /show|hide/.test(config)) {
        _config.toggle = false;
      }
Mark Otto's avatar
dist    
Mark Otto committed
2212

XhmikosR's avatar
XhmikosR committed
2213
2214
2215
2216
2217
2218
      if (!data) {
        data = new Collapse(element, _config);
      }

      if (typeof config === 'string') {
        if (typeof data[config] === 'undefined') {
XhmikosR's avatar
Dist.    
XhmikosR committed
2219
          throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist    
XhmikosR committed
2220
        }
Mark Otto's avatar
grunt    
Mark Otto committed
2221

XhmikosR's avatar
XhmikosR committed
2222
2223
2224
        data[config]();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
2225

XhmikosR's avatar
XhmikosR committed
2226
    Collapse.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
XhmikosR committed
2227
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
2228
        Collapse.collapseInterface(this, config);
XhmikosR's avatar
Dist    
XhmikosR committed
2229
2230
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
2231

XhmikosR's avatar
XhmikosR committed
2232
    Collapse.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
2233
2234
2235
      return Data.getData(element, DATA_KEY$3);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
    _createClass(Collapse, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$3;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$1;
      }
    }]);
Jacob Thornton's avatar
Jacob Thornton committed
2247

XhmikosR's avatar
Dist    
XhmikosR committed
2248
2249
2250
2251
2252
2253
2254
    return Collapse;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
2255

Jacob Thornton's avatar
Jacob Thornton committed
2256

XhmikosR's avatar
XhmikosR committed
2257
  EventHandler.on(document, Event$4.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2258
    // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
XhmikosR's avatar
XhmikosR committed
2259
    if (event.target.tagName === 'A') {
XhmikosR's avatar
Dist    
XhmikosR committed
2260
2261
      event.preventDefault();
    }
Mark Otto's avatar
dist    
Mark Otto committed
2262

XhmikosR's avatar
XhmikosR committed
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
    var triggerData = Manipulator.getDataAttributes(this);
    var selector = getSelectorFromElement(this);
    var selectorElements = makeArray(SelectorEngine.find(selector));
    selectorElements.forEach(function (element) {
      var data = Data.getData(element, DATA_KEY$3);
      var config;

      if (data) {
        // update parent attribute
        if (data._parent === null && typeof triggerData.parent === 'string') {
          data._config.parent = triggerData.parent;
          data._parent = data._getParent();
        }

        config = 'toggle';
      } else {
        config = triggerData;
      }
Mark Otto's avatar
dist    
Mark Otto committed
2281

XhmikosR's avatar
XhmikosR committed
2282
      Collapse.collapseInterface(element, config);
XhmikosR's avatar
Dist    
XhmikosR committed
2283
2284
    });
  });
XhmikosR's avatar
XhmikosR committed
2285
  var $$4 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
2286
2287
2288
2289
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
2290
   * add .collapse to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
2291
   */
Jacob Thornton's avatar
Jacob Thornton committed
2292

2293
2294
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
2295
2296
2297
2298
  if ($$4) {
    var JQUERY_NO_CONFLICT$3 = $$4.fn[NAME$3];
    $$4.fn[NAME$3] = Collapse.jQueryInterface;
    $$4.fn[NAME$3].Constructor = Collapse;
Jacob Thornton's avatar
Jacob Thornton committed
2299

XhmikosR's avatar
XhmikosR committed
2300
2301
2302
    $$4.fn[NAME$3].noConflict = function () {
      $$4.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
      return Collapse.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
2303
2304
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
2305

XhmikosR's avatar
Dist    
XhmikosR committed
2306
2307
2308
2309
2310
2311
2312
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$4 = 'dropdown';
XhmikosR's avatar
XhmikosR committed
2313
  var VERSION$4 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
  var DATA_KEY$4 = 'bs.dropdown';
  var EVENT_KEY$4 = "." + DATA_KEY$4;
  var DATA_API_KEY$4 = '.data-api';
  var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key

  var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key

  var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key

  var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key

  var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key

  var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)

  var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
XhmikosR's avatar
XhmikosR committed
2330
  var Event$5 = {
XhmikosR's avatar
Dist    
XhmikosR committed
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
    HIDE: "hide" + EVENT_KEY$4,
    HIDDEN: "hidden" + EVENT_KEY$4,
    SHOW: "show" + EVENT_KEY$4,
    SHOWN: "shown" + EVENT_KEY$4,
    CLICK: "click" + EVENT_KEY$4,
    CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
    KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
    KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  };
  var ClassName$4 = {
    DISABLED: 'disabled',
    SHOW: 'show',
    DROPUP: 'dropup',
    DROPRIGHT: 'dropright',
    DROPLEFT: 'dropleft',
    MENURIGHT: 'dropdown-menu-right',
    POSITION_STATIC: 'position-static'
  };
  var Selector$4 = {
    DATA_TOGGLE: '[data-toggle="dropdown"]',
    FORM_CHILD: '.dropdown form',
    MENU: '.dropdown-menu',
    NAVBAR_NAV: '.navbar-nav',
    VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  };
  var AttachmentMap = {
    TOP: 'top-start',
    TOPEND: 'top-end',
    BOTTOM: 'bottom-start',
    BOTTOMEND: 'bottom-end',
    RIGHT: 'right-start',
    RIGHTEND: 'right-end',
    LEFT: 'left-start',
    LEFTEND: 'left-end'
  };
  var Default$2 = {
    offset: 0,
    flip: true,
    boundary: 'scrollParent',
    reference: 'toggle',
XhmikosR's avatar
XhmikosR committed
2371
2372
    display: 'dynamic',
    popperConfig: null
XhmikosR's avatar
Dist    
XhmikosR committed
2373
2374
2375
2376
2377
2378
  };
  var DefaultType$2 = {
    offset: '(number|string|function)',
    flip: 'boolean',
    boundary: '(string|element)',
    reference: '(string|element)',
XhmikosR's avatar
XhmikosR committed
2379
2380
    display: 'string',
    popperConfig: '(null|object)'
Mark Otto's avatar
dist    
Mark Otto committed
2381
2382
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
2383
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
2384
2385
     * ------------------------------------------------------------------------
     */
Mark Otto's avatar
dist    
Mark Otto committed
2386

XhmikosR's avatar
Dist    
XhmikosR committed
2387
  };
Mark Otto's avatar
dist    
Mark Otto committed
2388

XhmikosR's avatar
Dist    
XhmikosR committed
2389
2390
2391
2392
2393
2394
2395
2396
2397
  var Dropdown =
  /*#__PURE__*/
  function () {
    function Dropdown(element, config) {
      this._element = element;
      this._popper = null;
      this._config = this._getConfig(config);
      this._menu = this._getMenuElement();
      this._inNavbar = this._detectNavbar();
Mark Otto's avatar
dist    
Mark Otto committed
2398

XhmikosR's avatar
Dist    
XhmikosR committed
2399
      this._addEventListeners();
XhmikosR's avatar
XhmikosR committed
2400
2401

      Data.setData(element, DATA_KEY$4, this);
XhmikosR's avatar
Dist    
XhmikosR committed
2402
    } // Getters
Mark Otto's avatar
dist    
Mark Otto committed
2403

Jacob Thornton's avatar
Jacob Thornton committed
2404

XhmikosR's avatar
Dist    
XhmikosR committed
2405
    var _proto = Dropdown.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
2406

XhmikosR's avatar
Dist    
XhmikosR committed
2407
2408
    // Public
    _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
2409
      if (this._element.disabled || this._element.classList.contains(ClassName$4.DISABLED)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2410
2411
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2412

XhmikosR's avatar
XhmikosR committed
2413
      var isActive = this._menu.classList.contains(ClassName$4.SHOW);
Jacob Thornton's avatar
Jacob Thornton committed
2414

XhmikosR's avatar
XhmikosR committed
2415
      Dropdown.clearMenus();
Jacob Thornton's avatar
Jacob Thornton committed
2416

XhmikosR's avatar
Dist    
XhmikosR committed
2417
2418
2419
      if (isActive) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2420

XhmikosR's avatar
XhmikosR committed
2421
2422
2423
2424
2425
2426
2427
2428
2429
      this.show();
    };

    _proto.show = function show() {
      if (this._element.disabled || this._element.classList.contains(ClassName$4.DISABLED) || this._menu.classList.contains(ClassName$4.SHOW)) {
        return;
      }

      var parent = Dropdown.getParentFromElement(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
2430
2431
2432
      var relatedTarget = {
        relatedTarget: this._element
      };
XhmikosR's avatar
XhmikosR committed
2433
      var showEvent = EventHandler.trigger(parent, Event$5.SHOW, relatedTarget);
Mark Otto's avatar
dist    
Mark Otto committed
2434

XhmikosR's avatar
XhmikosR committed
2435
      if (showEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2436
2437
        return;
      } // Disable totally Popper.js for Dropdown in Navbar
Jacob Thornton's avatar
Jacob Thornton committed
2438
2439


XhmikosR's avatar
Dist    
XhmikosR committed
2440
2441
      if (!this._inNavbar) {
        if (typeof Popper === 'undefined') {
XhmikosR's avatar
XhmikosR committed
2442
          throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org)');
Mark Otto's avatar
dist    
Mark Otto committed
2443
        }
Jacob Thornton's avatar
Jacob Thornton committed
2444

XhmikosR's avatar
Dist    
XhmikosR committed
2445
        var referenceElement = this._element;
Mark Otto's avatar
dist    
Mark Otto committed
2446

XhmikosR's avatar
Dist    
XhmikosR committed
2447
2448
        if (this._config.reference === 'parent') {
          referenceElement = parent;
XhmikosR's avatar
XhmikosR committed
2449
        } else if (isElement(this._config.reference)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2450
          referenceElement = this._config.reference; // Check if it's jQuery element
Mark Otto's avatar
dist    
Mark Otto committed
2451

XhmikosR's avatar
Dist    
XhmikosR committed
2452
2453
          if (typeof this._config.reference.jquery !== 'undefined') {
            referenceElement = this._config.reference[0];
Mark Otto's avatar
dist    
Mark Otto committed
2454
          }
XhmikosR's avatar
Dist    
XhmikosR committed
2455
2456
2457
        } // If boundary is not `scrollParent`, then set position to `static`
        // to allow the menu to "escape" the scroll parent's boundaries
        // https://github.com/twbs/bootstrap/issues/24251
Jacob Thornton's avatar
Jacob Thornton committed
2458

Mark Otto's avatar
dist    
Mark Otto committed
2459

XhmikosR's avatar
Dist    
XhmikosR committed
2460
        if (this._config.boundary !== 'scrollParent') {
XhmikosR's avatar
XhmikosR committed
2461
          parent.classList.add(ClassName$4.POSITION_STATIC);
XhmikosR's avatar
Dist    
XhmikosR committed
2462
        }
Mark Otto's avatar
dist    
Mark Otto committed
2463

XhmikosR's avatar
Dist    
XhmikosR committed
2464
2465
2466
2467
2468
        this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
      } // If this is a touch-enabled device we add extra
      // empty mouseover listeners to the body's immediate children;
      // only needed because of broken event delegation on iOS
      // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
Mark Otto's avatar
dist    
Mark Otto committed
2469

Johann-S's avatar
build    
Johann-S committed
2470

XhmikosR's avatar
XhmikosR committed
2471
2472
2473
2474
      if ('ontouchstart' in document.documentElement && !makeArray(SelectorEngine.closest(parent, Selector$4.NAVBAR_NAV)).length) {
        makeArray(document.body.children).forEach(function (elem) {
          return EventHandler.on(elem, 'mouseover', null, noop());
        });
XhmikosR's avatar
Dist    
XhmikosR committed
2475
      }
Mark Otto's avatar
dist    
Mark Otto committed
2476

XhmikosR's avatar
Dist    
XhmikosR committed
2477
      this._element.focus();
Mark Otto's avatar
dist    
Mark Otto committed
2478

XhmikosR's avatar
Dist    
XhmikosR committed
2479
      this._element.setAttribute('aria-expanded', true);
Mark Otto's avatar
grunt    
Mark Otto committed
2480

XhmikosR's avatar
XhmikosR committed
2481
2482
2483
      Manipulator.toggleClass(this._menu, ClassName$4.SHOW);
      Manipulator.toggleClass(parent, ClassName$4.SHOW);
      EventHandler.trigger(parent, Event$5.SHOWN, relatedTarget);
XhmikosR's avatar
Dist    
XhmikosR committed
2484
    };
Mark Otto's avatar
dist    
Mark Otto committed
2485

XhmikosR's avatar
Dist    
XhmikosR committed
2486
    _proto.hide = function hide() {
XhmikosR's avatar
XhmikosR committed
2487
      if (this._element.disabled || this._element.classList.contains(ClassName$4.DISABLED) || !this._menu.classList.contains(ClassName$4.SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2488
2489
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2490

XhmikosR's avatar
XhmikosR committed
2491
      var parent = Dropdown.getParentFromElement(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
2492
2493
2494
      var relatedTarget = {
        relatedTarget: this._element
      };
XhmikosR's avatar
XhmikosR committed
2495
      var hideEvent = EventHandler.trigger(parent, Event$5.HIDE, relatedTarget);
Mark Otto's avatar
dist    
Mark Otto committed
2496

XhmikosR's avatar
XhmikosR committed
2497
      if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2498
2499
        return;
      }
Johann-S's avatar
build    
Johann-S committed
2500

XhmikosR's avatar
XhmikosR committed
2501
2502
2503
2504
      if (this._popper) {
        this._popper.destroy();
      }

XhmikosR's avatar
XhmikosR committed
2505
2506
2507
      Manipulator.toggleClass(this._menu, ClassName$4.SHOW);
      Manipulator.toggleClass(parent, ClassName$4.SHOW);
      EventHandler.trigger(parent, Event$5.HIDDEN, relatedTarget);
XhmikosR's avatar
Dist    
XhmikosR committed
2508
    };
Johann-S's avatar
build    
Johann-S committed
2509

XhmikosR's avatar
Dist    
XhmikosR committed
2510
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
2511
2512
      Data.removeData(this._element, DATA_KEY$4);
      EventHandler.off(this._element, EVENT_KEY$4);
XhmikosR's avatar
Dist    
XhmikosR committed
2513
2514
      this._element = null;
      this._menu = null;
Mark Otto's avatar
dist    
Mark Otto committed
2515

XhmikosR's avatar
XhmikosR committed
2516
      if (this._popper) {
XhmikosR's avatar
Dist    
XhmikosR committed
2517
        this._popper.destroy();
Mark Otto's avatar
dist    
Mark Otto committed
2518

XhmikosR's avatar
Dist    
XhmikosR committed
2519
2520
2521
        this._popper = null;
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2522

XhmikosR's avatar
Dist    
XhmikosR committed
2523
2524
    _proto.update = function update() {
      this._inNavbar = this._detectNavbar();
Mark Otto's avatar
build    
Mark Otto committed
2525

XhmikosR's avatar
XhmikosR committed
2526
      if (this._popper) {
XhmikosR's avatar
Dist    
XhmikosR committed
2527
2528
        this._popper.scheduleUpdate();
      }
Mark Otto's avatar
Mark Otto committed
2529
2530
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
2531

XhmikosR's avatar
Dist    
XhmikosR committed
2532
2533
    _proto._addEventListeners = function _addEventListeners() {
      var _this = this;
Mark Otto's avatar
build    
Mark Otto committed
2534

XhmikosR's avatar
XhmikosR committed
2535
      EventHandler.on(this._element, Event$5.CLICK, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2536
2537
        event.preventDefault();
        event.stopPropagation();
Mark Otto's avatar
build    
Mark Otto committed
2538

XhmikosR's avatar
Dist    
XhmikosR committed
2539
2540
2541
        _this.toggle();
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
2542

XhmikosR's avatar
Dist    
XhmikosR committed
2543
    _proto._getConfig = function _getConfig(config) {
2544
      config = _objectSpread2({}, this.constructor.Default, {}, Manipulator.getDataAttributes(this._element), {}, config);
XhmikosR's avatar
XhmikosR committed
2545
      typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
2546
2547
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
2548

XhmikosR's avatar
Dist    
XhmikosR committed
2549
    _proto._getMenuElement = function _getMenuElement() {
XhmikosR's avatar
XhmikosR committed
2550
      var parent = Dropdown.getParentFromElement(this._element);
2551
      return SelectorEngine.findOne(Selector$4.MENU, parent);
XhmikosR's avatar
Dist    
XhmikosR committed
2552
    };
Mark Otto's avatar
dist    
Mark Otto committed
2553

XhmikosR's avatar
Dist    
XhmikosR committed
2554
    _proto._getPlacement = function _getPlacement() {
XhmikosR's avatar
XhmikosR committed
2555
      var parentDropdown = this._element.parentNode;
XhmikosR's avatar
Dist    
XhmikosR committed
2556
      var placement = AttachmentMap.BOTTOM; // Handle dropup
Mark Otto's avatar
dist    
Mark Otto committed
2557

XhmikosR's avatar
XhmikosR committed
2558
      if (parentDropdown.classList.contains(ClassName$4.DROPUP)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2559
        placement = AttachmentMap.TOP;
Mark Otto's avatar
build    
Mark Otto committed
2560

XhmikosR's avatar
XhmikosR committed
2561
        if (this._menu.classList.contains(ClassName$4.MENURIGHT)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2562
2563
          placement = AttachmentMap.TOPEND;
        }
XhmikosR's avatar
XhmikosR committed
2564
      } else if (parentDropdown.classList.contains(ClassName$4.DROPRIGHT)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2565
        placement = AttachmentMap.RIGHT;
XhmikosR's avatar
XhmikosR committed
2566
      } else if (parentDropdown.classList.contains(ClassName$4.DROPLEFT)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2567
        placement = AttachmentMap.LEFT;
XhmikosR's avatar
XhmikosR committed
2568
      } else if (this._menu.classList.contains(ClassName$4.MENURIGHT)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2569
2570
        placement = AttachmentMap.BOTTOMEND;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2571

XhmikosR's avatar
Dist    
XhmikosR committed
2572
2573
      return placement;
    };
Mark Otto's avatar
dist    
Mark Otto committed
2574

XhmikosR's avatar
Dist    
XhmikosR committed
2575
    _proto._detectNavbar = function _detectNavbar() {
XhmikosR's avatar
XhmikosR committed
2576
      return Boolean(SelectorEngine.closest(this._element, '.navbar'));
XhmikosR's avatar
Dist    
XhmikosR committed
2577
    };
Jacob Thornton's avatar
Jacob Thornton committed
2578

Mark Otto's avatar
Mark Otto committed
2579
    _proto._getOffset = function _getOffset() {
XhmikosR's avatar
Dist    
XhmikosR committed
2580
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
2581

Mark Otto's avatar
Mark Otto committed
2582
      var offset = {};
Jacob Thornton's avatar
Jacob Thornton committed
2583

XhmikosR's avatar
Dist    
XhmikosR committed
2584
      if (typeof this._config.offset === 'function') {
Mark Otto's avatar
Mark Otto committed
2585
        offset.fn = function (data) {
2586
          data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
XhmikosR's avatar
Dist    
XhmikosR committed
2587
2588
2589
          return data;
        };
      } else {
Mark Otto's avatar
Mark Otto committed
2590
        offset.offset = this._config.offset;
XhmikosR's avatar
Dist    
XhmikosR committed
2591
      }
Mark Otto's avatar
dist    
Mark Otto committed
2592

Mark Otto's avatar
Mark Otto committed
2593
2594
2595
2596
      return offset;
    };

    _proto._getPopperConfig = function _getPopperConfig() {
XhmikosR's avatar
Dist    
XhmikosR committed
2597
2598
2599
      var popperConfig = {
        placement: this._getPlacement(),
        modifiers: {
Mark Otto's avatar
Mark Otto committed
2600
          offset: this._getOffset(),
XhmikosR's avatar
Dist    
XhmikosR committed
2601
2602
2603
2604
2605
          flip: {
            enabled: this._config.flip
          },
          preventOverflow: {
            boundariesElement: this._config.boundary
Mark Otto's avatar
grunt    
Mark Otto committed
2606
          }
XhmikosR's avatar
Dist    
XhmikosR committed
2607
        } // Disable Popper.js if we have a static display
Mark Otto's avatar
dist    
Mark Otto committed
2608

XhmikosR's avatar
Dist    
XhmikosR committed
2609
      };
Jacob Thornton's avatar
Jacob Thornton committed
2610

XhmikosR's avatar
Dist    
XhmikosR committed
2611
2612
2613
2614
2615
      if (this._config.display === 'static') {
        popperConfig.modifiers.applyStyle = {
          enabled: false
        };
      }
Jacob Thornton's avatar
Jacob Thornton committed
2616

XhmikosR's avatar
XhmikosR committed
2617
      return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
Mark Otto's avatar
Mark Otto committed
2618
2619
    } // Static
    ;
Mark Otto's avatar
dist    
Mark Otto committed
2620

XhmikosR's avatar
XhmikosR committed
2621
    Dropdown.dropdownInterface = function dropdownInterface(element, config) {
XhmikosR's avatar
XhmikosR committed
2622
      var data = Data.getData(element, DATA_KEY$4);
Mark Otto's avatar
dist    
Mark Otto committed
2623

XhmikosR's avatar
XhmikosR committed
2624
      var _config = typeof config === 'object' ? config : null;
Jacob Thornton's avatar
Jacob Thornton committed
2625

XhmikosR's avatar
XhmikosR committed
2626
2627
2628
2629
2630
2631
      if (!data) {
        data = new Dropdown(element, _config);
      }

      if (typeof config === 'string') {
        if (typeof data[config] === 'undefined') {
XhmikosR's avatar
Dist.    
XhmikosR committed
2632
          throw new TypeError("No method named \"" + config + "\"");
XhmikosR's avatar
Dist    
XhmikosR committed
2633
        }
Johann-S's avatar
build    
Johann-S committed
2634

XhmikosR's avatar
XhmikosR committed
2635
2636
2637
        data[config]();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
2638

XhmikosR's avatar
XhmikosR committed
2639
    Dropdown.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
XhmikosR committed
2640
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
2641
        Dropdown.dropdownInterface(this, config);
XhmikosR's avatar
Dist    
XhmikosR committed
2642
2643
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
2644

XhmikosR's avatar
XhmikosR committed
2645
    Dropdown.clearMenus = function clearMenus(event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2646
2647
2648
      if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2649

XhmikosR's avatar
XhmikosR committed
2650
      var toggles = makeArray(SelectorEngine.find(Selector$4.DATA_TOGGLE));
Mark Otto's avatar
dist    
Mark Otto committed
2651

XhmikosR's avatar
Dist    
XhmikosR committed
2652
      for (var i = 0, len = toggles.length; i < len; i++) {
XhmikosR's avatar
XhmikosR committed
2653
        var parent = Dropdown.getParentFromElement(toggles[i]);
XhmikosR's avatar
XhmikosR committed
2654
        var context = Data.getData(toggles[i], DATA_KEY$4);
XhmikosR's avatar
Dist    
XhmikosR committed
2655
2656
2657
        var relatedTarget = {
          relatedTarget: toggles[i]
        };
Mark Otto's avatar
dist    
Mark Otto committed
2658

XhmikosR's avatar
Dist    
XhmikosR committed
2659
2660
        if (event && event.type === 'click') {
          relatedTarget.clickEvent = event;
Mark Otto's avatar
grunt    
Mark Otto committed
2661
2662
        }

XhmikosR's avatar
Dist    
XhmikosR committed
2663
2664
        if (!context) {
          continue;
Mark Otto's avatar
dist    
Mark Otto committed
2665
        }
Jacob Thornton's avatar
Jacob Thornton committed
2666

XhmikosR's avatar
Dist    
XhmikosR committed
2667
        var dropdownMenu = context._menu;
Jacob Thornton's avatar
Jacob Thornton committed
2668

XhmikosR's avatar
XhmikosR committed
2669
        if (!parent.classList.contains(ClassName$4.SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2670
2671
          continue;
        }
Mark Otto's avatar
dist    
Mark Otto committed
2672

XhmikosR's avatar
XhmikosR committed
2673
        if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && parent.contains(event.target)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2674
          continue;
Mark Otto's avatar
dist    
Mark Otto committed
2675
        }
Jacob Thornton's avatar
Jacob Thornton committed
2676

XhmikosR's avatar
XhmikosR committed
2677
        var hideEvent = EventHandler.trigger(parent, Event$5.HIDE, relatedTarget);
Jacob Thornton's avatar
Jacob Thornton committed
2678

XhmikosR's avatar
XhmikosR committed
2679
        if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2680
2681
2682
2683
2684
2685
          continue;
        } // If this is a touch-enabled device we remove the extra
        // empty mouseover listeners we added for iOS support


        if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
2686
2687
2688
          makeArray(document.body.children).forEach(function (elem) {
            return EventHandler.off(elem, 'mouseover', null, noop());
          });
Mark Otto's avatar
dist    
Mark Otto committed
2689
        }
Jacob Thornton's avatar
Jacob Thornton committed
2690

XhmikosR's avatar
Dist    
XhmikosR committed
2691
        toggles[i].setAttribute('aria-expanded', 'false');
XhmikosR's avatar
XhmikosR committed
2692
2693
2694
2695
2696

        if (context._popper) {
          context._popper.destroy();
        }

XhmikosR's avatar
XhmikosR committed
2697
2698
2699
        dropdownMenu.classList.remove(ClassName$4.SHOW);
        parent.classList.remove(ClassName$4.SHOW);
        EventHandler.trigger(parent, Event$5.HIDDEN, relatedTarget);
XhmikosR's avatar
Dist    
XhmikosR committed
2700
2701
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2702

XhmikosR's avatar
XhmikosR committed
2703
2704
    Dropdown.getParentFromElement = function getParentFromElement(element) {
      return getElementFromSelector(element) || element.parentNode;
XhmikosR's avatar
XhmikosR committed
2705
    };
Jacob Thornton's avatar
Jacob Thornton committed
2706

XhmikosR's avatar
XhmikosR committed
2707
    Dropdown.dataApiKeydownHandler = function dataApiKeydownHandler(event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2708
2709
2710
2711
2712
2713
2714
      // If not input/textarea:
      //  - And not a key in REGEXP_KEYDOWN => not a dropdown command
      // If input/textarea:
      //  - If space key => not a dropdown command
      //  - If key is other than escape
      //    - If key is not up or down => not a dropdown command
      //    - If trigger inside the menu => not a dropdown command
XhmikosR's avatar
XhmikosR committed
2715
      if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || SelectorEngine.closest(event.target, Selector$4.MENU)) : !REGEXP_KEYDOWN.test(event.which)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2716
2717
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2718

XhmikosR's avatar
Dist    
XhmikosR committed
2719
2720
      event.preventDefault();
      event.stopPropagation();
Jacob Thornton's avatar
Jacob Thornton committed
2721

XhmikosR's avatar
XhmikosR committed
2722
      if (this.disabled || this.classList.contains(ClassName$4.DISABLED)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2723
2724
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2725

XhmikosR's avatar
XhmikosR committed
2726
      var parent = Dropdown.getParentFromElement(this);
XhmikosR's avatar
XhmikosR committed
2727
      var isActive = parent.classList.contains(ClassName$4.SHOW);
Jacob Thornton's avatar
Jacob Thornton committed
2728

Mark Otto's avatar
dist    
Mark Otto committed
2729
      if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2730
        if (event.which === ESCAPE_KEYCODE) {
Mark Otto's avatar
dist v5    
Mark Otto committed
2731
          SelectorEngine.findOne(Selector$4.DATA_TOGGLE, parent).focus();
Mark Otto's avatar
dist    
Mark Otto committed
2732
        }
Mark Otto's avatar
grunt    
Mark Otto committed
2733

XhmikosR's avatar
XhmikosR committed
2734
        Dropdown.clearMenus();
XhmikosR's avatar
Dist    
XhmikosR committed
2735
2736
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2737

XhmikosR's avatar
XhmikosR committed
2738
      var items = makeArray(SelectorEngine.find(Selector$4.VISIBLE_ITEMS, parent));
Jacob Thornton's avatar
Jacob Thornton committed
2739

XhmikosR's avatar
XhmikosR committed
2740
      if (!items.length) {
XhmikosR's avatar
Dist    
XhmikosR committed
2741
2742
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
2743

XhmikosR's avatar
Dist    
XhmikosR committed
2744
      var index = items.indexOf(event.target);
Mark Otto's avatar
dist    
Mark Otto committed
2745

XhmikosR's avatar
Dist    
XhmikosR committed
2746
2747
2748
2749
      if (event.which === ARROW_UP_KEYCODE && index > 0) {
        // Up
        index--;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2750

XhmikosR's avatar
Dist    
XhmikosR committed
2751
2752
2753
2754
      if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
        // Down
        index++;
      }
Mark Otto's avatar
dist    
Mark Otto committed
2755

XhmikosR's avatar
Dist    
XhmikosR committed
2756
2757
2758
      if (index < 0) {
        index = 0;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2759

XhmikosR's avatar
Dist    
XhmikosR committed
2760
      items[index].focus();
Mark Otto's avatar
dist    
Mark Otto committed
2761
    };
Jacob Thornton's avatar
Jacob Thornton committed
2762

XhmikosR's avatar
XhmikosR committed
2763
    Dropdown.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
2764
2765
2766
      return Data.getData(element, DATA_KEY$4);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
    _createClass(Dropdown, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$4;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$2;
      }
    }, {
      key: "DefaultType",
      get: function get() {
        return DefaultType$2;
      }
    }]);

Mark Otto's avatar
dist    
Mark Otto committed
2784
    return Dropdown;
XhmikosR's avatar
Dist    
XhmikosR committed
2785
2786
2787
2788
2789
2790
2791
2792
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


XhmikosR's avatar
XhmikosR committed
2793
2794
2795
2796
  EventHandler.on(document, Event$5.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown.dataApiKeydownHandler);
  EventHandler.on(document, Event$5.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown.dataApiKeydownHandler);
  EventHandler.on(document, Event$5.CLICK_DATA_API, Dropdown.clearMenus);
  EventHandler.on(document, Event$5.KEYUP_DATA_API, Dropdown.clearMenus);
XhmikosR's avatar
XhmikosR committed
2797
  EventHandler.on(document, Event$5.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2798
2799
    event.preventDefault();
    event.stopPropagation();
XhmikosR's avatar
XhmikosR committed
2800
    Dropdown.dropdownInterface(this, 'toggle');
XhmikosR's avatar
XhmikosR committed
2801
2802
2803
  });
  EventHandler.on(document, Event$5.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
    return e.stopPropagation();
XhmikosR's avatar
Dist    
XhmikosR committed
2804
  });
XhmikosR's avatar
XhmikosR committed
2805
  var $$5 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
2806
2807
2808
2809
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
2810
   * add .dropdown to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
2811
2812
   */

2813
2814
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
2815
2816
2817
2818
  if ($$5) {
    var JQUERY_NO_CONFLICT$4 = $$5.fn[NAME$4];
    $$5.fn[NAME$4] = Dropdown.jQueryInterface;
    $$5.fn[NAME$4].Constructor = Dropdown;
XhmikosR's avatar
Dist    
XhmikosR committed
2819

XhmikosR's avatar
XhmikosR committed
2820
2821
2822
    $$5.fn[NAME$4].noConflict = function () {
      $$5.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
      return Dropdown.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
2823
2824
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
2825

XhmikosR's avatar
Dist    
XhmikosR committed
2826
2827
2828
2829
2830
2831
2832
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$5 = 'modal';
XhmikosR's avatar
XhmikosR committed
2833
  var VERSION$5 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
  var DATA_KEY$5 = 'bs.modal';
  var EVENT_KEY$5 = "." + DATA_KEY$5;
  var DATA_API_KEY$5 = '.data-api';
  var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key

  var Default$3 = {
    backdrop: true,
    keyboard: true,
    focus: true,
    show: true
  };
  var DefaultType$3 = {
    backdrop: '(boolean|string)',
    keyboard: 'boolean',
    focus: 'boolean',
    show: 'boolean'
  };
XhmikosR's avatar
XhmikosR committed
2851
  var Event$6 = {
XhmikosR's avatar
Dist    
XhmikosR committed
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
    HIDE: "hide" + EVENT_KEY$5,
    HIDDEN: "hidden" + EVENT_KEY$5,
    SHOW: "show" + EVENT_KEY$5,
    SHOWN: "shown" + EVENT_KEY$5,
    FOCUSIN: "focusin" + EVENT_KEY$5,
    RESIZE: "resize" + EVENT_KEY$5,
    CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
    KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
    MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
    MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
    CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  };
  var ClassName$5 = {
Mark Otto's avatar
Mark Otto committed
2865
    SCROLLABLE: 'modal-dialog-scrollable',
XhmikosR's avatar
Dist    
XhmikosR committed
2866
2867
2868
2869
2870
2871
2872
2873
    SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
    BACKDROP: 'modal-backdrop',
    OPEN: 'modal-open',
    FADE: 'fade',
    SHOW: 'show'
  };
  var Selector$5 = {
    DIALOG: '.modal-dialog',
Mark Otto's avatar
Mark Otto committed
2874
    MODAL_BODY: '.modal-body',
XhmikosR's avatar
Dist    
XhmikosR committed
2875
2876
2877
2878
    DATA_TOGGLE: '[data-toggle="modal"]',
    DATA_DISMISS: '[data-dismiss="modal"]',
    FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
    STICKY_CONTENT: '.sticky-top'
Mark Otto's avatar
dist    
Mark Otto committed
2879
2880
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
2881
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
2882
2883
     * ------------------------------------------------------------------------
     */
Jacob Thornton's avatar
Jacob Thornton committed
2884

XhmikosR's avatar
Dist    
XhmikosR committed
2885
2886
2887
2888
2889
2890
2891
2892
  };

  var Modal =
  /*#__PURE__*/
  function () {
    function Modal(element, config) {
      this._config = this._getConfig(config);
      this._element = element;
XhmikosR's avatar
XhmikosR committed
2893
      this._dialog = SelectorEngine.findOne(Selector$5.DIALOG, element);
XhmikosR's avatar
Dist    
XhmikosR committed
2894
2895
2896
2897
2898
2899
      this._backdrop = null;
      this._isShown = false;
      this._isBodyOverflowing = false;
      this._ignoreBackdropClick = false;
      this._isTransitioning = false;
      this._scrollbarWidth = 0;
XhmikosR's avatar
XhmikosR committed
2900
      Data.setData(element, DATA_KEY$5, this);
XhmikosR's avatar
Dist    
XhmikosR committed
2901
2902
2903
2904
2905
2906
2907
2908
    } // Getters


    var _proto = Modal.prototype;

    // Public
    _proto.toggle = function toggle(relatedTarget) {
      return this._isShown ? this.hide() : this.show(relatedTarget);
Mark Otto's avatar
dist    
Mark Otto committed
2909
    };
Jacob Thornton's avatar
Jacob Thornton committed
2910

XhmikosR's avatar
Dist    
XhmikosR committed
2911
2912
    _proto.show = function show(relatedTarget) {
      var _this = this;
Mark Otto's avatar
grunt    
Mark Otto committed
2913

XhmikosR's avatar
Dist    
XhmikosR committed
2914
2915
2916
      if (this._isShown || this._isTransitioning) {
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2917

XhmikosR's avatar
XhmikosR committed
2918
      if (this._element.classList.contains(ClassName$5.FADE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2919
2920
        this._isTransitioning = true;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2921

XhmikosR's avatar
XhmikosR committed
2922
      var showEvent = EventHandler.trigger(this._element, Event$6.SHOW, {
XhmikosR's avatar
Dist    
XhmikosR committed
2923
2924
        relatedTarget: relatedTarget
      });
Jacob Thornton's avatar
Jacob Thornton committed
2925

XhmikosR's avatar
XhmikosR committed
2926
      if (this._isShown || showEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2927
2928
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2929

XhmikosR's avatar
Dist    
XhmikosR committed
2930
      this._isShown = true;
Mark Otto's avatar
dist    
Mark Otto committed
2931

XhmikosR's avatar
Dist    
XhmikosR committed
2932
      this._checkScrollbar();
Jacob Thornton's avatar
Jacob Thornton committed
2933

XhmikosR's avatar
Dist    
XhmikosR committed
2934
      this._setScrollbar();
Mark Otto's avatar
dist    
Mark Otto committed
2935

XhmikosR's avatar
Dist    
XhmikosR committed
2936
      this._adjustDialog();
Jacob Thornton's avatar
Jacob Thornton committed
2937

XhmikosR's avatar
Dist    
XhmikosR committed
2938
      this._setEscapeEvent();
Jacob Thornton's avatar
Jacob Thornton committed
2939

XhmikosR's avatar
Dist    
XhmikosR committed
2940
      this._setResizeEvent();
Mark Otto's avatar
grunt    
Mark Otto committed
2941

XhmikosR's avatar
XhmikosR committed
2942
      EventHandler.on(this._element, Event$6.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2943
2944
        return _this.hide(event);
      });
XhmikosR's avatar
XhmikosR committed
2945
2946
2947
      EventHandler.on(this._dialog, Event$6.MOUSEDOWN_DISMISS, function () {
        EventHandler.one(_this._element, Event$6.MOUSEUP_DISMISS, function (event) {
          if (event.target === _this._element) {
XhmikosR's avatar
Dist    
XhmikosR committed
2948
2949
            _this._ignoreBackdropClick = true;
          }
Mark Otto's avatar
dist    
Mark Otto committed
2950
        });
XhmikosR's avatar
Dist    
XhmikosR committed
2951
      });
Jacob Thornton's avatar
Jacob Thornton committed
2952

XhmikosR's avatar
Dist    
XhmikosR committed
2953
2954
2955
2956
      this._showBackdrop(function () {
        return _this._showElement(relatedTarget);
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
2957

XhmikosR's avatar
Dist    
XhmikosR committed
2958
2959
    _proto.hide = function hide(event) {
      var _this2 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2960

XhmikosR's avatar
Dist    
XhmikosR committed
2961
2962
2963
      if (event) {
        event.preventDefault();
      }
Jacob Thornton's avatar
Jacob Thornton committed
2964

XhmikosR's avatar
Dist    
XhmikosR committed
2965
2966
2967
      if (!this._isShown || this._isTransitioning) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2968

XhmikosR's avatar
XhmikosR committed
2969
      var hideEvent = EventHandler.trigger(this._element, Event$6.HIDE);
Jacob Thornton's avatar
Jacob Thornton committed
2970

2971
      if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2972
2973
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
2974

XhmikosR's avatar
Dist    
XhmikosR committed
2975
      this._isShown = false;
XhmikosR's avatar
XhmikosR committed
2976
2977

      var transition = this._element.classList.contains(ClassName$5.FADE);
Jacob Thornton's avatar
Jacob Thornton committed
2978

XhmikosR's avatar
Dist    
XhmikosR committed
2979
2980
2981
      if (transition) {
        this._isTransitioning = true;
      }
Mark Otto's avatar
dist    
Mark Otto committed
2982

XhmikosR's avatar
Dist    
XhmikosR committed
2983
      this._setEscapeEvent();
Jacob Thornton's avatar
Jacob Thornton committed
2984

XhmikosR's avatar
Dist    
XhmikosR committed
2985
      this._setResizeEvent();
Jacob Thornton's avatar
Jacob Thornton committed
2986

XhmikosR's avatar
XhmikosR committed
2987
2988
2989
2990
2991
2992
      EventHandler.off(document, Event$6.FOCUSIN);

      this._element.classList.remove(ClassName$5.SHOW);

      EventHandler.off(this._element, Event$6.CLICK_DISMISS);
      EventHandler.off(this._dialog, Event$6.MOUSEDOWN_DISMISS);
Jacob Thornton's avatar
Jacob Thornton committed
2993

XhmikosR's avatar
Dist    
XhmikosR committed
2994
      if (transition) {
XhmikosR's avatar
XhmikosR committed
2995
2996
        var transitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2997
          return _this2._hideModal(event);
XhmikosR's avatar
XhmikosR committed
2998
2999
        });
        emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
3000
3001
3002
3003
      } else {
        this._hideModal();
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
3004

XhmikosR's avatar
Dist    
XhmikosR committed
3005
3006
    _proto.dispose = function dispose() {
      [window, this._element, this._dialog].forEach(function (htmlElement) {
XhmikosR's avatar
XhmikosR committed
3007
        return EventHandler.off(htmlElement, EVENT_KEY$5);
XhmikosR's avatar
Dist    
XhmikosR committed
3008
3009
3010
3011
3012
3013
      });
      /**
       * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
       * Do not move `document` in `htmlElements` array
       * It will remove `Event.CLICK_DATA_API` event that should remain
       */
Mark Otto's avatar
grunt    
Mark Otto committed
3014

XhmikosR's avatar
XhmikosR committed
3015
3016
      EventHandler.off(document, Event$6.FOCUSIN);
      Data.removeData(this._element, DATA_KEY$5);
XhmikosR's avatar
Dist    
XhmikosR committed
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
      this._config = null;
      this._element = null;
      this._dialog = null;
      this._backdrop = null;
      this._isShown = null;
      this._isBodyOverflowing = null;
      this._ignoreBackdropClick = null;
      this._isTransitioning = null;
      this._scrollbarWidth = null;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3027

XhmikosR's avatar
Dist    
XhmikosR committed
3028
3029
    _proto.handleUpdate = function handleUpdate() {
      this._adjustDialog();
Mark Otto's avatar
Mark Otto committed
3030
3031
    } // Private
    ;
Jacob Thornton's avatar
Jacob Thornton committed
3032

XhmikosR's avatar
Dist    
XhmikosR committed
3033
    _proto._getConfig = function _getConfig(config) {
3034
      config = _objectSpread2({}, Default$3, {}, config);
XhmikosR's avatar
XhmikosR committed
3035
      typeCheckConfig(NAME$5, config, DefaultType$3);
XhmikosR's avatar
Dist    
XhmikosR committed
3036
3037
      return config;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3038

XhmikosR's avatar
Dist    
XhmikosR committed
3039
3040
    _proto._showElement = function _showElement(relatedTarget) {
      var _this3 = this;
Jacob Thornton's avatar
Jacob Thornton committed
3041

XhmikosR's avatar
XhmikosR committed
3042
      var transition = this._element.classList.contains(ClassName$5.FADE);
Mark Otto's avatar
dist    
Mark Otto committed
3043

XhmikosR's avatar
XhmikosR committed
3044
3045
      var modalBody = SelectorEngine.findOne(Selector$5.MODAL_BODY, this._dialog);

XhmikosR's avatar
Dist    
XhmikosR committed
3046
3047
3048
3049
      if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
        // Don't move modal's DOM position
        document.body.appendChild(this._element);
      }
Mark Otto's avatar
dist    
Mark Otto committed
3050

XhmikosR's avatar
Dist    
XhmikosR committed
3051
      this._element.style.display = 'block';
Jacob Thornton's avatar
Jacob Thornton committed
3052

XhmikosR's avatar
Dist    
XhmikosR committed
3053
      this._element.removeAttribute('aria-hidden');
Mark Otto's avatar
grunt    
Mark Otto committed
3054

Mark Otto's avatar
dist    
Mark Otto committed
3055
3056
      this._element.setAttribute('aria-modal', true);

XhmikosR's avatar
XhmikosR committed
3057
3058
      if (this._dialog.classList.contains(ClassName$5.SCROLLABLE) && modalBody) {
        modalBody.scrollTop = 0;
Mark Otto's avatar
Mark Otto committed
3059
3060
3061
      } else {
        this._element.scrollTop = 0;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
3062

XhmikosR's avatar
Dist    
XhmikosR committed
3063
      if (transition) {
XhmikosR's avatar
XhmikosR committed
3064
        reflow(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
3065
      }
Mark Otto's avatar
grunt    
Mark Otto committed
3066

XhmikosR's avatar
XhmikosR committed
3067
      this._element.classList.add(ClassName$5.SHOW);
Mark Otto's avatar
dist    
Mark Otto committed
3068

XhmikosR's avatar
Dist    
XhmikosR committed
3069
3070
3071
      if (this._config.focus) {
        this._enforceFocus();
      }
Mark Otto's avatar
dist    
Mark Otto committed
3072

XhmikosR's avatar
Dist    
XhmikosR committed
3073
3074
3075
      var transitionComplete = function transitionComplete() {
        if (_this3._config.focus) {
          _this3._element.focus();
Jacob Thornton's avatar
Jacob Thornton committed
3076
        }
Mark Otto's avatar
dist    
Mark Otto committed
3077

XhmikosR's avatar
Dist    
XhmikosR committed
3078
        _this3._isTransitioning = false;
XhmikosR's avatar
XhmikosR committed
3079
3080
3081
        EventHandler.trigger(_this3._element, Event$6.SHOWN, {
          relatedTarget: relatedTarget
        });
Mark Otto's avatar
grunt    
Mark Otto committed
3082
3083
      };

XhmikosR's avatar
Dist    
XhmikosR committed
3084
      if (transition) {
XhmikosR's avatar
XhmikosR committed
3085
3086
3087
        var transitionDuration = getTransitionDurationFromElement(this._dialog);
        EventHandler.one(this._dialog, TRANSITION_END, transitionComplete);
        emulateTransitionEnd(this._dialog, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
3088
3089
3090
3091
      } else {
        transitionComplete();
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
3092

XhmikosR's avatar
Dist    
XhmikosR committed
3093
3094
    _proto._enforceFocus = function _enforceFocus() {
      var _this4 = this;
Mark Otto's avatar
grunt    
Mark Otto committed
3095

XhmikosR's avatar
XhmikosR committed
3096
3097
3098
3099
      EventHandler.off(document, Event$6.FOCUSIN); // guard against infinite focus loop

      EventHandler.on(document, Event$6.FOCUSIN, function (event) {
        if (document !== event.target && _this4._element !== event.target && !_this4._element.contains(event.target)) {
XhmikosR's avatar
Dist    
XhmikosR committed
3100
          _this4._element.focus();
Mark Otto's avatar
dist    
Mark Otto committed
3101
        }
XhmikosR's avatar
Dist    
XhmikosR committed
3102
3103
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
3104

XhmikosR's avatar
Dist    
XhmikosR committed
3105
3106
    _proto._setEscapeEvent = function _setEscapeEvent() {
      var _this5 = this;
Mark Otto's avatar
grunt    
Mark Otto committed
3107

XhmikosR's avatar
Dist    
XhmikosR committed
3108
      if (this._isShown && this._config.keyboard) {
XhmikosR's avatar
XhmikosR committed
3109
        EventHandler.on(this._element, Event$6.KEYDOWN_DISMISS, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
3110
3111
          if (event.which === ESCAPE_KEYCODE$1) {
            event.preventDefault();
Mark Otto's avatar
grunt    
Mark Otto committed
3112

XhmikosR's avatar
Dist    
XhmikosR committed
3113
3114
3115
            _this5.hide();
          }
        });
3116
      } else {
XhmikosR's avatar
XhmikosR committed
3117
        EventHandler.off(this._element, Event$6.KEYDOWN_DISMISS);
XhmikosR's avatar
Dist    
XhmikosR committed
3118
3119
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
3120

XhmikosR's avatar
Dist    
XhmikosR committed
3121
3122
    _proto._setResizeEvent = function _setResizeEvent() {
      var _this6 = this;
Jacob Thornton's avatar
Jacob Thornton committed
3123

XhmikosR's avatar
Dist    
XhmikosR committed
3124
      if (this._isShown) {
3125
3126
        EventHandler.on(window, Event$6.RESIZE, function () {
          return _this6._adjustDialog();
XhmikosR's avatar
Dist    
XhmikosR committed
3127
3128
        });
      } else {
XhmikosR's avatar
XhmikosR committed
3129
        EventHandler.off(window, Event$6.RESIZE);
XhmikosR's avatar
Dist    
XhmikosR committed
3130
3131
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
3132

XhmikosR's avatar
Dist    
XhmikosR committed
3133
3134
    _proto._hideModal = function _hideModal() {
      var _this7 = this;
Mark Otto's avatar
dist    
Mark Otto committed
3135

XhmikosR's avatar
Dist    
XhmikosR committed
3136
      this._element.style.display = 'none';
Mark Otto's avatar
dist    
Mark Otto committed
3137

XhmikosR's avatar
Dist    
XhmikosR committed
3138
      this._element.setAttribute('aria-hidden', true);
Mark Otto's avatar
dist    
Mark Otto committed
3139

Mark Otto's avatar
dist    
Mark Otto committed
3140
3141
      this._element.removeAttribute('aria-modal');

XhmikosR's avatar
Dist    
XhmikosR committed
3142
      this._isTransitioning = false;
Mark Otto's avatar
dist    
Mark Otto committed
3143

XhmikosR's avatar
Dist    
XhmikosR committed
3144
      this._showBackdrop(function () {
XhmikosR's avatar
XhmikosR committed
3145
        document.body.classList.remove(ClassName$5.OPEN);
Mark Otto's avatar
dist    
Mark Otto committed
3146

XhmikosR's avatar
Dist    
XhmikosR committed
3147
        _this7._resetAdjustments();
Mark Otto's avatar
dist    
Mark Otto committed
3148

XhmikosR's avatar
Dist    
XhmikosR committed
3149
        _this7._resetScrollbar();
Jacob Thornton's avatar
Jacob Thornton committed
3150

XhmikosR's avatar
XhmikosR committed
3151
        EventHandler.trigger(_this7._element, Event$6.HIDDEN);
XhmikosR's avatar
Dist    
XhmikosR committed
3152
3153
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
3154

XhmikosR's avatar
Dist    
XhmikosR committed
3155
    _proto._removeBackdrop = function _removeBackdrop() {
3156
      this._backdrop.parentNode.removeChild(this._backdrop);
XhmikosR's avatar
XhmikosR committed
3157

3158
      this._backdrop = null;
XhmikosR's avatar
Dist    
XhmikosR committed
3159
    };
Jacob Thornton's avatar
Jacob Thornton committed
3160

XhmikosR's avatar
Dist    
XhmikosR committed
3161
3162
    _proto._showBackdrop = function _showBackdrop(callback) {
      var _this8 = this;
Jacob Thornton's avatar
Jacob Thornton committed
3163

XhmikosR's avatar
XhmikosR committed
3164
      var animate = this._element.classList.contains(ClassName$5.FADE) ? ClassName$5.FADE : '';
Jacob Thornton's avatar
Jacob Thornton committed
3165

XhmikosR's avatar
Dist    
XhmikosR committed
3166
3167
3168
      if (this._isShown && this._config.backdrop) {
        this._backdrop = document.createElement('div');
        this._backdrop.className = ClassName$5.BACKDROP;
Mark Otto's avatar
grunt    
Mark Otto committed
3169

XhmikosR's avatar
Dist    
XhmikosR committed
3170
3171
3172
        if (animate) {
          this._backdrop.classList.add(animate);
        }
Jacob Thornton's avatar
Jacob Thornton committed
3173

XhmikosR's avatar
XhmikosR committed
3174
3175
        document.body.appendChild(this._backdrop);
        EventHandler.on(this._element, Event$6.CLICK_DISMISS, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
3176
3177
          if (_this8._ignoreBackdropClick) {
            _this8._ignoreBackdropClick = false;
Jacob Thornton's avatar
Jacob Thornton committed
3178
3179
            return;
          }
Mark Otto's avatar
dist    
Mark Otto committed
3180

XhmikosR's avatar
Dist    
XhmikosR committed
3181
          if (event.target !== event.currentTarget) {
Jacob Thornton's avatar
Jacob Thornton committed
3182
3183
            return;
          }
Mark Otto's avatar
dist    
Mark Otto committed
3184

XhmikosR's avatar
Dist    
XhmikosR committed
3185
3186
3187
3188
3189
3190
          if (_this8._config.backdrop === 'static') {
            _this8._element.focus();
          } else {
            _this8.hide();
          }
        });
Jacob Thornton's avatar
Jacob Thornton committed
3191

XhmikosR's avatar
Dist    
XhmikosR committed
3192
        if (animate) {
XhmikosR's avatar
XhmikosR committed
3193
          reflow(this._backdrop);
XhmikosR's avatar
Dist    
XhmikosR committed
3194
        }
Jacob Thornton's avatar
Jacob Thornton committed
3195

XhmikosR's avatar
XhmikosR committed
3196
        this._backdrop.classList.add(ClassName$5.SHOW);
Jacob Thornton's avatar
Jacob Thornton committed
3197

XhmikosR's avatar
Dist    
XhmikosR committed
3198
        if (!animate) {
Jacob Thornton's avatar
Jacob Thornton committed
3199
          callback();
XhmikosR's avatar
Dist    
XhmikosR committed
3200
          return;
Jacob Thornton's avatar
Jacob Thornton committed
3201
3202
        }

XhmikosR's avatar
XhmikosR committed
3203
3204
3205
        var backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
        EventHandler.one(this._backdrop, TRANSITION_END, callback);
        emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
3206
      } else if (!this._isShown && this._backdrop) {
XhmikosR's avatar
XhmikosR committed
3207
        this._backdrop.classList.remove(ClassName$5.SHOW);
Jacob Thornton's avatar
Jacob Thornton committed
3208

XhmikosR's avatar
Dist    
XhmikosR committed
3209
3210
        var callbackRemove = function callbackRemove() {
          _this8._removeBackdrop();
Jacob Thornton's avatar
Jacob Thornton committed
3211

3212
          callback();
XhmikosR's avatar
Dist    
XhmikosR committed
3213
3214
        };

XhmikosR's avatar
XhmikosR committed
3215
3216
        if (this._element.classList.contains(ClassName$5.FADE)) {
          var _backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
Mark Otto's avatar
grunt    
Mark Otto committed
3217

XhmikosR's avatar
XhmikosR committed
3218
3219
          EventHandler.one(this._backdrop, TRANSITION_END, callbackRemove);
          emulateTransitionEnd(this._backdrop, _backdropTransitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
3220
3221
        } else {
          callbackRemove();
Mark Otto's avatar
dist    
Mark Otto committed
3222
        }
3223
      } else {
XhmikosR's avatar
Dist    
XhmikosR committed
3224
3225
        callback();
      }
Mark Otto's avatar
Mark Otto committed
3226
    } // ----------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
3227
3228
    // the following methods are used to handle overflowing modals
    // ----------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
3229
    ;
Mark Otto's avatar
grunt    
Mark Otto committed
3230

XhmikosR's avatar
Dist    
XhmikosR committed
3231
3232
    _proto._adjustDialog = function _adjustDialog() {
      var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
Mark Otto's avatar
grunt    
Mark Otto committed
3233

XhmikosR's avatar
Dist    
XhmikosR committed
3234
3235
3236
      if (!this._isBodyOverflowing && isModalOverflowing) {
        this._element.style.paddingLeft = this._scrollbarWidth + "px";
      }
Mark Otto's avatar
dist    
Mark Otto committed
3237

XhmikosR's avatar
Dist    
XhmikosR committed
3238
3239
3240
3241
      if (this._isBodyOverflowing && !isModalOverflowing) {
        this._element.style.paddingRight = this._scrollbarWidth + "px";
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
3242

XhmikosR's avatar
Dist    
XhmikosR committed
3243
3244
3245
3246
    _proto._resetAdjustments = function _resetAdjustments() {
      this._element.style.paddingLeft = '';
      this._element.style.paddingRight = '';
    };
Mark Otto's avatar
dist    
Mark Otto committed
3247

XhmikosR's avatar
Dist    
XhmikosR committed
3248
3249
3250
3251
3252
    _proto._checkScrollbar = function _checkScrollbar() {
      var rect = document.body.getBoundingClientRect();
      this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
      this._scrollbarWidth = this._getScrollbarWidth();
    };
Mark Otto's avatar
dist    
Mark Otto committed
3253

XhmikosR's avatar
Dist    
XhmikosR committed
3254
3255
3256
3257
3258
3259
    _proto._setScrollbar = function _setScrollbar() {
      var _this9 = this;

      if (this._isBodyOverflowing) {
        // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
        //   while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
XhmikosR's avatar
XhmikosR committed
3260
3261
        // Adjust fixed content padding
        makeArray(SelectorEngine.find(Selector$5.FIXED_CONTENT)).forEach(function (element) {
XhmikosR's avatar
Dist    
XhmikosR committed
3262
          var actualPadding = element.style.paddingRight;
XhmikosR's avatar
XhmikosR committed
3263
3264
3265
          var calculatedPadding = window.getComputedStyle(element)['padding-right'];
          Manipulator.setDataAttribute(element, 'padding-right', actualPadding);
          element.style.paddingRight = parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px";
XhmikosR's avatar
Dist    
XhmikosR committed
3266
3267
        }); // Adjust sticky content margin

XhmikosR's avatar
XhmikosR committed
3268
        makeArray(SelectorEngine.find(Selector$5.STICKY_CONTENT)).forEach(function (element) {
XhmikosR's avatar
Dist    
XhmikosR committed
3269
          var actualMargin = element.style.marginRight;
XhmikosR's avatar
XhmikosR committed
3270
3271
3272
          var calculatedMargin = window.getComputedStyle(element)['margin-right'];
          Manipulator.setDataAttribute(element, 'margin-right', actualMargin);
          element.style.marginRight = parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px";
XhmikosR's avatar
Dist    
XhmikosR committed
3273
3274
3275
        }); // Adjust body padding

        var actualPadding = document.body.style.paddingRight;
XhmikosR's avatar
XhmikosR committed
3276
3277
3278
        var calculatedPadding = window.getComputedStyle(document.body)['padding-right'];
        Manipulator.setDataAttribute(document.body, 'padding-right', actualPadding);
        document.body.style.paddingRight = parseFloat(calculatedPadding) + this._scrollbarWidth + "px";
XhmikosR's avatar
Dist    
XhmikosR committed
3279
      }
XhmikosR's avatar
Dist    
XhmikosR committed
3280

XhmikosR's avatar
XhmikosR committed
3281
      document.body.classList.add(ClassName$5.OPEN);
XhmikosR's avatar
Dist    
XhmikosR committed
3282
    };
Mark Otto's avatar
grunt    
Mark Otto committed
3283

XhmikosR's avatar
Dist    
XhmikosR committed
3284
3285
    _proto._resetScrollbar = function _resetScrollbar() {
      // Restore fixed content padding
XhmikosR's avatar
XhmikosR committed
3286
3287
3288
3289
3290
3291
3292
3293
      makeArray(SelectorEngine.find(Selector$5.FIXED_CONTENT)).forEach(function (element) {
        var padding = Manipulator.getDataAttribute(element, 'padding-right');

        if (typeof padding !== 'undefined') {
          Manipulator.removeDataAttribute(element, 'padding-right');
          element.style.paddingRight = padding;
        }
      }); // Restore sticky content and navbar-toggler margin
Jacob Thornton's avatar
Jacob Thornton committed
3294

XhmikosR's avatar
XhmikosR committed
3295
3296
      makeArray(SelectorEngine.find("" + Selector$5.STICKY_CONTENT)).forEach(function (element) {
        var margin = Manipulator.getDataAttribute(element, 'margin-right');
Mark Otto's avatar
dist    
Mark Otto committed
3297

XhmikosR's avatar
Dist    
XhmikosR committed
3298
        if (typeof margin !== 'undefined') {
XhmikosR's avatar
XhmikosR committed
3299
3300
          Manipulator.removeDataAttribute(element, 'margin-right');
          element.style.marginRight = margin;
XhmikosR's avatar
Dist    
XhmikosR committed
3301
3302
        }
      }); // Restore body padding
Jacob Thornton's avatar
Jacob Thornton committed
3303

XhmikosR's avatar
XhmikosR committed
3304
3305
      var padding = Manipulator.getDataAttribute(document.body, 'padding-right');

XhmikosR's avatar
Dist.    
XhmikosR committed
3306
3307
3308
      if (typeof padding === 'undefined') {
        document.body.style.paddingRight = '';
      } else {
XhmikosR's avatar
XhmikosR committed
3309
3310
3311
        Manipulator.removeDataAttribute(document.body, 'padding-right');
        document.body.style.paddingRight = padding;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
3312
    };
Mark Otto's avatar
grunt    
Mark Otto committed
3313

XhmikosR's avatar
Dist    
XhmikosR committed
3314
3315
3316
3317
3318
3319
3320
3321
    _proto._getScrollbarWidth = function _getScrollbarWidth() {
      // thx d.walsh
      var scrollDiv = document.createElement('div');
      scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
      document.body.appendChild(scrollDiv);
      var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
      document.body.removeChild(scrollDiv);
      return scrollbarWidth;
Mark Otto's avatar
Mark Otto committed
3322
3323
    } // Static
    ;
Mark Otto's avatar
dist    
Mark Otto committed
3324

XhmikosR's avatar
XhmikosR committed
3325
    Modal.jQueryInterface = function jQueryInterface(config, relatedTarget) {
XhmikosR's avatar
Dist    
XhmikosR committed
3326
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
3327
        var data = Data.getData(this, DATA_KEY$5);
Mark Otto's avatar
grunt    
Mark Otto committed
3328

3329
        var _config = _objectSpread2({}, Default$3, {}, Manipulator.getDataAttributes(this), {}, typeof config === 'object' && config ? config : {});
Jacob Thornton's avatar
Jacob Thornton committed
3330

XhmikosR's avatar
Dist    
XhmikosR committed
3331
3332
3333
3334
3335
3336
3337
        if (!data) {
          data = new Modal(this, _config);
        }

        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Jacob Thornton's avatar
Jacob Thornton committed
3338
          }
Mark Otto's avatar
dist    
Mark Otto committed
3339

XhmikosR's avatar
Dist    
XhmikosR committed
3340
3341
3342
          data[config](relatedTarget);
        } else if (_config.show) {
          data.show(relatedTarget);
Mark Otto's avatar
dist    
Mark Otto committed
3343
        }
XhmikosR's avatar
Dist    
XhmikosR committed
3344
3345
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
3346

XhmikosR's avatar
XhmikosR committed
3347
    Modal.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
3348
3349
3350
      return Data.getData(element, DATA_KEY$5);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
    _createClass(Modal, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$5;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$3;
      }
    }]);
Mark Otto's avatar
dist    
Mark Otto committed
3362

XhmikosR's avatar
Dist    
XhmikosR committed
3363
3364
3365
3366
3367
3368
3369
    return Modal;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
3370
3371


XhmikosR's avatar
XhmikosR committed
3372
  EventHandler.on(document, Event$6.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
3373
    var _this10 = this;
Jacob Thornton's avatar
Jacob Thornton committed
3374

XhmikosR's avatar
XhmikosR committed
3375
    var target = getElementFromSelector(this);
XhmikosR's avatar
Dist    
XhmikosR committed
3376
3377
3378
3379
3380

    if (this.tagName === 'A' || this.tagName === 'AREA') {
      event.preventDefault();
    }

XhmikosR's avatar
XhmikosR committed
3381
3382
3383
    EventHandler.one(target, Event$6.SHOW, function (showEvent) {
      if (showEvent.defaultPrevented) {
        // only register focus restorer if modal will actually get shown
XhmikosR's avatar
Dist    
XhmikosR committed
3384
        return;
Jacob Thornton's avatar
Jacob Thornton committed
3385
3386
      }

XhmikosR's avatar
XhmikosR committed
3387
3388
      EventHandler.one(target, Event$6.HIDDEN, function () {
        if (isVisible(_this10)) {
XhmikosR's avatar
Dist    
XhmikosR committed
3389
          _this10.focus();
Jacob Thornton's avatar
Jacob Thornton committed
3390
        }
Mark Otto's avatar
dist    
Mark Otto committed
3391
3392
      });
    });
XhmikosR's avatar
XhmikosR committed
3393
    var data = Data.getData(target, DATA_KEY$5);
Mark Otto's avatar
dist    
Mark Otto committed
3394

XhmikosR's avatar
XhmikosR committed
3395
    if (!data) {
3396
3397
      var config = _objectSpread2({}, Manipulator.getDataAttributes(target), {}, Manipulator.getDataAttributes(this));

XhmikosR's avatar
XhmikosR committed
3398
3399
3400
3401
      data = new Modal(target, config);
    }

    data.show(this);
XhmikosR's avatar
Dist    
XhmikosR committed
3402
  });
XhmikosR's avatar
XhmikosR committed
3403
  var $$6 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
3404
3405
3406
3407
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
3408
   * add .modal to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
3409
   */
Jacob Thornton's avatar
Jacob Thornton committed
3410

3411
3412
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
3413
3414
3415
3416
  if ($$6) {
    var JQUERY_NO_CONFLICT$5 = $$6.fn[NAME$5];
    $$6.fn[NAME$5] = Modal.jQueryInterface;
    $$6.fn[NAME$5].Constructor = Modal;
Jacob Thornton's avatar
Jacob Thornton committed
3417

XhmikosR's avatar
XhmikosR committed
3418
3419
3420
    $$6.fn[NAME$5].noConflict = function () {
      $$6.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
      return Modal.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
3421
3422
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
3423

XhmikosR's avatar
XhmikosR committed
3424
3425
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
3426
   * Bootstrap (v4.3.1): util/sanitizer.js
XhmikosR's avatar
XhmikosR committed
3427
3428
3429
3430
3431
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
XhmikosR's avatar
XhmikosR committed
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
  /**
   * A pattern that recognizes a commonly useful subset of URLs that are safe.
   *
   * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
   */

  var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  /**
   * A pattern that matches safe data URLs. Only matches image, video and audio types.
   *
   * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
   */

  var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;

  var allowedAttribute = function allowedAttribute(attr, allowedAttributeList) {
    var attrName = attr.nodeName.toLowerCase();

    if (allowedAttributeList.indexOf(attrName) !== -1) {
      if (uriAttrs.indexOf(attrName) !== -1) {
        return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
      }

      return true;
    }

    var regExp = allowedAttributeList.filter(function (attrRegex) {
      return attrRegex instanceof RegExp;
    }); // Check if a regular expression validates the attribute.

    for (var i = 0, l = regExp.length; i < l; i++) {
      if (attrName.match(regExp[i])) {
        return true;
      }
    }

    return false;
  };

XhmikosR's avatar
XhmikosR committed
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
  var DefaultWhitelist = {
    // Global attributes allowed on any supplied element below.
    '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
    a: ['target', 'href', 'title', 'rel'],
    area: [],
    b: [],
    br: [],
    col: [],
    code: [],
    div: [],
    em: [],
    hr: [],
    h1: [],
    h2: [],
    h3: [],
    h4: [],
    h5: [],
    h6: [],
    i: [],
    img: ['src', 'alt', 'title', 'width', 'height'],
    li: [],
    ol: [],
    p: [],
    pre: [],
    s: [],
    small: [],
    span: [],
    sub: [],
    sup: [],
    strong: [],
    u: [],
    ul: []
  };
  function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
XhmikosR's avatar
XhmikosR committed
3505
    if (!unsafeHtml.length) {
XhmikosR's avatar
XhmikosR committed
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
      return unsafeHtml;
    }

    if (sanitizeFn && typeof sanitizeFn === 'function') {
      return sanitizeFn(unsafeHtml);
    }

    var domParser = new window.DOMParser();
    var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
    var whitelistKeys = Object.keys(whiteList);
XhmikosR's avatar
XhmikosR committed
3516
    var elements = makeArray(createdDocument.body.querySelectorAll('*'));
XhmikosR's avatar
XhmikosR committed
3517
3518
3519
3520
3521

    var _loop = function _loop(i, len) {
      var el = elements[i];
      var elName = el.nodeName.toLowerCase();

XhmikosR's avatar
XhmikosR committed
3522
      if (whitelistKeys.indexOf(elName) === -1) {
XhmikosR's avatar
XhmikosR committed
3523
3524
3525
3526
        el.parentNode.removeChild(el);
        return "continue";
      }

XhmikosR's avatar
XhmikosR committed
3527
      var attributeList = makeArray(el.attributes);
XhmikosR's avatar
XhmikosR committed
3528
3529
3530
3531
3532
3533
3534
3535
3536
      var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
      attributeList.forEach(function (attr) {
        if (!allowedAttribute(attr, whitelistedAttributes)) {
          el.removeAttribute(attr.nodeName);
        }
      });
    };

    for (var i = 0, len = elements.length; i < len; i++) {
3537
      var _ret = _loop(i);
XhmikosR's avatar
XhmikosR committed
3538
3539
3540
3541
3542
3543
3544

      if (_ret === "continue") continue;
    }

    return createdDocument.body.innerHTML;
  }

XhmikosR's avatar
Dist    
XhmikosR committed
3545
3546
3547
3548
3549
3550
3551
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$6 = 'tooltip';
XhmikosR's avatar
XhmikosR committed
3552
  var VERSION$6 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
3553
3554
3555
3556
  var DATA_KEY$6 = 'bs.tooltip';
  var EVENT_KEY$6 = "." + DATA_KEY$6;
  var CLASS_PREFIX = 'bs-tooltip';
  var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
XhmikosR's avatar
XhmikosR committed
3557
  var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
XhmikosR's avatar
Dist    
XhmikosR committed
3558
3559
3560
3561
3562
3563
3564
3565
3566
  var DefaultType$4 = {
    animation: 'boolean',
    template: 'string',
    title: '(string|element|function)',
    trigger: 'string',
    delay: '(number|object)',
    html: 'boolean',
    selector: '(string|boolean)',
    placement: '(string|function)',
Mark Otto's avatar
Mark Otto committed
3567
    offset: '(number|string|function)',
XhmikosR's avatar
Dist    
XhmikosR committed
3568
3569
    container: '(string|element|boolean)',
    fallbackPlacement: '(string|array)',
XhmikosR's avatar
XhmikosR committed
3570
3571
3572
    boundary: '(string|element)',
    sanitize: 'boolean',
    sanitizeFn: '(null|function)',
XhmikosR's avatar
XhmikosR committed
3573
3574
    whiteList: 'object',
    popperConfig: '(null|object)'
XhmikosR's avatar
Dist    
XhmikosR committed
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
  };
  var AttachmentMap$1 = {
    AUTO: 'auto',
    TOP: 'top',
    RIGHT: 'right',
    BOTTOM: 'bottom',
    LEFT: 'left'
  };
  var Default$4 = {
    animation: true,
XhmikosR's avatar
XhmikosR committed
3585
    template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>',
XhmikosR's avatar
Dist    
XhmikosR committed
3586
3587
3588
3589
3590
3591
3592
3593
3594
    trigger: 'hover focus',
    title: '',
    delay: 0,
    html: false,
    selector: false,
    placement: 'top',
    offset: 0,
    container: false,
    fallbackPlacement: 'flip',
XhmikosR's avatar
XhmikosR committed
3595
3596
3597
    boundary: 'scrollParent',
    sanitize: true,
    sanitizeFn: null,
XhmikosR's avatar
XhmikosR committed
3598
3599
    whiteList: DefaultWhitelist,
    popperConfig: null
XhmikosR's avatar
Dist    
XhmikosR committed
3600
3601
3602
3603
3604
  };
  var HoverState = {
    SHOW: 'show',
    OUT: 'out'
  };
XhmikosR's avatar
XhmikosR committed
3605
  var Event$7 = {
XhmikosR's avatar
Dist    
XhmikosR committed
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
    HIDE: "hide" + EVENT_KEY$6,
    HIDDEN: "hidden" + EVENT_KEY$6,
    SHOW: "show" + EVENT_KEY$6,
    SHOWN: "shown" + EVENT_KEY$6,
    INSERTED: "inserted" + EVENT_KEY$6,
    CLICK: "click" + EVENT_KEY$6,
    FOCUSIN: "focusin" + EVENT_KEY$6,
    FOCUSOUT: "focusout" + EVENT_KEY$6,
    MOUSEENTER: "mouseenter" + EVENT_KEY$6,
    MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  };
  var ClassName$6 = {
    FADE: 'fade',
    SHOW: 'show'
  };
  var Selector$6 = {
Mark Otto's avatar
dist v5    
Mark Otto committed
3622
    TOOLTIP_INNER: '.tooltip-inner'
XhmikosR's avatar
Dist    
XhmikosR committed
3623
3624
3625
3626
3627
3628
  };
  var Trigger = {
    HOVER: 'hover',
    FOCUS: 'focus',
    CLICK: 'click',
    MANUAL: 'manual'
Mark Otto's avatar
dist    
Mark Otto committed
3629
3630
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
3631
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
3632
3633
     * ------------------------------------------------------------------------
     */
XhmikosR's avatar
Dist    
XhmikosR committed
3634
3635
3636
3637
3638
3639
3640
3641

  };

  var Tooltip =
  /*#__PURE__*/
  function () {
    function Tooltip(element, config) {
      if (typeof Popper === 'undefined') {
XhmikosR's avatar
XhmikosR committed
3642
        throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org)');
XhmikosR's avatar
Dist    
XhmikosR committed
3643
      } // private
Mark Otto's avatar
dist    
Mark Otto committed
3644
3645


XhmikosR's avatar
Dist    
XhmikosR committed
3646
3647
3648
3649
3650
      this._isEnabled = true;
      this._timeout = 0;
      this._hoverState = '';
      this._activeTrigger = {};
      this._popper = null; // Protected
Jacob Thornton's avatar
Jacob Thornton committed
3651

XhmikosR's avatar
Dist    
XhmikosR committed
3652
3653
3654
      this.element = element;
      this.config = this._getConfig(config);
      this.tip = null;
Jacob Thornton's avatar
Jacob Thornton committed
3655

XhmikosR's avatar
Dist    
XhmikosR committed
3656
      this._setListeners();
XhmikosR's avatar
XhmikosR committed
3657
3658

      Data.setData(element, this.constructor.DATA_KEY, this);
XhmikosR's avatar
Dist    
XhmikosR committed
3659
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
3660
3661


XhmikosR's avatar
Dist    
XhmikosR committed
3662
    var _proto = Tooltip.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
3663

XhmikosR's avatar
Dist    
XhmikosR committed
3664
3665
3666
3667
    // Public
    _proto.enable = function enable() {
      this._isEnabled = true;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3668

XhmikosR's avatar
Dist    
XhmikosR committed
3669
3670
3671
    _proto.disable = function disable() {
      this._isEnabled = false;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3672

XhmikosR's avatar
Dist    
XhmikosR committed
3673
3674
3675
    _proto.toggleEnabled = function toggleEnabled() {
      this._isEnabled = !this._isEnabled;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3676

XhmikosR's avatar
Dist    
XhmikosR committed
3677
3678
3679
3680
    _proto.toggle = function toggle(event) {
      if (!this._isEnabled) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3681

XhmikosR's avatar
Dist    
XhmikosR committed
3682
3683
      if (event) {
        var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
3684
        var context = Data.getData(event.delegateTarget, dataKey);
Jacob Thornton's avatar
Jacob Thornton committed
3685

XhmikosR's avatar
Dist    
XhmikosR committed
3686
        if (!context) {
XhmikosR's avatar
XhmikosR committed
3687
3688
          context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
          Data.setData(event.delegateTarget, dataKey, context);
Mark Otto's avatar
dist    
Mark Otto committed
3689
        }
Jacob Thornton's avatar
Jacob Thornton committed
3690

XhmikosR's avatar
Dist    
XhmikosR committed
3691
        context._activeTrigger.click = !context._activeTrigger.click;
Jacob Thornton's avatar
Jacob Thornton committed
3692

XhmikosR's avatar
Dist    
XhmikosR committed
3693
3694
        if (context._isWithActiveTrigger()) {
          context._enter(null, context);
Mark Otto's avatar
dist    
Mark Otto committed
3695
        } else {
XhmikosR's avatar
Dist    
XhmikosR committed
3696
3697
3698
          context._leave(null, context);
        }
      } else {
XhmikosR's avatar
XhmikosR committed
3699
        if (this.getTipElement().classList.contains(ClassName$6.SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
3700
          this._leave(null, this);
Jacob Thornton's avatar
Jacob Thornton committed
3701

XhmikosR's avatar
Dist    
XhmikosR committed
3702
          return;
Mark Otto's avatar
dist    
Mark Otto committed
3703
        }
Jacob Thornton's avatar
Jacob Thornton committed
3704

XhmikosR's avatar
Dist    
XhmikosR committed
3705
3706
3707
        this._enter(null, this);
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
3708

XhmikosR's avatar
Dist    
XhmikosR committed
3709
3710
    _proto.dispose = function dispose() {
      clearTimeout(this._timeout);
XhmikosR's avatar
XhmikosR committed
3711
3712
      Data.removeData(this.element, this.constructor.DATA_KEY);
      EventHandler.off(this.element, this.constructor.EVENT_KEY);
Mark Otto's avatar
dist v5    
Mark Otto committed
3713
      EventHandler.off(SelectorEngine.closest(this.element, '.modal'), 'hide.bs.modal', this._hideModalHandler);
Jacob Thornton's avatar
Jacob Thornton committed
3714

XhmikosR's avatar
Dist    
XhmikosR committed
3715
      if (this.tip) {
XhmikosR's avatar
XhmikosR committed
3716
        this.tip.parentNode.removeChild(this.tip);
XhmikosR's avatar
Dist    
XhmikosR committed
3717
      }
Mark Otto's avatar
dist    
Mark Otto committed
3718

XhmikosR's avatar
Dist    
XhmikosR committed
3719
3720
3721
3722
      this._isEnabled = null;
      this._timeout = null;
      this._hoverState = null;
      this._activeTrigger = null;
Mark Otto's avatar
grunt    
Mark Otto committed
3723

XhmikosR's avatar
XhmikosR committed
3724
      if (this._popper) {
XhmikosR's avatar
Dist    
XhmikosR committed
3725
3726
        this._popper.destroy();
      }
Jacob Thornton's avatar
Jacob Thornton committed
3727

XhmikosR's avatar
Dist    
XhmikosR committed
3728
3729
3730
3731
3732
      this._popper = null;
      this.element = null;
      this.config = null;
      this.tip = null;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3733

XhmikosR's avatar
Dist    
XhmikosR committed
3734
3735
    _proto.show = function show() {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
3736

XhmikosR's avatar
XhmikosR committed
3737
      if (this.element.style.display === 'none') {
XhmikosR's avatar
Dist    
XhmikosR committed
3738
3739
        throw new Error('Please use show on visible elements');
      }
Mark Otto's avatar
dist    
Mark Otto committed
3740

XhmikosR's avatar
Dist    
XhmikosR committed
3741
      if (this.isWithContent() && this._isEnabled) {
XhmikosR's avatar
XhmikosR committed
3742
3743
        var showEvent = EventHandler.trigger(this.element, this.constructor.Event.SHOW);
        var shadowRoot = findShadowRoot(this.element);
XhmikosR's avatar
Dist.    
XhmikosR committed
3744
        var isInTheDom = shadowRoot === null ? this.element.ownerDocument.documentElement.contains(this.element) : shadowRoot.contains(this.element);
Jacob Thornton's avatar
Jacob Thornton committed
3745

XhmikosR's avatar
XhmikosR committed
3746
        if (showEvent.defaultPrevented || !isInTheDom) {
XhmikosR's avatar
Dist    
XhmikosR committed
3747
3748
          return;
        }
Mark Otto's avatar
dist    
Mark Otto committed
3749

XhmikosR's avatar
Dist    
XhmikosR committed
3750
        var tip = this.getTipElement();
XhmikosR's avatar
XhmikosR committed
3751
        var tipId = getUID(this.constructor.NAME);
XhmikosR's avatar
Dist    
XhmikosR committed
3752
3753
3754
        tip.setAttribute('id', tipId);
        this.element.setAttribute('aria-describedby', tipId);
        this.setContent();
Jacob Thornton's avatar
Jacob Thornton committed
3755

XhmikosR's avatar
Dist    
XhmikosR committed
3756
        if (this.config.animation) {
XhmikosR's avatar
XhmikosR committed
3757
          tip.classList.add(ClassName$6.FADE);
XhmikosR's avatar
Dist    
XhmikosR committed
3758
        }
Jacob Thornton's avatar
Jacob Thornton committed
3759

XhmikosR's avatar
Dist    
XhmikosR committed
3760
        var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
Jacob Thornton's avatar
Jacob Thornton committed
3761

XhmikosR's avatar
Dist    
XhmikosR committed
3762
        var attachment = this._getAttachment(placement);
Mark Otto's avatar
dist    
Mark Otto committed
3763

3764
        this._addAttachmentClass(attachment);
Mark Otto's avatar
dist    
Mark Otto committed
3765
3766
3767

        var container = this._getContainer();

XhmikosR's avatar
XhmikosR committed
3768
        Data.setData(tip, this.constructor.DATA_KEY, this);
Mark Otto's avatar
grunt    
Mark Otto committed
3769

XhmikosR's avatar
XhmikosR committed
3770
3771
        if (!this.element.ownerDocument.documentElement.contains(this.tip)) {
          container.appendChild(tip);
XhmikosR's avatar
Dist    
XhmikosR committed
3772
3773
        }

XhmikosR's avatar
XhmikosR committed
3774
        EventHandler.trigger(this.element, this.constructor.Event.INSERTED);
XhmikosR's avatar
XhmikosR committed
3775
        this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
XhmikosR's avatar
XhmikosR committed
3776
        tip.classList.add(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
XhmikosR's avatar
Dist    
XhmikosR committed
3777
3778
3779
        // empty mouseover listeners to the body's immediate children;
        // only needed because of broken event delegation on iOS
        // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
Mark Otto's avatar
dist    
Mark Otto committed
3780

XhmikosR's avatar
Dist    
XhmikosR committed
3781
        if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
3782
3783
3784
          makeArray(document.body.children).forEach(function (element) {
            EventHandler.on(element, 'mouseover', noop());
          });
XhmikosR's avatar
Dist    
XhmikosR committed
3785
        }
Mark Otto's avatar
grunt    
Mark Otto committed
3786

XhmikosR's avatar
Dist    
XhmikosR committed
3787
3788
3789
3790
        var complete = function complete() {
          if (_this.config.animation) {
            _this._fixTransition();
          }
Mark Otto's avatar
dist    
Mark Otto committed
3791

XhmikosR's avatar
Dist    
XhmikosR committed
3792
3793
          var prevHoverState = _this._hoverState;
          _this._hoverState = null;
XhmikosR's avatar
XhmikosR committed
3794
          EventHandler.trigger(_this.element, _this.constructor.Event.SHOWN);
Jacob Thornton's avatar
Jacob Thornton committed
3795

XhmikosR's avatar
Dist    
XhmikosR committed
3796
3797
          if (prevHoverState === HoverState.OUT) {
            _this._leave(null, _this);
Mark Otto's avatar
dist    
Mark Otto committed
3798
          }
XhmikosR's avatar
Dist    
XhmikosR committed
3799
3800
        };

XhmikosR's avatar
XhmikosR committed
3801
3802
3803
3804
        if (this.tip.classList.contains(ClassName$6.FADE)) {
          var transitionDuration = getTransitionDurationFromElement(this.tip);
          EventHandler.one(this.tip, TRANSITION_END, complete);
          emulateTransitionEnd(this.tip, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
3805
3806
        } else {
          complete();
Mark Otto's avatar
dist    
Mark Otto committed
3807
        }
XhmikosR's avatar
Dist    
XhmikosR committed
3808
3809
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
3810

3811
    _proto.hide = function hide() {
XhmikosR's avatar
Dist    
XhmikosR committed
3812
      var _this2 = this;
Jacob Thornton's avatar
Jacob Thornton committed
3813

XhmikosR's avatar
Dist    
XhmikosR committed
3814
      var tip = this.getTipElement();
Mark Otto's avatar
dist    
Mark Otto committed
3815

XhmikosR's avatar
Dist    
XhmikosR committed
3816
3817
3818
3819
      var complete = function complete() {
        if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
          tip.parentNode.removeChild(tip);
        }
Mark Otto's avatar
grunt    
Mark Otto committed
3820

XhmikosR's avatar
Dist    
XhmikosR committed
3821
        _this2._cleanTipClass();
Mark Otto's avatar
dist    
Mark Otto committed
3822

XhmikosR's avatar
Dist    
XhmikosR committed
3823
        _this2.element.removeAttribute('aria-describedby');
Mark Otto's avatar
dist    
Mark Otto committed
3824

XhmikosR's avatar
XhmikosR committed
3825
        EventHandler.trigger(_this2.element, _this2.constructor.Event.HIDDEN);
Mark Otto's avatar
dist    
Mark Otto committed
3826

3827
        _this2._popper.destroy();
XhmikosR's avatar
Dist    
XhmikosR committed
3828
      };
Mark Otto's avatar
grunt    
Mark Otto committed
3829

XhmikosR's avatar
XhmikosR committed
3830
      var hideEvent = EventHandler.trigger(this.element, this.constructor.Event.HIDE);
Mark Otto's avatar
dist    
Mark Otto committed
3831

XhmikosR's avatar
XhmikosR committed
3832
      if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
3833
3834
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3835

XhmikosR's avatar
XhmikosR committed
3836
      tip.classList.remove(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
XhmikosR's avatar
Dist    
XhmikosR committed
3837
      // empty mouseover listeners we added for iOS support
Mark Otto's avatar
dist    
Mark Otto committed
3838

XhmikosR's avatar
Dist    
XhmikosR committed
3839
      if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
3840
3841
3842
        makeArray(document.body.children).forEach(function (element) {
          return EventHandler.off(element, 'mouseover', noop);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
3843
      }
Jacob Thornton's avatar
Jacob Thornton committed
3844

XhmikosR's avatar
Dist    
XhmikosR committed
3845
3846
3847
      this._activeTrigger[Trigger.CLICK] = false;
      this._activeTrigger[Trigger.FOCUS] = false;
      this._activeTrigger[Trigger.HOVER] = false;
Jacob Thornton's avatar
Jacob Thornton committed
3848

XhmikosR's avatar
XhmikosR committed
3849
3850
3851
3852
      if (this.tip.classList.contains(ClassName$6.FADE)) {
        var transitionDuration = getTransitionDurationFromElement(tip);
        EventHandler.one(tip, TRANSITION_END, complete);
        emulateTransitionEnd(tip, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
3853
3854
3855
      } else {
        complete();
      }
Jacob Thornton's avatar
Jacob Thornton committed
3856

XhmikosR's avatar
Dist    
XhmikosR committed
3857
3858
      this._hoverState = '';
    };
Jacob Thornton's avatar
Jacob Thornton committed
3859

XhmikosR's avatar
Dist    
XhmikosR committed
3860
3861
3862
3863
    _proto.update = function update() {
      if (this._popper !== null) {
        this._popper.scheduleUpdate();
      }
Mark Otto's avatar
Mark Otto committed
3864
3865
    } // Protected
    ;
Jacob Thornton's avatar
Jacob Thornton committed
3866

XhmikosR's avatar
Dist    
XhmikosR committed
3867
3868
3869
    _proto.isWithContent = function isWithContent() {
      return Boolean(this.getTitle());
    };
Jacob Thornton's avatar
Jacob Thornton committed
3870

XhmikosR's avatar
Dist    
XhmikosR committed
3871
    _proto.getTipElement = function getTipElement() {
XhmikosR's avatar
XhmikosR committed
3872
3873
3874
3875
3876
3877
3878
      if (this.tip) {
        return this.tip;
      }

      var element = document.createElement('div');
      element.innerHTML = this.config.template;
      this.tip = element.children[0];
XhmikosR's avatar
Dist    
XhmikosR committed
3879
3880
      return this.tip;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3881

XhmikosR's avatar
Dist    
XhmikosR committed
3882
3883
    _proto.setContent = function setContent() {
      var tip = this.getTipElement();
XhmikosR's avatar
XhmikosR committed
3884
3885
3886
      this.setElementContent(SelectorEngine.findOne(Selector$6.TOOLTIP_INNER, tip), this.getTitle());
      tip.classList.remove(ClassName$6.FADE);
      tip.classList.remove(ClassName$6.SHOW);
XhmikosR's avatar
Dist    
XhmikosR committed
3887
    };
Jacob Thornton's avatar
Jacob Thornton committed
3888

XhmikosR's avatar
XhmikosR committed
3889
3890
3891
3892
3893
    _proto.setElementContent = function setElementContent(element, content) {
      if (element === null) {
        return;
      }

3894
      if (typeof content === 'object' && isElement(content)) {
XhmikosR's avatar
XhmikosR committed
3895
3896
3897
3898
3899
        if (content.jquery) {
          content = content[0];
        } // content is a DOM node or a jQuery


XhmikosR's avatar
XhmikosR committed
3900
        if (this.config.html) {
XhmikosR's avatar
XhmikosR committed
3901
3902
3903
          if (content.parentNode !== element) {
            element.innerHTML = '';
            element.appendChild(content);
Mark Otto's avatar
dist    
Mark Otto committed
3904
3905
          }
        } else {
XhmikosR's avatar
XhmikosR committed
3906
          element.innerText = content.textContent;
Mark Otto's avatar
dist    
Mark Otto committed
3907
        }
XhmikosR's avatar
XhmikosR committed
3908
3909
3910
3911
3912
3913
3914
3915
3916

        return;
      }

      if (this.config.html) {
        if (this.config.sanitize) {
          content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
        }

XhmikosR's avatar
XhmikosR committed
3917
        element.innerHTML = content;
XhmikosR's avatar
Dist    
XhmikosR committed
3918
      } else {
XhmikosR's avatar
XhmikosR committed
3919
        element.innerText = content;
XhmikosR's avatar
Dist    
XhmikosR committed
3920
3921
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
3922

XhmikosR's avatar
Dist    
XhmikosR committed
3923
3924
    _proto.getTitle = function getTitle() {
      var title = this.element.getAttribute('data-original-title');
Jacob Thornton's avatar
Jacob Thornton committed
3925

XhmikosR's avatar
Dist    
XhmikosR committed
3926
3927
3928
      if (!title) {
        title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3929

XhmikosR's avatar
Dist    
XhmikosR committed
3930
      return title;
Mark Otto's avatar
Mark Otto committed
3931
3932
    } // Private
    ;
Jacob Thornton's avatar
Jacob Thornton committed
3933

XhmikosR's avatar
XhmikosR committed
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
    _proto._getPopperConfig = function _getPopperConfig(attachment) {
      var _this3 = this;

      var defaultBsConfig = {
        placement: attachment,
        modifiers: {
          offset: this._getOffset(),
          flip: {
            behavior: this.config.fallbackPlacement
          },
          arrow: {
            element: "." + this.constructor.NAME + "-arrow"
          },
          preventOverflow: {
            boundariesElement: this.config.boundary
          }
        },
        onCreate: function onCreate(data) {
          if (data.originalPlacement !== data.placement) {
            _this3._handlePopperPlacementChange(data);
          }
        },
        onUpdate: function onUpdate(data) {
          return _this3._handlePopperPlacementChange(data);
        }
      };
      return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
    };

3963
3964
3965
3966
    _proto._addAttachmentClass = function _addAttachmentClass(attachment) {
      this.getTipElement().classList.add(CLASS_PREFIX + "-" + attachment);
    };

Mark Otto's avatar
Mark Otto committed
3967
    _proto._getOffset = function _getOffset() {
XhmikosR's avatar
XhmikosR committed
3968
      var _this4 = this;
Mark Otto's avatar
Mark Otto committed
3969
3970
3971
3972
3973

      var offset = {};

      if (typeof this.config.offset === 'function') {
        offset.fn = function (data) {
XhmikosR's avatar
XhmikosR committed
3974
          data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
Mark Otto's avatar
Mark Otto committed
3975
3976
3977
3978
3979
3980
3981
3982
3983
          return data;
        };
      } else {
        offset.offset = this.config.offset;
      }

      return offset;
    };

Mark Otto's avatar
dist    
Mark Otto committed
3984
3985
3986
3987
3988
    _proto._getContainer = function _getContainer() {
      if (this.config.container === false) {
        return document.body;
      }

XhmikosR's avatar
XhmikosR committed
3989
3990
      if (isElement(this.config.container)) {
        return this.config.container;
Mark Otto's avatar
dist    
Mark Otto committed
3991
3992
      }

XhmikosR's avatar
XhmikosR committed
3993
      return SelectorEngine.findOne(this.config.container);
Mark Otto's avatar
dist    
Mark Otto committed
3994
3995
    };

XhmikosR's avatar
Dist    
XhmikosR committed
3996
3997
3998
    _proto._getAttachment = function _getAttachment(placement) {
      return AttachmentMap$1[placement.toUpperCase()];
    };
Mark Otto's avatar
dist    
Mark Otto committed
3999

XhmikosR's avatar
Dist    
XhmikosR committed
4000
    _proto._setListeners = function _setListeners() {
XhmikosR's avatar
XhmikosR committed
4001
      var _this5 = this;
Jacob Thornton's avatar
Jacob Thornton committed
4002

XhmikosR's avatar
Dist    
XhmikosR committed
4003
4004
4005
      var triggers = this.config.trigger.split(' ');
      triggers.forEach(function (trigger) {
        if (trigger === 'click') {
XhmikosR's avatar
XhmikosR committed
4006
4007
          EventHandler.on(_this5.element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
            return _this5.toggle(event);
Mark Otto's avatar
dist    
Mark Otto committed
4008
          });
XhmikosR's avatar
Dist    
XhmikosR committed
4009
        } else if (trigger !== Trigger.MANUAL) {
XhmikosR's avatar
XhmikosR committed
4010
4011
4012
4013
          var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
          var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
          EventHandler.on(_this5.element, eventIn, _this5.config.selector, function (event) {
            return _this5._enter(event);
XhmikosR's avatar
XhmikosR committed
4014
          });
XhmikosR's avatar
XhmikosR committed
4015
4016
          EventHandler.on(_this5.element, eventOut, _this5.config.selector, function (event) {
            return _this5._leave(event);
Mark Otto's avatar
dist    
Mark Otto committed
4017
4018
          });
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4019
      });
Mark Otto's avatar
dist v5    
Mark Otto committed
4020
4021

      this._hideModalHandler = function () {
XhmikosR's avatar
XhmikosR committed
4022
4023
        if (_this5.element) {
          _this5.hide();
XhmikosR's avatar
Dist    
XhmikosR committed
4024
        }
Mark Otto's avatar
dist v5    
Mark Otto committed
4025
4026
4027
      };

      EventHandler.on(SelectorEngine.closest(this.element, '.modal'), 'hide.bs.modal', this._hideModalHandler);
Jacob Thornton's avatar
Jacob Thornton committed
4028

XhmikosR's avatar
Dist    
XhmikosR committed
4029
      if (this.config.selector) {
4030
        this.config = _objectSpread2({}, this.config, {
XhmikosR's avatar
Dist    
XhmikosR committed
4031
4032
4033
4034
4035
4036
4037
          trigger: 'manual',
          selector: ''
        });
      } else {
        this._fixTitle();
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
4038

XhmikosR's avatar
Dist    
XhmikosR committed
4039
4040
    _proto._fixTitle = function _fixTitle() {
      var titleType = typeof this.element.getAttribute('data-original-title');
Mark Otto's avatar
dist    
Mark Otto committed
4041

XhmikosR's avatar
Dist    
XhmikosR committed
4042
4043
4044
4045
4046
      if (this.element.getAttribute('title') || titleType !== 'string') {
        this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
        this.element.setAttribute('title', '');
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
4047

XhmikosR's avatar
Dist    
XhmikosR committed
4048
4049
    _proto._enter = function _enter(event, context) {
      var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
4050
      context = context || Data.getData(event.delegateTarget, dataKey);
Jacob Thornton's avatar
Jacob Thornton committed
4051

XhmikosR's avatar
Dist    
XhmikosR committed
4052
      if (!context) {
XhmikosR's avatar
XhmikosR committed
4053
4054
        context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
        Data.setData(event.delegateTarget, dataKey, context);
XhmikosR's avatar
Dist    
XhmikosR committed
4055
      }
Jacob Thornton's avatar
Jacob Thornton committed
4056

XhmikosR's avatar
Dist    
XhmikosR committed
4057
4058
4059
      if (event) {
        context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
      }
Jacob Thornton's avatar
Jacob Thornton committed
4060

XhmikosR's avatar
XhmikosR committed
4061
      if (context.getTipElement().classList.contains(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
Mark Otto's avatar
dist    
Mark Otto committed
4062
        context._hoverState = HoverState.SHOW;
XhmikosR's avatar
Dist    
XhmikosR committed
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
        return;
      }

      clearTimeout(context._timeout);
      context._hoverState = HoverState.SHOW;

      if (!context.config.delay || !context.config.delay.show) {
        context.show();
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
4073

XhmikosR's avatar
Dist    
XhmikosR committed
4074
4075
      context._timeout = setTimeout(function () {
        if (context._hoverState === HoverState.SHOW) {
Mark Otto's avatar
dist    
Mark Otto committed
4076
4077
          context.show();
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4078
4079
      }, context.config.delay.show);
    };
Jacob Thornton's avatar
Jacob Thornton committed
4080

XhmikosR's avatar
Dist    
XhmikosR committed
4081
4082
    _proto._leave = function _leave(event, context) {
      var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
4083
      context = context || Data.getData(event.delegateTarget, dataKey);
Mark Otto's avatar
grunt    
Mark Otto committed
4084

XhmikosR's avatar
Dist    
XhmikosR committed
4085
      if (!context) {
XhmikosR's avatar
XhmikosR committed
4086
4087
        context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
        Data.setData(event.delegateTarget, dataKey, context);
XhmikosR's avatar
Dist    
XhmikosR committed
4088
      }
Mark Otto's avatar
dist    
Mark Otto committed
4089

XhmikosR's avatar
Dist    
XhmikosR committed
4090
4091
4092
      if (event) {
        context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
      }
Jacob Thornton's avatar
Jacob Thornton committed
4093

XhmikosR's avatar
Dist    
XhmikosR committed
4094
4095
4096
      if (context._isWithActiveTrigger()) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
4097

XhmikosR's avatar
Dist    
XhmikosR committed
4098
4099
      clearTimeout(context._timeout);
      context._hoverState = HoverState.OUT;
Jacob Thornton's avatar
Jacob Thornton committed
4100

XhmikosR's avatar
Dist    
XhmikosR committed
4101
4102
4103
4104
      if (!context.config.delay || !context.config.delay.hide) {
        context.hide();
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
4105

XhmikosR's avatar
Dist    
XhmikosR committed
4106
4107
      context._timeout = setTimeout(function () {
        if (context._hoverState === HoverState.OUT) {
Mark Otto's avatar
dist    
Mark Otto committed
4108
4109
          context.hide();
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4110
4111
      }, context.config.delay.hide);
    };
Jacob Thornton's avatar
Jacob Thornton committed
4112

XhmikosR's avatar
Dist    
XhmikosR committed
4113
4114
4115
4116
    _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
      for (var trigger in this._activeTrigger) {
        if (this._activeTrigger[trigger]) {
          return true;
Mark Otto's avatar
dist    
Mark Otto committed
4117
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4118
      }
Jacob Thornton's avatar
Jacob Thornton committed
4119

XhmikosR's avatar
Dist    
XhmikosR committed
4120
4121
      return false;
    };
Jacob Thornton's avatar
Jacob Thornton committed
4122

XhmikosR's avatar
Dist    
XhmikosR committed
4123
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
4124
      var dataAttributes = Manipulator.getDataAttributes(this.element);
XhmikosR's avatar
XhmikosR committed
4125
4126
4127
4128
4129
      Object.keys(dataAttributes).forEach(function (dataAttr) {
        if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
          delete dataAttributes[dataAttr];
        }
      });
XhmikosR's avatar
XhmikosR committed
4130
4131
4132
4133
4134

      if (config && typeof config.container === 'object' && config.container.jquery) {
        config.container = config.container[0];
      }

4135
      config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
Jacob Thornton's avatar
Jacob Thornton committed
4136

XhmikosR's avatar
Dist    
XhmikosR committed
4137
4138
4139
4140
4141
4142
      if (typeof config.delay === 'number') {
        config.delay = {
          show: config.delay,
          hide: config.delay
        };
      }
Mark Otto's avatar
grunt    
Mark Otto committed
4143

XhmikosR's avatar
Dist    
XhmikosR committed
4144
4145
4146
      if (typeof config.title === 'number') {
        config.title = config.title.toString();
      }
Jacob Thornton's avatar
Jacob Thornton committed
4147

XhmikosR's avatar
Dist    
XhmikosR committed
4148
4149
4150
      if (typeof config.content === 'number') {
        config.content = config.content.toString();
      }
Jacob Thornton's avatar
Jacob Thornton committed
4151

XhmikosR's avatar
XhmikosR committed
4152
      typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
XhmikosR's avatar
XhmikosR committed
4153
4154
4155
4156
4157

      if (config.sanitize) {
        config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
      }

XhmikosR's avatar
Dist    
XhmikosR committed
4158
4159
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
4160

XhmikosR's avatar
Dist    
XhmikosR committed
4161
4162
    _proto._getDelegateConfig = function _getDelegateConfig() {
      var config = {};
Mark Otto's avatar
dist    
Mark Otto committed
4163

XhmikosR's avatar
Dist    
XhmikosR committed
4164
4165
4166
4167
      if (this.config) {
        for (var key in this.config) {
          if (this.constructor.Default[key] !== this.config[key]) {
            config[key] = this.config[key];
Mark Otto's avatar
dist    
Mark Otto committed
4168
4169
          }
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4170
      }
Mark Otto's avatar
dist    
Mark Otto committed
4171

XhmikosR's avatar
Dist    
XhmikosR committed
4172
4173
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
4174

XhmikosR's avatar
Dist    
XhmikosR committed
4175
    _proto._cleanTipClass = function _cleanTipClass() {
XhmikosR's avatar
XhmikosR committed
4176
4177
      var tip = this.getTipElement();
      var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
Mark Otto's avatar
dist    
Mark Otto committed
4178

XhmikosR's avatar
Dist    
XhmikosR committed
4179
      if (tabClass !== null && tabClass.length) {
XhmikosR's avatar
XhmikosR committed
4180
4181
4182
4183
4184
        tabClass.map(function (token) {
          return token.trim();
        }).forEach(function (tClass) {
          return tip.classList.remove(tClass);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
4185
4186
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
4187

XhmikosR's avatar
Dist    
XhmikosR committed
4188
4189
4190
    _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
      var popperInstance = popperData.instance;
      this.tip = popperInstance.popper;
Mark Otto's avatar
dist    
Mark Otto committed
4191

XhmikosR's avatar
Dist    
XhmikosR committed
4192
      this._cleanTipClass();
Mark Otto's avatar
dist    
Mark Otto committed
4193

4194
      this._addAttachmentClass(this._getAttachment(popperData.placement));
XhmikosR's avatar
Dist    
XhmikosR committed
4195
    };
Mark Otto's avatar
dist    
Mark Otto committed
4196

XhmikosR's avatar
Dist    
XhmikosR committed
4197
4198
4199
    _proto._fixTransition = function _fixTransition() {
      var tip = this.getTipElement();
      var initConfigAnimation = this.config.animation;
Jacob Thornton's avatar
Jacob Thornton committed
4200

XhmikosR's avatar
Dist    
XhmikosR committed
4201
4202
4203
      if (tip.getAttribute('x-placement') !== null) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
4204

XhmikosR's avatar
XhmikosR committed
4205
      tip.classList.remove(ClassName$6.FADE);
XhmikosR's avatar
Dist    
XhmikosR committed
4206
4207
4208
4209
      this.config.animation = false;
      this.hide();
      this.show();
      this.config.animation = initConfigAnimation;
Mark Otto's avatar
Mark Otto committed
4210
4211
    } // Static
    ;
Mark Otto's avatar
grunt    
Mark Otto committed
4212

XhmikosR's avatar
XhmikosR committed
4213
    Tooltip.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
4214
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4215
        var data = Data.getData(this, DATA_KEY$6);
Jacob Thornton's avatar
Jacob Thornton committed
4216

XhmikosR's avatar
Dist    
XhmikosR committed
4217
        var _config = typeof config === 'object' && config;
Mark Otto's avatar
dist    
Mark Otto committed
4218

XhmikosR's avatar
Dist    
XhmikosR committed
4219
4220
4221
        if (!data && /dispose|hide/.test(config)) {
          return;
        }
Mark Otto's avatar
dist    
Mark Otto committed
4222

XhmikosR's avatar
Dist    
XhmikosR committed
4223
4224
4225
        if (!data) {
          data = new Tooltip(this, _config);
        }
Mark Otto's avatar
dist    
Mark Otto committed
4226

XhmikosR's avatar
Dist    
XhmikosR committed
4227
4228
4229
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
4230
4231
          }

XhmikosR's avatar
Dist    
XhmikosR committed
4232
          data[config]();
Mark Otto's avatar
dist    
Mark Otto committed
4233
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4234
4235
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
4236

XhmikosR's avatar
XhmikosR committed
4237
    Tooltip.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
4238
4239
4240
      return Data.getData(element, DATA_KEY$6);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
    _createClass(Tooltip, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$6;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$4;
      }
    }, {
      key: "NAME",
      get: function get() {
        return NAME$6;
      }
    }, {
      key: "DATA_KEY",
      get: function get() {
        return DATA_KEY$6;
      }
    }, {
      key: "Event",
      get: function get() {
XhmikosR's avatar
XhmikosR committed
4264
        return Event$7;
XhmikosR's avatar
Dist    
XhmikosR committed
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
      }
    }, {
      key: "EVENT_KEY",
      get: function get() {
        return EVENT_KEY$6;
      }
    }, {
      key: "DefaultType",
      get: function get() {
        return DefaultType$4;
      }
    }]);
Mark Otto's avatar
dist    
Mark Otto committed
4277

XhmikosR's avatar
Dist    
XhmikosR committed
4278
4279
    return Tooltip;
  }();
XhmikosR's avatar
XhmikosR committed
4280
4281

  var $$7 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
4282
4283
4284
4285
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
4286
   * add .tooltip to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
4287
   */
Mark Otto's avatar
dist    
Mark Otto committed
4288

4289
4290
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4291
4292
4293
4294
  if ($$7) {
    var JQUERY_NO_CONFLICT$6 = $$7.fn[NAME$6];
    $$7.fn[NAME$6] = Tooltip.jQueryInterface;
    $$7.fn[NAME$6].Constructor = Tooltip;
Jacob Thornton's avatar
Jacob Thornton committed
4295

XhmikosR's avatar
XhmikosR committed
4296
4297
4298
    $$7.fn[NAME$6].noConflict = function () {
      $$7.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
      return Tooltip.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
4299
4300
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
4301

XhmikosR's avatar
Dist    
XhmikosR committed
4302
4303
4304
4305
4306
4307
4308
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$7 = 'popover';
XhmikosR's avatar
XhmikosR committed
4309
  var VERSION$7 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
4310
4311
4312
4313
4314
  var DATA_KEY$7 = 'bs.popover';
  var EVENT_KEY$7 = "." + DATA_KEY$7;
  var CLASS_PREFIX$1 = 'bs-popover';
  var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');

4315
  var Default$5 = _objectSpread2({}, Tooltip.Default, {
XhmikosR's avatar
Dist    
XhmikosR committed
4316
4317
4318
    placement: 'right',
    trigger: 'click',
    content: '',
XhmikosR's avatar
XhmikosR committed
4319
    template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
XhmikosR's avatar
Dist    
XhmikosR committed
4320
4321
  });

4322
  var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
XhmikosR's avatar
Dist    
XhmikosR committed
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
    content: '(string|element|function)'
  });

  var ClassName$7 = {
    FADE: 'fade',
    SHOW: 'show'
  };
  var Selector$7 = {
    TITLE: '.popover-header',
    CONTENT: '.popover-body'
  };
XhmikosR's avatar
XhmikosR committed
4334
  var Event$8 = {
XhmikosR's avatar
Dist    
XhmikosR committed
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
    HIDE: "hide" + EVENT_KEY$7,
    HIDDEN: "hidden" + EVENT_KEY$7,
    SHOW: "show" + EVENT_KEY$7,
    SHOWN: "shown" + EVENT_KEY$7,
    INSERTED: "inserted" + EVENT_KEY$7,
    CLICK: "click" + EVENT_KEY$7,
    FOCUSIN: "focusin" + EVENT_KEY$7,
    FOCUSOUT: "focusout" + EVENT_KEY$7,
    MOUSEENTER: "mouseenter" + EVENT_KEY$7,
    MOUSELEAVE: "mouseleave" + EVENT_KEY$7
Mark Otto's avatar
dist    
Mark Otto committed
4345
4346
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
4347
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
4348
4349
     * ------------------------------------------------------------------------
     */
Jacob Thornton's avatar
Jacob Thornton committed
4350

XhmikosR's avatar
Dist    
XhmikosR committed
4351
  };
Jacob Thornton's avatar
Jacob Thornton committed
4352

XhmikosR's avatar
Dist    
XhmikosR committed
4353
4354
4355
4356
  var Popover =
  /*#__PURE__*/
  function (_Tooltip) {
    _inheritsLoose(Popover, _Tooltip);
Jacob Thornton's avatar
Jacob Thornton committed
4357

XhmikosR's avatar
Dist    
XhmikosR committed
4358
4359
4360
    function Popover() {
      return _Tooltip.apply(this, arguments) || this;
    }
Mark Otto's avatar
grunt    
Mark Otto committed
4361

XhmikosR's avatar
Dist    
XhmikosR committed
4362
    var _proto = Popover.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
4363

XhmikosR's avatar
Dist    
XhmikosR committed
4364
4365
4366
4367
    // Overrides
    _proto.isWithContent = function isWithContent() {
      return this.getTitle() || this._getContent();
    };
Mark Otto's avatar
Mark Otto committed
4368

XhmikosR's avatar
Dist    
XhmikosR committed
4369
    _proto.setContent = function setContent() {
XhmikosR's avatar
XhmikosR committed
4370
      var tip = this.getTipElement(); // we use append for html objects to maintain js events
Jacob Thornton's avatar
Jacob Thornton committed
4371

XhmikosR's avatar
XhmikosR committed
4372
      this.setElementContent(SelectorEngine.findOne(Selector$7.TITLE, tip), this.getTitle());
Jacob Thornton's avatar
Jacob Thornton committed
4373

XhmikosR's avatar
Dist    
XhmikosR committed
4374
      var content = this._getContent();
Mark Otto's avatar
dist    
Mark Otto committed
4375

XhmikosR's avatar
Dist    
XhmikosR committed
4376
4377
4378
      if (typeof content === 'function') {
        content = content.call(this.element);
      }
Jacob Thornton's avatar
Jacob Thornton committed
4379

XhmikosR's avatar
XhmikosR committed
4380
4381
4382
      this.setElementContent(SelectorEngine.findOne(Selector$7.CONTENT, tip), content);
      tip.classList.remove(ClassName$7.FADE);
      tip.classList.remove(ClassName$7.SHOW);
XhmikosR's avatar
XhmikosR committed
4383
4384
4385
4386
    };

    _proto._addAttachmentClass = function _addAttachmentClass(attachment) {
      this.getTipElement().classList.add(CLASS_PREFIX$1 + "-" + attachment);
Mark Otto's avatar
Mark Otto committed
4387
4388
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
4389

XhmikosR's avatar
Dist    
XhmikosR committed
4390
4391
4392
    _proto._getContent = function _getContent() {
      return this.element.getAttribute('data-content') || this.config.content;
    };
Jacob Thornton's avatar
Jacob Thornton committed
4393

XhmikosR's avatar
Dist    
XhmikosR committed
4394
    _proto._cleanTipClass = function _cleanTipClass() {
XhmikosR's avatar
XhmikosR committed
4395
4396
      var tip = this.getTipElement();
      var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX$1);
Jacob Thornton's avatar
Jacob Thornton committed
4397

XhmikosR's avatar
Dist    
XhmikosR committed
4398
      if (tabClass !== null && tabClass.length > 0) {
XhmikosR's avatar
XhmikosR committed
4399
4400
4401
4402
4403
        tabClass.map(function (token) {
          return token.trim();
        }).forEach(function (tClass) {
          return tip.classList.remove(tClass);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
4404
      }
Mark Otto's avatar
Mark Otto committed
4405
4406
    } // Static
    ;
Mark Otto's avatar
dist    
Mark Otto committed
4407

XhmikosR's avatar
XhmikosR committed
4408
    Popover.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
4409
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4410
        var data = Data.getData(this, DATA_KEY$7);
Mark Otto's avatar
dist    
Mark Otto committed
4411

XhmikosR's avatar
Dist    
XhmikosR committed
4412
        var _config = typeof config === 'object' ? config : null;
Mark Otto's avatar
dist    
Mark Otto committed
4413

XhmikosR's avatar
Dist    
XhmikosR committed
4414
4415
4416
        if (!data && /dispose|hide/.test(config)) {
          return;
        }
Mark Otto's avatar
build    
Mark Otto committed
4417

XhmikosR's avatar
Dist    
XhmikosR committed
4418
4419
        if (!data) {
          data = new Popover(this, _config);
XhmikosR's avatar
XhmikosR committed
4420
          Data.setData(this, DATA_KEY$7, data);
XhmikosR's avatar
Dist    
XhmikosR committed
4421
        }
Mark Otto's avatar
dist    
Mark Otto committed
4422

XhmikosR's avatar
Dist    
XhmikosR committed
4423
4424
4425
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
4426
          }
Jacob Thornton's avatar
Jacob Thornton committed
4427

XhmikosR's avatar
Dist    
XhmikosR committed
4428
          data[config]();
Mark Otto's avatar
dist    
Mark Otto committed
4429
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4430
4431
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
4432

XhmikosR's avatar
XhmikosR committed
4433
    Popover.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
4434
4435
4436
      return Data.getData(element, DATA_KEY$7);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
    _createClass(Popover, null, [{
      key: "VERSION",
      // Getters
      get: function get() {
        return VERSION$7;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$5;
      }
    }, {
      key: "NAME",
      get: function get() {
        return NAME$7;
      }
    }, {
      key: "DATA_KEY",
      get: function get() {
        return DATA_KEY$7;
      }
    }, {
      key: "Event",
      get: function get() {
XhmikosR's avatar
XhmikosR committed
4461
        return Event$8;
XhmikosR's avatar
Dist    
XhmikosR committed
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
      }
    }, {
      key: "EVENT_KEY",
      get: function get() {
        return EVENT_KEY$7;
      }
    }, {
      key: "DefaultType",
      get: function get() {
        return DefaultType$5;
      }
    }]);
Mark Otto's avatar
dist    
Mark Otto committed
4474

XhmikosR's avatar
Dist    
XhmikosR committed
4475
4476
    return Popover;
  }(Tooltip);
XhmikosR's avatar
XhmikosR committed
4477
4478

  var $$8 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
4479
4480
4481
4482
4483
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
4484

4485
4486
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4487
4488
4489
4490
  if ($$8) {
    var JQUERY_NO_CONFLICT$7 = $$8.fn[NAME$7];
    $$8.fn[NAME$7] = Popover.jQueryInterface;
    $$8.fn[NAME$7].Constructor = Popover;
Jacob Thornton's avatar
Jacob Thornton committed
4491

XhmikosR's avatar
XhmikosR committed
4492
4493
4494
    $$8.fn[NAME$7].noConflict = function () {
      $$8.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
      return Popover.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
4495
4496
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
4497

XhmikosR's avatar
Dist    
XhmikosR committed
4498
4499
4500
4501
4502
4503
4504
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$8 = 'scrollspy';
XhmikosR's avatar
XhmikosR committed
4505
  var VERSION$8 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
  var DATA_KEY$8 = 'bs.scrollspy';
  var EVENT_KEY$8 = "." + DATA_KEY$8;
  var DATA_API_KEY$6 = '.data-api';
  var Default$6 = {
    offset: 10,
    method: 'auto',
    target: ''
  };
  var DefaultType$6 = {
    offset: 'number',
    method: 'string',
    target: '(string|element)'
  };
XhmikosR's avatar
XhmikosR committed
4519
  var Event$9 = {
XhmikosR's avatar
Dist    
XhmikosR committed
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
    ACTIVATE: "activate" + EVENT_KEY$8,
    SCROLL: "scroll" + EVENT_KEY$8,
    LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  };
  var ClassName$8 = {
    DROPDOWN_ITEM: 'dropdown-item',
    ACTIVE: 'active'
  };
  var Selector$8 = {
    DATA_SPY: '[data-spy="scroll"]',
    NAV_LIST_GROUP: '.nav, .list-group',
    NAV_LINKS: '.nav-link',
    NAV_ITEMS: '.nav-item',
    LIST_ITEMS: '.list-group-item',
    DROPDOWN: '.dropdown',
    DROPDOWN_TOGGLE: '.dropdown-toggle'
  };
  var OffsetMethod = {
    OFFSET: 'offset',
    POSITION: 'position'
Mark Otto's avatar
dist    
Mark Otto committed
4540
4541
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
4542
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
4543
4544
     * ------------------------------------------------------------------------
     */
XhmikosR's avatar
Dist    
XhmikosR committed
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556

  };

  var ScrollSpy =
  /*#__PURE__*/
  function () {
    function ScrollSpy(element, config) {
      var _this = this;

      this._element = element;
      this._scrollElement = element.tagName === 'BODY' ? window : element;
      this._config = this._getConfig(config);
XhmikosR's avatar
Dist.    
XhmikosR committed
4557
      this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " ." + ClassName$8.DROPDOWN_ITEM);
XhmikosR's avatar
Dist    
XhmikosR committed
4558
4559
4560
4561
      this._offsets = [];
      this._targets = [];
      this._activeTarget = null;
      this._scrollHeight = 0;
XhmikosR's avatar
XhmikosR committed
4562
      EventHandler.on(this._scrollElement, Event$9.SCROLL, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
4563
4564
4565
4566
4567
        return _this._process(event);
      });
      this.refresh();

      this._process();
XhmikosR's avatar
XhmikosR committed
4568
4569

      Data.setData(element, DATA_KEY$8, this);
XhmikosR's avatar
Dist    
XhmikosR committed
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
    } // Getters


    var _proto = ScrollSpy.prototype;

    // Public
    _proto.refresh = function refresh() {
      var _this2 = this;

      var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
      var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
      var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
      this._offsets = [];
      this._targets = [];
      this._scrollHeight = this._getScrollHeight();
XhmikosR's avatar
XhmikosR committed
4585
      var targets = makeArray(SelectorEngine.find(this._selector));
XhmikosR's avatar
Dist    
XhmikosR committed
4586
4587
      targets.map(function (element) {
        var target;
XhmikosR's avatar
XhmikosR committed
4588
        var targetSelector = getSelectorFromElement(element);
XhmikosR's avatar
Dist    
XhmikosR committed
4589
4590

        if (targetSelector) {
XhmikosR's avatar
XhmikosR committed
4591
          target = SelectorEngine.findOne(targetSelector);
XhmikosR's avatar
Dist    
XhmikosR committed
4592
4593
4594
4595
4596
4597
        }

        if (target) {
          var targetBCR = target.getBoundingClientRect();

          if (targetBCR.width || targetBCR.height) {
XhmikosR's avatar
XhmikosR committed
4598
            return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
XhmikosR's avatar
Dist    
XhmikosR committed
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
          }
        }

        return null;
      }).filter(function (item) {
        return item;
      }).sort(function (a, b) {
        return a[0] - b[0];
      }).forEach(function (item) {
        _this2._offsets.push(item[0]);

        _this2._targets.push(item[1]);
      });
Mark Otto's avatar
dist    
Mark Otto committed
4612
    };
XhmikosR's avatar
Dist    
XhmikosR committed
4613
4614

    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
4615
4616
      Data.removeData(this._element, DATA_KEY$8);
      EventHandler.off(this._scrollElement, EVENT_KEY$8);
XhmikosR's avatar
Dist    
XhmikosR committed
4617
4618
4619
4620
4621
4622
4623
4624
      this._element = null;
      this._scrollElement = null;
      this._config = null;
      this._selector = null;
      this._offsets = null;
      this._targets = null;
      this._activeTarget = null;
      this._scrollHeight = null;
Mark Otto's avatar
Mark Otto committed
4625
4626
    } // Private
    ;
XhmikosR's avatar
Dist    
XhmikosR committed
4627
4628

    _proto._getConfig = function _getConfig(config) {
4629
      config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
XhmikosR's avatar
Dist    
XhmikosR committed
4630
4631

      if (typeof config.target !== 'string') {
XhmikosR's avatar
XhmikosR committed
4632
        var id = config.target.id;
XhmikosR's avatar
Dist    
XhmikosR committed
4633
4634

        if (!id) {
XhmikosR's avatar
XhmikosR committed
4635
4636
          id = getUID(NAME$8);
          config.target.id = id;
XhmikosR's avatar
Dist    
XhmikosR committed
4637
4638
4639
4640
4641
        }

        config.target = "#" + id;
      }

XhmikosR's avatar
XhmikosR committed
4642
      typeCheckConfig(NAME$8, config, DefaultType$6);
XhmikosR's avatar
Dist    
XhmikosR committed
4643
      return config;
Mark Otto's avatar
dist    
Mark Otto committed
4644
    };
XhmikosR's avatar
Dist    
XhmikosR committed
4645
4646
4647

    _proto._getScrollTop = function _getScrollTop() {
      return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
Mark Otto's avatar
dist    
Mark Otto committed
4648
    };
XhmikosR's avatar
Dist    
XhmikosR committed
4649
4650
4651

    _proto._getScrollHeight = function _getScrollHeight() {
      return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
Mark Otto's avatar
dist    
Mark Otto committed
4652
    };
Mark Otto's avatar
grunt    
Mark Otto committed
4653

XhmikosR's avatar
Dist    
XhmikosR committed
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
    _proto._getOffsetHeight = function _getOffsetHeight() {
      return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
    };

    _proto._process = function _process() {
      var scrollTop = this._getScrollTop() + this._config.offset;

      var scrollHeight = this._getScrollHeight();

      var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();

      if (this._scrollHeight !== scrollHeight) {
        this.refresh();
      }

      if (scrollTop >= maxScroll) {
        var target = this._targets[this._targets.length - 1];

        if (this._activeTarget !== target) {
          this._activate(target);
        }

        return;
      }

      if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
        this._activeTarget = null;

        this._clear();

        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
4686

XhmikosR's avatar
Dist    
XhmikosR committed
4687
      var offsetLength = this._offsets.length;
Mark Otto's avatar
grunt    
Mark Otto committed
4688

XhmikosR's avatar
Dist    
XhmikosR committed
4689
4690
      for (var i = offsetLength; i--;) {
        var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
Mark Otto's avatar
dist    
Mark Otto committed
4691

XhmikosR's avatar
Dist    
XhmikosR committed
4692
4693
4694
4695
4696
        if (isActiveTarget) {
          this._activate(this._targets[i]);
        }
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
4697

XhmikosR's avatar
Dist    
XhmikosR committed
4698
4699
    _proto._activate = function _activate(target) {
      this._activeTarget = target;
Jacob Thornton's avatar
Jacob Thornton committed
4700

XhmikosR's avatar
Dist    
XhmikosR committed
4701
      this._clear();
Jacob Thornton's avatar
Jacob Thornton committed
4702

XhmikosR's avatar
Dist    
XhmikosR committed
4703
4704
      var queries = this._selector.split(',').map(function (selector) {
        return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
XhmikosR's avatar
Dist    
XhmikosR committed
4705
      });
XhmikosR's avatar
Dist    
XhmikosR committed
4706

XhmikosR's avatar
XhmikosR committed
4707
      var link = SelectorEngine.findOne(queries.join(','));
Mark Otto's avatar
dist    
Mark Otto committed
4708

XhmikosR's avatar
XhmikosR committed
4709
4710
4711
      if (link.classList.contains(ClassName$8.DROPDOWN_ITEM)) {
        SelectorEngine.findOne(Selector$8.DROPDOWN_TOGGLE, SelectorEngine.closest(link, Selector$8.DROPDOWN)).classList.add(ClassName$8.ACTIVE);
        link.classList.add(ClassName$8.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
4712
4713
      } else {
        // Set triggered link as active
XhmikosR's avatar
XhmikosR committed
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
        link.classList.add(ClassName$8.ACTIVE);
        SelectorEngine.parents(link, Selector$8.NAV_LIST_GROUP).forEach(function (listGroup) {
          // Set triggered links parents as active
          // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
          SelectorEngine.prev(listGroup, Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).forEach(function (item) {
            return item.classList.add(ClassName$8.ACTIVE);
          }); // Handle special case when .nav-link is inside .nav-item

          SelectorEngine.prev(listGroup, Selector$8.NAV_ITEMS).forEach(function (navItem) {
            SelectorEngine.children(navItem, Selector$8.NAV_LINKS).forEach(function (item) {
              return item.classList.add(ClassName$8.ACTIVE);
            });
          });
        });
XhmikosR's avatar
Dist    
XhmikosR committed
4728
      }
Mark Otto's avatar
dist    
Mark Otto committed
4729

XhmikosR's avatar
XhmikosR committed
4730
      EventHandler.trigger(this._scrollElement, Event$9.ACTIVATE, {
XhmikosR's avatar
Dist    
XhmikosR committed
4731
4732
4733
        relatedTarget: target
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
4734

XhmikosR's avatar
Dist    
XhmikosR committed
4735
    _proto._clear = function _clear() {
XhmikosR's avatar
XhmikosR committed
4736
      makeArray(SelectorEngine.find(this._selector)).filter(function (node) {
XhmikosR's avatar
Dist    
XhmikosR committed
4737
4738
4739
4740
        return node.classList.contains(ClassName$8.ACTIVE);
      }).forEach(function (node) {
        return node.classList.remove(ClassName$8.ACTIVE);
      });
Mark Otto's avatar
Mark Otto committed
4741
4742
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
4743

XhmikosR's avatar
XhmikosR committed
4744
    ScrollSpy.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
4745
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4746
        var data = Data.getData(this, DATA_KEY$8);
Jacob Thornton's avatar
Jacob Thornton committed
4747

XhmikosR's avatar
Dist    
XhmikosR committed
4748
        var _config = typeof config === 'object' && config;
Mark Otto's avatar
dist    
Mark Otto committed
4749

XhmikosR's avatar
Dist    
XhmikosR committed
4750
4751
        if (!data) {
          data = new ScrollSpy(this, _config);
Mark Otto's avatar
dist    
Mark Otto committed
4752
        }
Mark Otto's avatar
dist    
Mark Otto committed
4753

XhmikosR's avatar
Dist    
XhmikosR committed
4754
4755
4756
4757
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
          }
Mark Otto's avatar
grunt    
Mark Otto committed
4758

XhmikosR's avatar
Dist    
XhmikosR committed
4759
4760
4761
4762
          data[config]();
        }
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
4763

XhmikosR's avatar
XhmikosR committed
4764
    ScrollSpy.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
4765
4766
4767
      return Data.getData(element, DATA_KEY$8);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
    _createClass(ScrollSpy, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$8;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$6;
      }
    }]);
Mark Otto's avatar
grunt    
Mark Otto committed
4779

XhmikosR's avatar
Dist    
XhmikosR committed
4780
4781
4782
4783
4784
4785
4786
    return ScrollSpy;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
4787
4788


XhmikosR's avatar
XhmikosR committed
4789
4790
4791
4792
  EventHandler.on(window, Event$9.LOAD_DATA_API, function () {
    makeArray(SelectorEngine.find(Selector$8.DATA_SPY)).forEach(function (spy) {
      return new ScrollSpy(spy, Manipulator.getDataAttributes(spy));
    });
XhmikosR's avatar
Dist    
XhmikosR committed
4793
  });
XhmikosR's avatar
XhmikosR committed
4794
  var $$9 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
4795
4796
4797
4798
4799
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
4800

4801
4802
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4803
4804
4805
4806
  if ($$9) {
    var JQUERY_NO_CONFLICT$8 = $$9.fn[NAME$8];
    $$9.fn[NAME$8] = ScrollSpy.jQueryInterface;
    $$9.fn[NAME$8].Constructor = ScrollSpy;
Jacob Thornton's avatar
Jacob Thornton committed
4807

XhmikosR's avatar
XhmikosR committed
4808
4809
4810
    $$9.fn[NAME$8].noConflict = function () {
      $$9.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
      return ScrollSpy.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
4811
4812
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
4813

XhmikosR's avatar
Dist    
XhmikosR committed
4814
4815
4816
4817
4818
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
4819

XhmikosR's avatar
Dist    
XhmikosR committed
4820
  var NAME$9 = 'tab';
XhmikosR's avatar
XhmikosR committed
4821
  var VERSION$9 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
4822
4823
4824
  var DATA_KEY$9 = 'bs.tab';
  var EVENT_KEY$9 = "." + DATA_KEY$9;
  var DATA_API_KEY$7 = '.data-api';
XhmikosR's avatar
XhmikosR committed
4825
  var Event$a = {
XhmikosR's avatar
Dist    
XhmikosR committed
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
    HIDE: "hide" + EVENT_KEY$9,
    HIDDEN: "hidden" + EVENT_KEY$9,
    SHOW: "show" + EVENT_KEY$9,
    SHOWN: "shown" + EVENT_KEY$9,
    CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  };
  var ClassName$9 = {
    DROPDOWN_MENU: 'dropdown-menu',
    ACTIVE: 'active',
    DISABLED: 'disabled',
    FADE: 'fade',
    SHOW: 'show'
  };
  var Selector$9 = {
    DROPDOWN: '.dropdown',
    NAV_LIST_GROUP: '.nav, .list-group',
    ACTIVE: '.active',
XhmikosR's avatar
XhmikosR committed
4843
    ACTIVE_UL: ':scope > li > .active',
XhmikosR's avatar
Dist    
XhmikosR committed
4844
4845
    DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
    DROPDOWN_TOGGLE: '.dropdown-toggle',
XhmikosR's avatar
XhmikosR committed
4846
    DROPDOWN_ACTIVE_CHILD: ':scope > .dropdown-menu .active'
XhmikosR's avatar
Dist    
XhmikosR committed
4847
4848
4849
4850
4851
    /**
     * ------------------------------------------------------------------------
     * Class Definition
     * ------------------------------------------------------------------------
     */
Mark Otto's avatar
dist    
Mark Otto committed
4852

XhmikosR's avatar
Dist    
XhmikosR committed
4853
  };
Mark Otto's avatar
dist    
Mark Otto committed
4854

XhmikosR's avatar
Dist    
XhmikosR committed
4855
4856
4857
4858
4859
  var Tab =
  /*#__PURE__*/
  function () {
    function Tab(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
4860
      Data.setData(this._element, DATA_KEY$9, this);
XhmikosR's avatar
Dist    
XhmikosR committed
4861
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
4862

Mark Otto's avatar
dist    
Mark Otto committed
4863

XhmikosR's avatar
Dist    
XhmikosR committed
4864
    var _proto = Tab.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
4865

XhmikosR's avatar
Dist    
XhmikosR committed
4866
4867
4868
    // Public
    _proto.show = function show() {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
4869

XhmikosR's avatar
XhmikosR committed
4870
      if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(ClassName$9.ACTIVE) || this._element.classList.contains(ClassName$9.DISABLED)) {
XhmikosR's avatar
Dist    
XhmikosR committed
4871
4872
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
4873

XhmikosR's avatar
Dist    
XhmikosR committed
4874
      var previous;
XhmikosR's avatar
XhmikosR committed
4875
      var target = getElementFromSelector(this._element);
XhmikosR's avatar
XhmikosR committed
4876
      var listElement = SelectorEngine.closest(this._element, Selector$9.NAV_LIST_GROUP);
XhmikosR's avatar
Dist    
XhmikosR committed
4877
4878

      if (listElement) {
XhmikosR's avatar
Dist    
XhmikosR committed
4879
        var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
XhmikosR's avatar
XhmikosR committed
4880
        previous = makeArray(SelectorEngine.find(itemSelector, listElement));
XhmikosR's avatar
Dist    
XhmikosR committed
4881
4882
        previous = previous[previous.length - 1];
      }
Mark Otto's avatar
grunt    
Mark Otto committed
4883

XhmikosR's avatar
XhmikosR committed
4884
      var hideEvent = null;
Mark Otto's avatar
dist    
Mark Otto committed
4885

XhmikosR's avatar
Dist    
XhmikosR committed
4886
      if (previous) {
XhmikosR's avatar
XhmikosR committed
4887
4888
4889
        hideEvent = EventHandler.trigger(previous, Event$a.HIDE, {
          relatedTarget: this._element
        });
XhmikosR's avatar
Dist    
XhmikosR committed
4890
      }
Mark Otto's avatar
dist    
Mark Otto committed
4891

XhmikosR's avatar
XhmikosR committed
4892
4893
4894
      var showEvent = EventHandler.trigger(this._element, Event$a.SHOW, {
        relatedTarget: previous
      });
Jacob Thornton's avatar
Jacob Thornton committed
4895

XhmikosR's avatar
XhmikosR committed
4896
      if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
4897
4898
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
4899

XhmikosR's avatar
Dist    
XhmikosR committed
4900
      this._activate(this._element, listElement);
Johann-S's avatar
build    
Johann-S committed
4901

XhmikosR's avatar
Dist    
XhmikosR committed
4902
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
4903
        EventHandler.trigger(previous, Event$a.HIDDEN, {
XhmikosR's avatar
Dist    
XhmikosR committed
4904
          relatedTarget: _this._element
Mark Otto's avatar
dist    
Mark Otto committed
4905
        });
XhmikosR's avatar
XhmikosR committed
4906
        EventHandler.trigger(_this._element, Event$a.SHOWN, {
XhmikosR's avatar
Dist    
XhmikosR committed
4907
4908
          relatedTarget: previous
        });
Mark Otto's avatar
dist    
Mark Otto committed
4909
      };
Johann-S's avatar
build    
Johann-S committed
4910

XhmikosR's avatar
Dist    
XhmikosR committed
4911
4912
4913
4914
4915
4916
      if (target) {
        this._activate(target, target.parentNode, complete);
      } else {
        complete();
      }
    };
Johann-S's avatar
build    
Johann-S committed
4917

XhmikosR's avatar
Dist    
XhmikosR committed
4918
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
4919
      Data.removeData(this._element, DATA_KEY$9);
XhmikosR's avatar
Dist    
XhmikosR committed
4920
      this._element = null;
Mark Otto's avatar
Mark Otto committed
4921
4922
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
4923

XhmikosR's avatar
Dist    
XhmikosR committed
4924
4925
    _proto._activate = function _activate(element, container, callback) {
      var _this2 = this;
Jacob Thornton's avatar
Jacob Thornton committed
4926

XhmikosR's avatar
XhmikosR committed
4927
      var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(Selector$9.ACTIVE_UL, container) : SelectorEngine.children(container, Selector$9.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
4928
      var active = activeElements[0];
XhmikosR's avatar
XhmikosR committed
4929
      var isTransitioning = callback && active && active.classList.contains(ClassName$9.FADE);
XhmikosR's avatar
Dist    
XhmikosR committed
4930
4931
4932

      var complete = function complete() {
        return _this2._transitionComplete(element, active, callback);
Mark Otto's avatar
dist    
Mark Otto committed
4933
      };
Mark Otto's avatar
dist    
Mark Otto committed
4934

XhmikosR's avatar
Dist    
XhmikosR committed
4935
      if (active && isTransitioning) {
XhmikosR's avatar
XhmikosR committed
4936
4937
4938
4939
        var transitionDuration = getTransitionDurationFromElement(active);
        active.classList.remove(ClassName$9.SHOW);
        EventHandler.one(active, TRANSITION_END, complete);
        emulateTransitionEnd(active, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
4940
4941
4942
4943
4944
4945
4946
      } else {
        complete();
      }
    };

    _proto._transitionComplete = function _transitionComplete(element, active, callback) {
      if (active) {
XhmikosR's avatar
XhmikosR committed
4947
4948
        active.classList.remove(ClassName$9.ACTIVE);
        var dropdownChild = SelectorEngine.findOne(Selector$9.DROPDOWN_ACTIVE_CHILD, active.parentNode);
XhmikosR's avatar
Dist    
XhmikosR committed
4949
4950

        if (dropdownChild) {
XhmikosR's avatar
XhmikosR committed
4951
          dropdownChild.classList.remove(ClassName$9.ACTIVE);
Mark Otto's avatar
grunt    
Mark Otto committed
4952
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4953
4954
4955

        if (active.getAttribute('role') === 'tab') {
          active.setAttribute('aria-selected', false);
Mark Otto's avatar
dist    
Mark Otto committed
4956
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4957
      }
Mark Otto's avatar
dist    
Mark Otto committed
4958

XhmikosR's avatar
XhmikosR committed
4959
      element.classList.add(ClassName$9.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
4960
4961
4962
4963

      if (element.getAttribute('role') === 'tab') {
        element.setAttribute('aria-selected', true);
      }
Mark Otto's avatar
dist    
Mark Otto committed
4964

XhmikosR's avatar
XhmikosR committed
4965
      reflow(element);
Mark Otto's avatar
Mark Otto committed
4966
4967
4968
4969

      if (element.classList.contains(ClassName$9.FADE)) {
        element.classList.add(ClassName$9.SHOW);
      }
Mark Otto's avatar
dist    
Mark Otto committed
4970

XhmikosR's avatar
XhmikosR committed
4971
4972
      if (element.parentNode && element.parentNode.classList.contains(ClassName$9.DROPDOWN_MENU)) {
        var dropdownElement = SelectorEngine.closest(element, Selector$9.DROPDOWN);
Mark Otto's avatar
dist    
Mark Otto committed
4973

XhmikosR's avatar
Dist    
XhmikosR committed
4974
        if (dropdownElement) {
XhmikosR's avatar
XhmikosR committed
4975
4976
4977
          makeArray(SelectorEngine.find(Selector$9.DROPDOWN_TOGGLE)).forEach(function (dropdown) {
            return dropdown.classList.add(ClassName$9.ACTIVE);
          });
XhmikosR's avatar
Dist    
XhmikosR committed
4978
        }
Jacob Thornton's avatar
Jacob Thornton committed
4979

XhmikosR's avatar
Dist    
XhmikosR committed
4980
        element.setAttribute('aria-expanded', true);
Mark Otto's avatar
dist    
Mark Otto committed
4981
      }
Mark Otto's avatar
dist    
Mark Otto committed
4982

XhmikosR's avatar
Dist    
XhmikosR committed
4983
4984
4985
      if (callback) {
        callback();
      }
Mark Otto's avatar
Mark Otto committed
4986
4987
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
4988

XhmikosR's avatar
XhmikosR committed
4989
    Tab.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
4990
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4991
        var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
XhmikosR's avatar
Dist    
XhmikosR committed
4992
4993
4994
4995
4996
4997
4998
4999
5000

        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
          }

          data[config]();
        }
      });
Mark Otto's avatar
dist    
Mark Otto committed
5001
    };
Jacob Thornton's avatar
Jacob Thornton committed
5002

XhmikosR's avatar
XhmikosR committed
5003
    Tab.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
5004
5005
5006
      return Data.getData(element, DATA_KEY$9);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
    _createClass(Tab, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$9;
      }
    }]);

    return Tab;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


XhmikosR's avatar
XhmikosR committed
5023
  EventHandler.on(document, Event$a.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
5024
    event.preventDefault();
XhmikosR's avatar
XhmikosR committed
5025
5026
    var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
    data.show();
XhmikosR's avatar
Dist    
XhmikosR committed
5027
  });
XhmikosR's avatar
XhmikosR committed
5028
  var $$a = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
5029
5030
5031
5032
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
5033
   * add .tab to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
5034
5035
   */

5036
5037
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
5038
5039
5040
5041
  if ($$a) {
    var JQUERY_NO_CONFLICT$9 = $$a.fn[NAME$9];
    $$a.fn[NAME$9] = Tab.jQueryInterface;
    $$a.fn[NAME$9].Constructor = Tab;
XhmikosR's avatar
Dist    
XhmikosR committed
5042

XhmikosR's avatar
XhmikosR committed
5043
5044
5045
    $$a.fn[NAME$9].noConflict = function () {
      $$a.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
      return Tab.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
5046
5047
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
5048
5049

  /**
XhmikosR's avatar
Dist    
XhmikosR committed
5050
5051
5052
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
Jacob Thornton's avatar
Jacob Thornton committed
5053
   */
Mark Otto's avatar
dist    
Mark Otto committed
5054

XhmikosR's avatar
Dist    
XhmikosR committed
5055
  var NAME$a = 'toast';
XhmikosR's avatar
XhmikosR committed
5056
  var VERSION$a = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
5057
5058
  var DATA_KEY$a = 'bs.toast';
  var EVENT_KEY$a = "." + DATA_KEY$a;
XhmikosR's avatar
XhmikosR committed
5059
  var Event$b = {
XhmikosR's avatar
Dist    
XhmikosR committed
5060
5061
5062
5063
5064
5065
5066
5067
5068
    CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
    HIDE: "hide" + EVENT_KEY$a,
    HIDDEN: "hidden" + EVENT_KEY$a,
    SHOW: "show" + EVENT_KEY$a,
    SHOWN: "shown" + EVENT_KEY$a
  };
  var ClassName$a = {
    FADE: 'fade',
    HIDE: 'hide',
Mark Otto's avatar
dist    
Mark Otto committed
5069
5070
    SHOW: 'show',
    SHOWING: 'showing'
XhmikosR's avatar
Dist    
XhmikosR committed
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
  };
  var DefaultType$7 = {
    animation: 'boolean',
    autohide: 'boolean',
    delay: 'number'
  };
  var Default$7 = {
    animation: true,
    autohide: true,
    delay: 500
  };
  var Selector$a = {
    DATA_DISMISS: '[data-dismiss="toast"]'
Mark Otto's avatar
dist    
Mark Otto committed
5084
5085
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
5086
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
5087
5088
     * ------------------------------------------------------------------------
     */
XhmikosR's avatar
Dist    
XhmikosR committed
5089

XhmikosR's avatar
Dist    
XhmikosR committed
5090
  };
Jacob Thornton's avatar
Jacob Thornton committed
5091

XhmikosR's avatar
Dist    
XhmikosR committed
5092
5093
5094
5095
5096
5097
5098
  var Toast =
  /*#__PURE__*/
  function () {
    function Toast(element, config) {
      this._element = element;
      this._config = this._getConfig(config);
      this._timeout = null;
Jacob Thornton's avatar
Jacob Thornton committed
5099

XhmikosR's avatar
Dist    
XhmikosR committed
5100
      this._setListeners();
XhmikosR's avatar
XhmikosR committed
5101
5102

      Data.setData(element, DATA_KEY$a, this);
XhmikosR's avatar
Dist    
XhmikosR committed
5103
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
5104

Johann-S's avatar
build    
Johann-S committed
5105

XhmikosR's avatar
Dist    
XhmikosR committed
5106
    var _proto = Toast.prototype;
XhmikosR's avatar
Dist    
XhmikosR committed
5107

XhmikosR's avatar
Dist    
XhmikosR committed
5108
5109
5110
    // Public
    _proto.show = function show() {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
5111

Mark Otto's avatar
dist v5    
Mark Otto committed
5112
5113
5114
5115
5116
      var showEvent = EventHandler.trigger(this._element, Event$b.SHOW);

      if (showEvent.defaultPrevented) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
5117

XhmikosR's avatar
Dist    
XhmikosR committed
5118
5119
5120
      if (this._config.animation) {
        this._element.classList.add(ClassName$a.FADE);
      }
Mark Otto's avatar
dist    
Mark Otto committed
5121

XhmikosR's avatar
Dist    
XhmikosR committed
5122
      var complete = function complete() {
Mark Otto's avatar
dist    
Mark Otto committed
5123
5124
5125
5126
        _this._element.classList.remove(ClassName$a.SHOWING);

        _this._element.classList.add(ClassName$a.SHOW);

XhmikosR's avatar
XhmikosR committed
5127
        EventHandler.trigger(_this._element, Event$b.SHOWN);
Mark Otto's avatar
dist    
Mark Otto committed
5128

XhmikosR's avatar
Dist    
XhmikosR committed
5129
        if (_this._config.autohide) {
XhmikosR's avatar
XhmikosR committed
5130
5131
5132
          _this._timeout = setTimeout(function () {
            _this.hide();
          }, _this._config.delay);
Mark Otto's avatar
dist    
Mark Otto committed
5133
        }
XhmikosR's avatar
Dist    
XhmikosR committed
5134
      };
Mark Otto's avatar
dist    
Mark Otto committed
5135

Mark Otto's avatar
dist    
Mark Otto committed
5136
5137
      this._element.classList.remove(ClassName$a.HIDE);

5138
5139
      reflow(this._element);

Mark Otto's avatar
dist    
Mark Otto committed
5140
      this._element.classList.add(ClassName$a.SHOWING);
Mark Otto's avatar
dist    
Mark Otto committed
5141

XhmikosR's avatar
Dist    
XhmikosR committed
5142
      if (this._config.animation) {
XhmikosR's avatar
XhmikosR committed
5143
5144
5145
        var transitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, complete);
        emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
5146
5147
5148
5149
      } else {
        complete();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
5150

XhmikosR's avatar
XhmikosR committed
5151
    _proto.hide = function hide() {
XhmikosR's avatar
Dist    
XhmikosR committed
5152
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
5153

XhmikosR's avatar
Dist    
XhmikosR committed
5154
5155
5156
      if (!this._element.classList.contains(ClassName$a.SHOW)) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
5157

Mark Otto's avatar
dist v5    
Mark Otto committed
5158
5159
5160
5161
5162
      var hideEvent = EventHandler.trigger(this._element, Event$b.HIDE);

      if (hideEvent.defaultPrevented) {
        return;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
5163

XhmikosR's avatar
XhmikosR committed
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
      var complete = function complete() {
        _this2._element.classList.add(ClassName$a.HIDE);

        EventHandler.trigger(_this2._element, Event$b.HIDDEN);
      };

      this._element.classList.remove(ClassName$a.SHOW);

      if (this._config.animation) {
        var transitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, complete);
        emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
5176
      } else {
XhmikosR's avatar
XhmikosR committed
5177
        complete();
XhmikosR's avatar
Dist    
XhmikosR committed
5178
5179
      }
    };
XhmikosR's avatar
Dist    
XhmikosR committed
5180

XhmikosR's avatar
Dist    
XhmikosR committed
5181
5182
5183
    _proto.dispose = function dispose() {
      clearTimeout(this._timeout);
      this._timeout = null;
Mark Otto's avatar
dist    
Mark Otto committed
5184

XhmikosR's avatar
Dist    
XhmikosR committed
5185
5186
5187
      if (this._element.classList.contains(ClassName$a.SHOW)) {
        this._element.classList.remove(ClassName$a.SHOW);
      }
Jacob Thornton's avatar
Jacob Thornton committed
5188

XhmikosR's avatar
XhmikosR committed
5189
5190
      EventHandler.off(this._element, Event$b.CLICK_DISMISS);
      Data.removeData(this._element, DATA_KEY$a);
XhmikosR's avatar
Dist    
XhmikosR committed
5191
5192
      this._element = null;
      this._config = null;
Mark Otto's avatar
Mark Otto committed
5193
5194
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
5195

XhmikosR's avatar
Dist    
XhmikosR committed
5196
    _proto._getConfig = function _getConfig(config) {
5197
      config = _objectSpread2({}, Default$7, {}, Manipulator.getDataAttributes(this._element), {}, typeof config === 'object' && config ? config : {});
XhmikosR's avatar
XhmikosR committed
5198
      typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
5199
5200
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
5201

XhmikosR's avatar
Dist    
XhmikosR committed
5202
5203
    _proto._setListeners = function _setListeners() {
      var _this3 = this;
Mark Otto's avatar
dist    
Mark Otto committed
5204

XhmikosR's avatar
XhmikosR committed
5205
      EventHandler.on(this._element, Event$b.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
XhmikosR's avatar
XhmikosR committed
5206
        return _this3.hide();
XhmikosR's avatar
Dist    
XhmikosR committed
5207
      });
Mark Otto's avatar
Mark Otto committed
5208
5209
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
5210

XhmikosR's avatar
XhmikosR committed
5211
    Toast.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
5212
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
5213
        var data = Data.getData(this, DATA_KEY$a);
Jacob Thornton's avatar
Jacob Thornton committed
5214

XhmikosR's avatar
Dist    
XhmikosR committed
5215
5216
5217
5218
5219
        var _config = typeof config === 'object' && config;

        if (!data) {
          data = new Toast(this, _config);
        }
Jacob Thornton's avatar
Jacob Thornton committed
5220

XhmikosR's avatar
Dist    
XhmikosR committed
5221
5222
5223
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
grunt    
Mark Otto committed
5224
          }
Mark Otto's avatar
dist    
Mark Otto committed
5225

XhmikosR's avatar
Dist    
XhmikosR committed
5226
          data[config](this);
XhmikosR's avatar
Dist    
XhmikosR committed
5227
        }
XhmikosR's avatar
Dist    
XhmikosR committed
5228
5229
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
5230

XhmikosR's avatar
XhmikosR committed
5231
    Toast.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
5232
5233
5234
      return Data.getData(element, DATA_KEY$a);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
    _createClass(Toast, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$a;
      }
    }, {
      key: "DefaultType",
      get: function get() {
        return DefaultType$7;
      }
Mark Otto's avatar
Mark Otto committed
5245
5246
5247
5248
5249
    }, {
      key: "Default",
      get: function get() {
        return Default$7;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
5250
    }]);
Jacob Thornton's avatar
Jacob Thornton committed
5251

XhmikosR's avatar
Dist    
XhmikosR committed
5252
5253
    return Toast;
  }();
XhmikosR's avatar
XhmikosR committed
5254
5255

  var $$b = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
5256
5257
5258
5259
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
5260
   *  add .toast to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
5261
   */
XhmikosR's avatar
Dist    
XhmikosR committed
5262

5263
5264
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
5265
5266
5267
5268
  if ($$b) {
    var JQUERY_NO_CONFLICT$a = $$b.fn[NAME$a];
    $$b.fn[NAME$a] = Toast.jQueryInterface;
    $$b.fn[NAME$a].Constructor = Toast;
Mark Otto's avatar
dist    
Mark Otto committed
5269

XhmikosR's avatar
XhmikosR committed
5270
5271
5272
    $$b.fn[NAME$a].noConflict = function () {
      $$b.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
      return Toast.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
5273
5274
    };
  }
Mark Otto's avatar
grunt    
Mark Otto committed
5275

Mark Otto's avatar
dist    
Mark Otto committed
5276
5277
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
Dist.    
XhmikosR committed
5278
   * Bootstrap (v4.3.1): index.umd.js
Mark Otto's avatar
dist    
Mark Otto committed
5279
5280
5281
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist.    
XhmikosR committed
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
  var index_umd = {
    Alert: Alert,
    Button: Button,
    Carousel: Carousel,
    Collapse: Collapse,
    Dropdown: Dropdown,
    Modal: Modal,
    Popover: Popover,
    ScrollSpy: ScrollSpy,
    Tab: Tab,
    Toast: Toast,
    Tooltip: Tooltip
  };
Mark Otto's avatar
dist    
Mark Otto committed
5295

XhmikosR's avatar
Dist.    
XhmikosR committed
5296
  return index_umd;
Mark Otto's avatar
dist    
Mark Otto committed
5297

Mark Otto's avatar
Mark Otto committed
5298
}));
Mark Otto's avatar
dist    
Mark Otto committed
5299
//# sourceMappingURL=bootstrap.js.map