bootstrap.bundle.js 239 KB
Newer Older
Mark Otto's avatar
dist  
Mark Otto committed
1
/*!
XhmikosR's avatar
XhmikosR committed
2
  * Bootstrap v5.0.0-alpha3 (https://getbootstrap.com/)
XhmikosR's avatar
XhmikosR committed
3
  * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
XhmikosR's avatar
XhmikosR committed
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
Mark Otto's avatar
dist  
Mark Otto committed
5
  */
Mark Otto's avatar
dist    
Mark Otto committed
6
(function (global, factory) {
XhmikosR's avatar
Dist.    
XhmikosR committed
7
8
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  typeof define === 'function' && define.amd ? define(factory) :
XhmikosR's avatar
XhmikosR committed
9
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bootstrap = factory());
XhmikosR's avatar
XhmikosR committed
10
}(this, (function () { 'use strict';
Mark Otto's avatar
dist  
Mark Otto committed
11

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

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

XhmikosR's avatar
XhmikosR committed
28
29
30
31
  function _extends() {
    _extends = Object.assign || function (target) {
      for (var i = 1; i < arguments.length; i++) {
        var source = arguments[i];
Mark Otto's avatar
dist    
Mark Otto committed
32

XhmikosR's avatar
XhmikosR committed
33
34
35
36
37
        for (var key in source) {
          if (Object.prototype.hasOwnProperty.call(source, key)) {
            target[key] = source[key];
          }
        }
Mark Otto's avatar
dist    
Mark Otto committed
38
39
      }

XhmikosR's avatar
XhmikosR committed
40
41
42
43
      return target;
    };

    return _extends.apply(this, arguments);
Mark Otto's avatar
dist    
Mark Otto committed
44
  }
Mark Otto's avatar
Mark Otto committed
45

Mark Otto's avatar
dist    
Mark Otto committed
46
47
48
49
50
  function _inheritsLoose(subClass, superClass) {
    subClass.prototype = Object.create(superClass.prototype);
    subClass.prototype.constructor = subClass;
    subClass.__proto__ = superClass;
  }
Mark Otto's avatar
dist  
Mark Otto committed
51
52

  /**
Mark Otto's avatar
dist    
Mark Otto committed
53
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
54
   * Bootstrap (v5.0.0-alpha3): util/index.js
XhmikosR's avatar
XhmikosR committed
55
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
Mark Otto's avatar
dist    
Mark Otto committed
56
   * --------------------------------------------------------------------------
Mark Otto's avatar
dist  
Mark Otto committed
57
   */
XhmikosR's avatar
XhmikosR committed
58
59
  var MAX_UID = 1000000;
  var MILLISECONDS_MULTIPLIER = 1000;
XhmikosR's avatar
XhmikosR committed
60
  var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
XhmikosR's avatar
XhmikosR committed
61
62

  var toType = function toType(obj) {
XhmikosR's avatar
XhmikosR committed
63
64
65
66
    if (obj === null || obj === undefined) {
      return "" + obj;
    }

XhmikosR's avatar
XhmikosR committed
67
68
    return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  };
XhmikosR's avatar
Dist    
XhmikosR committed
69
  /**
XhmikosR's avatar
XhmikosR committed
70
71
72
   * --------------------------------------------------------------------------
   * Public Util Api
   * --------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
73
   */
Mark Otto's avatar
dist  
Mark Otto committed
74
75


XhmikosR's avatar
XhmikosR committed
76
77
  var getUID = function getUID(prefix) {
    do {
Mark Otto's avatar
Mark Otto committed
78
      prefix += Math.floor(Math.random() * MAX_UID);
XhmikosR's avatar
XhmikosR committed
79
    } while (document.getElementById(prefix));
Mark Otto's avatar
dist  
Mark Otto committed
80

XhmikosR's avatar
XhmikosR committed
81
82
    return prefix;
  };
Mark Otto's avatar
dist  
Mark Otto committed
83

XhmikosR's avatar
XhmikosR committed
84
  var getSelector = function getSelector(element) {
XhmikosR's avatar
XhmikosR committed
85
    var selector = element.getAttribute('data-bs-target');
XhmikosR's avatar
XhmikosR committed
86
87
88

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

XhmikosR's avatar
XhmikosR committed
92
93
94
95
96
97
98
    return selector;
  };

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

    if (selector) {
XhmikosR's avatar
XhmikosR committed
99
100
      return document.querySelector(selector) ? selector : null;
    }
XhmikosR's avatar
XhmikosR committed
101
102
103
104
105
106
107

    return null;
  };

  var getElementFromSelector = function getElementFromSelector(element) {
    var selector = getSelector(element);
    return selector ? document.querySelector(selector) : null;
XhmikosR's avatar
XhmikosR committed
108
  };
Mark Otto's avatar
dist  
Mark Otto committed
109

XhmikosR's avatar
XhmikosR committed
110
111
112
113
114
115
116
117
118
119
  var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
    if (!element) {
      return 0;
    } // Get transition-duration of the element


    var _window$getComputedSt = window.getComputedStyle(element),
        transitionDuration = _window$getComputedSt.transitionDuration,
        transitionDelay = _window$getComputedSt.transitionDelay;

XhmikosR's avatar
XhmikosR committed
120
121
    var floatTransitionDuration = Number.parseFloat(transitionDuration);
    var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
XhmikosR's avatar
XhmikosR committed
122
123
124
125
126
127
128
129

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


    transitionDuration = transitionDuration.split(',')[0];
    transitionDelay = transitionDelay.split(',')[0];
XhmikosR's avatar
XhmikosR committed
130
    return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
XhmikosR's avatar
XhmikosR committed
131
132
133
  };

  var triggerTransitionEnd = function triggerTransitionEnd(element) {
XhmikosR's avatar
XhmikosR committed
134
    element.dispatchEvent(new Event(TRANSITION_END));
XhmikosR's avatar
XhmikosR committed
135
  };
Mark Otto's avatar
dist  
Mark Otto committed
136

XhmikosR's avatar
XhmikosR committed
137
138
139
140
141
  var isElement = function isElement(obj) {
    return (obj[0] || obj).nodeType;
  };

  var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
XhmikosR's avatar
Dist    
XhmikosR committed
142
    var called = false;
XhmikosR's avatar
XhmikosR committed
143
144
145
146
    var durationPadding = 5;
    var emulatedDuration = duration + durationPadding;

    function listener() {
XhmikosR's avatar
Dist    
XhmikosR committed
147
      called = true;
XhmikosR's avatar
XhmikosR committed
148
149
150
151
      element.removeEventListener(TRANSITION_END, listener);
    }

    element.addEventListener(TRANSITION_END, listener);
XhmikosR's avatar
Dist    
XhmikosR committed
152
153
    setTimeout(function () {
      if (!called) {
XhmikosR's avatar
XhmikosR committed
154
        triggerTransitionEnd(element);
XhmikosR's avatar
Dist    
XhmikosR committed
155
      }
XhmikosR's avatar
XhmikosR committed
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
    }, 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
177
178
179
      var elementStyle = getComputedStyle(element);
      var parentNodeStyle = getComputedStyle(element.parentNode);
      return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
XhmikosR's avatar
XhmikosR committed
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
    }

    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
206
  };
XhmikosR's avatar
XhmikosR committed
207
208
209
210
211
212
213
214

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

  var reflow = function reflow(element) {
    return element.offsetHeight;
  };
XhmikosR's avatar
Dist    
XhmikosR committed
215

XhmikosR's avatar
XhmikosR committed
216
217
218
219
  var getjQuery = function getjQuery() {
    var _window = window,
        jQuery = _window.jQuery;

XhmikosR's avatar
XhmikosR committed
220
    if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
XhmikosR's avatar
XhmikosR committed
221
222
223
224
225
226
      return jQuery;
    }

    return null;
  };

XhmikosR's avatar
XhmikosR committed
227
228
229
230
231
232
233
234
  var onDOMContentLoaded = function onDOMContentLoaded(callback) {
    if (document.readyState === 'loading') {
      document.addEventListener('DOMContentLoaded', callback);
    } else {
      callback();
    }
  };

XhmikosR's avatar
Dist    
XhmikosR committed
235
236
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
237
   * Bootstrap (v5.0.0-alpha3): dom/data.js
XhmikosR's avatar
XhmikosR committed
238
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist    
XhmikosR committed
239
240
   * --------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
241

XhmikosR's avatar
XhmikosR committed
242
243
244
245
246
247
248
249
250
251
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */
  var mapData = function () {
    var storeData = {};
    var id = 1;
    return {
      set: function set(element, key, data) {
XhmikosR's avatar
XhmikosR committed
252
253
        if (typeof element.bsKey === 'undefined') {
          element.bsKey = {
XhmikosR's avatar
XhmikosR committed
254
255
256
257
258
259
            key: key,
            id: id
          };
          id++;
        }

XhmikosR's avatar
XhmikosR committed
260
        storeData[element.bsKey.id] = data;
XhmikosR's avatar
XhmikosR committed
261
262
      },
      get: function get(element, key) {
XhmikosR's avatar
XhmikosR committed
263
        if (!element || typeof element.bsKey === 'undefined') {
XhmikosR's avatar
XhmikosR committed
264
265
          return null;
        }
Mark Otto's avatar
dist  
Mark Otto committed
266

XhmikosR's avatar
XhmikosR committed
267
        var keyProperties = element.bsKey;
Mark Otto's avatar
dist    
Mark Otto committed
268

XhmikosR's avatar
XhmikosR committed
269
270
271
        if (keyProperties.key === key) {
          return storeData[keyProperties.id];
        }
Mark Otto's avatar
dist    
Mark Otto committed
272

XhmikosR's avatar
XhmikosR committed
273
274
275
        return null;
      },
      delete: function _delete(element, key) {
XhmikosR's avatar
XhmikosR committed
276
        if (typeof element.bsKey === 'undefined') {
XhmikosR's avatar
XhmikosR committed
277
278
279
          return;
        }

XhmikosR's avatar
XhmikosR committed
280
        var keyProperties = element.bsKey;
XhmikosR's avatar
XhmikosR committed
281
282
283

        if (keyProperties.key === key) {
          delete storeData[keyProperties.id];
XhmikosR's avatar
XhmikosR committed
284
          delete element.bsKey;
XhmikosR's avatar
XhmikosR committed
285
        }
XhmikosR's avatar
Dist    
XhmikosR committed
286
      }
XhmikosR's avatar
XhmikosR committed
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
    };
  }();

  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
304
   * Bootstrap (v5.0.0-alpha3): dom/event-handler.js
XhmikosR's avatar
XhmikosR committed
305
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
XhmikosR committed
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
   * --------------------------------------------------------------------------
   */
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var namespaceRegex = /[^.]*(?=\..*)\.|.*/;
  var stripNameRegex = /\..*/;
  var stripUidRegex = /::\d+$/;
  var eventRegistry = {}; // Events storage

  var uidEvent = 1;
  var customEvents = {
    mouseenter: 'mouseover',
    mouseleave: 'mouseout'
  };
XhmikosR's avatar
XhmikosR committed
324
  var nativeEvents = new Set(['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']);
XhmikosR's avatar
XhmikosR committed
325
326
327
328
329
330
331
332
333
334
335
336
337
  /**
   * ------------------------------------------------------------------------
   * 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
338
339
    eventRegistry[uid] = eventRegistry[uid] || {};
    return eventRegistry[uid];
XhmikosR's avatar
XhmikosR committed
340
341
342
343
  }

  function bootstrapHandler(element, fn) {
    return function handler(event) {
XhmikosR's avatar
XhmikosR committed
344
345
      event.delegateTarget = element;

XhmikosR's avatar
XhmikosR committed
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
      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) {
XhmikosR's avatar
XhmikosR committed
361
362
            event.delegateTarget = target;

XhmikosR's avatar
XhmikosR committed
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
            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
382
383
384
385
    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
386
387

      if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
Mark Otto's avatar
dist v5    
Mark Otto committed
388
        return event;
XhmikosR's avatar
XhmikosR committed
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
      }
    }

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

XhmikosR's avatar
XhmikosR committed
406
    var isNative = nativeEvents.has(typeEvent);
XhmikosR's avatar
XhmikosR committed
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439

    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
440
    var fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
XhmikosR's avatar
XhmikosR committed
441
442
443
444
445
446
447
448
449
450
451
    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
452
    if (!fn) {
XhmikosR's avatar
XhmikosR committed
453
454
455
456
457
458
459
460
461
462
      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) {
XhmikosR's avatar
XhmikosR committed
463
      if (handlerKey.includes(namespace)) {
XhmikosR's avatar
XhmikosR committed
464
465
        var event = storeElementEvent[handlerKey];
        removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
Mark Otto's avatar
Mark Otto committed
466
      }
XhmikosR's avatar
XhmikosR committed
467
468
469
470
471
472
    });
  }

  var EventHandler = {
    on: function on(element, event, handler, delegationFn) {
      addHandler(element, event, handler, delegationFn, false);
XhmikosR's avatar
Dist    
XhmikosR committed
473
    },
XhmikosR's avatar
XhmikosR committed
474
475
476
477
478
479
480
    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;
      }
Mark Otto's avatar
dist    
Mark Otto committed
481

XhmikosR's avatar
XhmikosR committed
482
483
484
485
      var _normalizeParams2 = normalizeParams(originalTypeEvent, handler, delegationFn),
          delegation = _normalizeParams2[0],
          originalHandler = _normalizeParams2[1],
          typeEvent = _normalizeParams2[2];
Mark Otto's avatar
dist    
Mark Otto committed
486

XhmikosR's avatar
XhmikosR committed
487
488
      var inNamespace = typeEvent !== originalTypeEvent;
      var events = getEvent(element);
XhmikosR's avatar
XhmikosR committed
489
      var isNamespace = originalTypeEvent.startsWith('.');
Mark Otto's avatar
dist    
Mark Otto committed
490

XhmikosR's avatar
XhmikosR committed
491
492
493
494
495
496
497
498
499
500
501
502
      if (typeof originalHandler !== 'undefined') {
        // Simplest case: handler is passed, remove that listener ONLY.
        if (!events || !events[typeEvent]) {
          return;
        }

        removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
        return;
      }

      if (isNamespace) {
        Object.keys(events).forEach(function (elementEvent) {
XhmikosR's avatar
XhmikosR committed
503
          removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
XhmikosR's avatar
XhmikosR committed
504
505
        });
      }
Mark Otto's avatar
dist    
Mark Otto committed
506

XhmikosR's avatar
XhmikosR committed
507
508
509
      var storeElementEvent = events[typeEvent] || {};
      Object.keys(storeElementEvent).forEach(function (keyHandlers) {
        var handlerKey = keyHandlers.replace(stripUidRegex, '');
Mark Otto's avatar
dist    
Mark Otto committed
510

XhmikosR's avatar
XhmikosR committed
511
        if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
XhmikosR's avatar
XhmikosR committed
512
513
514
515
          var event = storeElementEvent[keyHandlers];
          removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
        }
      });
XhmikosR's avatar
Dist    
XhmikosR committed
516
    },
XhmikosR's avatar
XhmikosR committed
517
518
519
520
521
    trigger: function trigger(element, event, args) {
      if (typeof event !== 'string' || !element) {
        return null;
      }

XhmikosR's avatar
XhmikosR committed
522
      var $ = getjQuery();
XhmikosR's avatar
XhmikosR committed
523
524
      var typeEvent = event.replace(stripNameRegex, '');
      var inNamespace = event !== typeEvent;
XhmikosR's avatar
XhmikosR committed
525
      var isNative = nativeEvents.has(typeEvent);
XhmikosR's avatar
XhmikosR committed
526
527
528
529
530
531
      var jQueryEvent;
      var bubbles = true;
      var nativeDispatch = true;
      var defaultPrevented = false;
      var evt = null;

XhmikosR's avatar
XhmikosR committed
532
533
534
      if (inNamespace && $) {
        jQueryEvent = $.Event(event, args);
        $(element).trigger(jQueryEvent);
XhmikosR's avatar
XhmikosR committed
535
536
537
538
539
540
541
542
543
        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
544
        evt = new CustomEvent(event, {
XhmikosR's avatar
XhmikosR committed
545
546
547
          bubbles: bubbles,
          cancelable: true
        });
XhmikosR's avatar
XhmikosR committed
548
      } // merge custom information in our event
XhmikosR's avatar
XhmikosR committed
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576


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

      if (defaultPrevented) {
        evt.preventDefault();
      }

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

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

      return evt;
    }
  };

XhmikosR's avatar
Dist    
XhmikosR committed
577
578
579
580
581
582
583
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME = 'alert';
XhmikosR's avatar
XhmikosR committed
584
  var VERSION = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
585
586
587
  var DATA_KEY = 'bs.alert';
  var EVENT_KEY = "." + DATA_KEY;
  var DATA_API_KEY = '.data-api';
XhmikosR's avatar
XhmikosR committed
588
  var SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
XhmikosR's avatar
XhmikosR committed
589
590
591
592
593
594
  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
595
596
597
598
599
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
600

XhmikosR's avatar
XhmikosR committed
601
  var Alert = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
602
603
    function Alert(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
604
605
606
607

      if (this._element) {
        Data.setData(element, DATA_KEY, this);
      }
XhmikosR's avatar
Dist    
XhmikosR committed
608
    } // Getters
Mark Otto's avatar
dist  
Mark Otto committed
609
610


XhmikosR's avatar
Dist    
XhmikosR committed
611
    var _proto = Alert.prototype;
Mark Otto's avatar
dist  
Mark Otto committed
612

XhmikosR's avatar
Dist    
XhmikosR committed
613
614
    // Public
    _proto.close = function close(element) {
XhmikosR's avatar
XhmikosR committed
615
      var rootElement = element ? this._getRootElement(element) : this._element;
Mark Otto's avatar
dist    
Mark Otto committed
616

XhmikosR's avatar
Dist    
XhmikosR committed
617
      var customEvent = this._triggerCloseEvent(rootElement);
Mark Otto's avatar
dist  
Mark Otto committed
618

XhmikosR's avatar
XhmikosR committed
619
      if (customEvent === null || customEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
620
621
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
622

XhmikosR's avatar
Dist    
XhmikosR committed
623
624
      this._removeElement(rootElement);
    };
Mark Otto's avatar
dist  
Mark Otto committed
625

XhmikosR's avatar
Dist    
XhmikosR committed
626
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
627
      Data.removeData(this._element, DATA_KEY);
XhmikosR's avatar
Dist    
XhmikosR committed
628
      this._element = null;
Mark Otto's avatar
Mark Otto committed
629
630
    } // Private
    ;
Mark Otto's avatar
dist  
Mark Otto committed
631

XhmikosR's avatar
Dist    
XhmikosR committed
632
    _proto._getRootElement = function _getRootElement(element) {
XhmikosR's avatar
XhmikosR committed
633
      return getElementFromSelector(element) || element.closest("." + CLASSNAME_ALERT);
XhmikosR's avatar
Dist    
XhmikosR committed
634
    };
Mark Otto's avatar
dist  
Mark Otto committed
635

XhmikosR's avatar
Dist    
XhmikosR committed
636
    _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
XhmikosR's avatar
XhmikosR committed
637
      return EventHandler.trigger(element, EVENT_CLOSE);
XhmikosR's avatar
Dist    
XhmikosR committed
638
    };
Mark Otto's avatar
dist  
Mark Otto committed
639

XhmikosR's avatar
Dist    
XhmikosR committed
640
641
    _proto._removeElement = function _removeElement(element) {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
642

XhmikosR's avatar
XhmikosR committed
643
      element.classList.remove(CLASSNAME_SHOW);
Mark Otto's avatar
dist  
Mark Otto committed
644

XhmikosR's avatar
XhmikosR committed
645
      if (!element.classList.contains(CLASSNAME_FADE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
646
        this._destroyElement(element);
Mark Otto's avatar
dist    
Mark Otto committed
647

XhmikosR's avatar
Dist    
XhmikosR committed
648
649
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
650

XhmikosR's avatar
XhmikosR committed
651
      var transitionDuration = getTransitionDurationFromElement(element);
652
653
      EventHandler.one(element, TRANSITION_END, function () {
        return _this._destroyElement(element);
XhmikosR's avatar
XhmikosR committed
654
655
      });
      emulateTransitionEnd(element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
656
    };
Mark Otto's avatar
dist  
Mark Otto committed
657

XhmikosR's avatar
Dist    
XhmikosR committed
658
    _proto._destroyElement = function _destroyElement(element) {
XhmikosR's avatar
XhmikosR committed
659
660
661
662
      if (element.parentNode) {
        element.parentNode.removeChild(element);
      }

XhmikosR's avatar
XhmikosR committed
663
      EventHandler.trigger(element, EVENT_CLOSED);
Mark Otto's avatar
Mark Otto committed
664
665
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
666

XhmikosR's avatar
XhmikosR committed
667
    Alert.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
668
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
669
        var data = Data.getData(this, DATA_KEY);
Mark Otto's avatar
dist  
Mark Otto committed
670

XhmikosR's avatar
Dist    
XhmikosR committed
671
672
673
        if (!data) {
          data = new Alert(this);
        }
Mark Otto's avatar
dist  
Mark Otto committed
674

XhmikosR's avatar
Dist    
XhmikosR committed
675
676
677
678
679
        if (config === 'close') {
          data[config](this);
        }
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
680

XhmikosR's avatar
XhmikosR committed
681
    Alert.handleDismiss = function handleDismiss(alertInstance) {
XhmikosR's avatar
Dist    
XhmikosR committed
682
683
684
685
      return function (event) {
        if (event) {
          event.preventDefault();
        }
Mark Otto's avatar
dist  
Mark Otto committed
686

XhmikosR's avatar
Dist    
XhmikosR committed
687
        alertInstance.close(this);
Mark Otto's avatar
dist  
Mark Otto committed
688
      };
XhmikosR's avatar
Dist    
XhmikosR committed
689
    };
Mark Otto's avatar
dist  
Mark Otto committed
690

XhmikosR's avatar
XhmikosR committed
691
    Alert.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
692
693
694
      return Data.getData(element, DATA_KEY);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
695
696
697
698
699
700
    _createClass(Alert, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION;
      }
    }]);
Mark Otto's avatar
dist  
Mark Otto committed
701

XhmikosR's avatar
Dist    
XhmikosR committed
702
703
704
705
706
707
708
    return Alert;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
709

Mark Otto's avatar
dist    
Mark Otto committed
710

XhmikosR's avatar
XhmikosR committed
711
  EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
XhmikosR's avatar
Dist    
XhmikosR committed
712
713
714
715
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
716
   * add .Alert to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
717
   */
Mark Otto's avatar
dist  
Mark Otto committed
718

XhmikosR's avatar
XhmikosR committed
719
720
721
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
722

XhmikosR's avatar
XhmikosR committed
723
724
725
726
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME];
      $.fn[NAME] = Alert.jQueryInterface;
      $.fn[NAME].Constructor = Alert;
Mark Otto's avatar
dist  
Mark Otto committed
727

XhmikosR's avatar
XhmikosR committed
728
729
730
731
732
733
      $.fn[NAME].noConflict = function () {
        $.fn[NAME] = JQUERY_NO_CONFLICT;
        return Alert.jQueryInterface;
      };
    }
  });
Mark Otto's avatar
dist  
Mark Otto committed
734

XhmikosR's avatar
Dist    
XhmikosR committed
735
736
737
738
739
740
741
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$1 = 'button';
XhmikosR's avatar
XhmikosR committed
742
  var VERSION$1 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
743
744
745
  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
746
  var CLASS_NAME_ACTIVE = 'active';
XhmikosR's avatar
XhmikosR committed
747
  var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="button"]';
XhmikosR's avatar
XhmikosR committed
748
  var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1;
XhmikosR's avatar
XhmikosR committed
749
750
751
752
753
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
754

XhmikosR's avatar
XhmikosR committed
755
  var Button = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
756
757
    function Button(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
758
      Data.setData(element, DATA_KEY$1, this);
XhmikosR's avatar
Dist    
XhmikosR committed
759
    } // Getters
Mark Otto's avatar
dist  
Mark Otto committed
760
761


XhmikosR's avatar
Dist    
XhmikosR committed
762
    var _proto = Button.prototype;
Mark Otto's avatar
dist  
Mark Otto committed
763

XhmikosR's avatar
Dist    
XhmikosR committed
764
765
    // Public
    _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
766
767
      // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method
      this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE));
XhmikosR's avatar
Dist    
XhmikosR committed
768
    };
Mark Otto's avatar
dist  
Mark Otto committed
769

XhmikosR's avatar
Dist    
XhmikosR committed
770
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
771
      Data.removeData(this._element, DATA_KEY$1);
XhmikosR's avatar
Dist    
XhmikosR committed
772
      this._element = null;
Mark Otto's avatar
Mark Otto committed
773
774
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
775

XhmikosR's avatar
XhmikosR committed
776
    Button.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
777
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
778
        var data = Data.getData(this, DATA_KEY$1);
Mark Otto's avatar
dist  
Mark Otto committed
779

XhmikosR's avatar
Dist    
XhmikosR committed
780
781
782
        if (!data) {
          data = new Button(this);
        }
Mark Otto's avatar
dist  
Mark Otto committed
783

XhmikosR's avatar
Dist    
XhmikosR committed
784
785
        if (config === 'toggle') {
          data[config]();
Mark Otto's avatar
dist  
Mark Otto committed
786
        }
XhmikosR's avatar
Dist    
XhmikosR committed
787
788
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
789

XhmikosR's avatar
XhmikosR committed
790
    Button.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
791
792
793
      return Data.getData(element, DATA_KEY$1);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
794
795
796
797
798
799
    _createClass(Button, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$1;
      }
    }]);
Mark Otto's avatar
dist    
Mark Otto committed
800

XhmikosR's avatar
Dist    
XhmikosR committed
801
802
803
804
805
806
807
    return Button;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
808
809


XhmikosR's avatar
XhmikosR committed
810
  EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
811
    event.preventDefault();
XhmikosR's avatar
XhmikosR committed
812
    var button = event.target.closest(SELECTOR_DATA_TOGGLE);
XhmikosR's avatar
XhmikosR committed
813
814
815
816
    var data = Data.getData(button, DATA_KEY$1);

    if (!data) {
      data = new Button(button);
XhmikosR's avatar
Dist    
XhmikosR committed
817
    }
Mark Otto's avatar
dist    
Mark Otto committed
818

XhmikosR's avatar
XhmikosR committed
819
820
    data.toggle();
  });
XhmikosR's avatar
Dist    
XhmikosR committed
821
822
823
824
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
825
   * add .Button to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
826
   */
Mark Otto's avatar
dist  
Mark Otto committed
827

XhmikosR's avatar
XhmikosR committed
828
829
830
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
831

XhmikosR's avatar
XhmikosR committed
832
833
834
835
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$1];
      $.fn[NAME$1] = Button.jQueryInterface;
      $.fn[NAME$1].Constructor = Button;
XhmikosR's avatar
XhmikosR committed
836

XhmikosR's avatar
XhmikosR committed
837
838
839
840
841
842
      $.fn[NAME$1].noConflict = function () {
        $.fn[NAME$1] = JQUERY_NO_CONFLICT;
        return Button.jQueryInterface;
      };
    }
  });
XhmikosR's avatar
XhmikosR committed
843
844
845

  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
846
   * Bootstrap (v5.0.0-alpha3): dom/manipulator.js
XhmikosR's avatar
XhmikosR committed
847
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
XhmikosR committed
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
   * --------------------------------------------------------------------------
   */
  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;
  }

  function normalizeDataKey(key) {
    return key.replace(/[A-Z]/g, function (chr) {
XhmikosR's avatar
XhmikosR committed
872
      return "-" + chr.toLowerCase();
XhmikosR's avatar
XhmikosR committed
873
874
875
876
877
    });
  }

  var Manipulator = {
    setDataAttribute: function setDataAttribute(element, key, value) {
XhmikosR's avatar
XhmikosR committed
878
      element.setAttribute("data-bs-" + normalizeDataKey(key), value);
XhmikosR's avatar
XhmikosR committed
879
880
    },
    removeDataAttribute: function removeDataAttribute(element, key) {
XhmikosR's avatar
XhmikosR committed
881
      element.removeAttribute("data-bs-" + normalizeDataKey(key));
XhmikosR's avatar
XhmikosR committed
882
883
884
885
886
887
    },
    getDataAttributes: function getDataAttributes(element) {
      if (!element) {
        return {};
      }

XhmikosR's avatar
XhmikosR committed
888
889
890
891
892
893
894
      var attributes = {};
      Object.keys(element.dataset).filter(function (key) {
        return key.startsWith('bs');
      }).forEach(function (key) {
        var pureKey = key.replace(/^bs/, '');
        pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
        attributes[pureKey] = normalizeData(element.dataset[key]);
XhmikosR's avatar
XhmikosR committed
895
896
897
898
      });
      return attributes;
    },
    getDataAttribute: function getDataAttribute(element, key) {
XhmikosR's avatar
XhmikosR committed
899
      return normalizeData(element.getAttribute("data-bs-" + normalizeDataKey(key)));
XhmikosR's avatar
XhmikosR committed
900
901
902
903
904
905
906
907
908
909
910
911
912
913
    },
    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
      };
    }
XhmikosR's avatar
Dist    
XhmikosR committed
914
  };
Mark Otto's avatar
dist  
Mark Otto committed
915

XhmikosR's avatar
XhmikosR committed
916
917
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
918
   * Bootstrap (v5.0.0-alpha3): dom/selector-engine.js
XhmikosR's avatar
XhmikosR committed
919
920
921
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
   * --------------------------------------------------------------------------
   */
XhmikosR's avatar
XhmikosR committed
922

XhmikosR's avatar
XhmikosR committed
923
924
925
926
927
928
929
930
931
932
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */
  var NODE_TEXT = 3;
  var SelectorEngine = {
    matches: function matches(element, selector) {
      return element.matches(selector);
    },
XhmikosR's avatar
XhmikosR committed
933
    find: function find(selector, element) {
XhmikosR's avatar
XhmikosR committed
934
935
936
937
938
939
      var _ref;

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

XhmikosR's avatar
XhmikosR committed
940
      return (_ref = []).concat.apply(_ref, Element.prototype.querySelectorAll.call(element, selector));
XhmikosR's avatar
XhmikosR committed
941
    },
XhmikosR's avatar
XhmikosR committed
942
    findOne: function findOne(selector, element) {
XhmikosR's avatar
XhmikosR committed
943
944
945
946
      if (element === void 0) {
        element = document.documentElement;
      }

XhmikosR's avatar
XhmikosR committed
947
      return Element.prototype.querySelector.call(element, selector);
XhmikosR's avatar
XhmikosR committed
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
    },
    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 [];
    }
  };

Mark Otto's avatar
dist  
Mark Otto committed
1000
  /**
XhmikosR's avatar
Dist    
XhmikosR committed
1001
1002
1003
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
Mark Otto's avatar
dist  
Mark Otto committed
1004
   */
Mark Otto's avatar
dist    
Mark Otto committed
1005

XhmikosR's avatar
Dist    
XhmikosR committed
1006
  var NAME$2 = 'carousel';
XhmikosR's avatar
XhmikosR committed
1007
  var VERSION$2 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
1008
1009
1010
  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
1011
1012
  var ARROW_LEFT_KEY = 'ArrowLeft';
  var ARROW_RIGHT_KEY = 'ArrowRight';
XhmikosR's avatar
Dist    
XhmikosR committed
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
  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
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
  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';
XhmikosR's avatar
XhmikosR committed
1057
  var SELECTOR_ACTIVE = '.active';
XhmikosR's avatar
XhmikosR committed
1058
1059
1060
1061
1062
  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';
XhmikosR's avatar
XhmikosR committed
1063
1064
  var SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
  var SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
XhmikosR's avatar
Dist    
XhmikosR committed
1065
1066
1067
1068
  var PointerType = {
    TOUCH: 'touch',
    PEN: 'pen'
  };
XhmikosR's avatar
XhmikosR committed
1069
1070
1071
1072
1073
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
1074

XhmikosR's avatar
XhmikosR committed
1075
  var Carousel = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
    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
1087
      this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
1088
      this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
XhmikosR's avatar
XhmikosR committed
1089
      this._pointerEvent = Boolean(window.PointerEvent);
XhmikosR's avatar
Dist    
XhmikosR committed
1090
1091

      this._addEventListeners();
XhmikosR's avatar
XhmikosR committed
1092
1093

      Data.setData(element, DATA_KEY$2, this);
XhmikosR's avatar
Dist    
XhmikosR committed
1094
1095
1096
1097
1098
1099
1100
1101
    } // Getters


    var _proto = Carousel.prototype;

    // Public
    _proto.next = function next() {
      if (!this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1102
        this._slide(DIRECTION_NEXT);
XhmikosR's avatar
Dist    
XhmikosR committed
1103
      }
Mark Otto's avatar
dist    
Mark Otto committed
1104
    };
Mark Otto's avatar
dist  
Mark Otto committed
1105

XhmikosR's avatar
Dist    
XhmikosR committed
1106
1107
1108
    _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
1109
      if (!document.hidden && isVisible(this._element)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1110
1111
        this.next();
      }
