bootstrap.js 152 KB
Newer Older
1
/*!
2
  * Bootstrap v5.0.0-alpha1 (https://getbootstrap.com/)
XhmikosR's avatar
XhmikosR committed
3
  * Copyright 2011-2020 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
  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));
XhmikosR's avatar
XhmikosR committed
10
}(this, (function (Popper) { 'use strict';
Mark Otto's avatar
grunt    
Mark Otto committed
11

XhmikosR's avatar
XhmikosR committed
12
  Popper = Popper && Object.prototype.hasOwnProperty.call(Popper, '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
      if (i % 2) {
XhmikosR's avatar
XhmikosR committed
64
        ownKeys(Object(source), true).forEach(function (key) {
65
66
67
68
69
          _defineProperty(target, key, source[key]);
        });
      } else if (Object.getOwnPropertyDescriptors) {
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
      } else {
XhmikosR's avatar
XhmikosR committed
70
        ownKeys(Object(source)).forEach(function (key) {
71
72
          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
  }

  /**
   * --------------------------------------------------------------------------
87
   * Bootstrap (v5.0.0-alpha1): 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

  var toType = function toType(obj) {
XhmikosR's avatar
XhmikosR committed
96
97
98
99
    if (obj === null || obj === undefined) {
      return "" + obj;
    }

XhmikosR's avatar
XhmikosR committed
100
101
    return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  };
XhmikosR's avatar
Dist    
XhmikosR committed
102
  /**
XhmikosR's avatar
XhmikosR committed
103
104
105
   * --------------------------------------------------------------------------
   * Public Util Api
   * --------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
106
   */
Mark Otto's avatar
dist    
Mark Otto committed
107

Jacob Thornton's avatar
Jacob Thornton committed
108

XhmikosR's avatar
XhmikosR committed
109
110
111
112
  var getUID = function getUID(prefix) {
    do {
      prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
    } while (document.getElementById(prefix));
Mark Otto's avatar
dist    
Mark Otto committed
113

XhmikosR's avatar
XhmikosR committed
114
115
    return prefix;
  };
Mark Otto's avatar
dist    
Mark Otto committed
116

XhmikosR's avatar
XhmikosR committed
117
  var getSelector = function getSelector(element) {
XhmikosR's avatar
XhmikosR committed
118
119
120
121
    var selector = element.getAttribute('data-target');

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

XhmikosR's avatar
XhmikosR committed
125
126
127
128
129
130
131
    return selector;
  };

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

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

    return null;
  };

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

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

Mark Otto's avatar
dist    
Mark Otto committed
148

XhmikosR's avatar
XhmikosR committed
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
    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
167
    element.dispatchEvent(new Event(TRANSITION_END));
XhmikosR's avatar
XhmikosR committed
168
169
170
171
172
173
174
  };

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

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

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

    element.addEventListener(TRANSITION_END, listener);
XhmikosR's avatar
Dist    
XhmikosR committed
185
186
    setTimeout(function () {
      if (!called) {
XhmikosR's avatar
XhmikosR committed
187
        triggerTransitionEnd(element);
XhmikosR's avatar
Dist    
XhmikosR committed
188
      }
XhmikosR's avatar
XhmikosR committed
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
    }, 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 isVisible = function isVisible(element) {
    if (!element) {
      return false;
    }

    if (element.style && element.parentNode && element.parentNode.style) {
XhmikosR's avatar
XhmikosR committed
210
211
212
      var elementStyle = getComputedStyle(element);
      var parentNodeStyle = getComputedStyle(element.parentNode);
      return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
XhmikosR's avatar
XhmikosR committed
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
    }

    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);
XhmikosR's avatar
XhmikosR committed
239
  };
XhmikosR's avatar
XhmikosR committed
240
241
242
243
244
245
246
247

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

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

XhmikosR's avatar
XhmikosR committed
249
250
251
252
253
254
255
256
257
258
259
  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
260
261
  /**
   * --------------------------------------------------------------------------
262
   * Bootstrap (v5.0.0-alpha1): dom/data.js
XhmikosR's avatar
XhmikosR committed
263
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
XhmikosR's avatar
Dist    
XhmikosR committed
264
265
   * --------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
266

XhmikosR's avatar
XhmikosR committed
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
  /**
   * ------------------------------------------------------------------------
   * 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
291

XhmikosR's avatar
XhmikosR committed
292
        var keyProperties = element.key;
XhmikosR's avatar
Dist    
XhmikosR committed
293

XhmikosR's avatar
XhmikosR committed
294
295
296
297
298
299
300
301
302
303
        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
304

XhmikosR's avatar
XhmikosR committed
305
306
307
308
309
310
        var keyProperties = element.key;

        if (keyProperties.key === key) {
          delete storeData[keyProperties.id];
          delete element.key;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
311
      }
XhmikosR's avatar
XhmikosR committed
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
    };
  }();

  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
327
328
  /* istanbul ignore file */
  var find = Element.prototype.querySelectorAll;
XhmikosR's avatar
XhmikosR committed
329
  var findOne = Element.prototype.querySelector; // MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached
XhmikosR's avatar
XhmikosR committed
330

XhmikosR's avatar
XhmikosR committed
331
  var defaultPreventedPreservedOnDispatch = function () {
XhmikosR's avatar
XhmikosR committed
332
    var e = new CustomEvent('Bootstrap', {
XhmikosR's avatar
XhmikosR committed
333
334
335
336
337
338
339
340
341
342
      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
343

XhmikosR's avatar
XhmikosR committed
344
  var scopeSelectorRegex = /:scope\b/;
XhmikosR's avatar
XhmikosR committed
345

XhmikosR's avatar
XhmikosR committed
346
347
  var supportScopeQuery = function () {
    var element = document.createElement('div');
XhmikosR's avatar
XhmikosR committed
348

XhmikosR's avatar
XhmikosR committed
349
350
    try {
      element.querySelectorAll(':scope *');
XhmikosR's avatar
XhmikosR committed
351
    } catch (_) {
XhmikosR's avatar
XhmikosR committed
352
      return false;
XhmikosR's avatar
XhmikosR committed
353
354
    }

XhmikosR's avatar
XhmikosR committed
355
    return true;
XhmikosR's avatar
XhmikosR committed
356
357
  }();

XhmikosR's avatar
XhmikosR committed
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
  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
399
400
  /**
   * --------------------------------------------------------------------------
401
   * Bootstrap (v5.0.0-alpha1): dom/event-handler.js
XhmikosR's avatar
XhmikosR committed
402
403
404
405
406
407
408
409
410
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

XhmikosR's avatar
XhmikosR committed
411
  var $ = getjQuery();
XhmikosR's avatar
XhmikosR committed
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
  var namespaceRegex = /[^.]*(?=\..*)\.|.*/;
  var stripNameRegex = /\..*/;
  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
436
437
    eventRegistry[uid] = eventRegistry[uid] || {};
    return eventRegistry[uid];
XhmikosR's avatar
XhmikosR committed
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
472
473
474
475
  }

  function bootstrapHandler(element, fn) {
    return function handler(event) {
      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) {
            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
476
477
478
479
    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
480
481

      if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
Mark Otto's avatar
dist v5    
Mark Otto committed
482
        return event;
XhmikosR's avatar
XhmikosR committed
483
484
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
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
      }
    }

    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
534
    var fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
XhmikosR's avatar
XhmikosR committed
535
536
537
538
539
540
541
542
543
544
545
    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
546
    if (!fn) {
XhmikosR's avatar
XhmikosR committed
547
548
549
550
551
552
553
554
555
556
557
558
559
      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
560
      }
XhmikosR's avatar
XhmikosR committed
561
562
563
564
565
566
    });
  }

  var EventHandler = {
    on: function on(element, event, handler, delegationFn) {
      addHandler(element, event, handler, delegationFn, false);
XhmikosR's avatar
Dist    
XhmikosR committed
567
    },
XhmikosR's avatar
XhmikosR committed
568
569
570
571
572
573
574
    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
575

XhmikosR's avatar
XhmikosR committed
576
577
578
579
      var _normalizeParams2 = normalizeParams(originalTypeEvent, handler, delegationFn),
          delegation = _normalizeParams2[0],
          originalHandler = _normalizeParams2[1],
          typeEvent = _normalizeParams2[2];
XhmikosR's avatar
Dist    
XhmikosR committed
580

XhmikosR's avatar
XhmikosR committed
581
582
583
      var inNamespace = typeEvent !== originalTypeEvent;
      var events = getEvent(element);
      var isNamespace = originalTypeEvent.charAt(0) === '.';
XhmikosR's avatar
Dist    
XhmikosR committed
584

XhmikosR's avatar
XhmikosR committed
585
586
587
588
589
      if (typeof originalHandler !== 'undefined') {
        // Simplest case: handler is passed, remove that listener ONLY.
        if (!events || !events[typeEvent]) {
          return;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
590

XhmikosR's avatar
XhmikosR committed
591
592
593
        removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
        return;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
594

XhmikosR's avatar
XhmikosR committed
595
596
      if (isNamespace) {
        Object.keys(events).forEach(function (elementEvent) {
XhmikosR's avatar
XhmikosR committed
597
          removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
XhmikosR's avatar
XhmikosR committed
598
599
600
601
602
603
604
605
606
607
608
609
        });
      }

      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
610
    },
XhmikosR's avatar
XhmikosR committed
611
612
613
614
615
616
617
618
619
620
621
622
623
624
    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
625
626
627
      if (inNamespace && $) {
        jQueryEvent = $.Event(event, args);
        $(element).trigger(jQueryEvent);
XhmikosR's avatar
XhmikosR committed
628
629
630
631
632
633
634
635
636
        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
637
        evt = new CustomEvent(event, {
XhmikosR's avatar
XhmikosR committed
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
          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
657
        if (!defaultPreventedPreservedOnDispatch) {
XhmikosR's avatar
XhmikosR committed
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
          Object.defineProperty(evt, 'defaultPrevented', {
            get: function get() {
              return true;
            }
          });
        }
      }

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

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

      return evt;
    }
  };

XhmikosR's avatar
Dist    
XhmikosR committed
678
679
680
681
682
683
684
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME = 'alert';
685
  var VERSION = '5.0.0-alpha1';
XhmikosR's avatar
Dist    
XhmikosR committed
686
687
688
  var DATA_KEY = 'bs.alert';
  var EVENT_KEY = "." + DATA_KEY;
  var DATA_API_KEY = '.data-api';
XhmikosR's avatar
XhmikosR committed
689
690
691
692
693
694
695
  var SELECTOR_DISMISS = '[data-dismiss="alert"]';
  var EVENT_CLOSE = "close" + EVENT_KEY;
  var EVENT_CLOSED = "closed" + EVENT_KEY;
  var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
  var CLASSNAME_ALERT = 'alert';
  var CLASSNAME_FADE = 'fade';
  var CLASSNAME_SHOW = 'show';
XhmikosR's avatar
XhmikosR committed
696
697
698
699
700
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
701

XhmikosR's avatar
XhmikosR committed
702
  var Alert = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
703
704
    function Alert(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
705
706
707
708

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


XhmikosR's avatar
Dist    
XhmikosR committed
712
    var _proto = Alert.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
713

XhmikosR's avatar
Dist    
XhmikosR committed
714
715
716
    // Public
    _proto.close = function close(element) {
      var rootElement = this._element;
Jacob Thornton's avatar
Jacob Thornton committed
717

XhmikosR's avatar
Dist    
XhmikosR committed
718
719
720
      if (element) {
        rootElement = this._getRootElement(element);
      }
Mark Otto's avatar
dist    
Mark Otto committed
721

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

XhmikosR's avatar
XhmikosR committed
724
      if (customEvent === null || customEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
725
726
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
727

XhmikosR's avatar
Dist    
XhmikosR committed
728
729
      this._removeElement(rootElement);
    };
Jacob Thornton's avatar
Jacob Thornton committed
730

XhmikosR's avatar
Dist    
XhmikosR committed
731
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
732
      Data.removeData(this._element, DATA_KEY);
XhmikosR's avatar
Dist    
XhmikosR committed
733
      this._element = null;
Mark Otto's avatar
Mark Otto committed
734
735
    } // Private
    ;
Jacob Thornton's avatar
Jacob Thornton committed
736

XhmikosR's avatar
Dist    
XhmikosR committed
737
    _proto._getRootElement = function _getRootElement(element) {
XhmikosR's avatar
XhmikosR committed
738
      return getElementFromSelector(element) || element.closest("." + CLASSNAME_ALERT);
XhmikosR's avatar
Dist    
XhmikosR committed
739
    };
Jacob Thornton's avatar
Jacob Thornton committed
740

XhmikosR's avatar
Dist    
XhmikosR committed
741
    _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
XhmikosR's avatar
XhmikosR committed
742
      return EventHandler.trigger(element, EVENT_CLOSE);
XhmikosR's avatar
Dist    
XhmikosR committed
743
    };
Jacob Thornton's avatar
Jacob Thornton committed
744

XhmikosR's avatar
Dist    
XhmikosR committed
745
746
    _proto._removeElement = function _removeElement(element) {
      var _this = this;
Mark Otto's avatar
grunt    
Mark Otto committed
747

XhmikosR's avatar
XhmikosR committed
748
      element.classList.remove(CLASSNAME_SHOW);
Jacob Thornton's avatar
Jacob Thornton committed
749

XhmikosR's avatar
XhmikosR committed
750
      if (!element.classList.contains(CLASSNAME_FADE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
751
        this._destroyElement(element);
Mark Otto's avatar
dist    
Mark Otto committed
752

XhmikosR's avatar
Dist    
XhmikosR committed
753
754
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
755

XhmikosR's avatar
XhmikosR committed
756
      var transitionDuration = getTransitionDurationFromElement(element);
757
758
      EventHandler.one(element, TRANSITION_END, function () {
        return _this._destroyElement(element);
XhmikosR's avatar
XhmikosR committed
759
760
      });
      emulateTransitionEnd(element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
761
    };
Jacob Thornton's avatar
Jacob Thornton committed
762

XhmikosR's avatar
Dist    
XhmikosR committed
763
    _proto._destroyElement = function _destroyElement(element) {
XhmikosR's avatar
XhmikosR committed
764
765
766
767
      if (element.parentNode) {
        element.parentNode.removeChild(element);
      }

XhmikosR's avatar
XhmikosR committed
768
      EventHandler.trigger(element, EVENT_CLOSED);
Mark Otto's avatar
Mark Otto committed
769
770
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
771

XhmikosR's avatar
XhmikosR committed
772
    Alert.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
773
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
774
        var data = Data.getData(this, DATA_KEY);
Jacob Thornton's avatar
Jacob Thornton committed
775

XhmikosR's avatar
Dist    
XhmikosR committed
776
777
778
        if (!data) {
          data = new Alert(this);
        }
Jacob Thornton's avatar
Jacob Thornton committed
779

XhmikosR's avatar
Dist    
XhmikosR committed
780
781
782
783
784
        if (config === 'close') {
          data[config](this);
        }
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
785

XhmikosR's avatar
XhmikosR committed
786
    Alert.handleDismiss = function handleDismiss(alertInstance) {
XhmikosR's avatar
Dist    
XhmikosR committed
787
788
789
790
      return function (event) {
        if (event) {
          event.preventDefault();
        }
Jacob Thornton's avatar
Jacob Thornton committed
791

XhmikosR's avatar
Dist    
XhmikosR committed
792
        alertInstance.close(this);
Mark Otto's avatar
grunt    
Mark Otto committed
793
      };
XhmikosR's avatar
Dist    
XhmikosR committed
794
    };
Mark Otto's avatar
grunt    
Mark Otto committed
795

XhmikosR's avatar
XhmikosR committed
796
    Alert.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
797
798
799
      return Data.getData(element, DATA_KEY);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
800
801
802
803
804
805
    _createClass(Alert, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION;
      }
    }]);
Jacob Thornton's avatar
Jacob Thornton committed
806

XhmikosR's avatar
Dist    
XhmikosR committed
807
808
809
810
811
812
813
    return Alert;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
814

Mark Otto's avatar
dist    
Mark Otto committed
815

XhmikosR's avatar
XhmikosR committed
816
  EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
XhmikosR's avatar
XhmikosR committed
817
  var $$1 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
818
819
820
821
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
822
   * add .alert to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
823
   */
Jacob Thornton's avatar
Jacob Thornton committed
824

825
826
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
827
828
829
830
  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
831

XhmikosR's avatar
XhmikosR committed
832
833
834
    $$1.fn[NAME].noConflict = function () {
      $$1.fn[NAME] = JQUERY_NO_CONFLICT;
      return Alert.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
835
836
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
837

XhmikosR's avatar
XhmikosR committed
838
839
  /**
   * --------------------------------------------------------------------------
840
   * Bootstrap (v5.0.0-alpha1): dom/selector-engine.js
XhmikosR's avatar
XhmikosR committed
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NODE_TEXT = 3;
  var SelectorEngine = {
    matches: function matches(element, selector) {
      return element.matches(selector);
    },
    find: function find$1(selector, element) {
      var _ref;

      if (element === void 0) {
        element = document.documentElement;
      }

      return (_ref = []).concat.apply(_ref, find.call(element, selector));
    },
    findOne: function findOne$1(selector, element) {
      if (element === void 0) {
        element = document.documentElement;
      }

      return findOne.call(element, selector);
    },
    children: function children(element, selector) {
      var _ref2;

      var children = (_ref2 = []).concat.apply(_ref2, element.children);

      return children.filter(function (child) {
        return child.matches(selector);
      });
    },
    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);
        }

        ancestor = ancestor.parentNode;
      }

      return parents;
    },
    prev: function prev(element, selector) {
      var previous = element.previousElementSibling;

      while (previous) {
        if (previous.matches(selector)) {
          return [previous];
        }

        previous = previous.previousElementSibling;
      }

      return [];
    },
    next: function next(element, selector) {
      var next = element.nextElementSibling;

      while (next) {
        if (this.matches(next, selector)) {
          return [next];
        }

        next = next.nextElementSibling;
      }

      return [];
    }
  };

XhmikosR's avatar
Dist    
XhmikosR committed
922
923
924
925
926
927
928
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$1 = 'button';
929
  var VERSION$1 = '5.0.0-alpha1';
XhmikosR's avatar
Dist    
XhmikosR committed
930
931
932
  var DATA_KEY$1 = 'bs.button';
  var EVENT_KEY$1 = "." + DATA_KEY$1;
  var DATA_API_KEY$1 = '.data-api';
XhmikosR's avatar
XhmikosR committed
933
934
935
936
937
938
939
940
941
942
943
  var CLASS_NAME_ACTIVE = 'active';
  var CLASS_NAME_DISABLED = 'disabled';
  var CLASS_NAME_FOCUS = 'focus';
  var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]';
  var SELECTOR_DATA_TOGGLE = '[data-toggle="buttons"]';
  var SELECTOR_INPUT = 'input:not([type="hidden"])';
  var SELECTOR_ACTIVE = '.active';
  var SELECTOR_BUTTON = '.btn';
  var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1;
  var EVENT_FOCUS_DATA_API = "focus" + EVENT_KEY$1 + DATA_API_KEY$1;
  var EVENT_BLUR_DATA_API = "blur" + EVENT_KEY$1 + DATA_API_KEY$1;
XhmikosR's avatar
XhmikosR committed
944
945
946
947
948
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
949

XhmikosR's avatar
XhmikosR committed
950
  var Button = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
951
952
    function Button(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
953
      Data.setData(element, DATA_KEY$1, this);
XhmikosR's avatar
Dist    
XhmikosR committed
954
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
955
956


XhmikosR's avatar
Dist    
XhmikosR committed
957
    var _proto = Button.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
958

XhmikosR's avatar
Dist    
XhmikosR committed
959
960
961
962
    // Public
    _proto.toggle = function toggle() {
      var triggerChangeEvent = true;
      var addAriaPressed = true;
XhmikosR's avatar
XhmikosR committed
963
964

      var rootElement = this._element.closest(SELECTOR_DATA_TOGGLE);
XhmikosR's avatar
Dist    
XhmikosR committed
965
966

      if (rootElement) {
XhmikosR's avatar
XhmikosR committed
967
        var input = SelectorEngine.findOne(SELECTOR_INPUT, this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
968

XhmikosR's avatar
XhmikosR committed
969
        if (input && input.type === 'radio') {
XhmikosR's avatar
XhmikosR committed
970
          if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
XhmikosR's avatar
XhmikosR committed
971
972
            triggerChangeEvent = false;
          } else {
XhmikosR's avatar
XhmikosR committed
973
            var activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE, rootElement);
Jacob Thornton's avatar
Jacob Thornton committed
974

XhmikosR's avatar
XhmikosR committed
975
            if (activeElement) {
XhmikosR's avatar
XhmikosR committed
976
              activeElement.classList.remove(CLASS_NAME_ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
977
978
            }
          }
Mark Otto's avatar
dist    
Mark Otto committed
979

XhmikosR's avatar
Dist    
XhmikosR committed
980
          if (triggerChangeEvent) {
XhmikosR's avatar
XhmikosR committed
981
            if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains(CLASS_NAME_DISABLED) || rootElement.classList.contains(CLASS_NAME_DISABLED)) {
XhmikosR's avatar
Dist    
XhmikosR committed
982
              return;
Johann-S's avatar
build    
Johann-S committed
983
            }
Mark Otto's avatar
dist    
Mark Otto committed
984

XhmikosR's avatar
XhmikosR committed
985
            input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE);
XhmikosR's avatar
XhmikosR committed
986
            EventHandler.trigger(input, 'change');
Jacob Thornton's avatar
Jacob Thornton committed
987
988
          }

XhmikosR's avatar
Dist    
XhmikosR committed
989
990
          input.focus();
          addAriaPressed = false;
Jacob Thornton's avatar
Jacob Thornton committed
991
        }
XhmikosR's avatar
Dist    
XhmikosR committed
992
      }
Mark Otto's avatar
grunt    
Mark Otto committed
993

XhmikosR's avatar
Dist    
XhmikosR committed
994
      if (addAriaPressed) {
XhmikosR's avatar
XhmikosR committed
995
        this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE));
XhmikosR's avatar
Dist    
XhmikosR committed
996
      }
Mark Otto's avatar
grunt    
Mark Otto committed
997

XhmikosR's avatar
Dist    
XhmikosR committed
998
      if (triggerChangeEvent) {
XhmikosR's avatar
XhmikosR committed
999
        this._element.classList.toggle(CLASS_NAME_ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
1000
1001
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1002

XhmikosR's avatar
Dist    
XhmikosR committed
1003
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
1004
      Data.removeData(this._element, DATA_KEY$1);
XhmikosR's avatar
Dist    
XhmikosR committed
1005
      this._element = null;
Mark Otto's avatar
Mark Otto committed
1006
1007
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
1008

XhmikosR's avatar
XhmikosR committed
1009
    Button.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
1010
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1011
        var data = Data.getData(this, DATA_KEY$1);
Jacob Thornton's avatar
Jacob Thornton committed
1012

XhmikosR's avatar
Dist    
XhmikosR committed
1013
1014
1015
        if (!data) {
          data = new Button(this);
        }
Mark Otto's avatar
grunt    
Mark Otto committed
1016

XhmikosR's avatar
Dist    
XhmikosR committed
1017
1018
        if (config === 'toggle') {
          data[config]();
Mark Otto's avatar
grunt    
Mark Otto committed
1019
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1020
1021
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
1022

XhmikosR's avatar
XhmikosR committed
1023
    Button.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
1024
1025
1026
      return Data.getData(element, DATA_KEY$1);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1027
1028
1029
1030
1031
1032
    _createClass(Button, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$1;
      }
    }]);
Mark Otto's avatar
dist    
Mark Otto committed
1033

XhmikosR's avatar
Dist    
XhmikosR committed
1034
1035
1036
1037
1038
1039
1040
    return Button;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
1041
1042


XhmikosR's avatar
XhmikosR committed
1043
  EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1044
    event.preventDefault();
XhmikosR's avatar
XhmikosR committed
1045
    var button = event.target.closest(SELECTOR_BUTTON);
XhmikosR's avatar
XhmikosR committed
1046
1047
1048
1049
1050
1051
1052
1053
    var data = Data.getData(button, DATA_KEY$1);

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

    data.toggle();
  });
XhmikosR's avatar
XhmikosR committed
1054
  EventHandler.on(document, EVENT_FOCUS_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
XhmikosR's avatar
XhmikosR committed
1055
    var button = event.target.closest(SELECTOR_BUTTON);
XhmikosR's avatar
XhmikosR committed
1056
1057

    if (button) {
XhmikosR's avatar
XhmikosR committed
1058
      button.classList.add(CLASS_NAME_FOCUS);
XhmikosR's avatar
XhmikosR committed
1059
    }
XhmikosR's avatar
XhmikosR committed
1060
  });
XhmikosR's avatar
XhmikosR committed
1061
  EventHandler.on(document, EVENT_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
XhmikosR's avatar
XhmikosR committed
1062
    var button = event.target.closest(SELECTOR_BUTTON);
XhmikosR's avatar
XhmikosR committed
1063
1064

    if (button) {
XhmikosR's avatar
XhmikosR committed
1065
      button.classList.remove(CLASS_NAME_FOCUS);
XhmikosR's avatar
XhmikosR committed
1066
    }
XhmikosR's avatar
Dist    
XhmikosR committed
1067
  });
XhmikosR's avatar
XhmikosR committed
1068
  var $$2 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
1069
1070
1071
1072
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
1073
1074
1075
   * add .button to jQuery only if jQuery is present
   */

1076
1077
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
1078
1079
1080
1081
  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
1082

XhmikosR's avatar
XhmikosR committed
1083
1084
1085
    $$2.fn[NAME$1].noConflict = function () {
      $$2.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
      return Button.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
1086
1087
1088
1089
1090
    };
  }

  /**
   * --------------------------------------------------------------------------
1091
   * Bootstrap (v5.0.0-alpha1): dom/manipulator.js
XhmikosR's avatar
XhmikosR committed
1092
1093
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
1094
   */
XhmikosR's avatar
XhmikosR committed
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
  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
1114

XhmikosR's avatar
XhmikosR committed
1115
1116
  function normalizeDataKey(key) {
    return key.replace(/[A-Z]/g, function (chr) {
XhmikosR's avatar
XhmikosR committed
1117
      return "-" + chr.toLowerCase();
XhmikosR's avatar
XhmikosR committed
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
    });
  }

  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 {};
      }

1133
      var attributes = _objectSpread2({}, element.dataset);
XhmikosR's avatar
XhmikosR committed
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159

      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
1160

XhmikosR's avatar
XhmikosR committed
1161
1162
1163
1164
1165
1166
      if (element.classList.contains(className)) {
        element.classList.remove(className);
      } else {
        element.classList.add(className);
      }
    }
XhmikosR's avatar
Dist    
XhmikosR committed
1167
  };
