bootstrap.bundle.js 245 KB
Newer Older
Mark Otto's avatar
dist  
Mark Otto committed
1
/*!
XhmikosR's avatar
XhmikosR committed
2
  * Bootstrap v4.3.1 (https://getbootstrap.com/)
Mark Otto's avatar
Mark Otto committed
3
  * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
Mark Otto's avatar
dist  
Mark Otto committed
4
5
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  */
Mark Otto's avatar
dist    
Mark Otto committed
6
(function (global, factory) {
XhmikosR's avatar
Dist.    
XhmikosR committed
7
8
9
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  typeof define === 'function' && define.amd ? define(factory) :
  (global = 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
  }

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

    return obj;
  }
Mark Otto's avatar
Mark Otto committed
42

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

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

    return keys;
  }

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

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

    return target;
Mark Otto's avatar
dist    
Mark Otto committed
75
  }
Mark Otto's avatar
Mark Otto committed
76

Mark Otto's avatar
dist    
Mark Otto committed
77
78
79
80
81
  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
82
83

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

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


XhmikosR's avatar
XhmikosR committed
103
104
105
106
  var getUID = function getUID(prefix) {
    do {
      prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
    } while (document.getElementById(prefix));
Mark Otto's avatar
dist  
Mark Otto committed
107

XhmikosR's avatar
XhmikosR committed
108
109
    return prefix;
  };
Mark Otto's avatar
dist  
Mark Otto committed
110

XhmikosR's avatar
XhmikosR committed
111
  var getSelector = function getSelector(element) {
XhmikosR's avatar
XhmikosR committed
112
113
114
115
    var selector = element.getAttribute('data-target');

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

XhmikosR's avatar
XhmikosR committed
119
120
121
122
123
124
125
    return selector;
  };

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

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

    return null;
  };

  var getElementFromSelector = function getElementFromSelector(element) {
    var selector = getSelector(element);
    return selector ? document.querySelector(selector) : null;
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
  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;

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

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


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

  var triggerTransitionEnd = function triggerTransitionEnd(element) {
XhmikosR's avatar
XhmikosR committed
161
162
163
    var evt = document.createEvent('HTMLEvents');
    evt.initEvent(TRANSITION_END, true, true);
    element.dispatchEvent(evt);
XhmikosR's avatar
XhmikosR committed
164
  };
Mark Otto's avatar
dist  
Mark Otto committed
165

XhmikosR's avatar
XhmikosR committed
166
167
168
169
170
  var isElement = function isElement(obj) {
    return (obj[0] || obj).nodeType;
  };

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

    function listener() {
XhmikosR's avatar
Dist    
XhmikosR committed
176
      called = true;
XhmikosR's avatar
XhmikosR committed
177
178
179
180
      element.removeEventListener(TRANSITION_END, listener);
    }

    element.addEventListener(TRANSITION_END, listener);
XhmikosR's avatar
Dist    
XhmikosR committed
181
182
    setTimeout(function () {
      if (!called) {
XhmikosR's avatar
XhmikosR committed
183
        triggerTransitionEnd(element);
XhmikosR's avatar
Dist    
XhmikosR committed
184
      }
XhmikosR's avatar
XhmikosR committed
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
    }, emulatedDuration);
  };

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

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

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

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

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

    if (element.style && element.parentNode && element.parentNode.style) {
XhmikosR's avatar
XhmikosR committed
214
215
216
      var elementStyle = getComputedStyle(element);
      var parentNodeStyle = getComputedStyle(element.parentNode);
      return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
XhmikosR's avatar
XhmikosR committed
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
    }

    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
243
  };
XhmikosR's avatar
XhmikosR committed
244
245
246
247
248
249
250
251

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

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

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

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

    return null;
  };

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

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

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

XhmikosR's avatar
XhmikosR committed
296
        var keyProperties = element.key;
Mark Otto's avatar
dist    
Mark Otto committed
297

XhmikosR's avatar
XhmikosR committed
298
299
300
        if (keyProperties.key === key) {
          return storeData[keyProperties.id];
        }
Mark Otto's avatar
dist    
Mark Otto committed
301

XhmikosR's avatar
XhmikosR committed
302
303
304
305
306
307
308
309
310
311
312
313
314
        return null;
      },
      delete: function _delete(element, key) {
        if (typeof element.key === 'undefined') {
          return;
        }

        var keyProperties = element.key;

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

  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
331
332
333
334
335
336
  /* istanbul ignore file */
  var _Element$prototype = Element.prototype,
      matches = _Element$prototype.matches,
      closest = _Element$prototype.closest;
  var find = Element.prototype.querySelectorAll;
  var findOne = Element.prototype.querySelector;
XhmikosR's avatar
XhmikosR committed
337

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

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

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

XhmikosR's avatar
XhmikosR committed
363
364
  if (!workingDefaultPrevented) {
    var origPreventDefault = Event.prototype.preventDefault;
Mark Otto's avatar
dist    
Mark Otto committed
365

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

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


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

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

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

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

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

XhmikosR's avatar
XhmikosR committed
411
412
413
      return null;
    };
  }
XhmikosR's avatar
XhmikosR committed
414

XhmikosR's avatar
XhmikosR committed
415
  var scopeSelectorRegex = /:scope\b/;
XhmikosR's avatar
XhmikosR committed
416

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

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

XhmikosR's avatar
XhmikosR committed
426
    return true;
XhmikosR's avatar
XhmikosR committed
427
428
  }();

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

      var hasId = Boolean(this.id);

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

      var nodeList = null;

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

      return nodeList;
    };

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

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

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

      return null;
    };
  }

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

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

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

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

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

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

    event.delegateTarget = element;
  }

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

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

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

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

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

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

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


      return null;
    };
  }

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

Mark Otto's avatar
dist v5    
Mark Otto committed
561
562
563
564
    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
565
566

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

    return null;
  }

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

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

    if (custom) {
      typeEvent = custom;
    }

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

    if (!isNative) {
      typeEvent = originalTypeEvent;
    }

    return [delegation, originalHandler, typeEvent];
  }

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

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

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

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

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

    var uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
XhmikosR's avatar
Dist.    
XhmikosR committed
619
    var fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
XhmikosR's avatar
XhmikosR committed
620
621
622
623
624
625
626
627
628
629
630
    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
631
    if (!fn) {
XhmikosR's avatar
XhmikosR committed
632
633
634
635
636
637
638
639
640
641
642
643
644
      return;
    }

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

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

  var EventHandler = {
    on: function on(element, event, handler, delegationFn) {
      addHandler(element, event, handler, delegationFn, false);
XhmikosR's avatar
Dist    
XhmikosR committed
652
    },
XhmikosR's avatar
XhmikosR committed
653
654
655
656
657
658
659
    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
660

XhmikosR's avatar
XhmikosR committed
661
662
663
664
      var _normalizeParams2 = normalizeParams(originalTypeEvent, handler, delegationFn),
          delegation = _normalizeParams2[0],
          originalHandler = _normalizeParams2[1],
          typeEvent = _normalizeParams2[2];
Mark Otto's avatar
dist    
Mark Otto committed
665

XhmikosR's avatar
XhmikosR committed
666
667
668
      var inNamespace = typeEvent !== originalTypeEvent;
      var events = getEvent(element);
      var isNamespace = originalTypeEvent.charAt(0) === '.';
Mark Otto's avatar
dist    
Mark Otto committed
669

XhmikosR's avatar
XhmikosR committed
670
671
672
673
674
675
676
677
678
679
680
681
      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
682
          removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
XhmikosR's avatar
XhmikosR committed
683
684
        });
      }
Mark Otto's avatar
dist    
Mark Otto committed
685

XhmikosR's avatar
XhmikosR committed
686
687
688
      var storeElementEvent = events[typeEvent] || {};
      Object.keys(storeElementEvent).forEach(function (keyHandlers) {
        var handlerKey = keyHandlers.replace(stripUidRegex, '');
Mark Otto's avatar
dist    
Mark Otto committed
689

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

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

XhmikosR's avatar
XhmikosR committed
710
711
712
      if (inNamespace && $) {
        jQueryEvent = $.Event(event, args);
        $(element).trigger(jQueryEvent);
XhmikosR's avatar
XhmikosR committed
713
714
715
716
717
718
719
720
721
        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
722
        evt = createCustomEvent(event, {
XhmikosR's avatar
XhmikosR committed
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
          bubbles: bubbles,
          cancelable: true
        });
      } // merge custom informations in our event


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

      if (defaultPrevented) {
        evt.preventDefault();

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

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

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

      return evt;
    }
  };

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

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

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

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

      var children = makeArray(element.children);
      return children.filter(function (child) {
        return _this.matches(child, selector);
      });
XhmikosR's avatar
Dist    
XhmikosR committed
801
    },
XhmikosR's avatar
XhmikosR committed
802
803
804
805
806
807
808
    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);
Mark Otto's avatar
dist  
Mark Otto committed
809
        }
XhmikosR's avatar
XhmikosR committed
810
811

        ancestor = ancestor.parentNode;
Mark Otto's avatar
dist  
Mark Otto committed
812
      }
XhmikosR's avatar
XhmikosR committed
813
814

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

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

XhmikosR's avatar
XhmikosR committed
828
        previous = previous.previousSibling;
Mark Otto's avatar
dist    
Mark Otto committed
829
830
      }

XhmikosR's avatar
XhmikosR committed
831
      return siblings;
XhmikosR's avatar
Dist    
XhmikosR committed
832
833
    }
  };
Mark Otto's avatar
dist    
Mark Otto committed
834

XhmikosR's avatar
Dist    
XhmikosR committed
835
836
837
838
839
840
841
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

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

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

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


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

XhmikosR's avatar
Dist    
XhmikosR committed
879
880
881
    // Public
    _proto.close = function close(element) {
      var rootElement = this._element;
Mark Otto's avatar
dist  
Mark Otto committed
882

XhmikosR's avatar
Dist    
XhmikosR committed
883
884
885
      if (element) {
        rootElement = this._getRootElement(element);
      }
Mark Otto's avatar
dist    
Mark Otto committed
886

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

XhmikosR's avatar
XhmikosR committed
889
      if (customEvent === null || customEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
890
891
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
892

XhmikosR's avatar
Dist    
XhmikosR committed
893
894
      this._removeElement(rootElement);
    };
Mark Otto's avatar
dist  
Mark Otto committed
895

XhmikosR's avatar
Dist    
XhmikosR committed
896
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
897
      Data.removeData(this._element, DATA_KEY);
XhmikosR's avatar
Dist    
XhmikosR committed
898
      this._element = null;
Mark Otto's avatar
Mark Otto committed
899
900
    } // Private
    ;
Mark Otto's avatar
dist  
Mark Otto committed
901

XhmikosR's avatar
Dist    
XhmikosR committed
902
    _proto._getRootElement = function _getRootElement(element) {
XhmikosR's avatar
XhmikosR committed
903
      var parent = getElementFromSelector(element);
Mark Otto's avatar
dist  
Mark Otto committed
904

XhmikosR's avatar
Dist    
XhmikosR committed
905
      if (!parent) {
XhmikosR's avatar
XhmikosR committed
906
        parent = SelectorEngine.closest(element, "." + ClassName.ALERT);
XhmikosR's avatar
Dist    
XhmikosR committed
907
      }
Mark Otto's avatar
dist  
Mark Otto committed
908

XhmikosR's avatar
Dist    
XhmikosR committed
909
910
      return parent;
    };
Mark Otto's avatar
dist  
Mark Otto committed
911

XhmikosR's avatar
Dist    
XhmikosR committed
912
    _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
XhmikosR's avatar
XhmikosR committed
913
      return EventHandler.trigger(element, Event$1.CLOSE);
XhmikosR's avatar
Dist    
XhmikosR committed
914
    };
Mark Otto's avatar
dist  
Mark Otto committed
915