Mark Otto's avatar
dist  
Mark Otto committed
1112
1113
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1114
1115
    _proto.prev = function prev() {
      if (!this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1116
        this._slide(DIRECTION_PREV);
XhmikosR's avatar
Dist    
XhmikosR committed
1117
1118
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1119

XhmikosR's avatar
Dist    
XhmikosR committed
1120
1121
1122
1123
    _proto.pause = function pause(event) {
      if (!event) {
        this._isPaused = true;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1124

XhmikosR's avatar
XhmikosR committed
1125
      if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
XhmikosR's avatar
XhmikosR committed
1126
        triggerTransitionEnd(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
1127
1128
        this.cycle(true);
      }
Mark Otto's avatar
dist  
Mark Otto committed
1129

XhmikosR's avatar
Dist    
XhmikosR committed
1130
1131
1132
      clearInterval(this._interval);
      this._interval = null;
    };
Mark Otto's avatar
dist  
Mark Otto committed
1133

XhmikosR's avatar
Dist    
XhmikosR committed
1134
1135
1136
1137
    _proto.cycle = function cycle(event) {
      if (!event) {
        this._isPaused = false;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1138

XhmikosR's avatar
Dist    
XhmikosR committed
1139
      if (this._interval) {
Mark Otto's avatar
dist    
Mark Otto committed
1140
1141
        clearInterval(this._interval);
        this._interval = null;
XhmikosR's avatar
Dist    
XhmikosR committed
1142
      }
Mark Otto's avatar
dist  
Mark Otto committed
1143

XhmikosR's avatar
XhmikosR committed
1144
      if (this._config && this._config.interval && !this._isPaused) {
XhmikosR's avatar
XhmikosR committed
1145
1146
        this._updateInterval();

XhmikosR's avatar
Dist    
XhmikosR committed
1147
1148
1149
        this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1150

XhmikosR's avatar
Dist    
XhmikosR committed
1151
1152
    _proto.to = function to(index) {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
1153

XhmikosR's avatar
XhmikosR committed
1154
      this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
Mark Otto's avatar
dist    
Mark Otto committed
1155

XhmikosR's avatar
Dist    
XhmikosR committed
1156
      var activeIndex = this._getItemIndex(this._activeElement);
Mark Otto's avatar
dist    
Mark Otto committed
1157

XhmikosR's avatar
Dist    
XhmikosR committed
1158
1159
1160
      if (index > this._items.length - 1 || index < 0) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1161

XhmikosR's avatar
Dist    
XhmikosR committed
1162
      if (this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1163
        EventHandler.one(this._element, EVENT_SLID, function () {
XhmikosR's avatar
Dist    
XhmikosR committed
1164
1165
1166
1167
          return _this.to(index);
        });
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1168

XhmikosR's avatar
Dist    
XhmikosR committed
1169
1170
1171
1172
1173
      if (activeIndex === index) {
        this.pause();
        this.cycle();
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1174

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

XhmikosR's avatar
Dist    
XhmikosR committed
1177
1178
      this._slide(direction, this._items[index]);
    };
Mark Otto's avatar
dist  
Mark Otto committed
1179

XhmikosR's avatar
Dist    
XhmikosR committed
1180
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
1181
1182
      EventHandler.off(this._element, EVENT_KEY$2);
      Data.removeData(this._element, DATA_KEY$2);
XhmikosR's avatar
Dist    
XhmikosR committed
1183
1184
1185
1186
1187
1188
1189
1190
      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
1191
1192
    } // Private
    ;
XhmikosR's avatar
Dist    
XhmikosR committed
1193
1194

    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
1195
      config = _extends({}, Default, config);
XhmikosR's avatar
XhmikosR committed
1196
      typeCheckConfig(NAME$2, config, DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
1197
1198
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
1199

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

XhmikosR's avatar
Dist    
XhmikosR committed
1203
1204
1205
      if (absDeltax <= SWIPE_THRESHOLD) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1206

XhmikosR's avatar
XhmikosR committed
1207
1208
      var direction = absDeltax / this.touchDeltaX;
      this.touchDeltaX = 0; // swipe left
Mark Otto's avatar
dist    
Mark Otto committed
1209

XhmikosR's avatar
Dist    
XhmikosR committed
1210
1211
1212
      if (direction > 0) {
        this.prev();
      } // swipe right
Mark Otto's avatar
dist    
Mark Otto committed
1213

Mark Otto's avatar
dist    
Mark Otto committed
1214

XhmikosR's avatar
Dist    
XhmikosR committed
1215
1216
1217
1218
      if (direction < 0) {
        this.next();
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1219

XhmikosR's avatar
Dist    
XhmikosR committed
1220
1221
    _proto._addEventListeners = function _addEventListeners() {
      var _this2 = this;
Mark Otto's avatar
dist  
Mark Otto committed
1222

XhmikosR's avatar
Dist    
XhmikosR committed
1223
      if (this._config.keyboard) {
XhmikosR's avatar
XhmikosR committed
1224
        EventHandler.on(this._element, EVENT_KEYDOWN, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1225
1226
1227
          return _this2._keydown(event);
        });
      }
Mark Otto's avatar
dist    
Mark Otto committed
1228

XhmikosR's avatar
Dist    
XhmikosR committed
1229
      if (this._config.pause === 'hover') {
XhmikosR's avatar
XhmikosR committed
1230
        EventHandler.on(this._element, EVENT_MOUSEENTER, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1231
          return _this2.pause(event);
XhmikosR's avatar
XhmikosR committed
1232
        });
XhmikosR's avatar
XhmikosR committed
1233
        EventHandler.on(this._element, EVENT_MOUSELEAVE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1234
1235
1236
          return _this2.cycle(event);
        });
      }
Mark Otto's avatar
dist    
Mark Otto committed
1237

1238
      if (this._config.touch && this._touchSupported) {
Mark Otto's avatar
Mark Otto committed
1239
1240
        this._addTouchEventListeners();
      }
XhmikosR's avatar
Dist    
XhmikosR committed
1241
    };
Mark Otto's avatar
dist  
Mark Otto committed
1242

XhmikosR's avatar
Dist    
XhmikosR committed
1243
1244
    _proto._addTouchEventListeners = function _addTouchEventListeners() {
      var _this3 = this;
Mark Otto's avatar
dist    
Mark Otto committed
1245

XhmikosR's avatar
Dist    
XhmikosR committed
1246
      var start = function start(event) {
XhmikosR's avatar
XhmikosR committed
1247
1248
        if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
          _this3.touchStartX = event.clientX;
XhmikosR's avatar
Dist    
XhmikosR committed
1249
        } else if (!_this3._pointerEvent) {
XhmikosR's avatar
XhmikosR committed
1250
          _this3.touchStartX = event.touches[0].clientX;
Mark Otto's avatar
dist    
Mark Otto committed
1251
1252
        }
      };
Mark Otto's avatar
dist  
Mark Otto committed
1253

XhmikosR's avatar
Dist    
XhmikosR committed
1254
1255
      var move = function move(event) {
        // ensure swiping with one touch and not pinching
XhmikosR's avatar
XhmikosR committed
1256
        if (event.touches && event.touches.length > 1) {
XhmikosR's avatar
Dist    
XhmikosR committed
1257
1258
          _this3.touchDeltaX = 0;
        } else {
XhmikosR's avatar
XhmikosR committed
1259
          _this3.touchDeltaX = event.touches[0].clientX - _this3.touchStartX;
XhmikosR's avatar
Dist    
XhmikosR committed
1260
        }
Mark Otto's avatar
dist    
Mark Otto committed
1261
      };
Mark Otto's avatar
dist    
Mark Otto committed
1262

XhmikosR's avatar
Dist    
XhmikosR committed
1263
      var end = function end(event) {
XhmikosR's avatar
XhmikosR committed
1264
1265
        if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
          _this3.touchDeltaX = event.clientX - _this3.touchStartX;
XhmikosR's avatar
Dist    
XhmikosR committed
1266
1267
1268
        }

        _this3._handleSwipe();
Mark Otto's avatar
dist    
Mark Otto committed
1269

XhmikosR's avatar
Dist    
XhmikosR committed
1270
1271
1272
1273
1274
1275
1276
1277
1278
        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
1279

XhmikosR's avatar
Dist    
XhmikosR committed
1280
1281
1282
          if (_this3.touchTimeout) {
            clearTimeout(_this3.touchTimeout);
          }
Mark Otto's avatar
dist  
Mark Otto committed
1283

XhmikosR's avatar
Dist    
XhmikosR committed
1284
1285
1286
          _this3.touchTimeout = setTimeout(function (event) {
            return _this3.cycle(event);
          }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
Mark Otto's avatar
dist    
Mark Otto committed
1287
1288
        }
      };
Mark Otto's avatar
dist    
Mark Otto committed
1289

XhmikosR's avatar
XhmikosR committed
1290
1291
      SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(function (itemImg) {
        EventHandler.on(itemImg, EVENT_DRAG_START, function (e) {
XhmikosR's avatar
XhmikosR committed
1292
1293
          return e.preventDefault();
        });
XhmikosR's avatar
Dist    
XhmikosR committed
1294
      });
Mark Otto's avatar
dist    
Mark Otto committed
1295

XhmikosR's avatar
Dist    
XhmikosR committed
1296
      if (this._pointerEvent) {
XhmikosR's avatar
XhmikosR committed
1297
        EventHandler.on(this._element, EVENT_POINTERDOWN, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1298
1299
          return start(event);
        });
XhmikosR's avatar
XhmikosR committed
1300
        EventHandler.on(this._element, EVENT_POINTERUP, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1301
1302
          return end(event);
        });
Mark Otto's avatar
dist    
Mark Otto committed
1303

XhmikosR's avatar
XhmikosR committed
1304
        this._element.classList.add(CLASS_NAME_POINTER_EVENT);
XhmikosR's avatar
Dist    
XhmikosR committed
1305
      } else {
XhmikosR's avatar
XhmikosR committed
1306
        EventHandler.on(this._element, EVENT_TOUCHSTART, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1307
          return start(event);
Mark Otto's avatar
dist    
Mark Otto committed
1308
        });
XhmikosR's avatar
XhmikosR committed
1309
        EventHandler.on(this._element, EVENT_TOUCHMOVE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1310
1311
          return move(event);
        });
XhmikosR's avatar
XhmikosR committed
1312
        EventHandler.on(this._element, EVENT_TOUCHEND, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1313
1314
1315
1316
          return end(event);
        });
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1317

XhmikosR's avatar
Dist    
XhmikosR committed
1318
1319
1320
1321
    _proto._keydown = function _keydown(event) {
      if (/input|textarea/i.test(event.target.tagName)) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1322

XhmikosR's avatar
XhmikosR committed
1323
1324
      switch (event.key) {
        case ARROW_LEFT_KEY:
XhmikosR's avatar
Dist    
XhmikosR committed
1325
1326
1327
          event.preventDefault();
          this.prev();
          break;
Mark Otto's avatar
dist  
Mark Otto committed
1328

XhmikosR's avatar
XhmikosR committed
1329
        case ARROW_RIGHT_KEY:
XhmikosR's avatar
Dist    
XhmikosR committed
1330
1331
1332
1333
1334
          event.preventDefault();
          this.next();
          break;
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1335

XhmikosR's avatar
Dist    
XhmikosR committed
1336
    _proto._getItemIndex = function _getItemIndex(element) {
XhmikosR's avatar
XhmikosR committed
1337
      this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : [];
XhmikosR's avatar
Dist    
XhmikosR committed
1338
1339
      return this._items.indexOf(element);
    };
Mark Otto's avatar
dist    
Mark Otto committed
1340

XhmikosR's avatar
Dist    
XhmikosR committed
1341
    _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
XhmikosR's avatar
XhmikosR committed
1342
1343
      var isNextDirection = direction === DIRECTION_NEXT;
      var isPrevDirection = direction === DIRECTION_PREV;
Mark Otto's avatar
dist    
Mark Otto committed
1344

XhmikosR's avatar
Dist    
XhmikosR committed
1345
      var activeIndex = this._getItemIndex(activeElement);
Mark Otto's avatar
dist    
Mark Otto committed
1346

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

XhmikosR's avatar
Dist    
XhmikosR committed
1350
1351
1352
      if (isGoingToWrap && !this._config.wrap) {
        return activeElement;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1353

XhmikosR's avatar
XhmikosR committed
1354
      var delta = direction === DIRECTION_PREV ? -1 : 1;
XhmikosR's avatar
Dist    
XhmikosR committed
1355
1356
1357
      var itemIndex = (activeIndex + delta) % this._items.length;
      return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
    };
Mark Otto's avatar
dist  
Mark Otto committed
1358

XhmikosR's avatar
Dist    
XhmikosR committed
1359
1360
    _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
      var targetIndex = this._getItemIndex(relatedTarget);
Mark Otto's avatar
dist  
Mark Otto committed
1361

XhmikosR's avatar
XhmikosR committed
1362
      var fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element));
Mark Otto's avatar
dist    
Mark Otto committed
1363

XhmikosR's avatar
XhmikosR committed
1364
      return EventHandler.trigger(this._element, EVENT_SLIDE, {
XhmikosR's avatar
Dist    
XhmikosR committed
1365
1366
1367
1368
1369
1370
        relatedTarget: relatedTarget,
        direction: eventDirectionName,
        from: fromIndex,
        to: targetIndex
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
1371

XhmikosR's avatar
Dist    
XhmikosR committed
1372
1373
    _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
      if (this._indicatorsElement) {
XhmikosR's avatar
XhmikosR committed
1374
        var indicators = SelectorEngine.find(SELECTOR_ACTIVE, this._indicatorsElement);
XhmikosR's avatar
XhmikosR committed
1375
1376

        for (var i = 0; i < indicators.length; i++) {
XhmikosR's avatar
XhmikosR committed
1377
          indicators[i].classList.remove(CLASS_NAME_ACTIVE$1);
XhmikosR's avatar
XhmikosR committed
1378
        }
Mark Otto's avatar
dist  
Mark Otto committed
1379

XhmikosR's avatar
Dist    
XhmikosR committed
1380
        var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
Mark Otto's avatar
dist  
Mark Otto committed
1381

XhmikosR's avatar
Dist    
XhmikosR committed
1382
        if (nextIndicator) {
XhmikosR's avatar
XhmikosR committed
1383
          nextIndicator.classList.add(CLASS_NAME_ACTIVE$1);
Mark Otto's avatar
dist    
Mark Otto committed
1384
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1385
1386
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1387

XhmikosR's avatar
XhmikosR committed
1388
1389
1390
1391
1392
1393
1394
    _proto._updateInterval = function _updateInterval() {
      var element = this._activeElement || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);

      if (!element) {
        return;
      }

XhmikosR's avatar
XhmikosR committed
1395
      var elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10);
XhmikosR's avatar
XhmikosR committed
1396
1397
1398
1399
1400
1401
1402
1403
1404

      if (elementInterval) {
        this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
        this._config.interval = elementInterval;
      } else {
        this._config.interval = this._config.defaultInterval || this._config.interval;
      }
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1405
1406
    _proto._slide = function _slide(direction, element) {
      var _this4 = this;
Mark Otto's avatar
dist  
Mark Otto committed
1407

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

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1414
      var nextElementIndex = this._getItemIndex(nextElement);
Mark Otto's avatar
dist  
Mark Otto committed
1415

XhmikosR's avatar
Dist    
XhmikosR committed
1416
1417
1418
1419
      var isCycling = Boolean(this._interval);
      var directionalClassName;
      var orderClassName;
      var eventDirectionName;
Mark Otto's avatar
dist  
Mark Otto committed
1420

XhmikosR's avatar
XhmikosR committed
1421
1422
1423
1424
      if (direction === DIRECTION_NEXT) {
        directionalClassName = CLASS_NAME_LEFT;
        orderClassName = CLASS_NAME_NEXT;
        eventDirectionName = DIRECTION_LEFT;
XhmikosR's avatar
Dist    
XhmikosR committed
1425
      } else {
XhmikosR's avatar
XhmikosR committed
1426
1427
1428
        directionalClassName = CLASS_NAME_RIGHT;
        orderClassName = CLASS_NAME_PREV;
        eventDirectionName = DIRECTION_RIGHT;
XhmikosR's avatar
Dist    
XhmikosR committed
1429
      }
Mark Otto's avatar
dist  
Mark Otto committed
1430

XhmikosR's avatar
XhmikosR committed
1431
      if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$1)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1432
1433
1434
        this._isSliding = false;
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1435

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

XhmikosR's avatar
XhmikosR committed
1438
      if (slideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
1439
1440
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1441

XhmikosR's avatar
Dist    
XhmikosR committed
1442
1443
1444
1445
      if (!activeElement || !nextElement) {
        // Some weirdness is happening, so we bail
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1446

XhmikosR's avatar
Dist    
XhmikosR committed
1447
      this._isSliding = true;
Mark Otto's avatar
dist    
Mark Otto committed
1448

XhmikosR's avatar
Dist    
XhmikosR committed
1449
1450
1451
      if (isCycling) {
        this.pause();
      }
Mark Otto's avatar
dist  
Mark Otto committed
1452

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

XhmikosR's avatar
XhmikosR committed
1455
1456
      this._activeElement = nextElement;

XhmikosR's avatar
XhmikosR committed
1457
      if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
XhmikosR's avatar
XhmikosR committed
1458
1459
1460
1461
1462
1463
        nextElement.classList.add(orderClassName);
        reflow(nextElement);
        activeElement.classList.add(directionalClassName);
        nextElement.classList.add(directionalClassName);
        var transitionDuration = getTransitionDurationFromElement(activeElement);
        EventHandler.one(activeElement, TRANSITION_END, function () {
XhmikosR's avatar
XhmikosR committed
1464
          nextElement.classList.remove(directionalClassName, orderClassName);
XhmikosR's avatar
XhmikosR committed
1465
          nextElement.classList.add(CLASS_NAME_ACTIVE$1);
XhmikosR's avatar
XhmikosR committed
1466
          activeElement.classList.remove(CLASS_NAME_ACTIVE$1, orderClassName, directionalClassName);
XhmikosR's avatar
Dist    
XhmikosR committed
1467
1468
          _this4._isSliding = false;
          setTimeout(function () {
XhmikosR's avatar
XhmikosR committed
1469
            EventHandler.trigger(_this4._element, EVENT_SLID, {
XhmikosR's avatar
XhmikosR committed
1470
1471
1472
1473
1474
              relatedTarget: nextElement,
              direction: eventDirectionName,
              from: activeElementIndex,
              to: nextElementIndex
            });
XhmikosR's avatar
Dist    
XhmikosR committed
1475
          }, 0);
XhmikosR's avatar
XhmikosR committed
1476
1477
        });
        emulateTransitionEnd(activeElement, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
1478
      } else {
XhmikosR's avatar
XhmikosR committed
1479
1480
        activeElement.classList.remove(CLASS_NAME_ACTIVE$1);
        nextElement.classList.add(CLASS_NAME_ACTIVE$1);
XhmikosR's avatar
Dist    
XhmikosR committed
1481
        this._isSliding = false;
XhmikosR's avatar
XhmikosR committed
1482
        EventHandler.trigger(this._element, EVENT_SLID, {
XhmikosR's avatar
XhmikosR committed
1483
1484
1485
1486
1487
          relatedTarget: nextElement,
          direction: eventDirectionName,
          from: activeElementIndex,
          to: nextElementIndex
        });
XhmikosR's avatar
Dist    
XhmikosR committed
1488
1489
1490
1491
1492
      }

      if (isCycling) {
        this.cycle();
      }
Mark Otto's avatar
Mark Otto committed
1493
1494
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
1495

XhmikosR's avatar
XhmikosR committed
1496
    Carousel.carouselInterface = function carouselInterface(element, config) {
XhmikosR's avatar
XhmikosR committed
1497
      var data = Data.getData(element, DATA_KEY$2);
Mark Otto's avatar
dist  
Mark Otto committed
1498

XhmikosR's avatar
XhmikosR committed
1499
      var _config = _extends({}, Default, Manipulator.getDataAttributes(element));
Mark Otto's avatar
dist  
Mark Otto committed
1500

XhmikosR's avatar
XhmikosR committed
1501
      if (typeof config === 'object') {
XhmikosR's avatar
XhmikosR committed
1502
        _config = _extends({}, _config, config);
XhmikosR's avatar
XhmikosR committed
1503
      }
Mark Otto's avatar
dist  
Mark Otto committed
1504

XhmikosR's avatar
XhmikosR committed
1505
      var action = typeof config === 'string' ? config : _config.slide;
Mark Otto's avatar
dist  
Mark Otto committed
1506

XhmikosR's avatar
XhmikosR committed
1507
1508
1509
1510
1511
1512
1513
1514
      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
1515
          throw new TypeError("No method named \"" + action + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
1516
        }
Mark Otto's avatar
dist  
Mark Otto committed
1517

XhmikosR's avatar
XhmikosR committed
1518
1519
1520
1521
1522
1523
        data[action]();
      } else if (_config.interval && _config.ride) {
        data.pause();
        data.cycle();
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1524

XhmikosR's avatar
XhmikosR committed
1525
    Carousel.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
XhmikosR committed
1526
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1527
        Carousel.carouselInterface(this, config);
XhmikosR's avatar
Dist    
XhmikosR committed
1528
1529
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
1530

XhmikosR's avatar
XhmikosR committed
1531
1532
    Carousel.dataApiClickHandler = function dataApiClickHandler(event) {
      var target = getElementFromSelector(this);
XhmikosR's avatar
Dist    
XhmikosR committed
1533

XhmikosR's avatar
XhmikosR committed
1534
      if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1535
1536
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1537

XhmikosR's avatar
XhmikosR committed
1538
      var config = _extends({}, Manipulator.getDataAttributes(target), Manipulator.getDataAttributes(this));
Mark Otto's avatar
dist    
Mark Otto committed
1539

XhmikosR's avatar
XhmikosR committed
1540
      var slideIndex = this.getAttribute('data-bs-slide-to');
Mark Otto's avatar
dist    
Mark Otto committed
1541

XhmikosR's avatar
Dist    
XhmikosR committed
1542
1543
      if (slideIndex) {
        config.interval = false;
Mark Otto's avatar
dist    
Mark Otto committed
1544
      }
Mark Otto's avatar
dist    
Mark Otto committed
1545

XhmikosR's avatar
XhmikosR committed
1546
      Carousel.carouselInterface(target, config);
Mark Otto's avatar
dist  
Mark Otto committed
1547

XhmikosR's avatar
Dist    
XhmikosR committed
1548
      if (slideIndex) {
XhmikosR's avatar
XhmikosR committed
1549
        Data.getData(target, DATA_KEY$2).to(slideIndex);
XhmikosR's avatar
Dist    
XhmikosR committed
1550
1551
1552
      }

      event.preventDefault();
Mark Otto's avatar
dist    
Mark Otto committed
1553
    };
Mark Otto's avatar
dist  
Mark Otto committed
1554

XhmikosR's avatar
XhmikosR committed
1555
    Carousel.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
1556
1557
1558
      return Data.getData(element, DATA_KEY$2);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
    _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
1571
    return Carousel;
XhmikosR's avatar
Dist    
XhmikosR committed
1572
1573
1574
1575
1576
1577
1578
1579
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


XhmikosR's avatar
XhmikosR committed
1580
1581
1582
  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
1583
1584

    for (var i = 0, len = carousels.length; i < len; i++) {
XhmikosR's avatar
XhmikosR committed
1585
      Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY$2));
XhmikosR's avatar
Dist    
XhmikosR committed
1586
1587
1588
1589
1590
1591
    }
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
1592
   * add .Carousel to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
1593
1594
   */

XhmikosR's avatar
XhmikosR committed
1595
1596
1597
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
1598

XhmikosR's avatar
XhmikosR committed
1599
1600
1601
1602
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$2];
      $.fn[NAME$2] = Carousel.jQueryInterface;
      $.fn[NAME$2].Constructor = Carousel;
XhmikosR's avatar
Dist    
XhmikosR committed
1603

XhmikosR's avatar
XhmikosR committed
1604
1605
1606
1607
1608
1609
      $.fn[NAME$2].noConflict = function () {
        $.fn[NAME$2] = JQUERY_NO_CONFLICT;
        return Carousel.jQueryInterface;
      };
    }
  });
Mark Otto's avatar
dist  
Mark Otto committed
1610

XhmikosR's avatar
Dist    
XhmikosR committed
1611
1612
1613
1614
1615
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
1616

XhmikosR's avatar
Dist    
XhmikosR committed
1617
  var NAME$3 = 'collapse';
XhmikosR's avatar
XhmikosR committed
1618
  var VERSION$3 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
  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
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
  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';
XhmikosR's avatar
XhmikosR committed
1642
  var SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="collapse"]';
XhmikosR's avatar
XhmikosR committed
1643
1644
1645
1646
1647
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
1648

XhmikosR's avatar
XhmikosR committed
1649
  var Collapse = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
1650
1651
1652
1653
    function Collapse(element, config) {
      this._isTransitioning = false;
      this._element = element;
      this._config = this._getConfig(config);
XhmikosR's avatar
XhmikosR committed
1654
      this._triggerArray = SelectorEngine.find(SELECTOR_DATA_TOGGLE$1 + "[href=\"#" + element.id + "\"]," + (SELECTOR_DATA_TOGGLE$1 + "[data-bs-target=\"#" + element.id + "\"]"));
XhmikosR's avatar
XhmikosR committed
1655
      var toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$1);
XhmikosR's avatar
Dist    
XhmikosR committed
1656
1657
1658

      for (var i = 0, len = toggleList.length; i < len; i++) {
        var elem = toggleList[i];
XhmikosR's avatar
XhmikosR committed
1659
        var selector = getSelectorFromElement(elem);
XhmikosR's avatar
XhmikosR committed
1660
        var filterElement = SelectorEngine.find(selector).filter(function (foundElem) {
XhmikosR's avatar
Dist    
XhmikosR committed
1661
1662
          return foundElem === element;
        });
Mark Otto's avatar
dist  
Mark Otto committed
1663

XhmikosR's avatar
XhmikosR committed
1664
        if (selector !== null && filterElement.length) {
XhmikosR's avatar
Dist    
XhmikosR committed
1665
          this._selector = selector;
Mark Otto's avatar
dist  
Mark Otto committed
1666

XhmikosR's avatar
Dist    
XhmikosR committed
1667
          this._triggerArray.push(elem);
Mark Otto's avatar
dist    
Mark Otto committed
1668
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1669
      }
Mark Otto's avatar
dist  
Mark Otto committed
1670

XhmikosR's avatar
Dist    
XhmikosR committed
1671
      this._parent = this._config.parent ? this._getParent() : null;
Mark Otto's avatar
dist  
Mark Otto committed
1672

XhmikosR's avatar
Dist    
XhmikosR committed
1673
1674
1675
      if (!this._config.parent) {
        this._addAriaAndCollapsedClass(this._element, this._triggerArray);
      }
Mark Otto's avatar
dist  
Mark Otto committed
1676

XhmikosR's avatar
Dist    
XhmikosR committed
1677
1678
1679
      if (this._config.toggle) {
        this.toggle();
      }
XhmikosR's avatar
XhmikosR committed
1680
1681

      Data.setData(element, DATA_KEY$3, this);
XhmikosR's avatar
Dist    
XhmikosR committed
1682
    } // Getters
Mark Otto's avatar
dist  
Mark Otto committed
1683
1684


XhmikosR's avatar
Dist    
XhmikosR committed
1685
    var _proto = Collapse.prototype;
Mark Otto's avatar
dist  
Mark Otto committed
1686

XhmikosR's avatar
Dist    
XhmikosR committed
1687
1688
    // Public
    _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
1689
      if (this._element.classList.contains(CLASS_NAME_SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1690
1691
1692
1693
1694
        this.hide();
      } else {
        this.show();
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1695

XhmikosR's avatar
Dist    
XhmikosR committed
1696
1697
    _proto.show = function show() {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
1698

XhmikosR's avatar
XhmikosR committed
1699
      if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1700
1701
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1702

XhmikosR's avatar
Dist    
XhmikosR committed
1703
1704
      var actives;
      var activesData;
Mark Otto's avatar
dist    
Mark Otto committed
1705

XhmikosR's avatar
Dist    
XhmikosR committed
1706
      if (this._parent) {
XhmikosR's avatar
XhmikosR committed
1707
        actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter(function (elem) {
XhmikosR's avatar
Dist    
XhmikosR committed
1708
          if (typeof _this._config.parent === 'string') {
XhmikosR's avatar
XhmikosR committed
1709
            return elem.getAttribute('data-bs-parent') === _this._config.parent;
Mark Otto's avatar
dist    
Mark Otto committed
1710
          }
Mark Otto's avatar
dist  
Mark Otto committed
1711

XhmikosR's avatar
XhmikosR committed
1712
          return elem.classList.contains(CLASS_NAME_COLLAPSE);
XhmikosR's avatar
Dist    
XhmikosR committed
1713
        });
Mark Otto's avatar
dist    
Mark Otto committed
1714

XhmikosR's avatar
Dist    
XhmikosR committed
1715
1716
        if (actives.length === 0) {
          actives = null;
Mark Otto's avatar
dist  
Mark Otto committed
1717
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1718
      }
Mark Otto's avatar
dist  
Mark Otto committed
1719

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

XhmikosR's avatar
Dist    
XhmikosR committed
1722
      if (actives) {
XhmikosR's avatar
XhmikosR committed
1723
        var tempActiveData = actives.find(function (elem) {
XhmikosR's avatar
XhmikosR committed
1724
1725
          return container !== elem;
        });
XhmikosR's avatar
XhmikosR committed
1726
        activesData = tempActiveData ? Data.getData(tempActiveData, DATA_KEY$3) : null;
Mark Otto's avatar
dist    
Mark Otto committed
1727

XhmikosR's avatar
Dist    
XhmikosR committed
1728
        if (activesData && activesData._isTransitioning) {
Mark Otto's avatar
dist    
Mark Otto committed
1729
1730
          return;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1731
      }
Mark Otto's avatar
dist  
Mark Otto committed
1732

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

XhmikosR's avatar
XhmikosR committed
1735
      if (startEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
1736
1737
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1738

XhmikosR's avatar
Dist    
XhmikosR committed
1739
      if (actives) {
XhmikosR's avatar
XhmikosR committed
1740
1741
        actives.forEach(function (elemActive) {
          if (container !== elemActive) {
XhmikosR's avatar
XhmikosR committed
1742
            Collapse.collapseInterface(elemActive, 'hide');
XhmikosR's avatar
XhmikosR committed
1743
          }
Mark Otto's avatar
dist  
Mark Otto committed
1744

XhmikosR's avatar
XhmikosR committed
1745
1746
1747
1748
          if (!activesData) {
            Data.setData(elemActive, DATA_KEY$3, null);
          }
        });
XhmikosR's avatar
Dist    
XhmikosR committed
1749
      }
Mark Otto's avatar
dist  
Mark Otto committed
1750

XhmikosR's avatar
Dist    
XhmikosR committed
1751
      var dimension = this._getDimension();
Mark Otto's avatar
dist  
Mark Otto committed
1752

XhmikosR's avatar
XhmikosR committed
1753
      this._element.classList.remove(CLASS_NAME_COLLAPSE);
XhmikosR's avatar
XhmikosR committed
1754

XhmikosR's avatar
XhmikosR committed
1755
      this._element.classList.add(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
XhmikosR committed
1756

XhmikosR's avatar
Dist    
XhmikosR committed
1757
      this._element.style[dimension] = 0;
Mark Otto's avatar
dist  
Mark Otto committed
1758

XhmikosR's avatar
Dist    
XhmikosR committed
1759
      if (this._triggerArray.length) {
XhmikosR's avatar
XhmikosR committed
1760
        this._triggerArray.forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
1761
          element.classList.remove(CLASS_NAME_COLLAPSED);
XhmikosR's avatar
XhmikosR committed
1762
1763
          element.setAttribute('aria-expanded', true);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
1764
      }
Mark Otto's avatar
dist  
Mark Otto committed
1765

XhmikosR's avatar
Dist    
XhmikosR committed
1766
      this.setTransitioning(true);
Mark Otto's avatar
dist  
Mark Otto committed
1767

XhmikosR's avatar
Dist    
XhmikosR committed
1768
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
1769
        _this._element.classList.remove(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
XhmikosR committed
1770

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

XhmikosR's avatar
Dist    
XhmikosR committed
1773
1774
1775
1776
        _this._element.style[dimension] = '';

        _this.setTransitioning(false);

XhmikosR's avatar
XhmikosR committed
1777
        EventHandler.trigger(_this._element, EVENT_SHOWN);
Mark Otto's avatar
dist    
Mark Otto committed
1778
      };
Mark Otto's avatar
dist  
Mark Otto committed
1779

XhmikosR's avatar
Dist    
XhmikosR committed
1780
1781
      var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
      var scrollSize = "scroll" + capitalizedDimension;
XhmikosR's avatar
XhmikosR committed
1782
1783
1784
      var transitionDuration = getTransitionDurationFromElement(this._element);
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
1785
1786
      this._element.style[dimension] = this._element[scrollSize] + "px";
    };
Mark Otto's avatar
dist  
Mark Otto committed
1787

XhmikosR's avatar
Dist    
XhmikosR committed
1788
1789
1790
    _proto.hide = function hide() {
      var _this2 = this;

XhmikosR's avatar
XhmikosR committed
1791
      if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1792
1793
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1794

XhmikosR's avatar
XhmikosR committed
1795
      var startEvent = EventHandler.trigger(this._element, EVENT_HIDE);
Mark Otto's avatar
dist    
Mark Otto committed
1796

XhmikosR's avatar
XhmikosR committed
1797
      if (startEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
1798
1799
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1800

XhmikosR's avatar
Dist    
XhmikosR committed
1801
      var dimension = this._getDimension();
Mark Otto's avatar
dist  
Mark Otto committed
1802

XhmikosR's avatar
Dist    
XhmikosR committed
1803
      this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
XhmikosR's avatar
XhmikosR committed
1804
1805
      reflow(this._element);

XhmikosR's avatar
XhmikosR committed
1806
      this._element.classList.add(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
XhmikosR committed
1807

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1812
1813
1814
      if (triggerArrayLength > 0) {
        for (var i = 0; i < triggerArrayLength; i++) {
          var trigger = this._triggerArray[i];
XhmikosR's avatar
XhmikosR committed
1815
          var elem = getElementFromSelector(trigger);
Mark Otto's avatar
dist    
Mark Otto committed
1816

XhmikosR's avatar
XhmikosR committed
1817
1818
          if (elem && !elem.classList.contains(CLASS_NAME_SHOW)) {
            trigger.classList.add(CLASS_NAME_COLLAPSED);
XhmikosR's avatar
XhmikosR committed
1819
            trigger.setAttribute('aria-expanded', false);
Mark Otto's avatar
dist  
Mark Otto committed
1820
1821
          }
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1822
      }
Mark Otto's avatar
dist  
Mark Otto committed
1823

XhmikosR's avatar
Dist    
XhmikosR committed
1824
      this.setTransitioning(true);
Mark Otto's avatar
dist  
Mark Otto committed
1825

XhmikosR's avatar
Dist    
XhmikosR committed
1826
1827
      var complete = function complete() {
        _this2.setTransitioning(false);
Mark Otto's avatar
dist  
Mark Otto committed
1828

XhmikosR's avatar
XhmikosR committed
1829
        _this2._element.classList.remove(CLASS_NAME_COLLAPSING);
XhmikosR's avatar
XhmikosR committed
1830

XhmikosR's avatar
XhmikosR committed
1831
        _this2._element.classList.add(CLASS_NAME_COLLAPSE);
XhmikosR's avatar
XhmikosR committed
1832

XhmikosR's avatar
XhmikosR committed
1833
        EventHandler.trigger(_this2._element, EVENT_HIDDEN);
Mark Otto's avatar
dist    
Mark Otto committed
1834
      };
Mark Otto's avatar
dist  
Mark Otto committed
1835

XhmikosR's avatar
Dist    
XhmikosR committed
1836
      this._element.style[dimension] = '';
XhmikosR's avatar
XhmikosR committed
1837
1838
1839
      var transitionDuration = getTransitionDurationFromElement(this._element);
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
1840
    };
Mark Otto's avatar
dist  
Mark Otto committed
1841

XhmikosR's avatar
Dist    
XhmikosR committed
1842
1843
1844
    _proto.setTransitioning = function setTransitioning(isTransitioning) {
      this._isTransitioning = isTransitioning;
    };
Mark Otto's avatar
dist  
Mark Otto committed
1845

XhmikosR's avatar
Dist    
XhmikosR committed
1846
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
1847
      Data.removeData(this._element, DATA_KEY$3);
XhmikosR's avatar
Dist    
XhmikosR committed
1848
1849
1850
1851
1852
      this._config = null;
      this._parent = null;
      this._element = null;
      this._triggerArray = null;
      this._isTransitioning = null;
Mark Otto's avatar
Mark Otto committed
1853
1854
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
1855

XhmikosR's avatar
Dist    
XhmikosR committed
1856
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
1857
      config = _extends({}, Default$1, config);
XhmikosR's avatar
Dist    
XhmikosR committed
1858
      config.toggle = Boolean(config.toggle); // Coerce string values
Mark Otto's avatar
dist  
Mark Otto committed
1859

XhmikosR's avatar
XhmikosR committed
1860
      typeCheckConfig(NAME$3, config, DefaultType$1);
XhmikosR's avatar
Dist    
XhmikosR committed
1861
1862
      return config;
    };
Mark Otto's avatar
dist  
Mark Otto committed
1863

XhmikosR's avatar
Dist    
XhmikosR committed
1864
    _proto._getDimension = function _getDimension() {
XhmikosR's avatar
XhmikosR committed
1865
      return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
XhmikosR's avatar
Dist    
XhmikosR committed
1866
    };
Mark Otto's avatar
dist  
Mark Otto committed
1867

XhmikosR's avatar
Dist    
XhmikosR committed
1868
1869
    _proto._getParent = function _getParent() {
      var _this3 = this;
Mark Otto's avatar
dist  
Mark Otto committed
1870

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

XhmikosR's avatar
Dist.    
XhmikosR committed
1873
1874
1875
1876
      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
1877
1878
        }
      } else {
XhmikosR's avatar
Dist.    
XhmikosR committed
1879
        parent = SelectorEngine.findOne(parent);
XhmikosR's avatar
Dist    
XhmikosR committed
1880
      }
Mark Otto's avatar
dist  
Mark Otto committed
1881

XhmikosR's avatar
XhmikosR committed
1882
      var selector = SELECTOR_DATA_TOGGLE$1 + "[data-bs-parent=\"" + parent + "\"]";
XhmikosR's avatar
XhmikosR committed
1883
      SelectorEngine.find(selector, parent).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
1884
        var selected = getElementFromSelector(element);
1885
1886

        _this3._addAriaAndCollapsedClass(selected, [element]);
XhmikosR's avatar
Dist    
XhmikosR committed
1887
1888
1889
      });
      return parent;
    };
Mark Otto's avatar
dist  
Mark Otto committed
1890

XhmikosR's avatar
XhmikosR committed
1891
    _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
XhmikosR's avatar
XhmikosR committed
1892
1893
1894
      if (!element || !triggerArray.length) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1895

XhmikosR's avatar
XhmikosR committed
1896
1897
1898
1899
1900
1901
      var isOpen = element.classList.contains(CLASS_NAME_SHOW);
      triggerArray.forEach(function (elem) {
        if (isOpen) {
          elem.classList.remove(CLASS_NAME_COLLAPSED);
        } else {
          elem.classList.add(CLASS_NAME_COLLAPSED);
XhmikosR's avatar
XhmikosR committed
1902
        }
XhmikosR's avatar
XhmikosR committed
1903
1904
1905

        elem.setAttribute('aria-expanded', isOpen);
      });
Mark Otto's avatar
Mark Otto committed
1906
1907
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
1908

XhmikosR's avatar
XhmikosR committed
1909
    Collapse.collapseInterface = function collapseInterface(element, config) {
XhmikosR's avatar
XhmikosR committed
1910
      var data = Data.getData(element, DATA_KEY$3);
Mark Otto's avatar
dist  
Mark Otto committed
1911

XhmikosR's avatar
XhmikosR committed
1912
      var _config = _extends({}, Default$1, Manipulator.getDataAttributes(element), typeof config === 'object' && config ? config : {});
Mark Otto's avatar
dist  
Mark Otto committed
1913

XhmikosR's avatar
XhmikosR committed
1914
      if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
XhmikosR's avatar
XhmikosR committed
1915
1916
        _config.toggle = false;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1917

XhmikosR's avatar
XhmikosR committed
1918
1919
1920
1921
1922
1923
      if (!data) {
        data = new Collapse(element, _config);
      }

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

XhmikosR's avatar
XhmikosR committed
1927
1928
1929
        data[config]();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
1930

XhmikosR's avatar
XhmikosR committed
1931
    Collapse.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
XhmikosR committed
1932
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1933
        Collapse.collapseInterface(this, config);
XhmikosR's avatar
Dist    
XhmikosR committed
1934
1935
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
1936

XhmikosR's avatar
XhmikosR committed
1937
    Collapse.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
1938
1939
1940
      return Data.getData(element, DATA_KEY$3);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
    _createClass(Collapse, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$3;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$1;
      }
    }]);
Mark Otto's avatar
dist  
Mark Otto committed
1952

XhmikosR's avatar
Dist    
XhmikosR committed
1953
1954
1955
1956
1957
1958
1959
    return Collapse;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
1960

Mark Otto's avatar
dist  
Mark Otto committed
1961

XhmikosR's avatar
XhmikosR committed
1962
  EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$1, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1963
    // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
XhmikosR's avatar
XhmikosR committed
1964
    if (event.target.tagName === 'A') {
XhmikosR's avatar
Dist    
XhmikosR committed
1965
1966
      event.preventDefault();
    }
Mark Otto's avatar
dist    
Mark Otto committed
1967

XhmikosR's avatar
XhmikosR committed
1968
1969
    var triggerData = Manipulator.getDataAttributes(this);
    var selector = getSelectorFromElement(this);
XhmikosR's avatar
XhmikosR committed
1970
    var selectorElements = SelectorEngine.find(selector);
XhmikosR's avatar
XhmikosR committed
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
    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
1986

XhmikosR's avatar
XhmikosR committed
1987
      Collapse.collapseInterface(element, config);
XhmikosR's avatar
Dist    
XhmikosR committed
1988
1989
1990
1991
1992
1993
    });
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
1994
   * add .Collapse to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
1995
   */
Mark Otto's avatar
dist    
Mark Otto committed
1996

XhmikosR's avatar
XhmikosR committed
1997
1998
1999
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
2000

XhmikosR's avatar
XhmikosR committed
2001
2002
2003
2004
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$3];
      $.fn[NAME$3] = Collapse.jQueryInterface;
      $.fn[NAME$3].Constructor = Collapse;
Mark Otto's avatar
dist  
Mark Otto committed
2005

XhmikosR's avatar
XhmikosR committed
2006
2007
2008
2009
2010
2011
      $.fn[NAME$3].noConflict = function () {
        $.fn[NAME$3] = JQUERY_NO_CONFLICT;
        return Collapse.jQueryInterface;
      };
    }
  });
Mark Otto's avatar
dist  
Mark Otto committed
2012