Jacob Thornton's avatar
Jacob Thornton committed
1168
1169

  /**
XhmikosR's avatar
Dist    
XhmikosR committed
1170
1171
1172
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
Jacob Thornton's avatar
Jacob Thornton committed
1173
   */
Mark Otto's avatar
dist    
Mark Otto committed
1174

XhmikosR's avatar
Dist    
XhmikosR committed
1175
  var NAME$2 = 'carousel';
1176
  var VERSION$2 = '5.0.0-alpha1';
XhmikosR's avatar
Dist    
XhmikosR committed
1177
1178
1179
  var DATA_KEY$2 = 'bs.carousel';
  var EVENT_KEY$2 = "." + DATA_KEY$2;
  var DATA_API_KEY$2 = '.data-api';
XhmikosR's avatar
XhmikosR committed
1180
1181
  var ARROW_LEFT_KEY = 'ArrowLeft';
  var ARROW_RIGHT_KEY = 'ArrowRight';
XhmikosR's avatar
Dist    
XhmikosR committed
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
  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'
  };
XhmikosR's avatar
XhmikosR committed
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
  var DIRECTION_NEXT = 'next';
  var DIRECTION_PREV = 'prev';
  var DIRECTION_LEFT = 'left';
  var DIRECTION_RIGHT = 'right';
  var EVENT_SLIDE = "slide" + EVENT_KEY$2;
  var EVENT_SLID = "slid" + EVENT_KEY$2;
  var EVENT_KEYDOWN = "keydown" + EVENT_KEY$2;
  var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$2;
  var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$2;
  var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$2;
  var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$2;
  var EVENT_TOUCHEND = "touchend" + EVENT_KEY$2;
  var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$2;
  var EVENT_POINTERUP = "pointerup" + EVENT_KEY$2;
  var EVENT_DRAG_START = "dragstart" + EVENT_KEY$2;
  var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$2 + DATA_API_KEY$2;
  var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$2 + DATA_API_KEY$2;
  var CLASS_NAME_CAROUSEL = 'carousel';
  var CLASS_NAME_ACTIVE$1 = 'active';
  var CLASS_NAME_SLIDE = 'slide';
  var CLASS_NAME_RIGHT = 'carousel-item-right';
  var CLASS_NAME_LEFT = 'carousel-item-left';
  var CLASS_NAME_NEXT = 'carousel-item-next';
  var CLASS_NAME_PREV = 'carousel-item-prev';
  var CLASS_NAME_POINTER_EVENT = 'pointer-event';
  var SELECTOR_ACTIVE$1 = '.active';
  var SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
  var SELECTOR_ITEM = '.carousel-item';
  var SELECTOR_ITEM_IMG = '.carousel-item img';
  var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
  var SELECTOR_INDICATORS = '.carousel-indicators';
  var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]';
  var SELECTOR_DATA_RIDE = '[data-ride="carousel"]';
XhmikosR's avatar
Dist    
XhmikosR committed
1234
1235
1236
1237
  var PointerType = {
    TOUCH: 'touch',
    PEN: 'pen'
  };
XhmikosR's avatar
XhmikosR committed
1238
1239
1240
1241
1242
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist    
XhmikosR committed
1243

XhmikosR's avatar
XhmikosR committed
1244
  var Carousel = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
    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
1256
      this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
1257
      this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
XhmikosR's avatar
XhmikosR committed
1258
      this._pointerEvent = Boolean(window.PointerEvent);
XhmikosR's avatar
Dist    
XhmikosR committed
1259
1260

      this._addEventListeners();
XhmikosR's avatar
XhmikosR committed
1261
1262

      Data.setData(element, DATA_KEY$2, this);
XhmikosR's avatar
Dist    
XhmikosR committed
1263
1264
1265
1266
1267
1268
1269
1270
    } // Getters


    var _proto = Carousel.prototype;

    // Public
    _proto.next = function next() {
      if (!this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1271
        this._slide(DIRECTION_NEXT);
XhmikosR's avatar
Dist    
XhmikosR committed
1272
      }
Mark Otto's avatar
dist    
Mark Otto committed
1273
    };
Jacob Thornton's avatar
Jacob Thornton committed
1274

XhmikosR's avatar
Dist    
XhmikosR committed
1275
1276
1277
    _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