XhmikosR's avatar
Dist    
XhmikosR committed
916
917
    _proto._removeElement = function _removeElement(element) {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
918

XhmikosR's avatar
XhmikosR committed
919
      element.classList.remove(ClassName.SHOW);
Mark Otto's avatar
dist  
Mark Otto committed
920

XhmikosR's avatar
XhmikosR committed
921
      if (!element.classList.contains(ClassName.FADE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
922
        this._destroyElement(element);
Mark Otto's avatar
dist    
Mark Otto committed
923

XhmikosR's avatar
Dist    
XhmikosR committed
924
925
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
926

XhmikosR's avatar
XhmikosR committed
927
      var transitionDuration = getTransitionDurationFromElement(element);
928
929
      EventHandler.one(element, TRANSITION_END, function () {
        return _this._destroyElement(element);
XhmikosR's avatar
XhmikosR committed
930
931
      });
      emulateTransitionEnd(element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
932
    };
Mark Otto's avatar
dist  
Mark Otto committed
933

XhmikosR's avatar
Dist    
XhmikosR committed
934
    _proto._destroyElement = function _destroyElement(element) {
XhmikosR's avatar
XhmikosR committed
935
936
937
938
939
      if (element.parentNode) {
        element.parentNode.removeChild(element);
      }

      EventHandler.trigger(element, Event$1.CLOSED);
Mark Otto's avatar
Mark Otto committed
940
941
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
942

XhmikosR's avatar
XhmikosR committed
943
    Alert.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
944
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
945
        var data = Data.getData(this, DATA_KEY);
Mark Otto's avatar
dist  
Mark Otto committed
946

XhmikosR's avatar
Dist    
XhmikosR committed
947
948
949
        if (!data) {
          data = new Alert(this);
        }
Mark Otto's avatar
dist  
Mark Otto committed
950

XhmikosR's avatar
Dist    
XhmikosR committed
951
952
953
954
955
        if (config === 'close') {
          data[config](this);
        }
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
956

XhmikosR's avatar
XhmikosR committed
957
    Alert.handleDismiss = function handleDismiss(alertInstance) {
XhmikosR's avatar
Dist    
XhmikosR committed
958
959
960
961
      return function (event) {
        if (event) {
          event.preventDefault();
        }
Mark Otto's avatar
dist  
Mark Otto committed
962

XhmikosR's avatar
Dist    
XhmikosR committed
963
        alertInstance.close(this);
Mark Otto's avatar
dist  
Mark Otto committed
964
      };
XhmikosR's avatar
Dist    
XhmikosR committed
965
    };
Mark Otto's avatar
dist  
Mark Otto committed
966

XhmikosR's avatar
XhmikosR committed
967
    Alert.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
968
969
970
      return Data.getData(element, DATA_KEY);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
971
972
973
974
975
976
    _createClass(Alert, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION;
      }
    }]);
Mark Otto's avatar
dist  
Mark Otto committed
977

XhmikosR's avatar
Dist    
XhmikosR committed
978
979
980
981
982
983
984
    return Alert;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
985

Mark Otto's avatar
dist    
Mark Otto committed
986

XhmikosR's avatar
XhmikosR committed
987
988
  EventHandler.on(document, Event$1.CLICK_DATA_API, Selector.DISMISS, Alert.handleDismiss(new Alert()));
  var $$1 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
989
990
991
992
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
993
   * add .alert to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
994
   */
Mark Otto's avatar
dist  
Mark Otto committed
995

996
997
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
998
999
1000
1001
  if ($$1) {
    var JQUERY_NO_CONFLICT = $$1.fn[NAME];
    $$1.fn[NAME] = Alert.jQueryInterface;
    $$1.fn[NAME].Constructor = Alert;
Mark Otto's avatar
dist  
Mark Otto committed
1002

XhmikosR's avatar
XhmikosR committed
1003
1004
1005
    $$1.fn[NAME].noConflict = function () {
      $$1.fn[NAME] = JQUERY_NO_CONFLICT;
      return Alert.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
1006
1007
    };
  }
Mark Otto's avatar
dist  
Mark Otto committed
1008

XhmikosR's avatar
Dist    
XhmikosR committed
1009
1010
1011
1012
1013
1014
1015
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

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

XhmikosR's avatar
Dist    
XhmikosR committed
1043
1044
1045
1046
1047
  var Button =
  /*#__PURE__*/
  function () {
    function Button(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
1048
      Data.setData(element, DATA_KEY$1, this);
XhmikosR's avatar
Dist    
XhmikosR committed
1049
    } // Getters
Mark Otto's avatar
dist  
Mark Otto committed
1050
1051


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

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

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

XhmikosR's avatar
XhmikosR committed
1063
1064
1065
1066
1067
        if (input && input.type === 'radio') {
          if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
            triggerChangeEvent = false;
          } else {
            var activeElement = SelectorEngine.findOne(Selector$1.ACTIVE, rootElement);
Mark Otto's avatar
dist  
Mark Otto committed
1068

XhmikosR's avatar
XhmikosR committed
1069
1070
            if (activeElement) {
              activeElement.classList.remove(ClassName$1.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
1071
1072
            }
          }
Mark Otto's avatar
dist    
Mark Otto committed
1073

XhmikosR's avatar
Dist    
XhmikosR committed
1074
1075
1076
          if (triggerChangeEvent) {
            if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
              return;
Mark Otto's avatar
dist  
Mark Otto committed
1077
            }
Mark Otto's avatar
dist    
Mark Otto committed
1078

XhmikosR's avatar
Dist    
XhmikosR committed
1079
            input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
XhmikosR's avatar
XhmikosR committed
1080
            EventHandler.trigger(input, 'change');
Mark Otto's avatar
dist  
Mark Otto committed
1081
1082
          }

XhmikosR's avatar
Dist    
XhmikosR committed
1083
1084
          input.focus();
          addAriaPressed = false;
Mark Otto's avatar
dist  
Mark Otto committed
1085
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1086
      }
Mark Otto's avatar
dist  
Mark Otto committed
1087

XhmikosR's avatar
Dist    
XhmikosR committed
1088
1089
1090
      if (addAriaPressed) {
        this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
      }
Mark Otto's avatar
dist  
Mark Otto committed
1091

XhmikosR's avatar
Dist    
XhmikosR committed
1092
      if (triggerChangeEvent) {
XhmikosR's avatar
XhmikosR committed
1093
        this._element.classList.toggle(ClassName$1.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
1094
1095
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1096

XhmikosR's avatar
Dist    
XhmikosR committed
1097
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
1098
      Data.removeData(this._element, DATA_KEY$1);
XhmikosR's avatar
Dist    
XhmikosR committed
1099
      this._element = null;
Mark Otto's avatar
Mark Otto committed
1100
1101
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
1102

XhmikosR's avatar
XhmikosR committed
1103
    Button.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
1104
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1105
        var data = Data.getData(this, DATA_KEY$1);
Mark Otto's avatar
dist  
Mark Otto committed
1106

XhmikosR's avatar
Dist    
XhmikosR committed
1107
1108
1109
        if (!data) {
          data = new Button(this);
        }
Mark Otto's avatar
dist  
Mark Otto committed
1110

XhmikosR's avatar
Dist    
XhmikosR committed
1111
1112
        if (config === 'toggle') {
          data[config]();
Mark Otto's avatar
dist  
Mark Otto committed
1113
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1114
1115
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
1116

XhmikosR's avatar
XhmikosR committed
1117
    Button.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
1118
1119
1120
      return Data.getData(element, DATA_KEY$1);
    };

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

XhmikosR's avatar
Dist    
XhmikosR committed
1128
1129
1130
1131
1132
1133
1134
    return Button;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
1135
1136


XhmikosR's avatar
XhmikosR committed
1137
  EventHandler.on(document, Event$2.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1138
1139
    event.preventDefault();
    var button = event.target;
Mark Otto's avatar
dist  
Mark Otto committed
1140

XhmikosR's avatar
XhmikosR committed
1141
1142
1143
1144
1145
1146
1147
1148
    if (!button.classList.contains(ClassName$1.BUTTON)) {
      button = SelectorEngine.closest(button, Selector$1.BUTTON);
    }

    var data = Data.getData(button, DATA_KEY$1);

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

XhmikosR's avatar
XhmikosR committed
1151
1152
1153
1154
    data.toggle();
  });
  EventHandler.on(document, Event$2.FOCUS_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
    var button = SelectorEngine.closest(event.target, Selector$1.BUTTON);
XhmikosR's avatar
XhmikosR committed
1155
1156
1157
1158

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

    if (button) {
      button.classList.remove(ClassName$1.FOCUS);
    }
XhmikosR's avatar
Dist    
XhmikosR committed
1166
  });
XhmikosR's avatar
XhmikosR committed
1167
  var $$2 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
1168
1169
1170
1171
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
1172
   * add .button to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
1173
   */
Mark Otto's avatar
dist  
Mark Otto committed
1174

1175
1176
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
1177
1178
1179
1180
  if ($$2) {
    var JQUERY_NO_CONFLICT$1 = $$2.fn[NAME$1];
    $$2.fn[NAME$1] = Button.jQueryInterface;
    $$2.fn[NAME$1].Constructor = Button;
XhmikosR's avatar
XhmikosR committed
1181

XhmikosR's avatar
XhmikosR committed
1182
1183
1184
    $$2.fn[NAME$1].noConflict = function () {
      $$2.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
      return Button.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
    };
  }

  /**
   * --------------------------------------------------------------------------
   * Bootstrap (v4.3.1): dom/manipulator.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  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
1216
      return "-" + chr.toLowerCase();
XhmikosR's avatar
XhmikosR committed
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
    });
  }

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

1232
      var attributes = _objectSpread2({}, element.dataset);
Mark Otto's avatar
dist  
Mark Otto committed
1233

XhmikosR's avatar
XhmikosR committed
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
      Object.keys(attributes).forEach(function (key) {
        attributes[key] = normalizeData(attributes[key]);
      });
      return attributes;
    },
    getDataAttribute: function getDataAttribute(element, key) {
      return normalizeData(element.getAttribute("data-" + normalizeDataKey(key)));
    },
    offset: function offset(element) {
      var rect = element.getBoundingClientRect();
      return {
        top: rect.top + document.body.scrollTop,
        left: rect.left + document.body.scrollLeft
      };
    },
    position: function position(element) {
      return {
        top: element.offsetTop,
        left: element.offsetLeft
      };
    },
    toggleClass: function toggleClass(element, className) {
      if (!element) {
        return;
      }

      if (element.classList.contains(className)) {
        element.classList.remove(className);
      } else {
        element.classList.add(className);
      }
    }
XhmikosR's avatar
Dist    
XhmikosR committed
1266
  };
Mark Otto's avatar
dist  
Mark Otto committed
1267
1268

  /**
XhmikosR's avatar
Dist    
XhmikosR committed
1269
1270
1271
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
Mark Otto's avatar
dist  
Mark Otto committed
1272
   */
Mark Otto's avatar
dist    
Mark Otto committed
1273

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

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

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
  var Carousel =
  /*#__PURE__*/
  function () {
    function Carousel(element, config) {
      this._items = null;
      this._interval = null;
      this._activeElement = null;
      this._isPaused = false;
      this._isSliding = false;
      this.touchTimeout = null;
      this.touchStartX = 0;
      this.touchDeltaX = 0;
      this._config = this._getConfig(config);
      this._element = element;
XhmikosR's avatar
XhmikosR committed
1368
      this._indicatorsElement = SelectorEngine.findOne(Selector$2.INDICATORS, this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
1369
1370
1371
1372
      this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
      this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);

      this._addEventListeners();
XhmikosR's avatar
XhmikosR committed
1373
1374

      Data.setData(element, DATA_KEY$2, this);
XhmikosR's avatar
Dist    
XhmikosR committed
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
    } // Getters


    var _proto = Carousel.prototype;

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

XhmikosR's avatar
Dist    
XhmikosR committed
1387
1388
1389
    _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
1390
      if (!document.hidden && isVisible(this._element)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1391
1392
        this.next();
      }
Mark Otto's avatar
dist  
Mark Otto committed
1393
1394
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1395
1396
1397
1398
1399
    _proto.prev = function prev() {
      if (!this._isSliding) {
        this._slide(Direction.PREV);
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1400

XhmikosR's avatar
Dist    
XhmikosR committed
1401
1402
1403
1404
    _proto.pause = function pause(event) {
      if (!event) {
        this._isPaused = true;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1405

XhmikosR's avatar
XhmikosR committed
1406
1407
      if (SelectorEngine.findOne(Selector$2.NEXT_PREV, this._element)) {
        triggerTransitionEnd(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
1408
1409
        this.cycle(true);
      }
Mark Otto's avatar
dist  
Mark Otto committed
1410

XhmikosR's avatar
Dist    
XhmikosR committed
1411
1412
1413
      clearInterval(this._interval);
      this._interval = null;
    };
Mark Otto's avatar
dist  
Mark Otto committed
1414

XhmikosR's avatar
Dist    
XhmikosR committed
1415
1416
1417
1418
    _proto.cycle = function cycle(event) {
      if (!event) {
        this._isPaused = false;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1419

XhmikosR's avatar
Dist    
XhmikosR committed
1420
      if (this._interval) {
Mark Otto's avatar
dist    
Mark Otto committed
1421
1422
        clearInterval(this._interval);
        this._interval = null;
XhmikosR's avatar
Dist    
XhmikosR committed
1423
      }
Mark Otto's avatar
dist  
Mark Otto committed
1424

XhmikosR's avatar
XhmikosR committed
1425
      if (this._config && this._config.interval && !this._isPaused) {
XhmikosR's avatar
Dist    
XhmikosR committed
1426
1427
1428
        this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1429

XhmikosR's avatar
Dist    
XhmikosR committed
1430
1431
    _proto.to = function to(index) {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
1432

XhmikosR's avatar
XhmikosR committed
1433
      this._activeElement = SelectorEngine.findOne(Selector$2.ACTIVE_ITEM, this._element);
Mark Otto's avatar
dist    
Mark Otto committed
1434

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

XhmikosR's avatar
Dist    
XhmikosR committed
1437
1438
1439
      if (index > this._items.length - 1 || index < 0) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1440

XhmikosR's avatar
Dist    
XhmikosR committed
1441
      if (this._isSliding) {
XhmikosR's avatar
XhmikosR committed
1442
        EventHandler.one(this._element, Event$3.SLID, function () {
XhmikosR's avatar
Dist    
XhmikosR committed
1443
1444
1445
1446
          return _this.to(index);
        });
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1447

XhmikosR's avatar
Dist    
XhmikosR committed
1448
1449
1450
1451
1452
      if (activeIndex === index) {
        this.pause();
        this.cycle();
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1453

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

XhmikosR's avatar
Dist    
XhmikosR committed
1456
1457
      this._slide(direction, this._items[index]);
    };
Mark Otto's avatar
dist  
Mark Otto committed
1458

XhmikosR's avatar
Dist    
XhmikosR committed
1459
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
1460
1461
      EventHandler.off(this._element, EVENT_KEY$2);
      Data.removeData(this._element, DATA_KEY$2);
XhmikosR's avatar
Dist    
XhmikosR committed
1462
1463
1464
1465
1466
1467
1468
1469
      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
1470
1471
    } // Private
    ;
XhmikosR's avatar
Dist    
XhmikosR committed
1472
1473

    _proto._getConfig = function _getConfig(config) {
1474
      config = _objectSpread2({}, Default, {}, config);
XhmikosR's avatar
XhmikosR committed
1475
      typeCheckConfig(NAME$2, config, DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
1476
1477
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
1478

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

XhmikosR's avatar
Dist    
XhmikosR committed
1482
1483
1484
      if (absDeltax <= SWIPE_THRESHOLD) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1485

XhmikosR's avatar
XhmikosR committed
1486
1487
      var direction = absDeltax / this.touchDeltaX;
      this.touchDeltaX = 0; // swipe left
Mark Otto's avatar
dist    
Mark Otto committed
1488

XhmikosR's avatar
Dist    
XhmikosR committed
1489
1490
1491
      if (direction > 0) {
        this.prev();
      } // swipe right
Mark Otto's avatar
dist    
Mark Otto committed
1492

Mark Otto's avatar
dist    
Mark Otto committed
1493

XhmikosR's avatar
Dist    
XhmikosR committed
1494
1495
1496
1497
      if (direction < 0) {
        this.next();
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1498

XhmikosR's avatar
Dist    
XhmikosR committed
1499
1500
    _proto._addEventListeners = function _addEventListeners() {
      var _this2 = this;
Mark Otto's avatar
dist  
Mark Otto committed
1501

XhmikosR's avatar
Dist    
XhmikosR committed
1502
      if (this._config.keyboard) {
XhmikosR's avatar
XhmikosR committed
1503
        EventHandler.on(this._element, Event$3.KEYDOWN, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1504
1505
1506
          return _this2._keydown(event);
        });
      }
Mark Otto's avatar
dist    
Mark Otto committed
1507

XhmikosR's avatar
Dist    
XhmikosR committed
1508
      if (this._config.pause === 'hover') {
XhmikosR's avatar
XhmikosR committed
1509
        EventHandler.on(this._element, Event$3.MOUSEENTER, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1510
          return _this2.pause(event);
XhmikosR's avatar
XhmikosR committed
1511
1512
        });
        EventHandler.on(this._element, Event$3.MOUSELEAVE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1513
1514
1515
          return _this2.cycle(event);
        });
      }
Mark Otto's avatar
dist    
Mark Otto committed
1516

1517
      if (this._config.touch && this._touchSupported) {
Mark Otto's avatar
Mark Otto committed
1518
1519
        this._addTouchEventListeners();
      }
XhmikosR's avatar
Dist    
XhmikosR committed
1520
    };
Mark Otto's avatar
dist  
Mark Otto committed
1521

XhmikosR's avatar
Dist    
XhmikosR committed
1522
1523
    _proto._addTouchEventListeners = function _addTouchEventListeners() {
      var _this3 = this;
Mark Otto's avatar
dist    
Mark Otto committed
1524

XhmikosR's avatar
Dist    
XhmikosR committed
1525
      var start = function start(event) {
XhmikosR's avatar
XhmikosR committed
1526
1527
        if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
          _this3.touchStartX = event.clientX;
XhmikosR's avatar
Dist    
XhmikosR committed
1528
        } else if (!_this3._pointerEvent) {
XhmikosR's avatar
XhmikosR committed
1529
          _this3.touchStartX = event.touches[0].clientX;
Mark Otto's avatar
dist    
Mark Otto committed
1530
1531
        }
      };
Mark Otto's avatar
dist  
Mark Otto committed
1532

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

XhmikosR's avatar
Dist    
XhmikosR committed
1542
      var end = function end(event) {
XhmikosR's avatar
XhmikosR committed
1543
1544
        if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
          _this3.touchDeltaX = event.clientX - _this3.touchStartX;
XhmikosR's avatar
Dist    
XhmikosR committed
1545
1546
1547
        }

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

XhmikosR's avatar
Dist    
XhmikosR committed
1549
1550
1551
1552
1553
1554
1555
1556
1557
        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
1558

XhmikosR's avatar
Dist    
XhmikosR committed
1559
1560
1561
          if (_this3.touchTimeout) {
            clearTimeout(_this3.touchTimeout);
          }
Mark Otto's avatar
dist  
Mark Otto committed
1562

XhmikosR's avatar
Dist    
XhmikosR committed
1563
1564
1565
          _this3.touchTimeout = setTimeout(function (event) {
            return _this3.cycle(event);
          }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
Mark Otto's avatar
dist    
Mark Otto committed
1566
1567
        }
      };
Mark Otto's avatar
dist    
Mark Otto committed
1568

XhmikosR's avatar
XhmikosR committed
1569
1570
1571
1572
      makeArray(SelectorEngine.find(Selector$2.ITEM_IMG, this._element)).forEach(function (itemImg) {
        EventHandler.on(itemImg, Event$3.DRAG_START, function (e) {
          return e.preventDefault();
        });
XhmikosR's avatar
Dist    
XhmikosR committed
1573
      });
Mark Otto's avatar
dist    
Mark Otto committed
1574

XhmikosR's avatar
Dist    
XhmikosR committed
1575
      if (this._pointerEvent) {
XhmikosR's avatar
XhmikosR committed
1576
        EventHandler.on(this._element, Event$3.POINTERDOWN, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1577
1578
          return start(event);
        });
XhmikosR's avatar
XhmikosR committed
1579
        EventHandler.on(this._element, Event$3.POINTERUP, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1580
1581
          return end(event);
        });
Mark Otto's avatar
dist    
Mark Otto committed
1582

XhmikosR's avatar
Dist    
XhmikosR committed
1583
1584
        this._element.classList.add(ClassName$2.POINTER_EVENT);
      } else {
XhmikosR's avatar
XhmikosR committed
1585
        EventHandler.on(this._element, Event$3.TOUCHSTART, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1586
          return start(event);
Mark Otto's avatar
dist    
Mark Otto committed
1587
        });
XhmikosR's avatar
XhmikosR committed
1588
        EventHandler.on(this._element, Event$3.TOUCHMOVE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1589
1590
          return move(event);
        });
XhmikosR's avatar
XhmikosR committed
1591
        EventHandler.on(this._element, Event$3.TOUCHEND, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
1592
1593
1594
1595
          return end(event);
        });
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1596

XhmikosR's avatar
Dist    
XhmikosR committed
1597
1598
1599
1600
    _proto._keydown = function _keydown(event) {
      if (/input|textarea/i.test(event.target.tagName)) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1601

XhmikosR's avatar
Dist    
XhmikosR committed
1602
1603
1604
1605
1606
      switch (event.which) {
        case ARROW_LEFT_KEYCODE:
          event.preventDefault();
          this.prev();
          break;
Mark Otto's avatar
dist  
Mark Otto committed
1607

XhmikosR's avatar
Dist    
XhmikosR committed
1608
1609
1610
1611
1612
1613
        case ARROW_RIGHT_KEYCODE:
          event.preventDefault();
          this.next();
          break;
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1614

XhmikosR's avatar
Dist    
XhmikosR committed
1615
    _proto._getItemIndex = function _getItemIndex(element) {
XhmikosR's avatar
XhmikosR committed
1616
      this._items = element && element.parentNode ? makeArray(SelectorEngine.find(Selector$2.ITEM, element.parentNode)) : [];
XhmikosR's avatar
Dist    
XhmikosR committed
1617
1618
      return this._items.indexOf(element);
    };
Mark Otto's avatar
dist    
Mark Otto committed
1619

XhmikosR's avatar
Dist    
XhmikosR committed
1620
1621
1622
    _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
      var isNextDirection = direction === Direction.NEXT;
      var isPrevDirection = direction === Direction.PREV;
Mark Otto's avatar
dist    
Mark Otto committed
1623

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1629
1630
1631
      if (isGoingToWrap && !this._config.wrap) {
        return activeElement;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1632

XhmikosR's avatar
Dist    
XhmikosR committed
1633
1634
1635
1636
      var delta = direction === Direction.PREV ? -1 : 1;
      var itemIndex = (activeIndex + delta) % this._items.length;
      return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
    };
Mark Otto's avatar
dist  
Mark Otto committed
1637

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

XhmikosR's avatar
XhmikosR committed
1641
      var fromIndex = this._getItemIndex(SelectorEngine.findOne(Selector$2.ACTIVE_ITEM, this._element));
Mark Otto's avatar
dist    
Mark Otto committed
1642

XhmikosR's avatar
XhmikosR committed
1643
      return EventHandler.trigger(this._element, Event$3.SLIDE, {
XhmikosR's avatar
Dist    
XhmikosR committed
1644
1645
1646
1647
1648
1649
        relatedTarget: relatedTarget,
        direction: eventDirectionName,
        from: fromIndex,
        to: targetIndex
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
1650

XhmikosR's avatar
Dist    
XhmikosR committed
1651
1652
    _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
      if (this._indicatorsElement) {
XhmikosR's avatar
XhmikosR committed
1653
1654
1655
1656
1657
        var indicators = SelectorEngine.find(Selector$2.ACTIVE, this._indicatorsElement);

        for (var i = 0; i < indicators.length; i++) {
          indicators[i].classList.remove(ClassName$2.ACTIVE);
        }
Mark Otto's avatar
dist  
Mark Otto committed
1658

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

XhmikosR's avatar
Dist    
XhmikosR committed
1661
        if (nextIndicator) {
XhmikosR's avatar
XhmikosR committed
1662
          nextIndicator.classList.add(ClassName$2.ACTIVE);
Mark Otto's avatar
dist    
Mark Otto committed
1663
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1664
1665
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1666

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

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

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

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1678
1679
1680
1681
      var isCycling = Boolean(this._interval);
      var directionalClassName;
      var orderClassName;
      var eventDirectionName;
Mark Otto's avatar
dist  
Mark Otto committed
1682

XhmikosR's avatar
Dist    
XhmikosR committed
1683
1684
1685
1686
1687
1688
1689
1690
1691
      if (direction === Direction.NEXT) {
        directionalClassName = ClassName$2.LEFT;
        orderClassName = ClassName$2.NEXT;
        eventDirectionName = Direction.LEFT;
      } else {
        directionalClassName = ClassName$2.RIGHT;
        orderClassName = ClassName$2.PREV;
        eventDirectionName = Direction.RIGHT;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1692

XhmikosR's avatar
XhmikosR committed
1693
      if (nextElement && nextElement.classList.contains(ClassName$2.ACTIVE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1694
1695
1696
        this._isSliding = false;
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1697

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

XhmikosR's avatar
XhmikosR committed
1700
      if (slideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
1701
1702
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1703

XhmikosR's avatar
Dist    
XhmikosR committed
1704
1705
1706
1707
      if (!activeElement || !nextElement) {
        // Some weirdness is happening, so we bail
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1708

XhmikosR's avatar
Dist    
XhmikosR committed
1709
      this._isSliding = true;
Mark Otto's avatar
dist    
Mark Otto committed
1710

XhmikosR's avatar
Dist    
XhmikosR committed
1711
1712
1713
      if (isCycling) {
        this.pause();
      }
Mark Otto's avatar
dist  
Mark Otto committed
1714

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

XhmikosR's avatar
XhmikosR committed
1717
1718
1719
1720
1721
      if (this._element.classList.contains(ClassName$2.SLIDE)) {
        nextElement.classList.add(orderClassName);
        reflow(nextElement);
        activeElement.classList.add(directionalClassName);
        nextElement.classList.add(directionalClassName);
XhmikosR's avatar
Dist    
XhmikosR committed
1722
1723
1724
1725
1726
1727
1728
        var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);

        if (nextElementInterval) {
          this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
          this._config.interval = nextElementInterval;
        } else {
          this._config.interval = this._config.defaultInterval || this._config.interval;
Mark Otto's avatar
dist  
Mark Otto committed
1729
1730
        }

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

      if (isCycling) {
        this.cycle();
      }
Mark Otto's avatar
Mark Otto committed
1765
1766
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
1767

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

1771
      var _config = _objectSpread2({}, Default, {}, Manipulator.getDataAttributes(element));
Mark Otto's avatar
dist  
Mark Otto committed
1772

XhmikosR's avatar
XhmikosR committed
1773
      if (typeof config === 'object') {
1774
        _config = _objectSpread2({}, _config, {}, config);
XhmikosR's avatar
XhmikosR committed
1775
      }
Mark Otto's avatar
dist  
Mark Otto committed
1776

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

XhmikosR's avatar
XhmikosR committed
1779
1780
1781
1782
1783
1784
1785
1786
      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
1787
          throw new TypeError("No method named \"" + action + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
1788
        }
Mark Otto's avatar
dist  
Mark Otto committed
1789

XhmikosR's avatar
XhmikosR committed
1790
1791
1792
1793
1794
1795
        data[action]();
      } else if (_config.interval && _config.ride) {
        data.pause();
        data.cycle();
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1796

XhmikosR's avatar
XhmikosR committed
1797
    Carousel.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
XhmikosR committed
1798
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
1799
        Carousel.carouselInterface(this, config);
XhmikosR's avatar
Dist    
XhmikosR committed
1800
1801
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
1802

XhmikosR's avatar
XhmikosR committed
1803
1804
    Carousel.dataApiClickHandler = function dataApiClickHandler(event) {
      var target = getElementFromSelector(this);
XhmikosR's avatar
Dist    
XhmikosR committed
1805

XhmikosR's avatar
XhmikosR committed
1806
      if (!target || !target.classList.contains(ClassName$2.CAROUSEL)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1807
1808
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
1809

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
1814
1815
      if (slideIndex) {
        config.interval = false;
Mark Otto's avatar
dist    
Mark Otto committed
1816
      }
Mark Otto's avatar
dist    
Mark Otto committed
1817

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

XhmikosR's avatar
Dist    
XhmikosR committed
1820
      if (slideIndex) {
XhmikosR's avatar
XhmikosR committed
1821
        Data.getData(target, DATA_KEY$2).to(slideIndex);
XhmikosR's avatar
Dist    
XhmikosR committed
1822
1823
1824
      }

      event.preventDefault();
Mark Otto's avatar
dist    
Mark Otto committed
1825
    };
Mark Otto's avatar
dist  
Mark Otto committed
1826

XhmikosR's avatar
XhmikosR committed
1827
    Carousel.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
1828
1829
1830
      return Data.getData(element, DATA_KEY$2);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
    _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
1843
    return Carousel;
XhmikosR's avatar
Dist    
XhmikosR committed
1844
1845
1846
1847
1848
1849
1850
1851
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


XhmikosR's avatar
XhmikosR committed
1852
  EventHandler.on(document, Event$3.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel.dataApiClickHandler);
XhmikosR's avatar
XhmikosR committed
1853
1854
  EventHandler.on(window, Event$3.LOAD_DATA_API, function () {
    var carousels = makeArray(SelectorEngine.find(Selector$2.DATA_RIDE));
XhmikosR's avatar
Dist    
XhmikosR committed
1855
1856

    for (var i = 0, len = carousels.length; i < len; i++) {
XhmikosR's avatar
XhmikosR committed
1857
      Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY$2));
XhmikosR's avatar
Dist    
XhmikosR committed
1858
1859
    }
  });
XhmikosR's avatar
XhmikosR committed
1860
  var $$3 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
1861
1862
1863
1864
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
1865
   * add .carousel to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
1866
1867
   */

1868
1869
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
1870
1871
1872
1873
  if ($$3) {
    var JQUERY_NO_CONFLICT$2 = $$3.fn[NAME$2];
    $$3.fn[NAME$2] = Carousel.jQueryInterface;
    $$3.fn[NAME$2].Constructor = Carousel;
XhmikosR's avatar
Dist    
XhmikosR committed
1874

XhmikosR's avatar
XhmikosR committed
1875
1876
1877
    $$3.fn[NAME$2].noConflict = function () {
      $$3.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
      return Carousel.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
1878
1879
    };
  }
Mark Otto's avatar
dist  
Mark Otto committed
1880

XhmikosR's avatar
Dist    
XhmikosR committed
1881
1882
1883
1884
1885
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
1886

XhmikosR's avatar
Dist    
XhmikosR committed
1887
  var NAME$3 = 'collapse';
XhmikosR's avatar
XhmikosR committed
1888
  var VERSION$3 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
  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
1900
  var Event$4 = {
XhmikosR's avatar
Dist    
XhmikosR committed
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
    SHOW: "show" + EVENT_KEY$3,
    SHOWN: "shown" + EVENT_KEY$3,
    HIDE: "hide" + EVENT_KEY$3,
    HIDDEN: "hidden" + EVENT_KEY$3,
    CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  };
  var ClassName$3 = {
    SHOW: 'show',
    COLLAPSE: 'collapse',
    COLLAPSING: 'collapsing',
    COLLAPSED: 'collapsed'
  };
  var Dimension = {
    WIDTH: 'width',
    HEIGHT: 'height'
  };
  var Selector$3 = {
    ACTIVES: '.show, .collapsing',
    DATA_TOGGLE: '[data-toggle="collapse"]'
  };
XhmikosR's avatar
XhmikosR committed
1921
1922
1923
1924
1925
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
1926

XhmikosR's avatar
Dist    
XhmikosR committed
1927
1928
1929
1930
1931
1932
1933
  var Collapse =
  /*#__PURE__*/
  function () {
    function Collapse(element, config) {
      this._isTransitioning = false;
      this._element = element;
      this._config = this._getConfig(config);
XhmikosR's avatar
XhmikosR committed
1934
1935
      this._triggerArray = makeArray(SelectorEngine.find("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
      var toggleList = makeArray(SelectorEngine.find(Selector$3.DATA_TOGGLE));
XhmikosR's avatar
Dist    
XhmikosR committed
1936
1937
1938

      for (var i = 0, len = toggleList.length; i < len; i++) {
        var elem = toggleList[i];
XhmikosR's avatar
XhmikosR committed
1939
1940
        var selector = getSelectorFromElement(elem);
        var filterElement = makeArray(SelectorEngine.find(selector)).filter(function (foundElem) {
XhmikosR's avatar
Dist    
XhmikosR committed
1941
1942
          return foundElem === element;
        });
Mark Otto's avatar
dist  
Mark Otto committed
1943

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

XhmikosR's avatar
Dist    
XhmikosR committed
1947
          this._triggerArray.push(elem);
Mark Otto's avatar
dist    
Mark Otto committed
1948
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1949
      }
Mark Otto's avatar
dist  
Mark Otto committed
1950

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

XhmikosR's avatar
Dist    
XhmikosR committed
1953
1954
1955
      if (!this._config.parent) {
        this._addAriaAndCollapsedClass(this._element, this._triggerArray);
      }
Mark Otto's avatar
dist  
Mark Otto committed
1956

XhmikosR's avatar
Dist    
XhmikosR committed
1957
1958
1959
      if (this._config.toggle) {
        this.toggle();
      }
XhmikosR's avatar
XhmikosR committed
1960
1961

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


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

XhmikosR's avatar
Dist    
XhmikosR committed
1967
1968
    // Public
    _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
1969
      if (this._element.classList.contains(ClassName$3.SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1970
1971
1972
1973
1974
        this.hide();
      } else {
        this.show();
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
1975

XhmikosR's avatar
Dist    
XhmikosR committed
1976
1977
    _proto.show = function show() {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
1978

XhmikosR's avatar
XhmikosR committed
1979
      if (this._isTransitioning || this._element.classList.contains(ClassName$3.SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
1980
1981
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
1982

XhmikosR's avatar
Dist    
XhmikosR committed
1983
1984
      var actives;
      var activesData;
Mark Otto's avatar
dist    
Mark Otto committed
1985

XhmikosR's avatar
Dist    
XhmikosR committed
1986
      if (this._parent) {
XhmikosR's avatar
XhmikosR committed
1987
        actives = makeArray(SelectorEngine.find(Selector$3.ACTIVES, this._parent)).filter(function (elem) {
XhmikosR's avatar
Dist    
XhmikosR committed
1988
1989
          if (typeof _this._config.parent === 'string') {
            return elem.getAttribute('data-parent') === _this._config.parent;
Mark Otto's avatar
dist    
Mark Otto committed
1990
          }
Mark Otto's avatar
dist  
Mark Otto committed
1991

XhmikosR's avatar
Dist    
XhmikosR committed
1992
1993
          return elem.classList.contains(ClassName$3.COLLAPSE);
        });
Mark Otto's avatar
dist    
Mark Otto committed
1994

XhmikosR's avatar
Dist    
XhmikosR committed
1995
1996
        if (actives.length === 0) {
          actives = null;
Mark Otto's avatar
dist  
Mark Otto committed
1997
        }
XhmikosR's avatar
Dist    
XhmikosR committed
1998
      }
Mark Otto's avatar
dist  
Mark Otto committed
1999

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

XhmikosR's avatar
Dist    
XhmikosR committed
2002
      if (actives) {
XhmikosR's avatar
XhmikosR committed
2003
2004
2005
2006
        var tempActiveData = actives.filter(function (elem) {
          return container !== elem;
        });
        activesData = tempActiveData[0] ? Data.getData(tempActiveData[0], DATA_KEY$3) : null;
Mark Otto's avatar
dist    
Mark Otto committed
2007

XhmikosR's avatar
Dist    
XhmikosR committed
2008
        if (activesData && activesData._isTransitioning) {
Mark Otto's avatar
dist    
Mark Otto committed
2009
2010
          return;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
2011
      }
Mark Otto's avatar
dist  
Mark Otto committed
2012

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

XhmikosR's avatar
XhmikosR committed
2015
      if (startEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2016
2017
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
2018

XhmikosR's avatar
Dist    
XhmikosR committed
2019
      if (actives) {
XhmikosR's avatar
XhmikosR committed
2020
2021
        actives.forEach(function (elemActive) {
          if (container !== elemActive) {
XhmikosR's avatar
XhmikosR committed
2022
            Collapse.collapseInterface(elemActive, 'hide');
XhmikosR's avatar
XhmikosR committed
2023
          }
Mark Otto's avatar
dist  
Mark Otto committed
2024

XhmikosR's avatar
XhmikosR committed
2025
2026
2027
2028
          if (!activesData) {
            Data.setData(elemActive, DATA_KEY$3, null);
          }
        });
XhmikosR's avatar
Dist    
XhmikosR committed
2029
      }
Mark Otto's avatar
dist  
Mark Otto committed
2030

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

XhmikosR's avatar
XhmikosR committed
2033
2034
2035
2036
      this._element.classList.remove(ClassName$3.COLLAPSE);

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
2039
      if (this._triggerArray.length) {
XhmikosR's avatar
XhmikosR committed
2040
2041
2042
2043
        this._triggerArray.forEach(function (element) {
          element.classList.remove(ClassName$3.COLLAPSED);
          element.setAttribute('aria-expanded', true);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
2044
      }
Mark Otto's avatar
dist  
Mark Otto committed
2045

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

XhmikosR's avatar
Dist    
XhmikosR committed
2048
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
2049
2050
2051
2052
2053
2054
        _this._element.classList.remove(ClassName$3.COLLAPSING);

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
2055
2056
2057
2058
        _this._element.style[dimension] = '';

        _this.setTransitioning(false);

XhmikosR's avatar
XhmikosR committed
2059
        EventHandler.trigger(_this._element, Event$4.SHOWN);
Mark Otto's avatar
dist    
Mark Otto committed
2060
      };
Mark Otto's avatar
dist  
Mark Otto committed
2061

XhmikosR's avatar
Dist    
XhmikosR committed
2062
2063
      var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
      var scrollSize = "scroll" + capitalizedDimension;
XhmikosR's avatar
XhmikosR committed
2064
2065
2066
      var transitionDuration = getTransitionDurationFromElement(this._element);
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
2067
2068
      this._element.style[dimension] = this._element[scrollSize] + "px";
    };
Mark Otto's avatar
dist  
Mark Otto committed
2069

XhmikosR's avatar
Dist    
XhmikosR committed
2070
2071
2072
    _proto.hide = function hide() {
      var _this2 = this;

XhmikosR's avatar
XhmikosR committed
2073
      if (this._isTransitioning || !this._element.classList.contains(ClassName$3.SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
2074
2075
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
2076

XhmikosR's avatar
XhmikosR committed
2077
      var startEvent = EventHandler.trigger(this._element, Event$4.HIDE);
Mark Otto's avatar
dist    
Mark Otto committed
2078

XhmikosR's avatar
XhmikosR committed
2079
      if (startEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
2080
2081
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
2082

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

XhmikosR's avatar
Dist    
XhmikosR committed
2085
      this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
XhmikosR's avatar
XhmikosR committed
2086
2087
2088
2089
2090
2091
2092
2093
      reflow(this._element);

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

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

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
2096
2097
2098
      if (triggerArrayLength > 0) {
        for (var i = 0; i < triggerArrayLength; i++) {
          var trigger = this._triggerArray[i];
XhmikosR's avatar
XhmikosR committed
2099
          var elem = getElementFromSelector(trigger);
Mark Otto's avatar
dist    
Mark Otto committed
2100

XhmikosR's avatar
XhmikosR committed
2101
2102
2103
          if (elem && !elem.classList.contains(ClassName$3.SHOW)) {
            trigger.classList.add(ClassName$3.COLLAPSED);
            trigger.setAttribute('aria-expanded', false);
Mark Otto's avatar
dist  
Mark Otto committed
2104
2105
          }
        }
XhmikosR's avatar
Dist    
XhmikosR committed
2106
      }
Mark Otto's avatar
dist  
Mark Otto committed
2107

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

XhmikosR's avatar
Dist    
XhmikosR committed
2110
2111
      var complete = function complete() {
        _this2.setTransitioning(false);
Mark Otto's avatar
dist  
Mark Otto committed
2112

XhmikosR's avatar
XhmikosR committed
2113
2114
2115
2116
2117
        _this2._element.classList.remove(ClassName$3.COLLAPSING);

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

        EventHandler.trigger(_this2._element, Event$4.HIDDEN);
Mark Otto's avatar
dist    
Mark Otto committed
2118
      };
Mark Otto's avatar
dist  
Mark Otto committed
2119

XhmikosR's avatar
Dist    
XhmikosR committed
2120
      this._element.style[dimension] = '';
XhmikosR's avatar
XhmikosR committed
2121
2122
2123
      var transitionDuration = getTransitionDurationFromElement(this._element);
      EventHandler.one(this._element, TRANSITION_END, complete);
      emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
2124
    };
Mark Otto's avatar
dist  
Mark Otto committed
2125

XhmikosR's avatar
Dist    
XhmikosR committed
2126
2127
2128
    _proto.setTransitioning = function setTransitioning(isTransitioning) {
      this._isTransitioning = isTransitioning;
    };
Mark Otto's avatar
dist  
Mark Otto committed
2129

XhmikosR's avatar
Dist    
XhmikosR committed
2130
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
2131
      Data.removeData(this._element, DATA_KEY$3);
XhmikosR's avatar
Dist    
XhmikosR committed
2132
2133
2134
2135
2136
      this._config = null;
      this._parent = null;
      this._element = null;
      this._triggerArray = null;
      this._isTransitioning = null;
Mark Otto's avatar
Mark Otto committed
2137
2138
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
2139

XhmikosR's avatar
Dist    
XhmikosR committed
2140
    _proto._getConfig = function _getConfig(config) {
2141
      config = _objectSpread2({}, Default$1, {}, config);
XhmikosR's avatar
Dist    
XhmikosR committed
2142
      config.toggle = Boolean(config.toggle); // Coerce string values
Mark Otto's avatar
dist  
Mark Otto committed
2143

XhmikosR's avatar
XhmikosR committed
2144
      typeCheckConfig(NAME$3, config, DefaultType$1);
XhmikosR's avatar
Dist    
XhmikosR committed
2145
2146
      return config;
    };
Mark Otto's avatar
dist  
Mark Otto committed
2147

XhmikosR's avatar
Dist    
XhmikosR committed
2148
    _proto._getDimension = function _getDimension() {
XhmikosR's avatar
XhmikosR committed
2149
2150
      var hasWidth = this._element.classList.contains(Dimension.WIDTH);

XhmikosR's avatar
Dist    
XhmikosR committed
2151
2152
      return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
    };
Mark Otto's avatar
dist  
Mark Otto committed
2153

XhmikosR's avatar
Dist    
XhmikosR committed
2154
2155
    _proto._getParent = function _getParent() {
      var _this3 = this;
Mark Otto's avatar
dist  
Mark Otto committed
2156

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

XhmikosR's avatar
Dist.    
XhmikosR committed
2159
2160
2161
2162
      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
2163
2164
        }
      } else {
XhmikosR's avatar
Dist.    
XhmikosR committed
2165
        parent = SelectorEngine.findOne(parent);
XhmikosR's avatar
Dist    
XhmikosR committed
2166
      }
Mark Otto's avatar
dist  
Mark Otto committed
2167

XhmikosR's avatar
Dist.    
XhmikosR committed
2168
      var selector = "[data-toggle=\"collapse\"][data-parent=\"" + parent + "\"]";
XhmikosR's avatar
XhmikosR committed
2169
      makeArray(SelectorEngine.find(selector, parent)).forEach(function (element) {
XhmikosR's avatar
XhmikosR committed
2170
        var selected = getElementFromSelector(element);
2171
2172

        _this3._addAriaAndCollapsedClass(selected, [element]);
XhmikosR's avatar
Dist    
XhmikosR committed
2173
2174
2175
      });
      return parent;
    };
Mark Otto's avatar
dist  
Mark Otto committed
2176

XhmikosR's avatar
XhmikosR committed
2177
2178
2179
2180
2181
2182
    _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
      if (element) {
        var isOpen = element.classList.contains(ClassName$3.SHOW);

        if (triggerArray.length) {
          triggerArray.forEach(function (elem) {
XhmikosR's avatar
Dist.    
XhmikosR committed
2183
            if (isOpen) {
XhmikosR's avatar
XhmikosR committed
2184
              elem.classList.remove(ClassName$3.COLLAPSED);
XhmikosR's avatar
Dist.    
XhmikosR committed
2185
2186
            } else {
              elem.classList.add(ClassName$3.COLLAPSED);
XhmikosR's avatar
XhmikosR committed
2187
            }
Mark Otto's avatar
dist  
Mark Otto committed
2188

XhmikosR's avatar
XhmikosR committed
2189
2190
2191
            elem.setAttribute('aria-expanded', isOpen);
          });
        }
XhmikosR's avatar
Dist    
XhmikosR committed
2192
      }
Mark Otto's avatar
Mark Otto committed
2193
2194
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
2195

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

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

XhmikosR's avatar
XhmikosR committed
2201
2202
2203
      if (!data && _config.toggle && /show|hide/.test(config)) {
        _config.toggle = false;
      }
Mark Otto's avatar
dist    
Mark Otto committed
2204

XhmikosR's avatar
XhmikosR committed
2205
2206
2207
2208
2209
2210
      if (!data) {
        data = new Collapse(element, _config);
      }

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

XhmikosR's avatar
XhmikosR committed
2214
2215
2216
        data[config]();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
2217

XhmikosR's avatar
XhmikosR committed
2218
    Collapse.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
XhmikosR committed
2219
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
2220
        Collapse.collapseInterface(this, config);
XhmikosR's avatar
Dist    
XhmikosR committed
2221
2222
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
2223

XhmikosR's avatar
XhmikosR committed
2224
    Collapse.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
2225
2226
2227
      return Data.getData(element, DATA_KEY$3);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
    _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
2239

XhmikosR's avatar
Dist    
XhmikosR committed
2240
2241
2242
2243
2244
2245
2246
    return Collapse;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
2247

Mark Otto's avatar
dist  
Mark Otto committed
2248

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

XhmikosR's avatar
XhmikosR committed
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
    var triggerData = Manipulator.getDataAttributes(this);
    var selector = getSelectorFromElement(this);
    var selectorElements = makeArray(SelectorEngine.find(selector));
    selectorElements.forEach(function (element) {
      var data = Data.getData(element, DATA_KEY$3);
      var config;

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

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

XhmikosR's avatar
XhmikosR committed
2274
      Collapse.collapseInterface(element, config);
XhmikosR's avatar
Dist    
XhmikosR committed
2275
2276
    });
  });
XhmikosR's avatar
XhmikosR committed
2277
  var $$4 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
2278
2279
2280
2281
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
2282
   * add .collapse to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
2283
   */
Mark Otto's avatar
dist    
Mark Otto committed
2284

2285
2286
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
2287
2288
2289
2290
  if ($$4) {
    var JQUERY_NO_CONFLICT$3 = $$4.fn[NAME$3];
    $$4.fn[NAME$3] = Collapse.jQueryInterface;
    $$4.fn[NAME$3].Constructor = Collapse;
Mark Otto's avatar
dist  
Mark Otto committed
2291

XhmikosR's avatar
XhmikosR committed
2292
2293
2294
    $$4.fn[NAME$3].noConflict = function () {
      $$4.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
      return Collapse.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
2295
2296
    };
  }
Mark Otto's avatar
dist  
Mark Otto committed
2297

Mark Otto's avatar
dist    
Mark Otto committed
2298
2299
  /**!
   * @fileOverview Kickass library to create and place poppers near their reference elements.
XhmikosR's avatar
XhmikosR committed
2300
   * @version 1.16.0
Mark Otto's avatar
dist    
Mark Otto committed
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
   * @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
2322
2323
2324
2325
2326
2327
2328
2329
  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
2330
    }
XhmikosR's avatar
XhmikosR committed
2331
2332
    return 0;
  }();
Mark Otto's avatar
dist  
Mark Otto committed
2333

Mark Otto's avatar
dist    
Mark Otto committed
2334
2335
2336
2337
2338
2339
2340
2341
2342
  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
2343
        fn();
Mark Otto's avatar
dist    
Mark Otto committed
2344
2345
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
2346
2347
  }

Mark Otto's avatar
dist    
Mark Otto committed
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
  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
2359
2360
  }

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

Mark Otto's avatar
dist    
Mark Otto committed
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
  /**
  * 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
2373

Mark Otto's avatar
dist    
Mark Otto committed
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
  /**
   * 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
2384
2385
  }

Mark Otto's avatar
dist    
Mark Otto committed
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
  /**
   * 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
2396
    }
Mark Otto's avatar
dist    
Mark Otto committed
2397
    // NOTE: 1 DOM access here
XhmikosR's avatar
Dist    
XhmikosR committed
2398
2399
    var window = element.ownerDocument.defaultView;
    var css = window.getComputedStyle(element, null);
Mark Otto's avatar
dist    
Mark Otto committed
2400
    return property ? css[property] : css;
Mark Otto's avatar
dist  
Mark Otto committed
2401
2402
  }

Mark Otto's avatar
dist    
Mark Otto committed
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
  /**
   * 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
2415
2416
  }

Mark Otto's avatar
dist    
Mark Otto committed
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
  /**
   * 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
2429

Mark Otto's avatar
dist    
Mark Otto committed
2430
2431
2432
2433
2434
2435
2436
    switch (element.nodeName) {
      case 'HTML':
      case 'BODY':
        return element.ownerDocument.body;
      case '#document':
        return element.body;
    }
Mark Otto's avatar
dist  
Mark Otto committed
2437

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

Mark Otto's avatar
dist    
Mark Otto committed
2440
2441
2442
2443
    var _getStyleComputedProp = getStyleComputedProperty(element),
        overflow = _getStyleComputedProp.overflow,
        overflowX = _getStyleComputedProp.overflowX,
        overflowY = _getStyleComputedProp.overflowY;
Mark Otto's avatar
dist  
Mark Otto committed
2444

Mark Otto's avatar
dist    
Mark Otto committed
2445
2446
    if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
      return element;
Mark Otto's avatar
dist  
Mark Otto committed
2447
2448
    }

Mark Otto's avatar
dist    
Mark Otto committed
2449
    return getScrollParent(getParentNode(element));
Mark Otto's avatar
dist  
Mark Otto committed
2450
2451
  }

XhmikosR's avatar
XhmikosR committed
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
  /**
   * 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
2463
2464
2465
  var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);

Mark Otto's avatar
dist    
Mark Otto committed
2466
  /**
Mark Otto's avatar
dist    
Mark Otto committed
2467
   * Determines if the browser is Internet Explorer
Mark Otto's avatar
dist    
Mark Otto committed
2468
2469
   * @method
   * @memberof Popper.Utils
Mark Otto's avatar
dist    
Mark Otto committed
2470
   * @param {Number} version to check
Mark Otto's avatar
dist    
Mark Otto committed
2471
2472
   * @returns {Boolean} isIE
   */
Mark Otto's avatar
dist    
Mark Otto committed
2473
2474
2475
  function isIE(version) {
    if (version === 11) {
      return isIE11;
Mark Otto's avatar
dist    
Mark Otto committed
2476
    }
Mark Otto's avatar
dist    
Mark Otto committed
2477
2478
    if (version === 10) {
      return isIE10;
Mark Otto's avatar
dist    
Mark Otto committed
2479
    }
Mark Otto's avatar
dist    
Mark Otto committed
2480
2481
    return isIE11 || isIE10;
  }
Mark Otto's avatar
dist  
Mark Otto committed
2482

Mark Otto's avatar
dist    
Mark Otto committed
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
  /**
   * 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
2493
2494
    }

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

Mark Otto's avatar
dist    
Mark Otto committed
2497
    // NOTE: 1 DOM access here
XhmikosR's avatar
Dist    
XhmikosR committed
2498
    var offsetParent = element.offsetParent || null;
Mark Otto's avatar
dist    
Mark Otto committed
2499
2500
2501
2502
    // 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
2503

Mark Otto's avatar
dist    
Mark Otto committed
2504
    var nodeName = offsetParent && offsetParent.nodeName;
Mark Otto's avatar
dist  
Mark Otto committed
2505

Mark Otto's avatar
dist    
Mark Otto committed
2506
2507
2508
    if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
      return element ? element.ownerDocument.documentElement : document.documentElement;
    }
Mark Otto's avatar
dist  
Mark Otto committed
2509

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

Mark Otto's avatar
dist    
Mark Otto committed
2516
    return offsetParent;
Mark Otto's avatar
dist  
Mark Otto committed
2517
2518
  }

Mark Otto's avatar
dist    
Mark Otto committed
2519
2520
  function isOffsetContainer(element) {
    var nodeName = element.nodeName;
Mark Otto's avatar
dist  
Mark Otto committed
2521

Mark Otto's avatar
dist    
Mark Otto committed
2522
2523
    if (nodeName === 'BODY') {
      return false;
Mark Otto's avatar
dist  
Mark Otto committed
2524
    }
Mark Otto's avatar
dist    
Mark Otto committed
2525
    return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
Mark Otto's avatar
dist  
Mark Otto committed
2526
2527
  }

Mark Otto's avatar
dist    
Mark Otto committed
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
  /**
   * 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
2539

Mark Otto's avatar
dist    
Mark Otto committed
2540
    return node;
Mark Otto's avatar
dist  
Mark Otto committed
2541
2542
  }

Mark Otto's avatar
dist    
Mark Otto committed
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
  /**
   * 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
2556

Mark Otto's avatar
dist    
Mark Otto committed
2557
2558
2559
2560
    // 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
2561

Mark Otto's avatar
dist    
Mark Otto committed
2562
2563
2564
2565
2566
    // 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
2567

Mark Otto's avatar
dist    
Mark Otto committed
2568
    // Both nodes are inside #document
Mark Otto's avatar
dist  
Mark Otto committed
2569

Mark Otto's avatar
dist    
Mark Otto committed
2570
2571
2572
2573
    if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
      if (isOffsetContainer(commonAncestorContainer)) {
        return commonAncestorContainer;
      }
Mark Otto's avatar
dist  
Mark Otto committed
2574

Mark Otto's avatar
dist    
Mark Otto committed
2575
2576
      return getOffsetParent(commonAncestorContainer);
    }
Mark Otto's avatar
dist  
Mark Otto committed
2577

Mark Otto's avatar
dist    
Mark Otto committed
2578
2579
2580
2581
    // 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
2582
    } else {
Mark Otto's avatar
dist    
Mark Otto committed
2583
      return findCommonOffsetParent(element1, getRoot(element2).host);
Mark Otto's avatar
dist  
Mark Otto committed
2584
    }
Mark Otto's avatar
dist    
Mark Otto committed
2585
  }
Mark Otto's avatar
dist  
Mark Otto committed
2586

Mark Otto's avatar
dist    
Mark Otto committed
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
  /**
   * 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
2597

Mark Otto's avatar
dist    
Mark Otto committed
2598
2599
    var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
    var nodeName = element.nodeName;
Mark Otto's avatar
dist  
Mark Otto committed
2600

Mark Otto's avatar
dist    
Mark Otto committed
2601
2602
2603
2604
    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
2605
2606
    }

Mark Otto's avatar
dist    
Mark Otto committed
2607
    return element[upperSide];
Mark Otto's avatar
dist  
Mark Otto committed
2608
2609
  }

Mark Otto's avatar
dist    
Mark Otto committed
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
  /*
   * 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
2631

Mark Otto's avatar
dist    
Mark Otto committed
2632
2633
2634
2635
2636
2637
2638
2639
2640
  /*
   * 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
2641

Mark Otto's avatar
dist    
Mark Otto committed
2642
2643
2644
  function getBordersSize(styles, axis) {
    var sideA = axis === 'x' ? 'Left' : 'Top';
    var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
Mark Otto's avatar
dist  
Mark Otto committed
2645

Mark Otto's avatar
dist    
Mark Otto committed
2646
    return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10);
Mark Otto's avatar
dist  
Mark Otto committed
2647
2648
  }

Mark Otto's avatar
dist    
Mark Otto committed
2649
  function getSize(axis, body, html, computedStyle) {
Mark Otto's avatar
dist    
Mark Otto committed
2650
    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
2651
2652
  }

Mark Otto's avatar
dist    
Mark Otto committed
2653
  function getWindowSizes(document) {
Mark Otto's avatar
dist    
Mark Otto committed
2654
2655
2656
    var body = document.body;
    var html = document.documentElement;
    var computedStyle = isIE(10) && getComputedStyle(html);
Mark Otto's avatar
dist  
Mark Otto committed
2657

Mark Otto's avatar
dist    
Mark Otto committed
2658
2659
2660
2661
    return {
      height: getSize('Height', body, html, computedStyle),
      width: getSize('Width', body, html, computedStyle)
    };
Mark Otto's avatar
dist  
Mark Otto committed
2662
2663
  }

Mark Otto's avatar
dist    
Mark Otto committed
2664
2665
2666
2667
  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
2668
2669
  };

Mark Otto's avatar
dist    
Mark Otto committed
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
  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
2680

Mark Otto's avatar
dist    
Mark Otto committed
2681
2682
2683
2684
2685
2686
    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
2687
2688
2689
2690
2691





Mark Otto's avatar
dist    
Mark Otto committed
2692
2693
2694
2695
2696
2697
2698
2699
  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
2700
    } else {
Mark Otto's avatar
dist    
Mark Otto committed
2701
      obj[key] = value;
Mark Otto's avatar
dist  
Mark Otto committed
2702
2703
    }

Mark Otto's avatar
dist    
Mark Otto committed
2704
2705
    return obj;
  };
Mark Otto's avatar
dist  
Mark Otto committed
2706

Mark Otto's avatar
dist    
Mark Otto committed
2707
2708
2709
  var _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
2710

Mark Otto's avatar
dist    
Mark Otto committed
2711
2712
2713
2714
2715
2716
      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) {
          target[key] = source[key];
        }
      }
    }
Mark Otto's avatar
dist  
Mark Otto committed
2717

Mark Otto's avatar
dist    
Mark Otto committed
2718
    return target;
Mark Otto's avatar
dist  
Mark Otto committed
2719
2720
  };

Mark Otto's avatar
dist    
Mark Otto committed
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
  /**
   * Given element offsets, generate an output similar to getBoundingClientRect
   * @method
   * @memberof Popper.Utils
   * @argument {Object} offsets
   * @returns {Object} ClientRect like output
   */
  function getClientRect(offsets) {
    return _extends({}, offsets, {
      right: offsets.left + offsets.width,
      bottom: offsets.top + offsets.height
    });
Mark Otto's avatar
dist  
Mark Otto committed
2733
2734
  }

Mark Otto's avatar
dist    
Mark Otto committed
2735
2736
2737
2738
2739
2740
2741
2742
2743
  /**
   * 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
2744

Mark Otto's avatar
dist    
Mark Otto committed
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
    // 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
2768

Mark Otto's avatar
dist    
Mark Otto committed
2769
    // subtract scrollbar size from sizes
Mark Otto's avatar
dist    
Mark Otto committed
2770
    var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
XhmikosR's avatar
XhmikosR committed
2771
2772
    var width = sizes.width || element.clientWidth || result.width;
    var height = sizes.height || element.clientHeight || result.height;
Mark Otto's avatar
dist  
Mark Otto committed
2773

Mark Otto's avatar
dist    
Mark Otto committed
2774
2775
    var horizScrollbar = element.offsetWidth - width;
    var vertScrollbar = element.offsetHeight - height;
Mark Otto's avatar
dist  
Mark Otto committed
2776

Mark Otto's avatar
dist    
Mark Otto committed
2777
2778
2779
2780
2781
2782
2783
2784
2785
    // 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
2786
    }
Mark Otto's avatar
dist    
Mark Otto committed
2787
2788

    return getClientRect(result);
Mark Otto's avatar
dist  
Mark Otto committed
2789
2790
  }

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

Mark Otto's avatar
dist    
Mark Otto committed
2794
2795
2796
2797
2798
    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
2799

Mark Otto's avatar
dist    
Mark Otto committed
2800
2801
2802
    var styles = getStyleComputedProperty(parent);
    var borderTopWidth = parseFloat(styles.borderTopWidth, 10);
    var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10);
Mark Otto's avatar
dist  
Mark Otto committed
2803

Mark Otto's avatar
dist    
Mark Otto committed
2804
    // In cases where the parent is fixed, we must ignore negative scroll in offset calc
Mark Otto's avatar
dist    
Mark Otto committed
2805
    if (fixedPosition && isHTML) {
Mark Otto's avatar
dist    
Mark Otto committed
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
      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) {
      var marginTop = parseFloat(styles.marginTop, 10);
      var marginLeft = parseFloat(styles.marginLeft, 10);

      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
2835

Mark Otto's avatar
dist    
Mark Otto committed
2836
2837
2838
    if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
      offsets = includeScroll(offsets, parent);
    }
Mark Otto's avatar
dist  
Mark Otto committed
2839

Mark Otto's avatar
dist    
Mark Otto committed
2840
    return offsets;
Mark Otto's avatar
dist  
Mark Otto committed
2841
2842
  }

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

Mark Otto's avatar
dist    
Mark Otto committed
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
    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
2860

Mark Otto's avatar
dist    
Mark Otto committed
2861
    return getClientRect(offset);
Mark Otto's avatar
dist  
Mark Otto committed
2862
2863
  }

Mark Otto's avatar
dist    
Mark Otto committed
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
  /**
   * 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
2876
    }
Mark Otto's avatar
dist    
Mark Otto committed
2877
2878
2879
    if (getStyleComputedProperty(element, 'position') === 'fixed') {
      return true;
    }
Mark Otto's avatar
Mark Otto committed
2880
2881
2882
2883
2884
    var parentNode = getParentNode(element);
    if (!parentNode) {
      return false;
    }
    return isFixed(parentNode);
Mark Otto's avatar
dist    
Mark Otto committed
2885
  }
Mark Otto's avatar
dist  
Mark Otto committed
2886

Mark Otto's avatar
dist    
Mark Otto committed
2887
2888
2889
2890
2891
2892
2893
  /**
   * 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
2894

Mark Otto's avatar
dist    
Mark Otto committed
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
  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
2906

Mark Otto's avatar
dist    
Mark Otto committed
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
  /**
   * 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
2920

Mark Otto's avatar
dist    
Mark Otto committed
2921
    // NOTE: 1 DOM access here
Mark Otto's avatar
dist  
Mark Otto committed
2922

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

Mark Otto's avatar
dist    
Mark Otto committed
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
    // 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
2942

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

Mark Otto's avatar
dist    
Mark Otto committed
2945
2946
      // In case of HTML, we need a different computation
      if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
Mark Otto's avatar
dist    
Mark Otto committed
2947
        var _getWindowSizes = getWindowSizes(popper.ownerDocument),
Mark Otto's avatar
dist    
Mark Otto committed
2948
2949
            height = _getWindowSizes.height,
            width = _getWindowSizes.width;
Mark Otto's avatar
dist  
Mark Otto committed
2950

Mark Otto's avatar
dist    
Mark Otto committed
2951
2952
2953
2954
2955
2956
2957
        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
2958
      }
Mark Otto's avatar
dist    
Mark Otto committed
2959
    }
Mark Otto's avatar
dist  
Mark Otto committed
2960

Mark Otto's avatar
dist    
Mark Otto committed
2961
    // Add paddings
Mark Otto's avatar
dist    
Mark Otto committed
2962
2963
2964
2965
2966
2967
    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
2968

Mark Otto's avatar
dist    
Mark Otto committed
2969
    return boundaries;
Mark Otto's avatar
dist  
Mark Otto committed
2970
2971
  }

Mark Otto's avatar
dist    
Mark Otto committed
2972
2973
2974
2975
2976
  function getArea(_ref) {
    var width = _ref.width,
        height = _ref.height;

    return width * height;
Mark Otto's avatar
dist  
Mark Otto committed
2977
2978
  }

Mark Otto's avatar
dist    
Mark Otto committed
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
  /**
   * 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
2990

Mark Otto's avatar
dist    
Mark Otto committed
2991
2992
    if (placement.indexOf('auto') === -1) {
      return placement;
Mark Otto's avatar
dist  
Mark Otto committed
2993
2994
    }

Mark Otto's avatar
dist    
Mark Otto committed
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
    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
3013
      }
Mark Otto's avatar
dist    
Mark Otto committed
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
    };

    var sortedAreas = Object.keys(rects).map(function (key) {
      return _extends({
        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
3024
3025
    });

Mark Otto's avatar
dist    
Mark Otto committed
3026
3027
3028
3029
    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
3030
3031
    });

Mark Otto's avatar
dist    
Mark Otto committed
3032
3033
3034
    var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;

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

Mark Otto's avatar
dist    
Mark Otto committed
3036
    return computedPlacement + (variation ? '-' + variation : '');
Mark Otto's avatar
dist  
Mark Otto committed
3037
3038
  }

Mark Otto's avatar
dist    
Mark Otto committed
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
  /**
   * 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
3051

XhmikosR's avatar
XhmikosR committed
3052
    var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
Mark Otto's avatar
dist    
Mark Otto committed
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
    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
3064
3065
    var window = element.ownerDocument.defaultView;
    var styles = window.getComputedStyle(element);
Mark Otto's avatar
dist    
Mark Otto committed
3066
3067
    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
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
    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
3104

Mark Otto's avatar
dist    
Mark Otto committed
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
    // 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
3137
  function find$1(arr, check) {
Mark Otto's avatar
dist    
Mark Otto committed
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
    // 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
3165
    var match = find$1(arr, function (obj) {
Mark Otto's avatar
dist    
Mark Otto committed
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
      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
3188
      }
Mark Otto's avatar
dist    
Mark Otto committed
3189
3190
3191
3192
3193
3194
3195
3196
3197
      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
3198
      }
Mark Otto's avatar
dist    
Mark Otto committed
3199
    });
Mark Otto's avatar
dist  
Mark Otto committed
3200

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

Mark Otto's avatar
dist    
Mark Otto committed
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
  /**
   * 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
3216

Mark Otto's avatar
dist    
Mark Otto committed
3217
3218
3219
3220
3221
3222
3223
    var data = {
      instance: this,
      styles: {},
      arrowStyles: {},
      attributes: {},
      flipped: false,
      offsets: {}
Mark Otto's avatar
dist  
Mark Otto committed
3224
3225
    };

Mark Otto's avatar
dist    
Mark Otto committed
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
    // 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
3241

Mark Otto's avatar
dist    
Mark Otto committed
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
    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
3293
   * Destroys the popper.
Mark Otto's avatar
dist    
Mark Otto committed
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
   * @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
3314
    // remove the popper if user explicitly asked for the deletion on destroy
Mark Otto's avatar
dist    
Mark Otto committed
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
    // 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
3400
   * when they are triggered. It also won't trigger `onUpdate` callback anymore,
Mark Otto's avatar
dist    
Mark Otto committed
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
   * 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
3440
3441
  }

Mark Otto's avatar
dist    
Mark Otto committed
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
  /**
   * 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
3486
3487
3488
    return data;
  }

Mark Otto's avatar
dist    
Mark Otto committed
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
  /**
   * 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
3507

Mark Otto's avatar
dist    
Mark Otto committed
3508
3509
3510
3511
3512
3513
3514
3515
3516
    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
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
  /**
   * @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
3540
3541
    var round = Math.round,
        floor = Math.floor;
Mark Otto's avatar
dist    
Mark Otto committed
3542
3543
3544
3545
3546

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

Mark Otto's avatar
Mark Otto committed
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
    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
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567

    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
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
  /**
   * @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
3582
    var legacyGpuAccelerationOption = find$1(data.instance.modifiers, function (modifier) {
Mark Otto's avatar
dist    
Mark Otto committed
3583
3584
3585
3586
      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
3587
    }
Mark Otto's avatar
dist    
Mark Otto committed
3588
3589
3590
3591
3592
3593
3594
3595
3596
    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
3597

Mark Otto's avatar
dist    
Mark Otto committed
3598
    var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
Mark Otto's avatar
dist    
Mark Otto committed
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619

    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
3620
3621
3622
3623
3624
3625
3626
      // 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
3627
3628
3629
3630
    } else {
      top = offsets.top;
    }
    if (sideB === 'right') {
Mark Otto's avatar
dist    
Mark Otto committed
3631
3632
3633
3634
3635
      if (offsetParent.nodeName === 'HTML') {
        left = -offsetParent.clientWidth + offsets.right;
      } else {
        left = -offsetParentRect.width + offsets.right;
      }
Mark Otto's avatar
dist    
Mark Otto committed
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
    } 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
    data.attributes = _extends({}, attributes, data.attributes);
    data.styles = _extends({}, styles, data.styles);
    data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);

    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
3677
    var requesting = find$1(modifiers, function (_ref) {
Mark Otto's avatar
dist    
Mark Otto committed
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
      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
3706
3707
3708
      return data;
    }

Mark Otto's avatar
dist    
Mark Otto committed
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
    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
3744
    // reference have enough pixels in conjunction
Mark Otto's avatar
dist    
Mark Otto committed
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
    //

    // 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);
    var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10);
    var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10);
    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
3774
3775
3776
  }

  /**
Mark Otto's avatar
dist    
Mark Otto committed
3777
3778
3779
3780
3781
   * 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
3782
   */
Mark Otto's avatar
dist    
Mark Otto committed
3783
3784
3785
3786
3787
3788
3789
3790
  function getOppositeVariation(variation) {
    if (variation === 'end') {
      return 'start';
    } else if (variation === 'start') {
      return 'end';
    }
    return variation;
  }
Mark Otto's avatar
dist  
Mark Otto committed
3791
3792

  /**
Mark Otto's avatar
dist    
Mark Otto committed
3793
3794
3795
3796
3797
3798
3799
   * 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
3800
   *
Mark Otto's avatar
dist    
Mark Otto committed
3801
3802
3803
   * Each placement can have a variation from this list:
   * - `-start`
   * - `-end`
Mark Otto's avatar
dist  
Mark Otto committed
3804
   *
Mark Otto's avatar
dist    
Mark Otto committed
3805
3806
3807
3808
   * 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
3809
   *
Mark Otto's avatar
dist    
Mark Otto committed
3810
3811
3812
3813
   * 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
3814
   * - `auto-end` (on the side with more space available, alignment depends by placement)
Mark Otto's avatar
dist  
Mark Otto committed
3815
   *
Mark Otto's avatar
dist    
Mark Otto committed
3816
3817
3818
3819
3820
3821
   * @static
   * @type {Array}
   * @enum {String}
   * @readonly
   * @method placements
   * @memberof Popper
Mark Otto's avatar
dist  
Mark Otto committed
3822
   */
Mark Otto's avatar
dist    
Mark Otto committed
3823
3824
3825
3826
  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
3827
3828

  /**
Mark Otto's avatar
dist    
Mark Otto committed
3829
3830
   * Given an initial placement, returns all the subsequent placements
   * clockwise (or counter-clockwise).
Mark Otto's avatar
dist  
Mark Otto committed
3831
   *
Mark Otto's avatar
dist    
Mark Otto committed
3832
3833
3834
3835
3836
   * @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
3837
   */
Mark Otto's avatar
dist    
Mark Otto committed
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
  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
3851
3852

  /**
Mark Otto's avatar
dist    
Mark Otto committed
3853
3854
3855
3856
3857
   * @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
3858
   */
Mark Otto's avatar
dist    
Mark Otto committed
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
  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
3916
3917
3918
3919
3920
3921
3922
3923

      // 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
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947

      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
        data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));

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

  /**
Mark Otto's avatar
dist    
Mark Otto committed
3950
3951
3952
3953
3954
   * @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
3955
   */
Mark Otto's avatar
dist    
Mark Otto committed
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
  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
3977
3978

  /**
Mark Otto's avatar
dist    
Mark Otto committed
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
   * 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
3989
   */
Mark Otto's avatar
dist    
Mark Otto committed
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
  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
4030
4031

  /**
Mark Otto's avatar
dist    
Mark Otto committed
4032
4033
4034
4035
4036
4037
4038
4039
4040
   * 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
4041
   */
Mark Otto's avatar
dist    
Mark Otto committed
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
  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
4058
    var divider = fragments.indexOf(find$1(fragments, function (frag) {
Mark Otto's avatar
dist    
Mark Otto committed
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
      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
4108
4109

  /**
Mark Otto's avatar
dist    
Mark Otto committed
4110
4111
4112
4113
4114
4115
4116
   * @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
4117
   */
Mark Otto's avatar
dist    
Mark Otto committed
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
  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
4151
4152

  /**
Mark Otto's avatar
dist    
Mark Otto committed
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
   * @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
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
    // 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
4182
    var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
Mark Otto's avatar
dist    
Mark Otto committed
4183
4184
4185
4186
4187
4188
4189

    // 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
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
    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';
      popper = _extends({}, popper, check[side](placement));
    });

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

      data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
    }

    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
4269
    var bound = find$1(data.instance.modifiers, function (modifier) {
Mark Otto's avatar
dist    
Mark Otto committed
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
4323
4324
      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
4325
   *
Mark Otto's avatar
dist    
Mark Otto committed
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
   * @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
4336
   *
Mark Otto's avatar
dist    
Mark Otto committed
4337
4338
4339
   * 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
4340
   */
Mark Otto's avatar
dist    
Mark Otto committed
4341
  var modifiers = {
Mark Otto's avatar
dist  
Mark Otto committed
4342
    /**
Mark Otto's avatar
dist    
Mark Otto committed
4343
4344
4345
4346
4347
4348
     * 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
4349
     */
Mark Otto's avatar
dist    
Mark Otto committed
4350
4351
4352
4353
4354
4355
4356
4357
4358
    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
4359
    /**
Mark Otto's avatar
dist    
Mark Otto committed
4360
4361
4362
     * The `offset` modifier can shift your popper on both its axis.
     *
     * It accepts the following units:
Mark Otto's avatar
dist    
Mark Otto committed
4363
     * - `px` or unit-less, interpreted as pixels
Mark Otto's avatar
dist    
Mark Otto committed
4364
4365
4366
4367
4368
4369
4370
     * - `%` 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
4371
     * `width`. In case of `left` or `right`, it will be the `height`.
Mark Otto's avatar
dist    
Mark Otto committed
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
     *
     * 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
4392
     * > 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
4393
4394
4395
     *
     * @memberof modifiers
     * @inner
Mark Otto's avatar
dist  
Mark Otto committed
4396
     */
Mark Otto's avatar
dist    
Mark Otto committed
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
    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
4410
    /**
Mark Otto's avatar
dist    
Mark Otto committed
4411
4412
     * Modifier used to prevent the popper from being positioned outside the boundary.
     *
Mark Otto's avatar
dist    
Mark Otto committed
4413
     * A scenario exists where the reference itself is not within the boundaries.<br />
Mark Otto's avatar
dist    
Mark Otto committed
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
     * 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
4426
     */
Mark Otto's avatar
dist    
Mark Otto committed
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
    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
4443
       * and the popper. This makes sure the popper always has a little padding
Mark Otto's avatar
dist    
Mark Otto committed
4444
4445
4446
4447
4448
       * between the edges of its container
       */
      padding: 5,
      /**
       * @prop {String|HTMLElement} boundariesElement='scrollParent'
Mark Otto's avatar
dist    
Mark Otto committed
4449
       * Boundaries used by the modifier. Can be `scrollParent`, `window`,
Mark Otto's avatar
dist    
Mark Otto committed
4450
4451
4452
4453
       * `viewport` or any DOM element.
       */
      boundariesElement: 'scrollParent'
    },
Mark Otto's avatar
dist  
Mark Otto committed
4454
4455

    /**
Mark Otto's avatar
dist    
Mark Otto committed
4456
4457
4458
4459
     * 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
4460
4461
4462
     * between the popper and its reference element.
     * @memberof modifiers
     * @inner
Mark Otto's avatar
dist  
Mark Otto committed
4463
     */
Mark Otto's avatar
dist    
Mark Otto committed
4464
4465
4466
4467
4468
4469
4470
4471
    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
4472

Mark Otto's avatar
dist    
Mark Otto committed
4473
4474
4475
4476
    /**
     * 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
4477
     * pixels of conjunction are needed.
Mark Otto's avatar
dist    
Mark Otto committed
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
     *
     * 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
4493

Mark Otto's avatar
dist    
Mark Otto committed
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
    /**
     * 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
4516
       * placements (with optional variations)
Mark Otto's avatar
dist    
Mark Otto committed
4517
4518
4519
4520
4521
4522
4523
4524
4525
       */
      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
4526
4527
4528
       * 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
4529
       */
XhmikosR's avatar
XhmikosR committed
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
      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
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
    },

    /**
     * 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
4608
4609
       * 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
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
       */
      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
4636
     * Just disable this modifier and define your own to achieve the desired effect.
Mark Otto's avatar
dist    
Mark Otto committed
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
     *
     * @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
4653
4654
       * 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
4655
4656
4657
4658
       */
      gpuAcceleration: undefined
    }
  };
Mark Otto's avatar
dist  
Mark Otto committed
4659
4660

  /**
Mark Otto's avatar
dist    
Mark Otto committed
4661
4662
   * 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
4663
4664
4665
4666
4667
   * @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
4668
   * @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
4669
   * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
Mark Otto's avatar
dist    
Mark Otto committed
4670
4671
   * @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
4672
   * @property {Object} data.boundaries Offsets of the popper boundaries
Mark Otto's avatar
dist    
Mark Otto committed
4673
   * @property {Object} data.offsets The measurements of popper, reference and arrow elements
Mark Otto's avatar
dist    
Mark Otto committed
4674
4675
4676
   * @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
4677
4678
4679
   */

  /**
Mark Otto's avatar
dist    
Mark Otto committed
4680
   * Default options provided to Popper.js constructor.<br />
Mark Otto's avatar
dist    
Mark Otto committed
4681
4682
4683
   * 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
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
   * ```
   * new Popper(ref, pop, {
   *   modifiers: {
   *     preventOverflow: { enabled: false }
   *   }
   * })
   * ```
   * @type {Object}
   * @static
   * @memberof Popper
Mark Otto's avatar
dist  
Mark Otto committed
4694
   */
Mark Otto's avatar
dist    
Mark Otto committed
4695
4696
  var Defaults = {
    /**
Mark Otto's avatar
dist    
Mark Otto committed
4697
     * Popper's placement.
Mark Otto's avatar
dist    
Mark Otto committed
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
     * @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
4709
     * Whether events (resize, scroll) are initially enabled.
Mark Otto's avatar
dist    
Mark Otto committed
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
     * @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
4723
     * By default, it is set to no-op.<br />
Mark Otto's avatar
dist    
Mark Otto committed
4724
4725
4726
4727
4728
4729
     * Access Popper.js instance with `data.instance`.
     * @prop {onCreate}
     */
    onCreate: function onCreate() {},

    /**
Mark Otto's avatar
dist    
Mark Otto committed
4730
     * Callback called when the popper is updated. This callback is not called
Mark Otto's avatar
dist    
Mark Otto committed
4731
4732
     * on the initialization/creation of the popper, but only on subsequent
     * updates.<br />
Mark Otto's avatar
dist    
Mark Otto committed
4733
     * By default, it is set to no-op.<br />
Mark Otto's avatar
dist    
Mark Otto committed
4734
4735
4736
4737
4738
4739
4740
     * 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
4741
     * They provide most of the functionalities of Popper.js.
Mark Otto's avatar
dist    
Mark Otto committed
4742
4743
4744
4745
     * @prop {modifiers}
     */
    modifiers: modifiers
  };
Mark Otto's avatar
dist  
Mark Otto committed
4746
4747

  /**
Mark Otto's avatar
dist    
Mark Otto committed
4748
4749
   * @callback onCreate
   * @param {dataObject} data
Mark Otto's avatar
dist  
Mark Otto committed
4750
   */
Mark Otto's avatar
dist    
Mark Otto committed
4751

Mark Otto's avatar
dist  
Mark Otto committed
4752
  /**
Mark Otto's avatar
dist    
Mark Otto committed
4753
4754
   * @callback onUpdate
   * @param {dataObject} data
Mark Otto's avatar
dist  
Mark Otto committed
4755
4756
   */

Mark Otto's avatar
dist    
Mark Otto committed
4757
4758
4759
4760
  // Utils
  // Methods
  var Popper = function () {
    /**
Mark Otto's avatar
dist    
Mark Otto committed
4761
     * Creates a new Popper.js instance.
Mark Otto's avatar
dist    
Mark Otto committed
4762
     * @class Popper
XhmikosR's avatar
XhmikosR committed
4763
4764
     * @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
4765
4766
4767
4768
4769
4770
4771
4772
     * @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
4773

Mark Otto's avatar
dist    
Mark Otto committed
4774
4775
4776
      this.scheduleUpdate = function () {
        return requestAnimationFrame(_this.update);
      };
Mark Otto's avatar
dist  
Mark Otto committed
4777

Mark Otto's avatar
dist    
Mark Otto committed
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
      // 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
      this.options = _extends({}, Popper.Defaults, options);

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

Mark Otto's avatar
dist    
Mark Otto committed
4791
4792
4793
      // 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
4794

Mark Otto's avatar
dist    
Mark Otto committed
4795
4796
4797
4798
4799
      // Deep merge modifiers options
      this.options.modifiers = {};
      Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
        _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
      });
Mark Otto's avatar
dist  
Mark Otto committed
4800

Mark Otto's avatar
dist    
Mark Otto committed
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
      // Refactoring modifiers' list (Object => Array)
      this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
        return _extends({
          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
4811

Mark Otto's avatar
dist    
Mark Otto committed
4812
4813
4814
4815
4816
4817
4818
4819
4820
      // 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
4821

Mark Otto's avatar
dist    
Mark Otto committed
4822
4823
      // fire the first update to position the popper in the right place
      this.update();
Mark Otto's avatar
dist  
Mark Otto committed
4824

Mark Otto's avatar
dist    
Mark Otto committed
4825
4826
4827
4828
      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
4829
4830
      }

Mark Otto's avatar
dist    
Mark Otto committed
4831
      this.state.eventsEnabled = eventsEnabled;
Mark Otto's avatar
dist  
Mark Otto committed
4832
4833
    }

Mark Otto's avatar
dist    
Mark Otto committed
4834
4835
    // 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
4836
4837


Mark Otto's avatar
dist    
Mark Otto committed
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
    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
4858

Mark Otto's avatar
dist    
Mark Otto committed
4859
      /**
Mark Otto's avatar
dist    
Mark Otto committed
4860
       * Schedules an update. It will run on the next UI update available.
Mark Otto's avatar
dist    
Mark Otto committed
4861
4862
4863
       * @method scheduleUpdate
       * @memberof Popper
       */
Mark Otto's avatar
dist  
Mark Otto committed
4864
4865


Mark Otto's avatar
dist    
Mark Otto committed
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
      /**
       * 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
4882

Mark Otto's avatar
dist    
Mark Otto committed
4883
4884
4885
    }]);
    return Popper;
  }();
Mark Otto's avatar
dist  
Mark Otto committed
4886
4887

  /**
Mark Otto's avatar
dist    
Mark Otto committed
4888
4889
4890
4891
4892
4893
4894
4895
4896
   * 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
4897
   * NB: This feature isn't supported in Internet Explorer 10.
Mark Otto's avatar
dist    
Mark Otto committed
4898
4899
4900
4901
4902
4903
4904
   * @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
4905
   */
Mark Otto's avatar
dist    
Mark Otto committed
4906
4907
4908
4909
4910
4911


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

XhmikosR's avatar
Dist    
XhmikosR committed
4912
4913
4914
4915
4916
4917
4918
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$4 = 'dropdown';
XhmikosR's avatar
XhmikosR committed
4919
  var VERSION$4 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
  var DATA_KEY$4 = 'bs.dropdown';
  var EVENT_KEY$4 = "." + DATA_KEY$4;
  var DATA_API_KEY$4 = '.data-api';
  var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key

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

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

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

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

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

  var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
XhmikosR's avatar
XhmikosR committed
4936
  var Event$5 = {
XhmikosR's avatar
Dist    
XhmikosR committed
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
    HIDE: "hide" + EVENT_KEY$4,
    HIDDEN: "hidden" + EVENT_KEY$4,
    SHOW: "show" + EVENT_KEY$4,
    SHOWN: "shown" + EVENT_KEY$4,
    CLICK: "click" + EVENT_KEY$4,
    CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
    KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
    KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  };
  var ClassName$4 = {
    DISABLED: 'disabled',
    SHOW: 'show',
    DROPUP: 'dropup',
    DROPRIGHT: 'dropright',
    DROPLEFT: 'dropleft',
    MENURIGHT: 'dropdown-menu-right',
    POSITION_STATIC: 'position-static'
  };
  var Selector$4 = {
    DATA_TOGGLE: '[data-toggle="dropdown"]',
    FORM_CHILD: '.dropdown form',
    MENU: '.dropdown-menu',
    NAVBAR_NAV: '.navbar-nav',
    VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  };
  var AttachmentMap = {
    TOP: 'top-start',
    TOPEND: 'top-end',
    BOTTOM: 'bottom-start',
    BOTTOMEND: 'bottom-end',
    RIGHT: 'right-start',
    RIGHTEND: 'right-end',
    LEFT: 'left-start',
    LEFTEND: 'left-end'
  };
  var Default$2 = {
    offset: 0,
    flip: true,
    boundary: 'scrollParent',
    reference: 'toggle',
XhmikosR's avatar
XhmikosR committed
4977
4978
    display: 'dynamic',
    popperConfig: null
XhmikosR's avatar
Dist    
XhmikosR committed
4979
4980
4981
4982
4983
4984
  };
  var DefaultType$2 = {
    offset: '(number|string|function)',
    flip: 'boolean',
    boundary: '(string|element)',
    reference: '(string|element)',
XhmikosR's avatar
XhmikosR committed
4985
4986
    display: 'string',
    popperConfig: '(null|object)'
XhmikosR's avatar
Dist    
XhmikosR committed
4987
  };
XhmikosR's avatar
XhmikosR committed
4988
4989
4990
4991
4992
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
4993

XhmikosR's avatar
Dist    
XhmikosR committed
4994
4995
4996
4997
4998
4999
5000
5001
5002
  var Dropdown =
  /*#__PURE__*/
  function () {
    function Dropdown(element, config) {
      this._element = element;
      this._popper = null;
      this._config = this._getConfig(config);
      this._menu = this._getMenuElement();
      this._inNavbar = this._detectNavbar();
Mark Otto's avatar
dist    
Mark Otto committed
5003

XhmikosR's avatar
Dist    
XhmikosR committed
5004
      this._addEventListeners();
XhmikosR's avatar
XhmikosR committed
5005
5006

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

Mark Otto's avatar
dist  
Mark Otto committed
5009

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

XhmikosR's avatar
Dist    
XhmikosR committed
5012
5013
    // Public
    _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
5014
      if (this._element.disabled || this._element.classList.contains(ClassName$4.DISABLED)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5015
5016
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5017

XhmikosR's avatar
XhmikosR committed
5018
      var isActive = this._menu.classList.contains(ClassName$4.SHOW);
Mark Otto's avatar
dist  
Mark Otto committed
5019

XhmikosR's avatar
XhmikosR committed
5020
      Dropdown.clearMenus();
Mark Otto's avatar
dist  
Mark Otto committed
5021

XhmikosR's avatar
Dist    
XhmikosR committed
5022
5023
5024
      if (isActive) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
5025

XhmikosR's avatar
XhmikosR committed
5026
5027
5028
5029
5030
5031
5032
5033
5034
      this.show();
    };

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

      var parent = Dropdown.getParentFromElement(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
5035
5036
5037
      var relatedTarget = {
        relatedTarget: this._element
      };
XhmikosR's avatar
XhmikosR committed
5038
      var showEvent = EventHandler.trigger(parent, Event$5.SHOW, relatedTarget);
Mark Otto's avatar
dist  
Mark Otto committed
5039

XhmikosR's avatar
XhmikosR committed
5040
      if (showEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
5041
5042
        return;
      } // Disable totally Popper.js for Dropdown in Navbar
Mark Otto's avatar
dist    
Mark Otto committed
5043

Mark Otto's avatar
dist  
Mark Otto committed
5044

XhmikosR's avatar
Dist    
XhmikosR committed
5045
5046
      if (!this._inNavbar) {
        if (typeof Popper === 'undefined') {
XhmikosR's avatar
XhmikosR committed
5047
          throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org)');
Mark Otto's avatar
dist    
Mark Otto committed
5048
        }
Mark Otto's avatar
dist  
Mark Otto committed
5049

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

XhmikosR's avatar
Dist    
XhmikosR committed
5052
5053
        if (this._config.reference === 'parent') {
          referenceElement = parent;
XhmikosR's avatar
XhmikosR committed
5054
        } else if (isElement(this._config.reference)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5055
          referenceElement = this._config.reference; // Check if it's jQuery element
Mark Otto's avatar
dist    
Mark Otto committed
5056

XhmikosR's avatar
Dist    
XhmikosR committed
5057
5058
          if (typeof this._config.reference.jquery !== 'undefined') {
            referenceElement = this._config.reference[0];
Mark Otto's avatar
dist    
Mark Otto committed
5059
          }
XhmikosR's avatar
Dist    
XhmikosR committed
5060
5061
5062
        } // 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
5063

Mark Otto's avatar
dist    
Mark Otto committed
5064

XhmikosR's avatar
Dist    
XhmikosR committed
5065
        if (this._config.boundary !== 'scrollParent') {
XhmikosR's avatar
XhmikosR committed
5066
          parent.classList.add(ClassName$4.POSITION_STATIC);
XhmikosR's avatar
Dist    
XhmikosR committed
5067
        }
Mark Otto's avatar
dist    
Mark Otto committed
5068

XhmikosR's avatar
Dist    
XhmikosR committed
5069
5070
5071
5072
5073
        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
5074

Mark Otto's avatar
dist    
Mark Otto committed
5075

XhmikosR's avatar
XhmikosR committed
5076
5077
5078
5079
      if ('ontouchstart' in document.documentElement && !makeArray(SelectorEngine.closest(parent, Selector$4.NAVBAR_NAV)).length) {
        makeArray(document.body.children).forEach(function (elem) {
          return EventHandler.on(elem, 'mouseover', null, noop());
        });
XhmikosR's avatar
Dist    
XhmikosR committed
5080
      }
Mark Otto's avatar
dist    
Mark Otto committed
5081

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

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

XhmikosR's avatar
XhmikosR committed
5086
5087
5088
      Manipulator.toggleClass(this._menu, ClassName$4.SHOW);
      Manipulator.toggleClass(parent, ClassName$4.SHOW);
      EventHandler.trigger(parent, Event$5.SHOWN, relatedTarget);
XhmikosR's avatar
Dist    
XhmikosR committed
5089
    };
Mark Otto's avatar
dist    
Mark Otto committed
5090

XhmikosR's avatar
Dist    
XhmikosR committed
5091
    _proto.hide = function hide() {
XhmikosR's avatar
XhmikosR committed
5092
      if (this._element.disabled || this._element.classList.contains(ClassName$4.DISABLED) || !this._menu.classList.contains(ClassName$4.SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5093
5094
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
5095

XhmikosR's avatar
XhmikosR committed
5096
      var parent = Dropdown.getParentFromElement(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
5097
5098
5099
      var relatedTarget = {
        relatedTarget: this._element
      };
XhmikosR's avatar
XhmikosR committed
5100
      var hideEvent = EventHandler.trigger(parent, Event$5.HIDE, relatedTarget);
Mark Otto's avatar
dist    
Mark Otto committed
5101

XhmikosR's avatar
XhmikosR committed
5102
      if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
5103
5104
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5105

XhmikosR's avatar
XhmikosR committed
5106
5107
5108
5109
      if (this._popper) {
        this._popper.destroy();
      }

XhmikosR's avatar
XhmikosR committed
5110
5111
5112
      Manipulator.toggleClass(this._menu, ClassName$4.SHOW);
      Manipulator.toggleClass(parent, ClassName$4.SHOW);
      EventHandler.trigger(parent, Event$5.HIDDEN, relatedTarget);
XhmikosR's avatar
Dist    
XhmikosR committed
5113
    };
Mark Otto's avatar
dist  
Mark Otto committed
5114

XhmikosR's avatar
Dist    
XhmikosR committed
5115
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
5116
5117
      Data.removeData(this._element, DATA_KEY$4);
      EventHandler.off(this._element, EVENT_KEY$4);
XhmikosR's avatar
Dist    
XhmikosR committed
5118
5119
      this._element = null;
      this._menu = null;
Mark Otto's avatar
dist    
Mark Otto committed
5120

XhmikosR's avatar
XhmikosR committed
5121
      if (this._popper) {
XhmikosR's avatar
Dist    
XhmikosR committed
5122
        this._popper.destroy();
Mark Otto's avatar
dist  
Mark Otto committed
5123

XhmikosR's avatar
Dist    
XhmikosR committed
5124
5125
5126
        this._popper = null;
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
5127

XhmikosR's avatar
Dist    
XhmikosR committed
5128
5129
    _proto.update = function update() {
      this._inNavbar = this._detectNavbar();
Mark Otto's avatar
dist    
Mark Otto committed
5130

XhmikosR's avatar
XhmikosR committed
5131
      if (this._popper) {
XhmikosR's avatar
Dist    
XhmikosR committed
5132
5133
        this._popper.scheduleUpdate();
      }
Mark Otto's avatar
Mark Otto committed
5134
5135
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
5136

XhmikosR's avatar
Dist    
XhmikosR committed
5137
5138
    _proto._addEventListeners = function _addEventListeners() {
      var _this = this;
Mark Otto's avatar
dist    
Mark Otto committed
5139

XhmikosR's avatar
XhmikosR committed
5140
      EventHandler.on(this._element, Event$5.CLICK, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
5141
5142
        event.preventDefault();
        event.stopPropagation();
Mark Otto's avatar
dist  
Mark Otto committed
5143

XhmikosR's avatar
Dist    
XhmikosR committed
5144
5145
5146
        _this.toggle();
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
5147

XhmikosR's avatar
Dist    
XhmikosR committed
5148
    _proto._getConfig = function _getConfig(config) {
5149
      config = _objectSpread2({}, this.constructor.Default, {}, Manipulator.getDataAttributes(this._element), {}, config);
XhmikosR's avatar
XhmikosR committed
5150
      typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
5151
5152
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
5153

XhmikosR's avatar
Dist    
XhmikosR committed
5154
    _proto._getMenuElement = function _getMenuElement() {
XhmikosR's avatar
XhmikosR committed
5155
      var parent = Dropdown.getParentFromElement(this._element);
5156
      return SelectorEngine.findOne(Selector$4.MENU, parent);
XhmikosR's avatar
Dist    
XhmikosR committed
5157
    };
Mark Otto's avatar
dist  
Mark Otto committed
5158

XhmikosR's avatar
Dist    
XhmikosR committed
5159
    _proto._getPlacement = function _getPlacement() {
XhmikosR's avatar
XhmikosR committed
5160
      var parentDropdown = this._element.parentNode;
XhmikosR's avatar
Dist    
XhmikosR committed
5161
      var placement = AttachmentMap.BOTTOM; // Handle dropup
Mark Otto's avatar
dist  
Mark Otto committed
5162

XhmikosR's avatar
XhmikosR committed
5163
      if (parentDropdown.classList.contains(ClassName$4.DROPUP)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5164
        placement = AttachmentMap.TOP;
Mark Otto's avatar
dist    
Mark Otto committed
5165

XhmikosR's avatar
XhmikosR committed
5166
        if (this._menu.classList.contains(ClassName$4.MENURIGHT)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5167
5168
          placement = AttachmentMap.TOPEND;
        }
XhmikosR's avatar
XhmikosR committed
5169
      } else if (parentDropdown.classList.contains(ClassName$4.DROPRIGHT)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5170
        placement = AttachmentMap.RIGHT;
XhmikosR's avatar
XhmikosR committed
5171
      } else if (parentDropdown.classList.contains(ClassName$4.DROPLEFT)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5172
        placement = AttachmentMap.LEFT;
XhmikosR's avatar
XhmikosR committed
5173
      } else if (this._menu.classList.contains(ClassName$4.MENURIGHT)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5174
5175
        placement = AttachmentMap.BOTTOMEND;
      }
Mark Otto's avatar
dist    
Mark Otto committed
5176

XhmikosR's avatar
Dist    
XhmikosR committed
5177
5178
      return placement;
    };
Mark Otto's avatar
dist    
Mark Otto committed
5179

XhmikosR's avatar
Dist    
XhmikosR committed
5180
    _proto._detectNavbar = function _detectNavbar() {
XhmikosR's avatar
XhmikosR committed
5181
      return Boolean(SelectorEngine.closest(this._element, '.navbar'));
XhmikosR's avatar
Dist    
XhmikosR committed
5182
    };
Mark Otto's avatar
dist    
Mark Otto committed
5183

Mark Otto's avatar
Mark Otto committed
5184
    _proto._getOffset = function _getOffset() {
XhmikosR's avatar
Dist    
XhmikosR committed
5185
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
5186

Mark Otto's avatar
Mark Otto committed
5187
      var offset = {};
Mark Otto's avatar
dist    
Mark Otto committed
5188

XhmikosR's avatar
Dist    
XhmikosR committed
5189
      if (typeof this._config.offset === 'function') {
Mark Otto's avatar
Mark Otto committed
5190
        offset.fn = function (data) {
5191
          data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
XhmikosR's avatar
Dist    
XhmikosR committed
5192
5193
5194
          return data;
        };
      } else {
Mark Otto's avatar
Mark Otto committed
5195
        offset.offset = this._config.offset;
XhmikosR's avatar
Dist    
XhmikosR committed
5196
      }
Mark Otto's avatar
dist    
Mark Otto committed
5197

Mark Otto's avatar
Mark Otto committed
5198
5199
5200
5201
      return offset;
    };

    _proto._getPopperConfig = function _getPopperConfig() {
XhmikosR's avatar
Dist    
XhmikosR committed
5202
5203
5204
      var popperConfig = {
        placement: this._getPlacement(),
        modifiers: {
Mark Otto's avatar
Mark Otto committed
5205
          offset: this._getOffset(),
XhmikosR's avatar
Dist    
XhmikosR committed
5206
5207
5208
5209
5210
          flip: {
            enabled: this._config.flip
          },
          preventOverflow: {
            boundariesElement: this._config.boundary
Mark Otto's avatar
dist    
Mark Otto committed
5211
          }
XhmikosR's avatar
XhmikosR committed
5212
5213
        }
      }; // Disable Popper.js if we have a static display
Mark Otto's avatar
dist    
Mark Otto committed
5214

XhmikosR's avatar
Dist    
XhmikosR committed
5215
5216
5217
5218
5219
      if (this._config.display === 'static') {
        popperConfig.modifiers.applyStyle = {
          enabled: false
        };
      }
Mark Otto's avatar
dist  
Mark Otto committed
5220

XhmikosR's avatar
XhmikosR committed
5221
      return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
Mark Otto's avatar
Mark Otto committed
5222
5223
    } // Static
    ;
Mark Otto's avatar
dist    
Mark Otto committed
5224

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

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

XhmikosR's avatar
XhmikosR committed
5230
5231
5232
5233
5234
5235
      if (!data) {
        data = new Dropdown(element, _config);
      }

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

XhmikosR's avatar
XhmikosR committed
5239
5240
5241
        data[config]();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
5242

XhmikosR's avatar
XhmikosR committed
5243
    Dropdown.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
XhmikosR committed
5244
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
5245
        Dropdown.dropdownInterface(this, config);
XhmikosR's avatar
Dist    
XhmikosR committed
5246
5247
5248
      });
    };

XhmikosR's avatar
XhmikosR committed
5249
    Dropdown.clearMenus = function clearMenus(event) {
XhmikosR's avatar
Dist    
XhmikosR committed
5250
5251
5252
      if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5253

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

XhmikosR's avatar
Dist    
XhmikosR committed
5256
      for (var i = 0, len = toggles.length; i < len; i++) {
XhmikosR's avatar
XhmikosR committed
5257
        var parent = Dropdown.getParentFromElement(toggles[i]);
XhmikosR's avatar
XhmikosR committed
5258
        var context = Data.getData(toggles[i], DATA_KEY$4);
XhmikosR's avatar
Dist    
XhmikosR committed
5259
5260
5261
        var relatedTarget = {
          relatedTarget: toggles[i]
        };
Mark Otto's avatar
dist    
Mark Otto committed
5262

XhmikosR's avatar
Dist    
XhmikosR committed
5263
5264
5265
        if (event && event.type === 'click') {
          relatedTarget.clickEvent = event;
        }
Mark Otto's avatar
dist  
Mark Otto committed
5266

XhmikosR's avatar
Dist    
XhmikosR committed
5267
5268
        if (!context) {
          continue;
Mark Otto's avatar
dist  
Mark Otto committed
5269
5270
        }

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

XhmikosR's avatar
XhmikosR committed
5273
        if (!parent.classList.contains(ClassName$4.SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5274
          continue;
Mark Otto's avatar
dist  
Mark Otto committed
5275
5276
        }

XhmikosR's avatar
XhmikosR committed
5277
        if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && parent.contains(event.target)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5278
5279
          continue;
        }
Mark Otto's avatar
dist  
Mark Otto committed
5280

XhmikosR's avatar
XhmikosR committed
5281
        var hideEvent = EventHandler.trigger(parent, Event$5.HIDE, relatedTarget);
Mark Otto's avatar
dist    
Mark Otto committed
5282

XhmikosR's avatar
XhmikosR committed
5283
        if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
5284
5285
5286
          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
5287
5288


XhmikosR's avatar
Dist    
XhmikosR committed
5289
        if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
5290
5291
5292
          makeArray(document.body.children).forEach(function (elem) {
            return EventHandler.off(elem, 'mouseover', null, noop());
          });
Mark Otto's avatar
dist  
Mark Otto committed
5293
5294
        }

XhmikosR's avatar
Dist    
XhmikosR committed
5295
        toggles[i].setAttribute('aria-expanded', 'false');
XhmikosR's avatar
XhmikosR committed
5296
5297
5298
5299
5300

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

XhmikosR's avatar
XhmikosR committed
5301
5302
5303
        dropdownMenu.classList.remove(ClassName$4.SHOW);
        parent.classList.remove(ClassName$4.SHOW);
        EventHandler.trigger(parent, Event$5.HIDDEN, relatedTarget);
XhmikosR's avatar
Dist    
XhmikosR committed
5304
5305
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
5306

XhmikosR's avatar
XhmikosR committed
5307
5308
    Dropdown.getParentFromElement = function getParentFromElement(element) {
      return getElementFromSelector(element) || element.parentNode;
XhmikosR's avatar
XhmikosR committed
5309
    };
Mark Otto's avatar
dist  
Mark Otto committed
5310

XhmikosR's avatar
XhmikosR committed
5311
    Dropdown.dataApiKeydownHandler = function dataApiKeydownHandler(event) {
XhmikosR's avatar
Dist    
XhmikosR committed
5312
5313
5314
5315
5316
5317
5318
      // 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
5319
      if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || SelectorEngine.closest(event.target, Selector$4.MENU)) : !REGEXP_KEYDOWN.test(event.which)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5320
5321
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5322

XhmikosR's avatar
Dist    
XhmikosR committed
5323
5324
      event.preventDefault();
      event.stopPropagation();
Mark Otto's avatar
dist  
Mark Otto committed
5325

XhmikosR's avatar
XhmikosR committed
5326
      if (this.disabled || this.classList.contains(ClassName$4.DISABLED)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5327
5328
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
5329

XhmikosR's avatar
XhmikosR committed
5330
      var parent = Dropdown.getParentFromElement(this);
XhmikosR's avatar
XhmikosR committed
5331
      var isActive = parent.classList.contains(ClassName$4.SHOW);
XhmikosR's avatar
Dist    
XhmikosR committed
5332

Mark Otto's avatar
dist    
Mark Otto committed
5333
      if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5334
        if (event.which === ESCAPE_KEYCODE) {
Mark Otto's avatar
dist v5    
Mark Otto committed
5335
          SelectorEngine.findOne(Selector$4.DATA_TOGGLE, parent).focus();
Mark Otto's avatar
dist  
Mark Otto committed
5336
5337
        }

XhmikosR's avatar
XhmikosR committed
5338
        Dropdown.clearMenus();
XhmikosR's avatar
Dist    
XhmikosR committed
5339
5340
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5341

XhmikosR's avatar
XhmikosR committed
5342
      var items = makeArray(SelectorEngine.find(Selector$4.VISIBLE_ITEMS, parent)).filter(isVisible);
Mark Otto's avatar
dist  
Mark Otto committed
5343

XhmikosR's avatar
XhmikosR committed
5344
      if (!items.length) {
XhmikosR's avatar
Dist    
XhmikosR committed
5345
5346
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5347

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

XhmikosR's avatar
Dist    
XhmikosR committed
5350
5351
5352
5353
      if (event.which === ARROW_UP_KEYCODE && index > 0) {
        // Up
        index--;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5354

XhmikosR's avatar
Dist    
XhmikosR committed
5355
5356
5357
5358
      if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
        // Down
        index++;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5359

XhmikosR's avatar
Dist    
XhmikosR committed
5360
5361
5362
      if (index < 0) {
        index = 0;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5363

XhmikosR's avatar
Dist    
XhmikosR committed
5364
      items[index].focus();
Mark Otto's avatar
dist  
Mark Otto committed
5365
5366
    };

XhmikosR's avatar
XhmikosR committed
5367
    Dropdown.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
5368
5369
5370
      return Data.getData(element, DATA_KEY$4);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
    _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
5388
    return Dropdown;
XhmikosR's avatar
Dist    
XhmikosR committed
5389
5390
5391
5392
5393
5394
5395
5396
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */


XhmikosR's avatar
XhmikosR committed
5397
5398
5399
5400
  EventHandler.on(document, Event$5.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown.dataApiKeydownHandler);
  EventHandler.on(document, Event$5.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown.dataApiKeydownHandler);
  EventHandler.on(document, Event$5.CLICK_DATA_API, Dropdown.clearMenus);
  EventHandler.on(document, Event$5.KEYUP_DATA_API, Dropdown.clearMenus);
XhmikosR's avatar
XhmikosR committed
5401
  EventHandler.on(document, Event$5.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
5402
5403
    event.preventDefault();
    event.stopPropagation();
XhmikosR's avatar
XhmikosR committed
5404
    Dropdown.dropdownInterface(this, 'toggle');
XhmikosR's avatar
XhmikosR committed
5405
5406
5407
  });
  EventHandler.on(document, Event$5.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
    return e.stopPropagation();
XhmikosR's avatar
Dist    
XhmikosR committed
5408
  });
XhmikosR's avatar
XhmikosR committed
5409
  var $$5 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
5410
5411
5412
5413
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
5414
   * add .dropdown to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
5415
5416
   */

5417
5418
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
5419
5420
5421
5422
  if ($$5) {
    var JQUERY_NO_CONFLICT$4 = $$5.fn[NAME$4];
    $$5.fn[NAME$4] = Dropdown.jQueryInterface;
    $$5.fn[NAME$4].Constructor = Dropdown;
XhmikosR's avatar
Dist    
XhmikosR committed
5423

XhmikosR's avatar
XhmikosR committed
5424
5425
5426
    $$5.fn[NAME$4].noConflict = function () {
      $$5.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
      return Dropdown.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
5427
5428
    };
  }
Mark Otto's avatar
dist    
Mark Otto committed
5429

XhmikosR's avatar
Dist    
XhmikosR committed
5430
5431
5432
5433
5434
5435
5436
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$5 = 'modal';
XhmikosR's avatar
XhmikosR committed
5437
  var VERSION$5 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
  var DATA_KEY$5 = 'bs.modal';
  var EVENT_KEY$5 = "." + DATA_KEY$5;
  var DATA_API_KEY$5 = '.data-api';
  var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key

  var Default$3 = {
    backdrop: true,
    keyboard: true,
    focus: true,
    show: true
  };
  var DefaultType$3 = {
    backdrop: '(boolean|string)',
    keyboard: 'boolean',
    focus: 'boolean',
    show: 'boolean'
  };
XhmikosR's avatar
XhmikosR committed
5455
  var Event$6 = {
XhmikosR's avatar
Dist    
XhmikosR committed
5456
    HIDE: "hide" + EVENT_KEY$5,
XhmikosR's avatar
XhmikosR committed
5457
    HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
XhmikosR's avatar
Dist    
XhmikosR committed
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
    HIDDEN: "hidden" + EVENT_KEY$5,
    SHOW: "show" + EVENT_KEY$5,
    SHOWN: "shown" + EVENT_KEY$5,
    FOCUSIN: "focusin" + EVENT_KEY$5,
    RESIZE: "resize" + EVENT_KEY$5,
    CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
    KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
    MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
    MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
    CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  };
  var ClassName$5 = {
Mark Otto's avatar
Mark Otto committed
5470
    SCROLLABLE: 'modal-dialog-scrollable',
XhmikosR's avatar
Dist    
XhmikosR committed
5471
5472
5473
5474
    SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
    BACKDROP: 'modal-backdrop',
    OPEN: 'modal-open',
    FADE: 'fade',
XhmikosR's avatar
XhmikosR committed
5475
5476
    SHOW: 'show',
    STATIC: 'modal-static'
XhmikosR's avatar
Dist    
XhmikosR committed
5477
5478
5479
  };
  var Selector$5 = {
    DIALOG: '.modal-dialog',
Mark Otto's avatar
Mark Otto committed
5480
    MODAL_BODY: '.modal-body',
XhmikosR's avatar
Dist    
XhmikosR committed
5481
5482
5483
5484
5485
    DATA_TOGGLE: '[data-toggle="modal"]',
    DATA_DISMISS: '[data-dismiss="modal"]',
    FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
    STICKY_CONTENT: '.sticky-top'
  };
XhmikosR's avatar
XhmikosR committed
5486
5487
5488
5489
5490
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
5491

XhmikosR's avatar
Dist    
XhmikosR committed
5492
5493
5494
5495
5496
5497
  var Modal =
  /*#__PURE__*/
  function () {
    function Modal(element, config) {
      this._config = this._getConfig(config);
      this._element = element;
XhmikosR's avatar
XhmikosR committed
5498
      this._dialog = SelectorEngine.findOne(Selector$5.DIALOG, element);
XhmikosR's avatar
Dist    
XhmikosR committed
5499
5500
5501
5502
5503
5504
      this._backdrop = null;
      this._isShown = false;
      this._isBodyOverflowing = false;
      this._ignoreBackdropClick = false;
      this._isTransitioning = false;
      this._scrollbarWidth = 0;
XhmikosR's avatar
XhmikosR committed
5505
      Data.setData(element, DATA_KEY$5, this);
XhmikosR's avatar
Dist    
XhmikosR committed
5506
5507
5508
5509
5510
5511
5512
5513
    } // 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
5514
5515
    };

XhmikosR's avatar
Dist    
XhmikosR committed
5516
5517
    _proto.show = function show(relatedTarget) {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
5518

XhmikosR's avatar
Dist    
XhmikosR committed
5519
5520
5521
      if (this._isShown || this._isTransitioning) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5522

XhmikosR's avatar
XhmikosR committed
5523
      if (this._element.classList.contains(ClassName$5.FADE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5524
5525
        this._isTransitioning = true;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5526

XhmikosR's avatar
XhmikosR committed
5527
      var showEvent = EventHandler.trigger(this._element, Event$6.SHOW, {
XhmikosR's avatar
Dist    
XhmikosR committed
5528
5529
        relatedTarget: relatedTarget
      });
Mark Otto's avatar
dist    
Mark Otto committed
5530

XhmikosR's avatar
XhmikosR committed
5531
      if (this._isShown || showEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
5532
5533
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
5534

XhmikosR's avatar
Dist    
XhmikosR committed
5535
      this._isShown = true;
Mark Otto's avatar
dist    
Mark Otto committed
5536

XhmikosR's avatar
Dist    
XhmikosR committed
5537
      this._checkScrollbar();
Mark Otto's avatar
dist    
Mark Otto committed
5538

XhmikosR's avatar
Dist    
XhmikosR committed
5539
      this._setScrollbar();
Mark Otto's avatar
dist    
Mark Otto committed
5540

XhmikosR's avatar
Dist    
XhmikosR committed
5541
      this._adjustDialog();
Mark Otto's avatar
dist  
Mark Otto committed
5542

XhmikosR's avatar
Dist    
XhmikosR committed
5543
      this._setEscapeEvent();
Mark Otto's avatar
dist  
Mark Otto committed
5544

XhmikosR's avatar
Dist    
XhmikosR committed
5545
      this._setResizeEvent();
Mark Otto's avatar
dist    
Mark Otto committed
5546

XhmikosR's avatar
XhmikosR committed
5547
      EventHandler.on(this._element, Event$6.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
5548
5549
        return _this.hide(event);
      });
XhmikosR's avatar
XhmikosR committed
5550
5551
5552
      EventHandler.on(this._dialog, Event$6.MOUSEDOWN_DISMISS, function () {
        EventHandler.one(_this._element, Event$6.MOUSEUP_DISMISS, function (event) {
          if (event.target === _this._element) {
XhmikosR's avatar
Dist    
XhmikosR committed
5553
5554
5555
5556
            _this._ignoreBackdropClick = true;
          }
        });
      });
Mark Otto's avatar
dist  
Mark Otto committed
5557

XhmikosR's avatar
Dist    
XhmikosR committed
5558
5559
5560
5561
      this._showBackdrop(function () {
        return _this._showElement(relatedTarget);
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
5562

XhmikosR's avatar
Dist    
XhmikosR committed
5563
5564
    _proto.hide = function hide(event) {
      var _this2 = this;
Mark Otto's avatar
dist  
Mark Otto committed
5565

XhmikosR's avatar
Dist    
XhmikosR committed
5566
5567
5568
      if (event) {
        event.preventDefault();
      }
Mark Otto's avatar
dist    
Mark Otto committed
5569

XhmikosR's avatar
Dist    
XhmikosR committed
5570
5571
5572
      if (!this._isShown || this._isTransitioning) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5573

XhmikosR's avatar
XhmikosR committed
5574
      var hideEvent = EventHandler.trigger(this._element, Event$6.HIDE);
Mark Otto's avatar
dist  
Mark Otto committed
5575

5576
      if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
5577
5578
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5579

XhmikosR's avatar
Dist    
XhmikosR committed
5580
      this._isShown = false;
XhmikosR's avatar
XhmikosR committed
5581
5582

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

XhmikosR's avatar
Dist    
XhmikosR committed
5584
5585
5586
      if (transition) {
        this._isTransitioning = true;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5587

XhmikosR's avatar
Dist    
XhmikosR committed
5588
      this._setEscapeEvent();
Mark Otto's avatar
dist  
Mark Otto committed
5589

XhmikosR's avatar
Dist    
XhmikosR committed
5590
      this._setResizeEvent();
Mark Otto's avatar
dist  
Mark Otto committed
5591

XhmikosR's avatar
XhmikosR committed
5592
5593
5594
5595
5596
5597
      EventHandler.off(document, Event$6.FOCUSIN);

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

      EventHandler.off(this._element, Event$6.CLICK_DISMISS);
      EventHandler.off(this._dialog, Event$6.MOUSEDOWN_DISMISS);
Mark Otto's avatar
dist  
Mark Otto committed
5598

XhmikosR's avatar
Dist    
XhmikosR committed
5599
      if (transition) {
XhmikosR's avatar
XhmikosR committed
5600
5601
        var transitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
5602
          return _this2._hideModal(event);
XhmikosR's avatar
XhmikosR committed
5603
5604
        });
        emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
5605
5606
5607
5608
      } else {
        this._hideModal();
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
5609

XhmikosR's avatar
Dist    
XhmikosR committed
5610
5611
    _proto.dispose = function dispose() {
      [window, this._element, this._dialog].forEach(function (htmlElement) {
XhmikosR's avatar
XhmikosR committed
5612
        return EventHandler.off(htmlElement, EVENT_KEY$5);
XhmikosR's avatar
Dist    
XhmikosR committed
5613
5614
5615
5616
5617
5618
      });
      /**
       * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
       * Do not move `document` in `htmlElements` array
       * It will remove `Event.CLICK_DATA_API` event that should remain
       */
Mark Otto's avatar
dist  
Mark Otto committed
5619

XhmikosR's avatar
XhmikosR committed
5620
5621
      EventHandler.off(document, Event$6.FOCUSIN);
      Data.removeData(this._element, DATA_KEY$5);
XhmikosR's avatar
Dist    
XhmikosR committed
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
      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
5632

XhmikosR's avatar
Dist    
XhmikosR committed
5633
5634
    _proto.handleUpdate = function handleUpdate() {
      this._adjustDialog();
Mark Otto's avatar
Mark Otto committed
5635
5636
    } // Private
    ;
Mark Otto's avatar
dist  
Mark Otto committed
5637

XhmikosR's avatar
Dist    
XhmikosR committed
5638
    _proto._getConfig = function _getConfig(config) {
5639
      config = _objectSpread2({}, Default$3, {}, config);
XhmikosR's avatar
XhmikosR committed
5640
      typeCheckConfig(NAME$5, config, DefaultType$3);
XhmikosR's avatar
Dist    
XhmikosR committed
5641
5642
      return config;
    };
Mark Otto's avatar
dist  
Mark Otto committed
5643

XhmikosR's avatar
Dist    
XhmikosR committed
5644
5645
    _proto._showElement = function _showElement(relatedTarget) {
      var _this3 = this;
Mark Otto's avatar
dist  
Mark Otto committed
5646

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
5651
5652
5653
5654
      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
5655

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

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

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

XhmikosR's avatar
XhmikosR committed
5662
5663
      if (this._dialog.classList.contains(ClassName$5.SCROLLABLE) && modalBody) {
        modalBody.scrollTop = 0;
Mark Otto's avatar
Mark Otto committed
5664
5665
5666
      } else {
        this._element.scrollTop = 0;
      }
Mark Otto's avatar
dist  
Mark Otto committed
5667

XhmikosR's avatar
Dist    
XhmikosR committed
5668
      if (transition) {
XhmikosR's avatar
XhmikosR committed
5669
        reflow(this._element);
XhmikosR's avatar
Dist    
XhmikosR committed
5670
      }
Mark Otto's avatar
dist  
Mark Otto committed
5671

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

XhmikosR's avatar
Dist    
XhmikosR committed
5674
5675
5676
      if (this._config.focus) {
        this._enforceFocus();
      }
Mark Otto's avatar
dist    
Mark Otto committed
5677

XhmikosR's avatar
Dist    
XhmikosR committed
5678
5679
5680
      var transitionComplete = function transitionComplete() {
        if (_this3._config.focus) {
          _this3._element.focus();
Mark Otto's avatar
dist    
Mark Otto committed
5681
        }
Mark Otto's avatar
dist  
Mark Otto committed
5682

XhmikosR's avatar
Dist    
XhmikosR committed
5683
        _this3._isTransitioning = false;
XhmikosR's avatar
XhmikosR committed
5684
5685
5686
        EventHandler.trigger(_this3._element, Event$6.SHOWN, {
          relatedTarget: relatedTarget
        });
XhmikosR's avatar
Dist    
XhmikosR committed
5687
      };
Mark Otto's avatar
dist  
Mark Otto committed
5688

XhmikosR's avatar
Dist    
XhmikosR committed
5689
      if (transition) {
XhmikosR's avatar
XhmikosR committed
5690
5691
5692
        var transitionDuration = getTransitionDurationFromElement(this._dialog);
        EventHandler.one(this._dialog, TRANSITION_END, transitionComplete);
        emulateTransitionEnd(this._dialog, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
5693
5694
5695
5696
      } else {
        transitionComplete();
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
5697

XhmikosR's avatar
Dist    
XhmikosR committed
5698
5699
    _proto._enforceFocus = function _enforceFocus() {
      var _this4 = this;
Mark Otto's avatar
dist  
Mark Otto committed
5700

XhmikosR's avatar
XhmikosR committed
5701
5702
5703
5704
      EventHandler.off(document, Event$6.FOCUSIN); // guard against infinite focus loop

      EventHandler.on(document, Event$6.FOCUSIN, function (event) {
        if (document !== event.target && _this4._element !== event.target && !_this4._element.contains(event.target)) {
XhmikosR's avatar
Dist    
XhmikosR committed
5705
          _this4._element.focus();
Mark Otto's avatar
dist  
Mark Otto committed
5706
        }
XhmikosR's avatar
Dist    
XhmikosR committed
5707
5708
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
5709

XhmikosR's avatar
Dist    
XhmikosR committed
5710
5711
5712
5713
    _proto._setEscapeEvent = function _setEscapeEvent() {
      var _this5 = this;

      if (this._isShown && this._config.keyboard) {
XhmikosR's avatar
XhmikosR committed
5714
        EventHandler.on(this._element, Event$6.KEYDOWN_DISMISS, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
5715
          if (event.which === ESCAPE_KEYCODE$1) {
XhmikosR's avatar
XhmikosR committed
5716
            _this5._triggerBackdropTransition();
Mark Otto's avatar
dist    
Mark Otto committed
5717
5718
          }
        });
5719
      } else {
XhmikosR's avatar
XhmikosR committed
5720
        EventHandler.off(this._element, Event$6.KEYDOWN_DISMISS);
XhmikosR's avatar
Dist    
XhmikosR committed
5721
5722
5723
5724
5725
      }
    };

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

XhmikosR's avatar
Dist    
XhmikosR committed
5727
      if (this._isShown) {
5728
5729
        EventHandler.on(window, Event$6.RESIZE, function () {
          return _this6._adjustDialog();
XhmikosR's avatar
Dist    
XhmikosR committed
5730
5731
        });
      } else {
XhmikosR's avatar
XhmikosR committed
5732
        EventHandler.off(window, Event$6.RESIZE);
XhmikosR's avatar
Dist    
XhmikosR committed
5733
5734
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
5735

XhmikosR's avatar
Dist    
XhmikosR committed
5736
5737
    _proto._hideModal = function _hideModal() {
      var _this7 = this;
Mark Otto's avatar
dist  
Mark Otto committed
5738

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

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

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

XhmikosR's avatar
Dist    
XhmikosR committed
5745
      this._isTransitioning = false;
Mark Otto's avatar
dist    
Mark Otto committed
5746

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

XhmikosR's avatar
Dist    
XhmikosR committed
5750
        _this7._resetAdjustments();
Mark Otto's avatar
dist  
Mark Otto committed
5751

XhmikosR's avatar
Dist    
XhmikosR committed
5752
        _this7._resetScrollbar();
Mark Otto's avatar
dist  
Mark Otto committed
5753

XhmikosR's avatar
XhmikosR committed
5754
        EventHandler.trigger(_this7._element, Event$6.HIDDEN);
XhmikosR's avatar
Dist    
XhmikosR committed
5755
5756
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
5757

XhmikosR's avatar
Dist    
XhmikosR committed
5758
    _proto._removeBackdrop = function _removeBackdrop() {
5759
      this._backdrop.parentNode.removeChild(this._backdrop);
XhmikosR's avatar
XhmikosR committed
5760

5761
      this._backdrop = null;
XhmikosR's avatar
Dist    
XhmikosR committed
5762
    };
Mark Otto's avatar
dist    
Mark Otto committed
5763

XhmikosR's avatar
Dist    
XhmikosR committed
5764
5765
    _proto._showBackdrop = function _showBackdrop(callback) {
      var _this8 = this;
Mark Otto's avatar
dist    
Mark Otto committed
5766

XhmikosR's avatar
XhmikosR committed
5767
      var animate = this._element.classList.contains(ClassName$5.FADE) ? ClassName$5.FADE : '';
Mark Otto's avatar
dist    
Mark Otto committed
5768

XhmikosR's avatar
Dist    
XhmikosR committed
5769
5770
5771
      if (this._isShown && this._config.backdrop) {
        this._backdrop = document.createElement('div');
        this._backdrop.className = ClassName$5.BACKDROP;
Mark Otto's avatar
dist    
Mark Otto committed
5772

XhmikosR's avatar
Dist    
XhmikosR committed
5773
5774
        if (animate) {
          this._backdrop.classList.add(animate);
Mark Otto's avatar
dist    
Mark Otto committed
5775
        }
Mark Otto's avatar
dist    
Mark Otto committed
5776

XhmikosR's avatar
XhmikosR committed
5777
5778
        document.body.appendChild(this._backdrop);
        EventHandler.on(this._element, Event$6.CLICK_DISMISS, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
5779
5780
5781
5782
          if (_this8._ignoreBackdropClick) {
            _this8._ignoreBackdropClick = false;
            return;
          }
Mark Otto's avatar
dist  
Mark Otto committed
5783

XhmikosR's avatar
Dist    
XhmikosR committed
5784
5785
5786
          if (event.target !== event.currentTarget) {
            return;
          }
Mark Otto's avatar
dist  
Mark Otto committed
5787

XhmikosR's avatar
XhmikosR committed
5788
          _this8._triggerBackdropTransition();
XhmikosR's avatar
Dist    
XhmikosR committed
5789
        });
Mark Otto's avatar
dist  
Mark Otto committed
5790

XhmikosR's avatar
Dist    
XhmikosR committed
5791
        if (animate) {
XhmikosR's avatar
XhmikosR committed
5792
          reflow(this._backdrop);
XhmikosR's avatar
Dist    
XhmikosR committed
5793
        }
Mark Otto's avatar
dist  
Mark Otto committed
5794

XhmikosR's avatar
XhmikosR committed
5795
        this._backdrop.classList.add(ClassName$5.SHOW);
Mark Otto's avatar
dist  
Mark Otto committed
5796

XhmikosR's avatar
Dist    
XhmikosR committed
5797
5798
5799
5800
        if (!animate) {
          callback();
          return;
        }
Mark Otto's avatar
dist    
Mark Otto committed
5801

XhmikosR's avatar
XhmikosR committed
5802
5803
5804
        var backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
        EventHandler.one(this._backdrop, TRANSITION_END, callback);
        emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
5805
      } else if (!this._isShown && this._backdrop) {
XhmikosR's avatar
XhmikosR committed
5806
        this._backdrop.classList.remove(ClassName$5.SHOW);
Mark Otto's avatar
dist    
Mark Otto committed
5807

XhmikosR's avatar
Dist    
XhmikosR committed
5808
5809
        var callbackRemove = function callbackRemove() {
          _this8._removeBackdrop();
Mark Otto's avatar
dist    
Mark Otto committed
5810

5811
          callback();
XhmikosR's avatar
Dist    
XhmikosR committed
5812
        };
Mark Otto's avatar
dist  
Mark Otto committed
5813

XhmikosR's avatar
XhmikosR committed
5814
5815
        if (this._element.classList.contains(ClassName$5.FADE)) {
          var _backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
Mark Otto's avatar
dist  
Mark Otto committed
5816

XhmikosR's avatar
XhmikosR committed
5817
5818
          EventHandler.one(this._backdrop, TRANSITION_END, callbackRemove);
          emulateTransitionEnd(this._backdrop, _backdropTransitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
5819
5820
5821
        } else {
          callbackRemove();
        }
5822
      } else {
XhmikosR's avatar
Dist    
XhmikosR committed
5823
5824
        callback();
      }
XhmikosR's avatar
XhmikosR committed
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
    };

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

      if (this._config.backdrop === 'static') {
        var hideEvent = EventHandler.trigger(this._element, Event$6.HIDE_PREVENTED);

        if (hideEvent.defaultPrevented) {
          return;
        }

        this._element.classList.add(ClassName$5.STATIC);

        var modalTransitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, function () {
          _this9._element.classList.remove(ClassName$5.STATIC);
        });
        emulateTransitionEnd(this._element, modalTransitionDuration);

        this._element.focus();
      } else {
        this.hide();
      }
Mark Otto's avatar
Mark Otto committed
5849
    } // ----------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
5850
5851
    // the following methods are used to handle overflowing modals
    // ----------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
5852
    ;
Mark Otto's avatar
dist  
Mark Otto committed
5853

XhmikosR's avatar
Dist    
XhmikosR committed
5854
5855
    _proto._adjustDialog = function _adjustDialog() {
      var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
Mark Otto's avatar
dist    
Mark Otto committed
5856

XhmikosR's avatar
Dist    
XhmikosR committed
5857
5858
5859
      if (!this._isBodyOverflowing && isModalOverflowing) {
        this._element.style.paddingLeft = this._scrollbarWidth + "px";
      }
Mark Otto's avatar
dist  
Mark Otto committed
5860

XhmikosR's avatar
Dist    
XhmikosR committed
5861
5862
5863
5864
      if (this._isBodyOverflowing && !isModalOverflowing) {
        this._element.style.paddingRight = this._scrollbarWidth + "px";
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
5865

XhmikosR's avatar
Dist    
XhmikosR committed
5866
5867
5868
5869
    _proto._resetAdjustments = function _resetAdjustments() {
      this._element.style.paddingLeft = '';
      this._element.style.paddingRight = '';
    };
Mark Otto's avatar
dist    
Mark Otto committed
5870

XhmikosR's avatar
Dist    
XhmikosR committed
5871
5872
5873
5874
5875
    _proto._checkScrollbar = function _checkScrollbar() {
      var rect = document.body.getBoundingClientRect();
      this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
      this._scrollbarWidth = this._getScrollbarWidth();
    };
Mark Otto's avatar
dist  
Mark Otto committed
5876

XhmikosR's avatar
Dist    
XhmikosR committed
5877
    _proto._setScrollbar = function _setScrollbar() {
XhmikosR's avatar
XhmikosR committed
5878
      var _this10 = this;
XhmikosR's avatar
Dist    
XhmikosR committed
5879
5880
5881
5882

      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
5883
5884
        // Adjust fixed content padding
        makeArray(SelectorEngine.find(Selector$5.FIXED_CONTENT)).forEach(function (element) {
XhmikosR's avatar
Dist    
XhmikosR committed
5885
          var actualPadding = element.style.paddingRight;
XhmikosR's avatar
XhmikosR committed
5886
5887
          var calculatedPadding = window.getComputedStyle(element)['padding-right'];
          Manipulator.setDataAttribute(element, 'padding-right', actualPadding);
XhmikosR's avatar
XhmikosR committed
5888
          element.style.paddingRight = parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px";
XhmikosR's avatar
Dist    
XhmikosR committed
5889
5890
        }); // Adjust sticky content margin

XhmikosR's avatar
XhmikosR committed
5891
        makeArray(SelectorEngine.find(Selector$5.STICKY_CONTENT)).forEach(function (element) {
XhmikosR's avatar
Dist    
XhmikosR committed
5892
          var actualMargin = element.style.marginRight;
XhmikosR's avatar
XhmikosR committed
5893
5894
          var calculatedMargin = window.getComputedStyle(element)['margin-right'];
          Manipulator.setDataAttribute(element, 'margin-right', actualMargin);
XhmikosR's avatar
XhmikosR committed
5895
          element.style.marginRight = parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px";
XhmikosR's avatar
Dist    
XhmikosR committed
5896
5897
5898
        }); // Adjust body padding

        var actualPadding = document.body.style.paddingRight;
XhmikosR's avatar
XhmikosR committed
5899
5900
5901
        var calculatedPadding = window.getComputedStyle(document.body)['padding-right'];
        Manipulator.setDataAttribute(document.body, 'padding-right', actualPadding);
        document.body.style.paddingRight = parseFloat(calculatedPadding) + this._scrollbarWidth + "px";
XhmikosR's avatar
Dist    
XhmikosR committed
5902
      }
XhmikosR's avatar
Dist    
XhmikosR committed
5903

XhmikosR's avatar
XhmikosR committed
5904
      document.body.classList.add(ClassName$5.OPEN);
XhmikosR's avatar
Dist    
XhmikosR committed
5905
    };
Mark Otto's avatar
dist    
Mark Otto committed
5906

XhmikosR's avatar
Dist    
XhmikosR committed
5907
5908
    _proto._resetScrollbar = function _resetScrollbar() {
      // Restore fixed content padding
XhmikosR's avatar
XhmikosR committed
5909
5910
      makeArray(SelectorEngine.find(Selector$5.FIXED_CONTENT)).forEach(function (element) {
        var padding = Manipulator.getDataAttribute(element, 'padding-right');
Mark Otto's avatar
dist  
Mark Otto committed
5911

XhmikosR's avatar
XhmikosR committed
5912
5913
5914
5915
5916
5917
5918
5919
        if (typeof padding !== 'undefined') {
          Manipulator.removeDataAttribute(element, 'padding-right');
          element.style.paddingRight = padding;
        }
      }); // Restore sticky content and navbar-toggler margin

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

XhmikosR's avatar
Dist    
XhmikosR committed
5921
        if (typeof margin !== 'undefined') {
XhmikosR's avatar
XhmikosR committed
5922
5923
          Manipulator.removeDataAttribute(element, 'margin-right');
          element.style.marginRight = margin;
Mark Otto's avatar
dist    
Mark Otto committed
5924
        }
XhmikosR's avatar
Dist    
XhmikosR committed
5925
      }); // Restore body padding
Mark Otto's avatar
dist  
Mark Otto committed
5926

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

XhmikosR's avatar
Dist.    
XhmikosR committed
5929
5930
5931
      if (typeof padding === 'undefined') {
        document.body.style.paddingRight = '';
      } else {
XhmikosR's avatar
XhmikosR committed
5932
5933
5934
        Manipulator.removeDataAttribute(document.body, 'padding-right');
        document.body.style.paddingRight = padding;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
5935
    };
Mark Otto's avatar
dist  
Mark Otto committed
5936

XhmikosR's avatar
Dist    
XhmikosR committed
5937
5938
5939
5940
5941
5942
5943
5944
    _proto._getScrollbarWidth = function _getScrollbarWidth() {
      // thx d.walsh
      var scrollDiv = document.createElement('div');
      scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
      document.body.appendChild(scrollDiv);
      var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
      document.body.removeChild(scrollDiv);
      return scrollbarWidth;
Mark Otto's avatar
Mark Otto committed
5945
5946
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
5947

XhmikosR's avatar
XhmikosR committed
5948
    Modal.jQueryInterface = function jQueryInterface(config, relatedTarget) {
XhmikosR's avatar
Dist    
XhmikosR committed
5949
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
5950
        var data = Data.getData(this, DATA_KEY$5);
Mark Otto's avatar
dist  
Mark Otto committed
5951

5952
        var _config = _objectSpread2({}, Default$3, {}, Manipulator.getDataAttributes(this), {}, typeof config === 'object' && config ? config : {});
Mark Otto's avatar
dist  
Mark Otto committed
5953

XhmikosR's avatar
Dist    
XhmikosR committed
5954
5955
5956
        if (!data) {
          data = new Modal(this, _config);
        }
Mark Otto's avatar
dist    
Mark Otto committed
5957

XhmikosR's avatar
Dist    
XhmikosR committed
5958
5959
5960
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
5961
          }
Mark Otto's avatar
dist  
Mark Otto committed
5962

XhmikosR's avatar
Dist    
XhmikosR committed
5963
5964
5965
5966
5967
5968
          data[config](relatedTarget);
        } else if (_config.show) {
          data.show(relatedTarget);
        }
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
5969

XhmikosR's avatar
XhmikosR committed
5970
    Modal.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
5971
5972
5973
      return Data.getData(element, DATA_KEY$5);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
    _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
5985

XhmikosR's avatar
Dist    
XhmikosR committed
5986
5987
5988
5989
5990
5991
5992
    return Modal;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
5993

Mark Otto's avatar
dist    
Mark Otto committed
5994

XhmikosR's avatar
XhmikosR committed
5995
  EventHandler.on(document, Event$6.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
XhmikosR's avatar
XhmikosR committed
5996
    var _this11 = this;
Mark Otto's avatar
dist  
Mark Otto committed
5997

XhmikosR's avatar
XhmikosR committed
5998
    var target = getElementFromSelector(this);
Mark Otto's avatar
dist  
Mark Otto committed
5999

XhmikosR's avatar
Dist    
XhmikosR committed
6000
6001
6002
    if (this.tagName === 'A' || this.tagName === 'AREA') {
      event.preventDefault();
    }
Mark Otto's avatar
dist  
Mark Otto committed
6003

XhmikosR's avatar
XhmikosR committed
6004
6005
6006
    EventHandler.one(target, Event$6.SHOW, function (showEvent) {
      if (showEvent.defaultPrevented) {
        // only register focus restorer if modal will actually get shown
XhmikosR's avatar
Dist    
XhmikosR committed
6007
        return;
Mark Otto's avatar
dist  
Mark Otto committed
6008
6009
      }

XhmikosR's avatar
XhmikosR committed
6010
      EventHandler.one(target, Event$6.HIDDEN, function () {
XhmikosR's avatar
XhmikosR committed
6011
6012
        if (isVisible(_this11)) {
          _this11.focus();
Mark Otto's avatar
dist  
Mark Otto committed
6013
        }
Mark Otto's avatar
dist    
Mark Otto committed
6014
6015
      });
    });
XhmikosR's avatar
XhmikosR committed
6016
6017
6018
    var data = Data.getData(target, DATA_KEY$5);

    if (!data) {
6019
6020
      var config = _objectSpread2({}, Manipulator.getDataAttributes(target), {}, Manipulator.getDataAttributes(this));

XhmikosR's avatar
XhmikosR committed
6021
6022
      data = new Modal(target, config);
    }
Mark Otto's avatar
dist    
Mark Otto committed
6023

XhmikosR's avatar
XhmikosR committed
6024
    data.show(this);
XhmikosR's avatar
Dist    
XhmikosR committed
6025
  });
XhmikosR's avatar
XhmikosR committed
6026
  var $$6 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
6027
6028
6029
6030
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
6031
   * add .modal to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
6032
   */
Mark Otto's avatar
dist  
Mark Otto committed
6033

6034
6035
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
6036
6037
6038
6039
  if ($$6) {
    var JQUERY_NO_CONFLICT$5 = $$6.fn[NAME$5];
    $$6.fn[NAME$5] = Modal.jQueryInterface;
    $$6.fn[NAME$5].Constructor = Modal;
Mark Otto's avatar
dist  
Mark Otto committed
6040

XhmikosR's avatar
XhmikosR committed
6041
6042
6043
    $$6.fn[NAME$5].noConflict = function () {
      $$6.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
      return Modal.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
6044
6045
    };
  }
Mark Otto's avatar
dist  
Mark Otto committed
6046

XhmikosR's avatar
XhmikosR committed
6047
6048
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
6049
   * Bootstrap (v4.3.1): util/sanitizer.js
XhmikosR's avatar
XhmikosR committed
6050
6051
6052
6053
6054
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
XhmikosR's avatar
XhmikosR committed
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
  /**
   * A pattern that recognizes a commonly useful subset of URLs that are safe.
   *
   * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
   */

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

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

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

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

      return true;
    }

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

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

    return false;
  };

XhmikosR's avatar
XhmikosR committed
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
  var DefaultWhitelist = {
    // Global attributes allowed on any supplied element below.
    '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
    a: ['target', 'href', 'title', 'rel'],
    area: [],
    b: [],
    br: [],
    col: [],
    code: [],
    div: [],
    em: [],
    hr: [],
    h1: [],
    h2: [],
    h3: [],
    h4: [],
    h5: [],
    h6: [],
    i: [],
    img: ['src', 'alt', 'title', 'width', 'height'],
    li: [],
    ol: [],
    p: [],
    pre: [],
    s: [],
    small: [],
    span: [],
    sub: [],
    sup: [],
    strong: [],
    u: [],
    ul: []
  };
  function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
XhmikosR's avatar
XhmikosR committed
6128
    if (!unsafeHtml.length) {
XhmikosR's avatar
XhmikosR committed
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
      return unsafeHtml;
    }

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

    var domParser = new window.DOMParser();
    var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
    var whitelistKeys = Object.keys(whiteList);
XhmikosR's avatar
XhmikosR committed
6139
    var elements = makeArray(createdDocument.body.querySelectorAll('*'));
XhmikosR's avatar
XhmikosR committed
6140
6141
6142
6143
6144

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

XhmikosR's avatar
XhmikosR committed
6145
      if (whitelistKeys.indexOf(elName) === -1) {
XhmikosR's avatar
XhmikosR committed
6146
6147
6148
6149
        el.parentNode.removeChild(el);
        return "continue";
      }

XhmikosR's avatar
XhmikosR committed
6150
      var attributeList = makeArray(el.attributes);
XhmikosR's avatar
XhmikosR committed
6151
6152
6153
6154
6155
6156
6157
6158
6159
      var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
      attributeList.forEach(function (attr) {
        if (!allowedAttribute(attr, whitelistedAttributes)) {
          el.removeAttribute(attr.nodeName);
        }
      });
    };

    for (var i = 0, len = elements.length; i < len; i++) {
6160
      var _ret = _loop(i);
XhmikosR's avatar
XhmikosR committed
6161
6162
6163
6164
6165
6166
6167

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

    return createdDocument.body.innerHTML;
  }

XhmikosR's avatar
Dist    
XhmikosR committed
6168
6169
6170
6171
6172
6173
6174
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$6 = 'tooltip';
XhmikosR's avatar
XhmikosR committed
6175
  var VERSION$6 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
6176
6177
6178
6179
  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
6180
  var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
XhmikosR's avatar
Dist    
XhmikosR committed
6181
6182
6183
6184
6185
6186
6187
6188
6189
  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
6190
    offset: '(number|string|function)',
XhmikosR's avatar
Dist    
XhmikosR committed
6191
6192
    container: '(string|element|boolean)',
    fallbackPlacement: '(string|array)',
XhmikosR's avatar
XhmikosR committed
6193
6194
6195
    boundary: '(string|element)',
    sanitize: 'boolean',
    sanitizeFn: '(null|function)',
XhmikosR's avatar
XhmikosR committed
6196
6197
    whiteList: 'object',
    popperConfig: '(null|object)'
XhmikosR's avatar
Dist    
XhmikosR committed
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
  };
  var AttachmentMap$1 = {
    AUTO: 'auto',
    TOP: 'top',
    RIGHT: 'right',
    BOTTOM: 'bottom',
    LEFT: 'left'
  };
  var Default$4 = {
    animation: true,
XhmikosR's avatar
XhmikosR committed
6208
    template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>',
XhmikosR's avatar
Dist    
XhmikosR committed
6209
6210
6211
6212
6213
6214
6215
6216
6217
    trigger: 'hover focus',
    title: '',
    delay: 0,
    html: false,
    selector: false,
    placement: 'top',
    offset: 0,
    container: false,
    fallbackPlacement: 'flip',
XhmikosR's avatar
XhmikosR committed
6218
6219
6220
    boundary: 'scrollParent',
    sanitize: true,
    sanitizeFn: null,
XhmikosR's avatar
XhmikosR committed
6221
6222
    whiteList: DefaultWhitelist,
    popperConfig: null
XhmikosR's avatar
Dist    
XhmikosR committed
6223
6224
6225
6226
6227
  };
  var HoverState = {
    SHOW: 'show',
    OUT: 'out'
  };
XhmikosR's avatar
XhmikosR committed
6228
  var Event$7 = {
XhmikosR's avatar
Dist    
XhmikosR committed
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
    HIDE: "hide" + EVENT_KEY$6,
    HIDDEN: "hidden" + EVENT_KEY$6,
    SHOW: "show" + EVENT_KEY$6,
    SHOWN: "shown" + EVENT_KEY$6,
    INSERTED: "inserted" + EVENT_KEY$6,
    CLICK: "click" + EVENT_KEY$6,
    FOCUSIN: "focusin" + EVENT_KEY$6,
    FOCUSOUT: "focusout" + EVENT_KEY$6,
    MOUSEENTER: "mouseenter" + EVENT_KEY$6,
    MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  };
  var ClassName$6 = {
    FADE: 'fade',
    SHOW: 'show'
  };
  var Selector$6 = {
Mark Otto's avatar
dist v5    
Mark Otto committed
6245
    TOOLTIP_INNER: '.tooltip-inner'
XhmikosR's avatar
Dist    
XhmikosR committed
6246
6247
6248
6249
6250
6251
6252
  };
  var Trigger = {
    HOVER: 'hover',
    FOCUS: 'focus',
    CLICK: 'click',
    MANUAL: 'manual'
  };
XhmikosR's avatar
XhmikosR committed
6253
6254
6255
6256
6257
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist    
XhmikosR committed
6258
6259
6260
6261
6262
6263

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


XhmikosR's avatar
Dist    
XhmikosR committed
6268
6269
6270
6271
6272
      this._isEnabled = true;
      this._timeout = 0;
      this._hoverState = '';
      this._activeTrigger = {};
      this._popper = null; // Protected
Mark Otto's avatar
dist  
Mark Otto committed
6273

XhmikosR's avatar
Dist    
XhmikosR committed
6274
6275
6276
      this.element = element;
      this.config = this._getConfig(config);
      this.tip = null;
Mark Otto's avatar
dist  
Mark Otto committed
6277

XhmikosR's avatar
Dist    
XhmikosR committed
6278
      this._setListeners();
XhmikosR's avatar
XhmikosR committed
6279
6280

      Data.setData(element, this.constructor.DATA_KEY, this);
XhmikosR's avatar
Dist    
XhmikosR committed
6281
    } // Getters
Mark Otto's avatar
dist  
Mark Otto committed
6282
6283


XhmikosR's avatar
Dist    
XhmikosR committed
6284
    var _proto = Tooltip.prototype;
Mark Otto's avatar
dist  
Mark Otto committed
6285

XhmikosR's avatar
Dist    
XhmikosR committed
6286
6287
6288
6289
    // Public
    _proto.enable = function enable() {
      this._isEnabled = true;
    };
Mark Otto's avatar
dist  
Mark Otto committed
6290

XhmikosR's avatar
Dist    
XhmikosR committed
6291
6292
6293
    _proto.disable = function disable() {
      this._isEnabled = false;
    };
Mark Otto's avatar
dist  
Mark Otto committed
6294

XhmikosR's avatar
Dist    
XhmikosR committed
6295
6296
6297
    _proto.toggleEnabled = function toggleEnabled() {
      this._isEnabled = !this._isEnabled;
    };
Mark Otto's avatar
dist  
Mark Otto committed
6298

XhmikosR's avatar
Dist    
XhmikosR committed
6299
6300
6301
6302
    _proto.toggle = function toggle(event) {
      if (!this._isEnabled) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
6303

XhmikosR's avatar
Dist    
XhmikosR committed
6304
6305
      if (event) {
        var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
6306
        var context = Data.getData(event.delegateTarget, dataKey);
Mark Otto's avatar
dist  
Mark Otto committed
6307

XhmikosR's avatar
Dist    
XhmikosR committed
6308
        if (!context) {
XhmikosR's avatar
XhmikosR committed
6309
6310
          context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
          Data.setData(event.delegateTarget, dataKey, context);
Mark Otto's avatar
dist  
Mark Otto committed
6311
6312
        }

XhmikosR's avatar
Dist    
XhmikosR committed
6313
        context._activeTrigger.click = !context._activeTrigger.click;
Mark Otto's avatar
dist    
Mark Otto committed
6314

XhmikosR's avatar
Dist    
XhmikosR committed
6315
6316
        if (context._isWithActiveTrigger()) {
          context._enter(null, context);
Mark Otto's avatar
dist  
Mark Otto committed
6317
        } else {
XhmikosR's avatar
Dist    
XhmikosR committed
6318
6319
6320
          context._leave(null, context);
        }
      } else {
XhmikosR's avatar
XhmikosR committed
6321
        if (this.getTipElement().classList.contains(ClassName$6.SHOW)) {
XhmikosR's avatar
Dist    
XhmikosR committed
6322
          this._leave(null, this);
Mark Otto's avatar
dist  
Mark Otto committed
6323

XhmikosR's avatar
Dist    
XhmikosR committed
6324
          return;
Mark Otto's avatar
dist    
Mark Otto committed
6325
        }
Mark Otto's avatar
dist  
Mark Otto committed
6326

XhmikosR's avatar
Dist    
XhmikosR committed
6327
6328
6329
        this._enter(null, this);
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
6330

XhmikosR's avatar
Dist    
XhmikosR committed
6331
6332
    _proto.dispose = function dispose() {
      clearTimeout(this._timeout);
XhmikosR's avatar
XhmikosR committed
6333
6334
      Data.removeData(this.element, this.constructor.DATA_KEY);
      EventHandler.off(this.element, this.constructor.EVENT_KEY);
Mark Otto's avatar
dist v5    
Mark Otto committed
6335
      EventHandler.off(SelectorEngine.closest(this.element, '.modal'), 'hide.bs.modal', this._hideModalHandler);
Mark Otto's avatar
dist  
Mark Otto committed
6336

XhmikosR's avatar
Dist    
XhmikosR committed
6337
      if (this.tip) {
XhmikosR's avatar
XhmikosR committed
6338
        this.tip.parentNode.removeChild(this.tip);
XhmikosR's avatar
Dist    
XhmikosR committed
6339
      }
Mark Otto's avatar
dist    
Mark Otto committed
6340

XhmikosR's avatar
Dist    
XhmikosR committed
6341
6342
6343
6344
      this._isEnabled = null;
      this._timeout = null;
      this._hoverState = null;
      this._activeTrigger = null;
Mark Otto's avatar
dist  
Mark Otto committed
6345

XhmikosR's avatar
XhmikosR committed
6346
      if (this._popper) {
XhmikosR's avatar
Dist    
XhmikosR committed
6347
6348
        this._popper.destroy();
      }
Mark Otto's avatar
dist  
Mark Otto committed
6349

XhmikosR's avatar
Dist    
XhmikosR committed
6350
6351
6352
6353
6354
      this._popper = null;
      this.element = null;
      this.config = null;
      this.tip = null;
    };
Mark Otto's avatar
dist  
Mark Otto committed
6355

XhmikosR's avatar
Dist    
XhmikosR committed
6356
6357
    _proto.show = function show() {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
6358

XhmikosR's avatar
XhmikosR committed
6359
      if (this.element.style.display === 'none') {
XhmikosR's avatar
Dist    
XhmikosR committed
6360
6361
        throw new Error('Please use show on visible elements');
      }
Mark Otto's avatar
dist    
Mark Otto committed
6362

XhmikosR's avatar
Dist    
XhmikosR committed
6363
      if (this.isWithContent() && this._isEnabled) {
XhmikosR's avatar
XhmikosR committed
6364
6365
        var showEvent = EventHandler.trigger(this.element, this.constructor.Event.SHOW);
        var shadowRoot = findShadowRoot(this.element);
XhmikosR's avatar
Dist.    
XhmikosR committed
6366
        var isInTheDom = shadowRoot === null ? this.element.ownerDocument.documentElement.contains(this.element) : shadowRoot.contains(this.element);
Mark Otto's avatar
dist  
Mark Otto committed
6367

XhmikosR's avatar
XhmikosR committed
6368
        if (showEvent.defaultPrevented || !isInTheDom) {
XhmikosR's avatar
Dist    
XhmikosR committed
6369
6370
          return;
        }
Mark Otto's avatar
dist  
Mark Otto committed
6371

XhmikosR's avatar
Dist    
XhmikosR committed
6372
        var tip = this.getTipElement();
XhmikosR's avatar
XhmikosR committed
6373
        var tipId = getUID(this.constructor.NAME);
XhmikosR's avatar
Dist    
XhmikosR committed
6374
6375
6376
        tip.setAttribute('id', tipId);
        this.element.setAttribute('aria-describedby', tipId);
        this.setContent();
Mark Otto's avatar
dist  
Mark Otto committed
6377

XhmikosR's avatar
Dist    
XhmikosR committed
6378
        if (this.config.animation) {
XhmikosR's avatar
XhmikosR committed
6379
          tip.classList.add(ClassName$6.FADE);
XhmikosR's avatar
Dist    
XhmikosR committed
6380
        }
Mark Otto's avatar
dist  
Mark Otto committed
6381

XhmikosR's avatar
Dist    
XhmikosR committed
6382
        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
6383

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

6386
        this._addAttachmentClass(attachment);
Mark Otto's avatar
dist    
Mark Otto committed
6387
6388
6389

        var container = this._getContainer();

XhmikosR's avatar
XhmikosR committed
6390
        Data.setData(tip, this.constructor.DATA_KEY, this);
Mark Otto's avatar
dist  
Mark Otto committed
6391

XhmikosR's avatar
XhmikosR committed
6392
6393
        if (!this.element.ownerDocument.documentElement.contains(this.tip)) {
          container.appendChild(tip);
XhmikosR's avatar
Dist    
XhmikosR committed
6394
6395
        }

XhmikosR's avatar
XhmikosR committed
6396
        EventHandler.trigger(this.element, this.constructor.Event.INSERTED);
XhmikosR's avatar
XhmikosR committed
6397
        this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
XhmikosR's avatar
XhmikosR committed
6398
        tip.classList.add(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
XhmikosR's avatar
Dist    
XhmikosR committed
6399
6400
6401
        // 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
6402

XhmikosR's avatar
Dist    
XhmikosR committed
6403
        if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
6404
6405
6406
          makeArray(document.body.children).forEach(function (element) {
            EventHandler.on(element, 'mouseover', noop());
          });
XhmikosR's avatar
Dist    
XhmikosR committed
6407
        }
Mark Otto's avatar
dist  
Mark Otto committed
6408

XhmikosR's avatar
Dist    
XhmikosR committed
6409
6410
6411
6412
        var complete = function complete() {
          if (_this.config.animation) {
            _this._fixTransition();
          }
Mark Otto's avatar
dist    
Mark Otto committed
6413

XhmikosR's avatar
Dist    
XhmikosR committed
6414
6415
          var prevHoverState = _this._hoverState;
          _this._hoverState = null;
XhmikosR's avatar
XhmikosR committed
6416
          EventHandler.trigger(_this.element, _this.constructor.Event.SHOWN);
Mark Otto's avatar
dist  
Mark Otto committed
6417

XhmikosR's avatar
Dist    
XhmikosR committed
6418
6419
          if (prevHoverState === HoverState.OUT) {
            _this._leave(null, _this);
Mark Otto's avatar
dist  
Mark Otto committed
6420
          }
XhmikosR's avatar
Dist    
XhmikosR committed
6421
6422
        };

XhmikosR's avatar
XhmikosR committed
6423
6424
6425
6426
        if (this.tip.classList.contains(ClassName$6.FADE)) {
          var transitionDuration = getTransitionDurationFromElement(this.tip);
          EventHandler.one(this.tip, TRANSITION_END, complete);
          emulateTransitionEnd(this.tip, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
6427
6428
        } else {
          complete();
Mark Otto's avatar
dist  
Mark Otto committed
6429
        }
XhmikosR's avatar
Dist    
XhmikosR committed
6430
6431
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
6432

6433
    _proto.hide = function hide() {
XhmikosR's avatar
Dist    
XhmikosR committed
6434
      var _this2 = this;
Mark Otto's avatar
dist  
Mark Otto committed
6435

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

XhmikosR's avatar
Dist    
XhmikosR committed
6438
6439
6440
6441
      var complete = function complete() {
        if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
          tip.parentNode.removeChild(tip);
        }
Mark Otto's avatar
dist  
Mark Otto committed
6442

XhmikosR's avatar
Dist    
XhmikosR committed
6443
        _this2._cleanTipClass();
Mark Otto's avatar
dist    
Mark Otto committed
6444

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

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

6449
        _this2._popper.destroy();
XhmikosR's avatar
Dist    
XhmikosR committed
6450
      };
Mark Otto's avatar
dist  
Mark Otto committed
6451

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

XhmikosR's avatar
XhmikosR committed
6454
      if (hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
6455
6456
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
6457

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

XhmikosR's avatar
Dist    
XhmikosR committed
6461
      if ('ontouchstart' in document.documentElement) {
XhmikosR's avatar
XhmikosR committed
6462
6463
6464
        makeArray(document.body.children).forEach(function (element) {
          return EventHandler.off(element, 'mouseover', noop);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
6465
      }
Mark Otto's avatar
dist  
Mark Otto committed
6466

XhmikosR's avatar
Dist    
XhmikosR committed
6467
6468
6469
      this._activeTrigger[Trigger.CLICK] = false;
      this._activeTrigger[Trigger.FOCUS] = false;
      this._activeTrigger[Trigger.HOVER] = false;
Mark Otto's avatar
dist  
Mark Otto committed
6470

XhmikosR's avatar
XhmikosR committed
6471
6472
6473
6474
      if (this.tip.classList.contains(ClassName$6.FADE)) {
        var transitionDuration = getTransitionDurationFromElement(tip);
        EventHandler.one(tip, TRANSITION_END, complete);
        emulateTransitionEnd(tip, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
6475
6476
6477
      } else {
        complete();
      }
Mark Otto's avatar
dist  
Mark Otto committed
6478

XhmikosR's avatar
Dist    
XhmikosR committed
6479
6480
      this._hoverState = '';
    };
Mark Otto's avatar
dist  
Mark Otto committed
6481

XhmikosR's avatar
Dist    
XhmikosR committed
6482
6483
6484
6485
    _proto.update = function update() {
      if (this._popper !== null) {
        this._popper.scheduleUpdate();
      }
Mark Otto's avatar
Mark Otto committed
6486
6487
    } // Protected
    ;
Mark Otto's avatar
dist  
Mark Otto committed
6488

XhmikosR's avatar
Dist    
XhmikosR committed
6489
6490
6491
    _proto.isWithContent = function isWithContent() {
      return Boolean(this.getTitle());
    };
Mark Otto's avatar
dist  
Mark Otto committed
6492

XhmikosR's avatar
Dist    
XhmikosR committed
6493
    _proto.getTipElement = function getTipElement() {
XhmikosR's avatar
XhmikosR committed
6494
6495
6496
6497
6498
6499
6500
      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
6501
6502
      return this.tip;
    };
Mark Otto's avatar
dist  
Mark Otto committed
6503

XhmikosR's avatar
Dist    
XhmikosR committed
6504
6505
    _proto.setContent = function setContent() {
      var tip = this.getTipElement();
XhmikosR's avatar
XhmikosR committed
6506
6507
6508
      this.setElementContent(SelectorEngine.findOne(Selector$6.TOOLTIP_INNER, tip), this.getTitle());
      tip.classList.remove(ClassName$6.FADE);
      tip.classList.remove(ClassName$6.SHOW);
XhmikosR's avatar
Dist    
XhmikosR committed
6509
    };
Mark Otto's avatar
dist  
Mark Otto committed
6510

XhmikosR's avatar
XhmikosR committed
6511
6512
6513
6514
6515
    _proto.setElementContent = function setElementContent(element, content) {
      if (element === null) {
        return;
      }

6516
      if (typeof content === 'object' && isElement(content)) {
XhmikosR's avatar
XhmikosR committed
6517
6518
6519
6520
6521
        if (content.jquery) {
          content = content[0];
        } // content is a DOM node or a jQuery


XhmikosR's avatar
XhmikosR committed
6522
        if (this.config.html) {
XhmikosR's avatar
XhmikosR committed
6523
6524
6525
          if (content.parentNode !== element) {
            element.innerHTML = '';
            element.appendChild(content);
Mark Otto's avatar
dist  
Mark Otto committed
6526
6527
          }
        } else {
XhmikosR's avatar
XhmikosR committed
6528
          element.innerText = content.textContent;
Mark Otto's avatar
dist  
Mark Otto committed
6529
        }
XhmikosR's avatar
XhmikosR committed
6530
6531
6532
6533
6534
6535
6536
6537
6538

        return;
      }

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

XhmikosR's avatar
XhmikosR committed
6539
        element.innerHTML = content;
XhmikosR's avatar
Dist    
XhmikosR committed
6540
      } else {
XhmikosR's avatar
XhmikosR committed
6541
        element.innerText = content;
XhmikosR's avatar
Dist    
XhmikosR committed
6542
6543
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
6544

XhmikosR's avatar
Dist    
XhmikosR committed
6545
6546
    _proto.getTitle = function getTitle() {
      var title = this.element.getAttribute('data-original-title');
Mark Otto's avatar
dist  
Mark Otto committed
6547

XhmikosR's avatar
Dist    
XhmikosR committed
6548
6549
6550
      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
6551

XhmikosR's avatar
Dist    
XhmikosR committed
6552
      return title;
Mark Otto's avatar
Mark Otto committed
6553
6554
    } // Private
    ;
Mark Otto's avatar
dist  
Mark Otto committed
6555

XhmikosR's avatar
XhmikosR committed
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
    _proto._getPopperConfig = function _getPopperConfig(attachment) {
      var _this3 = this;

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

6585
6586
6587
6588
    _proto._addAttachmentClass = function _addAttachmentClass(attachment) {
      this.getTipElement().classList.add(CLASS_PREFIX + "-" + attachment);
    };

Mark Otto's avatar
Mark Otto committed
6589
    _proto._getOffset = function _getOffset() {
XhmikosR's avatar
XhmikosR committed
6590
      var _this4 = this;
Mark Otto's avatar
Mark Otto committed
6591
6592
6593
6594
6595

      var offset = {};

      if (typeof this.config.offset === 'function') {
        offset.fn = function (data) {
XhmikosR's avatar
XhmikosR committed
6596
          data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
Mark Otto's avatar
Mark Otto committed
6597
6598
6599
6600
6601
6602
6603
6604
6605
          return data;
        };
      } else {
        offset.offset = this.config.offset;
      }

      return offset;
    };

Mark Otto's avatar
dist    
Mark Otto committed
6606
6607
6608
6609
6610
    _proto._getContainer = function _getContainer() {
      if (this.config.container === false) {
        return document.body;
      }

XhmikosR's avatar
XhmikosR committed
6611
6612
      if (isElement(this.config.container)) {
        return this.config.container;
Mark Otto's avatar
dist    
Mark Otto committed
6613
6614
      }

XhmikosR's avatar
XhmikosR committed
6615
      return SelectorEngine.findOne(this.config.container);
Mark Otto's avatar
dist    
Mark Otto committed
6616
6617
    };

XhmikosR's avatar
Dist    
XhmikosR committed
6618
6619
6620
    _proto._getAttachment = function _getAttachment(placement) {
      return AttachmentMap$1[placement.toUpperCase()];
    };
Mark Otto's avatar
dist    
Mark Otto committed
6621

XhmikosR's avatar
Dist    
XhmikosR committed
6622
    _proto._setListeners = function _setListeners() {
XhmikosR's avatar
XhmikosR committed
6623
      var _this5 = this;
Mark Otto's avatar
dist  
Mark Otto committed
6624

XhmikosR's avatar
Dist    
XhmikosR committed
6625
6626
6627
      var triggers = this.config.trigger.split(' ');
      triggers.forEach(function (trigger) {
        if (trigger === 'click') {
XhmikosR's avatar
XhmikosR committed
6628
6629
          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
6630
          });
XhmikosR's avatar
Dist    
XhmikosR committed
6631
        } else if (trigger !== Trigger.MANUAL) {
XhmikosR's avatar
XhmikosR committed
6632
6633
6634
6635
          var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
          var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
          EventHandler.on(_this5.element, eventIn, _this5.config.selector, function (event) {
            return _this5._enter(event);
XhmikosR's avatar
XhmikosR committed
6636
          });
XhmikosR's avatar
XhmikosR committed
6637
6638
          EventHandler.on(_this5.element, eventOut, _this5.config.selector, function (event) {
            return _this5._leave(event);
Mark Otto's avatar
dist  
Mark Otto committed
6639
6640
          });
        }
XhmikosR's avatar
Dist    
XhmikosR committed
6641
      });
Mark Otto's avatar
dist v5    
Mark Otto committed
6642
6643

      this._hideModalHandler = function () {
XhmikosR's avatar
XhmikosR committed
6644
6645
        if (_this5.element) {
          _this5.hide();
XhmikosR's avatar
Dist    
XhmikosR committed
6646
        }
Mark Otto's avatar
dist v5    
Mark Otto committed
6647
6648
6649
      };

      EventHandler.on(SelectorEngine.closest(this.element, '.modal'), 'hide.bs.modal', this._hideModalHandler);
Mark Otto's avatar
dist  
Mark Otto committed
6650

XhmikosR's avatar
Dist    
XhmikosR committed
6651
      if (this.config.selector) {
6652
        this.config = _objectSpread2({}, this.config, {
XhmikosR's avatar
Dist    
XhmikosR committed
6653
6654
6655
6656
6657
6658
6659
          trigger: 'manual',
          selector: ''
        });
      } else {
        this._fixTitle();
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
6660

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

XhmikosR's avatar
Dist    
XhmikosR committed
6664
6665
6666
6667
6668
      if (this.element.getAttribute('title') || titleType !== 'string') {
        this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
        this.element.setAttribute('title', '');
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
6669

XhmikosR's avatar
Dist    
XhmikosR committed
6670
6671
    _proto._enter = function _enter(event, context) {
      var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
6672
      context = context || Data.getData(event.delegateTarget, dataKey);
Mark Otto's avatar
dist  
Mark Otto committed
6673

XhmikosR's avatar
Dist    
XhmikosR committed
6674
      if (!context) {
XhmikosR's avatar
XhmikosR committed
6675
6676
        context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
        Data.setData(event.delegateTarget, dataKey, context);
XhmikosR's avatar
Dist    
XhmikosR committed
6677
      }
Mark Otto's avatar
dist  
Mark Otto committed
6678

XhmikosR's avatar
Dist    
XhmikosR committed
6679
6680
6681
      if (event) {
        context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
      }
Mark Otto's avatar
dist  
Mark Otto committed
6682

XhmikosR's avatar
XhmikosR committed
6683
      if (context.getTipElement().classList.contains(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
Mark Otto's avatar
dist  
Mark Otto committed
6684
        context._hoverState = HoverState.SHOW;
XhmikosR's avatar
Dist    
XhmikosR committed
6685
6686
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
6687

XhmikosR's avatar
Dist    
XhmikosR committed
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
      clearTimeout(context._timeout);
      context._hoverState = HoverState.SHOW;

      if (!context.config.delay || !context.config.delay.show) {
        context.show();
        return;
      }

      context._timeout = setTimeout(function () {
        if (context._hoverState === HoverState.SHOW) {
Mark Otto's avatar
dist  
Mark Otto committed
6698
6699
          context.show();
        }
XhmikosR's avatar
Dist    
XhmikosR committed
6700
6701
      }, context.config.delay.show);
    };
Mark Otto's avatar
dist  
Mark Otto committed
6702

XhmikosR's avatar
Dist    
XhmikosR committed
6703
6704
    _proto._leave = function _leave(event, context) {
      var dataKey = this.constructor.DATA_KEY;
XhmikosR's avatar
XhmikosR committed
6705
      context = context || Data.getData(event.delegateTarget, dataKey);
Mark Otto's avatar
dist  
Mark Otto committed
6706

XhmikosR's avatar
Dist    
XhmikosR committed
6707
      if (!context) {
XhmikosR's avatar
XhmikosR committed
6708
6709
        context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
        Data.setData(event.delegateTarget, dataKey, context);
XhmikosR's avatar
Dist    
XhmikosR committed
6710
      }
Mark Otto's avatar
dist  
Mark Otto committed
6711

XhmikosR's avatar
Dist    
XhmikosR committed
6712
6713
6714
      if (event) {
        context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
      }
Mark Otto's avatar
dist  
Mark Otto committed
6715

XhmikosR's avatar
Dist    
XhmikosR committed
6716
6717
6718
      if (context._isWithActiveTrigger()) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
6719

XhmikosR's avatar
Dist    
XhmikosR committed
6720
6721
      clearTimeout(context._timeout);
      context._hoverState = HoverState.OUT;
Mark Otto's avatar
dist  
Mark Otto committed
6722

XhmikosR's avatar
Dist    
XhmikosR committed
6723
6724
6725
6726
      if (!context.config.delay || !context.config.delay.hide) {
        context.hide();
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
6727

XhmikosR's avatar
Dist    
XhmikosR committed
6728
6729
      context._timeout = setTimeout(function () {
        if (context._hoverState === HoverState.OUT) {
Mark Otto's avatar
dist  
Mark Otto committed
6730
6731
          context.hide();
        }
XhmikosR's avatar
Dist    
XhmikosR committed
6732
6733
      }, context.config.delay.hide);
    };
Mark Otto's avatar
dist  
Mark Otto committed
6734

XhmikosR's avatar
Dist    
XhmikosR committed
6735
6736
6737
6738
    _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
      for (var trigger in this._activeTrigger) {
        if (this._activeTrigger[trigger]) {
          return true;
Mark Otto's avatar
dist  
Mark Otto committed
6739
        }
XhmikosR's avatar
Dist    
XhmikosR committed
6740
      }
Mark Otto's avatar
dist  
Mark Otto committed
6741

XhmikosR's avatar
Dist    
XhmikosR committed
6742
6743
      return false;
    };
Mark Otto's avatar
dist  
Mark Otto committed
6744

XhmikosR's avatar
Dist    
XhmikosR committed
6745
    _proto._getConfig = function _getConfig(config) {
XhmikosR's avatar
XhmikosR committed
6746
      var dataAttributes = Manipulator.getDataAttributes(this.element);
XhmikosR's avatar
XhmikosR committed
6747
6748
6749
6750
6751
      Object.keys(dataAttributes).forEach(function (dataAttr) {
        if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
          delete dataAttributes[dataAttr];
        }
      });
XhmikosR's avatar
XhmikosR committed
6752
6753
6754
6755
6756

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

6757
      config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
Mark Otto's avatar
dist  
Mark Otto committed
6758

XhmikosR's avatar
Dist    
XhmikosR committed
6759
6760
6761
6762
6763
6764
      if (typeof config.delay === 'number') {
        config.delay = {
          show: config.delay,
          hide: config.delay
        };
      }
Mark Otto's avatar
dist  
Mark Otto committed
6765

XhmikosR's avatar
Dist    
XhmikosR committed
6766
6767
6768
      if (typeof config.title === 'number') {
        config.title = config.title.toString();
      }
Mark Otto's avatar
dist  
Mark Otto committed
6769

XhmikosR's avatar
Dist    
XhmikosR committed
6770
6771
6772
      if (typeof config.content === 'number') {
        config.content = config.content.toString();
      }
Mark Otto's avatar
dist  
Mark Otto committed
6773

XhmikosR's avatar
XhmikosR committed
6774
      typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
XhmikosR's avatar
XhmikosR committed
6775
6776
6777
6778
6779

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

XhmikosR's avatar
Dist    
XhmikosR committed
6780
6781
      return config;
    };
Mark Otto's avatar
dist  
Mark Otto committed
6782

XhmikosR's avatar
Dist    
XhmikosR committed
6783
6784
    _proto._getDelegateConfig = function _getDelegateConfig() {
      var config = {};
Mark Otto's avatar
dist  
Mark Otto committed
6785

XhmikosR's avatar
Dist    
XhmikosR committed
6786
6787
6788
6789
      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
6790
6791
          }
        }
XhmikosR's avatar
Dist    
XhmikosR committed
6792
      }
Mark Otto's avatar
dist  
Mark Otto committed
6793

XhmikosR's avatar
Dist    
XhmikosR committed
6794
6795
      return config;
    };
Mark Otto's avatar
dist    
Mark Otto committed
6796

XhmikosR's avatar
Dist    
XhmikosR committed
6797
    _proto._cleanTipClass = function _cleanTipClass() {
XhmikosR's avatar
XhmikosR committed
6798
6799
      var tip = this.getTipElement();
      var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
Mark Otto's avatar
dist  
Mark Otto committed
6800

XhmikosR's avatar
Dist    
XhmikosR committed
6801
      if (tabClass !== null && tabClass.length) {
XhmikosR's avatar
XhmikosR committed
6802
6803
6804
6805
6806
        tabClass.map(function (token) {
          return token.trim();
        }).forEach(function (tClass) {
          return tip.classList.remove(tClass);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
6807
6808
      }
    };
Mark Otto's avatar
dist    
Mark Otto committed
6809

XhmikosR's avatar
Dist    
XhmikosR committed
6810
6811
6812
    _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
      var popperInstance = popperData.instance;
      this.tip = popperInstance.popper;
Mark Otto's avatar
dist    
Mark Otto committed
6813

XhmikosR's avatar
Dist    
XhmikosR committed
6814
      this._cleanTipClass();
Mark Otto's avatar
dist  
Mark Otto committed
6815

6816
      this._addAttachmentClass(this._getAttachment(popperData.placement));
XhmikosR's avatar
Dist    
XhmikosR committed
6817
    };
Mark Otto's avatar
dist    
Mark Otto committed
6818

XhmikosR's avatar
Dist    
XhmikosR committed
6819
6820
6821
    _proto._fixTransition = function _fixTransition() {
      var tip = this.getTipElement();
      var initConfigAnimation = this.config.animation;
Mark Otto's avatar
dist    
Mark Otto committed
6822

XhmikosR's avatar
Dist    
XhmikosR committed
6823
6824
6825
      if (tip.getAttribute('x-placement') !== null) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
6826

XhmikosR's avatar
XhmikosR committed
6827
      tip.classList.remove(ClassName$6.FADE);
XhmikosR's avatar
Dist    
XhmikosR committed
6828
6829
6830
6831
      this.config.animation = false;
      this.hide();
      this.show();
      this.config.animation = initConfigAnimation;
Mark Otto's avatar
Mark Otto committed
6832
6833
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
6834

XhmikosR's avatar
XhmikosR committed
6835
    Tooltip.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
6836
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
6837
        var data = Data.getData(this, DATA_KEY$6);
Mark Otto's avatar
dist    
Mark Otto committed
6838

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

XhmikosR's avatar
Dist    
XhmikosR committed
6841
6842
6843
        if (!data && /dispose|hide/.test(config)) {
          return;
        }
Mark Otto's avatar
dist  
Mark Otto committed
6844

XhmikosR's avatar
Dist    
XhmikosR committed
6845
6846
6847
        if (!data) {
          data = new Tooltip(this, _config);
        }
Mark Otto's avatar
dist  
Mark Otto committed
6848

XhmikosR's avatar
Dist    
XhmikosR committed
6849
6850
6851
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist  
Mark Otto committed
6852
          }
Mark Otto's avatar
dist    
Mark Otto committed
6853

XhmikosR's avatar
Dist    
XhmikosR committed
6854
          data[config]();
Mark Otto's avatar
dist    
Mark Otto committed
6855
        }
XhmikosR's avatar
Dist    
XhmikosR committed
6856
6857
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
6858

XhmikosR's avatar
XhmikosR committed
6859
    Tooltip.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
6860
6861
6862
      return Data.getData(element, DATA_KEY$6);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
    _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
6886
        return Event$7;
XhmikosR's avatar
Dist    
XhmikosR committed
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
      }
    }, {
      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
6899

XhmikosR's avatar
Dist    
XhmikosR committed
6900
6901
    return Tooltip;
  }();
XhmikosR's avatar
XhmikosR committed
6902
6903

  var $$7 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
6904
6905
6906
6907
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
6908
   * add .tooltip to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
6909
   */
Mark Otto's avatar
dist    
Mark Otto committed
6910

6911
6912
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
6913
6914
6915
6916
  if ($$7) {
    var JQUERY_NO_CONFLICT$6 = $$7.fn[NAME$6];
    $$7.fn[NAME$6] = Tooltip.jQueryInterface;
    $$7.fn[NAME$6].Constructor = Tooltip;
Mark Otto's avatar
dist  
Mark Otto committed
6917

XhmikosR's avatar
XhmikosR committed
6918
6919
6920
    $$7.fn[NAME$6].noConflict = function () {
      $$7.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
      return Tooltip.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
6921
6922
    };
  }
Mark Otto's avatar
dist  
Mark Otto committed
6923

XhmikosR's avatar
Dist    
XhmikosR committed
6924
6925
6926
6927
6928
6929
6930
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$7 = 'popover';
XhmikosR's avatar
XhmikosR committed
6931
  var VERSION$7 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
6932
6933
6934
6935
6936
  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');

6937
  var Default$5 = _objectSpread2({}, Tooltip.Default, {
XhmikosR's avatar
Dist    
XhmikosR committed
6938
6939
6940
    placement: 'right',
    trigger: 'click',
    content: '',
XhmikosR's avatar
XhmikosR committed
6941
    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
6942
6943
  });

6944
  var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
XhmikosR's avatar
Dist    
XhmikosR committed
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
    content: '(string|element|function)'
  });

  var ClassName$7 = {
    FADE: 'fade',
    SHOW: 'show'
  };
  var Selector$7 = {
    TITLE: '.popover-header',
    CONTENT: '.popover-body'
  };
XhmikosR's avatar
XhmikosR committed
6956
  var Event$8 = {
XhmikosR's avatar
Dist    
XhmikosR committed
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
    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
6968
6969
6970
6971
6972
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
6973

XhmikosR's avatar
Dist    
XhmikosR committed
6974
6975
6976
6977
  var Popover =
  /*#__PURE__*/
  function (_Tooltip) {
    _inheritsLoose(Popover, _Tooltip);
Mark Otto's avatar
dist  
Mark Otto committed
6978

XhmikosR's avatar
Dist    
XhmikosR committed
6979
6980
6981
    function Popover() {
      return _Tooltip.apply(this, arguments) || this;
    }
Mark Otto's avatar
Mark Otto committed
6982

XhmikosR's avatar
Dist    
XhmikosR committed
6983
    var _proto = Popover.prototype;
Mark Otto's avatar
Mark Otto committed
6984

XhmikosR's avatar
Dist    
XhmikosR committed
6985
6986
6987
6988
    // Overrides
    _proto.isWithContent = function isWithContent() {
      return this.getTitle() || this._getContent();
    };
Mark Otto's avatar
dist    
Mark Otto committed
6989

XhmikosR's avatar
Dist    
XhmikosR committed
6990
    _proto.setContent = function setContent() {
XhmikosR's avatar
XhmikosR committed
6991
      var tip = this.getTipElement(); // we use append for html objects to maintain js events
Mark Otto's avatar
dist  
Mark Otto committed
6992

XhmikosR's avatar
XhmikosR committed
6993
      this.setElementContent(SelectorEngine.findOne(Selector$7.TITLE, tip), this.getTitle());
Mark Otto's avatar
dist  
Mark Otto committed
6994

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

XhmikosR's avatar
Dist    
XhmikosR committed
6997
6998
6999
      if (typeof content === 'function') {
        content = content.call(this.element);
      }
Mark Otto's avatar
dist    
Mark Otto committed
7000

XhmikosR's avatar
XhmikosR committed
7001
7002
7003
      this.setElementContent(SelectorEngine.findOne(Selector$7.CONTENT, tip), content);
      tip.classList.remove(ClassName$7.FADE);
      tip.classList.remove(ClassName$7.SHOW);
XhmikosR's avatar
XhmikosR committed
7004
7005
7006
7007
    };

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

XhmikosR's avatar
Dist    
XhmikosR committed
7011
7012
7013
    _proto._getContent = function _getContent() {
      return this.element.getAttribute('data-content') || this.config.content;
    };
Mark Otto's avatar
dist    
Mark Otto committed
7014

XhmikosR's avatar
Dist    
XhmikosR committed
7015
    _proto._cleanTipClass = function _cleanTipClass() {
XhmikosR's avatar
XhmikosR committed
7016
7017
      var tip = this.getTipElement();
      var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX$1);
Mark Otto's avatar
dist  
Mark Otto committed
7018

XhmikosR's avatar
Dist    
XhmikosR committed
7019
      if (tabClass !== null && tabClass.length > 0) {
XhmikosR's avatar
XhmikosR committed
7020
7021
7022
7023
7024
        tabClass.map(function (token) {
          return token.trim();
        }).forEach(function (tClass) {
          return tip.classList.remove(tClass);
        });
XhmikosR's avatar
Dist    
XhmikosR committed
7025
      }
Mark Otto's avatar
Mark Otto committed
7026
7027
    } // Static
    ;
Mark Otto's avatar
dist    
Mark Otto committed
7028

XhmikosR's avatar
XhmikosR committed
7029
    Popover.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
7030
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
7031
        var data = Data.getData(this, DATA_KEY$7);
Mark Otto's avatar
dist    
Mark Otto committed
7032

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

XhmikosR's avatar
Dist    
XhmikosR committed
7035
7036
7037
        if (!data && /dispose|hide/.test(config)) {
          return;
        }
Mark Otto's avatar
dist  
Mark Otto committed
7038

XhmikosR's avatar
Dist    
XhmikosR committed
7039
7040
        if (!data) {
          data = new Popover(this, _config);
XhmikosR's avatar
XhmikosR committed
7041
          Data.setData(this, DATA_KEY$7, data);
XhmikosR's avatar
Dist    
XhmikosR committed
7042
        }
Mark Otto's avatar
dist  
Mark Otto committed
7043

XhmikosR's avatar
Dist    
XhmikosR committed
7044
7045
7046
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist  
Mark Otto committed
7047
          }
Mark Otto's avatar
dist    
Mark Otto committed
7048

XhmikosR's avatar
Dist    
XhmikosR committed
7049
          data[config]();
Mark Otto's avatar
dist    
Mark Otto committed
7050
        }
XhmikosR's avatar
Dist    
XhmikosR committed
7051
7052
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
7053

XhmikosR's avatar
XhmikosR committed
7054
    Popover.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
7055
7056
7057
      return Data.getData(element, DATA_KEY$7);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
    _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
7082
        return Event$8;
XhmikosR's avatar
Dist    
XhmikosR committed
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
      }
    }, {
      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
7095

XhmikosR's avatar
Dist    
XhmikosR committed
7096
7097
    return Popover;
  }(Tooltip);
XhmikosR's avatar
XhmikosR committed
7098
7099

  var $$8 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
7100
7101
7102
7103
7104
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
7105

7106
7107
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
7108
7109
7110
7111
  if ($$8) {
    var JQUERY_NO_CONFLICT$7 = $$8.fn[NAME$7];
    $$8.fn[NAME$7] = Popover.jQueryInterface;
    $$8.fn[NAME$7].Constructor = Popover;
Mark Otto's avatar
dist  
Mark Otto committed
7112

XhmikosR's avatar
XhmikosR committed
7113
7114
7115
    $$8.fn[NAME$7].noConflict = function () {
      $$8.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
      return Popover.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
7116
7117
    };
  }
Mark Otto's avatar
dist  
Mark Otto committed
7118

XhmikosR's avatar
Dist    
XhmikosR committed
7119
7120
7121
7122
7123
7124
7125
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME$8 = 'scrollspy';
XhmikosR's avatar
XhmikosR committed
7126
  var VERSION$8 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
  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
7140
  var Event$9 = {
XhmikosR's avatar
Dist    
XhmikosR committed
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
    ACTIVATE: "activate" + EVENT_KEY$8,
    SCROLL: "scroll" + EVENT_KEY$8,
    LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  };
  var ClassName$8 = {
    DROPDOWN_ITEM: 'dropdown-item',
    ACTIVE: 'active'
  };
  var Selector$8 = {
    DATA_SPY: '[data-spy="scroll"]',
    NAV_LIST_GROUP: '.nav, .list-group',
    NAV_LINKS: '.nav-link',
    NAV_ITEMS: '.nav-item',
    LIST_ITEMS: '.list-group-item',
    DROPDOWN: '.dropdown',
    DROPDOWN_TOGGLE: '.dropdown-toggle'
  };
  var OffsetMethod = {
    OFFSET: 'offset',
    POSITION: 'position'
  };
XhmikosR's avatar
XhmikosR committed
7162
7163
7164
7165
7166
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist    
XhmikosR committed
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176

  var ScrollSpy =
  /*#__PURE__*/
  function () {
    function ScrollSpy(element, config) {
      var _this = this;

      this._element = element;
      this._scrollElement = element.tagName === 'BODY' ? window : element;
      this._config = this._getConfig(config);
XhmikosR's avatar
Dist.    
XhmikosR committed
7177
      this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " ." + ClassName$8.DROPDOWN_ITEM);
XhmikosR's avatar
Dist    
XhmikosR committed
7178
7179
7180
7181
      this._offsets = [];
      this._targets = [];
      this._activeTarget = null;
      this._scrollHeight = 0;
XhmikosR's avatar
XhmikosR committed
7182
      EventHandler.on(this._scrollElement, Event$9.SCROLL, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
7183
7184
7185
7186
7187
        return _this._process(event);
      });
      this.refresh();

      this._process();
XhmikosR's avatar
XhmikosR committed
7188
7189

      Data.setData(element, DATA_KEY$8, this);
XhmikosR's avatar
Dist    
XhmikosR committed
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
    } // Getters


    var _proto = ScrollSpy.prototype;

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

      var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
      var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
      var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
      this._offsets = [];
      this._targets = [];
      this._scrollHeight = this._getScrollHeight();
XhmikosR's avatar
XhmikosR committed
7205
      var targets = makeArray(SelectorEngine.find(this._selector));
XhmikosR's avatar
Dist    
XhmikosR committed
7206
7207
      targets.map(function (element) {
        var target;
XhmikosR's avatar
XhmikosR committed
7208
        var targetSelector = getSelectorFromElement(element);
XhmikosR's avatar
Dist    
XhmikosR committed
7209
7210

        if (targetSelector) {
XhmikosR's avatar
XhmikosR committed
7211
          target = SelectorEngine.findOne(targetSelector);
XhmikosR's avatar
Dist    
XhmikosR committed
7212
7213
7214
7215
7216
7217
        }

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

          if (targetBCR.width || targetBCR.height) {
XhmikosR's avatar
XhmikosR committed
7218
            return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
XhmikosR's avatar
Dist    
XhmikosR committed
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
          }
        }

        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
7232
    };
XhmikosR's avatar
Dist    
XhmikosR committed
7233
7234

    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
7235
7236
      Data.removeData(this._element, DATA_KEY$8);
      EventHandler.off(this._scrollElement, EVENT_KEY$8);
XhmikosR's avatar
Dist    
XhmikosR committed
7237
7238
7239
7240
7241
7242
7243
7244
      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
7245
7246
    } // Private
    ;
XhmikosR's avatar
Dist    
XhmikosR committed
7247
7248

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

      if (typeof config.target !== 'string') {
XhmikosR's avatar
XhmikosR committed
7252
        var id = config.target.id;
XhmikosR's avatar
Dist    
XhmikosR committed
7253
7254

        if (!id) {
XhmikosR's avatar
XhmikosR committed
7255
7256
          id = getUID(NAME$8);
          config.target.id = id;
XhmikosR's avatar
Dist    
XhmikosR committed
7257
7258
7259
7260
7261
        }

        config.target = "#" + id;
      }

XhmikosR's avatar
XhmikosR committed
7262
      typeCheckConfig(NAME$8, config, DefaultType$6);
XhmikosR's avatar
Dist    
XhmikosR committed
7263
      return config;
Mark Otto's avatar
dist    
Mark Otto committed
7264
    };
XhmikosR's avatar
Dist    
XhmikosR committed
7265
7266
7267

    _proto._getScrollTop = function _getScrollTop() {
      return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
Mark Otto's avatar
dist    
Mark Otto committed
7268
    };
XhmikosR's avatar
Dist    
XhmikosR committed
7269
7270
7271

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

XhmikosR's avatar
Dist    
XhmikosR committed
7274
7275
    _proto._getOffsetHeight = function _getOffsetHeight() {
      return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
Mark Otto's avatar
dist    
Mark Otto committed
7276
    };
Mark Otto's avatar
dist  
Mark Otto committed
7277

XhmikosR's avatar
Dist    
XhmikosR committed
7278
7279
    _proto._process = function _process() {
      var scrollTop = this._getScrollTop() + this._config.offset;
Mark Otto's avatar
dist    
Mark Otto committed
7280

XhmikosR's avatar
Dist    
XhmikosR committed
7281
7282
7283
7284
7285
      var scrollHeight = this._getScrollHeight();

      var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();

      if (this._scrollHeight !== scrollHeight) {
Mark Otto's avatar
dist    
Mark Otto committed
7286
        this.refresh();
XhmikosR's avatar
Dist    
XhmikosR committed
7287
      }
Mark Otto's avatar
dist    
Mark Otto committed
7288

XhmikosR's avatar
Dist    
XhmikosR committed
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
      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;
      }

      var offsetLength = this._offsets.length;

      for (var i = offsetLength; i--;) {
        var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);

        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
7322

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

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

XhmikosR's avatar
XhmikosR committed
7329
7330
7331
      if (link.classList.contains(ClassName$8.DROPDOWN_ITEM)) {
        SelectorEngine.findOne(Selector$8.DROPDOWN_TOGGLE, SelectorEngine.closest(link, Selector$8.DROPDOWN)).classList.add(ClassName$8.ACTIVE);
        link.classList.add(ClassName$8.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
7332
7333
      } else {
        // Set triggered link as active
XhmikosR's avatar
XhmikosR committed
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
        link.classList.add(ClassName$8.ACTIVE);
        SelectorEngine.parents(link, Selector$8.NAV_LIST_GROUP).forEach(function (listGroup) {
          // Set triggered links parents as active
          // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
          SelectorEngine.prev(listGroup, Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).forEach(function (item) {
            return item.classList.add(ClassName$8.ACTIVE);
          }); // Handle special case when .nav-link is inside .nav-item

          SelectorEngine.prev(listGroup, Selector$8.NAV_ITEMS).forEach(function (navItem) {
            SelectorEngine.children(navItem, Selector$8.NAV_LINKS).forEach(function (item) {
              return item.classList.add(ClassName$8.ACTIVE);
            });
          });
        });
XhmikosR's avatar
Dist    
XhmikosR committed
7348
      }
Mark Otto's avatar
dist    
Mark Otto committed
7349

XhmikosR's avatar
XhmikosR committed
7350
      EventHandler.trigger(this._scrollElement, Event$9.ACTIVATE, {
XhmikosR's avatar
Dist    
XhmikosR committed
7351
7352
7353
        relatedTarget: target
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
7354

XhmikosR's avatar
Dist    
XhmikosR committed
7355
    _proto._clear = function _clear() {
XhmikosR's avatar
XhmikosR committed
7356
      makeArray(SelectorEngine.find(this._selector)).filter(function (node) {
XhmikosR's avatar
Dist    
XhmikosR committed
7357
7358
7359
7360
        return node.classList.contains(ClassName$8.ACTIVE);
      }).forEach(function (node) {
        return node.classList.remove(ClassName$8.ACTIVE);
      });
Mark Otto's avatar
Mark Otto committed
7361
7362
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
7363

XhmikosR's avatar
XhmikosR committed
7364
    ScrollSpy.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
7365
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
7366
        var data = Data.getData(this, DATA_KEY$8);
Mark Otto's avatar
dist  
Mark Otto committed
7367

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

XhmikosR's avatar
Dist    
XhmikosR committed
7370
7371
7372
        if (!data) {
          data = new ScrollSpy(this, _config);
        }
Mark Otto's avatar
dist  
Mark Otto committed
7373

XhmikosR's avatar
Dist    
XhmikosR committed
7374
7375
7376
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist    
Mark Otto committed
7377
          }
Mark Otto's avatar
dist    
Mark Otto committed
7378

XhmikosR's avatar
Dist    
XhmikosR committed
7379
          data[config]();
Mark Otto's avatar
dist  
Mark Otto committed
7380
        }
XhmikosR's avatar
Dist    
XhmikosR committed
7381
7382
      });
    };
Mark Otto's avatar
dist    
Mark Otto committed
7383

XhmikosR's avatar
XhmikosR committed
7384
    ScrollSpy.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
7385
7386
7387
      return Data.getData(element, DATA_KEY$8);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
    _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
7399

XhmikosR's avatar
Dist    
XhmikosR committed
7400
7401
7402
7403
7404
7405
7406
    return ScrollSpy;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
7407
7408


XhmikosR's avatar
XhmikosR committed
7409
7410
7411
7412
  EventHandler.on(window, Event$9.LOAD_DATA_API, function () {
    makeArray(SelectorEngine.find(Selector$8.DATA_SPY)).forEach(function (spy) {
      return new ScrollSpy(spy, Manipulator.getDataAttributes(spy));
    });
XhmikosR's avatar
Dist    
XhmikosR committed
7413
  });
XhmikosR's avatar
XhmikosR committed
7414
  var $$9 = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
7415
7416
7417
7418
7419
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
7420

7421
7422
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
7423
7424
7425
7426
  if ($$9) {
    var JQUERY_NO_CONFLICT$8 = $$9.fn[NAME$8];
    $$9.fn[NAME$8] = ScrollSpy.jQueryInterface;
    $$9.fn[NAME$8].Constructor = ScrollSpy;
Mark Otto's avatar
dist  
Mark Otto committed
7427

XhmikosR's avatar
XhmikosR committed
7428
7429
7430
    $$9.fn[NAME$8].noConflict = function () {
      $$9.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
      return ScrollSpy.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
7431
7432
    };
  }
Mark Otto's avatar
dist  
Mark Otto committed
7433

XhmikosR's avatar
Dist    
XhmikosR committed
7434
7435
7436
7437
7438
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
7439

XhmikosR's avatar
Dist    
XhmikosR committed
7440
  var NAME$9 = 'tab';
XhmikosR's avatar
XhmikosR committed
7441
  var VERSION$9 = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
7442
7443
7444
  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
7445
  var Event$a = {
XhmikosR's avatar
Dist    
XhmikosR committed
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
    HIDE: "hide" + EVENT_KEY$9,
    HIDDEN: "hidden" + EVENT_KEY$9,
    SHOW: "show" + EVENT_KEY$9,
    SHOWN: "shown" + EVENT_KEY$9,
    CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  };
  var ClassName$9 = {
    DROPDOWN_MENU: 'dropdown-menu',
    ACTIVE: 'active',
    DISABLED: 'disabled',
    FADE: 'fade',
    SHOW: 'show'
  };
  var Selector$9 = {
    DROPDOWN: '.dropdown',
    NAV_LIST_GROUP: '.nav, .list-group',
    ACTIVE: '.active',
XhmikosR's avatar
XhmikosR committed
7463
    ACTIVE_UL: ':scope > li > .active',
XhmikosR's avatar
Dist    
XhmikosR committed
7464
7465
    DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
    DROPDOWN_TOGGLE: '.dropdown-toggle',
XhmikosR's avatar
XhmikosR committed
7466
    DROPDOWN_ACTIVE_CHILD: ':scope > .dropdown-menu .active'
XhmikosR's avatar
Dist    
XhmikosR committed
7467
  };
XhmikosR's avatar
XhmikosR committed
7468
7469
7470
7471
7472
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
7473

XhmikosR's avatar
Dist    
XhmikosR committed
7474
7475
7476
7477
7478
  var Tab =
  /*#__PURE__*/
  function () {
    function Tab(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
7479
      Data.setData(this._element, DATA_KEY$9, this);
XhmikosR's avatar
Dist    
XhmikosR committed
7480
    } // Getters
Mark Otto's avatar
dist  
Mark Otto committed
7481

Mark Otto's avatar
dist    
Mark Otto committed
7482

XhmikosR's avatar
Dist    
XhmikosR committed
7483
    var _proto = Tab.prototype;
Mark Otto's avatar
dist  
Mark Otto committed
7484

XhmikosR's avatar
Dist    
XhmikosR committed
7485
7486
7487
    // Public
    _proto.show = function show() {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
7488

XhmikosR's avatar
XhmikosR committed
7489
      if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(ClassName$9.ACTIVE) || this._element.classList.contains(ClassName$9.DISABLED)) {
XhmikosR's avatar
Dist    
XhmikosR committed
7490
7491
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
7492

XhmikosR's avatar
Dist    
XhmikosR committed
7493
      var previous;
XhmikosR's avatar
XhmikosR committed
7494
      var target = getElementFromSelector(this._element);
XhmikosR's avatar
XhmikosR committed
7495
      var listElement = SelectorEngine.closest(this._element, Selector$9.NAV_LIST_GROUP);
XhmikosR's avatar
Dist    
XhmikosR committed
7496
7497

      if (listElement) {
XhmikosR's avatar
Dist    
XhmikosR committed
7498
        var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
XhmikosR's avatar
XhmikosR committed
7499
        previous = makeArray(SelectorEngine.find(itemSelector, listElement));
XhmikosR's avatar
Dist    
XhmikosR committed
7500
7501
        previous = previous[previous.length - 1];
      }
Mark Otto's avatar
dist  
Mark Otto committed
7502

XhmikosR's avatar
XhmikosR committed
7503
      var hideEvent = null;
Mark Otto's avatar
dist    
Mark Otto committed
7504

XhmikosR's avatar
Dist    
XhmikosR committed
7505
      if (previous) {
XhmikosR's avatar
XhmikosR committed
7506
7507
7508
        hideEvent = EventHandler.trigger(previous, Event$a.HIDE, {
          relatedTarget: this._element
        });
XhmikosR's avatar
Dist    
XhmikosR committed
7509
      }
Mark Otto's avatar
dist    
Mark Otto committed
7510

XhmikosR's avatar
XhmikosR committed
7511
7512
7513
      var showEvent = EventHandler.trigger(this._element, Event$a.SHOW, {
        relatedTarget: previous
      });
Mark Otto's avatar
dist  
Mark Otto committed
7514

XhmikosR's avatar
XhmikosR committed
7515
      if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
7516
7517
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
7518

XhmikosR's avatar
Dist    
XhmikosR committed
7519
      this._activate(this._element, listElement);
Mark Otto's avatar
dist  
Mark Otto committed
7520

XhmikosR's avatar
Dist    
XhmikosR committed
7521
      var complete = function complete() {
XhmikosR's avatar
XhmikosR committed
7522
        EventHandler.trigger(previous, Event$a.HIDDEN, {
XhmikosR's avatar
Dist    
XhmikosR committed
7523
7524
          relatedTarget: _this._element
        });
XhmikosR's avatar
XhmikosR committed
7525
        EventHandler.trigger(_this._element, Event$a.SHOWN, {
XhmikosR's avatar
Dist    
XhmikosR committed
7526
          relatedTarget: previous
Mark Otto's avatar
dist    
Mark Otto committed
7527
7528
        });
      };
Mark Otto's avatar
dist  
Mark Otto committed
7529

XhmikosR's avatar
Dist    
XhmikosR committed
7530
7531
7532
7533
7534
7535
      if (target) {
        this._activate(target, target.parentNode, complete);
      } else {
        complete();
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
7536

XhmikosR's avatar
Dist    
XhmikosR committed
7537
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
7538
      Data.removeData(this._element, DATA_KEY$9);
XhmikosR's avatar
Dist    
XhmikosR committed
7539
      this._element = null;
Mark Otto's avatar
Mark Otto committed
7540
7541
    } // Private
    ;
Mark Otto's avatar
dist    
Mark Otto committed
7542

XhmikosR's avatar
Dist    
XhmikosR committed
7543
7544
    _proto._activate = function _activate(element, container, callback) {
      var _this2 = this;
Mark Otto's avatar
dist  
Mark Otto committed
7545

XhmikosR's avatar
XhmikosR committed
7546
      var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(Selector$9.ACTIVE_UL, container) : SelectorEngine.children(container, Selector$9.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
7547
      var active = activeElements[0];
XhmikosR's avatar
XhmikosR committed
7548
      var isTransitioning = callback && active && active.classList.contains(ClassName$9.FADE);
XhmikosR's avatar
Dist    
XhmikosR committed
7549
7550
7551

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

XhmikosR's avatar
Dist    
XhmikosR committed
7554
      if (active && isTransitioning) {
XhmikosR's avatar
XhmikosR committed
7555
7556
7557
7558
        var transitionDuration = getTransitionDurationFromElement(active);
        active.classList.remove(ClassName$9.SHOW);
        EventHandler.one(active, TRANSITION_END, complete);
        emulateTransitionEnd(active, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
7559
7560
7561
7562
7563
7564
7565
      } else {
        complete();
      }
    };

    _proto._transitionComplete = function _transitionComplete(element, active, callback) {
      if (active) {
XhmikosR's avatar
XhmikosR committed
7566
7567
        active.classList.remove(ClassName$9.ACTIVE);
        var dropdownChild = SelectorEngine.findOne(Selector$9.DROPDOWN_ACTIVE_CHILD, active.parentNode);
XhmikosR's avatar
Dist    
XhmikosR committed
7568
7569

        if (dropdownChild) {
XhmikosR's avatar
XhmikosR committed
7570
          dropdownChild.classList.remove(ClassName$9.ACTIVE);
Mark Otto's avatar
dist  
Mark Otto committed
7571
        }
XhmikosR's avatar
Dist    
XhmikosR committed
7572
7573
7574

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

XhmikosR's avatar
XhmikosR committed
7578
      element.classList.add(ClassName$9.ACTIVE);
XhmikosR's avatar
Dist    
XhmikosR committed
7579
7580
7581
7582

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

XhmikosR's avatar
XhmikosR committed
7584
      reflow(element);
Mark Otto's avatar
Mark Otto committed
7585
7586
7587
7588

      if (element.classList.contains(ClassName$9.FADE)) {
        element.classList.add(ClassName$9.SHOW);
      }
Mark Otto's avatar
dist  
Mark Otto committed
7589

XhmikosR's avatar
XhmikosR committed
7590
7591
      if (element.parentNode && element.parentNode.classList.contains(ClassName$9.DROPDOWN_MENU)) {
        var dropdownElement = SelectorEngine.closest(element, Selector$9.DROPDOWN);
Mark Otto's avatar
dist    
Mark Otto committed
7592

XhmikosR's avatar
Dist    
XhmikosR committed
7593
        if (dropdownElement) {
XhmikosR's avatar
XhmikosR committed
7594
7595
7596
          makeArray(SelectorEngine.find(Selector$9.DROPDOWN_TOGGLE)).forEach(function (dropdown) {
            return dropdown.classList.add(ClassName$9.ACTIVE);
          });
XhmikosR's avatar
Dist    
XhmikosR committed
7597
        }
Mark Otto's avatar
dist  
Mark Otto committed
7598

XhmikosR's avatar
Dist    
XhmikosR committed
7599
        element.setAttribute('aria-expanded', true);
Mark Otto's avatar
dist    
Mark Otto committed
7600
      }
Mark Otto's avatar
dist    
Mark Otto committed
7601

XhmikosR's avatar
Dist    
XhmikosR committed
7602
7603
7604
      if (callback) {
        callback();
      }
Mark Otto's avatar
Mark Otto committed
7605
7606
    } // Static
    ;
Mark Otto's avatar
dist  
Mark Otto committed
7607

XhmikosR's avatar
XhmikosR committed
7608
    Tab.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
7609
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
7610
        var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
XhmikosR's avatar
Dist    
XhmikosR committed
7611
7612
7613
7614
7615
7616
7617
7618
7619

        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
7620
    };
Mark Otto's avatar
dist  
Mark Otto committed
7621

XhmikosR's avatar
XhmikosR committed
7622
    Tab.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
7623
7624
7625
      return Data.getData(element, DATA_KEY$9);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
    _createClass(Tab, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION$9;
      }
    }]);

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


XhmikosR's avatar
XhmikosR committed
7642
  EventHandler.on(document, Event$a.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
7643
    event.preventDefault();
XhmikosR's avatar
XhmikosR committed
7644
7645
    var data = Data.getData(this, DATA_KEY$9) || new Tab(this);
    data.show();
XhmikosR's avatar
Dist    
XhmikosR committed
7646
  });
XhmikosR's avatar
XhmikosR committed
7647
  var $$a = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
7648
7649
7650
7651
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
7652
   * add .tab to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
7653
7654
   */

7655
7656
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
7657
7658
7659
7660
  if ($$a) {
    var JQUERY_NO_CONFLICT$9 = $$a.fn[NAME$9];
    $$a.fn[NAME$9] = Tab.jQueryInterface;
    $$a.fn[NAME$9].Constructor = Tab;
XhmikosR's avatar
Dist    
XhmikosR committed
7661

XhmikosR's avatar
XhmikosR committed
7662
7663
7664
    $$a.fn[NAME$9].noConflict = function () {
      $$a.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
      return Tab.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
7665
7666
    };
  }
Mark Otto's avatar
dist  
Mark Otto committed
7667
7668

  /**
XhmikosR's avatar
Dist    
XhmikosR committed
7669
7670
7671
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
Mark Otto's avatar
dist  
Mark Otto committed
7672
   */
Mark Otto's avatar
dist    
Mark Otto committed
7673

XhmikosR's avatar
Dist    
XhmikosR committed
7674
  var NAME$a = 'toast';
XhmikosR's avatar
XhmikosR committed
7675
  var VERSION$a = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
7676
7677
  var DATA_KEY$a = 'bs.toast';
  var EVENT_KEY$a = "." + DATA_KEY$a;
XhmikosR's avatar
XhmikosR committed
7678
  var Event$b = {
XhmikosR's avatar
Dist    
XhmikosR committed
7679
7680
7681
7682
7683
7684
7685
7686
7687
    CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
    HIDE: "hide" + EVENT_KEY$a,
    HIDDEN: "hidden" + EVENT_KEY$a,
    SHOW: "show" + EVENT_KEY$a,
    SHOWN: "shown" + EVENT_KEY$a
  };
  var ClassName$a = {
    FADE: 'fade',
    HIDE: 'hide',
Mark Otto's avatar
dist    
Mark Otto committed
7688
7689
    SHOW: 'show',
    SHOWING: 'showing'
XhmikosR's avatar
Dist    
XhmikosR committed
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
  };
  var DefaultType$7 = {
    animation: 'boolean',
    autohide: 'boolean',
    delay: 'number'
  };
  var Default$7 = {
    animation: true,
    autohide: true,
    delay: 500
  };
  var Selector$a = {
    DATA_DISMISS: '[data-dismiss="toast"]'
  };
XhmikosR's avatar
XhmikosR committed
7704
7705
7706
7707
7708
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
7709

XhmikosR's avatar
Dist    
XhmikosR committed
7710
7711
7712
7713
7714
7715
7716
  var Toast =
  /*#__PURE__*/
  function () {
    function Toast(element, config) {
      this._element = element;
      this._config = this._getConfig(config);
      this._timeout = null;
Mark Otto's avatar
dist  
Mark Otto committed
7717

XhmikosR's avatar
Dist    
XhmikosR committed
7718
      this._setListeners();
XhmikosR's avatar
XhmikosR committed
7719
7720

      Data.setData(element, DATA_KEY$a, this);
XhmikosR's avatar
Dist    
XhmikosR committed
7721
    } // Getters
Mark Otto's avatar
dist  
Mark Otto committed
7722
7723


XhmikosR's avatar
Dist    
XhmikosR committed
7724
    var _proto = Toast.prototype;
Mark Otto's avatar
dist  
Mark Otto committed
7725

XhmikosR's avatar
Dist    
XhmikosR committed
7726
7727
7728
    // Public
    _proto.show = function show() {
      var _this = this;
Mark Otto's avatar
dist  
Mark Otto committed
7729

Mark Otto's avatar
dist v5    
Mark Otto committed
7730
7731
7732
7733
7734
      var showEvent = EventHandler.trigger(this._element, Event$b.SHOW);

      if (showEvent.defaultPrevented) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
7735

XhmikosR's avatar
Dist    
XhmikosR committed
7736
7737
7738
      if (this._config.animation) {
        this._element.classList.add(ClassName$a.FADE);
      }
Mark Otto's avatar
dist  
Mark Otto committed
7739

XhmikosR's avatar
Dist    
XhmikosR committed
7740
      var complete = function complete() {
Mark Otto's avatar
dist    
Mark Otto committed
7741
7742
7743
7744
        _this._element.classList.remove(ClassName$a.SHOWING);

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

XhmikosR's avatar
XhmikosR committed
7745
        EventHandler.trigger(_this._element, Event$b.SHOWN);
Mark Otto's avatar
dist  
Mark Otto committed
7746

XhmikosR's avatar
Dist    
XhmikosR committed
7747
        if (_this._config.autohide) {
XhmikosR's avatar
XhmikosR committed
7748
7749
7750
          _this._timeout = setTimeout(function () {
            _this.hide();
          }, _this._config.delay);
Mark Otto's avatar
dist    
Mark Otto committed
7751
        }
XhmikosR's avatar
Dist    
XhmikosR committed
7752
      };
Mark Otto's avatar
dist  
Mark Otto committed
7753

Mark Otto's avatar
dist    
Mark Otto committed
7754
7755
      this._element.classList.remove(ClassName$a.HIDE);

7756
7757
      reflow(this._element);

Mark Otto's avatar
dist    
Mark Otto committed
7758
      this._element.classList.add(ClassName$a.SHOWING);
Mark Otto's avatar
dist  
Mark Otto committed
7759

XhmikosR's avatar
Dist    
XhmikosR committed
7760
      if (this._config.animation) {
XhmikosR's avatar
XhmikosR committed
7761
7762
7763
        var transitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, complete);
        emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
7764
7765
7766
7767
      } else {
        complete();
      }
    };
Mark Otto's avatar
dist  
Mark Otto committed
7768

XhmikosR's avatar
XhmikosR committed
7769
    _proto.hide = function hide() {
XhmikosR's avatar
Dist    
XhmikosR committed
7770
      var _this2 = this;
Mark Otto's avatar
dist    
Mark Otto committed
7771

XhmikosR's avatar
Dist    
XhmikosR committed
7772
7773
7774
      if (!this._element.classList.contains(ClassName$a.SHOW)) {
        return;
      }
Mark Otto's avatar
dist  
Mark Otto committed
7775

Mark Otto's avatar
dist v5    
Mark Otto committed
7776
7777
7778
7779
7780
      var hideEvent = EventHandler.trigger(this._element, Event$b.HIDE);

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

XhmikosR's avatar
XhmikosR committed
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
      var complete = function complete() {
        _this2._element.classList.add(ClassName$a.HIDE);

        EventHandler.trigger(_this2._element, Event$b.HIDDEN);
      };

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

      if (this._config.animation) {
        var transitionDuration = getTransitionDurationFromElement(this._element);
        EventHandler.one(this._element, TRANSITION_END, complete);
        emulateTransitionEnd(this._element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
7794
      } else {
XhmikosR's avatar
XhmikosR committed
7795
        complete();
XhmikosR's avatar
Dist    
XhmikosR committed
7796
7797
      }
    };
XhmikosR's avatar
Dist    
XhmikosR committed
7798

XhmikosR's avatar
Dist    
XhmikosR committed
7799
7800
7801
    _proto.dispose = function dispose() {
      clearTimeout(this._timeout);
      this._timeout = null;
Mark Otto's avatar
dist  
Mark Otto committed
7802

XhmikosR's avatar
Dist    
XhmikosR committed
7803
7804
7805
      if (this._element.classList.contains(ClassName$a.SHOW)) {
        this._element.classList.remove(ClassName$a.SHOW);
      }
Mark Otto's avatar
dist  
Mark Otto committed
7806

XhmikosR's avatar
XhmikosR committed
7807
7808
      EventHandler.off(this._element, Event$b.CLICK_DISMISS);
      Data.removeData(this._element, DATA_KEY$a);
XhmikosR's avatar
Dist    
XhmikosR committed
7809
7810
      this._element = null;
      this._config = null;
Mark Otto's avatar
Mark Otto committed
7811
7812
    } // Private
    ;
Mark Otto's avatar
dist  
Mark Otto committed
7813

XhmikosR's avatar
Dist    
XhmikosR committed
7814
    _proto._getConfig = function _getConfig(config) {
7815
      config = _objectSpread2({}, Default$7, {}, Manipulator.getDataAttributes(this._element), {}, typeof config === 'object' && config ? config : {});
XhmikosR's avatar
XhmikosR committed
7816
      typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
XhmikosR's avatar
Dist    
XhmikosR committed
7817
7818
7819
7820
7821
      return config;
    };

    _proto._setListeners = function _setListeners() {
      var _this3 = this;
Mark Otto's avatar
dist    
Mark Otto committed
7822

XhmikosR's avatar
XhmikosR committed
7823
      EventHandler.on(this._element, Event$b.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
XhmikosR's avatar
XhmikosR committed
7824
        return _this3.hide();
XhmikosR's avatar
Dist    
XhmikosR committed
7825
      });
Mark Otto's avatar
Mark Otto committed
7826
7827
    } // Static
    ;
XhmikosR's avatar
Dist    
XhmikosR committed
7828

XhmikosR's avatar
XhmikosR committed
7829
    Toast.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist    
XhmikosR committed
7830
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
7831
        var data = Data.getData(this, DATA_KEY$a);
Mark Otto's avatar
dist  
Mark Otto committed
7832

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

XhmikosR's avatar
Dist    
XhmikosR committed
7835
7836
7837
        if (!data) {
          data = new Toast(this, _config);
        }
Mark Otto's avatar
dist  
Mark Otto committed
7838

XhmikosR's avatar
Dist    
XhmikosR committed
7839
7840
7841
        if (typeof config === 'string') {
          if (typeof data[config] === 'undefined') {
            throw new TypeError("No method named \"" + config + "\"");
Mark Otto's avatar
dist  
Mark Otto committed
7842
          }
Mark Otto's avatar
dist    
Mark Otto committed
7843

XhmikosR's avatar
Dist    
XhmikosR committed
7844
          data[config](this);
XhmikosR's avatar
Dist    
XhmikosR committed
7845
        }
XhmikosR's avatar
Dist    
XhmikosR committed
7846
7847
      });
    };
Mark Otto's avatar
dist  
Mark Otto committed
7848

XhmikosR's avatar
XhmikosR committed
7849
    Toast.getInstance = function getInstance(element) {
XhmikosR's avatar
XhmikosR committed
7850
7851
7852
      return Data.getData(element, DATA_KEY$a);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
    _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
7863
7864
7865
7866
7867
    }, {
      key: "Default",
      get: function get() {
        return Default$7;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
7868
    }]);
Mark Otto's avatar
dist  
Mark Otto committed
7869

XhmikosR's avatar
Dist    
XhmikosR committed
7870
7871
    return Toast;
  }();
XhmikosR's avatar
XhmikosR committed
7872
7873

  var $$b = getjQuery();
XhmikosR's avatar
Dist    
XhmikosR committed
7874
7875
7876
7877
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
7878
   *  add .toast to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
7879
   */
XhmikosR's avatar
Dist    
XhmikosR committed
7880

7881
7882
  /* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
7883
7884
7885
7886
  if ($$b) {
    var JQUERY_NO_CONFLICT$a = $$b.fn[NAME$a];
    $$b.fn[NAME$a] = Toast.jQueryInterface;
    $$b.fn[NAME$a].Constructor = Toast;
Mark Otto's avatar
dist    
Mark Otto committed
7887

XhmikosR's avatar
XhmikosR committed
7888
7889
7890
    $$b.fn[NAME$a].noConflict = function () {
      $$b.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
      return Toast.jQueryInterface;
XhmikosR's avatar
XhmikosR committed
7891
7892
    };
  }
Mark Otto's avatar
dist  
Mark Otto committed
7893

Mark Otto's avatar
dist    
Mark Otto committed
7894
7895
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
Dist.    
XhmikosR committed
7896
   * Bootstrap (v4.3.1): index.umd.js
Mark Otto's avatar
dist    
Mark Otto committed
7897
7898
7899
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
XhmikosR's avatar
Dist.    
XhmikosR committed
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
  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
7913

XhmikosR's avatar
Dist.    
XhmikosR committed
7914
  return index_umd;
Mark Otto's avatar
dist  
Mark Otto committed
7915

XhmikosR's avatar
XhmikosR committed
7916
})));
Mark Otto's avatar
dist    
Mark Otto committed
7917
//# sourceMappingURL=bootstrap.bundle.js.map