Mark Otto's avatar
dist    
Mark Otto committed
2013
2014
  /**!
   * @fileOverview Kickass library to create and place poppers near their reference elements.
XhmikosR's avatar
XhmikosR committed
2015
   * @version 1.16.1
Mark Otto's avatar
dist    
Mark Otto committed
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
   * @license
   * Copyright (c) 2016 Federico Zivolo and contributors
   *
   * Permission is hereby granted, free of charge, to any person obtaining a copy
   * of this software and associated documentation files (the "Software"), to deal
   * in the Software without restriction, including without limitation the rights
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   * copies of the Software, and to permit persons to whom the Software is
   * furnished to do so, subject to the following conditions:
   *
   * The above copyright notice and this permission notice shall be included in all
   * copies or substantial portions of the Software.
   *
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   * SOFTWARE.
   */
XhmikosR's avatar
XhmikosR committed
2037
2038
2039
2040
2041
2042
2043
2044
  var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';

  var timeoutDuration = function () {
    var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
    for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
      if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
        return 1;
      }
Mark Otto's avatar
dist  
Mark Otto committed
2045
    }
XhmikosR's avatar
XhmikosR committed
2046
2047
    return 0;
  }();
Mark Otto's avatar
dist  
Mark Otto committed
2048

Mark Otto's avatar
dist    
Mark Otto committed
2049
2050
2051
2052
2053
2054
2055
2056
2057
  function microtaskDebounce(fn) {
    var called = false;
    return function () {
      if (called) {
        return;
      }
      called = true;
      window.Promise.resolve().then(function () {
        called = false;
Mark Otto's avatar
dist  
Mark Otto committed
2058
        fn();
Mark Otto's avatar
dist    
Mark Otto committed
2059
2060
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
2061
2062
  }

Mark Otto's avatar
dist    
Mark Otto committed
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
  function taskDebounce(fn) {
    var scheduled = false;
    return function () {
      if (!scheduled) {
        scheduled = true;
        setTimeout(function () {
          scheduled = false;
          fn();
        }, timeoutDuration);
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
2074
2075
  }

Mark Otto's avatar
dist    
Mark Otto committed
2076
  var supportsMicroTasks = isBrowser && window.Promise;
Mark Otto's avatar
dist  
Mark Otto committed
2077

Mark Otto's avatar
dist    
Mark Otto committed
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
  /**
  * Create a debounced version of a method, that's asynchronously deferred
  * but called in the minimum time possible.
  *
  * @method
  * @memberof Popper.Utils
  * @argument {Function} fn
  * @returns {Function}
  */
  var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
Mark Otto's avatar
dist  
Mark Otto committed
2088

Mark Otto's avatar
dist    
Mark Otto committed
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
  /**
   * Check if the given variable is a function
   * @method
   * @memberof Popper.Utils
   * @argument {Any} functionToCheck - variable to check
   * @returns {Boolean} answer to: is a function?
   */
  function isFunction(functionToCheck) {
    var getType = {};
    return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
Mark Otto's avatar
dist  
Mark Otto committed
2099
2100
  }

Mark Otto's avatar
dist    
Mark Otto committed
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
  /**
   * Get CSS computed property of the given element
   * @method
   * @memberof Popper.Utils
   * @argument {Eement} element
   * @argument {String} property
   */
  function getStyleComputedProperty(element, property) {
    if (element.nodeType !== 1) {
      return [];
Mark Otto's avatar
dist    
Mark Otto committed
2111
    }
Mark Otto's avatar
dist    
Mark Otto committed
2112
    // NOTE: 1 DOM access here
XhmikosR's avatar
Dist    
XhmikosR committed
2113
2114
    var window = element.ownerDocument.defaultView;
    var css = window.getComputedStyle(element, null);
Mark Otto's avatar
dist    
Mark Otto committed
2115
    return property ? css[property] : css;
Mark Otto's avatar
dist  
Mark Otto committed
2116
2117
  }

Mark Otto's avatar
dist    
Mark Otto committed
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
  /**
   * Returns the parentNode or the host of the element
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Element} parent
   */
  function getParentNode(element) {
    if (element.nodeName === 'HTML') {
      return element;
    }
    return element.parentNode || element.host;
Mark Otto's avatar
dist  
Mark Otto committed
2130
2131
  }

Mark Otto's avatar
dist    
Mark Otto committed
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
  /**
   * Returns the scrolling parent of the given element
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Element} scroll parent
   */
  function getScrollParent(element) {
    // Return body, `getScroll` will take care to get the correct `scrollTop` from it
    if (!element) {
      return document.body;
    }
Mark Otto's avatar
dist  
Mark Otto committed
2144

Mark Otto's avatar
dist    
Mark Otto committed
2145
2146
2147
2148
2149
2150
2151
    switch (element.nodeName) {
      case 'HTML':
      case 'BODY':
        return element.ownerDocument.body;
      case '#document':
        return element.body;
    }
Mark Otto's avatar
dist  
Mark Otto committed
2152

Mark Otto's avatar
dist    
Mark Otto committed
2153
    // Firefox want us to check `-x` and `-y` variations as well
Mark Otto's avatar
dist  
Mark Otto committed
2154

Mark Otto's avatar
dist    
Mark Otto committed
2155
2156
2157
2158
    var _getStyleComputedProp = getStyleComputedProperty(element),
        overflow = _getStyleComputedProp.overflow,
        overflowX = _getStyleComputedProp.overflowX,
        overflowY = _getStyleComputedProp.overflowY;
Mark Otto's avatar
dist  
Mark Otto committed
2159

Mark Otto's avatar
dist    
Mark Otto committed
2160
2161
    if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
      return element;
Mark Otto's avatar
dist  
Mark Otto committed
2162
2163
    }

Mark Otto's avatar
dist    
Mark Otto committed
2164
    return getScrollParent(getParentNode(element));
Mark Otto's avatar
dist  
Mark Otto committed
2165
2166
  }

XhmikosR's avatar
XhmikosR committed
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
  /**
   * Returns the reference node of the reference object, or the reference object itself.
   * @method
   * @memberof Popper.Utils
   * @param {Element|Object} reference - the reference element (the popper will be relative to this)
   * @returns {Element} parent
   */
  function getReferenceNode(reference) {
    return reference && reference.referenceNode ? reference.referenceNode : reference;
  }

Mark Otto's avatar
dist    
Mark Otto committed
2178
2179
2180
  var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);

Mark Otto's avatar
dist    
Mark Otto committed
2181
  /**
Mark Otto's avatar
dist    
Mark Otto committed
2182
   * Determines if the browser is Internet Explorer
Mark Otto's avatar
dist    
Mark Otto committed
2183
2184
   * @method
   * @memberof Popper.Utils
Mark Otto's avatar
dist    
Mark Otto committed
2185
   * @param {Number} version to check
Mark Otto's avatar
dist    
Mark Otto committed
2186
2187
   * @returns {Boolean} isIE
   */
Mark Otto's avatar
dist    
Mark Otto committed
2188
2189
2190
  function isIE(version) {
    if (version === 11) {
      return isIE11;
Mark Otto's avatar
dist    
Mark Otto committed
2191
    }
Mark Otto's avatar
dist    
Mark Otto committed
2192
2193
    if (version === 10) {
      return isIE10;
Mark Otto's avatar
dist    
Mark Otto committed
2194
    }
Mark Otto's avatar
dist    
Mark Otto committed
2195
2196
    return isIE11 || isIE10;
  }
Mark Otto's avatar
dist  
Mark Otto committed
2197

Mark Otto's avatar
dist    
Mark Otto committed
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
  /**
   * Returns the offset parent of the given element
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Element} offset parent
   */
  function getOffsetParent(element) {
    if (!element) {
      return document.documentElement;
Mark Otto's avatar
dist  
Mark Otto committed
2208
2209
    }

Mark Otto's avatar
dist    
Mark Otto committed
2210
    var noOffsetParent = isIE(10) ? document.body : null;
Mark Otto's avatar
dist  
Mark Otto committed
2211

Mark Otto's avatar
dist    
Mark Otto committed
2212
    // NOTE: 1 DOM access here
XhmikosR's avatar
Dist    
XhmikosR committed
2213
    var offsetParent = element.offsetParent || null;
Mark Otto's avatar
dist    
Mark Otto committed
2214
2215
2216
2217
    // Skip hidden elements which don't have an offsetParent
    while (offsetParent === noOffsetParent && element.nextElementSibling) {
      offsetParent = (element = element.nextElementSibling).offsetParent;
    }
Mark Otto's avatar
dist  
Mark Otto committed
2218

Mark Otto's avatar
dist    
Mark Otto committed
2219
    var nodeName = offsetParent && offsetParent.nodeName;
Mark Otto's avatar
dist  
Mark Otto committed
2220

Mark Otto's avatar
dist    
Mark Otto committed
2221
2222
2223
    if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
      return element ? element.ownerDocument.documentElement : document.documentElement;
    }
Mark Otto's avatar
dist  
Mark Otto committed
2224

XhmikosR's avatar
Dist    
XhmikosR committed
2225
    // .offsetParent will return the closest TH, TD or TABLE in case
Mark Otto's avatar
dist    
Mark Otto committed
2226
    // no offsetParent is present, I hate this job...
XhmikosR's avatar
Dist    
XhmikosR committed
2227
    if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
Mark Otto's avatar
dist    
Mark Otto committed
2228
2229
      return getOffsetParent(offsetParent);
    }
Mark Otto's avatar
dist  
Mark Otto committed
2230

Mark Otto's avatar
dist    
Mark Otto committed
2231
    return offsetParent;
Mark Otto's avatar
dist  
Mark Otto committed
2232
2233
  }

Mark Otto's avatar
dist    
Mark Otto committed
2234
2235
  function isOffsetContainer(element) {
    var nodeName = element.nodeName;
Mark Otto's avatar
dist  
Mark Otto committed
2236

Mark Otto's avatar
dist    
Mark Otto committed
2237
2238
    if (nodeName === 'BODY') {
      return false;
Mark Otto's avatar
dist  
Mark Otto committed
2239
    }
Mark Otto's avatar
dist    
Mark Otto committed
2240
    return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
Mark Otto's avatar
dist  
Mark Otto committed
2241
2242
  }

Mark Otto's avatar
dist    
Mark Otto committed
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
  /**
   * Finds the root node (document, shadowDOM root) of the given element
   * @method
   * @memberof Popper.Utils
   * @argument {Element} node
   * @returns {Element} root node
   */
  function getRoot(node) {
    if (node.parentNode !== null) {
      return getRoot(node.parentNode);
    }
Mark Otto's avatar
dist  
Mark Otto committed
2254

Mark Otto's avatar
dist    
Mark Otto committed
2255
    return node;
Mark Otto's avatar
dist  
Mark Otto committed
2256
2257
  }

Mark Otto's avatar
dist    
Mark Otto committed
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
  /**
   * Finds the offset parent common to the two provided nodes
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element1
   * @argument {Element} element2
   * @returns {Element} common offset parent
   */
  function findCommonOffsetParent(element1, element2) {
    // This check is needed to avoid errors in case one of the elements isn't defined for any reason
    if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
      return document.documentElement;
    }
Mark Otto's avatar
dist  
Mark Otto committed
2271

Mark Otto's avatar
dist    
Mark Otto committed
2272
2273
2274
2275
    // Here we make sure to give as "start" the element that comes first in the DOM
    var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
    var start = order ? element1 : element2;
    var end = order ? element2 : element1;
Mark Otto's avatar
dist  
Mark Otto committed
2276

Mark Otto's avatar
dist    
Mark Otto committed
2277
2278
2279
2280
2281
    // Get common ancestor container
    var range = document.createRange();
    range.setStart(start, 0);
    range.setEnd(end, 0);
    var commonAncestorContainer = range.commonAncestorContainer;
Mark Otto's avatar
dist  
Mark Otto committed
2282

Mark Otto's avatar
dist    
Mark Otto committed
2283
    // Both nodes are inside #document
Mark Otto's avatar
dist  
Mark Otto committed
2284

Mark Otto's avatar
dist    
Mark Otto committed
2285
2286
2287
2288
    if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
      if (isOffsetContainer(commonAncestorContainer)) {
        return commonAncestorContainer;
      }
Mark Otto's avatar
dist  
Mark Otto committed
2289

Mark Otto's avatar
dist    
Mark Otto committed
2290
2291
      return getOffsetParent(commonAncestorContainer);
    }
Mark Otto's avatar
dist  
Mark Otto committed
2292

Mark Otto's avatar
dist    
Mark Otto committed
2293
2294
2295
2296
    // one of the nodes is inside shadowDOM, find which one
    var element1root = getRoot(element1);
    if (element1root.host) {
      return findCommonOffsetParent(element1root.host, element2);
Mark Otto's avatar
dist  
Mark Otto committed
2297
    } else {
Mark Otto's avatar
dist    
Mark Otto committed
2298
      return findCommonOffsetParent(element1, getRoot(element2).host);
Mark Otto's avatar
dist  
Mark Otto committed
2299
    }
Mark Otto's avatar
dist    
Mark Otto committed
2300
  }
Mark Otto's avatar
dist  
Mark Otto committed
2301

Mark Otto's avatar
dist    
Mark Otto committed
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
  /**
   * Gets the scroll value of the given element in the given side (top and left)
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @argument {String} side `top` or `left`
   * @returns {number} amount of scrolled pixels
   */
  function getScroll(element) {
    var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
Mark Otto's avatar
dist  
Mark Otto committed
2312

Mark Otto's avatar
dist    
Mark Otto committed
2313
2314
    var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
    var nodeName = element.nodeName;
Mark Otto's avatar
dist  
Mark Otto committed
2315

Mark Otto's avatar
dist    
Mark Otto committed
2316
2317
2318
2319
    if (nodeName === 'BODY' || nodeName === 'HTML') {
      var html = element.ownerDocument.documentElement;
      var scrollingElement = element.ownerDocument.scrollingElement || html;
      return scrollingElement[upperSide];
Mark Otto's avatar
dist  
Mark Otto committed
2320
2321
    }

Mark Otto's avatar
dist    
Mark Otto committed
2322
    return element[upperSide];
Mark Otto's avatar
dist  
Mark Otto committed
2323
2324
  }

Mark Otto's avatar
dist    
Mark Otto committed
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
  /*
   * Sum or subtract the element scroll values (left and top) from a given rect object
   * @method
   * @memberof Popper.Utils
   * @param {Object} rect - Rect object you want to change
   * @param {HTMLElement} element - The element from the function reads the scroll values
   * @param {Boolean} subtract - set to true if you want to subtract the scroll values
   * @return {Object} rect - The modifier rect object
   */
  function includeScroll(rect, element) {
    var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

    var scrollTop = getScroll(element, 'top');
    var scrollLeft = getScroll(element, 'left');
    var modifier = subtract ? -1 : 1;
    rect.top += scrollTop * modifier;
    rect.bottom += scrollTop * modifier;
    rect.left += scrollLeft * modifier;
    rect.right += scrollLeft * modifier;
    return rect;
  }
Mark Otto's avatar
dist  
Mark Otto committed
2346

Mark Otto's avatar
dist    
Mark Otto committed
2347
2348
2349
2350
2351
2352
2353
2354
2355
  /*
   * Helper to detect borders of a given element
   * @method
   * @memberof Popper.Utils
   * @param {CSSStyleDeclaration} styles
   * Result of `getStyleComputedProperty` on the given element
   * @param {String} axis - `x` or `y`
   * @return {number} borders - The borders size of the given axis
   */
Mark Otto's avatar
dist  
Mark Otto committed
2356

Mark Otto's avatar
dist    
Mark Otto committed
2357
2358
2359
  function getBordersSize(styles, axis) {
    var sideA = axis === 'x' ? 'Left' : 'Top';
    var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
Mark Otto's avatar
dist  
Mark Otto committed
2360

XhmikosR's avatar
XhmikosR committed
2361
    return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
Mark Otto's avatar
dist  
Mark Otto committed
2362
2363
  }

Mark Otto's avatar
dist    
Mark Otto committed
2364
  function getSize(axis, body, html, computedStyle) {
Mark Otto's avatar
dist    
Mark Otto committed
2365
    return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
Mark Otto's avatar
dist  
Mark Otto committed
2366
2367
  }

Mark Otto's avatar
dist    
Mark Otto committed
2368
  function getWindowSizes(document) {
Mark Otto's avatar
dist    
Mark Otto committed
2369
2370
2371
    var body = document.body;
    var html = document.documentElement;
    var computedStyle = isIE(10) && getComputedStyle(html);
Mark Otto's avatar
dist  
Mark Otto committed
2372

Mark Otto's avatar
dist    
Mark Otto committed
2373
2374
2375
2376
    return {
      height: getSize('Height', body, html, computedStyle),
      width: getSize('Width', body, html, computedStyle)
    };
Mark Otto's avatar
dist  
Mark Otto committed
2377
2378
  }

Mark Otto's avatar
dist    
Mark Otto committed
2379
2380
2381
2382
  var classCallCheck = function (instance, Constructor) {
    if (!(instance instanceof Constructor)) {
      throw new TypeError("Cannot call a class as a function");
    }
Mark Otto's avatar
dist  
Mark Otto committed
2383
2384
  };

Mark Otto's avatar
dist    
Mark Otto committed
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
  var createClass = function () {
    function defineProperties(target, props) {
      for (var i = 0; i < props.length; i++) {
        var descriptor = props[i];
        descriptor.enumerable = descriptor.enumerable || false;
        descriptor.configurable = true;
        if ("value" in descriptor) descriptor.writable = true;
        Object.defineProperty(target, descriptor.key, descriptor);
      }
    }
Mark Otto's avatar
dist  
Mark Otto committed
2395

Mark Otto's avatar
dist    
Mark Otto committed
2396
2397
2398
2399
2400
2401
    return function (Constructor, protoProps, staticProps) {
      if (protoProps) defineProperties(Constructor.prototype, protoProps);
      if (staticProps) defineProperties(Constructor, staticProps);
      return Constructor;
    };
  }();
Mark Otto's avatar
dist  
Mark Otto committed
2402
2403
2404
2405
2406





Mark Otto's avatar
dist    
Mark Otto committed
2407
2408
2409
2410
2411
2412
2413
2414
  var defineProperty = function (obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
Mark Otto's avatar
dist  
Mark Otto committed
2415
    } else {
Mark Otto's avatar
dist    
Mark Otto committed
2416
      obj[key] = value;
Mark Otto's avatar
dist  
Mark Otto committed
2417
2418
    }

Mark Otto's avatar
dist    
Mark Otto committed
2419
2420
    return obj;
  };
Mark Otto's avatar
dist  
Mark Otto committed
2421

XhmikosR's avatar
XhmikosR committed
2422
  var _extends$1 = Object.assign || function (target) {
Mark Otto's avatar
dist    
Mark Otto committed
2423
2424
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i];
Mark Otto's avatar
dist  
Mark Otto committed
2425

Mark Otto's avatar
dist    
Mark Otto committed
2426
2427
2428
2429
2430
2431
      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) {
          target[key] = source[key];
        }
      }
    }
Mark Otto's avatar
dist  
Mark Otto committed
2432

Mark Otto's avatar
dist    
Mark Otto committed
2433
    return target;
Mark Otto's avatar
dist  
Mark Otto committed
2434
2435
  };

Mark Otto's avatar
dist    
Mark Otto committed
2436
2437
2438
2439
2440
2441
2442
2443
  /**
   * Given element offsets, generate an output similar to getBoundingClientRect
   * @method
   * @memberof Popper.Utils
   * @argument {Object} offsets
   * @returns {Object} ClientRect like output
   */
  function getClientRect(offsets) {
XhmikosR's avatar
XhmikosR committed
2444
    return _extends$1({}, offsets, {
Mark Otto's avatar
dist    
Mark Otto committed
2445
2446
2447
      right: offsets.left + offsets.width,
      bottom: offsets.top + offsets.height
    });
Mark Otto's avatar
dist  
Mark Otto committed
2448
2449
  }

Mark Otto's avatar
dist    
Mark Otto committed
2450
2451
2452
2453
2454
2455
2456
2457
2458
  /**
   * Get bounding client rect of given element
   * @method
   * @memberof Popper.Utils
   * @param {HTMLElement} element
   * @return {Object} client rect
   */
  function getBoundingClientRect(element) {
    var rect = {};
Mark Otto's avatar
dist  
Mark Otto committed
2459

Mark Otto's avatar
dist    
Mark Otto committed
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
    // IE10 10 FIX: Please, don't ask, the element isn't
    // considered in DOM in some circumstances...
    // This isn't reproducible in IE10 compatibility mode of IE11
    try {
      if (isIE(10)) {
        rect = element.getBoundingClientRect();
        var scrollTop = getScroll(element, 'top');
        var scrollLeft = getScroll(element, 'left');
        rect.top += scrollTop;
        rect.left += scrollLeft;
        rect.bottom += scrollTop;
        rect.right += scrollLeft;
      } else {
        rect = element.getBoundingClientRect();
      }
    } catch (e) {}

    var result = {
      left: rect.left,
      top: rect.top,
      width: rect.right - rect.left,
      height: rect.bottom - rect.top
    };
Mark Otto's avatar
dist  
Mark Otto committed
2483

Mark Otto's avatar
dist    
Mark Otto committed
2484
    // subtract scrollbar size from sizes
Mark Otto's avatar
dist    
Mark Otto committed
2485
    var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
XhmikosR's avatar
XhmikosR committed
2486
2487
    var width = sizes.width || element.clientWidth || result.width;
    var height = sizes.height || element.clientHeight || result.height;
Mark Otto's avatar
dist  
Mark Otto committed
2488

Mark Otto's avatar
dist    
Mark Otto committed
2489
2490
    var horizScrollbar = element.offsetWidth - width;
    var vertScrollbar = element.offsetHeight - height;
Mark Otto's avatar
dist  
Mark Otto committed
2491

Mark Otto's avatar
dist    
Mark Otto committed
2492
2493
2494
2495
2496
2497
2498
2499
2500
    // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
    // we make this check conditional for performance reasons
    if (horizScrollbar || vertScrollbar) {
      var styles = getStyleComputedProperty(element);
      horizScrollbar -= getBordersSize(styles, 'x');
      vertScrollbar -= getBordersSize(styles, 'y');

      result.width -= horizScrollbar;
      result.height -= vertScrollbar;
Mark Otto's avatar
dist  
Mark Otto committed
2501
    }
Mark Otto's avatar
dist    
Mark Otto committed
2502
2503

    return getClientRect(result);
Mark Otto's avatar
dist  
Mark Otto committed
2504
2505
  }

Mark Otto's avatar
dist    
Mark Otto committed
2506
2507
  function getOffsetRectRelativeToArbitraryNode(children, parent) {
    var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
Mark Otto's avatar
dist  
Mark Otto committed
2508

Mark Otto's avatar
dist    
Mark Otto committed
2509
2510
2511
2512
2513
    var isIE10 = isIE(10);
    var isHTML = parent.nodeName === 'HTML';
    var childrenRect = getBoundingClientRect(children);
    var parentRect = getBoundingClientRect(parent);
    var scrollParent = getScrollParent(children);
Mark Otto's avatar
dist  
Mark Otto committed
2514

Mark Otto's avatar
dist    
Mark Otto committed
2515
    var styles = getStyleComputedProperty(parent);
XhmikosR's avatar
XhmikosR committed
2516
2517
    var borderTopWidth = parseFloat(styles.borderTopWidth);
    var borderLeftWidth = parseFloat(styles.borderLeftWidth);
Mark Otto's avatar
dist  
Mark Otto committed
2518

Mark Otto's avatar
dist    
Mark Otto committed
2519
    // In cases where the parent is fixed, we must ignore negative scroll in offset calc
Mark Otto's avatar
dist    
Mark Otto committed
2520
    if (fixedPosition && isHTML) {
Mark Otto's avatar
dist    
Mark Otto committed
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
      parentRect.top = Math.max(parentRect.top, 0);
      parentRect.left = Math.max(parentRect.left, 0);
    }
    var offsets = getClientRect({
      top: childrenRect.top - parentRect.top - borderTopWidth,
      left: childrenRect.left - parentRect.left - borderLeftWidth,
      width: childrenRect.width,
      height: childrenRect.height
    });
    offsets.marginTop = 0;
    offsets.marginLeft = 0;

    // Subtract margins of documentElement in case it's being used as parent
    // we do this only on HTML because it's the only element that behaves
    // differently when margins are applied to it. The margins are included in
    // the box of the documentElement, in the other cases not.
    if (!isIE10 && isHTML) {
XhmikosR's avatar
XhmikosR committed
2538
2539
      var marginTop = parseFloat(styles.marginTop);
      var marginLeft = parseFloat(styles.marginLeft);
Mark Otto's avatar
dist    
Mark Otto committed
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549

      offsets.top -= borderTopWidth - marginTop;
      offsets.bottom -= borderTopWidth - marginTop;
      offsets.left -= borderLeftWidth - marginLeft;
      offsets.right -= borderLeftWidth - marginLeft;

      // Attach marginTop and marginLeft because in some circumstances we may need them
      offsets.marginTop = marginTop;
      offsets.marginLeft = marginLeft;
    }
Mark Otto's avatar
dist  
Mark Otto committed
2550

Mark Otto's avatar
dist    
Mark Otto committed
2551
2552
2553
    if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
      offsets = includeScroll(offsets, parent);
    }
Mark Otto's avatar
dist  
Mark Otto committed
2554

Mark Otto's avatar
dist    
Mark Otto committed
2555
    return offsets;
Mark Otto's avatar
dist  
Mark Otto committed
2556
2557
  }

Mark Otto's avatar
dist    
Mark Otto committed
2558
2559
  function getViewportOffsetRectRelativeToArtbitraryNode(element) {
    var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
Mark Otto's avatar
dist  
Mark Otto committed
2560

Mark Otto's avatar
dist    
Mark Otto committed
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
    var html = element.ownerDocument.documentElement;
    var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
    var width = Math.max(html.clientWidth, window.innerWidth || 0);
    var height = Math.max(html.clientHeight, window.innerHeight || 0);

    var scrollTop = !excludeScroll ? getScroll(html) : 0;
    var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;

    var offset = {
      top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
      left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
      width: width,
      height: height
    };
Mark Otto's avatar
dist  
Mark Otto committed
2575

Mark Otto's avatar
dist    
Mark Otto committed
2576
    return getClientRect(offset);
Mark Otto's avatar
dist  
Mark Otto committed
2577
2578
  }

Mark Otto's avatar
dist    
Mark Otto committed
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
  /**
   * Check if the given element is fixed or is inside a fixed parent
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @argument {Element} customContainer
   * @returns {Boolean} answer to "isFixed?"
   */
  function isFixed(element) {
    var nodeName = element.nodeName;
    if (nodeName === 'BODY' || nodeName === 'HTML') {
      return false;
Mark Otto's avatar
dist  
Mark Otto committed
2591
    }
Mark Otto's avatar
dist    
Mark Otto committed
2592
2593
2594
    if (getStyleComputedProperty(element, 'position') === 'fixed') {
      return true;
    }
Mark Otto's avatar
Mark Otto committed
2595
2596
2597
2598
2599
    var parentNode = getParentNode(element);
    if (!parentNode) {
      return false;
    }
    return isFixed(parentNode);
Mark Otto's avatar
dist    
Mark Otto committed
2600
  }
Mark Otto's avatar
dist  
Mark Otto committed
2601

Mark Otto's avatar
dist    
Mark Otto committed
2602
2603
2604
2605
2606
2607
2608
  /**
   * Finds the first parent of an element that has a transformed property defined
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Element} first transformed parent or documentElement
   */
Mark Otto's avatar
dist  
Mark Otto committed
2609

Mark Otto's avatar
dist    
Mark Otto committed
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
  function getFixedPositionOffsetParent(element) {
    // This check is needed to avoid errors in case one of the elements isn't defined for any reason
    if (!element || !element.parentElement || isIE()) {
      return document.documentElement;
    }
    var el = element.parentElement;
    while (el && getStyleComputedProperty(el, 'transform') === 'none') {
      el = el.parentElement;
    }
    return el || document.documentElement;
  }
Mark Otto's avatar
dist  
Mark Otto committed
2621

Mark Otto's avatar
dist    
Mark Otto committed
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
  /**
   * Computed the boundaries limits and return them
   * @method
   * @memberof Popper.Utils
   * @param {HTMLElement} popper
   * @param {HTMLElement} reference
   * @param {number} padding
   * @param {HTMLElement} boundariesElement - Element used to define the boundaries
   * @param {Boolean} fixedPosition - Is in fixed position mode
   * @returns {Object} Coordinates of the boundaries
   */
  function getBoundaries(popper, reference, padding, boundariesElement) {
    var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
Mark Otto's avatar
dist  
Mark Otto committed
2635

Mark Otto's avatar
dist    
Mark Otto committed
2636
    // NOTE: 1 DOM access here
Mark Otto's avatar
dist  
Mark Otto committed
2637

Mark Otto's avatar
dist    
Mark Otto committed
2638
    var boundaries = { top: 0, left: 0 };
XhmikosR's avatar
XhmikosR committed
2639
    var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
Mark Otto's avatar
dist  
Mark Otto committed
2640

Mark Otto's avatar
dist    
Mark Otto committed
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
    // Handle viewport case
    if (boundariesElement === 'viewport') {
      boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
    } else {
      // Handle other cases based on DOM element used as boundaries
      var boundariesNode = void 0;
      if (boundariesElement === 'scrollParent') {
        boundariesNode = getScrollParent(getParentNode(reference));
        if (boundariesNode.nodeName === 'BODY') {
          boundariesNode = popper.ownerDocument.documentElement;
        }
      } else if (boundariesElement === 'window') {
        boundariesNode = popper.ownerDocument.documentElement;
      } else {
        boundariesNode = boundariesElement;
      }
Mark Otto's avatar
dist  
Mark Otto committed
2657

Mark Otto's avatar
dist    
Mark Otto committed
2658
      var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
Mark Otto's avatar
dist  
Mark Otto committed
2659

Mark Otto's avatar
dist    
Mark Otto committed
2660
2661
      // In case of HTML, we need a different computation
      if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
Mark Otto's avatar
dist    
Mark Otto committed
2662
        var _getWindowSizes = getWindowSizes(popper.ownerDocument),
Mark Otto's avatar
dist    
Mark Otto committed
2663
2664
            height = _getWindowSizes.height,
            width = _getWindowSizes.width;
Mark Otto's avatar
dist  
Mark Otto committed
2665

Mark Otto's avatar
dist    
Mark Otto committed
2666
2667
2668
2669
2670
2671
2672
        boundaries.top += offsets.top - offsets.marginTop;
        boundaries.bottom = height + offsets.top;
        boundaries.left += offsets.left - offsets.marginLeft;
        boundaries.right = width + offsets.left;
      } else {
        // for all the other DOM elements, this one is good
        boundaries = offsets;
Mark Otto's avatar
dist  
Mark Otto committed
2673
      }
Mark Otto's avatar
dist    
Mark Otto committed
2674
    }
Mark Otto's avatar
dist  
Mark Otto committed
2675

Mark Otto's avatar
dist    
Mark Otto committed
2676
    // Add paddings
Mark Otto's avatar
dist    
Mark Otto committed
2677
2678
2679
2680
2681
2682
    padding = padding || 0;
    var isPaddingNumber = typeof padding === 'number';
    boundaries.left += isPaddingNumber ? padding : padding.left || 0;
    boundaries.top += isPaddingNumber ? padding : padding.top || 0;
    boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
    boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
Mark Otto's avatar
dist  
Mark Otto committed
2683

Mark Otto's avatar
dist    
Mark Otto committed
2684
    return boundaries;
Mark Otto's avatar
dist  
Mark Otto committed
2685
2686
  }

Mark Otto's avatar
dist    
Mark Otto committed
2687
2688
2689
2690
2691
  function getArea(_ref) {
    var width = _ref.width,
        height = _ref.height;

    return width * height;
Mark Otto's avatar
dist  
Mark Otto committed
2692
2693
  }

Mark Otto's avatar
dist    
Mark Otto committed
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
  /**
   * Utility used to transform the `auto` placement to the placement with more
   * available space.
   * @method
   * @memberof Popper.Utils
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */
  function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
    var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
Mark Otto's avatar
dist  
Mark Otto committed
2705

Mark Otto's avatar
dist    
Mark Otto committed
2706
2707
    if (placement.indexOf('auto') === -1) {
      return placement;
Mark Otto's avatar
dist  
Mark Otto committed
2708
2709
    }

Mark Otto's avatar
dist    
Mark Otto committed
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
    var boundaries = getBoundaries(popper, reference, padding, boundariesElement);

    var rects = {
      top: {
        width: boundaries.width,
        height: refRect.top - boundaries.top
      },
      right: {
        width: boundaries.right - refRect.right,
        height: boundaries.height
      },
      bottom: {
        width: boundaries.width,
        height: boundaries.bottom - refRect.bottom
      },
      left: {
        width: refRect.left - boundaries.left,
        height: boundaries.height
Mark Otto's avatar
dist  
Mark Otto committed
2728
      }
Mark Otto's avatar
dist    
Mark Otto committed
2729
2730
2731
    };

    var sortedAreas = Object.keys(rects).map(function (key) {
XhmikosR's avatar
XhmikosR committed
2732
      return _extends$1({
Mark Otto's avatar
dist    
Mark Otto committed
2733
2734
2735
2736
2737
2738
        key: key
      }, rects[key], {
        area: getArea(rects[key])
      });
    }).sort(function (a, b) {
      return b.area - a.area;
Mark Otto's avatar
dist  
Mark Otto committed
2739
2740
    });

Mark Otto's avatar
dist    
Mark Otto committed
2741
2742
2743
2744
    var filteredAreas = sortedAreas.filter(function (_ref2) {
      var width = _ref2.width,
          height = _ref2.height;
      return width >= popper.clientWidth && height >= popper.clientHeight;
Mark Otto's avatar
dist  
Mark Otto committed
2745
2746
    });

Mark Otto's avatar
dist    
Mark Otto committed
2747
2748
2749
    var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;

    var variation = placement.split('-')[1];
Mark Otto's avatar
dist  
Mark Otto committed
2750

Mark Otto's avatar
dist    
Mark Otto committed
2751
    return computedPlacement + (variation ? '-' + variation : '');
Mark Otto's avatar
dist  
Mark Otto committed
2752
2753
  }

Mark Otto's avatar
dist    
Mark Otto committed
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
  /**
   * Get offsets to the reference element
   * @method
   * @memberof Popper.Utils
   * @param {Object} state
   * @param {Element} popper - the popper element
   * @param {Element} reference - the reference element (the popper will be relative to this)
   * @param {Element} fixedPosition - is in fixed position mode
   * @returns {Object} An object containing the offsets which will be applied to the popper
   */
  function getReferenceOffsets(state, popper, reference) {
    var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
Mark Otto's avatar
dist  
Mark Otto committed
2766

XhmikosR's avatar
XhmikosR committed
2767
    var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
Mark Otto's avatar
dist    
Mark Otto committed
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
    return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  }

  /**
   * Get the outer sizes of the given element (offset size + margins)
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Object} object containing width and height properties
   */
  function getOuterSizes(element) {
XhmikosR's avatar
Dist    
XhmikosR committed
2779
2780
    var window = element.ownerDocument.defaultView;
    var styles = window.getComputedStyle(element);
Mark Otto's avatar
dist    
Mark Otto committed
2781
2782
    var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
    var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
Mark Otto's avatar
dist    
Mark Otto committed
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
    var result = {
      width: element.offsetWidth + y,
      height: element.offsetHeight + x
    };
    return result;
  }

  /**
   * Get the opposite placement of the given one
   * @method
   * @memberof Popper.Utils
   * @argument {String} placement
   * @returns {String} flipped placement
   */
  function getOppositePlacement(placement) {
    var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
    return placement.replace(/left|right|bottom|top/g, function (matched) {
      return hash[matched];
    });
  }

  /**
   * Get offsets to the popper
   * @method
   * @memberof Popper.Utils
   * @param {Object} position - CSS position the Popper will get applied
   * @param {HTMLElement} popper - the popper element
   * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
   * @param {String} placement - one of the valid placement options
   * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
   */
  function getPopperOffsets(popper, referenceOffsets, placement) {
    placement = placement.split('-')[0];

    // Get popper node sizes
    var popperRect = getOuterSizes(popper);
Mark Otto's avatar
dist  
Mark Otto committed
2819

Mark Otto's avatar
dist    
Mark Otto committed
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
    // Add position, width and height to our offsets object
    var popperOffsets = {
      width: popperRect.width,
      height: popperRect.height
    };

    // depending by the popper placement we have to compute its offsets slightly differently
    var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
    var mainSide = isHoriz ? 'top' : 'left';
    var secondarySide = isHoriz ? 'left' : 'top';
    var measurement = isHoriz ? 'height' : 'width';
    var secondaryMeasurement = !isHoriz ? 'height' : 'width';

    popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
    if (placement === secondarySide) {
      popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
    } else {
      popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
    }

    return popperOffsets;
  }

  /**
   * Mimics the `find` method of Array
   * @method
   * @memberof Popper.Utils
   * @argument {Array} arr
   * @argument prop
   * @argument value
   * @returns index or -1
   */
XhmikosR's avatar
XhmikosR committed
2852
  function find(arr, check) {
Mark Otto's avatar
dist    
Mark Otto committed
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
    // use native find if supported
    if (Array.prototype.find) {
      return arr.find(check);
    }

    // use `filter` to obtain the same behavior of `find`
    return arr.filter(check)[0];
  }

  /**
   * Return the index of the matching object
   * @method
   * @memberof Popper.Utils
   * @argument {Array} arr
   * @argument prop
   * @argument value
   * @returns index or -1
   */
  function findIndex(arr, prop, value) {
    // use native findIndex if supported
    if (Array.prototype.findIndex) {
      return arr.findIndex(function (cur) {
        return cur[prop] === value;
      });
    }

    // use `find` + `indexOf` if `findIndex` isn't supported
XhmikosR's avatar
XhmikosR committed
2880
    var match = find(arr, function (obj) {
Mark Otto's avatar
dist    
Mark Otto committed
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
      return obj[prop] === value;
    });
    return arr.indexOf(match);
  }

  /**
   * Loop trough the list of modifiers and run them in order,
   * each of them will then edit the data object.
   * @method
   * @memberof Popper.Utils
   * @param {dataObject} data
   * @param {Array} modifiers
   * @param {String} ends - Optional modifier name used as stopper
   * @returns {dataObject}
   */
  function runModifiers(modifiers, data, ends) {
    var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));

    modifiersToRun.forEach(function (modifier) {
      if (modifier['function']) {
        // eslint-disable-line dot-notation
        console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
Mark Otto's avatar
dist  
Mark Otto committed
2903
      }
Mark Otto's avatar
dist    
Mark Otto committed
2904
2905
2906
2907
2908
2909
2910
2911
2912
      var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
      if (modifier.enabled && isFunction(fn)) {
        // Add properties to offsets to make them a complete clientRect object
        // we do this before each modifier to make sure the previous one doesn't
        // mess with these values
        data.offsets.popper = getClientRect(data.offsets.popper);
        data.offsets.reference = getClientRect(data.offsets.reference);

        data = fn(data, modifier);
Mark Otto's avatar
dist  
Mark Otto committed
2913
      }
Mark Otto's avatar
dist    
Mark Otto committed
2914
    });