1278
      if (!document.hidden && isVisible(this._element)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1279
1280
        this.next();
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1281
1282
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1283
1284
    _proto.prev = function prev() {
      if (!this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1285
        this._slide(DIRECTION_PREV);
XhmikosR's avatar
Dist    
XhmikosR committed
1286
1287
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1288

XhmikosR's avatar
Dist    
XhmikosR committed
1289
1290
1291
1292
    _proto.pause = function pause(event) {
      if (!event) {
        this._isPaused = true;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1293

XhmikosR's avatar
XhmikosR committed
1294
      if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
XhmikosR's avatar
XhmikosR committed
1295
        triggerTransitionEnd(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
1296
1297
        this.cycle(true);
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1298

XhmikosR's avatar
Dist    
XhmikosR committed
1299
1300
1301
      clearInterval(this._interval);
      this._interval = null;
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1302

XhmikosR's avatar
Dist    
XhmikosR committed
1303
1304
1305
1306
    _proto.cycle = function cycle(event) {
      if (!event) {
        this._isPaused = false;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1307

XhmikosR's avatar
Dist    
XhmikosR committed
1308
      if (this._interval) {
Mark Otto's avatar
dist    
Mark Otto committed
1309
1310
        clearInterval(this._interval);
        this._interval = null;
XhmikosR's avatar
Dist    
XhmikosR committed
1311
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1312

XhmikosR's avatar
XhmikosR committed
1313
      if (this._config && this._config.interval && !this._isPaused) {
XhmikosR's avatar
Dist    
XhmikosR committed
1314
1315
1316
        this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1317

XhmikosR's avatar
Dist    
XhmikosR committed
1318
1319
    _proto.to = function to(index) {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
1320

XhmikosR's avatar
XhmikosR committed
1321
      this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
Jacob Thornton's avatar
Jacob Thornton committed
1322

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

XhmikosR's avatar
Dist    
XhmikosR committed
1325
1326
1327
      if (index > this._items.length - 1 || index < 0) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1328

XhmikosR's avatar
Dist    
XhmikosR committed
1329
      if (this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1330
        EventHandler.one(this._element, EVENT_SLID, function () {
XhmikosR's avatar
Dist    
XhmikosR committed
1331
1332
1333
1334
          return _this.to(index);
        });
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1335

XhmikosR's avatar
Dist    
XhmikosR committed
1336
1337
1338
1339
1340
      if (activeIndex === index) {
        this.pause();
        this.cycle();
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1341

XhmikosR's avatar
XhmikosR committed
1342
      var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
Mark Otto's avatar
dist    
Mark Otto committed
1343

XhmikosR's avatar
Dist    
XhmikosR committed
1344
1345
      this._slide(direction, this._items[index]);
    };
Mark Otto's avatar
dist    
Mark Otto committed
1346

XhmikosR's avatar
Dist    
XhmikosR committed
1347
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
1348
1349
      EventHandler.off(this._element, EVENT_KEY$2);
      Data.removeData(this._element, DATA_KEY$2);
XhmikosR's avatar
Dist    
XhmikosR committed
1350
1351
1352
1353
1354
1355
1356
1357
      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
1358
1359
    } // Private
    ;
XhmikosR's avatar
Dist    
XhmikosR committed
1360
1361

    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
1362
      config = _objectSpread2(_objectSpread2({}, Default), config);
XhmikosR's avatar
XhmikosR committed
1363
      typeCheckConfig(NAME$2, config, DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
1364
1365
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
1366

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

XhmikosR's avatar
Dist    
XhmikosR committed
1370
1371
1372
      if (absDeltax <= SWIPE_THRESHOLD) {
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1373

XhmikosR's avatar
XhmikosR committed
1374
1375
      var direction = absDeltax / this.touchDeltaX;
      this.touchDeltaX = 0; // swipe left
Jacob Thornton's avatar
Jacob Thornton committed
1376

XhmikosR's avatar
Dist    
XhmikosR committed
1377
1378
1379
      if (direction > 0) {
        this.prev();
      } // swipe right
Mark Otto's avatar
dist    
Mark Otto committed
1380
1381


XhmikosR's avatar
Dist    
XhmikosR committed
1382
1383
1384
1385
      if (direction < 0) {
        this.next();
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1386

XhmikosR's avatar
Dist    
XhmikosR committed
1387
1388
    _proto._addEventListeners = function _addEventListeners() {
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
1389

XhmikosR's avatar
Dist    
XhmikosR committed
1390
      if (this._config.keyboard) {
XhmikosR's avatar
XhmikosR committed
1391
        EventHandler.on(this._element, EVENT_KEYDOWN, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1392
1393
1394
          return _this2._keydown(event);
        });
      }
Mark Otto's avatar
dist    
Mark Otto committed
1395

XhmikosR's avatar
Dist    
XhmikosR committed
1396
      if (this._config.pause === 'hover') {
XhmikosR's avatar
XhmikosR committed
1397
        EventHandler.on(this._element, EVENT_MOUSEENTER, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1398
          return _this2.pause(event);
XhmikosR's avatar
XhmikosR committed
1399
        });
XhmikosR's avatar
XhmikosR committed
1400
        EventHandler.on(this._element, EVENT_MOUSELEAVE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1401
1402
1403
          return _this2.cycle(event);
        });
      }
Jacob Thornton's avatar
Jacob Thornton committed
1404

1405
      if (this._config.touch && this._touchSupported) {
Mark Otto's avatar
Mark Otto committed
1406
1407
        this._addTouchEventListeners();
      }
XhmikosR's avatar
Dist    
XhmikosR committed
1408
    };
Jacob Thornton's avatar
Jacob Thornton committed
1409

XhmikosR's avatar
Dist    
XhmikosR committed
1410
1411
    _proto._addTouchEventListeners = function _addTouchEventListeners() {
      var _this3 = this;
Mark Otto's avatar
dist    
Mark Otto committed
1412

XhmikosR's avatar
Dist    
XhmikosR committed
1413
      var start = function start(event) {
XhmikosR's avatar
XhmikosR committed
1414
1415
        if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
          _this3.touchStartX = event.clientX;
XhmikosR's avatar
Dist    
XhmikosR committed
1416
        } else if (!_this3._pointerEvent) {
XhmikosR's avatar
XhmikosR committed
1417
          _this3.touchStartX = event.touches[0].clientX;
Mark Otto's avatar
dist    
Mark Otto committed
1418
1419
        }
      };
Jacob Thornton's avatar
Jacob Thornton committed
1420

XhmikosR's avatar
Dist    
XhmikosR committed
1421
1422
      var move = function move(event) {
        // ensure swiping with one touch and not pinching
XhmikosR's avatar
XhmikosR committed
1423
        if (event.touches && event.touches.length > 1) {
XhmikosR's avatar
Dist    
XhmikosR committed
1424
1425
          _this3.touchDeltaX = 0;
        } else {
XhmikosR's avatar
XhmikosR committed
1426
          _this3.touchDeltaX = event.touches[0].clientX - _this3.touchStartX;
XhmikosR's avatar
Dist    
XhmikosR committed
1427
        }
Mark Otto's avatar
dist    
Mark Otto committed
1428
      };
Jacob Thornton's avatar
Jacob Thornton committed
1429

XhmikosR's avatar
Dist    
XhmikosR committed
1430
      var end = function end(event) {
XhmikosR's avatar
XhmikosR committed
1431
1432
        if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
          _this3.touchDeltaX = event.clientX - _this3.touchStartX;
XhmikosR's avatar
Dist    
XhmikosR committed
1433
        }
Jacob Thornton's avatar
Jacob Thornton committed
1434

XhmikosR's avatar
Dist    
XhmikosR committed
1435
        _this3._handleSwipe();
Mark Otto's avatar
dist    
Mark Otto committed
1436

XhmikosR's avatar
Dist    
XhmikosR committed
1437
1438
1439
1440
1441
1442
1443
1444
1445
        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
1446

XhmikosR's avatar
Dist    
XhmikosR committed
1447
1448
1449
          if (_this3.touchTimeout) {
            clearTimeout(_this3.touchTimeout);
          }
Jacob Thornton's avatar
Jacob Thornton committed
1450

XhmikosR's avatar
Dist    
XhmikosR committed
1451
1452
1453
1454
          _this3.touchTimeout = setTimeout(function (event) {
            return _this3.cycle(event);
          }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
        }
Mark Otto's avatar
dist    
Mark Otto committed
1455
      };
Jacob Thornton's avatar
Jacob Thornton committed
1456

XhmikosR's avatar
XhmikosR committed
1457
1458
      SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(function (itemImg) {
        EventHandler.on(itemImg, EVENT_DRAG_START, function (e) {
XhmikosR's avatar
XhmikosR committed
1459
1460
          return e.preventDefault();
        });
XhmikosR's avatar
Dist    
XhmikosR committed
1461
      });
Jacob Thornton's avatar
Jacob Thornton committed
1462

XhmikosR's avatar
Dist    
XhmikosR committed
1463
      if (this._pointerEvent) {
XhmikosR's avatar
XhmikosR committed
1464
        EventHandler.on(this._element, EVENT_POINTERDOWN, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1465
1466
          return start(event);
        });
XhmikosR's avatar
XhmikosR committed
1467
        EventHandler.on(this._element, EVENT_POINTERUP, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1468
1469
          return end(event);
        });
Jacob Thornton's avatar
Jacob Thornton committed
1470

XhmikosR's avatar
XhmikosR committed
1471
        this._element.classList.add(CLASS_NAME_POINTER_EVENT);
XhmikosR's avatar
Dist    
XhmikosR committed
1472
      } else {
XhmikosR's avatar
XhmikosR committed
1473
        EventHandler.on(this._element, EVENT_TOUCHSTART, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1474
          return start(event);
Mark Otto's avatar
dist    
Mark Otto committed
1475
        });
XhmikosR's avatar
XhmikosR committed
1476
        EventHandler.on(this._element, EVENT_TOUCHMOVE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1477
1478
          return move(event);
        });
XhmikosR's avatar
XhmikosR committed
1479
        EventHandler.on(this._element, EVENT_TOUCHEND, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1480
1481
1482
1483
          return end(event);
        });
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1484

XhmikosR's avatar
Dist    
XhmikosR committed
1485
1486
1487
1488
    _proto._keydown = function _keydown(event) {
      if (/input|textarea/i.test(event.target.tagName)) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1489

XhmikosR's avatar
XhmikosR committed
1490
1491
      switch (event.key) {
        case ARROW_LEFT_KEY:
XhmikosR's avatar
Dist    
XhmikosR committed
1492
1493
1494
          event.preventDefault();
          this.prev();
          break;
Mark Otto's avatar
dist    
Mark Otto committed
1495

XhmikosR's avatar
XhmikosR committed
1496
        case ARROW_RIGHT_KEY:
XhmikosR's avatar
Dist    
XhmikosR committed
1497
1498
1499
1500
1501
          event.preventDefault();
          this.next();
          break;
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1502

XhmikosR's avatar
Dist    
XhmikosR committed
1503
    _proto._getItemIndex = function _getItemIndex(element) {
XhmikosR's avatar
XhmikosR committed
1504
      this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : [];
XhmikosR's avatar
Dist    
XhmikosR committed
1505
1506
      return this._items.indexOf(element);
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1507

XhmikosR's avatar
Dist    
XhmikosR committed
1508
    _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
XhmikosR's avatar
XhmikosR committed
1509
1510
      var isNextDirection = direction === DIRECTION_NEXT;
      var isPrevDirection = direction === DIRECTION_PREV;
Mark Otto's avatar
grunt    
Mark Otto committed
1511

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1517
1518
1519
      if (isGoingToWrap && !this._config.wrap) {
        return activeElement;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1520

XhmikosR's avatar
XhmikosR committed
1521
      var delta = direction === DIRECTION_PREV ? -1 : 1;
XhmikosR's avatar
Dist    
XhmikosR committed
1522
1523
1524
      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
1525

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

XhmikosR's avatar
XhmikosR committed
1529
      var fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element));
Jacob Thornton's avatar
Jacob Thornton committed
1530

XhmikosR's avatar
XhmikosR committed
1531
      return EventHandler.trigger(this._element, EVENT_SLIDE, {
XhmikosR's avatar
Dist    
XhmikosR committed
1532
1533
1534
1535
1536
1537
        relatedTarget: relatedTarget,
        direction: eventDirectionName,
        from: fromIndex,
        to: targetIndex
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
1538

XhmikosR's avatar
Dist    
XhmikosR committed
1539
1540
    _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
      if (this._indicatorsElement) {
XhmikosR's avatar
XhmikosR committed
1541
        var indicators = SelectorEngine.find(SELECTOR_ACTIVE$1, this._indicatorsElement);
XhmikosR's avatar
XhmikosR committed
1542
1543

        for (var i = 0; i < indicators.length; i++) {
XhmikosR's avatar
XhmikosR committed
1544
          indicators[i].classList.remove(CLASS_NAME_ACTIVE$1);
XhmikosR's avatar
XhmikosR committed
1545
        }
Jacob Thornton's avatar
Jacob Thornton committed
1546

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

XhmikosR's avatar
Dist    
XhmikosR committed
1549
        if (nextIndicator) {
XhmikosR's avatar
XhmikosR committed
1550
          nextIndicator.classList.add(CLASS_NAME_ACTIVE$1);
Mark Otto's avatar
dist    
Mark Otto committed
1551
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1552
1553
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1554

XhmikosR's avatar
Dist    
XhmikosR committed
1555
1556
    _proto._slide = function _slide(direction, element) {
      var _this4 = this;
Jacob Thornton's avatar
Jacob Thornton committed
1557

XhmikosR's avatar
XhmikosR committed
1558
      var activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
Mark Otto's avatar
dist    
Mark Otto committed
1559

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

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1566
1567
1568
1569
      var isCycling = Boolean(this._interval);
      var directionalClassName;
      var orderClassName;
      var eventDirectionName;
Jacob Thornton's avatar
Jacob Thornton committed
1570

XhmikosR's avatar
XhmikosR committed
1571
1572
1573
1574
      if (direction === DIRECTION_NEXT) {
        directionalClassName = CLASS_NAME_LEFT;
        orderClassName = CLASS_NAME_NEXT;
        eventDirectionName = DIRECTION_LEFT;
XhmikosR's avatar
Dist    
XhmikosR committed
1575
      } else {
XhmikosR's avatar
XhmikosR committed
1576
1577
1578
        directionalClassName = CLASS_NAME_RIGHT;
        orderClassName = CLASS_NAME_PREV;
        eventDirectionName = DIRECTION_RIGHT;
XhmikosR's avatar
Dist    
XhmikosR committed
1579
      }
Jacob Thornton's avatar
Jacob Thornton committed
1580

XhmikosR's avatar
XhmikosR committed
1581
      if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$1)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1582
1583
1584
        this._isSliding = false;
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1585

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

XhmikosR's avatar
XhmikosR committed
1588
      if (slideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
1589
1590
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1591

XhmikosR's avatar
Dist    
XhmikosR committed
1592
1593
1594
1595
      if (!activeElement || !nextElement) {
        // Some weirdness is happening, so we bail
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1596

XhmikosR's avatar
Dist    
XhmikosR committed
1597
      this._isSliding = true;
Jacob Thornton's avatar
Jacob Thornton committed
1598

XhmikosR's avatar
Dist    
XhmikosR committed
1599
1600
1601
      if (isCycling) {
        this.pause();
      }
Mark Otto's avatar
dist    
Mark Otto committed
1602

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

XhmikosR's avatar
XhmikosR committed
1605
      if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
XhmikosR's avatar
XhmikosR committed
1606
1607
1608
1609
        nextElement.classList.add(orderClassName);
        reflow(nextElement);
        activeElement.classList.add(directionalClassName);
        nextElement.classList.add(directionalClassName);
XhmikosR's avatar
Dist    
XhmikosR committed
1610
1611
1612
1613
1614
1615
1616
        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
1617
1618
        }

XhmikosR's avatar
XhmikosR committed
1619
1620
        var transitionDuration = getTransitionDurationFromElement(activeElement);
        EventHandler.one(activeElement, TRANSITION_END, function () {
XhmikosR's avatar
XhmikosR committed
1621
          nextElement.classList.remove(directionalClassName, orderClassName);
XhmikosR's avatar
XhmikosR committed
1622
          nextElement.classList.add(CLASS_NAME_ACTIVE$1);
XhmikosR's avatar
XhmikosR committed
1623
          activeElement.classList.remove(CLASS_NAME_ACTIVE$1, orderClassName, directionalClassName);
XhmikosR's avatar
Dist    
XhmikosR committed
1624
1625
          _this4._isSliding = false;
          setTimeout(function () {
XhmikosR's avatar
XhmikosR committed
1626
            EventHandler.trigger(_this4._element, EVENT_SLID, {
XhmikosR's avatar
XhmikosR committed
1627
1628
1629
1630
1631
              relatedTarget: nextElement,
              direction: eventDirectionName,
              from: activeElementIndex,
              to: nextElementIndex
            });
XhmikosR's avatar
Dist    
XhmikosR committed
1632
          }, 0);
XhmikosR's avatar
XhmikosR committed
1633
1634
        });
        emulateTransitionEnd(activeElement, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
1635
      } else {
XhmikosR's avatar
XhmikosR committed
1636
1637
        activeElement.classList.remove(CLASS_NAME_ACTIVE$1);
        nextElement.classList.add(CLASS_NAME_ACTIVE$1);
XhmikosR's avatar
Dist    
XhmikosR committed
1638
        this._isSliding = false;
XhmikosR's avatar
XhmikosR committed
1639
        EventHandler.trigger(this._element, EVENT_SLID, {
XhmikosR's avatar
XhmikosR committed
1640
1641
1642
1643
1644
          relatedTarget: nextElement,
          direction: eventDirectionName,
          from: activeElementIndex,
          to: nextElementIndex
        });
XhmikosR's avatar
Dist    
XhmikosR committed
1645
1646
1647
1648
1649
      }

      if (isCycling) {
        this.cycle();
      }
Mark Otto's avatar
Mark Otto committed
1650
1651
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
1652

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

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

XhmikosR's avatar
XhmikosR committed
1658
      if (typeof config === 'object') {
XhmikosR's avatar
XhmikosR committed
1659
        _config = _objectSpread2(_objectSpread2({}, _config), config);
XhmikosR's avatar
XhmikosR committed
1660
      }
Jacob Thornton's avatar
Jacob Thornton committed
1661

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

XhmikosR's avatar
XhmikosR committed
1664
1665
1666
1667
1668
1669
1670
1671
      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
1672
          throw new TypeError("No method named \"" + action + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
1673
        }
Mark Otto's avatar
grunt    
Mark Otto committed
1674

XhmikosR's avatar
XhmikosR committed
1675
1676
1677
1678
1679
1680
        data[action]();
      } else if (_config.interval && _config.ride) {
        data.pause();
        data.cycle();
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1681

XhmikosR's avatar
XhmikosR committed
1682
    Carousel.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
XhmikosR committed
1683
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1684
        Carousel.carouselInterface(this, config);
XhmikosR's avatar
Dist    
XhmikosR committed
1685
1686
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
1687

XhmikosR's avatar
XhmikosR committed
1688
1689
    Carousel.dataApiClickHandler = function dataApiClickHandler(event) {
      var target = getElementFromSelector(this);
Jacob Thornton's avatar
Jacob Thornton committed
1690

XhmikosR's avatar
XhmikosR committed
1691
      if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1692
1693
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1694

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1699
1700
      if (slideIndex) {
        config.interval = false;
Mark Otto's avatar
dist    
Mark Otto committed
1701
      }
Mark Otto's avatar
dist    
Mark Otto committed
1702

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

XhmikosR's avatar
Dist    
XhmikosR committed
1705
      if (slideIndex) {
XhmikosR's avatar
XhmikosR committed
1706
        Data.getData(target, DATA_KEY$2).to(slideIndex);
XhmikosR's avatar
Dist    
XhmikosR committed
1707
1708
1709
      }

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

XhmikosR's avatar
XhmikosR committed
1712
    Carousel.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
1713
1714
1715
      return Data.getData(element, DATA_KEY$2);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
    _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
1728
    return Carousel;
XhmikosR's avatar
Dist    
XhmikosR committed
1729
1730
1731
1732
1733
1734
1735
1736
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


XhmikosR's avatar
XhmikosR committed
1737
1738
1739
  EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
  EventHandler.on(window, EVENT_LOAD_DATA_API, function () {
    var carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
XhmikosR's avatar
Dist    
XhmikosR committed
1740
1741

    for (var i = 0, len = carousels.length; i < len; i++) {
XhmikosR's avatar
XhmikosR committed
1742
      Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY$2));
XhmikosR's avatar
Dist    
XhmikosR committed
1743
1744
    }
  });
XhmikosR's avatar
XhmikosR committed
1745
  var $$3 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
1746
1747
1748
1749
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
1750
   * add .carousel to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
1751
1752
   */

1753
1754
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
1755
1756
1757
1758
  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
1759

XhmikosR's avatar
XhmikosR committed
1760
1761
1762
    $$3.fn[NAME$2].noConflict = function () {
      $$3.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
      return Carousel.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
1763
1764
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
1765

XhmikosR's avatar
Dist    
XhmikosR committed
1766
1767
1768
1769
1770
1771
1772
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$3 = 'collapse';
1773
  var VERSION$3 = '5.0.0-alpha1';
XhmikosR's avatar
Dist    
XhmikosR committed
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
  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
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
  var EVENT_SHOW = "show" + EVENT_KEY$3;
  var EVENT_SHOWN = "shown" + EVENT_KEY$3;
  var EVENT_HIDE = "hide" + EVENT_KEY$3;
  var EVENT_HIDDEN = "hidden" + EVENT_KEY$3;
  var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$3 + DATA_API_KEY$3;
  var CLASS_NAME_SHOW = 'show';
  var CLASS_NAME_COLLAPSE = 'collapse';
  var CLASS_NAME_COLLAPSING = 'collapsing';
  var CLASS_NAME_COLLAPSED = 'collapsed';
  var WIDTH = 'width';
  var HEIGHT = 'height';
  var SELECTOR_ACTIVES = '.show, .collapsing';
  var SELECTOR_DATA_TOGGLE$1 = '[data-toggle="collapse"]';
XhmikosR's avatar
XhmikosR committed
1798
1799
1800
1801
1802
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist    
XhmikosR committed
1803

XhmikosR's avatar
XhmikosR committed
1804
  var Collapse = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
1805
1806
1807
1808
    function Collapse(element, config) {
      this._isTransitioning = false;
      this._element = element;
      this._config = this._getConfig(config);
XhmikosR's avatar
XhmikosR committed
1809
1810
      this._triggerArray = SelectorEngine.find(SELECTOR_DATA_TOGGLE$1 + "[href=\"#" + element.id + "\"]," + (SELECTOR_DATA_TOGGLE$1 + "[data-target=\"#" + element.id + "\"]"));
      var toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$1);
XhmikosR's avatar
Dist    
XhmikosR committed
1811
1812
1813

      for (var i = 0, len = toggleList.length; i < len; i++) {
        var elem = toggleList[i];
XhmikosR's avatar
XhmikosR committed
1814
        var selector = getSelectorFromElement(elem);
XhmikosR's avatar
XhmikosR committed
1815
        var filterElement = SelectorEngine.find(selector).filter(function (foundElem) {
XhmikosR's avatar
Dist    
XhmikosR committed
1816
1817
          return foundElem === element;
        });
Johann-S's avatar
build    
Johann-S committed
1818

XhmikosR's avatar
XhmikosR committed
1819
        if (selector !== null && filterElement.length) {
XhmikosR's avatar
Dist    
XhmikosR committed
1820
          this._selector = selector;
Jacob Thornton's avatar
Jacob Thornton committed
1821

XhmikosR's avatar
Dist    
XhmikosR committed
1822
          this._triggerArray.push(elem);
Mark Otto's avatar
dist    
Mark Otto committed
1823
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1824
      }
Jacob Thornton's avatar
Jacob Thornton committed
1825

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

XhmikosR's avatar
Dist    
XhmikosR committed
1828
1829
1830
      if (!this._config.parent) {
        this._addAriaAndCollapsedClass(this._element, this._triggerArray);
      }
Jacob Thornton's avatar
Jacob Thornton committed
1831

XhmikosR's avatar
Dist    
XhmikosR committed
1832
1833
1834
      if (this._config.toggle) {
        this.toggle();
      }
XhmikosR's avatar
XhmikosR committed
1835
1836

      Data.setData(element, DATA_KEY$3, this);
XhmikosR's avatar
Dist    
XhmikosR committed
1837
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
1838
1839


XhmikosR's avatar
Dist    
XhmikosR committed
1840
    var _proto = Collapse.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
1841

XhmikosR's avatar
Dist    
XhmikosR committed
1842
1843
    // Public
    _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
1844
      if (this._element.classList.contains(CLASS_NAME_SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1845
1846
1847
1848
1849
        this.hide();
      } else {
        this.show();
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
1850

XhmikosR's avatar
Dist    
XhmikosR committed
1851
1852
    _proto.show = function show() {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
1853

XhmikosR's avatar
XhmikosR committed
1854
      if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1855
1856
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1857

XhmikosR's avatar
Dist    
XhmikosR committed
1858
1859
      var actives;
      var activesData;
Mark Otto's avatar
dist    
Mark Otto committed
1860

XhmikosR's avatar
Dist    
XhmikosR committed
1861
      if (this._parent) {
XhmikosR's avatar
XhmikosR committed
1862
        actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter(function (elem) {
XhmikosR's avatar
Dist    
XhmikosR committed
1863
1864
          if (typeof _this._config.parent === 'string') {
            return elem.getAttribute('data-parent') === _this._config.parent;
Mark Otto's avatar
dist    
Mark Otto committed
1865
          }
Jacob Thornton's avatar
Jacob Thornton committed
1866

XhmikosR's avatar
XhmikosR committed
1867
          return elem.classList.contains(CLASS_NAME_COLLAPSE);
XhmikosR's avatar
Dist    
XhmikosR committed
1868
        });
Mark Otto's avatar
dist    
Mark Otto committed
1869

XhmikosR's avatar
Dist    
XhmikosR committed
1870
1871
        if (actives.length === 0) {
          actives = null;
Jacob Thornton's avatar
Jacob Thornton committed
1872
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1873
      }
Jacob Thornton's avatar
Jacob Thornton committed
1874

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

XhmikosR's avatar
Dist    
XhmikosR committed
1877
      if (actives) {
XhmikosR's avatar
XhmikosR committed
1878
1879
1880
1881
        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
1882

XhmikosR's avatar
Dist    
XhmikosR committed
1883
        if (activesData && activesData._isTransitioning) {
Mark Otto's avatar
dist    
Mark Otto committed
1884
1885
          return;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1886
      }
Mark Otto's avatar
grunt    
Mark Otto committed
1887

XhmikosR's avatar
XhmikosR committed
1888
      var startEvent = EventHandler.trigger(this._element, EVENT_SHOW);
Mark Otto's avatar
dist    
Mark Otto committed
1889

XhmikosR's avatar
XhmikosR committed
1890
      if (startEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
1891
1892
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1893

XhmikosR's avatar
Dist    
XhmikosR committed
1894
      if (actives) {
XhmikosR's avatar
XhmikosR committed
1895
1896
        actives.forEach(function (elemActive) {
          if (container !== elemActive) {
XhmikosR's avatar
XhmikosR committed
1897
            Collapse.collapseInterface(elemActive, 'hide');
XhmikosR's avatar
XhmikosR committed
1898
          }
Jacob Thornton's avatar
Jacob Thornton committed
1899

XhmikosR's avatar
XhmikosR committed
1900
1901
1902
1903
          if (!activesData) {
            Data.setData(elemActive, DATA_KEY$3, null);
          }
        });
XhmikosR's avatar
Dist    
XhmikosR committed
1904
      }
Jacob Thornton's avatar
Jacob Thornton committed
1905

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

XhmikosR's avatar
XhmikosR committed
1908
      this._element.classList.remove(CLASS_NAME_COLLAPSE);
XhmikosR's avatar
XhmikosR committed
1909

XhmikosR's avatar
XhmikosR committed
1910
      this._element.classList.add(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
XhmikosR committed
1911

XhmikosR's avatar
Dist    
XhmikosR committed
1912
1913
1914
      this._element.style[dimension] = 0;

      if (this._triggerArray.length) {
XhmikosR's avatar
XhmikosR committed
1915
        this._triggerArray.forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
1916
          element.classList.remove(CLASS_NAME_COLLAPSED);
XhmikosR's avatar
XhmikosR committed
1917
1918
          element.setAttribute('aria-expanded', true);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
1919
      }
Jacob Thornton's avatar
Jacob Thornton committed
1920

XhmikosR's avatar
Dist    
XhmikosR committed
1921
      this.setTransitioning(true);
Jacob Thornton's avatar
Jacob Thornton committed
1922

XhmikosR's avatar
Dist    
XhmikosR committed
1923
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
1924
        _this._element.classList.remove(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
XhmikosR committed
1925

XhmikosR's avatar
XhmikosR committed
1926
        _this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
XhmikosR's avatar
XhmikosR committed
1927

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

XhmikosR's avatar
Dist    
XhmikosR committed
1930
1931
        _this.setTransitioning(false);

XhmikosR's avatar
XhmikosR committed
1932
        EventHandler.trigger(_this._element, EVENT_SHOWN);
Mark Otto's avatar
dist    
Mark Otto committed
1933
      };
Jacob Thornton's avatar
Jacob Thornton committed
1934

XhmikosR's avatar
Dist    
XhmikosR committed
1935
1936
      var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
      var scrollSize = "scroll" + capitalizedDimension;
XhmikosR's avatar
XhmikosR committed
1937
1938
1939
      var transitionDuration = getTransitionDurationFromElement(this._element);
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
1940
1941
      this._element.style[dimension] = this._element[scrollSize] + "px";
    };
Jacob Thornton's avatar
Jacob Thornton committed
1942

XhmikosR's avatar
Dist    
XhmikosR committed
1943
1944
    _proto.hide = function hide() {
      var _this2 = this;
Jacob Thornton's avatar
Jacob Thornton committed
1945

XhmikosR's avatar
XhmikosR committed
1946
      if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1947
1948
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1949

XhmikosR's avatar
XhmikosR committed
1950
      var startEvent = EventHandler.trigger(this._element, EVENT_HIDE);
Jacob Thornton's avatar
Jacob Thornton committed
1951

XhmikosR's avatar
XhmikosR committed
1952
      if (startEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
1953
1954
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
1955

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

XhmikosR's avatar
Dist    
XhmikosR committed
1958
      this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
XhmikosR's avatar
XhmikosR committed
1959
1960
      reflow(this._element);

XhmikosR's avatar
XhmikosR committed
1961
      this._element.classList.add(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
XhmikosR committed
1962

XhmikosR's avatar
XhmikosR committed
1963
      this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
XhmikosR's avatar
XhmikosR committed
1964

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

XhmikosR's avatar
Dist    
XhmikosR committed
1967
1968
1969
      if (triggerArrayLength > 0) {
        for (var i = 0; i < triggerArrayLength; i++) {
          var trigger = this._triggerArray[i];
XhmikosR's avatar
XhmikosR committed
1970
          var elem = getElementFromSelector(trigger);
XhmikosR's avatar
Dist    
XhmikosR committed
1971

XhmikosR's avatar
XhmikosR committed
1972
1973
          if (elem && !elem.classList.contains(CLASS_NAME_SHOW)) {
            trigger.classList.add(CLASS_NAME_COLLAPSED);
XhmikosR's avatar
XhmikosR committed
1974
            trigger.setAttribute('aria-expanded', false);
Mark Otto's avatar
build    
Mark Otto committed
1975
1976
          }
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1977
      }
Mark Otto's avatar
dist    
Mark Otto committed
1978

XhmikosR's avatar
Dist    
XhmikosR committed
1979
      this.setTransitioning(true);
Jacob Thornton's avatar
Jacob Thornton committed
1980

XhmikosR's avatar
Dist    
XhmikosR committed
1981
1982
      var complete = function complete() {
        _this2.setTransitioning(false);
Jacob Thornton's avatar
Jacob Thornton committed
1983

XhmikosR's avatar
XhmikosR committed
1984
        _this2._element.classList.remove(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
XhmikosR committed
1985

XhmikosR's avatar
XhmikosR committed
1986
        _this2._element.classList.add(CLASS_NAME_COLLAPSE);
XhmikosR's avatar
XhmikosR committed
1987

XhmikosR's avatar
XhmikosR committed
1988
        EventHandler.trigger(_this2._element, EVENT_HIDDEN);
Mark Otto's avatar
dist    
Mark Otto committed
1989
      };
Jacob Thornton's avatar
Jacob Thornton committed
1990

XhmikosR's avatar
Dist    
XhmikosR committed
1991
      this._element.style[dimension] = '';
XhmikosR's avatar
XhmikosR committed
1992
1993
1994
      var transitionDuration = getTransitionDurationFromElement(this._element);
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
1995
    };
Jacob Thornton's avatar
Jacob Thornton committed
1996

XhmikosR's avatar
Dist    
XhmikosR committed
1997
1998
1999
    _proto.setTransitioning = function setTransitioning(isTransitioning) {
      this._isTransitioning = isTransitioning;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2000

XhmikosR's avatar
Dist    
XhmikosR committed
2001
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
2002
      Data.removeData(this._element, DATA_KEY$3);
XhmikosR's avatar
Dist    
XhmikosR committed
2003
2004
2005
2006
2007
      this._config = null;
      this._parent = null;
      this._element = null;
      this._triggerArray = null;
      this._isTransitioning = null;
Mark Otto's avatar
Mark Otto committed
2008
2009
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
2010

XhmikosR's avatar
Dist    
XhmikosR committed
2011
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
2012
      config = _objectSpread2(_objectSpread2({}, Default$1), config);
XhmikosR's avatar
Dist    
XhmikosR committed
2013
      config.toggle = Boolean(config.toggle); // Coerce string values
Mark Otto's avatar
grunt    
Mark Otto committed
2014

XhmikosR's avatar
XhmikosR committed
2015
      typeCheckConfig(NAME$3, config, DefaultType$1);
XhmikosR's avatar
Dist    
XhmikosR committed
2016
2017
      return config;
    };
Mark Otto's avatar
grunt    
Mark Otto committed
2018

XhmikosR's avatar
Dist    
XhmikosR committed
2019
    _proto._getDimension = function _getDimension() {
XhmikosR's avatar
XhmikosR committed
2020
      var hasWidth = this._element.classList.contains(WIDTH);
XhmikosR's avatar
XhmikosR committed
2021

XhmikosR's avatar
XhmikosR committed
2022
      return hasWidth ? WIDTH : HEIGHT;
XhmikosR's avatar
Dist    
XhmikosR committed
2023
    };
Mark Otto's avatar
grunt    
Mark Otto committed
2024

XhmikosR's avatar
Dist    
XhmikosR committed
2025
2026
    _proto._getParent = function _getParent() {
      var _this3 = this;
Mark Otto's avatar
grunt    
Mark Otto committed
2027

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

XhmikosR's avatar
Dist.    
XhmikosR committed
2030
2031
2032
2033
      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
2034
2035
        }
      } else {
XhmikosR's avatar
Dist.    
XhmikosR committed
2036
        parent = SelectorEngine.findOne(parent);
XhmikosR's avatar
Dist    
XhmikosR committed
2037
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2038

XhmikosR's avatar
XhmikosR committed
2039
2040
      var selector = SELECTOR_DATA_TOGGLE$1 + "[data-parent=\"" + parent + "\"]";
      SelectorEngine.find(selector, parent).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
2041
        var selected = getElementFromSelector(element);
2042
2043

        _this3._addAriaAndCollapsedClass(selected, [element]);
XhmikosR's avatar
Dist    
XhmikosR committed
2044
2045
2046
      });
      return parent;
    };
Mark Otto's avatar
grunt    
Mark Otto committed
2047

XhmikosR's avatar
Dist    
XhmikosR committed
2048
    _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
XhmikosR's avatar
XhmikosR committed
2049
      if (element) {
XhmikosR's avatar
XhmikosR committed
2050
        var isOpen = element.classList.contains(CLASS_NAME_SHOW);
XhmikosR's avatar
XhmikosR committed
2051
2052
2053

        if (triggerArray.length) {
          triggerArray.forEach(function (elem) {
XhmikosR's avatar
Dist.    
XhmikosR committed
2054
            if (isOpen) {
XhmikosR's avatar
XhmikosR committed
2055
              elem.classList.remove(CLASS_NAME_COLLAPSED);
XhmikosR's avatar
Dist.    
XhmikosR committed
2056
            } else {
XhmikosR's avatar
XhmikosR committed
2057
              elem.classList.add(CLASS_NAME_COLLAPSED);
XhmikosR's avatar
XhmikosR committed
2058
            }
Jacob Thornton's avatar
Jacob Thornton committed
2059

XhmikosR's avatar
XhmikosR committed
2060
2061
2062
            elem.setAttribute('aria-expanded', isOpen);
          });
        }
XhmikosR's avatar
Dist    
XhmikosR committed
2063
      }
Mark Otto's avatar
Mark Otto committed
2064
2065
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
2066

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

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

XhmikosR's avatar
XhmikosR committed
2072
      if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
XhmikosR's avatar
XhmikosR committed
2073
2074
        _config.toggle = false;
      }
Mark Otto's avatar
dist    
Mark Otto committed
2075

XhmikosR's avatar
XhmikosR committed
2076
2077
2078
2079
2080
2081
      if (!data) {
        data = new Collapse(element, _config);
      }

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

XhmikosR's avatar
XhmikosR committed
2085
2086
2087
        data[config]();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
2088

XhmikosR's avatar
XhmikosR committed
2089
    Collapse.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
XhmikosR committed
2090
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
2091
        Collapse.collapseInterface(this, config);
XhmikosR's avatar
Dist    
XhmikosR committed
2092
2093
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
2094

XhmikosR's avatar
XhmikosR committed
2095
    Collapse.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
2096
2097
2098
      return Data.getData(element, DATA_KEY$3);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
    _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
2110

XhmikosR's avatar
Dist    
XhmikosR committed
2111
2112
2113
2114
2115
2116
2117
    return Collapse;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
2118

Jacob Thornton's avatar
Jacob Thornton committed
2119

XhmikosR's avatar
XhmikosR committed
2120
  EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$1, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2121
    // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
XhmikosR's avatar
XhmikosR committed
2122
    if (event.target.tagName === 'A') {
XhmikosR's avatar
Dist    
XhmikosR committed
2123
2124
      event.preventDefault();
    }
Mark Otto's avatar
dist    
Mark Otto committed
2125

XhmikosR's avatar
XhmikosR committed
2126
2127
    var triggerData = Manipulator.getDataAttributes(this);
    var selector = getSelectorFromElement(this);
XhmikosR's avatar
XhmikosR committed
2128
    var selectorElements = SelectorEngine.find(selector);
XhmikosR's avatar
XhmikosR committed
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
    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
2144

XhmikosR's avatar
XhmikosR committed
2145
      Collapse.collapseInterface(element, config);
XhmikosR's avatar
Dist    
XhmikosR committed
2146
2147
    });
  });
XhmikosR's avatar
XhmikosR committed
2148
  var $$4 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
2149
2150
2151
2152
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
2153
   * add .collapse to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
2154
   */
Jacob Thornton's avatar
Jacob Thornton committed
2155

2156
2157
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
2158
2159
2160
2161
  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
2162

XhmikosR's avatar
XhmikosR committed
2163
2164
2165
    $$4.fn[NAME$3].noConflict = function () {
      $$4.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
      return Collapse.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
2166
2167
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
2168

XhmikosR's avatar
Dist    
XhmikosR committed
2169
2170
2171
2172
2173
2174
2175
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$4 = 'dropdown';
2176
  var VERSION$4 = '5.0.0-alpha1';
XhmikosR's avatar
Dist    
XhmikosR committed
2177
2178
2179
  var DATA_KEY$4 = 'bs.dropdown';
  var EVENT_KEY$4 = "." + DATA_KEY$4;
  var DATA_API_KEY$4 = '.data-api';
XhmikosR's avatar
XhmikosR committed
2180
2181
2182
2183
2184
2185
2186
2187
  var ESCAPE_KEY = 'Escape';
  var SPACE_KEY = 'Space';
  var TAB_KEY = 'Tab';
  var ARROW_UP_KEY = 'ArrowUp';
  var ARROW_DOWN_KEY = 'ArrowDown';
  var RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button

  var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEY + "|" + ARROW_DOWN_KEY + "|" + ESCAPE_KEY);
XhmikosR's avatar
XhmikosR committed
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
  var EVENT_HIDE$1 = "hide" + EVENT_KEY$4;
  var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$4;
  var EVENT_SHOW$1 = "show" + EVENT_KEY$4;
  var EVENT_SHOWN$1 = "shown" + EVENT_KEY$4;
  var EVENT_CLICK = "click" + EVENT_KEY$4;
  var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$4 + DATA_API_KEY$4;
  var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$4 + DATA_API_KEY$4;
  var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$4 + DATA_API_KEY$4;
  var CLASS_NAME_DISABLED$1 = 'disabled';
  var CLASS_NAME_SHOW$1 = 'show';
  var CLASS_NAME_DROPUP = 'dropup';
  var CLASS_NAME_DROPRIGHT = 'dropright';
  var CLASS_NAME_DROPLEFT = 'dropleft';
  var CLASS_NAME_MENURIGHT = 'dropdown-menu-right';
  var CLASS_NAME_NAVBAR = 'navbar';
  var CLASS_NAME_POSITION_STATIC = 'position-static';
  var SELECTOR_DATA_TOGGLE$2 = '[data-toggle="dropdown"]';
  var SELECTOR_FORM_CHILD = '.dropdown form';
  var SELECTOR_MENU = '.dropdown-menu';
  var SELECTOR_NAVBAR_NAV = '.navbar-nav';
  var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
  var PLACEMENT_TOP = 'top-start';
  var PLACEMENT_TOPEND = 'top-end';
  var PLACEMENT_BOTTOM = 'bottom-start';
  var PLACEMENT_BOTTOMEND = 'bottom-end';
  var PLACEMENT_RIGHT = 'right-start';
  var PLACEMENT_LEFT = 'left-start';
XhmikosR's avatar
Dist    
XhmikosR committed
2215
2216
2217
2218
2219
  var Default$2 = {
    offset: 0,
    flip: true,
    boundary: 'scrollParent',
    reference: 'toggle',
XhmikosR's avatar
XhmikosR committed
2220
2221
    display: 'dynamic',
    popperConfig: null
XhmikosR's avatar
Dist    
XhmikosR committed
2222
2223
2224
2225
2226
2227
  };
  var DefaultType$2 = {
    offset: '(number|string|function)',
    flip: 'boolean',
    boundary: '(string|element)',
    reference: '(string|element)',
XhmikosR's avatar
XhmikosR committed
2228
2229
    display: 'string',
    popperConfig: '(null|object)'
XhmikosR's avatar
Dist    
XhmikosR committed
2230
  };
XhmikosR's avatar
XhmikosR committed
2231
2232
2233
2234
2235
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
2236

XhmikosR's avatar
XhmikosR committed
2237
  var Dropdown = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
2238
2239
2240
2241
2242
2243
    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
2244

XhmikosR's avatar
Dist    
XhmikosR committed
2245
      this._addEventListeners();
XhmikosR's avatar
XhmikosR committed
2246
2247

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

Jacob Thornton's avatar
Jacob Thornton committed
2250

XhmikosR's avatar
Dist    
XhmikosR committed
2251
    var _proto = Dropdown.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
2252

XhmikosR's avatar
Dist    
XhmikosR committed
2253
2254
    // Public
    _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
2255
      if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED$1)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2256
2257
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2258

XhmikosR's avatar
XhmikosR committed
2259
      var isActive = this._element.classList.contains(CLASS_NAME_SHOW$1);
Jacob Thornton's avatar
Jacob Thornton committed
2260

XhmikosR's avatar
XhmikosR committed
2261
      Dropdown.clearMenus();
Jacob Thornton's avatar
Jacob Thornton committed
2262

XhmikosR's avatar
Dist    
XhmikosR committed
2263
2264
2265
      if (isActive) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2266

XhmikosR's avatar
XhmikosR committed
2267
2268
2269
2270
      this.show();
    };

    _proto.show = function show() {
XhmikosR's avatar
XhmikosR committed
2271
      if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED$1) || this._menu.classList.contains(CLASS_NAME_SHOW$1)) {
XhmikosR's avatar
XhmikosR committed
2272
2273
2274
2275
        return;
      }

      var parent = Dropdown.getParentFromElement(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
2276
2277
2278
      var relatedTarget = {
        relatedTarget: this._element
      };
XhmikosR's avatar
XhmikosR committed
2279
      var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$1, relatedTarget);
Mark Otto's avatar
dist    
Mark Otto committed
2280

XhmikosR's avatar
XhmikosR committed
2281
      if (showEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2282
2283
        return;
      } // Disable totally Popper.js for Dropdown in Navbar
Jacob Thornton's avatar
Jacob Thornton committed
2284
2285


XhmikosR's avatar
Dist    
XhmikosR committed
2286
2287
      if (!this._inNavbar) {
        if (typeof Popper === 'undefined') {
XhmikosR's avatar
XhmikosR committed
2288
          throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org)');
Mark Otto's avatar
dist    
Mark Otto committed
2289
        }
Jacob Thornton's avatar
Jacob Thornton committed
2290

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

XhmikosR's avatar
Dist    
XhmikosR committed
2293
2294
        if (this._config.reference === 'parent') {
          referenceElement = parent;
XhmikosR's avatar
XhmikosR committed
2295
        } else if (isElement(this._config.reference)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2296
          referenceElement = this._config.reference; // Check if it's jQuery element
Mark Otto's avatar
dist    
Mark Otto committed
2297

XhmikosR's avatar
Dist    
XhmikosR committed
2298
2299
          if (typeof this._config.reference.jquery !== 'undefined') {
            referenceElement = this._config.reference[0];
Mark Otto's avatar
dist    
Mark Otto committed
2300
          }
XhmikosR's avatar
Dist    
XhmikosR committed
2301
2302
2303
        } // 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
2304

Mark Otto's avatar
dist    
Mark Otto committed
2305

XhmikosR's avatar
Dist    
XhmikosR committed
2306
        if (this._config.boundary !== 'scrollParent') {
XhmikosR's avatar
XhmikosR committed
2307
          parent.classList.add(CLASS_NAME_POSITION_STATIC);
XhmikosR's avatar
Dist    
XhmikosR committed
2308
        }
Mark Otto's avatar
dist    
Mark Otto committed
2309

XhmikosR's avatar
Dist    
XhmikosR committed
2310
2311
2312
2313
2314
        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
2315

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

XhmikosR's avatar
XhmikosR committed
2317
      if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
XhmikosR's avatar
XhmikosR committed
2318
2319
2320
        var _ref;

        (_ref = []).concat.apply(_ref, document.body.children).forEach(function (elem) {
XhmikosR's avatar
XhmikosR committed
2321
2322
          return EventHandler.on(elem, 'mouseover', null, noop());
        });
XhmikosR's avatar
Dist    
XhmikosR committed
2323
      }
Mark Otto's avatar
dist    
Mark Otto committed
2324

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

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

XhmikosR's avatar
XhmikosR committed
2329
2330
2331
      Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW$1);
      Manipulator.toggleClass(this._element, CLASS_NAME_SHOW$1);
      EventHandler.trigger(parent, EVENT_SHOWN$1, relatedTarget);
XhmikosR's avatar
Dist    
XhmikosR committed
2332
    };
Mark Otto's avatar
dist    
Mark Otto committed
2333

XhmikosR's avatar
Dist    
XhmikosR committed
2334
    _proto.hide = function hide() {
XhmikosR's avatar
XhmikosR committed
2335
      if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED$1) || !this._menu.classList.contains(CLASS_NAME_SHOW$1)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2336
2337
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2338

XhmikosR's avatar
XhmikosR committed
2339
      var parent = Dropdown.getParentFromElement(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
2340
2341
2342
      var relatedTarget = {
        relatedTarget: this._element
      };
XhmikosR's avatar
XhmikosR committed
2343
      var hideEvent = EventHandler.trigger(parent, EVENT_HIDE$1, relatedTarget);
Mark Otto's avatar
dist    
Mark Otto committed
2344

XhmikosR's avatar
XhmikosR committed
2345
      if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2346
2347
        return;
      }
Johann-S's avatar
build    
Johann-S committed
2348

XhmikosR's avatar
XhmikosR committed
2349
2350
2351
2352
      if (this._popper) {
        this._popper.destroy();
      }

XhmikosR's avatar
XhmikosR committed
2353
2354
2355
      Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW$1);
      Manipulator.toggleClass(this._element, CLASS_NAME_SHOW$1);
      EventHandler.trigger(parent, EVENT_HIDDEN$1, relatedTarget);
XhmikosR's avatar
Dist    
XhmikosR committed
2356
    };
Johann-S's avatar
build    
Johann-S committed
2357

XhmikosR's avatar
Dist    
XhmikosR committed
2358
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
2359
2360
      Data.removeData(this._element, DATA_KEY$4);
      EventHandler.off(this._element, EVENT_KEY$4);
XhmikosR's avatar
Dist    
XhmikosR committed
2361
2362
      this._element = null;
      this._menu = null;
Mark Otto's avatar
dist    
Mark Otto committed
2363

XhmikosR's avatar
XhmikosR committed
2364
      if (this._popper) {
XhmikosR's avatar
Dist    
XhmikosR committed
2365
        this._popper.destroy();
Mark Otto's avatar
dist    
Mark Otto committed
2366

XhmikosR's avatar
Dist    
XhmikosR committed
2367
2368
2369
        this._popper = null;
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2370

XhmikosR's avatar
Dist    
XhmikosR committed
2371
2372
    _proto.update = function update() {
      this._inNavbar = this._detectNavbar();
Mark Otto's avatar
build    
Mark Otto committed
2373

XhmikosR's avatar
XhmikosR committed
2374
      if (this._popper) {
XhmikosR's avatar
Dist    
XhmikosR committed
2375
2376
        this._popper.scheduleUpdate();
      }
Mark Otto's avatar
Mark Otto committed
2377
2378
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
2379

XhmikosR's avatar
Dist    
XhmikosR committed
2380
2381
    _proto._addEventListeners = function _addEventListeners() {
      var _this = this;
Mark Otto's avatar
build    
Mark Otto committed
2382

XhmikosR's avatar
XhmikosR committed
2383
      EventHandler.on(this._element, EVENT_CLICK, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2384
2385
        event.preventDefault();
        event.stopPropagation();
Mark Otto's avatar
build    
Mark Otto committed
2386

XhmikosR's avatar
Dist    
XhmikosR committed
2387
2388
2389
        _this.toggle();
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
2390

XhmikosR's avatar
Dist    
XhmikosR committed
2391
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
2392
      config = _objectSpread2(_objectSpread2(_objectSpread2({}, this.constructor.Default), Manipulator.getDataAttributes(this._element)), config);
XhmikosR's avatar
XhmikosR committed
2393
      typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
2394
2395
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
2396

XhmikosR's avatar
Dist    
XhmikosR committed
2397
    _proto._getMenuElement = function _getMenuElement() {
XhmikosR's avatar
XhmikosR committed
2398
      return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
XhmikosR's avatar
Dist    
XhmikosR committed
2399
    };
Mark Otto's avatar
dist    
Mark Otto committed
2400

XhmikosR's avatar
Dist    
XhmikosR committed
2401
    _proto._getPlacement = function _getPlacement() {
XhmikosR's avatar
XhmikosR committed
2402
      var parentDropdown = this._element.parentNode;
XhmikosR's avatar
XhmikosR committed
2403
      var placement = PLACEMENT_BOTTOM; // Handle dropup
Mark Otto's avatar
dist    
Mark Otto committed
2404

XhmikosR's avatar
XhmikosR committed
2405
2406
      if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
        placement = PLACEMENT_TOP;
Mark Otto's avatar
build    
Mark Otto committed
2407

XhmikosR's avatar
XhmikosR committed
2408
2409
        if (this._menu.classList.contains(CLASS_NAME_MENURIGHT)) {
          placement = PLACEMENT_TOPEND;
XhmikosR's avatar
Dist    
XhmikosR committed
2410
        }
XhmikosR's avatar
XhmikosR committed
2411
2412
2413
2414
2415
2416
      } else if (parentDropdown.classList.contains(CLASS_NAME_DROPRIGHT)) {
        placement = PLACEMENT_RIGHT;
      } else if (parentDropdown.classList.contains(CLASS_NAME_DROPLEFT)) {
        placement = PLACEMENT_LEFT;
      } else if (this._menu.classList.contains(CLASS_NAME_MENURIGHT)) {
        placement = PLACEMENT_BOTTOMEND;
XhmikosR's avatar
Dist    
XhmikosR committed
2417
      }
Jacob Thornton's avatar
Jacob Thornton committed
2418

XhmikosR's avatar
Dist    
XhmikosR committed
2419
2420
      return placement;
    };
Mark Otto's avatar
dist    
Mark Otto committed
2421

XhmikosR's avatar
Dist    
XhmikosR committed
2422
    _proto._detectNavbar = function _detectNavbar() {
XhmikosR's avatar
XhmikosR committed
2423
      return Boolean(this._element.closest("." + CLASS_NAME_NAVBAR));
XhmikosR's avatar
Dist    
XhmikosR committed
2424
    };
Jacob Thornton's avatar
Jacob Thornton committed
2425

Mark Otto's avatar
Mark Otto committed
2426
    _proto._getOffset = function _getOffset() {
XhmikosR's avatar
Dist    
XhmikosR committed
2427
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
2428

Mark Otto's avatar
Mark Otto committed
2429
      var offset = {};
Jacob Thornton's avatar
Jacob Thornton committed
2430

XhmikosR's avatar
Dist    
XhmikosR committed
2431
      if (typeof this._config.offset === 'function') {
Mark Otto's avatar
Mark Otto committed
2432
        offset.fn = function (data) {
XhmikosR's avatar
XhmikosR committed
2433
          data.offsets = _objectSpread2(_objectSpread2({}, data.offsets), _this2._config.offset(data.offsets, _this2._element) || {});
XhmikosR's avatar
Dist    
XhmikosR committed
2434
2435
2436
          return data;
        };
      } else {
Mark Otto's avatar
Mark Otto committed
2437
        offset.offset = this._config.offset;
XhmikosR's avatar
Dist    
XhmikosR committed
2438
      }
Mark Otto's avatar
dist    
Mark Otto committed
2439

Mark Otto's avatar
Mark Otto committed
2440
2441
2442
2443
      return offset;
    };

    _proto._getPopperConfig = function _getPopperConfig() {
XhmikosR's avatar
Dist    
XhmikosR committed
2444
2445
2446
      var popperConfig = {
        placement: this._getPlacement(),
        modifiers: {
Mark Otto's avatar
Mark Otto committed
2447
          offset: this._getOffset(),
XhmikosR's avatar
Dist    
XhmikosR committed
2448
2449
2450
2451
2452
          flip: {
            enabled: this._config.flip
          },
          preventOverflow: {
            boundariesElement: this._config.boundary
Mark Otto's avatar
grunt    
Mark Otto committed
2453
          }
XhmikosR's avatar
XhmikosR committed
2454
2455
        }
      }; // Disable Popper.js if we have a static display
Jacob Thornton's avatar
Jacob Thornton committed
2456

XhmikosR's avatar
Dist    
XhmikosR committed
2457
2458
2459
2460
2461
      if (this._config.display === 'static') {
        popperConfig.modifiers.applyStyle = {
          enabled: false
        };
      }
Jacob Thornton's avatar
Jacob Thornton committed
2462

XhmikosR's avatar
XhmikosR committed
2463
      return _objectSpread2(_objectSpread2({}, popperConfig), this._config.popperConfig);
Mark Otto's avatar
Mark Otto committed
2464
2465
    } // Static
    ;
Mark Otto's avatar
dist    
Mark Otto committed
2466

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

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

XhmikosR's avatar
XhmikosR committed
2472
2473
2474
2475
2476
2477
      if (!data) {
        data = new Dropdown(element, _config);
      }

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

XhmikosR's avatar
XhmikosR committed
2481
2482
2483
        data[config]();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
2484

XhmikosR's avatar
XhmikosR committed
2485
    Dropdown.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
XhmikosR committed
2486
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
2487
        Dropdown.dropdownInterface(this, config);
XhmikosR's avatar
Dist    
XhmikosR committed
2488
2489
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
2490

XhmikosR's avatar
XhmikosR committed
2491
    Dropdown.clearMenus = function clearMenus(event) {
XhmikosR's avatar
XhmikosR committed
2492
      if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2493
2494
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2495

XhmikosR's avatar
XhmikosR committed
2496
      var toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$2);
Mark Otto's avatar
dist    
Mark Otto committed
2497

XhmikosR's avatar
Dist    
XhmikosR committed
2498
      for (var i = 0, len = toggles.length; i < len; i++) {
XhmikosR's avatar
XhmikosR committed
2499
        var parent = Dropdown.getParentFromElement(toggles[i]);
XhmikosR's avatar
XhmikosR committed
2500
        var context = Data.getData(toggles[i], DATA_KEY$4);
XhmikosR's avatar
Dist    
XhmikosR committed
2501
2502
2503
        var relatedTarget = {
          relatedTarget: toggles[i]
        };
Mark Otto's avatar
dist    
Mark Otto committed
2504

XhmikosR's avatar
Dist    
XhmikosR committed
2505
2506
        if (event && event.type === 'click') {
          relatedTarget.clickEvent = event;
Mark Otto's avatar
grunt    
Mark Otto committed
2507
2508
        }

XhmikosR's avatar
Dist    
XhmikosR committed
2509
2510
        if (!context) {
          continue;
Mark Otto's avatar
dist    
Mark Otto committed
2511
        }
Jacob Thornton's avatar
Jacob Thornton committed
2512

XhmikosR's avatar
Dist    
XhmikosR committed
2513
        var dropdownMenu = context._menu;
Jacob Thornton's avatar
Jacob Thornton committed
2514

XhmikosR's avatar
XhmikosR committed
2515
        if (!toggles[i].classList.contains(CLASS_NAME_SHOW$1)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2516
2517
          continue;
        }
Mark Otto's avatar
dist    
Mark Otto committed
2518

XhmikosR's avatar
XhmikosR committed
2519
        if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.key === TAB_KEY) && dropdownMenu.contains(event.target)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2520
          continue;
Mark Otto's avatar
dist    
Mark Otto committed
2521
        }
Jacob Thornton's avatar
Jacob Thornton committed
2522

XhmikosR's avatar
XhmikosR committed
2523
        var hideEvent = EventHandler.trigger(parent, EVENT_HIDE$1, relatedTarget);
Jacob Thornton's avatar
Jacob Thornton committed
2524

XhmikosR's avatar
XhmikosR committed
2525
        if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2526
2527
2528
2529
2530
2531
          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
2532
2533
2534
          var _ref2;

          (_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (elem) {
XhmikosR's avatar
XhmikosR committed
2535
2536
            return EventHandler.off(elem, 'mouseover', null, noop());
          });
Mark Otto's avatar
dist    
Mark Otto committed
2537
        }
Jacob Thornton's avatar
Jacob Thornton committed
2538

XhmikosR's avatar
Dist    
XhmikosR committed
2539
        toggles[i].setAttribute('aria-expanded', 'false');
XhmikosR's avatar
XhmikosR committed
2540
2541
2542
2543
2544

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

XhmikosR's avatar
XhmikosR committed
2545
2546
2547
        dropdownMenu.classList.remove(CLASS_NAME_SHOW$1);
        toggles[i].classList.remove(CLASS_NAME_SHOW$1);
        EventHandler.trigger(parent, EVENT_HIDDEN$1, relatedTarget);
XhmikosR's avatar
Dist    
XhmikosR committed
2548
2549
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2550

XhmikosR's avatar
XhmikosR committed
2551
2552
    Dropdown.getParentFromElement = function getParentFromElement(element) {
      return getElementFromSelector(element) || element.parentNode;
XhmikosR's avatar
XhmikosR committed
2553
    };
Jacob Thornton's avatar
Jacob Thornton committed
2554

XhmikosR's avatar
XhmikosR committed
2555
    Dropdown.dataApiKeydownHandler = function dataApiKeydownHandler(event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2556
2557
2558
2559
2560
2561
2562
      // 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
2563
      if (/input|textarea/i.test(event.target.tagName) ? event.key === SPACE_KEY || event.key !== ESCAPE_KEY && (event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY || event.target.closest(SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(event.key)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2564
2565
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2566

XhmikosR's avatar
Dist    
XhmikosR committed
2567
2568
      event.preventDefault();
      event.stopPropagation();
Jacob Thornton's avatar
Jacob Thornton committed
2569

XhmikosR's avatar
XhmikosR committed
2570
      if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED$1)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2571
2572
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2573

XhmikosR's avatar
XhmikosR committed
2574
      var parent = Dropdown.getParentFromElement(this);
XhmikosR's avatar
XhmikosR committed
2575
      var isActive = this.classList.contains(CLASS_NAME_SHOW$1);
Jacob Thornton's avatar
Jacob Thornton committed
2576

XhmikosR's avatar
XhmikosR committed
2577
      if (event.key === ESCAPE_KEY) {
XhmikosR's avatar
XhmikosR committed
2578
2579
2580
2581
2582
        var button = this.matches(SELECTOR_DATA_TOGGLE$2) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$2)[0];
        button.focus();
        Dropdown.clearMenus();
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2583

XhmikosR's avatar
XhmikosR committed
2584
      if (!isActive || event.key === SPACE_KEY) {
XhmikosR's avatar
XhmikosR committed
2585
        Dropdown.clearMenus();
XhmikosR's avatar
Dist    
XhmikosR committed
2586
2587
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2588

XhmikosR's avatar
XhmikosR committed
2589
      var items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible);
Jacob Thornton's avatar
Jacob Thornton committed
2590

XhmikosR's avatar
XhmikosR committed
2591
      if (!items.length) {
XhmikosR's avatar
Dist    
XhmikosR committed
2592
2593
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
2594

XhmikosR's avatar
XhmikosR committed
2595
      var index = items.indexOf(event.target);
Mark Otto's avatar
dist    
Mark Otto committed
2596

XhmikosR's avatar
XhmikosR committed
2597
      if (event.key === ARROW_UP_KEY && index > 0) {
XhmikosR's avatar
Dist    
XhmikosR committed
2598
2599
2600
        // Up
        index--;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2601

XhmikosR's avatar
XhmikosR committed
2602
      if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
XhmikosR's avatar
Dist    
XhmikosR committed
2603
2604
        // Down
        index++;
XhmikosR's avatar
XhmikosR committed
2605
2606
      } // index is -1 if the first keydown is an ArrowUp

Mark Otto's avatar
dist    
Mark Otto committed
2607

XhmikosR's avatar
XhmikosR committed
2608
      index = index === -1 ? 0 : index;
XhmikosR's avatar
Dist    
XhmikosR committed
2609
      items[index].focus();
Mark Otto's avatar
dist    
Mark Otto committed
2610
    };
Jacob Thornton's avatar
Jacob Thornton committed
2611

XhmikosR's avatar
XhmikosR committed
2612
    Dropdown.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
2613
2614
2615
      return Data.getData(element, DATA_KEY$4);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
    _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
2633
    return Dropdown;
XhmikosR's avatar
Dist    
XhmikosR committed
2634
2635
2636
2637
2638
2639
2640
2641
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


XhmikosR's avatar
XhmikosR committed
2642
2643
2644
2645
2646
  EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$2, Dropdown.dataApiKeydownHandler);
  EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
  EventHandler.on(document, EVENT_CLICK_DATA_API$4, Dropdown.clearMenus);
  EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
  EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$2, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2647
2648
    event.preventDefault();
    event.stopPropagation();
XhmikosR's avatar
XhmikosR committed
2649
    Dropdown.dropdownInterface(this, 'toggle');
XhmikosR's avatar
XhmikosR committed
2650
  });
XhmikosR's avatar
XhmikosR committed
2651
  EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_FORM_CHILD, function (e) {
XhmikosR's avatar
XhmikosR committed
2652
    return e.stopPropagation();
XhmikosR's avatar
Dist    
XhmikosR committed
2653
  });
XhmikosR's avatar
XhmikosR committed
2654
  var $$5 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
2655
2656
2657
2658
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
2659
   * add .dropdown to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
2660
2661
   */

2662
2663
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
2664
2665
2666
2667
  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
2668

XhmikosR's avatar
XhmikosR committed
2669
2670
2671
    $$5.fn[NAME$4].noConflict = function () {
      $$5.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
      return Dropdown.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
2672
2673
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
2674

XhmikosR's avatar
Dist    
XhmikosR committed
2675
2676
2677
2678
2679
2680
2681
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$5 = 'modal';
2682
  var VERSION$5 = '5.0.0-alpha1';
XhmikosR's avatar
Dist    
XhmikosR committed
2683
2684
2685
  var DATA_KEY$5 = 'bs.modal';
  var EVENT_KEY$5 = "." + DATA_KEY$5;
  var DATA_API_KEY$5 = '.data-api';
XhmikosR's avatar
XhmikosR committed
2686
  var ESCAPE_KEY$1 = 'Escape';
XhmikosR's avatar
Dist    
XhmikosR committed
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
  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
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
  var EVENT_HIDE$2 = "hide" + EVENT_KEY$5;
  var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5;
  var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5;
  var EVENT_SHOW$2 = "show" + EVENT_KEY$5;
  var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5;
  var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5;
  var EVENT_RESIZE = "resize" + EVENT_KEY$5;
  var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY$5;
  var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$5;
  var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$5;
  var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$5;
  var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$5 + DATA_API_KEY$5;
  var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
  var CLASS_NAME_BACKDROP = 'modal-backdrop';
  var CLASS_NAME_OPEN = 'modal-open';
  var CLASS_NAME_FADE = 'fade';
  var CLASS_NAME_SHOW$2 = 'show';
  var CLASS_NAME_STATIC = 'modal-static';
  var SELECTOR_DIALOG = '.modal-dialog';
  var SELECTOR_MODAL_BODY = '.modal-body';
  var SELECTOR_DATA_TOGGLE$3 = '[data-toggle="modal"]';
  var SELECTOR_DATA_DISMISS = '[data-dismiss="modal"]';
  var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
  var SELECTOR_STICKY_CONTENT = '.sticky-top';
XhmikosR's avatar
XhmikosR committed
2723
2724
2725
2726
2727
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist    
XhmikosR committed
2728

XhmikosR's avatar
XhmikosR committed
2729
  var Modal = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
2730
2731
2732
    function Modal(element, config) {
      this._config = this._getConfig(config);
      this._element = element;
XhmikosR's avatar
XhmikosR committed
2733
      this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, element);
XhmikosR's avatar
Dist    
XhmikosR committed
2734
2735
2736
2737
2738
2739
      this._backdrop = null;
      this._isShown = false;
      this._isBodyOverflowing = false;
      this._ignoreBackdropClick = false;
      this._isTransitioning = false;
      this._scrollbarWidth = 0;
XhmikosR's avatar
XhmikosR committed
2740
      Data.setData(element, DATA_KEY$5, this);
XhmikosR's avatar
Dist    
XhmikosR committed
2741
2742
2743
2744
2745
2746
2747
2748
    } // 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
2749
    };
Jacob Thornton's avatar
Jacob Thornton committed
2750

XhmikosR's avatar
Dist    
XhmikosR committed
2751
2752
    _proto.show = function show(relatedTarget) {
      var _this = this;
Mark Otto's avatar
grunt    
Mark Otto committed
2753

XhmikosR's avatar
Dist    
XhmikosR committed
2754
2755
2756
      if (this._isShown || this._isTransitioning) {
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2757

XhmikosR's avatar
XhmikosR committed
2758
      if (this._element.classList.contains(CLASS_NAME_FADE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2759
2760
        this._isTransitioning = true;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2761

XhmikosR's avatar
XhmikosR committed
2762
      var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, {
XhmikosR's avatar
Dist    
XhmikosR committed
2763
2764
        relatedTarget: relatedTarget
      });
Jacob Thornton's avatar
Jacob Thornton committed
2765

XhmikosR's avatar
XhmikosR committed
2766
      if (this._isShown || showEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2767
2768
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2769

XhmikosR's avatar
Dist    
XhmikosR committed
2770
      this._isShown = true;
Mark Otto's avatar
dist    
Mark Otto committed
2771

XhmikosR's avatar
Dist    
XhmikosR committed
2772
      this._checkScrollbar();
Jacob Thornton's avatar
Jacob Thornton committed
2773

XhmikosR's avatar
Dist    
XhmikosR committed
2774
      this._setScrollbar();
Mark Otto's avatar
dist    
Mark Otto committed
2775

XhmikosR's avatar
Dist    
XhmikosR committed
2776
      this._adjustDialog();
Jacob Thornton's avatar
Jacob Thornton committed
2777

XhmikosR's avatar
Dist    
XhmikosR committed
2778
      this._setEscapeEvent();
Jacob Thornton's avatar
Jacob Thornton committed
2779

XhmikosR's avatar
Dist    
XhmikosR committed
2780
      this._setResizeEvent();
Mark Otto's avatar
grunt    
Mark Otto committed
2781

XhmikosR's avatar
XhmikosR committed
2782
      EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2783
2784
        return _this.hide(event);
      });
XhmikosR's avatar
XhmikosR committed
2785
2786
      EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, function () {
        EventHandler.one(_this._element, EVENT_MOUSEUP_DISMISS, function (event) {
XhmikosR's avatar
XhmikosR committed
2787
          if (event.target === _this._element) {
XhmikosR's avatar
Dist    
XhmikosR committed
2788
2789
            _this._ignoreBackdropClick = true;
          }
Mark Otto's avatar
dist    
Mark Otto committed
2790
        });
XhmikosR's avatar
Dist    
XhmikosR committed
2791
      });
Jacob Thornton's avatar
Jacob Thornton committed
2792

XhmikosR's avatar
Dist    
XhmikosR committed
2793
2794
2795
2796
      this._showBackdrop(function () {
        return _this._showElement(relatedTarget);
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
2797

XhmikosR's avatar
Dist    
XhmikosR committed
2798
2799
    _proto.hide = function hide(event) {
      var _this2 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2800

XhmikosR's avatar
Dist    
XhmikosR committed
2801
2802
2803
      if (event) {
        event.preventDefault();
      }
Jacob Thornton's avatar
Jacob Thornton committed
2804

XhmikosR's avatar
Dist    
XhmikosR committed
2805
2806
2807
      if (!this._isShown || this._isTransitioning) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
2808

XhmikosR's avatar
XhmikosR committed
2809
      var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2);
Jacob Thornton's avatar
Jacob Thornton committed
2810

2811
      if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2812
2813
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
2814

XhmikosR's avatar
Dist    
XhmikosR committed
2815
      this._isShown = false;
XhmikosR's avatar
XhmikosR committed
2816

XhmikosR's avatar
XhmikosR committed
2817
      var transition = this._element.classList.contains(CLASS_NAME_FADE);
Jacob Thornton's avatar
Jacob Thornton committed
2818

XhmikosR's avatar
Dist    
XhmikosR committed
2819
2820
2821
      if (transition) {
        this._isTransitioning = true;
      }
Mark Otto's avatar
dist    
Mark Otto committed
2822

XhmikosR's avatar
Dist    
XhmikosR committed
2823
      this._setEscapeEvent();
Jacob Thornton's avatar
Jacob Thornton committed
2824

XhmikosR's avatar
Dist    
XhmikosR committed
2825
      this._setResizeEvent();
Jacob Thornton's avatar
Jacob Thornton committed
2826

XhmikosR's avatar
XhmikosR committed
2827
      EventHandler.off(document, EVENT_FOCUSIN);
XhmikosR's avatar
XhmikosR committed
2828

XhmikosR's avatar
XhmikosR committed
2829
      this._element.classList.remove(CLASS_NAME_SHOW$2);
XhmikosR's avatar
XhmikosR committed
2830

XhmikosR's avatar
XhmikosR committed
2831
2832
      EventHandler.off(this._element, EVENT_CLICK_DISMISS);
      EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
Jacob Thornton's avatar
Jacob Thornton committed
2833

XhmikosR's avatar
Dist    
XhmikosR committed
2834
      if (transition) {
XhmikosR's avatar
XhmikosR committed
2835
2836
        var transitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
2837
          return _this2._hideModal(event);
XhmikosR's avatar
XhmikosR committed
2838
2839
        });
        emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
2840
2841
2842
2843
      } else {
        this._hideModal();
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2844

XhmikosR's avatar
Dist    
XhmikosR committed
2845
2846
    _proto.dispose = function dispose() {
      [window, this._element, this._dialog].forEach(function (htmlElement) {
XhmikosR's avatar
XhmikosR committed
2847
        return EventHandler.off(htmlElement, EVENT_KEY$5);
XhmikosR's avatar
Dist    
XhmikosR committed
2848
2849
      });
      /**
XhmikosR's avatar
XhmikosR committed
2850
       * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
XhmikosR's avatar
Dist    
XhmikosR committed
2851
       * Do not move `document` in `htmlElements` array
XhmikosR's avatar
XhmikosR committed
2852
       * It will remove `EVENT_CLICK_DATA_API` event that should remain
XhmikosR's avatar
Dist    
XhmikosR committed
2853
       */
Mark Otto's avatar
grunt    
Mark Otto committed
2854

XhmikosR's avatar
XhmikosR committed
2855
      EventHandler.off(document, EVENT_FOCUSIN);
XhmikosR's avatar
XhmikosR committed
2856
      Data.removeData(this._element, DATA_KEY$5);
XhmikosR's avatar
Dist    
XhmikosR committed
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
      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
2867

XhmikosR's avatar
Dist    
XhmikosR committed
2868
2869
    _proto.handleUpdate = function handleUpdate() {
      this._adjustDialog();
Mark Otto's avatar
Mark Otto committed
2870
2871
    } // Private
    ;
Jacob Thornton's avatar
Jacob Thornton committed
2872

XhmikosR's avatar
Dist    
XhmikosR committed
2873
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
2874
      config = _objectSpread2(_objectSpread2({}, Default$3), config);
XhmikosR's avatar
XhmikosR committed
2875
      typeCheckConfig(NAME$5, config, DefaultType$3);
XhmikosR's avatar
Dist    
XhmikosR committed
2876
2877
      return config;
    };
Jacob Thornton's avatar
Jacob Thornton committed
2878

XhmikosR's avatar
Dist    
XhmikosR committed
2879
2880
    _proto._showElement = function _showElement(relatedTarget) {
      var _this3 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2881

XhmikosR's avatar
XhmikosR committed
2882
      var transition = this._element.classList.contains(CLASS_NAME_FADE);
Mark Otto's avatar
dist    
Mark Otto committed
2883

XhmikosR's avatar
XhmikosR committed
2884
      var modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
XhmikosR's avatar
XhmikosR committed
2885

XhmikosR's avatar
Dist    
XhmikosR committed
2886
2887
2888
2889
      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
2890

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

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

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

XhmikosR's avatar
XhmikosR committed
2897
2898
2899
      this._element.scrollTop = 0;

      if (modalBody) {
XhmikosR's avatar
XhmikosR committed
2900
        modalBody.scrollTop = 0;
Mark Otto's avatar
Mark Otto committed
2901
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2902

XhmikosR's avatar
Dist    
XhmikosR committed
2903
      if (transition) {
XhmikosR's avatar
XhmikosR committed
2904
        reflow(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
2905
      }
Mark Otto's avatar
grunt    
Mark Otto committed
2906

XhmikosR's avatar
XhmikosR committed
2907
      this._element.classList.add(CLASS_NAME_SHOW$2);
Mark Otto's avatar
dist    
Mark Otto committed
2908

XhmikosR's avatar
Dist    
XhmikosR committed
2909
2910
2911
      if (this._config.focus) {
        this._enforceFocus();
      }
Mark Otto's avatar
dist    
Mark Otto committed
2912

XhmikosR's avatar
Dist    
XhmikosR committed
2913
2914
2915
      var transitionComplete = function transitionComplete() {
        if (_this3._config.focus) {
          _this3._element.focus();
Jacob Thornton's avatar
Jacob Thornton committed
2916
        }
Mark Otto's avatar
dist    
Mark Otto committed
2917

XhmikosR's avatar
Dist    
XhmikosR committed
2918
        _this3._isTransitioning = false;
XhmikosR's avatar
XhmikosR committed
2919
        EventHandler.trigger(_this3._element, EVENT_SHOWN$2, {
XhmikosR's avatar
XhmikosR committed
2920
2921
          relatedTarget: relatedTarget
        });
Mark Otto's avatar
grunt    
Mark Otto committed
2922
2923
      };

XhmikosR's avatar
Dist    
XhmikosR committed
2924
      if (transition) {
XhmikosR's avatar
XhmikosR committed
2925
2926
2927
        var transitionDuration = getTransitionDurationFromElement(this._dialog);
        EventHandler.one(this._dialog, TRANSITION_END, transitionComplete);
        emulateTransitionEnd(this._dialog, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
2928
2929
2930
2931
      } else {
        transitionComplete();
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
2932

XhmikosR's avatar
Dist    
XhmikosR committed
2933
2934
    _proto._enforceFocus = function _enforceFocus() {
      var _this4 = this;
Mark Otto's avatar
grunt    
Mark Otto committed
2935

XhmikosR's avatar
XhmikosR committed
2936
      EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop
XhmikosR's avatar
XhmikosR committed
2937

XhmikosR's avatar
XhmikosR committed
2938
      EventHandler.on(document, EVENT_FOCUSIN, function (event) {
XhmikosR's avatar
XhmikosR committed
2939
        if (document !== event.target && _this4._element !== event.target && !_this4._element.contains(event.target)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2940
          _this4._element.focus();
Mark Otto's avatar
dist    
Mark Otto committed
2941
        }
XhmikosR's avatar
Dist    
XhmikosR committed
2942
2943
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
2944

XhmikosR's avatar
Dist    
XhmikosR committed
2945
2946
    _proto._setEscapeEvent = function _setEscapeEvent() {
      var _this5 = this;
Mark Otto's avatar
grunt    
Mark Otto committed
2947

XhmikosR's avatar
XhmikosR committed
2948
2949
      if (this._isShown) {
        EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, function (event) {
XhmikosR's avatar
XhmikosR committed
2950
          if (_this5._config.keyboard && event.key === ESCAPE_KEY$1) {
XhmikosR's avatar
XhmikosR committed
2951
2952
2953
            event.preventDefault();

            _this5.hide();
XhmikosR's avatar
XhmikosR committed
2954
          } else if (!_this5._config.keyboard && event.key === ESCAPE_KEY$1) {
XhmikosR's avatar
XhmikosR committed
2955
            _this5._triggerBackdropTransition();
XhmikosR's avatar
Dist    
XhmikosR committed
2956
2957
          }
        });
2958
      } else {
XhmikosR's avatar
XhmikosR committed
2959
        EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS);
XhmikosR's avatar
Dist    
XhmikosR committed
2960
2961
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
2962

XhmikosR's avatar
Dist    
XhmikosR committed
2963
2964
    _proto._setResizeEvent = function _setResizeEvent() {
      var _this6 = this;
Jacob Thornton's avatar
Jacob Thornton committed
2965

XhmikosR's avatar
Dist    
XhmikosR committed
2966
      if (this._isShown) {
XhmikosR's avatar
XhmikosR committed
2967
        EventHandler.on(window, EVENT_RESIZE, function () {
2968
          return _this6._adjustDialog();
XhmikosR's avatar
Dist    
XhmikosR committed
2969
2970
        });
      } else {
XhmikosR's avatar
XhmikosR committed
2971
        EventHandler.off(window, EVENT_RESIZE);
XhmikosR's avatar
Dist    
XhmikosR committed
2972
2973
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
2974

XhmikosR's avatar
Dist    
XhmikosR committed
2975
2976
    _proto._hideModal = function _hideModal() {
      var _this7 = this;
Mark Otto's avatar
dist    
Mark Otto committed
2977

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

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
2984
      this._isTransitioning = false;
Mark Otto's avatar
dist    
Mark Otto committed
2985

XhmikosR's avatar
Dist    
XhmikosR committed
2986
      this._showBackdrop(function () {
XhmikosR's avatar
XhmikosR committed
2987
        document.body.classList.remove(CLASS_NAME_OPEN);
Mark Otto's avatar
dist    
Mark Otto committed
2988

XhmikosR's avatar
Dist    
XhmikosR committed
2989
        _this7._resetAdjustments();
Mark Otto's avatar
dist    
Mark Otto committed
2990

XhmikosR's avatar
Dist    
XhmikosR committed
2991
        _this7._resetScrollbar();
Jacob Thornton's avatar
Jacob Thornton committed
2992

XhmikosR's avatar
XhmikosR committed
2993
        EventHandler.trigger(_this7._element, EVENT_HIDDEN$2);
XhmikosR's avatar
Dist    
XhmikosR committed
2994
2995
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
2996

XhmikosR's avatar
Dist    
XhmikosR committed
2997
    _proto._removeBackdrop = function _removeBackdrop() {
2998
      this._backdrop.parentNode.removeChild(this._backdrop);
XhmikosR's avatar
XhmikosR committed
2999

3000
      this._backdrop = null;
XhmikosR's avatar
Dist    
XhmikosR committed
3001
    };
Jacob Thornton's avatar
Jacob Thornton committed
3002

XhmikosR's avatar
Dist    
XhmikosR committed
3003
3004
    _proto._showBackdrop = function _showBackdrop(callback) {
      var _this8 = this;
Jacob Thornton's avatar
Jacob Thornton committed
3005

XhmikosR's avatar
XhmikosR committed
3006
      var animate = this._element.classList.contains(CLASS_NAME_FADE) ? CLASS_NAME_FADE : '';
Jacob Thornton's avatar
Jacob Thornton committed
3007

XhmikosR's avatar
Dist    
XhmikosR committed
3008
3009
      if (this._isShown && this._config.backdrop) {
        this._backdrop = document.createElement('div');
XhmikosR's avatar
XhmikosR committed
3010
        this._backdrop.className = CLASS_NAME_BACKDROP;
Mark Otto's avatar
grunt    
Mark Otto committed
3011

XhmikosR's avatar
Dist    
XhmikosR committed
3012
3013
3014
        if (animate) {
          this._backdrop.classList.add(animate);
        }
Jacob Thornton's avatar
Jacob Thornton committed
3015

XhmikosR's avatar
XhmikosR committed
3016
        document.body.appendChild(this._backdrop);
XhmikosR's avatar
XhmikosR committed
3017
        EventHandler.on(this._element, EVENT_CLICK_DISMISS, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
3018
3019
          if (_this8._ignoreBackdropClick) {
            _this8._ignoreBackdropClick = false;
Jacob Thornton's avatar
Jacob Thornton committed
3020
3021
            return;
          }
Mark Otto's avatar
dist    
Mark Otto committed
3022

XhmikosR's avatar
Dist    
XhmikosR committed
3023
          if (event.target !== event.currentTarget) {
Jacob Thornton's avatar
Jacob Thornton committed
3024
3025
            return;
          }
Mark Otto's avatar
dist    
Mark Otto committed
3026

XhmikosR's avatar
XhmikosR committed
3027
          _this8._triggerBackdropTransition();
XhmikosR's avatar
Dist    
XhmikosR committed
3028
        });
Jacob Thornton's avatar
Jacob Thornton committed
3029

XhmikosR's avatar
Dist    
XhmikosR committed
3030
        if (animate) {
XhmikosR's avatar
XhmikosR committed
3031
          reflow(this._backdrop);
XhmikosR's avatar
Dist    
XhmikosR committed
3032
        }
Jacob Thornton's avatar
Jacob Thornton committed
3033

XhmikosR's avatar
XhmikosR committed
3034
        this._backdrop.classList.add(CLASS_NAME_SHOW$2);
Jacob Thornton's avatar
Jacob Thornton committed
3035

XhmikosR's avatar
Dist    
XhmikosR committed
3036
        if (!animate) {
Jacob Thornton's avatar
Jacob Thornton committed
3037
          callback();
XhmikosR's avatar
Dist    
XhmikosR committed
3038
          return;
Jacob Thornton's avatar
Jacob Thornton committed
3039
3040
        }

XhmikosR's avatar
XhmikosR committed
3041
3042
3043
        var backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
        EventHandler.one(this._backdrop, TRANSITION_END, callback);
        emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
3044
      } else if (!this._isShown && this._backdrop) {
XhmikosR's avatar
XhmikosR committed
3045
        this._backdrop.classList.remove(CLASS_NAME_SHOW$2);
Jacob Thornton's avatar
Jacob Thornton committed
3046

XhmikosR's avatar
Dist    
XhmikosR committed
3047
3048
        var callbackRemove = function callbackRemove() {
          _this8._removeBackdrop();
Jacob Thornton's avatar
Jacob Thornton committed
3049

3050
          callback();
XhmikosR's avatar
Dist    
XhmikosR committed
3051
3052
        };

XhmikosR's avatar
XhmikosR committed
3053
        if (this._element.classList.contains(CLASS_NAME_FADE)) {
XhmikosR's avatar
XhmikosR committed
3054
          var _backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
Mark Otto's avatar
grunt    
Mark Otto committed
3055

XhmikosR's avatar
XhmikosR committed
3056
3057
          EventHandler.one(this._backdrop, TRANSITION_END, callbackRemove);
          emulateTransitionEnd(this._backdrop, _backdropTransitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
3058
3059
        } else {
          callbackRemove();
Mark Otto's avatar
dist    
Mark Otto committed
3060
        }
3061
      } else {
XhmikosR's avatar
Dist    
XhmikosR committed
3062
3063
        callback();
      }
XhmikosR's avatar
XhmikosR committed
3064
3065
3066
3067
3068
3069
    };

    _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
      var _this9 = this;

      if (this._config.backdrop === 'static') {
XhmikosR's avatar
XhmikosR committed
3070
        var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
XhmikosR's avatar
XhmikosR committed
3071
3072
3073
3074
3075

        if (hideEvent.defaultPrevented) {
          return;
        }

XhmikosR's avatar
XhmikosR committed
3076
        this._element.classList.add(CLASS_NAME_STATIC);
XhmikosR's avatar
XhmikosR committed
3077
3078
3079

        var modalTransitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, function () {
XhmikosR's avatar
XhmikosR committed
3080
          _this9._element.classList.remove(CLASS_NAME_STATIC);
XhmikosR's avatar
XhmikosR committed
3081
3082
3083
3084
3085
3086
3087
        });
        emulateTransitionEnd(this._element, modalTransitionDuration);

        this._element.focus();
      } else {
        this.hide();
      }
Mark Otto's avatar
Mark Otto committed
3088
    } // ----------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
3089
3090
    // the following methods are used to handle overflowing modals
    // ----------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
3091
    ;
Mark Otto's avatar
grunt    
Mark Otto committed
3092

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

XhmikosR's avatar
Dist    
XhmikosR committed
3096
3097
3098
      if (!this._isBodyOverflowing && isModalOverflowing) {
        this._element.style.paddingLeft = this._scrollbarWidth + "px";
      }
Mark Otto's avatar
dist    
Mark Otto committed
3099

XhmikosR's avatar
Dist    
XhmikosR committed
3100
3101
3102
3103
      if (this._isBodyOverflowing && !isModalOverflowing) {
        this._element.style.paddingRight = this._scrollbarWidth + "px";
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
3104

XhmikosR's avatar
Dist    
XhmikosR committed
3105
3106
3107
3108
    _proto._resetAdjustments = function _resetAdjustments() {
      this._element.style.paddingLeft = '';
      this._element.style.paddingRight = '';
    };
Mark Otto's avatar
dist    
Mark Otto committed
3109

XhmikosR's avatar
Dist    
XhmikosR committed
3110
3111
    _proto._checkScrollbar = function _checkScrollbar() {
      var rect = document.body.getBoundingClientRect();
XhmikosR's avatar
XhmikosR committed
3112
      this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
XhmikosR's avatar
Dist    
XhmikosR committed
3113
3114
      this._scrollbarWidth = this._getScrollbarWidth();
    };
Mark Otto's avatar
dist    
Mark Otto committed
3115

XhmikosR's avatar
Dist    
XhmikosR committed
3116
    _proto._setScrollbar = function _setScrollbar() {
XhmikosR's avatar
XhmikosR committed
3117
      var _this10 = this;
XhmikosR's avatar
Dist    
XhmikosR committed
3118
3119
3120
3121

      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
3122
        // Adjust fixed content padding
XhmikosR's avatar
XhmikosR committed
3123
        SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
XhmikosR's avatar
Dist    
XhmikosR committed
3124
          var actualPadding = element.style.paddingRight;
XhmikosR's avatar
XhmikosR committed
3125
3126
          var calculatedPadding = window.getComputedStyle(element)['padding-right'];
          Manipulator.setDataAttribute(element, 'padding-right', actualPadding);
XhmikosR's avatar
XhmikosR committed
3127
          element.style.paddingRight = parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px";
XhmikosR's avatar
Dist    
XhmikosR committed
3128
3129
        }); // Adjust sticky content margin

XhmikosR's avatar
XhmikosR committed
3130
        SelectorEngine.find(SELECTOR_STICKY_CONTENT).forEach(function (element) {
XhmikosR's avatar
Dist    
XhmikosR committed
3131
          var actualMargin = element.style.marginRight;
XhmikosR's avatar
XhmikosR committed
3132
3133
          var calculatedMargin = window.getComputedStyle(element)['margin-right'];
          Manipulator.setDataAttribute(element, 'margin-right', actualMargin);
XhmikosR's avatar
XhmikosR committed
3134
          element.style.marginRight = parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px";
XhmikosR's avatar
Dist    
XhmikosR committed
3135
3136
3137
        }); // Adjust body padding

        var actualPadding = document.body.style.paddingRight;
XhmikosR's avatar
XhmikosR committed
3138
3139
3140
        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
3141
      }
XhmikosR's avatar
Dist    
XhmikosR committed
3142

XhmikosR's avatar
XhmikosR committed
3143
      document.body.classList.add(CLASS_NAME_OPEN);
XhmikosR's avatar
Dist    
XhmikosR committed
3144
    };
Mark Otto's avatar
grunt    
Mark Otto committed
3145

XhmikosR's avatar
Dist    
XhmikosR committed
3146
3147
    _proto._resetScrollbar = function _resetScrollbar() {
      // Restore fixed content padding
XhmikosR's avatar
XhmikosR committed
3148
      SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
3149
3150
3151
3152
3153
3154
3155
        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
3156

XhmikosR's avatar
XhmikosR committed
3157
      SelectorEngine.find("" + SELECTOR_STICKY_CONTENT).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
3158
        var margin = Manipulator.getDataAttribute(element, 'margin-right');
Mark Otto's avatar
dist    
Mark Otto committed
3159

XhmikosR's avatar
Dist    
XhmikosR committed
3160
        if (typeof margin !== 'undefined') {
XhmikosR's avatar
XhmikosR committed
3161
3162
          Manipulator.removeDataAttribute(element, 'margin-right');
          element.style.marginRight = margin;
XhmikosR's avatar
Dist    
XhmikosR committed
3163
3164
        }
      }); // Restore body padding
Jacob Thornton's avatar
Jacob Thornton committed
3165

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

XhmikosR's avatar
Dist.    
XhmikosR committed
3168
3169
3170
      if (typeof padding === 'undefined') {
        document.body.style.paddingRight = '';
      } else {
XhmikosR's avatar
XhmikosR committed
3171
3172
3173
        Manipulator.removeDataAttribute(document.body, 'padding-right');
        document.body.style.paddingRight = padding;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
3174
    };
Mark Otto's avatar
grunt    
Mark Otto committed
3175

XhmikosR's avatar
Dist    
XhmikosR committed
3176
3177
3178
    _proto._getScrollbarWidth = function _getScrollbarWidth() {
      // thx d.walsh
      var scrollDiv = document.createElement('div');
XhmikosR's avatar
XhmikosR committed
3179
      scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
XhmikosR's avatar
Dist    
XhmikosR committed
3180
3181
3182
3183
      document.body.appendChild(scrollDiv);
      var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
      document.body.removeChild(scrollDiv);
      return scrollbarWidth;
Mark Otto's avatar
Mark Otto committed
3184
3185
    } // Static
    ;
Mark Otto's avatar
dist    
Mark Otto committed
3186

XhmikosR's avatar
XhmikosR committed
3187
    Modal.jQueryInterface = function jQueryInterface(config, relatedTarget) {
XhmikosR's avatar
Dist    
XhmikosR committed
3188
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
3189
        var data = Data.getData(this, DATA_KEY$5);
Mark Otto's avatar
grunt    
Mark Otto committed
3190

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

XhmikosR's avatar
Dist    
XhmikosR committed
3193
3194
3195
3196
3197
3198
3199
        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
3200
          }
Mark Otto's avatar
dist    
Mark Otto committed
3201

XhmikosR's avatar
Dist    
XhmikosR committed
3202
3203
3204
          data[config](relatedTarget);
        } else if (_config.show) {
          data.show(relatedTarget);
Mark Otto's avatar
dist    
Mark Otto committed
3205
        }
XhmikosR's avatar
Dist    
XhmikosR committed
3206
3207
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
3208

XhmikosR's avatar
XhmikosR committed
3209
    Modal.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
3210
3211
3212
      return Data.getData(element, DATA_KEY$5);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
    _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
3224

XhmikosR's avatar
Dist    
XhmikosR committed
3225
3226
3227
3228
3229
3230
3231
    return Modal;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
3232
3233


XhmikosR's avatar
XhmikosR committed
3234
  EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, function (event) {
XhmikosR's avatar
XhmikosR committed
3235
    var _this11 = this;
Jacob Thornton's avatar
Jacob Thornton committed
3236

XhmikosR's avatar
XhmikosR committed
3237
    var target = getElementFromSelector(this);
XhmikosR's avatar
Dist    
XhmikosR committed
3238
3239
3240
3241
3242

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

XhmikosR's avatar
XhmikosR committed
3243
    EventHandler.one(target, EVENT_SHOW$2, function (showEvent) {
XhmikosR's avatar
XhmikosR committed
3244
3245
      if (showEvent.defaultPrevented) {
        // only register focus restorer if modal will actually get shown
XhmikosR's avatar
Dist    
XhmikosR committed
3246
        return;
Jacob Thornton's avatar
Jacob Thornton committed
3247
3248
      }

XhmikosR's avatar
XhmikosR committed
3249
      EventHandler.one(target, EVENT_HIDDEN$2, function () {
XhmikosR's avatar
XhmikosR committed
3250
3251
        if (isVisible(_this11)) {
          _this11.focus();
Jacob Thornton's avatar
Jacob Thornton committed
3252
        }
Mark Otto's avatar
dist    
Mark Otto committed
3253
3254
      });
    });
XhmikosR's avatar
XhmikosR committed
3255
    var data = Data.getData(target, DATA_KEY$5);
Mark Otto's avatar
dist    
Mark Otto committed
3256

XhmikosR's avatar
XhmikosR committed
3257
    if (!data) {
XhmikosR's avatar
XhmikosR committed
3258
      var config = _objectSpread2(_objectSpread2({}, Manipulator.getDataAttributes(target)), Manipulator.getDataAttributes(this));
3259

XhmikosR's avatar
XhmikosR committed
3260
3261
3262
3263
      data = new Modal(target, config);
    }

    data.show(this);
XhmikosR's avatar
Dist    
XhmikosR committed
3264
  });
XhmikosR's avatar
XhmikosR committed
3265
  var $$6 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
3266
3267
3268
3269
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
3270
   * add .modal to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
3271
   */
Jacob Thornton's avatar
Jacob Thornton committed
3272

3273
3274
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
3275
3276
3277
3278
  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
3279

XhmikosR's avatar
XhmikosR committed
3280
3281
3282
    $$6.fn[NAME$5].noConflict = function () {
      $$6.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
      return Modal.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
3283
3284
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
3285

XhmikosR's avatar
XhmikosR committed
3286
3287
  /**
   * --------------------------------------------------------------------------
3288
   * Bootstrap (v5.0.0-alpha1): util/sanitizer.js
XhmikosR's avatar
XhmikosR committed
3289
3290
3291
3292
3293
   * 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
3294
3295
3296
3297
3298
3299
  /**
   * 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
   */

XhmikosR's avatar
XhmikosR committed
3300
  var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
XhmikosR's avatar
XhmikosR committed
3301
3302
3303
3304
3305
3306
  /**
   * 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
   */

XhmikosR's avatar
XhmikosR committed
3307
  var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
XhmikosR's avatar
XhmikosR committed
3308
3309
3310
3311
3312
3313

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

    if (allowedAttributeList.indexOf(attrName) !== -1) {
      if (uriAttrs.indexOf(attrName) !== -1) {
XhmikosR's avatar
XhmikosR committed
3314
        return SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue);
XhmikosR's avatar
XhmikosR committed
3315
3316
3317
3318
3319
3320
3321
3322
3323
      }

      return true;
    }

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

XhmikosR's avatar
XhmikosR committed
3324
3325
    for (var i = 0, len = regExp.length; i < len; i++) {
      if (regExp[i].test(attrName)) {
XhmikosR's avatar
XhmikosR committed
3326
3327
3328
3329
3330
3331
3332
        return true;
      }
    }

    return false;
  };

XhmikosR's avatar
XhmikosR committed
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
  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: [],
XhmikosR's avatar
XhmikosR committed
3352
    img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
XhmikosR's avatar
XhmikosR committed
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
    li: [],
    ol: [],
    p: [],
    pre: [],
    s: [],
    small: [],
    span: [],
    sub: [],
    sup: [],
    strong: [],
    u: [],
    ul: []
  };
  function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
XhmikosR's avatar
XhmikosR committed
3367
3368
    var _ref;

XhmikosR's avatar
XhmikosR committed
3369
    if (!unsafeHtml.length) {
XhmikosR's avatar
XhmikosR committed
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
      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
3380
3381

    var elements = (_ref = []).concat.apply(_ref, createdDocument.body.querySelectorAll('*'));
XhmikosR's avatar
XhmikosR committed
3382
3383

    var _loop = function _loop(i, len) {
XhmikosR's avatar
XhmikosR committed
3384
3385
      var _ref2;

XhmikosR's avatar
XhmikosR committed
3386
3387
3388
      var el = elements[i];
      var elName = el.nodeName.toLowerCase();

XhmikosR's avatar
XhmikosR committed
3389
      if (whitelistKeys.indexOf(elName) === -1) {
XhmikosR's avatar
XhmikosR committed
3390
3391
3392
3393
        el.parentNode.removeChild(el);
        return "continue";
      }

XhmikosR's avatar
XhmikosR committed
3394
3395
      var attributeList = (_ref2 = []).concat.apply(_ref2, el.attributes);

XhmikosR's avatar
XhmikosR committed
3396
3397
3398
3399
3400
3401
3402
3403
3404
      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++) {
3405
      var _ret = _loop(i);
XhmikosR's avatar
XhmikosR committed
3406
3407
3408
3409
3410
3411
3412

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

    return createdDocument.body.innerHTML;
  }

XhmikosR's avatar
Dist    
XhmikosR committed
3413
3414
3415
3416
3417
3418
3419
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$6 = 'tooltip';
3420
  var VERSION$6 = '5.0.0-alpha1';
XhmikosR's avatar
Dist    
XhmikosR committed
3421
3422
3423
3424
  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
3425
  var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
XhmikosR's avatar
Dist    
XhmikosR committed
3426
3427
3428
3429
3430
3431
3432
3433
3434
  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
3435
    offset: '(number|string|function)',
XhmikosR's avatar
Dist    
XhmikosR committed
3436
3437
    container: '(string|element|boolean)',
    fallbackPlacement: '(string|array)',
XhmikosR's avatar
XhmikosR committed
3438
3439
3440
    boundary: '(string|element)',
    sanitize: 'boolean',
    sanitizeFn: '(null|function)',
XhmikosR's avatar
XhmikosR committed
3441
3442
    whiteList: 'object',
    popperConfig: '(null|object)'
XhmikosR's avatar
Dist    
XhmikosR committed
3443
  };
XhmikosR's avatar
XhmikosR committed
3444
  var AttachmentMap = {
XhmikosR's avatar
Dist    
XhmikosR committed
3445
3446
3447
3448
3449
3450
3451
3452
    AUTO: 'auto',
    TOP: 'top',
    RIGHT: 'right',
    BOTTOM: 'bottom',
    LEFT: 'left'
  };
  var Default$4 = {
    animation: true,
XhmikosR's avatar
XhmikosR committed
3453
    template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>',
XhmikosR's avatar
Dist    
XhmikosR committed
3454
3455
3456
3457
3458
3459
3460
3461
3462
    trigger: 'hover focus',
    title: '',
    delay: 0,
    html: false,
    selector: false,
    placement: 'top',
    offset: 0,
    container: false,
    fallbackPlacement: 'flip',
XhmikosR's avatar
XhmikosR committed
3463
3464
3465
    boundary: 'scrollParent',
    sanitize: true,
    sanitizeFn: null,
XhmikosR's avatar
XhmikosR committed
3466
3467
    whiteList: DefaultWhitelist,
    popperConfig: null
XhmikosR's avatar
Dist    
XhmikosR committed
3468
  };
XhmikosR's avatar
XhmikosR committed
3469
  var Event$1 = {
XhmikosR's avatar
Dist    
XhmikosR committed
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
    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
  };
XhmikosR's avatar
XhmikosR committed
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
  var CLASS_NAME_FADE$1 = 'fade';
  var CLASS_NAME_MODAL = 'modal';
  var CLASS_NAME_SHOW$3 = 'show';
  var HOVER_STATE_SHOW = 'show';
  var HOVER_STATE_OUT = 'out';
  var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
  var TRIGGER_HOVER = 'hover';
  var TRIGGER_FOCUS = 'focus';
  var TRIGGER_CLICK = 'click';
  var TRIGGER_MANUAL = 'manual';
XhmikosR's avatar
XhmikosR committed
3491
3492
3493
3494
3495
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist    
XhmikosR committed
3496

XhmikosR's avatar
XhmikosR committed
3497
  var Tooltip = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
3498
3499
    function Tooltip(element, config) {
      if (typeof Popper === 'undefined') {
XhmikosR's avatar
XhmikosR committed
3500
        throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org)');
XhmikosR's avatar
Dist    
XhmikosR committed
3501
      } // private
Mark Otto's avatar
dist    
Mark Otto committed
3502
3503


XhmikosR's avatar
Dist    
XhmikosR committed
3504
3505
3506
3507
3508
      this._isEnabled = true;
      this._timeout = 0;
      this._hoverState = '';
      this._activeTrigger = {};
      this._popper = null; // Protected
Jacob Thornton's avatar
Jacob Thornton committed
3509

XhmikosR's avatar
Dist    
XhmikosR committed
3510
3511
3512
      this.element = element;
      this.config = this._getConfig(config);
      this.tip = null;
Jacob Thornton's avatar
Jacob Thornton committed
3513

XhmikosR's avatar
Dist    
XhmikosR committed
3514
      this._setListeners();
XhmikosR's avatar
XhmikosR committed
3515
3516

      Data.setData(element, this.constructor.DATA_KEY, this);
XhmikosR's avatar
Dist    
XhmikosR committed
3517
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
3518
3519


XhmikosR's avatar
Dist    
XhmikosR committed
3520
    var _proto = Tooltip.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
3521

XhmikosR's avatar
Dist    
XhmikosR committed
3522
3523
3524
3525
    // Public
    _proto.enable = function enable() {
      this._isEnabled = true;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3526

XhmikosR's avatar
Dist    
XhmikosR committed
3527
3528
3529
    _proto.disable = function disable() {
      this._isEnabled = false;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3530

XhmikosR's avatar
Dist    
XhmikosR committed
3531
3532
3533
    _proto.toggleEnabled = function toggleEnabled() {
      this._isEnabled = !this._isEnabled;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3534

XhmikosR's avatar
Dist    
XhmikosR committed
3535
3536
3537
3538
    _proto.toggle = function toggle(event) {
      if (!this._isEnabled) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3539

XhmikosR's avatar
Dist    
XhmikosR committed
3540
3541
      if (event) {
        var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
3542
        var context = Data.getData(event.target, dataKey);
Jacob Thornton's avatar
Jacob Thornton committed
3543

XhmikosR's avatar
Dist    
XhmikosR committed
3544
        if (!context) {
XhmikosR's avatar
XhmikosR committed
3545
3546
          context = new this.constructor(event.target, this._getDelegateConfig());
          Data.setData(event.target, dataKey, context);
Mark Otto's avatar
dist    
Mark Otto committed
3547
        }
Jacob Thornton's avatar
Jacob Thornton committed
3548

XhmikosR's avatar
Dist    
XhmikosR committed
3549
        context._activeTrigger.click = !context._activeTrigger.click;
Jacob Thornton's avatar
Jacob Thornton committed
3550

XhmikosR's avatar
Dist    
XhmikosR committed
3551
3552
        if (context._isWithActiveTrigger()) {
          context._enter(null, context);
Mark Otto's avatar
dist    
Mark Otto committed
3553
        } else {
XhmikosR's avatar
Dist    
XhmikosR committed
3554
3555
3556
          context._leave(null, context);
        }
      } else {
XhmikosR's avatar
XhmikosR committed
3557
        if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) {
XhmikosR's avatar
Dist    
XhmikosR committed
3558
          this._leave(null, this);
Jacob Thornton's avatar
Jacob Thornton committed
3559

XhmikosR's avatar
Dist    
XhmikosR committed
3560
          return;
Mark Otto's avatar
dist    
Mark Otto committed
3561
        }
Jacob Thornton's avatar
Jacob Thornton committed
3562

XhmikosR's avatar
Dist    
XhmikosR committed
3563
3564
3565
        this._enter(null, this);
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
3566

XhmikosR's avatar
Dist    
XhmikosR committed
3567
3568
    _proto.dispose = function dispose() {
      clearTimeout(this._timeout);
XhmikosR's avatar
XhmikosR committed
3569
3570
      Data.removeData(this.element, this.constructor.DATA_KEY);
      EventHandler.off(this.element, this.constructor.EVENT_KEY);
XhmikosR's avatar
XhmikosR committed
3571
      EventHandler.off(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
Jacob Thornton's avatar
Jacob Thornton committed
3572

XhmikosR's avatar
Dist    
XhmikosR committed
3573
      if (this.tip) {
XhmikosR's avatar
XhmikosR committed
3574
        this.tip.parentNode.removeChild(this.tip);
XhmikosR's avatar
Dist    
XhmikosR committed
3575
      }
Mark Otto's avatar
dist    
Mark Otto committed
3576

XhmikosR's avatar
Dist    
XhmikosR committed
3577
3578
3579
3580
      this._isEnabled = null;
      this._timeout = null;
      this._hoverState = null;
      this._activeTrigger = null;
Mark Otto's avatar
grunt    
Mark Otto committed
3581

XhmikosR's avatar
XhmikosR committed
3582
      if (this._popper) {
XhmikosR's avatar
Dist    
XhmikosR committed
3583
3584
        this._popper.destroy();
      }
Jacob Thornton's avatar
Jacob Thornton committed
3585

XhmikosR's avatar
Dist    
XhmikosR committed
3586
3587
3588
3589
3590
      this._popper = null;
      this.element = null;
      this.config = null;
      this.tip = null;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3591

XhmikosR's avatar
Dist    
XhmikosR committed
3592
3593
    _proto.show = function show() {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
3594

XhmikosR's avatar
XhmikosR committed
3595
      if (this.element.style.display === 'none') {
XhmikosR's avatar
Dist    
XhmikosR committed
3596
3597
        throw new Error('Please use show on visible elements');
      }
Mark Otto's avatar
dist    
Mark Otto committed
3598

XhmikosR's avatar
Dist    
XhmikosR committed
3599
      if (this.isWithContent() && this._isEnabled) {
XhmikosR's avatar
XhmikosR committed
3600
3601
        var showEvent = EventHandler.trigger(this.element, this.constructor.Event.SHOW);
        var shadowRoot = findShadowRoot(this.element);
XhmikosR's avatar
Dist.    
XhmikosR committed
3602
        var isInTheDom = shadowRoot === null ? this.element.ownerDocument.documentElement.contains(this.element) : shadowRoot.contains(this.element);
Jacob Thornton's avatar
Jacob Thornton committed
3603

XhmikosR's avatar
XhmikosR committed
3604
        if (showEvent.defaultPrevented || !isInTheDom) {
XhmikosR's avatar
Dist    
XhmikosR committed
3605
3606
          return;
        }
Mark Otto's avatar
dist    
Mark Otto committed
3607

XhmikosR's avatar
Dist    
XhmikosR committed
3608
        var tip = this.getTipElement();
XhmikosR's avatar
XhmikosR committed
3609
        var tipId = getUID(this.constructor.NAME);
XhmikosR's avatar
Dist    
XhmikosR committed
3610
3611
3612
        tip.setAttribute('id', tipId);
        this.element.setAttribute('aria-describedby', tipId);
        this.setContent();
Jacob Thornton's avatar
Jacob Thornton committed
3613

XhmikosR's avatar
Dist    
XhmikosR committed
3614
        if (this.config.animation) {
XhmikosR's avatar
XhmikosR committed
3615
          tip.classList.add(CLASS_NAME_FADE$1);
XhmikosR's avatar
Dist    
XhmikosR committed
3616
        }
Jacob Thornton's avatar
Jacob Thornton committed
3617

XhmikosR's avatar
Dist    
XhmikosR committed
3618
        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
3619

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

3622
        this._addAttachmentClass(attachment);
Mark Otto's avatar
dist    
Mark Otto committed
3623
3624
3625

        var container = this._getContainer();

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

XhmikosR's avatar
XhmikosR committed
3628
3629
        if (!this.element.ownerDocument.documentElement.contains(this.tip)) {
          container.appendChild(tip);
XhmikosR's avatar
Dist    
XhmikosR committed
3630
3631
        }

XhmikosR's avatar
XhmikosR committed
3632
        EventHandler.trigger(this.element, this.constructor.Event.INSERTED);
XhmikosR's avatar
XhmikosR committed
3633
        this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
XhmikosR's avatar
XhmikosR committed
3634
        tip.classList.add(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we add extra
XhmikosR's avatar
Dist    
XhmikosR committed
3635
3636
3637
        // 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
3638

XhmikosR's avatar
Dist    
XhmikosR committed
3639
        if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
3640
3641
3642
          var _ref;

          (_ref = []).concat.apply(_ref, document.body.children).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
3643
3644
            EventHandler.on(element, 'mouseover', noop());
          });
XhmikosR's avatar
Dist    
XhmikosR committed
3645
        }
Mark Otto's avatar
grunt    
Mark Otto committed
3646

XhmikosR's avatar
Dist    
XhmikosR committed
3647
3648
3649
3650
        var complete = function complete() {
          if (_this.config.animation) {
            _this._fixTransition();
          }
Mark Otto's avatar
dist    
Mark Otto committed
3651

XhmikosR's avatar
Dist    
XhmikosR committed
3652
3653
          var prevHoverState = _this._hoverState;
          _this._hoverState = null;
XhmikosR's avatar
XhmikosR committed
3654
          EventHandler.trigger(_this.element, _this.constructor.Event.SHOWN);
Jacob Thornton's avatar
Jacob Thornton committed
3655

XhmikosR's avatar
XhmikosR committed
3656
          if (prevHoverState === HOVER_STATE_OUT) {
XhmikosR's avatar
Dist    
XhmikosR committed
3657
            _this._leave(null, _this);
Mark Otto's avatar
dist    
Mark Otto committed
3658
          }
XhmikosR's avatar
Dist    
XhmikosR committed
3659
3660
        };

XhmikosR's avatar
XhmikosR committed
3661
        if (this.tip.classList.contains(CLASS_NAME_FADE$1)) {
XhmikosR's avatar
XhmikosR committed
3662
3663
3664
          var transitionDuration = getTransitionDurationFromElement(this.tip);
          EventHandler.one(this.tip, TRANSITION_END, complete);
          emulateTransitionEnd(this.tip, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
3665
3666
        } else {
          complete();
Mark Otto's avatar
dist    
Mark Otto committed
3667
        }
XhmikosR's avatar
Dist    
XhmikosR committed
3668
3669
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
3670

3671
    _proto.hide = function hide() {
XhmikosR's avatar
Dist    
XhmikosR committed
3672
      var _this2 = this;
Jacob Thornton's avatar
Jacob Thornton committed
3673

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

XhmikosR's avatar
Dist    
XhmikosR committed
3676
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
3677
        if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
XhmikosR's avatar
Dist    
XhmikosR committed
3678
3679
          tip.parentNode.removeChild(tip);
        }
Mark Otto's avatar
grunt    
Mark Otto committed
3680

XhmikosR's avatar
Dist    
XhmikosR committed
3681
        _this2._cleanTipClass();
Mark Otto's avatar
dist    
Mark Otto committed
3682

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

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

3687
        _this2._popper.destroy();
XhmikosR's avatar
Dist    
XhmikosR committed
3688
      };
Mark Otto's avatar
grunt    
Mark Otto committed
3689

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

XhmikosR's avatar
XhmikosR committed
3692
      if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
3693
3694
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3695

XhmikosR's avatar
XhmikosR committed
3696
      tip.classList.remove(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra
XhmikosR's avatar
Dist    
XhmikosR committed
3697
      // empty mouseover listeners we added for iOS support
Mark Otto's avatar
dist    
Mark Otto committed
3698

XhmikosR's avatar
Dist    
XhmikosR committed
3699
      if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
3700
3701
3702
        var _ref2;

        (_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
3703
3704
          return EventHandler.off(element, 'mouseover', noop);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
3705
      }
Jacob Thornton's avatar
Jacob Thornton committed
3706

XhmikosR's avatar
XhmikosR committed
3707
3708
3709
      this._activeTrigger[TRIGGER_CLICK] = false;
      this._activeTrigger[TRIGGER_FOCUS] = false;
      this._activeTrigger[TRIGGER_HOVER] = false;
Jacob Thornton's avatar
Jacob Thornton committed
3710

XhmikosR's avatar
XhmikosR committed
3711
      if (this.tip.classList.contains(CLASS_NAME_FADE$1)) {
XhmikosR's avatar
XhmikosR committed
3712
3713
3714
        var transitionDuration = getTransitionDurationFromElement(tip);
        EventHandler.one(tip, TRANSITION_END, complete);
        emulateTransitionEnd(tip, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
3715
3716
3717
      } else {
        complete();
      }
Jacob Thornton's avatar
Jacob Thornton committed
3718

XhmikosR's avatar
Dist    
XhmikosR committed
3719
3720
      this._hoverState = '';
    };
Jacob Thornton's avatar
Jacob Thornton committed
3721

XhmikosR's avatar
Dist    
XhmikosR committed
3722
3723
3724
3725
    _proto.update = function update() {
      if (this._popper !== null) {
        this._popper.scheduleUpdate();
      }
Mark Otto's avatar
Mark Otto committed
3726
3727
    } // Protected
    ;
Jacob Thornton's avatar
Jacob Thornton committed
3728

XhmikosR's avatar
Dist    
XhmikosR committed
3729
3730
3731
    _proto.isWithContent = function isWithContent() {
      return Boolean(this.getTitle());
    };
Jacob Thornton's avatar
Jacob Thornton committed
3732

XhmikosR's avatar
Dist    
XhmikosR committed
3733
    _proto.getTipElement = function getTipElement() {
XhmikosR's avatar
XhmikosR committed
3734
3735
3736
3737
3738
3739
3740
      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
3741
3742
      return this.tip;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3743

XhmikosR's avatar
Dist    
XhmikosR committed
3744
3745
    _proto.setContent = function setContent() {
      var tip = this.getTipElement();
XhmikosR's avatar
XhmikosR committed
3746
      this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
XhmikosR's avatar
XhmikosR committed
3747
      tip.classList.remove(CLASS_NAME_FADE$1, CLASS_NAME_SHOW$3);
XhmikosR's avatar
Dist    
XhmikosR committed
3748
    };
Jacob Thornton's avatar
Jacob Thornton committed
3749

XhmikosR's avatar
XhmikosR committed
3750
3751
3752
3753
3754
    _proto.setElementContent = function setElementContent(element, content) {
      if (element === null) {
        return;
      }

3755
      if (typeof content === 'object' && isElement(content)) {
XhmikosR's avatar
XhmikosR committed
3756
3757
3758
3759
3760
        if (content.jquery) {
          content = content[0];
        } // content is a DOM node or a jQuery


XhmikosR's avatar
XhmikosR committed
3761
        if (this.config.html) {
XhmikosR's avatar
XhmikosR committed
3762
3763
3764
          if (content.parentNode !== element) {
            element.innerHTML = '';
            element.appendChild(content);
Mark Otto's avatar
dist    
Mark Otto committed
3765
3766
          }
        } else {
XhmikosR's avatar
XhmikosR committed
3767
          element.textContent = content.textContent;
Mark Otto's avatar
dist    
Mark Otto committed
3768
        }
XhmikosR's avatar
XhmikosR committed
3769
3770
3771
3772
3773
3774
3775
3776
3777

        return;
      }

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

XhmikosR's avatar
XhmikosR committed
3778
        element.innerHTML = content;
XhmikosR's avatar
Dist    
XhmikosR committed
3779
      } else {
XhmikosR's avatar
XhmikosR committed
3780
        element.textContent = content;
XhmikosR's avatar
Dist    
XhmikosR committed
3781
3782
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
3783

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

XhmikosR's avatar
Dist    
XhmikosR committed
3787
3788
3789
      if (!title) {
        title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3790

XhmikosR's avatar
Dist    
XhmikosR committed
3791
      return title;
Mark Otto's avatar
Mark Otto committed
3792
3793
    } // Private
    ;
Jacob Thornton's avatar
Jacob Thornton committed
3794

XhmikosR's avatar
XhmikosR committed
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
    _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);
        }
      };
XhmikosR's avatar
XhmikosR committed
3821
      return _objectSpread2(_objectSpread2({}, defaultBsConfig), this.config.popperConfig);
XhmikosR's avatar
XhmikosR committed
3822
3823
    };

3824
3825
3826
3827
    _proto._addAttachmentClass = function _addAttachmentClass(attachment) {
      this.getTipElement().classList.add(CLASS_PREFIX + "-" + attachment);
    };

Mark Otto's avatar
Mark Otto committed
3828
    _proto._getOffset = function _getOffset() {
XhmikosR's avatar
XhmikosR committed
3829
      var _this4 = this;
Mark Otto's avatar
Mark Otto committed
3830
3831
3832
3833
3834

      var offset = {};

      if (typeof this.config.offset === 'function') {
        offset.fn = function (data) {
XhmikosR's avatar
XhmikosR committed
3835
          data.offsets = _objectSpread2(_objectSpread2({}, data.offsets), _this4.config.offset(data.offsets, _this4.element) || {});
Mark Otto's avatar
Mark Otto committed
3836
3837
3838
3839
3840
3841
3842
3843
3844
          return data;
        };
      } else {
        offset.offset = this.config.offset;
      }

      return offset;
    };

Mark Otto's avatar
dist    
Mark Otto committed
3845
3846
3847
3848
3849
    _proto._getContainer = function _getContainer() {
      if (this.config.container === false) {
        return document.body;
      }

XhmikosR's avatar
XhmikosR committed
3850
3851
      if (isElement(this.config.container)) {
        return this.config.container;
Mark Otto's avatar
dist    
Mark Otto committed
3852
3853
      }

XhmikosR's avatar
XhmikosR committed
3854
      return SelectorEngine.findOne(this.config.container);
Mark Otto's avatar
dist    
Mark Otto committed
3855
3856
    };

XhmikosR's avatar
Dist    
XhmikosR committed
3857
    _proto._getAttachment = function _getAttachment(placement) {
XhmikosR's avatar
XhmikosR committed
3858
      return AttachmentMap[placement.toUpperCase()];
XhmikosR's avatar
Dist    
XhmikosR committed
3859
    };
Mark Otto's avatar
dist    
Mark Otto committed
3860

XhmikosR's avatar
Dist    
XhmikosR committed
3861
    _proto._setListeners = function _setListeners() {
XhmikosR's avatar
XhmikosR committed
3862
      var _this5 = this;
Jacob Thornton's avatar
Jacob Thornton committed
3863

XhmikosR's avatar
Dist    
XhmikosR committed
3864
3865
3866
      var triggers = this.config.trigger.split(' ');
      triggers.forEach(function (trigger) {
        if (trigger === 'click') {
XhmikosR's avatar
XhmikosR committed
3867
3868
          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
3869
          });
XhmikosR's avatar
XhmikosR committed
3870
3871
3872
        } else if (trigger !== TRIGGER_MANUAL) {
          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;
XhmikosR's avatar
XhmikosR committed
3873
3874
          EventHandler.on(_this5.element, eventIn, _this5.config.selector, function (event) {
            return _this5._enter(event);
XhmikosR's avatar
XhmikosR committed
3875
          });
XhmikosR's avatar
XhmikosR committed
3876
3877
          EventHandler.on(_this5.element, eventOut, _this5.config.selector, function (event) {
            return _this5._leave(event);
Mark Otto's avatar
dist    
Mark Otto committed
3878
3879
          });
        }
XhmikosR's avatar
Dist    
XhmikosR committed
3880
      });
Mark Otto's avatar
dist v5    
Mark Otto committed
3881
3882

      this._hideModalHandler = function () {
XhmikosR's avatar
XhmikosR committed
3883
3884
        if (_this5.element) {
          _this5.hide();
XhmikosR's avatar
Dist    
XhmikosR committed
3885
        }
Mark Otto's avatar
dist v5    
Mark Otto committed
3886
3887
      };

XhmikosR's avatar
XhmikosR committed
3888
      EventHandler.on(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
Jacob Thornton's avatar
Jacob Thornton committed
3889

XhmikosR's avatar
Dist    
XhmikosR committed
3890
      if (this.config.selector) {
XhmikosR's avatar
XhmikosR committed
3891
        this.config = _objectSpread2(_objectSpread2({}, this.config), {}, {
XhmikosR's avatar
Dist    
XhmikosR committed
3892
3893
3894
3895
3896
3897
3898
          trigger: 'manual',
          selector: ''
        });
      } else {
        this._fixTitle();
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
3899

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

XhmikosR's avatar
Dist    
XhmikosR committed
3903
3904
3905
3906
3907
      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
3908

XhmikosR's avatar
Dist    
XhmikosR committed
3909
3910
    _proto._enter = function _enter(event, context) {
      var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
3911
      context = context || Data.getData(event.target, dataKey);
Jacob Thornton's avatar
Jacob Thornton committed
3912

XhmikosR's avatar
Dist    
XhmikosR committed
3913
      if (!context) {
XhmikosR's avatar
XhmikosR committed
3914
3915
        context = new this.constructor(event.target, this._getDelegateConfig());
        Data.setData(event.target, dataKey, context);
XhmikosR's avatar
Dist    
XhmikosR committed
3916
      }
Jacob Thornton's avatar
Jacob Thornton committed
3917

XhmikosR's avatar
Dist    
XhmikosR committed
3918
      if (event) {
XhmikosR's avatar
XhmikosR committed
3919
        context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
XhmikosR's avatar
Dist    
XhmikosR committed
3920
      }
Jacob Thornton's avatar
Jacob Thornton committed
3921

XhmikosR's avatar
XhmikosR committed
3922
3923
      if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) {
        context._hoverState = HOVER_STATE_SHOW;
XhmikosR's avatar
Dist    
XhmikosR committed
3924
3925
3926
3927
        return;
      }

      clearTimeout(context._timeout);
XhmikosR's avatar
XhmikosR committed
3928
      context._hoverState = HOVER_STATE_SHOW;
XhmikosR's avatar
Dist    
XhmikosR committed
3929
3930
3931
3932
3933

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

XhmikosR's avatar
Dist    
XhmikosR committed
3935
      context._timeout = setTimeout(function () {
XhmikosR's avatar
XhmikosR committed
3936
        if (context._hoverState === HOVER_STATE_SHOW) {
Mark Otto's avatar
dist    
Mark Otto committed
3937
3938
          context.show();
        }
XhmikosR's avatar
Dist    
XhmikosR committed
3939
3940
      }, context.config.delay.show);
    };
Jacob Thornton's avatar
Jacob Thornton committed
3941

XhmikosR's avatar
Dist    
XhmikosR committed
3942
3943
    _proto._leave = function _leave(event, context) {
      var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
3944
      context = context || Data.getData(event.target, dataKey);
Mark Otto's avatar
grunt    
Mark Otto committed
3945

XhmikosR's avatar
Dist    
XhmikosR committed
3946
      if (!context) {
XhmikosR's avatar
XhmikosR committed
3947
3948
        context = new this.constructor(event.target, this._getDelegateConfig());
        Data.setData(event.target, dataKey, context);
XhmikosR's avatar
Dist    
XhmikosR committed
3949
      }
Mark Otto's avatar
dist    
Mark Otto committed
3950

XhmikosR's avatar
Dist    
XhmikosR committed
3951
      if (event) {
XhmikosR's avatar
XhmikosR committed
3952
        context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
XhmikosR's avatar
Dist    
XhmikosR committed
3953
      }
Jacob Thornton's avatar
Jacob Thornton committed
3954

XhmikosR's avatar
Dist    
XhmikosR committed
3955
3956
3957
      if (context._isWithActiveTrigger()) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3958

XhmikosR's avatar
Dist    
XhmikosR committed
3959
      clearTimeout(context._timeout);
XhmikosR's avatar
XhmikosR committed
3960
      context._hoverState = HOVER_STATE_OUT;
Jacob Thornton's avatar
Jacob Thornton committed
3961

XhmikosR's avatar
Dist    
XhmikosR committed
3962
3963
3964
3965
      if (!context.config.delay || !context.config.delay.hide) {
        context.hide();
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
3966

XhmikosR's avatar
Dist    
XhmikosR committed
3967
      context._timeout = setTimeout(function () {
XhmikosR's avatar
XhmikosR committed
3968
        if (context._hoverState === HOVER_STATE_OUT) {
Mark Otto's avatar
dist    
Mark Otto committed
3969
3970
          context.hide();
        }
XhmikosR's avatar
Dist    
XhmikosR committed
3971
3972
      }, context.config.delay.hide);
    };
Jacob Thornton's avatar
Jacob Thornton committed
3973

XhmikosR's avatar
Dist    
XhmikosR committed
3974
3975
3976
3977
    _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
      for (var trigger in this._activeTrigger) {
        if (this._activeTrigger[trigger]) {
          return true;
Mark Otto's avatar
dist    
Mark Otto committed
3978
        }
XhmikosR's avatar
Dist    
XhmikosR committed
3979
      }
Jacob Thornton's avatar
Jacob Thornton committed
3980

XhmikosR's avatar
Dist    
XhmikosR committed
3981
3982
      return false;
    };
Jacob Thornton's avatar
Jacob Thornton committed
3983

XhmikosR's avatar
Dist    
XhmikosR committed
3984
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
3985
      var dataAttributes = Manipulator.getDataAttributes(this.element);
XhmikosR's avatar
XhmikosR committed
3986
3987
3988
3989
3990
      Object.keys(dataAttributes).forEach(function (dataAttr) {
        if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
          delete dataAttributes[dataAttr];
        }
      });
XhmikosR's avatar
XhmikosR committed
3991
3992
3993
3994
3995

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
3998
3999
4000
4001
4002
4003
      if (typeof config.delay === 'number') {
        config.delay = {
          show: config.delay,
          hide: config.delay
        };
      }
Mark Otto's avatar
grunt    
Mark Otto committed
4004

XhmikosR's avatar
Dist    
XhmikosR committed
4005
4006
4007
      if (typeof config.title === 'number') {
        config.title = config.title.toString();
      }
Jacob Thornton's avatar
Jacob Thornton committed
4008

XhmikosR's avatar
Dist    
XhmikosR committed
4009
4010
4011
      if (typeof config.content === 'number') {
        config.content = config.content.toString();
      }
Jacob Thornton's avatar
Jacob Thornton committed
4012

XhmikosR's avatar
XhmikosR committed
4013
      typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
XhmikosR's avatar
XhmikosR committed
4014
4015
4016
4017
4018

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

XhmikosR's avatar
Dist    
XhmikosR committed
4019
4020
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
4021

XhmikosR's avatar
Dist    
XhmikosR committed
4022
4023
    _proto._getDelegateConfig = function _getDelegateConfig() {
      var config = {};
Mark Otto's avatar
dist    
Mark Otto committed
4024

XhmikosR's avatar
Dist    
XhmikosR committed
4025
4026
4027
4028
      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
4029
4030
          }
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4031
      }
Mark Otto's avatar
dist    
Mark Otto committed
4032

XhmikosR's avatar
Dist    
XhmikosR committed
4033
4034
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
4035

XhmikosR's avatar
Dist    
XhmikosR committed
4036
    _proto._cleanTipClass = function _cleanTipClass() {
XhmikosR's avatar
XhmikosR committed
4037
4038
      var tip = this.getTipElement();
      var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
Mark Otto's avatar
dist    
Mark Otto committed
4039

XhmikosR's avatar
XhmikosR committed
4040
      if (tabClass !== null && tabClass.length > 0) {
XhmikosR's avatar
XhmikosR committed
4041
4042
4043
4044
4045
        tabClass.map(function (token) {
          return token.trim();
        }).forEach(function (tClass) {
          return tip.classList.remove(tClass);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
4046
4047
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
4048

XhmikosR's avatar
Dist    
XhmikosR committed
4049
4050
4051
    _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
      var popperInstance = popperData.instance;
      this.tip = popperInstance.popper;
Mark Otto's avatar
dist    
Mark Otto committed
4052

XhmikosR's avatar
Dist    
XhmikosR committed
4053
      this._cleanTipClass();
Mark Otto's avatar
dist    
Mark Otto committed
4054

4055
      this._addAttachmentClass(this._getAttachment(popperData.placement));
XhmikosR's avatar
Dist    
XhmikosR committed
4056
    };
Mark Otto's avatar
dist    
Mark Otto committed
4057

XhmikosR's avatar
Dist    
XhmikosR committed
4058
4059
4060
    _proto._fixTransition = function _fixTransition() {
      var tip = this.getTipElement();
      var initConfigAnimation = this.config.animation;
Jacob Thornton's avatar
Jacob Thornton committed
4061

XhmikosR's avatar
Dist    
XhmikosR committed
4062
4063
4064
      if (tip.getAttribute('x-placement') !== null) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
4065

XhmikosR's avatar
XhmikosR committed
4066
      tip.classList.remove(CLASS_NAME_FADE$1);
XhmikosR's avatar
Dist    
XhmikosR committed
4067
4068
4069
4070
      this.config.animation = false;
      this.hide();
      this.show();
      this.config.animation = initConfigAnimation;
Mark Otto's avatar
Mark Otto committed
4071
4072
    } // Static
    ;
Mark Otto's avatar
grunt    
Mark Otto committed
4073

XhmikosR's avatar
XhmikosR committed
4074
    Tooltip.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
4075
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4076
        var data = Data.getData(this, DATA_KEY$6);
Jacob Thornton's avatar
Jacob Thornton committed
4077

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

XhmikosR's avatar
Dist    
XhmikosR committed
4080
4081
4082
        if (!data && /dispose|hide/.test(config)) {
          return;
        }
Mark Otto's avatar
dist    
Mark Otto committed
4083

XhmikosR's avatar
Dist    
XhmikosR committed
4084
4085
4086
        if (!data) {
          data = new Tooltip(this, _config);
        }
Mark Otto's avatar
dist    
Mark Otto committed
4087

XhmikosR's avatar
Dist    
XhmikosR committed
4088
4089
4090
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
4091
4092
          }

XhmikosR's avatar
Dist    
XhmikosR committed
4093
          data[config]();
Mark Otto's avatar
dist    
Mark Otto committed
4094
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4095
4096
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
4097

XhmikosR's avatar
XhmikosR committed
4098
    Tooltip.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
4099
4100
4101
      return Data.getData(element, DATA_KEY$6);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
    _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
4125
        return Event$1;
XhmikosR's avatar
Dist    
XhmikosR committed
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
      }
    }, {
      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
4138

XhmikosR's avatar
Dist    
XhmikosR committed
4139
4140
    return Tooltip;
  }();
XhmikosR's avatar
XhmikosR committed
4141
4142

  var $$7 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
4143
4144
4145
4146
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
4147
   * add .tooltip to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
4148
   */
Mark Otto's avatar
dist    
Mark Otto committed
4149

4150
4151
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4152
4153
4154
4155
  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
4156

XhmikosR's avatar
XhmikosR committed
4157
4158
4159
    $$7.fn[NAME$6].noConflict = function () {
      $$7.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
      return Tooltip.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
4160
4161
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
4162

XhmikosR's avatar
Dist    
XhmikosR committed
4163
4164
4165
4166
4167
4168
4169
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$7 = 'popover';
4170
  var VERSION$7 = '5.0.0-alpha1';
XhmikosR's avatar
Dist    
XhmikosR committed
4171
4172
4173
4174
4175
  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');

XhmikosR's avatar
XhmikosR committed
4176
  var Default$5 = _objectSpread2(_objectSpread2({}, Tooltip.Default), {}, {
XhmikosR's avatar
Dist    
XhmikosR committed
4177
4178
4179
    placement: 'right',
    trigger: 'click',
    content: '',
XhmikosR's avatar
XhmikosR committed
4180
    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
4181
4182
  });

XhmikosR's avatar
XhmikosR committed
4183
  var DefaultType$5 = _objectSpread2(_objectSpread2({}, Tooltip.DefaultType), {}, {
XhmikosR's avatar
Dist    
XhmikosR committed
4184
4185
4186
    content: '(string|element|function)'
  });

XhmikosR's avatar
XhmikosR committed
4187
  var Event$2 = {
XhmikosR's avatar
Dist    
XhmikosR committed
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
    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
  };
XhmikosR's avatar
XhmikosR committed
4199
4200
4201
4202
  var CLASS_NAME_FADE$2 = 'fade';
  var CLASS_NAME_SHOW$4 = 'show';
  var SELECTOR_TITLE = '.popover-header';
  var SELECTOR_CONTENT = '.popover-body';
XhmikosR's avatar
XhmikosR committed
4203
4204
4205
4206
4207
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
4208

XhmikosR's avatar
XhmikosR committed
4209
  var Popover = /*#__PURE__*/function (_Tooltip) {
XhmikosR's avatar
Dist    
XhmikosR committed
4210
    _inheritsLoose(Popover, _Tooltip);
Jacob Thornton's avatar
Jacob Thornton committed
4211

XhmikosR's avatar
Dist    
XhmikosR committed
4212
4213
4214
    function Popover() {
      return _Tooltip.apply(this, arguments) || this;
    }
Mark Otto's avatar
grunt    
Mark Otto committed
4215

XhmikosR's avatar
Dist    
XhmikosR committed
4216
    var _proto = Popover.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
4217

XhmikosR's avatar
Dist    
XhmikosR committed
4218
4219
4220
4221
    // Overrides
    _proto.isWithContent = function isWithContent() {
      return this.getTitle() || this._getContent();
    };
Mark Otto's avatar
Mark Otto committed
4222

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

XhmikosR's avatar
XhmikosR committed
4226
      this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
Jacob Thornton's avatar
Jacob Thornton committed
4227

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

XhmikosR's avatar
Dist    
XhmikosR committed
4230
4231
4232
      if (typeof content === 'function') {
        content = content.call(this.element);
      }
Jacob Thornton's avatar
Jacob Thornton committed
4233

XhmikosR's avatar
XhmikosR committed
4234
      this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
XhmikosR's avatar
XhmikosR committed
4235
      tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$4);
XhmikosR's avatar
XhmikosR committed
4236
4237
4238
4239
    };

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

XhmikosR's avatar
Dist    
XhmikosR committed
4243
4244
4245
    _proto._getContent = function _getContent() {
      return this.element.getAttribute('data-content') || this.config.content;
    };
Jacob Thornton's avatar
Jacob Thornton committed
4246

XhmikosR's avatar
Dist    
XhmikosR committed
4247
    _proto._cleanTipClass = function _cleanTipClass() {
XhmikosR's avatar
XhmikosR committed
4248
4249
      var tip = this.getTipElement();
      var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX$1);
Jacob Thornton's avatar
Jacob Thornton committed
4250

XhmikosR's avatar
Dist    
XhmikosR committed
4251
      if (tabClass !== null && tabClass.length > 0) {
XhmikosR's avatar
XhmikosR committed
4252
4253
4254
4255
4256
        tabClass.map(function (token) {
          return token.trim();
        }).forEach(function (tClass) {
          return tip.classList.remove(tClass);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
4257
      }
Mark Otto's avatar
Mark Otto committed
4258
4259
    } // Static
    ;
Mark Otto's avatar
dist    
Mark Otto committed
4260

XhmikosR's avatar
XhmikosR committed
4261
    Popover.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
4262
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4263
        var data = Data.getData(this, DATA_KEY$7);
Mark Otto's avatar
dist    
Mark Otto committed
4264

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

XhmikosR's avatar
Dist    
XhmikosR committed
4267
4268
4269
        if (!data && /dispose|hide/.test(config)) {
          return;
        }
Mark Otto's avatar
build    
Mark Otto committed
4270

XhmikosR's avatar
Dist    
XhmikosR committed
4271
4272
        if (!data) {
          data = new Popover(this, _config);
XhmikosR's avatar
XhmikosR committed
4273
          Data.setData(this, DATA_KEY$7, data);
XhmikosR's avatar
Dist    
XhmikosR committed
4274
        }
Mark Otto's avatar
dist    
Mark Otto committed
4275

XhmikosR's avatar
Dist    
XhmikosR committed
4276
4277
4278
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
4279
          }
Jacob Thornton's avatar
Jacob Thornton committed
4280

XhmikosR's avatar
Dist    
XhmikosR committed
4281
          data[config]();
Mark Otto's avatar
dist    
Mark Otto committed
4282
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4283
4284
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
4285

XhmikosR's avatar
XhmikosR committed
4286
    Popover.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
4287
4288
4289
      return Data.getData(element, DATA_KEY$7);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
    _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
4314
        return Event$2;
XhmikosR's avatar
Dist    
XhmikosR committed
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
      }
    }, {
      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
4327

XhmikosR's avatar
Dist    
XhmikosR committed
4328
4329
    return Popover;
  }(Tooltip);
XhmikosR's avatar
XhmikosR committed
4330
4331

  var $$8 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
4332
4333
4334
4335
4336
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
4337

4338
4339
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4340
4341
4342
4343
  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
4344

XhmikosR's avatar
XhmikosR committed
4345
4346
4347
    $$8.fn[NAME$7].noConflict = function () {
      $$8.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
      return Popover.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
4348
4349
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
4350

XhmikosR's avatar
Dist    
XhmikosR committed
4351
4352
4353
4354
4355
4356
4357
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$8 = 'scrollspy';
4358
  var VERSION$8 = '5.0.0-alpha1';
XhmikosR's avatar
Dist    
XhmikosR committed
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
  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
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
  var EVENT_ACTIVATE = "activate" + EVENT_KEY$8;
  var EVENT_SCROLL = "scroll" + EVENT_KEY$8;
  var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$8 + DATA_API_KEY$6;
  var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
  var CLASS_NAME_ACTIVE$2 = 'active';
  var SELECTOR_DATA_SPY = '[data-spy="scroll"]';
  var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
  var SELECTOR_NAV_LINKS = '.nav-link';
  var SELECTOR_NAV_ITEMS = '.nav-item';
  var SELECTOR_LIST_ITEMS = '.list-group-item';
  var SELECTOR_DROPDOWN = '.dropdown';
  var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
  var METHOD_OFFSET = 'offset';
  var METHOD_POSITION = 'position';
XhmikosR's avatar
XhmikosR committed
4386
4387
4388
4389
4390
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist    
XhmikosR committed
4391

XhmikosR's avatar
XhmikosR committed
4392
  var ScrollSpy = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
4393
4394
4395
4396
4397
4398
    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
XhmikosR committed
4399
      this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " ." + CLASS_NAME_DROPDOWN_ITEM);
XhmikosR's avatar
Dist    
XhmikosR committed
4400
4401
4402
4403
      this._offsets = [];
      this._targets = [];
      this._activeTarget = null;
      this._scrollHeight = 0;
XhmikosR's avatar
XhmikosR committed
4404
      EventHandler.on(this._scrollElement, EVENT_SCROLL, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
4405
4406
4407
4408
4409
        return _this._process(event);
      });
      this.refresh();

      this._process();
XhmikosR's avatar
XhmikosR committed
4410
4411

      Data.setData(element, DATA_KEY$8, this);
XhmikosR's avatar
Dist    
XhmikosR committed
4412
4413
4414
4415
4416
4417
4418
4419
4420
    } // Getters


    var _proto = ScrollSpy.prototype;

    // Public
    _proto.refresh = function refresh() {
      var _this2 = this;

XhmikosR's avatar
XhmikosR committed
4421
      var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
XhmikosR's avatar
Dist    
XhmikosR committed
4422
      var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
XhmikosR's avatar
XhmikosR committed
4423
      var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
XhmikosR's avatar
Dist    
XhmikosR committed
4424
4425
4426
      this._offsets = [];
      this._targets = [];
      this._scrollHeight = this._getScrollHeight();
XhmikosR's avatar
XhmikosR committed
4427
      var targets = SelectorEngine.find(this._selector);
XhmikosR's avatar
Dist    
XhmikosR committed
4428
4429
      targets.map(function (element) {
        var target;
XhmikosR's avatar
XhmikosR committed
4430
        var targetSelector = getSelectorFromElement(element);
XhmikosR's avatar
Dist    
XhmikosR committed
4431
4432

        if (targetSelector) {
XhmikosR's avatar
XhmikosR committed
4433
          target = SelectorEngine.findOne(targetSelector);
XhmikosR's avatar
Dist    
XhmikosR committed
4434
4435
4436
4437
4438
4439
        }

        if (target) {
          var targetBCR = target.getBoundingClientRect();

          if (targetBCR.width || targetBCR.height) {
XhmikosR's avatar
XhmikosR committed
4440
            return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
XhmikosR's avatar
Dist    
XhmikosR committed
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
          }
        }

        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
4454
    };
XhmikosR's avatar
Dist    
XhmikosR committed
4455
4456

    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
4457
4458
      Data.removeData(this._element, DATA_KEY$8);
      EventHandler.off(this._scrollElement, EVENT_KEY$8);
XhmikosR's avatar
Dist    
XhmikosR committed
4459
4460
4461
4462
4463
4464
4465
4466
      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
4467
4468
    } // Private
    ;
XhmikosR's avatar
Dist    
XhmikosR committed
4469
4470

    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
4471
      config = _objectSpread2(_objectSpread2({}, Default$6), typeof config === 'object' && config ? config : {});
XhmikosR's avatar
Dist    
XhmikosR committed
4472

XhmikosR's avatar
XhmikosR committed
4473
      if (typeof config.target !== 'string' && isElement(config.target)) {
XhmikosR's avatar
XhmikosR committed
4474
        var id = config.target.id;
XhmikosR's avatar
Dist    
XhmikosR committed
4475
4476

        if (!id) {
XhmikosR's avatar
XhmikosR committed
4477
4478
          id = getUID(NAME$8);
          config.target.id = id;
XhmikosR's avatar
Dist    
XhmikosR committed
4479
4480
4481
4482
4483
        }

        config.target = "#" + id;
      }

XhmikosR's avatar
XhmikosR committed
4484
      typeCheckConfig(NAME$8, config, DefaultType$6);
XhmikosR's avatar
Dist    
XhmikosR committed
4485
      return config;
Mark Otto's avatar
dist    
Mark Otto committed
4486
    };
XhmikosR's avatar
Dist    
XhmikosR committed
4487
4488
4489

    _proto._getScrollTop = function _getScrollTop() {
      return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
Mark Otto's avatar
dist    
Mark Otto committed
4490
    };
XhmikosR's avatar
Dist    
XhmikosR committed
4491
4492
4493

    _proto._getScrollHeight = function _getScrollHeight() {
      return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
Mark Otto's avatar
dist    
Mark Otto committed
4494
    };
Mark Otto's avatar
grunt    
Mark Otto committed
4495

XhmikosR's avatar
Dist    
XhmikosR committed
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
    _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
4528

XhmikosR's avatar
XhmikosR committed
4529
      for (var i = this._offsets.length; i--;) {
XhmikosR's avatar
Dist    
XhmikosR committed
4530
        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
4531

XhmikosR's avatar
Dist    
XhmikosR committed
4532
4533
4534
4535
4536
        if (isActiveTarget) {
          this._activate(this._targets[i]);
        }
      }
    };
Jacob Thornton's avatar
Jacob Thornton committed
4537

XhmikosR's avatar
Dist    
XhmikosR committed
4538
4539
    _proto._activate = function _activate(target) {
      this._activeTarget = target;
Jacob Thornton's avatar
Jacob Thornton committed
4540

XhmikosR's avatar
Dist    
XhmikosR committed
4541
      this._clear();
Jacob Thornton's avatar
Jacob Thornton committed
4542

XhmikosR's avatar
Dist    
XhmikosR committed
4543
4544
      var queries = this._selector.split(',').map(function (selector) {
        return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
XhmikosR's avatar
Dist    
XhmikosR committed
4545
      });
XhmikosR's avatar
Dist    
XhmikosR committed
4546

XhmikosR's avatar
XhmikosR committed
4547
      var link = SelectorEngine.findOne(queries.join(','));
Mark Otto's avatar
dist    
Mark Otto committed
4548

XhmikosR's avatar
XhmikosR committed
4549
      if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
XhmikosR's avatar
XhmikosR committed
4550
        SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
4551
        link.classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
Dist    
XhmikosR committed
4552
4553
      } else {
        // Set triggered link as active
XhmikosR's avatar
XhmikosR committed
4554
4555
        link.classList.add(CLASS_NAME_ACTIVE$2);
        SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP).forEach(function (listGroup) {
XhmikosR's avatar
XhmikosR committed
4556
4557
          // Set triggered links parents as active
          // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
XhmikosR's avatar
XhmikosR committed
4558
4559
          SelectorEngine.prev(listGroup, SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).forEach(function (item) {
            return item.classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
4560
4561
          }); // Handle special case when .nav-link is inside .nav-item

XhmikosR's avatar
XhmikosR committed
4562
4563
4564
          SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach(function (navItem) {
            SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach(function (item) {
              return item.classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
4565
4566
4567
            });
          });
        });
XhmikosR's avatar
Dist    
XhmikosR committed
4568
      }
Mark Otto's avatar
dist    
Mark Otto committed
4569

XhmikosR's avatar
XhmikosR committed
4570
      EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, {
XhmikosR's avatar
Dist    
XhmikosR committed
4571
4572
4573
        relatedTarget: target
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
4574

XhmikosR's avatar
Dist    
XhmikosR committed
4575
    _proto._clear = function _clear() {
XhmikosR's avatar
XhmikosR committed
4576
4577
      SelectorEngine.find(this._selector).filter(function (node) {
        return node.classList.contains(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
Dist    
XhmikosR committed
4578
      }).forEach(function (node) {
XhmikosR's avatar
XhmikosR committed
4579
        return node.classList.remove(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
Dist    
XhmikosR committed
4580
      });
Mark Otto's avatar
Mark Otto committed
4581
4582
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
4583

XhmikosR's avatar
XhmikosR committed
4584
    ScrollSpy.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
4585
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4586
        var data = Data.getData(this, DATA_KEY$8);
Jacob Thornton's avatar
Jacob Thornton committed
4587

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

XhmikosR's avatar
Dist    
XhmikosR committed
4590
4591
        if (!data) {
          data = new ScrollSpy(this, _config);
Mark Otto's avatar
dist    
Mark Otto committed
4592
        }
Mark Otto's avatar
dist    
Mark Otto committed
4593

XhmikosR's avatar
Dist    
XhmikosR committed
4594
4595
4596
4597
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
          }
Mark Otto's avatar
grunt    
Mark Otto committed
4598

XhmikosR's avatar
Dist    
XhmikosR committed
4599
4600
4601
4602
          data[config]();
        }
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
4603

XhmikosR's avatar
XhmikosR committed
4604
    ScrollSpy.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
4605
4606
4607
      return Data.getData(element, DATA_KEY$8);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
    _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
4619

XhmikosR's avatar
Dist    
XhmikosR committed
4620
4621
4622
4623
4624
4625
4626
    return ScrollSpy;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
4627
4628


XhmikosR's avatar
XhmikosR committed
4629
4630
  EventHandler.on(window, EVENT_LOAD_DATA_API$1, function () {
    SelectorEngine.find(SELECTOR_DATA_SPY).forEach(function (spy) {
XhmikosR's avatar
XhmikosR committed
4631
4632
      return new ScrollSpy(spy, Manipulator.getDataAttributes(spy));
    });
XhmikosR's avatar
Dist    
XhmikosR committed
4633
  });
XhmikosR's avatar
XhmikosR committed
4634
  var $$9 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
4635
4636
4637
4638
4639
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
4640

4641
4642
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4643
4644
4645
4646
  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
4647

XhmikosR's avatar
XhmikosR committed
4648
4649
4650
    $$9.fn[NAME$8].noConflict = function () {
      $$9.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
      return ScrollSpy.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
4651
4652
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
4653

XhmikosR's avatar
Dist    
XhmikosR committed
4654
4655
4656
4657
4658
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
4659

XhmikosR's avatar
Dist    
XhmikosR committed
4660
  var NAME$9 = 'tab';
4661
  var VERSION$9 = '5.0.0-alpha1';
XhmikosR's avatar
Dist    
XhmikosR committed
4662
4663
4664
  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
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
  var EVENT_HIDE$3 = "hide" + EVENT_KEY$9;
  var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$9;
  var EVENT_SHOW$3 = "show" + EVENT_KEY$9;
  var EVENT_SHOWN$3 = "shown" + EVENT_KEY$9;
  var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$9 + DATA_API_KEY$7;
  var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
  var CLASS_NAME_ACTIVE$3 = 'active';
  var CLASS_NAME_DISABLED$2 = 'disabled';
  var CLASS_NAME_FADE$3 = 'fade';
  var CLASS_NAME_SHOW$5 = 'show';
  var SELECTOR_DROPDOWN$1 = '.dropdown';
  var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
  var SELECTOR_ACTIVE$2 = '.active';
  var SELECTOR_ACTIVE_UL = ':scope > li > .active';
  var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]';
  var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
  var SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
XhmikosR's avatar
XhmikosR committed
4682
4683
4684
4685
4686
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
4687

XhmikosR's avatar
XhmikosR committed
4688
  var Tab = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
4689
4690
    function Tab(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
4691
      Data.setData(this._element, DATA_KEY$9, this);
XhmikosR's avatar
Dist    
XhmikosR committed
4692
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
4693

Mark Otto's avatar
dist    
Mark Otto committed
4694

XhmikosR's avatar
Dist    
XhmikosR committed
4695
    var _proto = Tab.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
4696

XhmikosR's avatar
Dist    
XhmikosR committed
4697
4698
4699
    // Public
    _proto.show = function show() {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
4700

XhmikosR's avatar
XhmikosR committed
4701
      if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE$3) || this._element.classList.contains(CLASS_NAME_DISABLED$2)) {
XhmikosR's avatar
Dist    
XhmikosR committed
4702
4703
        return;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
4704

XhmikosR's avatar
Dist    
XhmikosR committed
4705
      var previous;
XhmikosR's avatar
XhmikosR committed
4706
      var target = getElementFromSelector(this._element);
XhmikosR's avatar
XhmikosR committed
4707
4708

      var listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP$1);
XhmikosR's avatar
Dist    
XhmikosR committed
4709
4710

      if (listElement) {
XhmikosR's avatar
XhmikosR committed
4711
4712
        var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE$2;
        previous = SelectorEngine.find(itemSelector, listElement);
XhmikosR's avatar
Dist    
XhmikosR committed
4713
4714
        previous = previous[previous.length - 1];
      }
Mark Otto's avatar
grunt    
Mark Otto committed
4715

XhmikosR's avatar
XhmikosR committed
4716
      var hideEvent = null;
Mark Otto's avatar
dist    
Mark Otto committed
4717

XhmikosR's avatar
Dist    
XhmikosR committed
4718
      if (previous) {
XhmikosR's avatar
XhmikosR committed
4719
        hideEvent = EventHandler.trigger(previous, EVENT_HIDE$3, {
XhmikosR's avatar
XhmikosR committed
4720
4721
          relatedTarget: this._element
        });
XhmikosR's avatar
Dist    
XhmikosR committed
4722
      }
Mark Otto's avatar
dist    
Mark Otto committed
4723

XhmikosR's avatar
XhmikosR committed
4724
      var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
XhmikosR's avatar
XhmikosR committed
4725
4726
        relatedTarget: previous
      });
Jacob Thornton's avatar
Jacob Thornton committed
4727

XhmikosR's avatar
XhmikosR committed
4728
      if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
4729
4730
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
4731

XhmikosR's avatar
Dist    
XhmikosR committed
4732
      this._activate(this._element, listElement);
Johann-S's avatar
build    
Johann-S committed
4733

XhmikosR's avatar
Dist    
XhmikosR committed
4734
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
4735
        EventHandler.trigger(previous, EVENT_HIDDEN$3, {
XhmikosR's avatar
Dist    
XhmikosR committed
4736
          relatedTarget: _this._element
Mark Otto's avatar
dist    
Mark Otto committed
4737
        });
XhmikosR's avatar
XhmikosR committed
4738
        EventHandler.trigger(_this._element, EVENT_SHOWN$3, {
XhmikosR's avatar
Dist    
XhmikosR committed
4739
4740
          relatedTarget: previous
        });
Mark Otto's avatar
dist    
Mark Otto committed
4741
      };
Johann-S's avatar
build    
Johann-S committed
4742

XhmikosR's avatar
Dist    
XhmikosR committed
4743
4744
4745
4746
4747
4748
      if (target) {
        this._activate(target, target.parentNode, complete);
      } else {
        complete();
      }
    };
Johann-S's avatar
build    
Johann-S committed
4749

XhmikosR's avatar
Dist    
XhmikosR committed
4750
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
4751
      Data.removeData(this._element, DATA_KEY$9);
XhmikosR's avatar
Dist    
XhmikosR committed
4752
      this._element = null;
Mark Otto's avatar
Mark Otto committed
4753
4754
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
4755

XhmikosR's avatar
Dist    
XhmikosR committed
4756
4757
    _proto._activate = function _activate(element, container, callback) {
      var _this2 = this;
Jacob Thornton's avatar
Jacob Thornton committed
4758

XhmikosR's avatar
XhmikosR committed
4759
      var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE$2);
XhmikosR's avatar
Dist    
XhmikosR committed
4760
      var active = activeElements[0];
XhmikosR's avatar
XhmikosR committed
4761
      var isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$3);
XhmikosR's avatar
Dist    
XhmikosR committed
4762
4763
4764

      var complete = function complete() {
        return _this2._transitionComplete(element, active, callback);
Mark Otto's avatar
dist    
Mark Otto committed
4765
      };
Mark Otto's avatar
dist    
Mark Otto committed
4766

XhmikosR's avatar
Dist    
XhmikosR committed
4767
      if (active && isTransitioning) {
XhmikosR's avatar
XhmikosR committed
4768
        var transitionDuration = getTransitionDurationFromElement(active);
XhmikosR's avatar
XhmikosR committed
4769
        active.classList.remove(CLASS_NAME_SHOW$5);
XhmikosR's avatar
XhmikosR committed
4770
4771
        EventHandler.one(active, TRANSITION_END, complete);
        emulateTransitionEnd(active, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
4772
4773
4774
4775
4776
4777
4778
      } else {
        complete();
      }
    };

    _proto._transitionComplete = function _transitionComplete(element, active, callback) {
      if (active) {
XhmikosR's avatar
XhmikosR committed
4779
4780
        active.classList.remove(CLASS_NAME_ACTIVE$3);
        var dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode);
XhmikosR's avatar
Dist    
XhmikosR committed
4781
4782

        if (dropdownChild) {
XhmikosR's avatar
XhmikosR committed
4783
          dropdownChild.classList.remove(CLASS_NAME_ACTIVE$3);
Mark Otto's avatar
grunt    
Mark Otto committed
4784
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4785
4786
4787

        if (active.getAttribute('role') === 'tab') {
          active.setAttribute('aria-selected', false);
Mark Otto's avatar
dist    
Mark Otto committed
4788
        }
XhmikosR's avatar
Dist    
XhmikosR committed
4789
      }
Mark Otto's avatar
dist    
Mark Otto committed
4790

XhmikosR's avatar
XhmikosR committed
4791
      element.classList.add(CLASS_NAME_ACTIVE$3);
XhmikosR's avatar
Dist    
XhmikosR committed
4792
4793
4794
4795

      if (element.getAttribute('role') === 'tab') {
        element.setAttribute('aria-selected', true);
      }
Mark Otto's avatar
dist    
Mark Otto committed
4796

XhmikosR's avatar
XhmikosR committed
4797
      reflow(element);
Mark Otto's avatar
Mark Otto committed
4798

XhmikosR's avatar
XhmikosR committed
4799
4800
      if (element.classList.contains(CLASS_NAME_FADE$3)) {
        element.classList.add(CLASS_NAME_SHOW$5);
Mark Otto's avatar
Mark Otto committed
4801
      }
Mark Otto's avatar
dist    
Mark Otto committed
4802

XhmikosR's avatar
XhmikosR committed
4803
      if (element.parentNode && element.parentNode.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
XhmikosR's avatar
XhmikosR committed
4804
        var dropdownElement = element.closest(SELECTOR_DROPDOWN$1);
Mark Otto's avatar
dist    
Mark Otto committed
4805

XhmikosR's avatar
Dist    
XhmikosR committed
4806
        if (dropdownElement) {
XhmikosR's avatar
XhmikosR committed
4807
4808
          SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE$1).forEach(function (dropdown) {
            return dropdown.classList.add(CLASS_NAME_ACTIVE$3);
XhmikosR's avatar
XhmikosR committed
4809
          });
XhmikosR's avatar
Dist    
XhmikosR committed
4810
        }
Jacob Thornton's avatar
Jacob Thornton committed
4811

XhmikosR's avatar
Dist    
XhmikosR committed
4812
        element.setAttribute('aria-expanded', true);
Mark Otto's avatar
dist    
Mark Otto committed
4813
      }
Mark Otto's avatar
dist    
Mark Otto committed
4814

XhmikosR's avatar
Dist    
XhmikosR committed
4815
4816
4817
      if (callback) {
        callback();
      }
Mark Otto's avatar
Mark Otto committed
4818
4819
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
4820

XhmikosR's avatar
XhmikosR committed
4821
    Tab.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
4822
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4823
        var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
XhmikosR's avatar
Dist    
XhmikosR committed
4824
4825
4826
4827
4828
4829
4830
4831
4832

        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
4833
    };
Jacob Thornton's avatar
Jacob Thornton committed
4834

XhmikosR's avatar
XhmikosR committed
4835
    Tab.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
4836
4837
4838
      return Data.getData(element, DATA_KEY$9);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
    _createClass(Tab, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$9;
      }
    }]);

    return Tab;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


XhmikosR's avatar
XhmikosR committed
4855
  EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$4, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
4856
    event.preventDefault();
XhmikosR's avatar
XhmikosR committed
4857
4858
    var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
    data.show();
XhmikosR's avatar
Dist    
XhmikosR committed
4859
  });
XhmikosR's avatar
XhmikosR committed
4860
  var $$a = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
4861
4862
4863
4864
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
4865
   * add .tab to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
4866
4867
   */

4868
4869
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
4870
4871
4872
4873
  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
4874

XhmikosR's avatar
XhmikosR committed
4875
4876
4877
    $$a.fn[NAME$9].noConflict = function () {
      $$a.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
      return Tab.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
4878
4879
    };
  }
Jacob Thornton's avatar
Jacob Thornton committed
4880
4881

  /**
XhmikosR's avatar
Dist    
XhmikosR committed
4882
4883
4884
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
Jacob Thornton's avatar
Jacob Thornton committed
4885
   */
Mark Otto's avatar
dist    
Mark Otto committed
4886

XhmikosR's avatar
Dist    
XhmikosR committed
4887
  var NAME$a = 'toast';
4888
  var VERSION$a = '5.0.0-alpha1';
XhmikosR's avatar
Dist    
XhmikosR committed
4889
4890
  var DATA_KEY$a = 'bs.toast';
  var EVENT_KEY$a = "." + DATA_KEY$a;
XhmikosR's avatar
XhmikosR committed
4891
4892
4893
4894
4895
4896
4897
4898
4899
  var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$a;
  var EVENT_HIDE$4 = "hide" + EVENT_KEY$a;
  var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$a;
  var EVENT_SHOW$4 = "show" + EVENT_KEY$a;
  var EVENT_SHOWN$4 = "shown" + EVENT_KEY$a;
  var CLASS_NAME_FADE$4 = 'fade';
  var CLASS_NAME_HIDE = 'hide';
  var CLASS_NAME_SHOW$6 = 'show';
  var CLASS_NAME_SHOWING = 'showing';