Mark Otto's avatar
dist  
Mark Otto committed
2915

Mark Otto's avatar
dist    
Mark Otto committed
2916
2917
    return data;
  }
Mark Otto's avatar
dist  
Mark Otto committed
2918

Mark Otto's avatar
dist    
Mark Otto committed
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
  /**
   * Updates the position of the popper, computing the new offsets and applying
   * the new style.<br />
   * Prefer `scheduleUpdate` over `update` because of performance reasons.
   * @method
   * @memberof Popper
   */
  function update() {
    // if popper is destroyed, don't perform any further update
    if (this.state.isDestroyed) {
      return;
    }
Mark Otto's avatar
dist  
Mark Otto committed
2931

Mark Otto's avatar
dist    
Mark Otto committed
2932
2933
2934
2935
2936
2937
2938
    var data = {
      instance: this,
      styles: {},
      arrowStyles: {},
      attributes: {},
      flipped: false,
      offsets: {}
Mark Otto's avatar
dist  
Mark Otto committed
2939
2940
    };

Mark Otto's avatar
dist    
Mark Otto committed
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
    // compute reference element offsets
    data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);

    // compute auto placement, store placement inside the data object,
    // modifiers will be able to edit `placement` if needed
    // and refer to originalPlacement to know the original value
    data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);

    // store the computed placement inside `originalPlacement`
    data.originalPlacement = data.placement;

    data.positionFixed = this.options.positionFixed;

    // compute the popper offsets
    data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
Mark Otto's avatar
dist    
Mark Otto committed
2956

Mark Otto's avatar
dist    
Mark Otto committed
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
    data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';

    // run the modifiers
    data = runModifiers(this.modifiers, data);

    // the first `update` will call `onCreate` callback
    // the other ones will call `onUpdate` callback
    if (!this.state.isCreated) {
      this.state.isCreated = true;
      this.options.onCreate(data);
    } else {
      this.options.onUpdate(data);
    }
  }

  /**
   * Helper used to know if the given modifier is enabled.
   * @method
   * @memberof Popper.Utils
   * @returns {Boolean}
   */
  function isModifierEnabled(modifiers, modifierName) {
    return modifiers.some(function (_ref) {
      var name = _ref.name,
          enabled = _ref.enabled;
      return enabled && name === modifierName;
    });
  }

  /**
   * Get the prefixed supported property name
   * @method
   * @memberof Popper.Utils
   * @argument {String} property (camelCase)
   * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
   */
  function getSupportedPropertyName(property) {
    var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
    var upperProp = property.charAt(0).toUpperCase() + property.slice(1);

    for (var i = 0; i < prefixes.length; i++) {
      var prefix = prefixes[i];
      var toCheck = prefix ? '' + prefix + upperProp : property;
      if (typeof document.body.style[toCheck] !== 'undefined') {
        return toCheck;
      }
    }
    return null;
  }

  /**
Mark Otto's avatar
dist    
Mark Otto committed
3008
   * Destroys the popper.
Mark Otto's avatar
dist    
Mark Otto committed
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
   * @method
   * @memberof Popper
   */
  function destroy() {
    this.state.isDestroyed = true;

    // touch DOM only if `applyStyle` modifier is enabled
    if (isModifierEnabled(this.modifiers, 'applyStyle')) {
      this.popper.removeAttribute('x-placement');
      this.popper.style.position = '';
      this.popper.style.top = '';
      this.popper.style.left = '';
      this.popper.style.right = '';
      this.popper.style.bottom = '';
      this.popper.style.willChange = '';
      this.popper.style[getSupportedPropertyName('transform')] = '';
    }

    this.disableEventListeners();

XhmikosR's avatar
XhmikosR committed
3029
    // remove the popper if user explicitly asked for the deletion on destroy
Mark Otto's avatar
dist    
Mark Otto committed
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
    // do not use `remove` because IE11 doesn't support it
    if (this.options.removeOnDestroy) {
      this.popper.parentNode.removeChild(this.popper);
    }
    return this;
  }

  /**
   * Get the window associated with the element
   * @argument {Element} element
   * @returns {Window}
   */
  function getWindow(element) {
    var ownerDocument = element.ownerDocument;
    return ownerDocument ? ownerDocument.defaultView : window;
  }

  function attachToScrollParents(scrollParent, event, callback, scrollParents) {
    var isBody = scrollParent.nodeName === 'BODY';
    var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
    target.addEventListener(event, callback, { passive: true });

    if (!isBody) {
      attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
    }
    scrollParents.push(target);
  }

  /**
   * Setup needed event listeners used to update the popper position
   * @method
   * @memberof Popper.Utils
   * @private
   */
  function setupEventListeners(reference, options, state, updateBound) {
    // Resize event listener on window
    state.updateBound = updateBound;
    getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });

    // Scroll event listener on scroll parents
    var scrollElement = getScrollParent(reference);
    attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
    state.scrollElement = scrollElement;
    state.eventsEnabled = true;

    return state;
  }

  /**
   * It will add resize/scroll events and start recalculating
   * position of the popper element when they are triggered.
   * @method
   * @memberof Popper
   */
  function enableEventListeners() {
    if (!this.state.eventsEnabled) {
      this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
    }
  }

  /**
   * Remove event listeners used to update the popper position
   * @method
   * @memberof Popper.Utils
   * @private
   */
  function removeEventListeners(reference, state) {
    // Remove resize event listener on window
    getWindow(reference).removeEventListener('resize', state.updateBound);

    // Remove scroll event listener on scroll parents
    state.scrollParents.forEach(function (target) {
      target.removeEventListener('scroll', state.updateBound);
    });

    // Reset state
    state.updateBound = null;
    state.scrollParents = [];
    state.scrollElement = null;
    state.eventsEnabled = false;
    return state;
  }

  /**
   * It will remove resize/scroll events and won't recalculate popper position
Mark Otto's avatar
dist    
Mark Otto committed
3115
   * when they are triggered. It also won't trigger `onUpdate` callback anymore,
Mark Otto's avatar
dist    
Mark Otto committed
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
   * unless you call `update` method manually.
   * @method
   * @memberof Popper
   */
  function disableEventListeners() {
    if (this.state.eventsEnabled) {
      cancelAnimationFrame(this.scheduleUpdate);
      this.state = removeEventListeners(this.reference, this.state);
    }
  }

  /**
   * Tells if a given input is a number
   * @method
   * @memberof Popper.Utils
   * @param {*} input to check
   * @return {Boolean}
   */
  function isNumeric(n) {
    return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  }

  /**
   * Set the style to the given popper
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element - Element to apply the style to
   * @argument {Object} styles
   * Object with a list of properties and values which will be applied to the element
   */
  function setStyles(element, styles) {
    Object.keys(styles).forEach(function (prop) {
      var unit = '';
      // add unit if the value is numeric and is one of the following
      if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
        unit = 'px';
      }
      element.style[prop] = styles[prop] + unit;
    });
Mark Otto's avatar
dist  
Mark Otto committed
3155
3156
  }

Mark Otto's avatar
dist    
Mark Otto committed
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
  /**
   * Set the attributes to the given popper
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element - Element to apply the attributes to
   * @argument {Object} styles
   * Object with a list of properties and values which will be applied to the element
   */
  function setAttributes(element, attributes) {
    Object.keys(attributes).forEach(function (prop) {
      var value = attributes[prop];
      if (value !== false) {
        element.setAttribute(prop, attributes[prop]);
      } else {
        element.removeAttribute(prop);
      }
    });
  }

  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Object} data.styles - List of style properties - values to apply to popper element
   * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The same data object
   */
  function applyStyle(data) {
    // any property present in `data.styles` will be applied to the popper,
    // in this way we can make the 3rd party modifiers add custom styles to it
    // Be aware, modifiers could override the properties defined in the previous
    // lines of this modifier!
    setStyles(data.instance.popper, data.styles);

    // any property present in `data.attributes` will be applied to the popper,
    // they will be set as HTML attributes of the element
    setAttributes(data.instance.popper, data.attributes);

    // if arrowElement is defined and arrowStyles has some properties
    if (data.arrowElement && Object.keys(data.arrowStyles).length) {
      setStyles(data.arrowElement, data.arrowStyles);
    }

Mark Otto's avatar
dist  
Mark Otto committed
3201
3202
3203
    return data;
  }

Mark Otto's avatar
dist    
Mark Otto committed
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
  /**
   * Set the x-placement attribute before everything else because it could be used
   * to add margins to the popper margins needs to be calculated to get the
   * correct popper offsets.
   * @method
   * @memberof Popper.modifiers
   * @param {HTMLElement} reference - The reference element used to position the popper
   * @param {HTMLElement} popper - The HTML element used as popper
   * @param {Object} options - Popper.js options
   */
  function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
    // compute reference element offsets
    var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);

    // compute auto placement, store placement inside the data object,
    // modifiers will be able to edit `placement` if needed
    // and refer to originalPlacement to know the original value
    var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
Mark Otto's avatar
dist  
Mark Otto committed
3222

Mark Otto's avatar
dist    
Mark Otto committed
3223
3224
3225
3226
3227
3228
3229
3230
3231
    popper.setAttribute('x-placement', placement);

    // Apply `position` to popper before anything else because
    // without the position applied we can't guarantee correct computations
    setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });

    return options;
  }

Mark Otto's avatar
dist    
Mark Otto committed
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
  /**
   * @function
   * @memberof Popper.Utils
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Boolean} shouldRound - If the offsets should be rounded at all
   * @returns {Object} The popper's position offsets rounded
   *
   * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
   * good as it can be within reason.
   * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
   *
   * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
   * as well on High DPI screens).
   *
   * Firefox prefers no rounding for positioning and does not have blurriness on
   * high DPI screens.
   *
   * Only horizontal placement and left/right values need to be considered.
   */
  function getRoundedOffsets(data, shouldRound) {
    var _data$offsets = data.offsets,
        popper = _data$offsets.popper,
        reference = _data$offsets.reference;
Mark Otto's avatar
Mark Otto committed
3255
3256
    var round = Math.round,
        floor = Math.floor;
Mark Otto's avatar
dist    
Mark Otto committed
3257
3258
3259
3260
3261

    var noRound = function noRound(v) {
      return v;
    };

Mark Otto's avatar
Mark Otto committed
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
    var referenceWidth = round(reference.width);
    var popperWidth = round(popper.width);

    var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
    var isVariation = data.placement.indexOf('-') !== -1;
    var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
    var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;

    var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
    var verticalToInteger = !shouldRound ? noRound : round;
Mark Otto's avatar
dist    
Mark Otto committed
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282

    return {
      left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
      top: verticalToInteger(popper.top),
      bottom: verticalToInteger(popper.bottom),
      right: horizontalToInteger(popper.right)
    };
  }

  var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);

Mark Otto's avatar
dist    
Mark Otto committed
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */
  function computeStyle(data, options) {
    var x = options.x,
        y = options.y;
    var popper = data.offsets.popper;

    // Remove this legacy support in Popper.js v2

XhmikosR's avatar
XhmikosR committed
3297
    var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
Mark Otto's avatar
dist    
Mark Otto committed
3298
3299
3300
3301
      return modifier.name === 'applyStyle';
    }).gpuAcceleration;
    if (legacyGpuAccelerationOption !== undefined) {
      console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
Mark Otto's avatar
dist  
Mark Otto committed
3302
    }
Mark Otto's avatar
dist    
Mark Otto committed
3303
3304
3305
3306
3307
3308
3309
3310
3311
    var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;

    var offsetParent = getOffsetParent(data.instance.popper);
    var offsetParentRect = getBoundingClientRect(offsetParent);

    // Styles
    var styles = {
      position: popper.position
    };
Mark Otto's avatar
dist  
Mark Otto committed
3312

Mark Otto's avatar
dist    
Mark Otto committed
3313
    var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
Mark Otto's avatar
dist    
Mark Otto committed
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334

    var sideA = x === 'bottom' ? 'top' : 'bottom';
    var sideB = y === 'right' ? 'left' : 'right';

    // if gpuAcceleration is set to `true` and transform is supported,
    //  we use `translate3d` to apply the position to the popper we
    // automatically use the supported prefixed version if needed
    var prefixedProperty = getSupportedPropertyName('transform');

    // now, let's make a step back and look at this code closely (wtf?)
    // If the content of the popper grows once it's been positioned, it
    // may happen that the popper gets misplaced because of the new content
    // overflowing its reference element
    // To avoid this problem, we provide two options (x and y), which allow
    // the consumer to define the offset origin.
    // If we position a popper on top of a reference element, we can set
    // `x` to `top` to make the popper grow towards its top instead of
    // its bottom.
    var left = void 0,
        top = void 0;
    if (sideA === 'bottom') {
Mark Otto's avatar
dist    
Mark Otto committed
3335
3336
3337
3338
3339
3340
3341
      // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
      // and not the bottom of the html element
      if (offsetParent.nodeName === 'HTML') {
        top = -offsetParent.clientHeight + offsets.bottom;
      } else {
        top = -offsetParentRect.height + offsets.bottom;
      }
Mark Otto's avatar
dist    
Mark Otto committed
3342
3343
3344
3345
    } else {
      top = offsets.top;
    }
    if (sideB === 'right') {
Mark Otto's avatar
dist    
Mark Otto committed
3346
3347
3348
3349
3350
      if (offsetParent.nodeName === 'HTML') {
        left = -offsetParent.clientWidth + offsets.right;
      } else {
        left = -offsetParentRect.width + offsets.right;
      }
Mark Otto's avatar
dist    
Mark Otto committed
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
    } else {
      left = offsets.left;
    }
    if (gpuAcceleration && prefixedProperty) {
      styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
      styles[sideA] = 0;
      styles[sideB] = 0;
      styles.willChange = 'transform';
    } else {
      // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
      var invertTop = sideA === 'bottom' ? -1 : 1;
      var invertLeft = sideB === 'right' ? -1 : 1;
      styles[sideA] = top * invertTop;
      styles[sideB] = left * invertLeft;
      styles.willChange = sideA + ', ' + sideB;
    }

    // Attributes
    var attributes = {
      'x-placement': data.placement
    };

    // Update `data` attributes, styles and arrowStyles
XhmikosR's avatar
XhmikosR committed
3374
3375
3376
    data.attributes = _extends$1({}, attributes, data.attributes);
    data.styles = _extends$1({}, styles, data.styles);
    data.arrowStyles = _extends$1({}, data.offsets.arrow, data.arrowStyles);
Mark Otto's avatar
dist    
Mark Otto committed
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391

    return data;
  }

  /**
   * Helper used to know if the given modifier depends from another one.<br />
   * It checks if the needed modifier is listed and enabled.
   * @method
   * @memberof Popper.Utils
   * @param {Array} modifiers - list of modifiers
   * @param {String} requestingName - name of requesting modifier
   * @param {String} requestedName - name of requested modifier
   * @returns {Boolean}
   */
  function isModifierRequired(modifiers, requestingName, requestedName) {
XhmikosR's avatar
XhmikosR committed
3392
    var requesting = find(modifiers, function (_ref) {
Mark Otto's avatar
dist    
Mark Otto committed
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
      var name = _ref.name;
      return name === requestingName;
    });

    var isRequired = !!requesting && modifiers.some(function (modifier) {
      return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
    });

    if (!isRequired) {
      var _requesting = '`' + requestingName + '`';
      var requested = '`' + requestedName + '`';
      console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
    }
    return isRequired;
  }

  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */
  function arrow(data, options) {
    var _data$offsets$arrow;

    // arrow depends on keepTogether in order to work
    if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
Mark Otto's avatar
dist  
Mark Otto committed
3421
3422
3423
      return data;
    }

Mark Otto's avatar
dist    
Mark Otto committed
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
    var arrowElement = options.element;

    // if arrowElement is a string, suppose it's a CSS selector
    if (typeof arrowElement === 'string') {
      arrowElement = data.instance.popper.querySelector(arrowElement);

      // if arrowElement is not found, don't run the modifier
      if (!arrowElement) {
        return data;
      }
    } else {
      // if the arrowElement isn't a query selector we must check that the
      // provided DOM node is child of its popper node
      if (!data.instance.popper.contains(arrowElement)) {
        console.warn('WARNING: `arrow.element` must be child of its popper element!');
        return data;
      }
    }

    var placement = data.placement.split('-')[0];
    var _data$offsets = data.offsets,
        popper = _data$offsets.popper,
        reference = _data$offsets.reference;

    var isVertical = ['left', 'right'].indexOf(placement) !== -1;

    var len = isVertical ? 'height' : 'width';
    var sideCapitalized = isVertical ? 'Top' : 'Left';
    var side = sideCapitalized.toLowerCase();
    var altSide = isVertical ? 'left' : 'top';
    var opSide = isVertical ? 'bottom' : 'right';
    var arrowElementSize = getOuterSizes(arrowElement)[len];

    //
    // extends keepTogether behavior making sure the popper and its
Mark Otto's avatar
dist    
Mark Otto committed
3459
    // reference have enough pixels in conjunction
Mark Otto's avatar
dist    
Mark Otto committed
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
    //

    // top/left side
    if (reference[opSide] - arrowElementSize < popper[side]) {
      data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
    }
    // bottom/right side
    if (reference[side] + arrowElementSize > popper[opSide]) {
      data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
    }
    data.offsets.popper = getClientRect(data.offsets.popper);

    // compute center of the popper
    var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;

    // Compute the sideValue using the updated popper offsets
    // take popper margin in account because we don't have this info available
    var css = getStyleComputedProperty(data.instance.popper);
XhmikosR's avatar
XhmikosR committed
3478
3479
    var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
    var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
Mark Otto's avatar
dist    
Mark Otto committed
3480
3481
3482
3483
3484
3485
3486
3487
3488
    var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;

    // prevent arrowElement from being placed not contiguously to its popper
    sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);

    data.arrowElement = arrowElement;
    data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);

    return data;
Mark Otto's avatar
dist  
Mark Otto committed
3489
3490
3491
  }

  /**
Mark Otto's avatar
dist    
Mark Otto committed
3492
3493
3494
3495
3496
   * Get the opposite placement variation of the given one
   * @method
   * @memberof Popper.Utils
   * @argument {String} placement variation
   * @returns {String} flipped placement variation
Mark Otto's avatar
dist  
Mark Otto committed
3497
   */
Mark Otto's avatar
dist    
Mark Otto committed
3498
3499
3500
3501
3502
3503
3504
3505
  function getOppositeVariation(variation) {
    if (variation === 'end') {
      return 'start';
    } else if (variation === 'start') {
      return 'end';
    }
    return variation;
  }
Mark Otto's avatar
dist  
Mark Otto committed
3506
3507

  /**
Mark Otto's avatar
dist    
Mark Otto committed
3508
3509
3510
3511
3512
3513
3514
   * List of accepted placements to use as values of the `placement` option.<br />
   * Valid placements are:
   * - `auto`
   * - `top`
   * - `right`
   * - `bottom`
   * - `left`
Mark Otto's avatar
dist  
Mark Otto committed
3515
   *
Mark Otto's avatar
dist    
Mark Otto committed
3516
3517
3518
   * Each placement can have a variation from this list:
   * - `-start`
   * - `-end`
Mark Otto's avatar
dist  
Mark Otto committed
3519
   *
Mark Otto's avatar
dist    
Mark Otto committed
3520
3521
3522
3523
   * Variations are interpreted easily if you think of them as the left to right
   * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
   * is right.<br />
   * Vertically (`left` and `right`), `start` is top and `end` is bottom.
Mark Otto's avatar
dist  
Mark Otto committed
3524
   *
Mark Otto's avatar
dist    
Mark Otto committed
3525
3526
3527
3528
   * Some valid examples are:
   * - `top-end` (on top of reference, right aligned)
   * - `right-start` (on right of reference, top aligned)
   * - `bottom` (on bottom, centered)
Mark Otto's avatar
dist    
Mark Otto committed
3529
   * - `auto-end` (on the side with more space available, alignment depends by placement)
Mark Otto's avatar
dist  
Mark Otto committed
3530
   *
Mark Otto's avatar
dist    
Mark Otto committed
3531
3532
3533
3534
3535
3536
   * @static
   * @type {Array}
   * @enum {String}
   * @readonly
   * @method placements
   * @memberof Popper
Mark Otto's avatar
dist  
Mark Otto committed
3537
   */
Mark Otto's avatar
dist    
Mark Otto committed
3538
3539
3540
3541
  var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];

  // Get rid of `auto` `auto-start` and `auto-end`
  var validPlacements = placements.slice(3);
Mark Otto's avatar
dist  
Mark Otto committed
3542
3543

  /**
Mark Otto's avatar
dist    
Mark Otto committed
3544
3545
   * Given an initial placement, returns all the subsequent placements
   * clockwise (or counter-clockwise).
Mark Otto's avatar
dist  
Mark Otto committed
3546
   *
Mark Otto's avatar
dist    
Mark Otto committed
3547
3548
3549
3550
3551
   * @method
   * @memberof Popper.Utils
   * @argument {String} placement - A valid placement (it accepts variations)
   * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
   * @returns {Array} placements including their variations
Mark Otto's avatar
dist  
Mark Otto committed
3552
   */
Mark Otto's avatar
dist    
Mark Otto committed
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
  function clockwise(placement) {
    var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

    var index = validPlacements.indexOf(placement);
    var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
    return counter ? arr.reverse() : arr;
  }

  var BEHAVIORS = {
    FLIP: 'flip',
    CLOCKWISE: 'clockwise',
    COUNTERCLOCKWISE: 'counterclockwise'
  };
Mark Otto's avatar
dist  
Mark Otto committed
3566
3567

  /**
Mark Otto's avatar
dist    
Mark Otto committed
3568
3569
3570
3571
3572
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
Mark Otto's avatar
dist  
Mark Otto committed
3573
   */
Mark Otto's avatar
dist    
Mark Otto committed
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
  function flip(data, options) {
    // if `inner` modifier is enabled, we can't use the `flip` modifier
    if (isModifierEnabled(data.instance.modifiers, 'inner')) {
      return data;
    }

    if (data.flipped && data.placement === data.originalPlacement) {
      // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
      return data;
    }

    var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);

    var placement = data.placement.split('-')[0];
    var placementOpposite = getOppositePlacement(placement);
    var variation = data.placement.split('-')[1] || '';

    var flipOrder = [];

    switch (options.behavior) {
      case BEHAVIORS.FLIP:
        flipOrder = [placement, placementOpposite];
        break;
      case BEHAVIORS.CLOCKWISE:
        flipOrder = clockwise(placement);
        break;
      case BEHAVIORS.COUNTERCLOCKWISE:
        flipOrder = clockwise(placement, true);
        break;
      default:
        flipOrder = options.behavior;
    }

    flipOrder.forEach(function (step, index) {
      if (placement !== step || flipOrder.length === index + 1) {
        return data;
      }

      placement = data.placement.split('-')[0];
      placementOpposite = getOppositePlacement(placement);

      var popperOffsets = data.offsets.popper;
      var refOffsets = data.offsets.reference;

      // using floor because the reference offsets may contain decimals we are not going to consider here
      var floor = Math.floor;
      var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);

      var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
      var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
      var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
      var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);

      var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;

      // flip the variation if required
      var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
XhmikosR's avatar
XhmikosR committed
3631
3632
3633
3634
3635
3636
3637
3638

      // flips variation if reference element overflows boundaries
      var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);

      // flips variation if popper content overflows boundaries
      var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);

      var flippedVariation = flippedVariationByRef || flippedVariationByContent;
Mark Otto's avatar
dist    
Mark Otto committed
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655

      if (overlapsRef || overflowsBoundaries || flippedVariation) {
        // this boolean to detect any flip loop
        data.flipped = true;

        if (overlapsRef || overflowsBoundaries) {
          placement = flipOrder[index + 1];
        }

        if (flippedVariation) {
          variation = getOppositeVariation(variation);
        }

        data.placement = placement + (variation ? '-' + variation : '');

        // this object contains `position`, we want to preserve it along with
        // any additional property we may add in the future
XhmikosR's avatar
XhmikosR committed
3656
        data.offsets.popper = _extends$1({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
Mark Otto's avatar
dist    
Mark Otto committed
3657
3658
3659
3660
3661
3662

        data = runModifiers(data.instance.modifiers, data, 'flip');
      }
    });
    return data;
  }
Mark Otto's avatar
dist  
Mark Otto committed
3663
3664

  /**
Mark Otto's avatar
dist    
Mark Otto committed
3665
3666
3667
3668
3669
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
Mark Otto's avatar
dist  
Mark Otto committed
3670
   */
Mark Otto's avatar
dist    
Mark Otto committed
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
  function keepTogether(data) {
    var _data$offsets = data.offsets,
        popper = _data$offsets.popper,
        reference = _data$offsets.reference;

    var placement = data.placement.split('-')[0];
    var floor = Math.floor;
    var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
    var side = isVertical ? 'right' : 'bottom';
    var opSide = isVertical ? 'left' : 'top';
    var measurement = isVertical ? 'width' : 'height';

    if (popper[side] < floor(reference[opSide])) {
      data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
    }
    if (popper[opSide] > floor(reference[side])) {
      data.offsets.popper[opSide] = floor(reference[side]);
    }

    return data;
  }
Mark Otto's avatar
dist  
Mark Otto committed
3692
3693

  /**
Mark Otto's avatar
dist    
Mark Otto committed
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
   * Converts a string containing value + unit into a px value number
   * @function
   * @memberof {modifiers~offset}
   * @private
   * @argument {String} str - Value + unit string
   * @argument {String} measurement - `height` or `width`
   * @argument {Object} popperOffsets
   * @argument {Object} referenceOffsets
   * @returns {Number|String}
   * Value in pixels, or original string if no values were extracted
Mark Otto's avatar
dist  
Mark Otto committed
3704
   */
Mark Otto's avatar
dist    
Mark Otto committed
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
  function toValue(str, measurement, popperOffsets, referenceOffsets) {
    // separate value from unit
    var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
    var value = +split[1];
    var unit = split[2];

    // If it's not a number it's an operator, I guess
    if (!value) {
      return str;
    }

    if (unit.indexOf('%') === 0) {
      var element = void 0;
      switch (unit) {
        case '%p':
          element = popperOffsets;
          break;
        case '%':
        case '%r':
        default:
          element = referenceOffsets;
      }

      var rect = getClientRect(element);
      return rect[measurement] / 100 * value;
    } else if (unit === 'vh' || unit === 'vw') {
      // if is a vh or vw, we calculate the size based on the viewport
      var size = void 0;
      if (unit === 'vh') {
        size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
      } else {
        size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
      }
      return size / 100 * value;
    } else {
      // if is an explicit pixel unit, we get rid of the unit and keep the value
      // if is an implicit unit, it's px, and we return just the value
      return value;
    }
  }
Mark Otto's avatar
dist  
Mark Otto committed
3745
3746

  /**
Mark Otto's avatar
dist    
Mark Otto committed
3747
3748
3749
3750
3751
3752
3753
3754
3755
   * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
   * @function
   * @memberof {modifiers~offset}
   * @private
   * @argument {String} offset
   * @argument {Object} popperOffsets
   * @argument {Object} referenceOffsets
   * @argument {String} basePlacement
   * @returns {Array} a two cells array with x and y offsets in numbers
Mark Otto's avatar
dist  
Mark Otto committed
3756
   */
Mark Otto's avatar
dist    
Mark Otto committed
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
  function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
    var offsets = [0, 0];

    // Use height if placement is left or right and index is 0 otherwise use width
    // in this way the first offset will use an axis and the second one
    // will use the other one
    var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;

    // Split the offset string to obtain a list of values and operands
    // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
    var fragments = offset.split(/(\+|\-)/).map(function (frag) {
      return frag.trim();
    });

    // Detect if the offset string contains a pair of values or a single one
    // they could be separated by comma or space
XhmikosR's avatar
XhmikosR committed
3773
    var divider = fragments.indexOf(find(fragments, function (frag) {
Mark Otto's avatar
dist    
Mark Otto committed
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
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
3821
3822
      return frag.search(/,|\s/) !== -1;
    }));

    if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
      console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
    }

    // If divider is found, we divide the list of values and operands to divide
    // them by ofset X and Y.
    var splitRegex = /\s*,\s*|\s+/;
    var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];

    // Convert the values with units to absolute pixels to allow our computations
    ops = ops.map(function (op, index) {
      // Most of the units rely on the orientation of the popper
      var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
      var mergeWithPrevious = false;
      return op
      // This aggregates any `+` or `-` sign that aren't considered operators
      // e.g.: 10 + +5 => [10, +, +5]
      .reduce(function (a, b) {
        if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
          a[a.length - 1] = b;
          mergeWithPrevious = true;
          return a;
        } else if (mergeWithPrevious) {
          a[a.length - 1] += b;
          mergeWithPrevious = false;
          return a;
        } else {
          return a.concat(b);
        }
      }, [])
      // Here we convert the string values into number values (in px)
      .map(function (str) {
        return toValue(str, measurement, popperOffsets, referenceOffsets);
      });
    });

    // Loop trough the offsets arrays and execute the operations
    ops.forEach(function (op, index) {
      op.forEach(function (frag, index2) {
        if (isNumeric(frag)) {
          offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
        }
      });
    });
    return offsets;
  }
Mark Otto's avatar
dist  
Mark Otto committed
3823
3824

  /**
Mark Otto's avatar
dist    
Mark Otto committed
3825
3826
3827
3828
3829
3830
3831
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @argument {Number|String} options.offset=0
   * The offset value as described in the modifier description
   * @returns {Object} The data object, properly modified
Mark Otto's avatar
dist  
Mark Otto committed
3832
   */
Mark Otto's avatar
dist    
Mark Otto committed
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
  function offset(data, _ref) {
    var offset = _ref.offset;
    var placement = data.placement,
        _data$offsets = data.offsets,
        popper = _data$offsets.popper,
        reference = _data$offsets.reference;

    var basePlacement = placement.split('-')[0];

    var offsets = void 0;
    if (isNumeric(+offset)) {
      offsets = [+offset, 0];
    } else {
      offsets = parseOffset(offset, popper, reference, basePlacement);
    }

    if (basePlacement === 'left') {
      popper.top += offsets[0];
      popper.left -= offsets[1];
    } else if (basePlacement === 'right') {
      popper.top += offsets[0];
      popper.left += offsets[1];
    } else if (basePlacement === 'top') {
      popper.left += offsets[0];
      popper.top -= offsets[1];
    } else if (basePlacement === 'bottom') {
      popper.left += offsets[0];
      popper.top += offsets[1];
    }

    data.popper = popper;
    return data;
  }
Mark Otto's avatar
dist  
Mark Otto committed
3866
3867

  /**
Mark Otto's avatar
dist    
Mark Otto committed
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */
  function preventOverflow(data, options) {
    var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);

    // If offsetParent is the reference element, we really want to
    // go one step up and use the next offsetParent as reference to
    // avoid to make this modifier completely useless and look like broken
    if (data.instance.reference === boundariesElement) {
      boundariesElement = getOffsetParent(boundariesElement);
    }

Mark Otto's avatar
dist    
Mark Otto committed
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
    // NOTE: DOM access here
    // resets the popper's position so that the document size can be calculated excluding
    // the size of the popper element itself
    var transformProp = getSupportedPropertyName('transform');
    var popperStyles = data.instance.popper.style; // assignment to help minification
    var top = popperStyles.top,
        left = popperStyles.left,
        transform = popperStyles[transformProp];

    popperStyles.top = '';
    popperStyles.left = '';
    popperStyles[transformProp] = '';

Mark Otto's avatar
dist    
Mark Otto committed
3897
    var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
Mark Otto's avatar
dist    
Mark Otto committed
3898
3899
3900
3901
3902
3903
3904

    // NOTE: DOM access here
    // restores the original style properties after the offsets have been computed
    popperStyles.top = top;
    popperStyles.left = left;
    popperStyles[transformProp] = transform;

Mark Otto's avatar
dist    
Mark Otto committed
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
    options.boundaries = boundaries;

    var order = options.priority;
    var popper = data.offsets.popper;

    var check = {
      primary: function primary(placement) {
        var value = popper[placement];
        if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
          value = Math.max(popper[placement], boundaries[placement]);
        }
        return defineProperty({}, placement, value);
      },
      secondary: function secondary(placement) {
        var mainSide = placement === 'right' ? 'left' : 'top';
        var value = popper[mainSide];
        if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
          value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
        }
        return defineProperty({}, mainSide, value);
      }
    };

    order.forEach(function (placement) {
      var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
XhmikosR's avatar
XhmikosR committed
3930
      popper = _extends$1({}, popper, check[side](placement));
Mark Otto's avatar
dist    
Mark Otto committed
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
    });

    data.offsets.popper = popper;

    return data;
  }

  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */
  function shift(data) {
    var placement = data.placement;
    var basePlacement = placement.split('-')[0];
    var shiftvariation = placement.split('-')[1];

    // if shift shiftvariation is specified, run the modifier
    if (shiftvariation) {
      var _data$offsets = data.offsets,
          reference = _data$offsets.reference,
          popper = _data$offsets.popper;

      var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
      var side = isVertical ? 'left' : 'top';
      var measurement = isVertical ? 'width' : 'height';

      var shiftOffsets = {
        start: defineProperty({}, side, reference[side]),
        end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
      };

XhmikosR's avatar
XhmikosR committed
3965
      data.offsets.popper = _extends$1({}, popper, shiftOffsets[shiftvariation]);
Mark Otto's avatar
dist    
Mark Otto committed
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
    }

    return data;
  }

  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */
  function hide(data) {
    if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
      return data;
    }

    var refRect = data.offsets.reference;
XhmikosR's avatar
XhmikosR committed
3984
    var bound = find(data.instance.modifiers, function (modifier) {
Mark Otto's avatar
dist    
Mark Otto committed
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
      return modifier.name === 'preventOverflow';
    }).boundaries;

    if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
      // Avoid unnecessary DOM access if visibility hasn't changed
      if (data.hide === true) {
        return data;
      }

      data.hide = true;
      data.attributes['x-out-of-boundaries'] = '';
    } else {
      // Avoid unnecessary DOM access if visibility hasn't changed
      if (data.hide === false) {
        return data;
      }

      data.hide = false;
      data.attributes['x-out-of-boundaries'] = false;
    }

    return data;
  }

  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */
  function inner(data) {
    var placement = data.placement;
    var basePlacement = placement.split('-')[0];
    var _data$offsets = data.offsets,
        popper = _data$offsets.popper,
        reference = _data$offsets.reference;

    var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;

    var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;

    popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);

    data.placement = getOppositePlacement(placement);
    data.offsets.popper = getClientRect(popper);

    return data;
  }

  /**
   * Modifier function, each modifier can have a function of this type assigned
   * to its `fn` property.<br />
   * These functions will be called on each update, this means that you must
   * make sure they are performant enough to avoid performance bottlenecks.
Mark Otto's avatar
dist  
Mark Otto committed
4040
   *
Mark Otto's avatar
dist    
Mark Otto committed
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
   * @function ModifierFn
   * @argument {dataObject} data - The data object generated by `update` method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {dataObject} The data object, properly modified
   */

  /**
   * Modifiers are plugins used to alter the behavior of your poppers.<br />
   * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
   * needed by the library.
Mark Otto's avatar
dist  
Mark Otto committed
4051
   *
Mark Otto's avatar
dist    
Mark Otto committed
4052
4053
4054
   * Usually you don't want to override the `order`, `fn` and `onLoad` props.
   * All the other properties are configurations that could be tweaked.
   * @namespace modifiers
Mark Otto's avatar
dist  
Mark Otto committed
4055
   */