XhmikosR's avatar
Dist    
XhmikosR committed
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
  var DefaultType$7 = {
    animation: 'boolean',
    autohide: 'boolean',
    delay: 'number'
  };
  var Default$7 = {
    animation: true,
    autohide: true,
    delay: 500
  };
XhmikosR's avatar
XhmikosR committed
4910
  var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="toast"]';
XhmikosR's avatar
XhmikosR committed
4911
4912
4913
4914
4915
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
4916

XhmikosR's avatar
XhmikosR committed
4917
  var Toast = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
4918
4919
4920
4921
    function Toast(element, config) {
      this._element = element;
      this._config = this._getConfig(config);
      this._timeout = null;
Jacob Thornton's avatar
Jacob Thornton committed
4922

XhmikosR's avatar
Dist    
XhmikosR committed
4923
      this._setListeners();
XhmikosR's avatar
XhmikosR committed
4924
4925

      Data.setData(element, DATA_KEY$a, this);
XhmikosR's avatar
Dist    
XhmikosR committed
4926
    } // Getters
Jacob Thornton's avatar
Jacob Thornton committed
4927

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

XhmikosR's avatar
Dist    
XhmikosR committed
4929
    var _proto = Toast.prototype;
XhmikosR's avatar
Dist    
XhmikosR committed
4930

XhmikosR's avatar
Dist    
XhmikosR committed
4931
4932
4933
    // Public
    _proto.show = function show() {
      var _this = this;
Jacob Thornton's avatar
Jacob Thornton committed
4934

XhmikosR's avatar
XhmikosR committed
4935
      var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4);
Mark Otto's avatar
dist v5    
Mark Otto committed
4936
4937
4938
4939

      if (showEvent.defaultPrevented) {
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
4940

XhmikosR's avatar
Dist    
XhmikosR committed
4941
      if (this._config.animation) {
XhmikosR's avatar
XhmikosR committed
4942
        this._element.classList.add(CLASS_NAME_FADE$4);
XhmikosR's avatar
Dist    
XhmikosR committed
4943
      }
Mark Otto's avatar
dist    
Mark Otto committed
4944

XhmikosR's avatar
Dist    
XhmikosR committed
4945
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
4946
        _this._element.classList.remove(CLASS_NAME_SHOWING);
Mark Otto's avatar
dist    
Mark Otto committed
4947

XhmikosR's avatar
XhmikosR committed
4948
        _this._element.classList.add(CLASS_NAME_SHOW$6);
Mark Otto's avatar
dist    
Mark Otto committed
4949

XhmikosR's avatar
XhmikosR committed
4950
        EventHandler.trigger(_this._element, EVENT_SHOWN$4);
Mark Otto's avatar
dist    
Mark Otto committed
4951

XhmikosR's avatar
Dist    
XhmikosR committed
4952
        if (_this._config.autohide) {
XhmikosR's avatar
XhmikosR committed
4953
4954
4955
          _this._timeout = setTimeout(function () {
            _this.hide();
          }, _this._config.delay);
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
      this._element.classList.remove(CLASS_NAME_HIDE);
Mark Otto's avatar
dist    
Mark Otto committed
4960

4961
4962
      reflow(this._element);

XhmikosR's avatar
XhmikosR committed
4963
      this._element.classList.add(CLASS_NAME_SHOWING);
Mark Otto's avatar
dist    
Mark Otto committed
4964

XhmikosR's avatar
Dist    
XhmikosR committed
4965
      if (this._config.animation) {
XhmikosR's avatar
XhmikosR committed
4966
4967
4968
        var transitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, complete);
        emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
4969
4970
4971
4972
      } else {
        complete();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
4973

XhmikosR's avatar
XhmikosR committed
4974
    _proto.hide = function hide() {
XhmikosR's avatar
Dist    
XhmikosR committed
4975
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
4976

XhmikosR's avatar
XhmikosR committed
4977
      if (!this._element.classList.contains(CLASS_NAME_SHOW$6)) {
XhmikosR's avatar
Dist    
XhmikosR committed
4978
4979
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
4980

XhmikosR's avatar
XhmikosR committed
4981
      var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4);
Mark Otto's avatar
dist v5    
Mark Otto committed
4982
4983
4984
4985

      if (hideEvent.defaultPrevented) {
        return;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
4986

XhmikosR's avatar
XhmikosR committed
4987
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
4988
        _this2._element.classList.add(CLASS_NAME_HIDE);
XhmikosR's avatar
XhmikosR committed
4989

XhmikosR's avatar
XhmikosR committed
4990
        EventHandler.trigger(_this2._element, EVENT_HIDDEN$4);
XhmikosR's avatar
XhmikosR committed
4991
4992
      };

XhmikosR's avatar
XhmikosR committed
4993
      this._element.classList.remove(CLASS_NAME_SHOW$6);
XhmikosR's avatar
XhmikosR committed
4994
4995
4996
4997
4998

      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
4999
      } else {
XhmikosR's avatar
XhmikosR committed
5000
        complete();
XhmikosR's avatar
Dist    
XhmikosR committed
5001
5002
      }
    };
XhmikosR's avatar
Dist    
XhmikosR committed
5003

XhmikosR's avatar
Dist    
XhmikosR committed
5004
5005
5006
    _proto.dispose = function dispose() {
      clearTimeout(this._timeout);
      this._timeout = null;
Mark Otto's avatar
dist    
Mark Otto committed
5007

XhmikosR's avatar
XhmikosR committed
5008
5009
      if (this._element.classList.contains(CLASS_NAME_SHOW$6)) {
        this._element.classList.remove(CLASS_NAME_SHOW$6);
XhmikosR's avatar
Dist    
XhmikosR committed
5010
      }
Jacob Thornton's avatar
Jacob Thornton committed
5011

XhmikosR's avatar
XhmikosR committed
5012
      EventHandler.off(this._element, EVENT_CLICK_DISMISS$1);
XhmikosR's avatar
XhmikosR committed
5013
      Data.removeData(this._element, DATA_KEY$a);
XhmikosR's avatar
Dist    
XhmikosR committed
5014
5015
      this._element = null;
      this._config = null;
Mark Otto's avatar
Mark Otto committed
5016
5017
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
5018

XhmikosR's avatar
Dist    
XhmikosR committed
5019
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
5020
      config = _objectSpread2(_objectSpread2(_objectSpread2({}, Default$7), Manipulator.getDataAttributes(this._element)), typeof config === 'object' && config ? config : {});
XhmikosR's avatar
XhmikosR committed
5021
      typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
5022
5023
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
5024

XhmikosR's avatar
Dist    
XhmikosR committed
5025
5026
    _proto._setListeners = function _setListeners() {
      var _this3 = this;
Mark Otto's avatar
dist    
Mark Otto committed
5027

XhmikosR's avatar
XhmikosR committed
5028
      EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () {
XhmikosR's avatar
XhmikosR committed
5029
        return _this3.hide();
XhmikosR's avatar
Dist    
XhmikosR committed
5030
      });
Mark Otto's avatar
Mark Otto committed
5031
5032
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
5033

XhmikosR's avatar
XhmikosR committed
5034
    Toast.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
5035
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
5036
        var data = Data.getData(this, DATA_KEY$a);
Jacob Thornton's avatar
Jacob Thornton committed
5037

XhmikosR's avatar
Dist    
XhmikosR committed
5038
5039
5040
5041
5042
        var _config = typeof config === 'object' && config;

        if (!data) {
          data = new Toast(this, _config);
        }
Jacob Thornton's avatar
Jacob Thornton committed
5043

XhmikosR's avatar
Dist    
XhmikosR committed
5044
5045
5046
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
grunt    
Mark Otto committed
5047
          }
Mark Otto's avatar
dist    
Mark Otto committed
5048

XhmikosR's avatar
Dist    
XhmikosR committed
5049
          data[config](this);
XhmikosR's avatar
Dist    
XhmikosR committed
5050
        }