Mark Otto's avatar
dist    
Mark Otto committed
4056
  var modifiers = {
Mark Otto's avatar
dist  
Mark Otto committed
4057
    /**
Mark Otto's avatar
dist    
Mark Otto committed
4058
4059
4060
4061
4062
4063
     * Modifier used to shift the popper on the start or end of its reference
     * element.<br />
     * It will read the variation of the `placement` property.<br />
     * It can be one either `-end` or `-start`.
     * @memberof modifiers
     * @inner
Mark Otto's avatar
dist  
Mark Otto committed
4064
     */
Mark Otto's avatar
dist    
Mark Otto committed
4065
4066
4067
4068
4069
4070
4071
4072
4073
    shift: {
      /** @prop {number} order=100 - Index used to define the order of execution */
      order: 100,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: shift
    },

Mark Otto's avatar
dist  
Mark Otto committed
4074
    /**
Mark Otto's avatar
dist    
Mark Otto committed
4075
4076
4077
     * The `offset` modifier can shift your popper on both its axis.
     *
     * It accepts the following units:
Mark Otto's avatar
dist    
Mark Otto committed
4078
     * - `px` or unit-less, interpreted as pixels
Mark Otto's avatar
dist    
Mark Otto committed
4079
4080
4081
4082
4083
4084
4085
     * - `%` or `%r`, percentage relative to the length of the reference element
     * - `%p`, percentage relative to the length of the popper element
     * - `vw`, CSS viewport width unit
     * - `vh`, CSS viewport height unit
     *
     * For length is intended the main axis relative to the placement of the popper.<br />
     * This means that if the placement is `top` or `bottom`, the length will be the
Mark Otto's avatar
dist    
Mark Otto committed
4086
     * `width`. In case of `left` or `right`, it will be the `height`.
Mark Otto's avatar
dist    
Mark Otto committed
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
     *
     * You can provide a single value (as `Number` or `String`), or a pair of values
     * as `String` divided by a comma or one (or more) white spaces.<br />
     * The latter is a deprecated method because it leads to confusion and will be
     * removed in v2.<br />
     * Additionally, it accepts additions and subtractions between different units.
     * Note that multiplications and divisions aren't supported.
     *
     * Valid examples are:
     * ```
     * 10
     * '10%'
     * '10, 10'
     * '10%, 10'
     * '10 + 10%'
     * '10 - 5vh + 3%'
     * '-10px + 5vh, 5px - 6%'
     * ```
     * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
     * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
Mark Otto's avatar
dist    
Mark Otto committed
4107
     * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
Mark Otto's avatar
dist    
Mark Otto committed
4108
4109
4110
     *
     * @memberof modifiers
     * @inner
Mark Otto's avatar
dist  
Mark Otto committed
4111
     */
Mark Otto's avatar
dist    
Mark Otto committed
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
    offset: {
      /** @prop {number} order=200 - Index used to define the order of execution */
      order: 200,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: offset,
      /** @prop {Number|String} offset=0
       * The offset value as described in the modifier description
       */
      offset: 0
    },

Mark Otto's avatar
dist  
Mark Otto committed
4125
    /**
Mark Otto's avatar
dist    
Mark Otto committed
4126
4127
     * Modifier used to prevent the popper from being positioned outside the boundary.
     *
Mark Otto's avatar
dist    
Mark Otto committed
4128
     * A scenario exists where the reference itself is not within the boundaries.<br />
Mark Otto's avatar
dist    
Mark Otto committed
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
     * We can say it has "escaped the boundaries" — or just "escaped".<br />
     * In this case we need to decide whether the popper should either:
     *
     * - detach from the reference and remain "trapped" in the boundaries, or
     * - if it should ignore the boundary and "escape with its reference"
     *
     * When `escapeWithReference` is set to`true` and reference is completely
     * outside its boundaries, the popper will overflow (or completely leave)
     * the boundaries in order to remain attached to the edge of the reference.
     *
     * @memberof modifiers
     * @inner
Mark Otto's avatar
dist  
Mark Otto committed
4141
     */
Mark Otto's avatar
dist    
Mark Otto committed
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
    preventOverflow: {
      /** @prop {number} order=300 - Index used to define the order of execution */
      order: 300,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: preventOverflow,
      /**
       * @prop {Array} [priority=['left','right','top','bottom']]
       * Popper will try to prevent overflow following these priorities by default,
       * then, it could overflow on the left and on top of the `boundariesElement`
       */
      priority: ['left', 'right', 'top', 'bottom'],
      /**
       * @prop {number} padding=5
       * Amount of pixel used to define a minimum distance between the boundaries
Mark Otto's avatar
dist    
Mark Otto committed
4158
       * and the popper. This makes sure the popper always has a little padding
Mark Otto's avatar
dist    
Mark Otto committed
4159
4160
4161
4162
4163
       * between the edges of its container
       */
      padding: 5,
      /**
       * @prop {String|HTMLElement} boundariesElement='scrollParent'
Mark Otto's avatar
dist    
Mark Otto committed
4164
       * Boundaries used by the modifier. Can be `scrollParent`, `window`,
Mark Otto's avatar
dist    
Mark Otto committed
4165
4166
4167
4168
       * `viewport` or any DOM element.
       */
      boundariesElement: 'scrollParent'
    },
Mark Otto's avatar
dist  
Mark Otto committed
4169
4170

    /**
Mark Otto's avatar
dist    
Mark Otto committed
4171
4172
4173
4174
     * Modifier used to make sure the reference and its popper stay near each other
     * without leaving any gap between the two. Especially useful when the arrow is
     * enabled and you want to ensure that it points to its reference element.
     * It cares only about the first axis. You can still have poppers with margin
Mark Otto's avatar
dist    
Mark Otto committed
4175
4176
4177
     * between the popper and its reference element.
     * @memberof modifiers
     * @inner
Mark Otto's avatar
dist  
Mark Otto committed
4178
     */
Mark Otto's avatar
dist    
Mark Otto committed
4179
4180
4181
4182
4183
4184
4185
4186
    keepTogether: {
      /** @prop {number} order=400 - Index used to define the order of execution */
      order: 400,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: keepTogether
    },
Mark Otto's avatar
dist  
Mark Otto committed
4187

Mark Otto's avatar
dist    
Mark Otto committed
4188
4189
4190
4191
    /**
     * This modifier is used to move the `arrowElement` of the popper to make
     * sure it is positioned between the reference element and its popper element.
     * It will read the outer size of the `arrowElement` node to detect how many
Mark Otto's avatar
dist    
Mark Otto committed
4192
     * pixels of conjunction are needed.
Mark Otto's avatar
dist    
Mark Otto committed
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
     *
     * It has no effect if no `arrowElement` is provided.
     * @memberof modifiers
     * @inner
     */
    arrow: {
      /** @prop {number} order=500 - Index used to define the order of execution */
      order: 500,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: arrow,
      /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
      element: '[x-arrow]'
    },
Mark Otto's avatar
dist  
Mark Otto committed
4208

Mark Otto's avatar
dist    
Mark Otto committed
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
    /**
     * Modifier used to flip the popper's placement when it starts to overlap its
     * reference element.
     *
     * Requires the `preventOverflow` modifier before it in order to work.
     *
     * **NOTE:** this modifier will interrupt the current update cycle and will
     * restart it if it detects the need to flip the placement.
     * @memberof modifiers
     * @inner
     */
    flip: {
      /** @prop {number} order=600 - Index used to define the order of execution */
      order: 600,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: flip,
      /**
       * @prop {String|Array} behavior='flip'
       * The behavior used to change the popper's placement. It can be one of
       * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
Mark Otto's avatar
dist    
Mark Otto committed
4231
       * placements (with optional variations)
Mark Otto's avatar
dist    
Mark Otto committed
4232
4233
4234
4235
4236
4237
4238
4239
4240
       */
      behavior: 'flip',
      /**
       * @prop {number} padding=5
       * The popper will flip if it hits the edges of the `boundariesElement`
       */
      padding: 5,
      /**
       * @prop {String|HTMLElement} boundariesElement='viewport'
Mark Otto's avatar
dist    
Mark Otto committed
4241
4242
4243
       * The element which will define the boundaries of the popper position.
       * The popper will never be placed outside of the defined boundaries
       * (except if `keepTogether` is enabled)
Mark Otto's avatar
dist    
Mark Otto committed
4244
       */
XhmikosR's avatar
XhmikosR committed
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
      boundariesElement: 'viewport',
      /**
       * @prop {Boolean} flipVariations=false
       * The popper will switch placement variation between `-start` and `-end` when
       * the reference element overlaps its boundaries.
       *
       * The original placement should have a set variation.
       */
      flipVariations: false,
      /**
       * @prop {Boolean} flipVariationsByContent=false
       * The popper will switch placement variation between `-start` and `-end` when
       * the popper element overlaps its reference boundaries.
       *
       * The original placement should have a set variation.
       */
      flipVariationsByContent: false
Mark Otto's avatar
dist    
Mark Otto committed
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
    },

    /**
     * Modifier used to make the popper flow toward the inner of the reference element.
     * By default, when this modifier is disabled, the popper will be placed outside
     * the reference element.
     * @memberof modifiers
     * @inner
     */
    inner: {
      /** @prop {number} order=700 - Index used to define the order of execution */
      order: 700,
      /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
      enabled: false,
      /** @prop {ModifierFn} */
      fn: inner
    },

    /**
     * Modifier used to hide the popper when its reference element is outside of the
     * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
     * be used to hide with a CSS selector the popper when its reference is
     * out of boundaries.
     *
     * Requires the `preventOverflow` modifier before it in order to work.
     * @memberof modifiers
     * @inner
     */
    hide: {
      /** @prop {number} order=800 - Index used to define the order of execution */
      order: 800,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: hide
    },

    /**
     * Computes the style that will be applied to the popper element to gets
     * properly positioned.
     *
     * Note that this modifier will not touch the DOM, it just prepares the styles
     * so that `applyStyle` modifier can apply it. This separation is useful
     * in case you need to replace `applyStyle` with a custom implementation.
     *
     * This modifier has `850` as `order` value to maintain backward compatibility
     * with previous versions of Popper.js. Expect the modifiers ordering method
     * to change in future major versions of the library.
     *
     * @memberof modifiers
     * @inner
     */
    computeStyle: {
      /** @prop {number} order=850 - Index used to define the order of execution */
      order: 850,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: computeStyle,
      /**
       * @prop {Boolean} gpuAcceleration=true
Mark Otto's avatar
dist    
Mark Otto committed
4323
4324
       * If true, it uses the CSS 3D transformation to position the popper.
       * Otherwise, it will use the `top` and `left` properties
Mark Otto's avatar
dist    
Mark Otto committed
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
       */
      gpuAcceleration: true,
      /**
       * @prop {string} [x='bottom']
       * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
       * Change this if your popper should grow in a direction different from `bottom`
       */
      x: 'bottom',
      /**
       * @prop {string} [x='left']
       * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
       * Change this if your popper should grow in a direction different from `right`
       */
      y: 'right'
    },

    /**
     * Applies the computed styles to the popper element.
     *
     * All the DOM manipulations are limited to this modifier. This is useful in case
     * you want to integrate Popper.js inside a framework or view library and you
     * want to delegate all the DOM manipulations to it.
     *
     * Note that if you disable this modifier, you must make sure the popper element
     * has its position set to `absolute` before Popper.js can do its work!
     *
Mark Otto's avatar
dist    
Mark Otto committed
4351
     * Just disable this modifier and define your own to achieve the desired effect.
Mark Otto's avatar
dist    
Mark Otto committed
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
     *
     * @memberof modifiers
     * @inner
     */
    applyStyle: {
      /** @prop {number} order=900 - Index used to define the order of execution */
      order: 900,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: applyStyle,
      /** @prop {Function} */
      onLoad: applyStyleOnLoad,
      /**
       * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
       * @prop {Boolean} gpuAcceleration=true
Mark Otto's avatar
dist    
Mark Otto committed
4368
4369
       * If true, it uses the CSS 3D transformation to position the popper.
       * Otherwise, it will use the `top` and `left` properties
Mark Otto's avatar
dist    
Mark Otto committed
4370
4371
4372
4373
       */
      gpuAcceleration: undefined
    }
  };
Mark Otto's avatar
dist  
Mark Otto committed
4374
4375

  /**
Mark Otto's avatar
dist    
Mark Otto committed
4376
4377
   * The `dataObject` is an object containing all the information used by Popper.js.
   * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
Mark Otto's avatar
dist    
Mark Otto committed
4378
4379
4380
4381
4382
   * @name dataObject
   * @property {Object} data.instance The Popper.js instance
   * @property {String} data.placement Placement applied to popper
   * @property {String} data.originalPlacement Placement originally defined on init
   * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
Mark Otto's avatar
dist    
Mark Otto committed
4383
   * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
Mark Otto's avatar
dist    
Mark Otto committed
4384
   * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
Mark Otto's avatar
dist    
Mark Otto committed
4385
4386
   * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
   * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
Mark Otto's avatar
dist    
Mark Otto committed
4387
   * @property {Object} data.boundaries Offsets of the popper boundaries
Mark Otto's avatar
dist    
Mark Otto committed
4388
   * @property {Object} data.offsets The measurements of popper, reference and arrow elements
Mark Otto's avatar
dist    
Mark Otto committed
4389
4390
4391
   * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
   * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
   * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
Mark Otto's avatar
dist  
Mark Otto committed
4392
4393
4394
   */

  /**
Mark Otto's avatar
dist    
Mark Otto committed
4395
   * Default options provided to Popper.js constructor.<br />
Mark Otto's avatar
dist    
Mark Otto committed
4396
4397
4398
   * These can be overridden using the `options` argument of Popper.js.<br />
   * To override an option, simply pass an object with the same
   * structure of the `options` object, as the 3rd argument. For example:
Mark Otto's avatar
dist    
Mark Otto committed
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
   * ```
   * new Popper(ref, pop, {
   *   modifiers: {
   *     preventOverflow: { enabled: false }
   *   }
   * })
   * ```
   * @type {Object}
   * @static
   * @memberof Popper
Mark Otto's avatar
dist  
Mark Otto committed
4409
   */
Mark Otto's avatar
dist    
Mark Otto committed
4410
4411
  var Defaults = {
    /**
Mark Otto's avatar
dist    
Mark Otto committed
4412
     * Popper's placement.
Mark Otto's avatar
dist    
Mark Otto committed
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
     * @prop {Popper.placements} placement='bottom'
     */
    placement: 'bottom',

    /**
     * Set this to true if you want popper to position it self in 'fixed' mode
     * @prop {Boolean} positionFixed=false
     */
    positionFixed: false,

    /**
Mark Otto's avatar
dist    
Mark Otto committed
4424
     * Whether events (resize, scroll) are initially enabled.
Mark Otto's avatar
dist    
Mark Otto committed
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
     * @prop {Boolean} eventsEnabled=true
     */
    eventsEnabled: true,

    /**
     * Set to true if you want to automatically remove the popper when
     * you call the `destroy` method.
     * @prop {Boolean} removeOnDestroy=false
     */
    removeOnDestroy: false,

    /**
     * Callback called when the popper is created.<br />
Mark Otto's avatar
dist    
Mark Otto committed
4438
     * By default, it is set to no-op.<br />
Mark Otto's avatar
dist    
Mark Otto committed
4439
4440
4441
4442
4443
4444
     * Access Popper.js instance with `data.instance`.
     * @prop {onCreate}
     */
    onCreate: function onCreate() {},

    /**
Mark Otto's avatar
dist    
Mark Otto committed
4445
     * Callback called when the popper is updated. This callback is not called
Mark Otto's avatar
dist    
Mark Otto committed
4446
4447
     * on the initialization/creation of the popper, but only on subsequent
     * updates.<br />
Mark Otto's avatar
dist    
Mark Otto committed
4448
     * By default, it is set to no-op.<br />
Mark Otto's avatar
dist    
Mark Otto committed
4449
4450
4451
4452
4453
4454
4455
     * Access Popper.js instance with `data.instance`.
     * @prop {onUpdate}
     */
    onUpdate: function onUpdate() {},

    /**
     * List of modifiers used to modify the offsets before they are applied to the popper.
Mark Otto's avatar
dist    
Mark Otto committed
4456
     * They provide most of the functionalities of Popper.js.
Mark Otto's avatar
dist    
Mark Otto committed
4457
4458
4459
4460
     * @prop {modifiers}
     */
    modifiers: modifiers
  };
Mark Otto's avatar
dist  
Mark Otto committed
4461
4462

  /**
Mark Otto's avatar
dist    
Mark Otto committed
4463
4464
   * @callback onCreate
   * @param {dataObject} data
Mark Otto's avatar
dist  
Mark Otto committed
4465
   */
Mark Otto's avatar
dist    
Mark Otto committed
4466

Mark Otto's avatar
dist  
Mark Otto committed
4467
  /**
Mark Otto's avatar
dist    
Mark Otto committed
4468
4469
   * @callback onUpdate
   * @param {dataObject} data
Mark Otto's avatar
dist  
Mark Otto committed
4470
4471
   */

Mark Otto's avatar
dist    
Mark Otto committed
4472
4473
4474
4475
  // Utils
  // Methods
  var Popper = function () {
    /**
Mark Otto's avatar
dist    
Mark Otto committed
4476
     * Creates a new Popper.js instance.
Mark Otto's avatar
dist    
Mark Otto committed
4477
     * @class Popper
XhmikosR's avatar
XhmikosR committed
4478
4479
     * @param {Element|referenceObject} reference - The reference element used to position the popper
     * @param {Element} popper - The HTML / XML element used as the popper
Mark Otto's avatar
dist    
Mark Otto committed
4480
4481
4482
4483
4484
4485
4486
4487
     * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
     * @return {Object} instance - The generated Popper.js instance
     */
    function Popper(reference, popper) {
      var _this = this;

      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      classCallCheck(this, Popper);
Mark Otto's avatar
dist  
Mark Otto committed
4488

Mark Otto's avatar
dist    
Mark Otto committed
4489
4490
4491
      this.scheduleUpdate = function () {
        return requestAnimationFrame(_this.update);
      };
Mark Otto's avatar
dist  
Mark Otto committed
4492

Mark Otto's avatar
dist    
Mark Otto committed
4493
4494
4495
4496
      // make update() debounced, so that it only runs at most once-per-tick
      this.update = debounce(this.update.bind(this));

      // with {} we create a new object with the options inside it
XhmikosR's avatar
XhmikosR committed
4497
      this.options = _extends$1({}, Popper.Defaults, options);
Mark Otto's avatar
dist    
Mark Otto committed
4498
4499
4500
4501
4502
4503
4504

      // init state
      this.state = {
        isDestroyed: false,
        isCreated: false,
        scrollParents: []
      };
Mark Otto's avatar
dist  
Mark Otto committed
4505

Mark Otto's avatar
dist    
Mark Otto committed
4506
4507
4508
      // get reference and popper elements (allow jQuery wrappers)
      this.reference = reference && reference.jquery ? reference[0] : reference;
      this.popper = popper && popper.jquery ? popper[0] : popper;
Mark Otto's avatar
dist  
Mark Otto committed
4509

Mark Otto's avatar
dist    
Mark Otto committed
4510
4511
      // Deep merge modifiers options
      this.options.modifiers = {};
XhmikosR's avatar
XhmikosR committed
4512
4513
      Object.keys(_extends$1({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
        _this.options.modifiers[name] = _extends$1({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
Mark Otto's avatar
dist    
Mark Otto committed
4514
      });
Mark Otto's avatar
dist  
Mark Otto committed
4515

Mark Otto's avatar
dist    
Mark Otto committed
4516
4517
      // Refactoring modifiers' list (Object => Array)
      this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
XhmikosR's avatar
XhmikosR committed
4518
        return _extends$1({
Mark Otto's avatar
dist    
Mark Otto committed
4519
4520
4521
4522
4523
4524
4525
          name: name
        }, _this.options.modifiers[name]);
      })
      // sort the modifiers by order
      .sort(function (a, b) {
        return a.order - b.order;
      });
Mark Otto's avatar
dist  
Mark Otto committed
4526

Mark Otto's avatar
dist    
Mark Otto committed
4527
4528
4529
4530
4531
4532
4533
4534
4535
      // modifiers have the ability to execute arbitrary code when Popper.js get inited
      // such code is executed in the same order of its modifier
      // they could add new properties to their options configuration
      // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
      this.modifiers.forEach(function (modifierOptions) {
        if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
          modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
        }
      });
Mark Otto's avatar
dist  
Mark Otto committed
4536

Mark Otto's avatar
dist    
Mark Otto committed
4537
4538
      // fire the first update to position the popper in the right place
      this.update();
Mark Otto's avatar
dist  
Mark Otto committed
4539

Mark Otto's avatar
dist    
Mark Otto committed
4540
4541
4542
4543
      var eventsEnabled = this.options.eventsEnabled;
      if (eventsEnabled) {
        // setup event listeners, they will take care of update the position in specific situations
        this.enableEventListeners();
Mark Otto's avatar
dist  
Mark Otto committed
4544
4545
      }

Mark Otto's avatar
dist    
Mark Otto committed
4546
      this.state.eventsEnabled = eventsEnabled;
Mark Otto's avatar
dist  
Mark Otto committed
4547
4548
    }

Mark Otto's avatar
dist    
Mark Otto committed
4549
4550
    // We can't use class properties because they don't get listed in the
    // class prototype and break stuff like Sinon stubs
Mark Otto's avatar
dist  
Mark Otto committed
4551
4552


Mark Otto's avatar
dist    
Mark Otto committed
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
    createClass(Popper, [{
      key: 'update',
      value: function update$$1() {
        return update.call(this);
      }
    }, {
      key: 'destroy',
      value: function destroy$$1() {
        return destroy.call(this);
      }
    }, {
      key: 'enableEventListeners',
      value: function enableEventListeners$$1() {
        return enableEventListeners.call(this);
      }
    }, {
      key: 'disableEventListeners',
      value: function disableEventListeners$$1() {
        return disableEventListeners.call(this);
      }
Mark Otto's avatar
dist  
Mark Otto committed
4573

Mark Otto's avatar
dist    
Mark Otto committed
4574
      /**
Mark Otto's avatar
dist    
Mark Otto committed
4575
       * Schedules an update. It will run on the next UI update available.
Mark Otto's avatar
dist    
Mark Otto committed
4576
4577
4578
       * @method scheduleUpdate
       * @memberof Popper
       */
Mark Otto's avatar
dist  
Mark Otto committed
4579
4580


Mark Otto's avatar
dist    
Mark Otto committed
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
      /**
       * Collection of utilities useful when writing custom modifiers.
       * Starting from version 1.7, this method is available only if you
       * include `popper-utils.js` before `popper.js`.
       *
       * **DEPRECATION**: This way to access PopperUtils is deprecated
       * and will be removed in v2! Use the PopperUtils module directly instead.
       * Due to the high instability of the methods contained in Utils, we can't
       * guarantee them to follow semver. Use them at your own risk!
       * @static
       * @private
       * @type {Object}
       * @deprecated since version 1.8
       * @member Utils
       * @memberof Popper
       */
Mark Otto's avatar
dist  
Mark Otto committed
4597

Mark Otto's avatar
dist    
Mark Otto committed
4598
4599
4600
    }]);
    return Popper;
  }();
Mark Otto's avatar
dist  
Mark Otto committed
4601
4602

  /**
Mark Otto's avatar
dist    
Mark Otto committed
4603
4604
4605
4606
4607
4608
4609
4610
4611
   * The `referenceObject` is an object that provides an interface compatible with Popper.js
   * and lets you use it as replacement of a real DOM node.<br />
   * You can use this method to position a popper relatively to a set of coordinates
   * in case you don't have a DOM node to use as reference.
   *
   * ```
   * new Popper(referenceObject, popperNode);
   * ```
   *
Mark Otto's avatar
dist    
Mark Otto committed
4612
   * NB: This feature isn't supported in Internet Explorer 10.
Mark Otto's avatar
dist    
Mark Otto committed
4613
4614
4615
4616
4617
4618
4619
   * @name referenceObject
   * @property {Function} data.getBoundingClientRect
   * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
   * @property {number} data.clientWidth
   * An ES6 getter that will return the width of the virtual reference element.
   * @property {number} data.clientHeight
   * An ES6 getter that will return the height of the virtual reference element.
Mark Otto's avatar
dist  
Mark Otto committed
4620
   */
Mark Otto's avatar
dist    
Mark Otto committed
4621
4622
4623
4624
4625
4626


  Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  Popper.placements = placements;
  Popper.Defaults = Defaults;

XhmikosR's avatar
Dist    
XhmikosR committed
4627
4628
4629
4630
4631
4632
4633
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$4 = 'dropdown';
XhmikosR's avatar
XhmikosR committed
4634
  var VERSION$4 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
4635
4636
4637
  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
4638
4639
4640
4641
4642
4643
4644
4645
  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
4646
4647
4648
4649
4650
4651
4652
4653
  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;
XhmikosR's avatar
XhmikosR committed
4654
  var CLASS_NAME_DISABLED = 'disabled';
XhmikosR's avatar
XhmikosR committed
4655
4656
4657
4658
4659
4660
4661
  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';
XhmikosR's avatar
XhmikosR committed
4662
  var SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="dropdown"]';
XhmikosR's avatar
XhmikosR committed
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
  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
4673
4674
4675
4676
4677
  var Default$2 = {
    offset: 0,
    flip: true,
    boundary: 'scrollParent',
    reference: 'toggle',
XhmikosR's avatar
XhmikosR committed
4678
4679
    display: 'dynamic',
    popperConfig: null
XhmikosR's avatar
Dist    
XhmikosR committed
4680
4681
4682
4683
4684
4685
  };
  var DefaultType$2 = {
    offset: '(number|string|function)',
    flip: 'boolean',
    boundary: '(string|element)',
    reference: '(string|element)',
XhmikosR's avatar
XhmikosR committed
4686
4687
    display: 'string',
    popperConfig: '(null|object)'
XhmikosR's avatar
Dist    
XhmikosR committed
4688
  };
XhmikosR's avatar
XhmikosR committed
4689
4690
4691
4692
4693
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
4694

XhmikosR's avatar
XhmikosR committed
4695
  var Dropdown = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
4696
4697
4698
4699
4700
4701
    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
4702

XhmikosR's avatar
Dist    
XhmikosR committed
4703
      this._addEventListeners();
XhmikosR's avatar
XhmikosR committed
4704
4705

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

Mark Otto's avatar
dist  
Mark Otto committed
4708

XhmikosR's avatar
Dist    
XhmikosR committed
4709
    var _proto = Dropdown.prototype;
Mark Otto's avatar
dist  
Mark Otto committed
4710

XhmikosR's avatar
Dist    
XhmikosR committed
4711
4712
    // Public
    _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
4713
      if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED)) {
XhmikosR's avatar
Dist    
XhmikosR committed
4714
4715
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4716

XhmikosR's avatar
XhmikosR committed
4717
      var isActive = this._element.classList.contains(CLASS_NAME_SHOW$1);
Mark Otto's avatar
dist  
Mark Otto committed
4718

XhmikosR's avatar
XhmikosR committed
4719
      Dropdown.clearMenus();
Mark Otto's avatar
dist  
Mark Otto committed
4720

XhmikosR's avatar
Dist    
XhmikosR committed
4721
4722
4723
      if (isActive) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
4724

XhmikosR's avatar
XhmikosR committed
4725
4726
4727
4728
      this.show();
    };

    _proto.show = function show() {
XhmikosR's avatar
XhmikosR committed
4729
      if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || this._menu.classList.contains(CLASS_NAME_SHOW$1)) {
XhmikosR's avatar
XhmikosR committed
4730
4731
4732
4733
        return;
      }

      var parent = Dropdown.getParentFromElement(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
4734
4735
4736
      var relatedTarget = {
        relatedTarget: this._element
      };
XhmikosR's avatar
XhmikosR committed
4737
      var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$1, relatedTarget);
Mark Otto's avatar
dist  
Mark Otto committed
4738

XhmikosR's avatar
XhmikosR committed
4739
      if (showEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
4740
        return;
XhmikosR's avatar
XhmikosR committed
4741
      } // Totally disable Popper for Dropdowns in Navbar
Mark Otto's avatar
dist    
Mark Otto committed
4742

Mark Otto's avatar
dist  
Mark Otto committed
4743

XhmikosR's avatar
Dist    
XhmikosR committed
4744
4745
      if (!this._inNavbar) {
        if (typeof Popper === 'undefined') {
XhmikosR's avatar
XhmikosR committed
4746
          throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
Mark Otto's avatar
dist    
Mark Otto committed
4747
        }
Mark Otto's avatar
dist  
Mark Otto committed
4748

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

XhmikosR's avatar
Dist    
XhmikosR committed
4751
4752
        if (this._config.reference === 'parent') {
          referenceElement = parent;
XhmikosR's avatar
XhmikosR committed
4753
        } else if (isElement(this._config.reference)) {
XhmikosR's avatar
Dist    
XhmikosR committed
4754
          referenceElement = this._config.reference; // Check if it's jQuery element
Mark Otto's avatar
dist    
Mark Otto committed
4755

XhmikosR's avatar
Dist    
XhmikosR committed
4756
4757
          if (typeof this._config.reference.jquery !== 'undefined') {
            referenceElement = this._config.reference[0];
Mark Otto's avatar
dist    
Mark Otto committed
4758
          }
XhmikosR's avatar
Dist    
XhmikosR committed
4759
4760
4761
        } // 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
Mark Otto's avatar
dist    
Mark Otto committed
4762

Mark Otto's avatar
dist    
Mark Otto committed
4763

XhmikosR's avatar
Dist    
XhmikosR committed
4764
        if (this._config.boundary !== 'scrollParent') {
XhmikosR's avatar
XhmikosR committed
4765
          parent.classList.add(CLASS_NAME_POSITION_STATIC);
XhmikosR's avatar
Dist    
XhmikosR committed
4766
        }
Mark Otto's avatar
dist    
Mark Otto committed
4767

XhmikosR's avatar
Dist    
XhmikosR committed
4768
4769
4770
4771
4772
        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
4773

Mark Otto's avatar
dist    
Mark Otto committed
4774

XhmikosR's avatar
XhmikosR committed
4775
      if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
XhmikosR's avatar
XhmikosR committed
4776
4777
4778
        var _ref;

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
4785
      this._element.setAttribute('aria-expanded', true);
Mark Otto's avatar
dist  
Mark Otto committed
4786

Mark Otto's avatar
Mark Otto committed
4787
4788
4789
4790
      this._menu.classList.toggle(CLASS_NAME_SHOW$1);

      this._element.classList.toggle(CLASS_NAME_SHOW$1);

XhmikosR's avatar
XhmikosR committed
4791
      EventHandler.trigger(parent, EVENT_SHOWN$1, relatedTarget);
XhmikosR's avatar
Dist    
XhmikosR committed
4792
    };
Mark Otto's avatar
dist    
Mark Otto committed
4793

XhmikosR's avatar
Dist    
XhmikosR committed
4794
    _proto.hide = function hide() {
XhmikosR's avatar
XhmikosR committed
4795
      if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || !this._menu.classList.contains(CLASS_NAME_SHOW$1)) {
XhmikosR's avatar
Dist    
XhmikosR committed
4796
4797
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
4798

XhmikosR's avatar
XhmikosR committed
4799
      var parent = Dropdown.getParentFromElement(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
4800
4801
4802
      var relatedTarget = {
        relatedTarget: this._element
      };
XhmikosR's avatar
XhmikosR committed
4803
      var hideEvent = EventHandler.trigger(parent, EVENT_HIDE$1, relatedTarget);
Mark Otto's avatar
dist    
Mark Otto committed
4804

XhmikosR's avatar
XhmikosR committed
4805
      if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
4806
4807
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4808

XhmikosR's avatar
XhmikosR committed
4809
4810
4811
4812
      if (this._popper) {
        this._popper.destroy();
      }

Mark Otto's avatar
Mark Otto committed
4813
4814
4815
4816
      this._menu.classList.toggle(CLASS_NAME_SHOW$1);

      this._element.classList.toggle(CLASS_NAME_SHOW$1);

XhmikosR's avatar
XhmikosR committed
4817
      EventHandler.trigger(parent, EVENT_HIDDEN$1, relatedTarget);
XhmikosR's avatar
Dist    
XhmikosR committed
4818
    };
Mark Otto's avatar
dist  
Mark Otto committed
4819

XhmikosR's avatar
Dist    
XhmikosR committed
4820
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
4821
4822
      Data.removeData(this._element, DATA_KEY$4);
      EventHandler.off(this._element, EVENT_KEY$4);
XhmikosR's avatar
Dist    
XhmikosR committed
4823
4824
      this._element = null;
      this._menu = null;
Mark Otto's avatar
dist    
Mark Otto committed
4825

XhmikosR's avatar
XhmikosR committed
4826
      if (this._popper) {
XhmikosR's avatar
Dist    
XhmikosR committed
4827
        this._popper.destroy();
Mark Otto's avatar
dist  
Mark Otto committed
4828

XhmikosR's avatar
Dist    
XhmikosR committed
4829
4830
4831
        this._popper = null;
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
4832

XhmikosR's avatar
Dist    
XhmikosR committed
4833
4834
    _proto.update = function update() {
      this._inNavbar = this._detectNavbar();
Mark Otto's avatar
dist    
Mark Otto committed
4835

XhmikosR's avatar
XhmikosR committed
4836
      if (this._popper) {
XhmikosR's avatar
Dist    
XhmikosR committed
4837
4838
        this._popper.scheduleUpdate();
      }
Mark Otto's avatar
Mark Otto committed
4839
4840
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
4841

XhmikosR's avatar
Dist    
XhmikosR committed
4842
4843
    _proto._addEventListeners = function _addEventListeners() {
      var _this = this;
Mark Otto's avatar
dist    
Mark Otto committed
4844

XhmikosR's avatar
XhmikosR committed
4845
      EventHandler.on(this._element, EVENT_CLICK, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
4846
4847
        event.preventDefault();
        event.stopPropagation();
Mark Otto's avatar
dist  
Mark Otto committed
4848

XhmikosR's avatar
Dist    
XhmikosR committed
4849
4850
4851
        _this.toggle();
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
4852

XhmikosR's avatar
Dist    
XhmikosR committed
4853
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
4854
      config = _extends({}, this.constructor.Default, Manipulator.getDataAttributes(this._element), config);
XhmikosR's avatar
XhmikosR committed
4855
      typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
4856
4857
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
4858

XhmikosR's avatar
Dist    
XhmikosR committed
4859
    _proto._getMenuElement = function _getMenuElement() {
XhmikosR's avatar
XhmikosR committed
4860
      return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
XhmikosR's avatar
Dist    
XhmikosR committed
4861
    };
Mark Otto's avatar
dist  
Mark Otto committed
4862

XhmikosR's avatar
Dist    
XhmikosR committed
4863
    _proto._getPlacement = function _getPlacement() {
XhmikosR's avatar
XhmikosR committed
4864
      var parentDropdown = this._element.parentNode;
XhmikosR's avatar
XhmikosR committed
4865
      var placement = PLACEMENT_BOTTOM; // Handle dropup
Mark Otto's avatar
dist  
Mark Otto committed
4866

XhmikosR's avatar
XhmikosR committed
4867
      if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
XhmikosR's avatar
XhmikosR committed
4868
        placement = this._menu.classList.contains(CLASS_NAME_MENURIGHT) ? PLACEMENT_TOPEND : PLACEMENT_TOP;
XhmikosR's avatar
XhmikosR committed
4869
4870
4871
4872
4873
4874
      } 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
4875
      }
Mark Otto's avatar
dist    
Mark Otto committed
4876

XhmikosR's avatar
Dist    
XhmikosR committed
4877
4878
      return placement;
    };
Mark Otto's avatar
dist    
Mark Otto committed
4879

XhmikosR's avatar
Dist    
XhmikosR committed
4880
    _proto._detectNavbar = function _detectNavbar() {
XhmikosR's avatar
XhmikosR committed
4881
      return Boolean(this._element.closest("." + CLASS_NAME_NAVBAR));
XhmikosR's avatar
Dist    
XhmikosR committed
4882
    };
Mark Otto's avatar
dist    
Mark Otto committed
4883

Mark Otto's avatar
Mark Otto committed
4884
    _proto._getOffset = function _getOffset() {
XhmikosR's avatar
Dist    
XhmikosR committed
4885
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
4886

Mark Otto's avatar
Mark Otto committed
4887
      var offset = {};
Mark Otto's avatar
dist    
Mark Otto committed
4888

XhmikosR's avatar
Dist    
XhmikosR committed
4889
      if (typeof this._config.offset === 'function') {
Mark Otto's avatar
Mark Otto committed
4890
        offset.fn = function (data) {
XhmikosR's avatar
XhmikosR committed
4891
          data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
XhmikosR's avatar
Dist    
XhmikosR committed
4892
4893
4894
          return data;
        };
      } else {
Mark Otto's avatar
Mark Otto committed
4895
        offset.offset = this._config.offset;
XhmikosR's avatar
Dist    
XhmikosR committed
4896
      }
Mark Otto's avatar
dist    
Mark Otto committed
4897

Mark Otto's avatar
Mark Otto committed
4898
4899
4900
4901
      return offset;
    };

    _proto._getPopperConfig = function _getPopperConfig() {
XhmikosR's avatar
Dist    
XhmikosR committed
4902
4903
4904
      var popperConfig = {
        placement: this._getPlacement(),
        modifiers: {
Mark Otto's avatar
Mark Otto committed
4905
          offset: this._getOffset(),
XhmikosR's avatar
Dist    
XhmikosR committed
4906
4907
4908
4909
4910
          flip: {
            enabled: this._config.flip
          },
          preventOverflow: {
            boundariesElement: this._config.boundary
Mark Otto's avatar
dist    
Mark Otto committed
4911
          }
XhmikosR's avatar
XhmikosR committed
4912
        }
XhmikosR's avatar
XhmikosR committed
4913
      }; // Disable Popper if we have a static display
Mark Otto's avatar
dist    
Mark Otto committed
4914

XhmikosR's avatar
Dist    
XhmikosR committed
4915
4916
4917
4918
4919
      if (this._config.display === 'static') {
        popperConfig.modifiers.applyStyle = {
          enabled: false
        };
      }
Mark Otto's avatar
dist  
Mark Otto committed
4920

XhmikosR's avatar
XhmikosR committed
4921
      return _extends({}, popperConfig, this._config.popperConfig);
Mark Otto's avatar
Mark Otto committed
4922
4923
    } // Static
    ;
Mark Otto's avatar
dist    
Mark Otto committed
4924

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

XhmikosR's avatar
XhmikosR committed
4928
      var _config = typeof config === 'object' ? config : null;
Mark Otto's avatar
dist  
Mark Otto committed
4929

XhmikosR's avatar
XhmikosR committed
4930
4931
4932
4933
4934
4935
      if (!data) {
        data = new Dropdown(element, _config);
      }

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

XhmikosR's avatar
XhmikosR committed
4939
4940
4941
        data[config]();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
4942

XhmikosR's avatar
XhmikosR committed
4943
    Dropdown.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
XhmikosR committed
4944
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
4945
        Dropdown.dropdownInterface(this, config);
XhmikosR's avatar
Dist    
XhmikosR committed
4946
4947
4948
      });
    };