XhmikosR's avatar
Dist    
XhmikosR committed
5051
5052
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
5053

XhmikosR's avatar
XhmikosR committed
5054
    Toast.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
5055
5056
5057
      return Data.getData(element, DATA_KEY$a);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
    _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
5068
5069
5070
5071
5072
    }, {
      key: "Default",
      get: function get() {
        return Default$7;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
5073
    }]);
Jacob Thornton's avatar
Jacob Thornton committed
5074

XhmikosR's avatar
Dist    
XhmikosR committed
5075
5076
    return Toast;
  }();
XhmikosR's avatar
XhmikosR committed
5077
5078

  var $$b = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
5079
5080
5081
5082
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
5083
   *  add .toast to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
5084
   */
XhmikosR's avatar
Dist    
XhmikosR committed
5085

5086
5087
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
5088
5089
5090
5091
  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
5092

XhmikosR's avatar
XhmikosR committed
5093
5094
5095
    $$b.fn[NAME$a].noConflict = function () {
      $$b.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
      return Toast.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
5096
5097
    };
  }
Mark Otto's avatar
grunt    
Mark Otto committed
5098

Mark Otto's avatar
dist    
Mark Otto committed
5099
5100
  /**
   * --------------------------------------------------------------------------
5101
   * Bootstrap (v5.0.0-alpha1): index.umd.js
Mark Otto's avatar
dist    
Mark Otto committed
5102
5103
5104
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist.    
XhmikosR committed
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
  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
5118

XhmikosR's avatar
Dist.    
XhmikosR committed
5119
  return index_umd;
Mark Otto's avatar
dist    
Mark Otto committed
5120

XhmikosR's avatar
XhmikosR committed
5121
})));
Mark Otto's avatar
dist    
Mark Otto committed
5122
//# sourceMappingURL=bootstrap.js.map