XhmikosR's avatar
XhmikosR committed
4949
    Dropdown.clearMenus = function clearMenus(event) {
XhmikosR's avatar
XhmikosR committed
4950
      if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY)) {
XhmikosR's avatar
Dist    
XhmikosR committed
4951
4952
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
4953

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

XhmikosR's avatar
Dist    
XhmikosR committed
4956
      for (var i = 0, len = toggles.length; i < len; i++) {
XhmikosR's avatar
XhmikosR committed
4957
        var parent = Dropdown.getParentFromElement(toggles[i]);
XhmikosR's avatar
XhmikosR committed
4958
        var context = Data.getData(toggles[i], DATA_KEY$4);
XhmikosR's avatar
Dist    
XhmikosR committed
4959
4960
4961
        var relatedTarget = {
          relatedTarget: toggles[i]
        };
Mark Otto's avatar
dist    
Mark Otto committed
4962

XhmikosR's avatar
Dist    
XhmikosR committed
4963
4964
4965
        if (event && event.type === 'click') {
          relatedTarget.clickEvent = event;
        }
Mark Otto's avatar
dist  
Mark Otto committed
4966

XhmikosR's avatar
Dist    
XhmikosR committed
4967
4968
        if (!context) {
          continue;
Mark Otto's avatar
dist  
Mark Otto committed
4969
4970
        }

XhmikosR's avatar
Dist    
XhmikosR committed
4971
        var dropdownMenu = context._menu;
Mark Otto's avatar
dist    
Mark Otto committed
4972

XhmikosR's avatar
XhmikosR committed
4973
        if (!toggles[i].classList.contains(CLASS_NAME_SHOW$1)) {
XhmikosR's avatar
Dist    
XhmikosR committed
4974
          continue;
Mark Otto's avatar
dist  
Mark Otto committed
4975
4976
        }

XhmikosR's avatar
XhmikosR committed
4977
        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
4978
4979
          continue;
        }
Mark Otto's avatar
dist  
Mark Otto committed
4980

XhmikosR's avatar
XhmikosR committed
4981
        var hideEvent = EventHandler.trigger(parent, EVENT_HIDE$1, relatedTarget);
Mark Otto's avatar
dist    
Mark Otto committed
4982

XhmikosR's avatar
XhmikosR committed
4983
        if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
4984
4985
4986
          continue;
        } // If this is a touch-enabled device we remove the extra
        // empty mouseover listeners we added for iOS support
Mark Otto's avatar
dist    
Mark Otto committed
4987
4988


XhmikosR's avatar
Dist    
XhmikosR committed
4989
        if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
4990
4991
4992
          var _ref2;

          (_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (elem) {
XhmikosR's avatar
XhmikosR committed
4993
4994
            return EventHandler.off(elem, 'mouseover', null, noop());
          });
Mark Otto's avatar
dist  
Mark Otto committed
4995
4996
        }

XhmikosR's avatar
Dist    
XhmikosR committed
4997
        toggles[i].setAttribute('aria-expanded', 'false');
XhmikosR's avatar
XhmikosR committed
4998
4999
5000
5001
5002

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

XhmikosR's avatar
XhmikosR committed
5003
5004
5005
        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
5006
5007
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
5008

XhmikosR's avatar
XhmikosR committed
5009
5010
    Dropdown.getParentFromElement = function getParentFromElement(element) {
      return getElementFromSelector(element) || element.parentNode;
XhmikosR's avatar
XhmikosR committed
5011
    };
Mark Otto's avatar
dist  
Mark Otto committed
5012

XhmikosR's avatar
XhmikosR committed
5013
    Dropdown.dataApiKeydownHandler = function dataApiKeydownHandler(event) {
XhmikosR's avatar
Dist    
XhmikosR committed
5014
5015
5016
5017
5018
5019
5020
      // 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
5021
      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
5022
5023
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5024

XhmikosR's avatar
Dist    
XhmikosR committed
5025
5026
      event.preventDefault();
      event.stopPropagation();
Mark Otto's avatar
dist  
Mark Otto committed
5027

XhmikosR's avatar
XhmikosR committed
5028
      if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5029
5030
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
5031

XhmikosR's avatar
XhmikosR committed
5032
      var parent = Dropdown.getParentFromElement(this);
XhmikosR's avatar
XhmikosR committed
5033
      var isActive = this.classList.contains(CLASS_NAME_SHOW$1);
XhmikosR's avatar
Dist    
XhmikosR committed
5034

XhmikosR's avatar
XhmikosR committed
5035
      if (event.key === ESCAPE_KEY) {
XhmikosR's avatar
XhmikosR committed
5036
5037
5038
5039
5040
        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
dist  
Mark Otto committed
5041

XhmikosR's avatar
XhmikosR committed
5042
      if (!isActive || event.key === SPACE_KEY) {
XhmikosR's avatar
XhmikosR committed
5043
        Dropdown.clearMenus();
XhmikosR's avatar
Dist    
XhmikosR committed
5044
5045
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5046

XhmikosR's avatar
XhmikosR committed
5047
      var items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible);
Mark Otto's avatar
dist  
Mark Otto committed
5048

XhmikosR's avatar
XhmikosR committed
5049
      if (!items.length) {
XhmikosR's avatar
Dist    
XhmikosR committed
5050
5051
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5052

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

XhmikosR's avatar
XhmikosR committed
5055
      if (event.key === ARROW_UP_KEY && index > 0) {
XhmikosR's avatar
Dist    
XhmikosR committed
5056
5057
5058
        // Up
        index--;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5059

XhmikosR's avatar
XhmikosR committed
5060
      if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
XhmikosR's avatar
Dist    
XhmikosR committed
5061
5062
        // Down
        index++;
XhmikosR's avatar
XhmikosR committed
5063
5064
      } // index is -1 if the first keydown is an ArrowUp

Mark Otto's avatar
dist  
Mark Otto committed
5065

XhmikosR's avatar
XhmikosR committed
5066
      index = index === -1 ? 0 : index;
XhmikosR's avatar
Dist    
XhmikosR committed
5067
      items[index].focus();
Mark Otto's avatar
dist  
Mark Otto committed
5068
5069
    };

XhmikosR's avatar
XhmikosR committed
5070
    Dropdown.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
5071
5072
5073
      return Data.getData(element, DATA_KEY$4);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
    _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
5091
    return Dropdown;
XhmikosR's avatar
Dist    
XhmikosR committed
5092
5093
5094
5095
5096
5097
5098
5099
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


XhmikosR's avatar
XhmikosR committed
5100
5101
5102
5103
5104
  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
5105
5106
    event.preventDefault();
    event.stopPropagation();
XhmikosR's avatar
XhmikosR committed
5107
    Dropdown.dropdownInterface(this, 'toggle');
XhmikosR's avatar
XhmikosR committed
5108
  });
XhmikosR's avatar
XhmikosR committed
5109
  EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_FORM_CHILD, function (e) {
XhmikosR's avatar
XhmikosR committed
5110
    return e.stopPropagation();
XhmikosR's avatar
Dist    
XhmikosR committed
5111
5112
5113
5114
5115
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
5116
   * add .Dropdown to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
5117
5118
   */

XhmikosR's avatar
XhmikosR committed
5119
5120
5121
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
5122

XhmikosR's avatar
XhmikosR committed
5123
5124
5125
5126
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$4];
      $.fn[NAME$4] = Dropdown.jQueryInterface;
      $.fn[NAME$4].Constructor = Dropdown;
XhmikosR's avatar
Dist    
XhmikosR committed
5127

XhmikosR's avatar
XhmikosR committed
5128
5129
5130
5131
5132
5133
      $.fn[NAME$4].noConflict = function () {
        $.fn[NAME$4] = JQUERY_NO_CONFLICT;
        return Dropdown.jQueryInterface;
      };
    }
  });
Mark Otto's avatar
dist    
Mark Otto committed
5134

XhmikosR's avatar
Dist    
XhmikosR committed
5135
5136
5137
5138
5139
5140
5141
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$5 = 'modal';
XhmikosR's avatar
XhmikosR committed
5142
  var VERSION$5 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
5143
5144
5145
  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
5146
  var ESCAPE_KEY$1 = 'Escape';
XhmikosR's avatar
Dist    
XhmikosR committed
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
  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
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
  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';
XhmikosR's avatar
XhmikosR committed
5179
5180
  var SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="modal"]';
  var SELECTOR_DATA_DISMISS = '[data-bs-dismiss="modal"]';
XhmikosR's avatar
XhmikosR committed
5181
5182
  var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
  var SELECTOR_STICKY_CONTENT = '.sticky-top';
XhmikosR's avatar
XhmikosR committed
5183
5184
5185
5186
5187
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
5188

XhmikosR's avatar
XhmikosR committed
5189
  var Modal = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
5190
5191
5192
    function Modal(element, config) {
      this._config = this._getConfig(config);
      this._element = element;
XhmikosR's avatar
XhmikosR committed
5193
      this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, element);
XhmikosR's avatar
Dist    
XhmikosR committed
5194
5195
5196
5197
5198
5199
      this._backdrop = null;
      this._isShown = false;
      this._isBodyOverflowing = false;
      this._ignoreBackdropClick = false;
      this._isTransitioning = false;
      this._scrollbarWidth = 0;
XhmikosR's avatar
XhmikosR committed
5200
      Data.setData(element, DATA_KEY$5, this);
XhmikosR's avatar
Dist    
XhmikosR committed
5201
5202
5203
5204
5205
5206
5207
5208
    } // 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
5209
5210
    };

XhmikosR's avatar
Dist    
XhmikosR committed
5211
5212
    _proto.show = function show(relatedTarget) {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
5213

XhmikosR's avatar
Dist    
XhmikosR committed
5214
5215
5216
      if (this._isShown || this._isTransitioning) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5217

XhmikosR's avatar
XhmikosR committed
5218
      if (this._element.classList.contains(CLASS_NAME_FADE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5219
5220
        this._isTransitioning = true;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5221

XhmikosR's avatar
XhmikosR committed
5222
      var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, {
XhmikosR's avatar
Dist    
XhmikosR committed
5223
5224
        relatedTarget: relatedTarget
      });
Mark Otto's avatar
dist    
Mark Otto committed
5225

XhmikosR's avatar
XhmikosR committed
5226
      if (this._isShown || showEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
5227
5228
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
5229

XhmikosR's avatar
Dist    
XhmikosR committed
5230
      this._isShown = true;
Mark Otto's avatar
dist    
Mark Otto committed
5231

XhmikosR's avatar
Dist    
XhmikosR committed
5232
      this._checkScrollbar();
Mark Otto's avatar
dist    
Mark Otto committed
5233

XhmikosR's avatar
Dist    
XhmikosR committed
5234
      this._setScrollbar();
Mark Otto's avatar
dist    
Mark Otto committed
5235

XhmikosR's avatar
Dist    
XhmikosR committed
5236
      this._adjustDialog();
Mark Otto's avatar
dist  
Mark Otto committed
5237

XhmikosR's avatar
Dist    
XhmikosR committed
5238
      this._setEscapeEvent();
Mark Otto's avatar
dist  
Mark Otto committed
5239

XhmikosR's avatar
Dist    
XhmikosR committed
5240
      this._setResizeEvent();
Mark Otto's avatar
dist    
Mark Otto committed
5241

XhmikosR's avatar
XhmikosR committed
5242
      EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
5243
5244
        return _this.hide(event);
      });
XhmikosR's avatar
XhmikosR committed
5245
5246
      EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, function () {
        EventHandler.one(_this._element, EVENT_MOUSEUP_DISMISS, function (event) {
XhmikosR's avatar
XhmikosR committed
5247
          if (event.target === _this._element) {
XhmikosR's avatar
Dist    
XhmikosR committed
5248
5249
5250
5251
            _this._ignoreBackdropClick = true;
          }
        });
      });
Mark Otto's avatar
dist  
Mark Otto committed
5252

XhmikosR's avatar
Dist    
XhmikosR committed
5253
5254
5255
5256
      this._showBackdrop(function () {
        return _this._showElement(relatedTarget);
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
5257

XhmikosR's avatar
Dist    
XhmikosR committed
5258
5259
    _proto.hide = function hide(event) {
      var _this2 = this;
Mark Otto's avatar
dist  
Mark Otto committed
5260

XhmikosR's avatar
Dist    
XhmikosR committed
5261
5262
5263
      if (event) {
        event.preventDefault();
      }
Mark Otto's avatar
dist    
Mark Otto committed
5264

XhmikosR's avatar
Dist    
XhmikosR committed
5265
5266
5267
      if (!this._isShown || this._isTransitioning) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5268

XhmikosR's avatar
XhmikosR committed
5269
      var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2);
Mark Otto's avatar
dist  
Mark Otto committed
5270

5271
      if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
5272
5273
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5274

XhmikosR's avatar
Dist    
XhmikosR committed
5275
      this._isShown = false;
XhmikosR's avatar
XhmikosR committed
5276

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

XhmikosR's avatar
Dist    
XhmikosR committed
5279
5280
5281
      if (transition) {
        this._isTransitioning = true;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5282

XhmikosR's avatar
Dist    
XhmikosR committed
5283
      this._setEscapeEvent();
Mark Otto's avatar
dist  
Mark Otto committed
5284

XhmikosR's avatar
Dist    
XhmikosR committed
5285
      this._setResizeEvent();
Mark Otto's avatar
dist  
Mark Otto committed
5286

XhmikosR's avatar
XhmikosR committed
5287
      EventHandler.off(document, EVENT_FOCUSIN);
XhmikosR's avatar
XhmikosR committed
5288

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

XhmikosR's avatar
XhmikosR committed
5291
5292
      EventHandler.off(this._element, EVENT_CLICK_DISMISS);
      EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
Mark Otto's avatar
dist  
Mark Otto committed
5293

XhmikosR's avatar
Dist    
XhmikosR committed
5294
      if (transition) {
XhmikosR's avatar
XhmikosR committed
5295
5296
        var transitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
5297
          return _this2._hideModal(event);
XhmikosR's avatar
XhmikosR committed
5298
5299
        });
        emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
5300
5301
5302
5303
      } else {
        this._hideModal();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
5304

XhmikosR's avatar
Dist    
XhmikosR committed
5305
5306
    _proto.dispose = function dispose() {
      [window, this._element, this._dialog].forEach(function (htmlElement) {
XhmikosR's avatar
XhmikosR committed
5307
        return EventHandler.off(htmlElement, EVENT_KEY$5);
XhmikosR's avatar
Dist    
XhmikosR committed
5308
5309
      });
      /**
XhmikosR's avatar
XhmikosR committed
5310
       * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
XhmikosR's avatar
Dist    
XhmikosR committed
5311
       * Do not move `document` in `htmlElements` array
XhmikosR's avatar
XhmikosR committed
5312
       * It will remove `EVENT_CLICK_DATA_API` event that should remain
XhmikosR's avatar
Dist    
XhmikosR committed
5313
       */
Mark Otto's avatar
dist  
Mark Otto committed
5314

XhmikosR's avatar
XhmikosR committed
5315
      EventHandler.off(document, EVENT_FOCUSIN);
XhmikosR's avatar
XhmikosR committed
5316
      Data.removeData(this._element, DATA_KEY$5);
XhmikosR's avatar
Dist    
XhmikosR committed
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
      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;
    };
Mark Otto's avatar
dist    
Mark Otto committed
5327

XhmikosR's avatar
Dist    
XhmikosR committed
5328
5329
    _proto.handleUpdate = function handleUpdate() {
      this._adjustDialog();
Mark Otto's avatar
Mark Otto committed
5330
5331
    } // Private
    ;
Mark Otto's avatar
dist  
Mark Otto committed
5332

XhmikosR's avatar
Dist    
XhmikosR committed
5333
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
5334
      config = _extends({}, Default$3, config);
XhmikosR's avatar
XhmikosR committed
5335
      typeCheckConfig(NAME$5, config, DefaultType$3);
XhmikosR's avatar
Dist    
XhmikosR committed
5336
5337
      return config;
    };
Mark Otto's avatar
dist  
Mark Otto committed
5338

XhmikosR's avatar
Dist    
XhmikosR committed
5339
5340
    _proto._showElement = function _showElement(relatedTarget) {
      var _this3 = this;
Mark Otto's avatar
dist  
Mark Otto committed
5341

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
5346
5347
5348
5349
      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
5350

XhmikosR's avatar
Dist    
XhmikosR committed
5351
      this._element.style.display = 'block';
Mark Otto's avatar
dist  
Mark Otto committed
5352

XhmikosR's avatar
Dist    
XhmikosR committed
5353
      this._element.removeAttribute('aria-hidden');
Mark Otto's avatar
dist  
Mark Otto committed
5354

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

Mark Otto's avatar
Mark Otto committed
5357
5358
      this._element.setAttribute('role', 'dialog');

XhmikosR's avatar
XhmikosR committed
5359
5360
5361
      this._element.scrollTop = 0;

      if (modalBody) {
XhmikosR's avatar
XhmikosR committed
5362
        modalBody.scrollTop = 0;
Mark Otto's avatar
Mark Otto committed
5363
      }
Mark Otto's avatar
dist  
Mark Otto committed
5364

XhmikosR's avatar
Dist    
XhmikosR committed
5365
      if (transition) {
XhmikosR's avatar
XhmikosR committed
5366
        reflow(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
5367
      }
Mark Otto's avatar
dist  
Mark Otto committed
5368

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

XhmikosR's avatar
Dist    
XhmikosR committed
5371
5372
5373
      if (this._config.focus) {
        this._enforceFocus();
      }
Mark Otto's avatar
dist    
Mark Otto committed
5374

XhmikosR's avatar
Dist    
XhmikosR committed
5375
5376
5377
      var transitionComplete = function transitionComplete() {
        if (_this3._config.focus) {
          _this3._element.focus();
Mark Otto's avatar
dist    
Mark Otto committed
5378
        }
Mark Otto's avatar
dist  
Mark Otto committed
5379

XhmikosR's avatar
Dist    
XhmikosR committed
5380
        _this3._isTransitioning = false;
XhmikosR's avatar
XhmikosR committed
5381
        EventHandler.trigger(_this3._element, EVENT_SHOWN$2, {
XhmikosR's avatar
XhmikosR committed
5382
5383
          relatedTarget: relatedTarget
        });
XhmikosR's avatar
Dist    
XhmikosR committed
5384
      };
Mark Otto's avatar
dist  
Mark Otto committed
5385

XhmikosR's avatar
Dist    
XhmikosR committed
5386
      if (transition) {
XhmikosR's avatar
XhmikosR committed
5387
5388
5389
        var transitionDuration = getTransitionDurationFromElement(this._dialog);
        EventHandler.one(this._dialog, TRANSITION_END, transitionComplete);
        emulateTransitionEnd(this._dialog, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
5390
5391
5392
5393
      } else {
        transitionComplete();
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
5394

XhmikosR's avatar
Dist    
XhmikosR committed
5395
5396
    _proto._enforceFocus = function _enforceFocus() {
      var _this4 = this;
Mark Otto's avatar
dist  
Mark Otto committed
5397

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

XhmikosR's avatar
XhmikosR committed
5400
      EventHandler.on(document, EVENT_FOCUSIN, function (event) {
XhmikosR's avatar
XhmikosR committed
5401
        if (document !== event.target && _this4._element !== event.target && !_this4._element.contains(event.target)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5402
          _this4._element.focus();
Mark Otto's avatar
dist  
Mark Otto committed
5403
        }
XhmikosR's avatar
Dist    
XhmikosR committed
5404
5405
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
5406

XhmikosR's avatar
Dist    
XhmikosR committed
5407
5408
5409
    _proto._setEscapeEvent = function _setEscapeEvent() {
      var _this5 = this;

XhmikosR's avatar
XhmikosR committed
5410
5411
      if (this._isShown) {
        EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, function (event) {
XhmikosR's avatar
XhmikosR committed
5412
          if (_this5._config.keyboard && event.key === ESCAPE_KEY$1) {
XhmikosR's avatar
XhmikosR committed
5413
5414
5415
            event.preventDefault();

            _this5.hide();
XhmikosR's avatar
XhmikosR committed
5416
          } else if (!_this5._config.keyboard && event.key === ESCAPE_KEY$1) {
XhmikosR's avatar
XhmikosR committed
5417
            _this5._triggerBackdropTransition();
Mark Otto's avatar
dist    
Mark Otto committed
5418
5419
          }
        });
5420
      } else {
XhmikosR's avatar
XhmikosR committed
5421
        EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS);
XhmikosR's avatar
Dist    
XhmikosR committed
5422
5423
5424
5425
5426
      }
    };

    _proto._setResizeEvent = function _setResizeEvent() {
      var _this6 = this;
Mark Otto's avatar
dist  
Mark Otto committed
5427

XhmikosR's avatar
Dist    
XhmikosR committed
5428
      if (this._isShown) {
XhmikosR's avatar
XhmikosR committed
5429
        EventHandler.on(window, EVENT_RESIZE, function () {
5430
          return _this6._adjustDialog();
XhmikosR's avatar
Dist    
XhmikosR committed
5431
5432
        });
      } else {
XhmikosR's avatar
XhmikosR committed
5433
        EventHandler.off(window, EVENT_RESIZE);
XhmikosR's avatar
Dist    
XhmikosR committed
5434
5435
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
5436

XhmikosR's avatar
Dist    
XhmikosR committed
5437
5438
    _proto._hideModal = function _hideModal() {
      var _this7 = this;
Mark Otto's avatar
dist  
Mark Otto committed
5439

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

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

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

Mark Otto's avatar
Mark Otto committed
5446
5447
      this._element.removeAttribute('role');

XhmikosR's avatar
Dist    
XhmikosR committed
5448
      this._isTransitioning = false;
Mark Otto's avatar
dist    
Mark Otto committed
5449

XhmikosR's avatar
Dist    
XhmikosR committed
5450
      this._showBackdrop(function () {
XhmikosR's avatar
XhmikosR committed
5451
        document.body.classList.remove(CLASS_NAME_OPEN);
Mark Otto's avatar
dist  
Mark Otto committed
5452

XhmikosR's avatar
Dist    
XhmikosR committed
5453
        _this7._resetAdjustments();
Mark Otto's avatar
dist  
Mark Otto committed
5454

XhmikosR's avatar
Dist    
XhmikosR committed
5455
        _this7._resetScrollbar();
Mark Otto's avatar
dist  
Mark Otto committed
5456

XhmikosR's avatar
XhmikosR committed
5457
        EventHandler.trigger(_this7._element, EVENT_HIDDEN$2);
XhmikosR's avatar
Dist    
XhmikosR committed
5458
5459
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
5460

XhmikosR's avatar
Dist    
XhmikosR committed
5461
    _proto._removeBackdrop = function _removeBackdrop() {
5462
      this._backdrop.parentNode.removeChild(this._backdrop);
XhmikosR's avatar
XhmikosR committed
5463

5464
      this._backdrop = null;
XhmikosR's avatar
Dist    
XhmikosR committed
5465
    };
Mark Otto's avatar
dist    
Mark Otto committed
5466

XhmikosR's avatar
Dist    
XhmikosR committed
5467
5468
    _proto._showBackdrop = function _showBackdrop(callback) {
      var _this8 = this;
Mark Otto's avatar
dist    
Mark Otto committed
5469

XhmikosR's avatar
XhmikosR committed
5470
      var animate = this._element.classList.contains(CLASS_NAME_FADE) ? CLASS_NAME_FADE : '';
Mark Otto's avatar
dist    
Mark Otto committed
5471

XhmikosR's avatar
Dist    
XhmikosR committed
5472
5473
      if (this._isShown && this._config.backdrop) {
        this._backdrop = document.createElement('div');
XhmikosR's avatar
XhmikosR committed
5474
        this._backdrop.className = CLASS_NAME_BACKDROP;
Mark Otto's avatar
dist    
Mark Otto committed
5475

XhmikosR's avatar
Dist    
XhmikosR committed
5476
5477
        if (animate) {
          this._backdrop.classList.add(animate);
Mark Otto's avatar
dist    
Mark Otto committed
5478
        }
Mark Otto's avatar
dist    
Mark Otto committed
5479

XhmikosR's avatar
XhmikosR committed
5480
        document.body.appendChild(this._backdrop);
XhmikosR's avatar
XhmikosR committed
5481
        EventHandler.on(this._element, EVENT_CLICK_DISMISS, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
5482
5483
5484
5485
          if (_this8._ignoreBackdropClick) {
            _this8._ignoreBackdropClick = false;
            return;
          }
Mark Otto's avatar
dist  
Mark Otto committed
5486

XhmikosR's avatar
Dist    
XhmikosR committed
5487
5488
5489
          if (event.target !== event.currentTarget) {
            return;
          }
Mark Otto's avatar
dist  
Mark Otto committed
5490

XhmikosR's avatar
XhmikosR committed
5491
5492
5493
5494
5495
          if (_this8._config.backdrop === 'static') {
            _this8._triggerBackdropTransition();
          } else {
            _this8.hide();
          }
XhmikosR's avatar
Dist    
XhmikosR committed
5496
        });
Mark Otto's avatar
dist  
Mark Otto committed
5497

XhmikosR's avatar
Dist    
XhmikosR committed
5498
        if (animate) {
XhmikosR's avatar
XhmikosR committed
5499
          reflow(this._backdrop);
XhmikosR's avatar
Dist    
XhmikosR committed
5500
        }
Mark Otto's avatar
dist  
Mark Otto committed
5501

XhmikosR's avatar
XhmikosR committed
5502
        this._backdrop.classList.add(CLASS_NAME_SHOW$2);
Mark Otto's avatar
dist  
Mark Otto committed
5503

XhmikosR's avatar
Dist    
XhmikosR committed
5504
5505
5506
5507
        if (!animate) {
          callback();
          return;
        }
Mark Otto's avatar
dist    
Mark Otto committed
5508

XhmikosR's avatar
XhmikosR committed
5509
5510
5511
        var backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
        EventHandler.one(this._backdrop, TRANSITION_END, callback);
        emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
5512
      } else if (!this._isShown && this._backdrop) {
XhmikosR's avatar
XhmikosR committed
5513
        this._backdrop.classList.remove(CLASS_NAME_SHOW$2);
Mark Otto's avatar
dist    
Mark Otto committed
5514

XhmikosR's avatar
Dist    
XhmikosR committed
5515
5516
        var callbackRemove = function callbackRemove() {
          _this8._removeBackdrop();
Mark Otto's avatar
dist    
Mark Otto committed
5517

5518
          callback();
XhmikosR's avatar
Dist    
XhmikosR committed
5519
        };
Mark Otto's avatar
dist  
Mark Otto committed
5520

XhmikosR's avatar
XhmikosR committed
5521
        if (this._element.classList.contains(CLASS_NAME_FADE)) {
XhmikosR's avatar
XhmikosR committed
5522
          var _backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
Mark Otto's avatar
dist  
Mark Otto committed
5523

XhmikosR's avatar
XhmikosR committed
5524
5525
          EventHandler.one(this._backdrop, TRANSITION_END, callbackRemove);
          emulateTransitionEnd(this._backdrop, _backdropTransitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
5526
5527
5528
        } else {
          callbackRemove();
        }
5529
      } else {
XhmikosR's avatar
Dist    
XhmikosR committed
5530
5531
        callback();
      }
XhmikosR's avatar
XhmikosR committed
5532
5533
5534
5535
5536
    };

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

XhmikosR's avatar
XhmikosR committed
5537
      var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
XhmikosR's avatar
XhmikosR committed
5538

XhmikosR's avatar
XhmikosR committed
5539
5540
5541
      if (hideEvent.defaultPrevented) {
        return;
      }
XhmikosR's avatar
XhmikosR committed
5542

XhmikosR's avatar
XhmikosR committed
5543
      var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
XhmikosR's avatar
XhmikosR committed
5544

XhmikosR's avatar
XhmikosR committed
5545
5546
5547
      if (!isModalOverflowing) {
        this._element.style.overflowY = 'hidden';
      }
XhmikosR's avatar
XhmikosR committed
5548

XhmikosR's avatar
XhmikosR committed
5549
      this._element.classList.add(CLASS_NAME_STATIC);
XhmikosR's avatar
XhmikosR committed
5550

XhmikosR's avatar
XhmikosR committed
5551
5552
5553
5554
      var modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
      EventHandler.off(this._element, TRANSITION_END);
      EventHandler.one(this._element, TRANSITION_END, function () {
        _this9._element.classList.remove(CLASS_NAME_STATIC);
XhmikosR's avatar
XhmikosR committed
5555

XhmikosR's avatar
XhmikosR committed
5556
5557
5558
5559
5560
5561
5562
5563
        if (!isModalOverflowing) {
          EventHandler.one(_this9._element, TRANSITION_END, function () {
            _this9._element.style.overflowY = '';
          });
          emulateTransitionEnd(_this9._element, modalTransitionDuration);
        }
      });
      emulateTransitionEnd(this._element, modalTransitionDuration);
XhmikosR's avatar
XhmikosR committed
5564

XhmikosR's avatar
XhmikosR committed
5565
      this._element.focus();
Mark Otto's avatar
Mark Otto committed
5566
    } // ----------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
5567
5568
    // the following methods are used to handle overflowing modals
    // ----------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
5569
    ;
Mark Otto's avatar
dist  
Mark Otto committed
5570

XhmikosR's avatar
Dist    
XhmikosR committed
5571
5572
    _proto._adjustDialog = function _adjustDialog() {
      var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
Mark Otto's avatar
dist    
Mark Otto committed
5573

XhmikosR's avatar
Dist    
XhmikosR committed
5574
5575
5576
      if (!this._isBodyOverflowing && isModalOverflowing) {
        this._element.style.paddingLeft = this._scrollbarWidth + "px";
      }
Mark Otto's avatar
dist  
Mark Otto committed
5577

XhmikosR's avatar
Dist    
XhmikosR committed
5578
5579
5580
5581
      if (this._isBodyOverflowing && !isModalOverflowing) {
        this._element.style.paddingRight = this._scrollbarWidth + "px";
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
5582

XhmikosR's avatar
Dist    
XhmikosR committed
5583
5584
5585
5586
    _proto._resetAdjustments = function _resetAdjustments() {
      this._element.style.paddingLeft = '';
      this._element.style.paddingRight = '';
    };
Mark Otto's avatar
dist    
Mark Otto committed
5587

XhmikosR's avatar
Dist    
XhmikosR committed
5588
5589
    _proto._checkScrollbar = function _checkScrollbar() {
      var rect = document.body.getBoundingClientRect();
XhmikosR's avatar
XhmikosR committed
5590
      this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
XhmikosR's avatar
Dist    
XhmikosR committed
5591
5592
      this._scrollbarWidth = this._getScrollbarWidth();
    };
Mark Otto's avatar
dist  
Mark Otto committed
5593

XhmikosR's avatar
Dist    
XhmikosR committed
5594
    _proto._setScrollbar = function _setScrollbar() {
XhmikosR's avatar
XhmikosR committed
5595
      var _this10 = this;
XhmikosR's avatar
Dist    
XhmikosR committed
5596
5597
5598
5599

      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
5600
        // Adjust fixed content padding
XhmikosR's avatar
XhmikosR committed
5601
        SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
XhmikosR's avatar
Dist    
XhmikosR committed
5602
          var actualPadding = element.style.paddingRight;
XhmikosR's avatar
XhmikosR committed
5603
5604
          var calculatedPadding = window.getComputedStyle(element)['padding-right'];
          Manipulator.setDataAttribute(element, 'padding-right', actualPadding);
XhmikosR's avatar
XhmikosR committed
5605
          element.style.paddingRight = Number.parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px";
XhmikosR's avatar
Dist    
XhmikosR committed
5606
5607
        }); // Adjust sticky content margin

XhmikosR's avatar
XhmikosR committed
5608
        SelectorEngine.find(SELECTOR_STICKY_CONTENT).forEach(function (element) {
XhmikosR's avatar
Dist    
XhmikosR committed
5609
          var actualMargin = element.style.marginRight;
XhmikosR's avatar
XhmikosR committed
5610
5611
          var calculatedMargin = window.getComputedStyle(element)['margin-right'];
          Manipulator.setDataAttribute(element, 'margin-right', actualMargin);
XhmikosR's avatar
XhmikosR committed
5612
          element.style.marginRight = Number.parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px";
XhmikosR's avatar
Dist    
XhmikosR committed
5613
5614
5615
        }); // Adjust body padding

        var actualPadding = document.body.style.paddingRight;
XhmikosR's avatar
XhmikosR committed
5616
5617
        var calculatedPadding = window.getComputedStyle(document.body)['padding-right'];
        Manipulator.setDataAttribute(document.body, 'padding-right', actualPadding);
XhmikosR's avatar
XhmikosR committed
5618
        document.body.style.paddingRight = Number.parseFloat(calculatedPadding) + this._scrollbarWidth + "px";
XhmikosR's avatar
Dist    
XhmikosR committed
5619
      }
XhmikosR's avatar
Dist    
XhmikosR committed
5620

XhmikosR's avatar
XhmikosR committed
5621
      document.body.classList.add(CLASS_NAME_OPEN);
XhmikosR's avatar
Dist    
XhmikosR committed
5622
    };
Mark Otto's avatar
dist    
Mark Otto committed
5623

XhmikosR's avatar
Dist    
XhmikosR committed
5624
5625
    _proto._resetScrollbar = function _resetScrollbar() {
      // Restore fixed content padding
XhmikosR's avatar
XhmikosR committed
5626
      SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
5627
        var padding = Manipulator.getDataAttribute(element, 'padding-right');
Mark Otto's avatar
dist  
Mark Otto committed
5628

XhmikosR's avatar
XhmikosR committed
5629
5630
5631
5632
5633
5634
        if (typeof padding !== 'undefined') {
          Manipulator.removeDataAttribute(element, 'padding-right');
          element.style.paddingRight = padding;
        }
      }); // Restore sticky content and navbar-toggler margin

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

XhmikosR's avatar
Dist    
XhmikosR committed
5638
        if (typeof margin !== 'undefined') {
XhmikosR's avatar
XhmikosR committed
5639
5640
          Manipulator.removeDataAttribute(element, 'margin-right');
          element.style.marginRight = margin;
Mark Otto's avatar
dist    
Mark Otto committed
5641
        }
XhmikosR's avatar
Dist    
XhmikosR committed
5642
      }); // Restore body padding
Mark Otto's avatar
dist  
Mark Otto committed
5643

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

XhmikosR's avatar
Dist.    
XhmikosR committed
5646
5647
5648
      if (typeof padding === 'undefined') {
        document.body.style.paddingRight = '';
      } else {
XhmikosR's avatar
XhmikosR committed
5649
5650
5651
        Manipulator.removeDataAttribute(document.body, 'padding-right');
        document.body.style.paddingRight = padding;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
5652
    };
Mark Otto's avatar
dist  
Mark Otto committed
5653

XhmikosR's avatar
Dist    
XhmikosR committed
5654
5655
5656
    _proto._getScrollbarWidth = function _getScrollbarWidth() {
      // thx d.walsh
      var scrollDiv = document.createElement('div');
XhmikosR's avatar
XhmikosR committed
5657
      scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
XhmikosR's avatar
Dist    
XhmikosR committed
5658
5659
5660
5661
      document.body.appendChild(scrollDiv);
      var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
      document.body.removeChild(scrollDiv);
      return scrollbarWidth;
Mark Otto's avatar
Mark Otto committed
5662
5663
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
5664

XhmikosR's avatar
XhmikosR committed
5665
    Modal.jQueryInterface = function jQueryInterface(config, relatedTarget) {
XhmikosR's avatar
Dist    
XhmikosR committed
5666
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
5667
        var data = Data.getData(this, DATA_KEY$5);
Mark Otto's avatar
dist  
Mark Otto committed
5668

XhmikosR's avatar
XhmikosR committed
5669
        var _config = _extends({}, Default$3, Manipulator.getDataAttributes(this), typeof config === 'object' && config ? config : {});
Mark Otto's avatar
dist  
Mark Otto committed
5670

XhmikosR's avatar
Dist    
XhmikosR committed
5671
5672
5673
        if (!data) {
          data = new Modal(this, _config);
        }
Mark Otto's avatar
dist    
Mark Otto committed
5674

XhmikosR's avatar
Dist    
XhmikosR committed
5675
5676
5677
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
5678
          }
Mark Otto's avatar
dist  
Mark Otto committed
5679

XhmikosR's avatar
Dist    
XhmikosR committed
5680
5681
5682
5683
5684
5685
          data[config](relatedTarget);
        } else if (_config.show) {
          data.show(relatedTarget);
        }
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
5686

XhmikosR's avatar
XhmikosR committed
5687
    Modal.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
5688
5689
5690
      return Data.getData(element, DATA_KEY$5);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
    _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
5702

XhmikosR's avatar
Dist    
XhmikosR committed
5703
5704
5705
5706
5707
5708
5709
    return Modal;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
5710

Mark Otto's avatar
dist    
Mark Otto committed
5711

XhmikosR's avatar
XhmikosR committed
5712
  EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, function (event) {
XhmikosR's avatar
XhmikosR committed
5713
    var _this11 = this;
Mark Otto's avatar
dist  
Mark Otto committed
5714

XhmikosR's avatar
XhmikosR committed
5715
    var target = getElementFromSelector(this);
Mark Otto's avatar
dist  
Mark Otto committed
5716

XhmikosR's avatar
Dist    
XhmikosR committed
5717
5718
5719
    if (this.tagName === 'A' || this.tagName === 'AREA') {
      event.preventDefault();
    }
Mark Otto's avatar
dist  
Mark Otto committed
5720

XhmikosR's avatar
XhmikosR committed
5721
    EventHandler.one(target, EVENT_SHOW$2, function (showEvent) {
XhmikosR's avatar
XhmikosR committed
5722
5723
      if (showEvent.defaultPrevented) {
        // only register focus restorer if modal will actually get shown
XhmikosR's avatar
Dist    
XhmikosR committed
5724
        return;
Mark Otto's avatar
dist  
Mark Otto committed
5725
5726
      }

XhmikosR's avatar
XhmikosR committed
5727
      EventHandler.one(target, EVENT_HIDDEN$2, function () {
XhmikosR's avatar
XhmikosR committed
5728
5729
        if (isVisible(_this11)) {
          _this11.focus();
Mark Otto's avatar
dist  
Mark Otto committed
5730
        }
Mark Otto's avatar
dist    
Mark Otto committed
5731
5732
      });
    });
XhmikosR's avatar
XhmikosR committed
5733
5734
5735
    var data = Data.getData(target, DATA_KEY$5);

    if (!data) {
XhmikosR's avatar
XhmikosR committed
5736
      var config = _extends({}, Manipulator.getDataAttributes(target), Manipulator.getDataAttributes(this));
5737

XhmikosR's avatar
XhmikosR committed
5738
5739
      data = new Modal(target, config);
    }
Mark Otto's avatar
dist    
Mark Otto committed
5740

XhmikosR's avatar
XhmikosR committed
5741
    data.show(this);
XhmikosR's avatar
Dist    
XhmikosR committed
5742
5743
5744
5745
5746
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
5747
   * add .Modal to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
5748
   */
Mark Otto's avatar
dist  
Mark Otto committed
5749

XhmikosR's avatar
XhmikosR committed
5750
5751
5752
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
5753

XhmikosR's avatar
XhmikosR committed
5754
5755
5756
5757
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$5];
      $.fn[NAME$5] = Modal.jQueryInterface;
      $.fn[NAME$5].Constructor = Modal;
Mark Otto's avatar
dist  
Mark Otto committed
5758

XhmikosR's avatar
XhmikosR committed
5759
5760
5761
5762
5763
5764
      $.fn[NAME$5].noConflict = function () {
        $.fn[NAME$5] = JQUERY_NO_CONFLICT;
        return Modal.jQueryInterface;
      };
    }
  });
Mark Otto's avatar
dist  
Mark Otto committed
5765

XhmikosR's avatar
XhmikosR committed
5766
5767
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
5768
   * Bootstrap (v5.0.0-alpha3): util/sanitizer.js
XhmikosR's avatar
XhmikosR committed
5769
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
XhmikosR committed
5770
5771
   * --------------------------------------------------------------------------
   */
XhmikosR's avatar
XhmikosR committed
5772
  var uriAttrs = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
XhmikosR's avatar
XhmikosR committed
5773
  var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
XhmikosR's avatar
XhmikosR committed
5774
5775
5776
5777
5778
5779
  /**
   * 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
5780
  var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
XhmikosR's avatar
XhmikosR committed
5781
5782
5783
5784
5785
5786
  /**
   * 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
5787
  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
5788
5789
5790
5791

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

XhmikosR's avatar
XhmikosR committed
5792
5793
    if (allowedAttributeList.includes(attrName)) {
      if (uriAttrs.has(attrName)) {
Mark Otto's avatar
Mark Otto committed
5794
        return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
XhmikosR's avatar
XhmikosR committed
5795
5796
5797
5798
5799
5800
5801
5802
5803
      }

      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
5804
    for (var i = 0, len = regExp.length; i < len; i++) {
Mark Otto's avatar
Mark Otto committed
5805
      if (attrName.match(regExp[i])) {
XhmikosR's avatar
XhmikosR committed
5806
5807
5808
5809
5810
5811
5812
        return true;
      }
    }

    return false;
  };

XhmikosR's avatar
XhmikosR committed
5813
  var DefaultAllowlist = {
XhmikosR's avatar
XhmikosR committed
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
    // 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
5832
    img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
XhmikosR's avatar
XhmikosR committed
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
    li: [],
    ol: [],
    p: [],
    pre: [],
    s: [],
    small: [],
    span: [],
    sub: [],
    sup: [],
    strong: [],
    u: [],
    ul: []
  };
XhmikosR's avatar
XhmikosR committed
5846
  function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
XhmikosR's avatar
XhmikosR committed
5847
5848
    var _ref;

XhmikosR's avatar
XhmikosR committed
5849
    if (!unsafeHtml.length) {
XhmikosR's avatar
XhmikosR committed
5850
5851
5852
5853
5854
5855
5856
5857
5858
      return unsafeHtml;
    }

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

    var domParser = new window.DOMParser();
    var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
XhmikosR's avatar
XhmikosR committed
5859
    var allowlistKeys = Object.keys(allowList);
XhmikosR's avatar
XhmikosR committed
5860
5861

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

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

XhmikosR's avatar
XhmikosR committed
5866
5867
5868
      var el = elements[i];
      var elName = el.nodeName.toLowerCase();

XhmikosR's avatar
XhmikosR committed
5869
      if (!allowlistKeys.includes(elName)) {
XhmikosR's avatar
XhmikosR committed
5870
5871
5872
5873
        el.parentNode.removeChild(el);
        return "continue";
      }

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

XhmikosR's avatar
XhmikosR committed
5876
      var allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []);
XhmikosR's avatar
XhmikosR committed
5877
      attributeList.forEach(function (attr) {
XhmikosR's avatar
XhmikosR committed
5878
        if (!allowedAttribute(attr, allowedAttributes)) {
XhmikosR's avatar
XhmikosR committed
5879
5880
5881
5882
5883
5884
          el.removeAttribute(attr.nodeName);
        }
      });
    };

    for (var i = 0, len = elements.length; i < len; i++) {
5885
      var _ret = _loop(i);
XhmikosR's avatar
XhmikosR committed
5886
5887
5888
5889
5890
5891
5892

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

    return createdDocument.body.innerHTML;
  }

XhmikosR's avatar
Dist    
XhmikosR committed
5893
5894
5895
5896
5897
5898
5899
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$6 = 'tooltip';
XhmikosR's avatar
XhmikosR committed
5900
  var VERSION$6 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
5901
5902
5903
5904
  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
5905
  var DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
XhmikosR's avatar
Dist    
XhmikosR committed
5906
5907
5908
5909
5910
5911
5912
5913
5914
  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
5915
    offset: '(number|string|function)',
XhmikosR's avatar
Dist    
XhmikosR committed
5916
5917
    container: '(string|element|boolean)',
    fallbackPlacement: '(string|array)',
XhmikosR's avatar
XhmikosR committed
5918
5919
5920
    boundary: '(string|element)',
    sanitize: 'boolean',
    sanitizeFn: '(null|function)',
XhmikosR's avatar
XhmikosR committed
5921
    allowList: 'object',
XhmikosR's avatar
XhmikosR committed
5922
    popperConfig: '(null|object)'
XhmikosR's avatar
Dist    
XhmikosR committed
5923
  };
XhmikosR's avatar
XhmikosR committed
5924
  var AttachmentMap = {
XhmikosR's avatar
Dist    
XhmikosR committed
5925
5926
5927
5928
5929
5930
5931
5932
    AUTO: 'auto',
    TOP: 'top',
    RIGHT: 'right',
    BOTTOM: 'bottom',
    LEFT: 'left'
  };
  var Default$4 = {
    animation: true,
XhmikosR's avatar
XhmikosR committed
5933
    template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>',
XhmikosR's avatar
Dist    
XhmikosR committed
5934
5935
5936
5937
5938
5939
5940
5941
5942
    trigger: 'hover focus',
    title: '',
    delay: 0,
    html: false,
    selector: false,
    placement: 'top',
    offset: 0,
    container: false,
    fallbackPlacement: 'flip',
XhmikosR's avatar
XhmikosR committed
5943
5944
5945
    boundary: 'scrollParent',
    sanitize: true,
    sanitizeFn: null,
XhmikosR's avatar
XhmikosR committed
5946
    allowList: DefaultAllowlist,
XhmikosR's avatar
XhmikosR committed
5947
    popperConfig: null
XhmikosR's avatar
Dist    
XhmikosR committed
5948
  };
XhmikosR's avatar
XhmikosR committed
5949
  var Event$1 = {
XhmikosR's avatar
Dist    
XhmikosR committed
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
    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
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
  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
5971
5972
5973
5974
5975
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist    
XhmikosR committed
5976

XhmikosR's avatar
XhmikosR committed
5977
  var Tooltip = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
5978
5979
    function Tooltip(element, config) {
      if (typeof Popper === 'undefined') {
XhmikosR's avatar
XhmikosR committed
5980
        throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
XhmikosR's avatar
Dist    
XhmikosR committed
5981
      } // private
Mark Otto's avatar
dist    
Mark Otto committed
5982
5983


XhmikosR's avatar
Dist    
XhmikosR committed
5984
5985
5986
5987
5988
      this._isEnabled = true;
      this._timeout = 0;
      this._hoverState = '';
      this._activeTrigger = {};
      this._popper = null; // Protected
Mark Otto's avatar
dist  
Mark Otto committed
5989

XhmikosR's avatar
Dist    
XhmikosR committed
5990
5991
5992
      this.element = element;
      this.config = this._getConfig(config);
      this.tip = null;
Mark Otto's avatar
dist  
Mark Otto committed
5993

XhmikosR's avatar
Dist    
XhmikosR committed
5994
      this._setListeners();
XhmikosR's avatar
XhmikosR committed
5995
5996

      Data.setData(element, this.constructor.DATA_KEY, this);
XhmikosR's avatar
Dist    
XhmikosR committed
5997
    } // Getters
Mark Otto's avatar
dist  
Mark Otto committed
5998
5999


XhmikosR's avatar
Dist    
XhmikosR committed
6000
    var _proto = Tooltip.prototype;
Mark Otto's avatar
dist  
Mark Otto committed
6001

XhmikosR's avatar
Dist    
XhmikosR committed
6002
6003
6004
6005
    // Public
    _proto.enable = function enable() {
      this._isEnabled = true;
    };
Mark Otto's avatar
dist  
Mark Otto committed
6006

XhmikosR's avatar
Dist    
XhmikosR committed
6007
6008
6009
    _proto.disable = function disable() {
      this._isEnabled = false;
    };
Mark Otto's avatar
dist  
Mark Otto committed
6010

XhmikosR's avatar
Dist    
XhmikosR committed
6011
6012
6013
    _proto.toggleEnabled = function toggleEnabled() {
      this._isEnabled = !this._isEnabled;
    };
Mark Otto's avatar
dist  
Mark Otto committed
6014

XhmikosR's avatar
Dist    
XhmikosR committed
6015
6016
6017
6018
    _proto.toggle = function toggle(event) {
      if (!this._isEnabled) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
6019

XhmikosR's avatar
Dist    
XhmikosR committed
6020
6021
      if (event) {
        var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
6022
        var context = Data.getData(event.delegateTarget, dataKey);
Mark Otto's avatar
dist  
Mark Otto committed
6023

XhmikosR's avatar
Dist    
XhmikosR committed
6024
        if (!context) {
XhmikosR's avatar
XhmikosR committed
6025
6026
          context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
          Data.setData(event.delegateTarget, dataKey, context);
Mark Otto's avatar
dist  
Mark Otto committed
6027
6028
        }

XhmikosR's avatar
Dist    
XhmikosR committed
6029
        context._activeTrigger.click = !context._activeTrigger.click;
Mark Otto's avatar
dist    
Mark Otto committed
6030

XhmikosR's avatar
Dist    
XhmikosR committed
6031
6032
        if (context._isWithActiveTrigger()) {
          context._enter(null, context);
Mark Otto's avatar
dist  
Mark Otto committed
6033
        } else {
XhmikosR's avatar
Dist    
XhmikosR committed
6034
6035
6036
          context._leave(null, context);
        }
      } else {
XhmikosR's avatar
XhmikosR committed
6037
        if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) {
XhmikosR's avatar
Dist    
XhmikosR committed
6038
          this._leave(null, this);
Mark Otto's avatar
dist  
Mark Otto committed
6039

XhmikosR's avatar
Dist    
XhmikosR committed
6040
          return;
Mark Otto's avatar
dist    
Mark Otto committed
6041
        }
Mark Otto's avatar
dist  
Mark Otto committed
6042

XhmikosR's avatar
Dist    
XhmikosR committed
6043
6044
6045
        this._enter(null, this);
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
6046

XhmikosR's avatar
Dist    
XhmikosR committed
6047
6048
    _proto.dispose = function dispose() {
      clearTimeout(this._timeout);
XhmikosR's avatar
XhmikosR committed
6049
6050
      Data.removeData(this.element, this.constructor.DATA_KEY);
      EventHandler.off(this.element, this.constructor.EVENT_KEY);
XhmikosR's avatar
XhmikosR committed
6051
      EventHandler.off(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
Mark Otto's avatar
dist  
Mark Otto committed
6052

XhmikosR's avatar
Dist    
XhmikosR committed
6053
      if (this.tip) {
XhmikosR's avatar
XhmikosR committed
6054
        this.tip.parentNode.removeChild(this.tip);
XhmikosR's avatar
Dist    
XhmikosR committed
6055
      }
Mark Otto's avatar
dist    
Mark Otto committed
6056

XhmikosR's avatar
Dist    
XhmikosR committed
6057
6058
6059
6060
      this._isEnabled = null;
      this._timeout = null;
      this._hoverState = null;
      this._activeTrigger = null;
Mark Otto's avatar
dist  
Mark Otto committed
6061

XhmikosR's avatar
XhmikosR committed
6062
      if (this._popper) {
XhmikosR's avatar
Dist    
XhmikosR committed
6063
6064
        this._popper.destroy();
      }
Mark Otto's avatar
dist  
Mark Otto committed
6065

XhmikosR's avatar
Dist    
XhmikosR committed
6066
6067
6068
6069
6070
      this._popper = null;
      this.element = null;
      this.config = null;
      this.tip = null;
    };
Mark Otto's avatar
dist  
Mark Otto committed
6071

XhmikosR's avatar
Dist    
XhmikosR committed
6072
6073
    _proto.show = function show() {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
6074

XhmikosR's avatar
XhmikosR committed
6075
      if (this.element.style.display === 'none') {
XhmikosR's avatar
Dist    
XhmikosR committed
6076
6077
        throw new Error('Please use show on visible elements');
      }
Mark Otto's avatar
dist    
Mark Otto committed
6078

XhmikosR's avatar
Dist    
XhmikosR committed
6079
      if (this.isWithContent() && this._isEnabled) {
XhmikosR's avatar
XhmikosR committed
6080
6081
        var showEvent = EventHandler.trigger(this.element, this.constructor.Event.SHOW);
        var shadowRoot = findShadowRoot(this.element);
XhmikosR's avatar
Dist.    
XhmikosR committed
6082
        var isInTheDom = shadowRoot === null ? this.element.ownerDocument.documentElement.contains(this.element) : shadowRoot.contains(this.element);
Mark Otto's avatar
dist  
Mark Otto committed
6083

XhmikosR's avatar
XhmikosR committed
6084
        if (showEvent.defaultPrevented || !isInTheDom) {
XhmikosR's avatar
Dist    
XhmikosR committed
6085
6086
          return;
        }
Mark Otto's avatar
dist  
Mark Otto committed
6087

XhmikosR's avatar
Dist    
XhmikosR committed
6088
        var tip = this.getTipElement();
XhmikosR's avatar
XhmikosR committed
6089
        var tipId = getUID(this.constructor.NAME);
XhmikosR's avatar
Dist    
XhmikosR committed
6090
6091
6092
        tip.setAttribute('id', tipId);
        this.element.setAttribute('aria-describedby', tipId);
        this.setContent();
Mark Otto's avatar
dist  
Mark Otto committed
6093

XhmikosR's avatar
Dist    
XhmikosR committed
6094
        if (this.config.animation) {
XhmikosR's avatar
XhmikosR committed
6095
          tip.classList.add(CLASS_NAME_FADE$1);
XhmikosR's avatar
Dist    
XhmikosR committed
6096
        }
Mark Otto's avatar
dist  
Mark Otto committed
6097

XhmikosR's avatar
Dist    
XhmikosR committed
6098
        var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
Mark Otto's avatar
dist  
Mark Otto committed
6099

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

6102
        this._addAttachmentClass(attachment);
Mark Otto's avatar
dist    
Mark Otto committed
6103
6104
6105

        var container = this._getContainer();

XhmikosR's avatar
XhmikosR committed
6106
        Data.setData(tip, this.constructor.DATA_KEY, this);
Mark Otto's avatar
dist  
Mark Otto committed
6107

XhmikosR's avatar
XhmikosR committed
6108
6109
        if (!this.element.ownerDocument.documentElement.contains(this.tip)) {
          container.appendChild(tip);
XhmikosR's avatar
Dist    
XhmikosR committed
6110
6111
        }

XhmikosR's avatar
XhmikosR committed
6112
        EventHandler.trigger(this.element, this.constructor.Event.INSERTED);
XhmikosR's avatar
XhmikosR committed
6113
        this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
XhmikosR's avatar
XhmikosR committed
6114
        tip.classList.add(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we add extra
XhmikosR's avatar
Dist    
XhmikosR committed
6115
6116
6117
        // 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
6118

XhmikosR's avatar
Dist    
XhmikosR committed
6119
        if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
6120
6121
6122
          var _ref;

          (_ref = []).concat.apply(_ref, document.body.children).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
6123
6124
            EventHandler.on(element, 'mouseover', noop());
          });
XhmikosR's avatar
Dist    
XhmikosR committed
6125
        }
Mark Otto's avatar
dist  
Mark Otto committed
6126

XhmikosR's avatar
Dist    
XhmikosR committed
6127
6128
6129
6130
        var complete = function complete() {
          if (_this.config.animation) {
            _this._fixTransition();
          }
Mark Otto's avatar
dist    
Mark Otto committed
6131

XhmikosR's avatar
Dist    
XhmikosR committed
6132
6133
          var prevHoverState = _this._hoverState;
          _this._hoverState = null;
XhmikosR's avatar
XhmikosR committed
6134
          EventHandler.trigger(_this.element, _this.constructor.Event.SHOWN);
Mark Otto's avatar
dist  
Mark Otto committed
6135

XhmikosR's avatar
XhmikosR committed
6136
          if (prevHoverState === HOVER_STATE_OUT) {
XhmikosR's avatar
Dist    
XhmikosR committed
6137
            _this._leave(null, _this);
Mark Otto's avatar
dist  
Mark Otto committed
6138
          }
XhmikosR's avatar
Dist    
XhmikosR committed
6139
6140
        };

XhmikosR's avatar
XhmikosR committed
6141
        if (this.tip.classList.contains(CLASS_NAME_FADE$1)) {
XhmikosR's avatar
XhmikosR committed
6142
6143
6144
          var transitionDuration = getTransitionDurationFromElement(this.tip);
          EventHandler.one(this.tip, TRANSITION_END, complete);
          emulateTransitionEnd(this.tip, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
6145
6146
        } else {
          complete();
Mark Otto's avatar
dist  
Mark Otto committed
6147
        }
XhmikosR's avatar
Dist    
XhmikosR committed
6148
6149
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
6150

6151
    _proto.hide = function hide() {
XhmikosR's avatar
Dist    
XhmikosR committed
6152
      var _this2 = this;
Mark Otto's avatar
dist  
Mark Otto committed
6153

XhmikosR's avatar
XhmikosR committed
6154
6155
6156
6157
      if (!this._popper) {
        return;
      }

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

XhmikosR's avatar
Dist    
XhmikosR committed
6160
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
6161
        if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
XhmikosR's avatar
Dist    
XhmikosR committed
6162
6163
          tip.parentNode.removeChild(tip);
        }
Mark Otto's avatar
dist  
Mark Otto committed
6164

XhmikosR's avatar
Dist    
XhmikosR committed
6165
        _this2._cleanTipClass();
Mark Otto's avatar
dist    
Mark Otto committed
6166

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

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

6171
        _this2._popper.destroy();
XhmikosR's avatar
Dist    
XhmikosR committed
6172
      };
Mark Otto's avatar
dist  
Mark Otto committed
6173

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

XhmikosR's avatar
XhmikosR committed
6176
      if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
6177
6178
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
6179

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

XhmikosR's avatar
Dist    
XhmikosR committed
6183
      if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
6184
6185
6186
        var _ref2;

        (_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
6187
6188
          return EventHandler.off(element, 'mouseover', noop);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
6189
      }
Mark Otto's avatar
dist  
Mark Otto committed
6190

XhmikosR's avatar
XhmikosR committed
6191
6192
6193
      this._activeTrigger[TRIGGER_CLICK] = false;
      this._activeTrigger[TRIGGER_FOCUS] = false;
      this._activeTrigger[TRIGGER_HOVER] = false;
Mark Otto's avatar
dist  
Mark Otto committed
6194

XhmikosR's avatar
XhmikosR committed
6195
      if (this.tip.classList.contains(CLASS_NAME_FADE$1)) {
XhmikosR's avatar
XhmikosR committed
6196
6197
6198
        var transitionDuration = getTransitionDurationFromElement(tip);
        EventHandler.one(tip, TRANSITION_END, complete);
        emulateTransitionEnd(tip, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
6199
6200
6201
      } else {
        complete();
      }
Mark Otto's avatar
dist  
Mark Otto committed
6202

XhmikosR's avatar
Dist    
XhmikosR committed
6203
6204
      this._hoverState = '';
    };
Mark Otto's avatar
dist  
Mark Otto committed
6205

XhmikosR's avatar
Dist    
XhmikosR committed
6206
6207
6208
6209
    _proto.update = function update() {
      if (this._popper !== null) {
        this._popper.scheduleUpdate();
      }
Mark Otto's avatar
Mark Otto committed
6210
6211
    } // Protected
    ;
Mark Otto's avatar
dist  
Mark Otto committed
6212

XhmikosR's avatar
Dist    
XhmikosR committed
6213
6214
6215
    _proto.isWithContent = function isWithContent() {
      return Boolean(this.getTitle());
    };
Mark Otto's avatar
dist  
Mark Otto committed
6216

XhmikosR's avatar
Dist    
XhmikosR committed
6217
    _proto.getTipElement = function getTipElement() {
XhmikosR's avatar
XhmikosR committed
6218
6219
6220
6221
6222
6223
6224
      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
6225
6226
      return this.tip;
    };
Mark Otto's avatar
dist  
Mark Otto committed
6227

XhmikosR's avatar
Dist    
XhmikosR committed
6228
6229
    _proto.setContent = function setContent() {
      var tip = this.getTipElement();
XhmikosR's avatar
XhmikosR committed
6230
      this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
XhmikosR's avatar
XhmikosR committed
6231
      tip.classList.remove(CLASS_NAME_FADE$1, CLASS_NAME_SHOW$3);
XhmikosR's avatar
Dist    
XhmikosR committed
6232
    };
Mark Otto's avatar
dist  
Mark Otto committed
6233

XhmikosR's avatar
XhmikosR committed
6234
6235
6236
6237
6238
    _proto.setElementContent = function setElementContent(element, content) {
      if (element === null) {
        return;
      }

6239
      if (typeof content === 'object' && isElement(content)) {
XhmikosR's avatar
XhmikosR committed
6240
6241
6242
6243
6244
        if (content.jquery) {
          content = content[0];
        } // content is a DOM node or a jQuery


XhmikosR's avatar
XhmikosR committed
6245
        if (this.config.html) {
XhmikosR's avatar
XhmikosR committed
6246
6247
6248
          if (content.parentNode !== element) {
            element.innerHTML = '';
            element.appendChild(content);
Mark Otto's avatar
dist  
Mark Otto committed
6249
6250
          }
        } else {
XhmikosR's avatar
XhmikosR committed
6251
          element.textContent = content.textContent;
Mark Otto's avatar
dist  
Mark Otto committed
6252
        }
XhmikosR's avatar
XhmikosR committed
6253
6254
6255
6256
6257
6258

        return;
      }

      if (this.config.html) {
        if (this.config.sanitize) {
XhmikosR's avatar
XhmikosR committed
6259
          content = sanitizeHtml(content, this.config.allowList, this.config.sanitizeFn);
XhmikosR's avatar
XhmikosR committed
6260
6261
        }

XhmikosR's avatar
XhmikosR committed
6262
        element.innerHTML = content;
XhmikosR's avatar
Dist    
XhmikosR committed
6263
      } else {
XhmikosR's avatar
XhmikosR committed
6264
        element.textContent = content;
XhmikosR's avatar
Dist    
XhmikosR committed
6265
6266
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
6267

XhmikosR's avatar
Dist    
XhmikosR committed
6268
    _proto.getTitle = function getTitle() {
XhmikosR's avatar
XhmikosR committed
6269
      var title = this.element.getAttribute('data-bs-original-title');
Mark Otto's avatar
dist  
Mark Otto committed
6270

XhmikosR's avatar
Dist    
XhmikosR committed
6271
6272
6273
      if (!title) {
        title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
      }
Mark Otto's avatar
dist  
Mark Otto committed
6274

XhmikosR's avatar
Dist    
XhmikosR committed
6275
      return title;
Mark Otto's avatar
Mark Otto committed
6276
6277
    } // Private
    ;
Mark Otto's avatar
dist  
Mark Otto committed
6278

XhmikosR's avatar
XhmikosR committed
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
    _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
6305
      return _extends({}, defaultBsConfig, this.config.popperConfig);
XhmikosR's avatar
XhmikosR committed
6306
6307
    };

6308
6309
6310
6311
    _proto._addAttachmentClass = function _addAttachmentClass(attachment) {
      this.getTipElement().classList.add(CLASS_PREFIX + "-" + attachment);
    };

Mark Otto's avatar
Mark Otto committed
6312
    _proto._getOffset = function _getOffset() {
XhmikosR's avatar
XhmikosR committed
6313
      var _this4 = this;
Mark Otto's avatar
Mark Otto committed
6314
6315
6316
6317
6318

      var offset = {};

      if (typeof this.config.offset === 'function') {
        offset.fn = function (data) {
XhmikosR's avatar
XhmikosR committed
6319
          data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {});
Mark Otto's avatar
Mark Otto committed
6320
6321
6322
6323
6324
6325
6326
6327
6328
          return data;
        };
      } else {
        offset.offset = this.config.offset;
      }

      return offset;
    };

Mark Otto's avatar
dist    
Mark Otto committed
6329
6330
6331
6332
6333
    _proto._getContainer = function _getContainer() {
      if (this.config.container === false) {
        return document.body;
      }

XhmikosR's avatar
XhmikosR committed
6334
6335
      if (isElement(this.config.container)) {
        return this.config.container;
Mark Otto's avatar
dist    
Mark Otto committed
6336
6337
      }

XhmikosR's avatar
XhmikosR committed
6338
      return SelectorEngine.findOne(this.config.container);
Mark Otto's avatar
dist    
Mark Otto committed
6339
6340
    };

XhmikosR's avatar
Dist    
XhmikosR committed
6341
    _proto._getAttachment = function _getAttachment(placement) {
XhmikosR's avatar
XhmikosR committed
6342
      return AttachmentMap[placement.toUpperCase()];
XhmikosR's avatar
Dist    
XhmikosR committed
6343
    };
Mark Otto's avatar
dist    
Mark Otto committed
6344

XhmikosR's avatar
Dist    
XhmikosR committed
6345
    _proto._setListeners = function _setListeners() {
XhmikosR's avatar
XhmikosR committed
6346
      var _this5 = this;
Mark Otto's avatar
dist  
Mark Otto committed
6347

XhmikosR's avatar
Dist    
XhmikosR committed
6348
6349
6350
      var triggers = this.config.trigger.split(' ');
      triggers.forEach(function (trigger) {
        if (trigger === 'click') {
XhmikosR's avatar
XhmikosR committed
6351
6352
          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
6353
          });
XhmikosR's avatar
XhmikosR committed
6354
6355
6356
        } 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
6357
6358
          EventHandler.on(_this5.element, eventIn, _this5.config.selector, function (event) {
            return _this5._enter(event);
XhmikosR's avatar
XhmikosR committed
6359
          });
XhmikosR's avatar
XhmikosR committed
6360
6361
          EventHandler.on(_this5.element, eventOut, _this5.config.selector, function (event) {
            return _this5._leave(event);
Mark Otto's avatar
dist  
Mark Otto committed
6362
6363
          });
        }
XhmikosR's avatar
Dist    
XhmikosR committed
6364
      });
Mark Otto's avatar
dist v5    
Mark Otto committed
6365
6366

      this._hideModalHandler = function () {
XhmikosR's avatar
XhmikosR committed
6367
6368
        if (_this5.element) {
          _this5.hide();
XhmikosR's avatar
Dist    
XhmikosR committed
6369
        }
Mark Otto's avatar
dist v5    
Mark Otto committed
6370
6371
      };

XhmikosR's avatar
XhmikosR committed
6372
      EventHandler.on(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
Mark Otto's avatar
dist  
Mark Otto committed
6373

XhmikosR's avatar
Dist    
XhmikosR committed
6374
      if (this.config.selector) {
XhmikosR's avatar
XhmikosR committed
6375
        this.config = _extends({}, this.config, {
XhmikosR's avatar
Dist    
XhmikosR committed
6376
6377
6378
6379
6380
6381
6382
          trigger: 'manual',
          selector: ''
        });
      } else {
        this._fixTitle();
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
6383

XhmikosR's avatar
Dist    
XhmikosR committed
6384
    _proto._fixTitle = function _fixTitle() {
XhmikosR's avatar
XhmikosR committed
6385
6386
      var title = this.element.getAttribute('title');
      var originalTitleType = typeof this.element.getAttribute('data-bs-original-title');
Mark Otto's avatar
dist    
Mark Otto committed
6387

XhmikosR's avatar
XhmikosR committed
6388
6389
      if (title || originalTitleType !== 'string') {
        this.element.setAttribute('data-bs-original-title', title || '');
XhmikosR's avatar
Dist    
XhmikosR committed
6390
6391
6392
        this.element.setAttribute('title', '');
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
6393

XhmikosR's avatar
Dist    
XhmikosR committed
6394
6395
    _proto._enter = function _enter(event, context) {
      var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
6396
      context = context || Data.getData(event.delegateTarget, dataKey);
Mark Otto's avatar
dist  
Mark Otto committed
6397

XhmikosR's avatar
Dist    
XhmikosR committed
6398
      if (!context) {
XhmikosR's avatar
XhmikosR committed
6399
6400
        context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
        Data.setData(event.delegateTarget, dataKey, context);
XhmikosR's avatar
Dist    
XhmikosR committed
6401
      }
Mark Otto's avatar
dist  
Mark Otto committed
6402

XhmikosR's avatar
Dist    
XhmikosR committed
6403
      if (event) {
XhmikosR's avatar
XhmikosR committed
6404
        context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
XhmikosR's avatar
Dist    
XhmikosR committed
6405
      }
Mark Otto's avatar
dist  
Mark Otto committed
6406

XhmikosR's avatar
XhmikosR committed
6407
6408
      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
6409
6410
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
6411

XhmikosR's avatar
Dist    
XhmikosR committed
6412
      clearTimeout(context._timeout);
XhmikosR's avatar
XhmikosR committed
6413
      context._hoverState = HOVER_STATE_SHOW;
XhmikosR's avatar
Dist    
XhmikosR committed
6414
6415
6416
6417
6418
6419
6420

      if (!context.config.delay || !context.config.delay.show) {
        context.show();
        return;
      }

      context._timeout = setTimeout(function () {
XhmikosR's avatar
XhmikosR committed
6421
        if (context._hoverState === HOVER_STATE_SHOW) {
Mark Otto's avatar
dist  
Mark Otto committed
6422
6423
          context.show();
        }
XhmikosR's avatar
Dist    
XhmikosR committed
6424
6425
      }, context.config.delay.show);
    };
Mark Otto's avatar
dist  
Mark Otto committed
6426

XhmikosR's avatar
Dist    
XhmikosR committed
6427
6428
    _proto._leave = function _leave(event, context) {
      var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
6429
      context = context || Data.getData(event.delegateTarget, dataKey);
Mark Otto's avatar
dist  
Mark Otto committed
6430

XhmikosR's avatar
Dist    
XhmikosR committed
6431
      if (!context) {
XhmikosR's avatar
XhmikosR committed
6432
6433
        context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
        Data.setData(event.delegateTarget, dataKey, context);
XhmikosR's avatar
Dist    
XhmikosR committed
6434
      }
Mark Otto's avatar
dist  
Mark Otto committed
6435

XhmikosR's avatar
Dist    
XhmikosR committed
6436
      if (event) {
XhmikosR's avatar
XhmikosR committed
6437
        context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
XhmikosR's avatar
Dist    
XhmikosR committed
6438
      }
Mark Otto's avatar
dist  
Mark Otto committed
6439

XhmikosR's avatar
Dist    
XhmikosR committed
6440
6441
6442
      if (context._isWithActiveTrigger()) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
6443

XhmikosR's avatar
Dist    
XhmikosR committed
6444
      clearTimeout(context._timeout);
XhmikosR's avatar
XhmikosR committed
6445
      context._hoverState = HOVER_STATE_OUT;
Mark Otto's avatar
dist  
Mark Otto committed
6446

XhmikosR's avatar
Dist    
XhmikosR committed
6447
6448
6449
6450
      if (!context.config.delay || !context.config.delay.hide) {
        context.hide();
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
6451

XhmikosR's avatar
Dist    
XhmikosR committed
6452
      context._timeout = setTimeout(function () {
XhmikosR's avatar
XhmikosR committed
6453
        if (context._hoverState === HOVER_STATE_OUT) {
Mark Otto's avatar
dist  
Mark Otto committed
6454
6455
          context.hide();
        }
XhmikosR's avatar
Dist    
XhmikosR committed
6456
6457
      }, context.config.delay.hide);
    };
Mark Otto's avatar
dist  
Mark Otto committed
6458

XhmikosR's avatar
Dist    
XhmikosR committed
6459
6460
6461
6462
    _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
      for (var trigger in this._activeTrigger) {
        if (this._activeTrigger[trigger]) {
          return true;
Mark Otto's avatar
dist  
Mark Otto committed
6463
        }
XhmikosR's avatar
Dist    
XhmikosR committed
6464
      }
Mark Otto's avatar
dist  
Mark Otto committed
6465

XhmikosR's avatar
Dist    
XhmikosR committed
6466
6467
      return false;
    };
Mark Otto's avatar
dist  
Mark Otto committed
6468

XhmikosR's avatar
Dist    
XhmikosR committed
6469
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
6470
      var dataAttributes = Manipulator.getDataAttributes(this.element);
XhmikosR's avatar
XhmikosR committed
6471
      Object.keys(dataAttributes).forEach(function (dataAttr) {
XhmikosR's avatar
XhmikosR committed
6472
        if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
XhmikosR's avatar
XhmikosR committed
6473
6474
6475
          delete dataAttributes[dataAttr];
        }
      });
XhmikosR's avatar
XhmikosR committed
6476
6477
6478
6479
6480

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

XhmikosR's avatar
XhmikosR committed
6481
      config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
Mark Otto's avatar
dist  
Mark Otto committed
6482

XhmikosR's avatar
Dist    
XhmikosR committed
6483
6484
6485
6486
6487
6488
      if (typeof config.delay === 'number') {
        config.delay = {
          show: config.delay,
          hide: config.delay
        };
      }
Mark Otto's avatar
dist  
Mark Otto committed
6489

XhmikosR's avatar
Dist    
XhmikosR committed
6490
6491
6492
      if (typeof config.title === 'number') {
        config.title = config.title.toString();
      }
Mark Otto's avatar
dist  
Mark Otto committed
6493

XhmikosR's avatar
Dist    
XhmikosR committed
6494
6495
6496
      if (typeof config.content === 'number') {
        config.content = config.content.toString();
      }
Mark Otto's avatar
dist  
Mark Otto committed
6497

XhmikosR's avatar
XhmikosR committed
6498
      typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
XhmikosR's avatar
XhmikosR committed
6499
6500

      if (config.sanitize) {
XhmikosR's avatar
XhmikosR committed
6501
        config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn);
XhmikosR's avatar
XhmikosR committed
6502
6503
      }

XhmikosR's avatar
Dist    
XhmikosR committed
6504
6505
      return config;
    };
Mark Otto's avatar
dist  
Mark Otto committed
6506

XhmikosR's avatar
Dist    
XhmikosR committed
6507
6508
    _proto._getDelegateConfig = function _getDelegateConfig() {
      var config = {};
Mark Otto's avatar
dist  
Mark Otto committed
6509

XhmikosR's avatar
Dist    
XhmikosR committed
6510
6511
6512
6513
      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
6514
6515
          }
        }
XhmikosR's avatar
Dist    
XhmikosR committed
6516
      }
Mark Otto's avatar
dist  
Mark Otto committed
6517

XhmikosR's avatar
Dist    
XhmikosR committed
6518
6519
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
6520

XhmikosR's avatar
Dist    
XhmikosR committed
6521
    _proto._cleanTipClass = function _cleanTipClass() {
XhmikosR's avatar
XhmikosR committed
6522
6523
      var tip = this.getTipElement();
      var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
Mark Otto's avatar
dist  
Mark Otto committed
6524

XhmikosR's avatar
XhmikosR committed
6525
      if (tabClass !== null && tabClass.length > 0) {
XhmikosR's avatar
XhmikosR committed
6526
6527
6528
6529
6530
        tabClass.map(function (token) {
          return token.trim();
        }).forEach(function (tClass) {
          return tip.classList.remove(tClass);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
6531
6532
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
6533

XhmikosR's avatar
Dist    
XhmikosR committed
6534
    _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
XhmikosR's avatar
XhmikosR committed
6535
      this.tip = popperData.instance.popper;
Mark Otto's avatar
dist    
Mark Otto committed
6536

XhmikosR's avatar
Dist    
XhmikosR committed
6537
      this._cleanTipClass();
Mark Otto's avatar
dist  
Mark Otto committed
6538

6539
      this._addAttachmentClass(this._getAttachment(popperData.placement));
XhmikosR's avatar
Dist    
XhmikosR committed
6540
    };
Mark Otto's avatar
dist    
Mark Otto committed
6541

XhmikosR's avatar
Dist    
XhmikosR committed
6542
6543
6544
    _proto._fixTransition = function _fixTransition() {
      var tip = this.getTipElement();
      var initConfigAnimation = this.config.animation;
Mark Otto's avatar
dist    
Mark Otto committed
6545

XhmikosR's avatar
Dist    
XhmikosR committed
6546
6547
6548
      if (tip.getAttribute('x-placement') !== null) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
6549

XhmikosR's avatar
XhmikosR committed
6550
      tip.classList.remove(CLASS_NAME_FADE$1);
XhmikosR's avatar
Dist    
XhmikosR committed
6551
6552
6553
6554
      this.config.animation = false;
      this.hide();
      this.show();
      this.config.animation = initConfigAnimation;
Mark Otto's avatar
Mark Otto committed
6555
6556
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
6557

XhmikosR's avatar
XhmikosR committed
6558
    Tooltip.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
6559
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
6560
        var data = Data.getData(this, DATA_KEY$6);
Mark Otto's avatar
dist    
Mark Otto committed
6561

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

XhmikosR's avatar
Dist    
XhmikosR committed
6564
6565
6566
        if (!data && /dispose|hide/.test(config)) {
          return;
        }
Mark Otto's avatar
dist  
Mark Otto committed
6567

XhmikosR's avatar
Dist    
XhmikosR committed
6568
6569
6570
        if (!data) {
          data = new Tooltip(this, _config);
        }
Mark Otto's avatar
dist  
Mark Otto committed
6571

XhmikosR's avatar
Dist    
XhmikosR committed
6572
6573
6574
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist  
Mark Otto committed
6575
          }
Mark Otto's avatar
dist    
Mark Otto committed
6576

XhmikosR's avatar
Dist    
XhmikosR committed
6577
          data[config]();
Mark Otto's avatar
dist    
Mark Otto committed
6578
        }
XhmikosR's avatar
Dist    
XhmikosR committed
6579
6580
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
6581

XhmikosR's avatar
XhmikosR committed
6582
    Tooltip.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
6583
6584
6585
      return Data.getData(element, DATA_KEY$6);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
    _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
6609
        return Event$1;
XhmikosR's avatar
Dist    
XhmikosR committed
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
      }
    }, {
      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
6622

XhmikosR's avatar
Dist    
XhmikosR committed
6623
6624
6625
6626
6627
6628
    return Tooltip;
  }();
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
6629
   * add .Tooltip to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
6630
   */
Mark Otto's avatar
dist    
Mark Otto committed
6631

6632

XhmikosR's avatar
XhmikosR committed
6633
6634
6635
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
Mark Otto's avatar
dist  
Mark Otto committed
6636

XhmikosR's avatar
XhmikosR committed
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$6];
      $.fn[NAME$6] = Tooltip.jQueryInterface;
      $.fn[NAME$6].Constructor = Tooltip;

      $.fn[NAME$6].noConflict = function () {
        $.fn[NAME$6] = JQUERY_NO_CONFLICT;
        return Tooltip.jQueryInterface;
      };
    }
  });
Mark Otto's avatar
dist  
Mark Otto committed
6648

XhmikosR's avatar
Dist    
XhmikosR committed
6649
6650
6651
6652
6653
6654
6655
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$7 = 'popover';
XhmikosR's avatar
XhmikosR committed
6656
  var VERSION$7 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
6657
6658
6659
6660
6661
  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
6662
  var Default$5 = _extends({}, Tooltip.Default, {
XhmikosR's avatar
Dist    
XhmikosR committed
6663
6664
6665
    placement: 'right',
    trigger: 'click',
    content: '',
XhmikosR's avatar
XhmikosR committed
6666
    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
6667
6668
  });

XhmikosR's avatar
XhmikosR committed
6669
  var DefaultType$5 = _extends({}, Tooltip.DefaultType, {
XhmikosR's avatar
Dist    
XhmikosR committed
6670
6671
6672
    content: '(string|element|function)'
  });

XhmikosR's avatar
XhmikosR committed
6673
  var Event$2 = {
XhmikosR's avatar
Dist    
XhmikosR committed
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
    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
6685
6686
6687
6688
  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
6689
6690
6691
6692
6693
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
6694

XhmikosR's avatar
XhmikosR committed
6695
  var Popover = /*#__PURE__*/function (_Tooltip) {
XhmikosR's avatar
Dist    
XhmikosR committed
6696
    _inheritsLoose(Popover, _Tooltip);
Mark Otto's avatar
dist  
Mark Otto committed
6697

XhmikosR's avatar
Dist    
XhmikosR committed
6698
6699
6700
    function Popover() {
      return _Tooltip.apply(this, arguments) || this;
    }
Mark Otto's avatar
Mark Otto committed
6701

XhmikosR's avatar
Dist    
XhmikosR committed
6702
    var _proto = Popover.prototype;
Mark Otto's avatar
Mark Otto committed
6703

XhmikosR's avatar
Dist    
XhmikosR committed
6704
6705
6706
6707
    // Overrides
    _proto.isWithContent = function isWithContent() {
      return this.getTitle() || this._getContent();
    };
Mark Otto's avatar
dist    
Mark Otto committed
6708

XhmikosR's avatar
Dist    
XhmikosR committed
6709
    _proto.setContent = function setContent() {
XhmikosR's avatar
XhmikosR committed
6710
      var tip = this.getTipElement(); // we use append for html objects to maintain js events
Mark Otto's avatar
dist  
Mark Otto committed
6711

XhmikosR's avatar
XhmikosR committed
6712
      this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
Mark Otto's avatar
dist  
Mark Otto committed
6713

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

XhmikosR's avatar
Dist    
XhmikosR committed
6716
6717
6718
      if (typeof content === 'function') {
        content = content.call(this.element);
      }
Mark Otto's avatar
dist    
Mark Otto committed
6719

XhmikosR's avatar
XhmikosR committed
6720
      this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
XhmikosR's avatar
XhmikosR committed
6721
      tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$4);
XhmikosR's avatar
XhmikosR committed
6722
6723
    } // Private
    ;
XhmikosR's avatar
XhmikosR committed
6724
6725
6726

    _proto._addAttachmentClass = function _addAttachmentClass(attachment) {
      this.getTipElement().classList.add(CLASS_PREFIX$1 + "-" + attachment);
XhmikosR's avatar
XhmikosR committed
6727
    };
Mark Otto's avatar
dist  
Mark Otto committed
6728

XhmikosR's avatar
Dist    
XhmikosR committed
6729
    _proto._getContent = function _getContent() {
XhmikosR's avatar
XhmikosR committed
6730
      return this.element.getAttribute('data-bs-content') || this.config.content;
XhmikosR's avatar
Dist    
XhmikosR committed
6731
    };
Mark Otto's avatar
dist    
Mark Otto committed
6732

XhmikosR's avatar
Dist    
XhmikosR committed
6733
    _proto._cleanTipClass = function _cleanTipClass() {
XhmikosR's avatar
XhmikosR committed
6734
6735
      var tip = this.getTipElement();
      var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX$1);
Mark Otto's avatar
dist  
Mark Otto committed
6736

XhmikosR's avatar
Dist    
XhmikosR committed
6737
      if (tabClass !== null && tabClass.length > 0) {
XhmikosR's avatar
XhmikosR committed
6738
6739
6740
6741
6742
        tabClass.map(function (token) {
          return token.trim();
        }).forEach(function (tClass) {
          return tip.classList.remove(tClass);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
6743
      }
Mark Otto's avatar
Mark Otto committed
6744
6745
    } // Static
    ;
Mark Otto's avatar
dist    
Mark Otto committed
6746

XhmikosR's avatar
XhmikosR committed
6747
    Popover.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
6748
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
6749
        var data = Data.getData(this, DATA_KEY$7);
Mark Otto's avatar
dist    
Mark Otto committed
6750

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

XhmikosR's avatar
Dist    
XhmikosR committed
6753
6754
6755
        if (!data && /dispose|hide/.test(config)) {
          return;
        }
Mark Otto's avatar
dist  
Mark Otto committed
6756

XhmikosR's avatar
Dist    
XhmikosR committed
6757
6758
        if (!data) {
          data = new Popover(this, _config);
XhmikosR's avatar
XhmikosR committed
6759
          Data.setData(this, DATA_KEY$7, data);
XhmikosR's avatar
Dist    
XhmikosR committed
6760
        }
Mark Otto's avatar
dist  
Mark Otto committed
6761

XhmikosR's avatar
Dist    
XhmikosR committed
6762
6763
6764
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist  
Mark Otto committed
6765
          }
Mark Otto's avatar
dist    
Mark Otto committed
6766

XhmikosR's avatar
Dist    
XhmikosR committed
6767
          data[config]();
Mark Otto's avatar
dist    
Mark Otto committed
6768
        }
XhmikosR's avatar
Dist    
XhmikosR committed
6769
6770
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
6771

XhmikosR's avatar
XhmikosR committed
6772
    Popover.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
6773
6774
6775
      return Data.getData(element, DATA_KEY$7);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
    _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
6800
        return Event$2;
XhmikosR's avatar
Dist    
XhmikosR committed
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
      }
    }, {
      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
6813

XhmikosR's avatar
Dist    
XhmikosR committed
6814
6815
6816
6817
6818
6819
    return Popover;
  }(Tooltip);
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
6820
   * add .Popover to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
6821
   */
Mark Otto's avatar
dist    
Mark Otto committed
6822

6823

XhmikosR's avatar
XhmikosR committed
6824
6825
6826
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
Mark Otto's avatar
dist  
Mark Otto committed
6827

XhmikosR's avatar
XhmikosR committed
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$7];
      $.fn[NAME$7] = Popover.jQueryInterface;
      $.fn[NAME$7].Constructor = Popover;

      $.fn[NAME$7].noConflict = function () {
        $.fn[NAME$7] = JQUERY_NO_CONFLICT;
        return Popover.jQueryInterface;
      };
    }
  });
Mark Otto's avatar
dist  
Mark Otto committed
6839

XhmikosR's avatar
Dist    
XhmikosR committed
6840
6841
6842
6843
6844
6845
6846
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$8 = 'scrollspy';
XhmikosR's avatar
XhmikosR committed
6847
  var VERSION$8 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
  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
6861
6862
6863
6864
6865
  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';
XhmikosR's avatar
XhmikosR committed
6866
  var SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
XhmikosR's avatar
XhmikosR committed
6867
6868
6869
6870
6871
6872
6873
6874
  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
6875
6876
6877
6878
6879
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist    
XhmikosR committed
6880

XhmikosR's avatar
XhmikosR committed
6881
  var ScrollSpy = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
6882
6883
6884
6885
6886
6887
    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
6888
      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
6889
6890
6891
6892
      this._offsets = [];
      this._targets = [];
      this._activeTarget = null;
      this._scrollHeight = 0;
XhmikosR's avatar
XhmikosR committed
6893
      EventHandler.on(this._scrollElement, EVENT_SCROLL, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
6894
6895
6896
6897
6898
        return _this._process(event);
      });
      this.refresh();

      this._process();
XhmikosR's avatar
XhmikosR committed
6899
6900

      Data.setData(element, DATA_KEY$8, this);
XhmikosR's avatar
Dist    
XhmikosR committed
6901
6902
6903
6904
6905
6906
6907
6908
6909
    } // Getters


    var _proto = ScrollSpy.prototype;

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

XhmikosR's avatar
XhmikosR committed
6910
      var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
XhmikosR's avatar
Dist    
XhmikosR committed
6911
      var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
XhmikosR's avatar
XhmikosR committed
6912
      var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
XhmikosR's avatar
Dist    
XhmikosR committed
6913
6914
6915
      this._offsets = [];
      this._targets = [];
      this._scrollHeight = this._getScrollHeight();
XhmikosR's avatar
XhmikosR committed
6916
      var targets = SelectorEngine.find(this._selector);
XhmikosR's avatar
Dist    
XhmikosR committed
6917
      targets.map(function (element) {
XhmikosR's avatar
XhmikosR committed
6918
        var targetSelector = getSelectorFromElement(element);
XhmikosR's avatar
XhmikosR committed
6919
        var target = targetSelector ? SelectorEngine.findOne(targetSelector) : null;
XhmikosR's avatar
Dist    
XhmikosR committed
6920
6921
6922
6923
6924

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

          if (targetBCR.width || targetBCR.height) {
XhmikosR's avatar
XhmikosR committed
6925
            return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
XhmikosR's avatar
Dist    
XhmikosR committed
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
          }
        }

        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
6939
    };
XhmikosR's avatar
Dist    
XhmikosR committed
6940
6941

    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
6942
6943
      Data.removeData(this._element, DATA_KEY$8);
      EventHandler.off(this._scrollElement, EVENT_KEY$8);
XhmikosR's avatar
Dist    
XhmikosR committed
6944
6945
6946
6947
6948
6949
6950
6951
      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
6952
6953
    } // Private
    ;
XhmikosR's avatar
Dist    
XhmikosR committed
6954
6955

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

XhmikosR's avatar
XhmikosR committed
6958
      if (typeof config.target !== 'string' && isElement(config.target)) {
XhmikosR's avatar
XhmikosR committed
6959
        var id = config.target.id;
XhmikosR's avatar
Dist    
XhmikosR committed
6960
6961

        if (!id) {
XhmikosR's avatar
XhmikosR committed
6962
6963
          id = getUID(NAME$8);
          config.target.id = id;
XhmikosR's avatar
Dist    
XhmikosR committed
6964
6965
6966
6967
6968
        }

        config.target = "#" + id;
      }

XhmikosR's avatar
XhmikosR committed
6969
      typeCheckConfig(NAME$8, config, DefaultType$6);
XhmikosR's avatar
Dist    
XhmikosR committed
6970
      return config;
Mark Otto's avatar
dist    
Mark Otto committed
6971
    };
XhmikosR's avatar
Dist    
XhmikosR committed
6972
6973
6974

    _proto._getScrollTop = function _getScrollTop() {
      return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
Mark Otto's avatar
dist    
Mark Otto committed
6975
    };
XhmikosR's avatar
Dist    
XhmikosR committed
6976
6977
6978

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

XhmikosR's avatar
Dist    
XhmikosR committed
6981
6982
    _proto._getOffsetHeight = function _getOffsetHeight() {
      return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
Mark Otto's avatar
dist    
Mark Otto committed
6983
    };
Mark Otto's avatar
dist  
Mark Otto committed
6984

XhmikosR's avatar
Dist    
XhmikosR committed
6985
6986
    _proto._process = function _process() {
      var scrollTop = this._getScrollTop() + this._config.offset;
Mark Otto's avatar
dist    
Mark Otto committed
6987

XhmikosR's avatar
Dist    
XhmikosR committed
6988
6989
6990
6991
6992
      var scrollHeight = this._getScrollHeight();

      var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();

      if (this._scrollHeight !== scrollHeight) {
Mark Otto's avatar
dist    
Mark Otto committed
6993
        this.refresh();
XhmikosR's avatar
Dist    
XhmikosR committed
6994
      }
Mark Otto's avatar
dist    
Mark Otto committed
6995

XhmikosR's avatar
Dist    
XhmikosR committed
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
      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;
      }

XhmikosR's avatar
XhmikosR committed
7014
      for (var i = this._offsets.length; i--;) {
XhmikosR's avatar
Dist    
XhmikosR committed
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
        var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);

        if (isActiveTarget) {
          this._activate(this._targets[i]);
        }
      }
    };

    _proto._activate = function _activate(target) {
      this._activeTarget = target;

      this._clear();
Mark Otto's avatar
dist  
Mark Otto committed
7027

XhmikosR's avatar
Dist    
XhmikosR committed
7028
      var queries = this._selector.split(',').map(function (selector) {
XhmikosR's avatar
XhmikosR committed
7029
        return selector + "[data-bs-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
XhmikosR's avatar
Dist    
XhmikosR committed
7030
      });
XhmikosR's avatar
Dist    
XhmikosR committed
7031

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

XhmikosR's avatar
XhmikosR committed
7034
      if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
XhmikosR's avatar
XhmikosR committed
7035
        SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
XhmikosR committed
7036
        link.classList.add(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
Dist    
XhmikosR committed
7037
7038
      } else {
        // Set triggered link as active
XhmikosR's avatar
XhmikosR committed
7039
7040
        link.classList.add(CLASS_NAME_ACTIVE$2);
        SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP).forEach(function (listGroup) {
XhmikosR's avatar
XhmikosR committed
7041
7042
          // 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
7043
7044
          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
7045
7046
          }); // Handle special case when .nav-link is inside .nav-item

XhmikosR's avatar
XhmikosR committed
7047
7048
7049
          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
7050
7051
7052
            });
          });
        });
XhmikosR's avatar
Dist    
XhmikosR committed
7053
      }
Mark Otto's avatar
dist    
Mark Otto committed
7054

XhmikosR's avatar
XhmikosR committed
7055
      EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, {
XhmikosR's avatar
Dist    
XhmikosR committed
7056
7057
7058
        relatedTarget: target
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
7059

XhmikosR's avatar
Dist    
XhmikosR committed
7060
    _proto._clear = function _clear() {
XhmikosR's avatar
XhmikosR committed
7061
7062
      SelectorEngine.find(this._selector).filter(function (node) {
        return node.classList.contains(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
Dist    
XhmikosR committed
7063
      }).forEach(function (node) {
XhmikosR's avatar
XhmikosR committed
7064
        return node.classList.remove(CLASS_NAME_ACTIVE$2);
XhmikosR's avatar
Dist    
XhmikosR committed
7065
      });
Mark Otto's avatar
Mark Otto committed
7066
7067
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
7068

XhmikosR's avatar
XhmikosR committed
7069
    ScrollSpy.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
7070
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
7071
        var data = Data.getData(this, DATA_KEY$8);
Mark Otto's avatar
dist  
Mark Otto committed
7072

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

XhmikosR's avatar
Dist    
XhmikosR committed
7075
7076
7077
        if (!data) {
          data = new ScrollSpy(this, _config);
        }
Mark Otto's avatar
dist  
Mark Otto committed
7078

XhmikosR's avatar
Dist    
XhmikosR committed
7079
7080
7081
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
7082
          }
Mark Otto's avatar
dist    
Mark Otto committed
7083

XhmikosR's avatar
Dist    
XhmikosR committed
7084
          data[config]();
Mark Otto's avatar
dist  
Mark Otto committed
7085
        }
XhmikosR's avatar
Dist    
XhmikosR committed
7086
7087
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
7088

XhmikosR's avatar
XhmikosR committed
7089
    ScrollSpy.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
7090
7091
7092
      return Data.getData(element, DATA_KEY$8);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
    _createClass(ScrollSpy, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$8;
      }
    }, {
      key: "Default",
      get: function get() {
        return Default$6;
      }
    }]);
Mark Otto's avatar
dist  
Mark Otto committed
7104

XhmikosR's avatar
Dist    
XhmikosR committed
7105
7106
7107
7108
7109
7110
7111
    return ScrollSpy;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
7112
7113


XhmikosR's avatar
XhmikosR committed
7114
7115
  EventHandler.on(window, EVENT_LOAD_DATA_API$1, function () {
    SelectorEngine.find(SELECTOR_DATA_SPY).forEach(function (spy) {
XhmikosR's avatar
XhmikosR committed
7116
7117
      return new ScrollSpy(spy, Manipulator.getDataAttributes(spy));
    });
XhmikosR's avatar
Dist    
XhmikosR committed
7118
7119
7120
7121
7122
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
7123
   * add .ScrollSpy to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
7124
   */
Mark Otto's avatar
dist    
Mark Otto committed
7125

XhmikosR's avatar
XhmikosR committed
7126
7127
7128
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
7129

XhmikosR's avatar
XhmikosR committed
7130
7131
7132
7133
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$8];
      $.fn[NAME$8] = ScrollSpy.jQueryInterface;
      $.fn[NAME$8].Constructor = ScrollSpy;
Mark Otto's avatar
dist  
Mark Otto committed
7134

XhmikosR's avatar
XhmikosR committed
7135
7136
7137
7138
7139
7140
      $.fn[NAME$8].noConflict = function () {
        $.fn[NAME$8] = JQUERY_NO_CONFLICT;
        return ScrollSpy.jQueryInterface;
      };
    }
  });
Mark Otto's avatar
dist  
Mark Otto committed
7141

XhmikosR's avatar
Dist    
XhmikosR committed
7142
7143
7144
7145
7146
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
7147

XhmikosR's avatar
Dist    
XhmikosR committed
7148
  var NAME$9 = 'tab';
XhmikosR's avatar
XhmikosR committed
7149
  var VERSION$9 = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
7150
7151
7152
  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
7153
7154
7155
7156
7157
7158
7159
  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';
XhmikosR's avatar
XhmikosR committed
7160
  var CLASS_NAME_DISABLED$1 = 'disabled';
XhmikosR's avatar
XhmikosR committed
7161
7162
7163
7164
  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';
XhmikosR's avatar
XhmikosR committed
7165
  var SELECTOR_ACTIVE$1 = '.active';
XhmikosR's avatar
XhmikosR committed
7166
  var SELECTOR_ACTIVE_UL = ':scope > li > .active';
XhmikosR's avatar
XhmikosR committed
7167
  var SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
XhmikosR's avatar
XhmikosR committed
7168
7169
  var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
  var SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
XhmikosR's avatar
XhmikosR committed
7170
7171
7172
7173
7174
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
7175

XhmikosR's avatar
XhmikosR committed
7176
  var Tab = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
7177
7178
    function Tab(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
7179
      Data.setData(this._element, DATA_KEY$9, this);
XhmikosR's avatar
Dist    
XhmikosR committed
7180
    } // Getters
Mark Otto's avatar
dist  
Mark Otto committed
7181

Mark Otto's avatar
dist    
Mark Otto committed
7182

XhmikosR's avatar
Dist    
XhmikosR committed
7183
    var _proto = Tab.prototype;
Mark Otto's avatar
dist  
Mark Otto committed
7184

XhmikosR's avatar
Dist    
XhmikosR committed
7185
7186
7187
    // Public
    _proto.show = function show() {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
7188

XhmikosR's avatar
XhmikosR committed
7189
      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$1)) {
XhmikosR's avatar
Dist    
XhmikosR committed
7190
7191
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
7192

XhmikosR's avatar
Dist    
XhmikosR committed
7193
      var previous;
XhmikosR's avatar
XhmikosR committed
7194
      var target = getElementFromSelector(this._element);
XhmikosR's avatar
XhmikosR committed
7195
7196

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

      if (listElement) {
XhmikosR's avatar
XhmikosR committed
7199
        var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE$1;
XhmikosR's avatar
XhmikosR committed
7200
        previous = SelectorEngine.find(itemSelector, listElement);
XhmikosR's avatar
Dist    
XhmikosR committed
7201
7202
        previous = previous[previous.length - 1];
      }
Mark Otto's avatar
dist  
Mark Otto committed
7203

XhmikosR's avatar
XhmikosR committed
7204
      var hideEvent = null;
Mark Otto's avatar
dist    
Mark Otto committed
7205

XhmikosR's avatar
Dist    
XhmikosR committed
7206
      if (previous) {
XhmikosR's avatar
XhmikosR committed
7207
        hideEvent = EventHandler.trigger(previous, EVENT_HIDE$3, {
XhmikosR's avatar
XhmikosR committed
7208
7209
          relatedTarget: this._element
        });
XhmikosR's avatar
Dist    
XhmikosR committed
7210
      }
Mark Otto's avatar
dist    
Mark Otto committed
7211

XhmikosR's avatar
XhmikosR committed
7212
      var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
XhmikosR's avatar
XhmikosR committed
7213
7214
        relatedTarget: previous
      });
Mark Otto's avatar
dist  
Mark Otto committed
7215

XhmikosR's avatar
XhmikosR committed
7216
      if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
7217
7218
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
7219

XhmikosR's avatar
Dist    
XhmikosR committed
7220
      this._activate(this._element, listElement);
Mark Otto's avatar
dist  
Mark Otto committed
7221

XhmikosR's avatar
Dist    
XhmikosR committed
7222
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
7223
        EventHandler.trigger(previous, EVENT_HIDDEN$3, {
XhmikosR's avatar
Dist    
XhmikosR committed
7224
7225
          relatedTarget: _this._element
        });
XhmikosR's avatar
XhmikosR committed
7226
        EventHandler.trigger(_this._element, EVENT_SHOWN$3, {
XhmikosR's avatar
Dist    
XhmikosR committed
7227
          relatedTarget: previous
Mark Otto's avatar
dist    
Mark Otto committed
7228
7229
        });
      };
Mark Otto's avatar
dist  
Mark Otto committed
7230

XhmikosR's avatar
Dist    
XhmikosR committed
7231
7232
7233
7234
7235
7236
      if (target) {
        this._activate(target, target.parentNode, complete);
      } else {
        complete();
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
7237

XhmikosR's avatar
Dist    
XhmikosR committed
7238
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
7239
      Data.removeData(this._element, DATA_KEY$9);
XhmikosR's avatar
Dist    
XhmikosR committed
7240
      this._element = null;
Mark Otto's avatar
Mark Otto committed
7241
7242
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
7243

XhmikosR's avatar
Dist    
XhmikosR committed
7244
7245
    _proto._activate = function _activate(element, container, callback) {
      var _this2 = this;
Mark Otto's avatar
dist  
Mark Otto committed
7246

XhmikosR's avatar
XhmikosR committed
7247
      var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE$1);
XhmikosR's avatar
Dist    
XhmikosR committed
7248
      var active = activeElements[0];
XhmikosR's avatar
XhmikosR committed
7249
      var isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$3);
XhmikosR's avatar
Dist    
XhmikosR committed
7250
7251
7252

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

XhmikosR's avatar
Dist    
XhmikosR committed
7255
      if (active && isTransitioning) {
XhmikosR's avatar
XhmikosR committed
7256
        var transitionDuration = getTransitionDurationFromElement(active);
XhmikosR's avatar
XhmikosR committed
7257
        active.classList.remove(CLASS_NAME_SHOW$5);
XhmikosR's avatar
XhmikosR committed
7258
7259
        EventHandler.one(active, TRANSITION_END, complete);
        emulateTransitionEnd(active, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
7260
7261
7262
7263
7264
7265
7266
      } else {
        complete();
      }
    };

    _proto._transitionComplete = function _transitionComplete(element, active, callback) {
      if (active) {
XhmikosR's avatar
XhmikosR committed
7267
7268
        active.classList.remove(CLASS_NAME_ACTIVE$3);
        var dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode);
XhmikosR's avatar
Dist    
XhmikosR committed
7269
7270

        if (dropdownChild) {
XhmikosR's avatar
XhmikosR committed
7271
          dropdownChild.classList.remove(CLASS_NAME_ACTIVE$3);
Mark Otto's avatar
dist  
Mark Otto committed
7272
        }
XhmikosR's avatar
Dist    
XhmikosR committed
7273
7274
7275

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

XhmikosR's avatar
XhmikosR committed
7279
      element.classList.add(CLASS_NAME_ACTIVE$3);
XhmikosR's avatar
Dist    
XhmikosR committed
7280
7281
7282
7283

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

XhmikosR's avatar
XhmikosR committed
7285
      reflow(element);
Mark Otto's avatar
Mark Otto committed
7286

XhmikosR's avatar
XhmikosR committed
7287
7288
      if (element.classList.contains(CLASS_NAME_FADE$3)) {
        element.classList.add(CLASS_NAME_SHOW$5);
Mark Otto's avatar
Mark Otto committed
7289
      }
Mark Otto's avatar
dist  
Mark Otto committed
7290

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

XhmikosR's avatar
Dist    
XhmikosR committed
7294
        if (dropdownElement) {
XhmikosR's avatar
XhmikosR committed
7295
7296
          SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE$1).forEach(function (dropdown) {
            return dropdown.classList.add(CLASS_NAME_ACTIVE$3);
XhmikosR's avatar
XhmikosR committed
7297
          });
XhmikosR's avatar
Dist    
XhmikosR committed
7298
        }
Mark Otto's avatar
dist  
Mark Otto committed
7299

XhmikosR's avatar
Dist    
XhmikosR committed
7300
        element.setAttribute('aria-expanded', true);
Mark Otto's avatar
dist    
Mark Otto committed
7301
      }
Mark Otto's avatar
dist    
Mark Otto committed
7302

XhmikosR's avatar
Dist    
XhmikosR committed
7303
7304
7305
      if (callback) {
        callback();
      }
Mark Otto's avatar
Mark Otto committed
7306
7307
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
7308

XhmikosR's avatar
XhmikosR committed
7309
    Tab.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
7310
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
7311
        var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
XhmikosR's avatar
Dist    
XhmikosR committed
7312
7313
7314
7315
7316
7317
7318
7319
7320

        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
7321
    };
Mark Otto's avatar
dist  
Mark Otto committed
7322

XhmikosR's avatar
XhmikosR committed
7323
    Tab.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
7324
7325
7326
      return Data.getData(element, DATA_KEY$9);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
    _createClass(Tab, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$9;
      }
    }]);

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


XhmikosR's avatar
XhmikosR committed
7343
  EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$4, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
7344
    event.preventDefault();
XhmikosR's avatar
XhmikosR committed
7345
7346
    var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
    data.show();
XhmikosR's avatar
Dist    
XhmikosR committed
7347
7348
7349
7350
7351
  });
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
7352
   * add .Tab to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
7353
7354
   */

XhmikosR's avatar
XhmikosR committed
7355
7356
7357
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
7358

XhmikosR's avatar
XhmikosR committed
7359
7360
7361
7362
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$9];
      $.fn[NAME$9] = Tab.jQueryInterface;
      $.fn[NAME$9].Constructor = Tab;
XhmikosR's avatar
Dist    
XhmikosR committed
7363

XhmikosR's avatar
XhmikosR committed
7364
7365
7366
7367
7368
7369
      $.fn[NAME$9].noConflict = function () {
        $.fn[NAME$9] = JQUERY_NO_CONFLICT;
        return Tab.jQueryInterface;
      };
    }
  });
Mark Otto's avatar
dist  
Mark Otto committed
7370
7371

  /**
XhmikosR's avatar
Dist    
XhmikosR committed
7372
7373
7374
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
Mark Otto's avatar
dist  
Mark Otto committed
7375
   */
Mark Otto's avatar
dist    
Mark Otto committed
7376

XhmikosR's avatar
Dist    
XhmikosR committed
7377
  var NAME$a = 'toast';
XhmikosR's avatar
XhmikosR committed
7378
  var VERSION$a = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
7379
7380
  var DATA_KEY$a = 'bs.toast';
  var EVENT_KEY$a = "." + DATA_KEY$a;
XhmikosR's avatar
XhmikosR committed
7381
7382
7383
7384
7385
7386
7387
7388
7389
  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
7390
7391
7392
7393
7394
7395
7396
7397
  var DefaultType$7 = {
    animation: 'boolean',
    autohide: 'boolean',
    delay: 'number'
  };
  var Default$7 = {
    animation: true,
    autohide: true,
XhmikosR's avatar
XhmikosR committed
7398
    delay: 5000
XhmikosR's avatar
Dist    
XhmikosR committed
7399
  };
XhmikosR's avatar
XhmikosR committed
7400
  var SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="toast"]';
XhmikosR's avatar
XhmikosR committed
7401
7402
7403
7404
7405
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
7406

XhmikosR's avatar
XhmikosR committed
7407
  var Toast = /*#__PURE__*/function () {
XhmikosR's avatar
Dist    
XhmikosR committed
7408
7409
7410
7411
    function Toast(element, config) {
      this._element = element;
      this._config = this._getConfig(config);
      this._timeout = null;
Mark Otto's avatar
dist  
Mark Otto committed
7412

XhmikosR's avatar
Dist    
XhmikosR committed
7413
      this._setListeners();
XhmikosR's avatar
XhmikosR committed
7414
7415

      Data.setData(element, DATA_KEY$a, this);
XhmikosR's avatar
Dist    
XhmikosR committed
7416
    } // Getters
Mark Otto's avatar
dist  
Mark Otto committed
7417
7418


XhmikosR's avatar
Dist    
XhmikosR committed
7419
    var _proto = Toast.prototype;
Mark Otto's avatar
dist  
Mark Otto committed
7420

XhmikosR's avatar
Dist    
XhmikosR committed
7421
7422
7423
    // Public
    _proto.show = function show() {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
7424

XhmikosR's avatar
XhmikosR committed
7425
      var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4);
Mark Otto's avatar
dist v5    
Mark Otto committed
7426
7427
7428
7429

      if (showEvent.defaultPrevented) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
7430

XhmikosR's avatar
XhmikosR committed
7431
7432
      this._clearTimeout();

XhmikosR's avatar
Dist    
XhmikosR committed
7433
      if (this._config.animation) {
XhmikosR's avatar
XhmikosR committed
7434
        this._element.classList.add(CLASS_NAME_FADE$4);
XhmikosR's avatar
Dist    
XhmikosR committed
7435
      }
Mark Otto's avatar
dist  
Mark Otto committed
7436

XhmikosR's avatar
Dist    
XhmikosR committed
7437
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
7438
        _this._element.classList.remove(CLASS_NAME_SHOWING);
Mark Otto's avatar
dist    
Mark Otto committed
7439

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
7444
        if (_this._config.autohide) {
XhmikosR's avatar
XhmikosR committed
7445
7446
7447
          _this._timeout = setTimeout(function () {
            _this.hide();
          }, _this._config.delay);
Mark Otto's avatar
dist    
Mark Otto committed
7448
        }
XhmikosR's avatar
Dist    
XhmikosR committed
7449
      };
Mark Otto's avatar
dist  
Mark Otto committed
7450

XhmikosR's avatar
XhmikosR committed
7451
      this._element.classList.remove(CLASS_NAME_HIDE);
Mark Otto's avatar
dist    
Mark Otto committed
7452

7453
7454
      reflow(this._element);

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

XhmikosR's avatar
Dist    
XhmikosR committed
7457
      if (this._config.animation) {
XhmikosR's avatar
XhmikosR committed
7458
7459
7460
        var transitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, complete);
        emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
7461
7462
7463
7464
      } else {
        complete();
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
7465

XhmikosR's avatar
XhmikosR committed
7466
    _proto.hide = function hide() {
XhmikosR's avatar
Dist    
XhmikosR committed
7467
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
7468

XhmikosR's avatar
XhmikosR committed
7469
      if (!this._element.classList.contains(CLASS_NAME_SHOW$6)) {
XhmikosR's avatar
Dist    
XhmikosR committed
7470
7471
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
7472

XhmikosR's avatar
XhmikosR committed
7473
      var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4);
Mark Otto's avatar
dist v5    
Mark Otto committed
7474
7475
7476
7477

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

XhmikosR's avatar
XhmikosR committed
7479
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
7480
        _this2._element.classList.add(CLASS_NAME_HIDE);
XhmikosR's avatar
XhmikosR committed
7481

XhmikosR's avatar
XhmikosR committed
7482
        EventHandler.trigger(_this2._element, EVENT_HIDDEN$4);
XhmikosR's avatar
XhmikosR committed
7483
7484
      };

XhmikosR's avatar
XhmikosR committed
7485
      this._element.classList.remove(CLASS_NAME_SHOW$6);
XhmikosR's avatar
XhmikosR committed
7486
7487
7488
7489
7490

      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
7491
      } else {
XhmikosR's avatar
XhmikosR committed
7492
        complete();
XhmikosR's avatar
Dist    
XhmikosR committed
7493
7494
      }
    };
XhmikosR's avatar
Dist    
XhmikosR committed
7495

XhmikosR's avatar
Dist    
XhmikosR committed
7496
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
7497
      this._clearTimeout();
Mark Otto's avatar
dist  
Mark Otto committed
7498

XhmikosR's avatar
XhmikosR committed
7499
7500
      if (this._element.classList.contains(CLASS_NAME_SHOW$6)) {
        this._element.classList.remove(CLASS_NAME_SHOW$6);
XhmikosR's avatar
Dist    
XhmikosR committed
7501
      }
Mark Otto's avatar
dist  
Mark Otto committed
7502

XhmikosR's avatar
XhmikosR committed
7503
      EventHandler.off(this._element, EVENT_CLICK_DISMISS$1);
XhmikosR's avatar
XhmikosR committed
7504
      Data.removeData(this._element, DATA_KEY$a);
XhmikosR's avatar
Dist    
XhmikosR committed
7505
7506
      this._element = null;
      this._config = null;
Mark Otto's avatar
Mark Otto committed
7507
7508
    } // Private
    ;
Mark Otto's avatar
dist  
Mark Otto committed
7509

XhmikosR's avatar
Dist    
XhmikosR committed
7510
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
7511
      config = _extends({}, Default$7, Manipulator.getDataAttributes(this._element), typeof config === 'object' && config ? config : {});
XhmikosR's avatar
XhmikosR committed
7512
      typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
7513
7514
7515
7516
7517
      return config;
    };

    _proto._setListeners = function _setListeners() {
      var _this3 = this;
Mark Otto's avatar
dist    
Mark Otto committed
7518

XhmikosR's avatar
XhmikosR committed
7519
      EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () {
XhmikosR's avatar
XhmikosR committed
7520
        return _this3.hide();
XhmikosR's avatar
Dist    
XhmikosR committed
7521
      });
XhmikosR's avatar
XhmikosR committed
7522
7523
7524
7525
7526
    };

    _proto._clearTimeout = function _clearTimeout() {
      clearTimeout(this._timeout);
      this._timeout = null;
Mark Otto's avatar
Mark Otto committed
7527
7528
    } // Static
    ;
XhmikosR's avatar
Dist    
XhmikosR committed
7529

XhmikosR's avatar
XhmikosR committed
7530
    Toast.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
7531
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
7532
        var data = Data.getData(this, DATA_KEY$a);
Mark Otto's avatar
dist  
Mark Otto committed
7533

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

XhmikosR's avatar
Dist    
XhmikosR committed
7536
7537
7538
        if (!data) {
          data = new Toast(this, _config);
        }
Mark Otto's avatar
dist  
Mark Otto committed
7539

XhmikosR's avatar
Dist    
XhmikosR committed
7540
7541
7542
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist  
Mark Otto committed
7543
          }
Mark Otto's avatar
dist    
Mark Otto committed
7544

XhmikosR's avatar
Dist    
XhmikosR committed
7545
          data[config](this);
XhmikosR's avatar
Dist    
XhmikosR committed
7546
        }
XhmikosR's avatar
Dist    
XhmikosR committed
7547
7548
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
7549

XhmikosR's avatar
XhmikosR committed
7550
    Toast.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
7551
7552
7553
      return Data.getData(element, DATA_KEY$a);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
    _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
7564
7565
7566
7567
7568
    }, {
      key: "Default",
      get: function get() {
        return Default$7;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
7569
    }]);
Mark Otto's avatar
dist  
Mark Otto committed
7570

XhmikosR's avatar
Dist    
XhmikosR committed
7571
7572
7573
7574
7575
7576
    return Toast;
  }();
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
7577
   * add .Toast to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
7578
   */
XhmikosR's avatar
Dist    
XhmikosR committed
7579

7580

XhmikosR's avatar
XhmikosR committed
7581
7582
7583
  onDOMContentLoaded(function () {
    var $ = getjQuery();
    /* istanbul ignore if */
Mark Otto's avatar
dist    
Mark Otto committed
7584

XhmikosR's avatar
XhmikosR committed
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
    if ($) {
      var JQUERY_NO_CONFLICT = $.fn[NAME$a];
      $.fn[NAME$a] = Toast.jQueryInterface;
      $.fn[NAME$a].Constructor = Toast;

      $.fn[NAME$a].noConflict = function () {
        $.fn[NAME$a] = JQUERY_NO_CONFLICT;
        return Toast.jQueryInterface;
      };
    }
  });
Mark Otto's avatar
dist  
Mark Otto committed
7596

Mark Otto's avatar
dist    
Mark Otto committed
7597
7598
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
7599
   * Bootstrap (v5.0.0-alpha3): index.umd.js
XhmikosR's avatar
XhmikosR committed
7600
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
Mark Otto's avatar
dist    
Mark Otto committed
7601
7602
   * --------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist.    
XhmikosR committed
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
  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
7616

XhmikosR's avatar
Dist.    
XhmikosR committed
7617
  return index_umd;
Mark Otto's avatar
dist  
Mark Otto committed
7618

XhmikosR's avatar
XhmikosR committed
7619
})));
Mark Otto's avatar
dist    
Mark Otto committed
7620
//# sourceMappingURL=bootstrap.bundle.js.map