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

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

Mark Otto's avatar
dist    
Mark Otto committed
14
15
16
17
18
19
20
21
  function _defineProperties(target, props) {
    for (var i = 0; i < props.length; i++) {
      var descriptor = props[i];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor) descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
Mark Otto's avatar
Mark Otto committed
22
23
  }

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

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

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

Mark Otto's avatar
dist    
Mark Otto committed
45
46
47
48
  function _objectSpread(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i] != null ? arguments[i] : {};
      var ownKeys = Object.keys(source);
Mark Otto's avatar
dist    
Mark Otto committed
49

Mark Otto's avatar
dist    
Mark Otto committed
50
51
52
53
      if (typeof Object.getOwnPropertySymbols === 'function') {
        ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
          return Object.getOwnPropertyDescriptor(source, sym).enumerable;
        }));
Jacob Thornton's avatar
Jacob Thornton committed
54
55
      }

Mark Otto's avatar
dist    
Mark Otto committed
56
57
58
      ownKeys.forEach(function (key) {
        _defineProperty(target, key, source[key]);
      });
Jacob Thornton's avatar
Jacob Thornton committed
59
60
    }

Mark Otto's avatar
dist    
Mark Otto committed
61
    return target;
Jacob Thornton's avatar
Jacob Thornton committed
62
63
  }

Mark Otto's avatar
dist    
Mark Otto committed
64
65
66
67
  function _inheritsLoose(subClass, superClass) {
    subClass.prototype = Object.create(superClass.prototype);
    subClass.prototype.constructor = subClass;
    subClass.__proto__ = superClass;
Jacob Thornton's avatar
Jacob Thornton committed
68
69
70
71
  }

  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
72
   * Bootstrap (v4.3.1): util/index.js
Mark Otto's avatar
dist    
Mark Otto committed
73
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
Jacob Thornton's avatar
Jacob Thornton committed
74
75
   * --------------------------------------------------------------------------
   */
XhmikosR's avatar
XhmikosR committed
76
77
78
  var MAX_UID = 1000000;
  var MILLISECONDS_MULTIPLIER = 1000;
  var TRANSITION_END = 'transitionend';
XhmikosR's avatar
Dist.    
XhmikosR committed
79
80
  var _window = window,
      jQuery = _window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
XhmikosR's avatar
XhmikosR committed
81
82
83
84

  var toType = function toType(obj) {
    return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  };
XhmikosR's avatar
Dist    
XhmikosR committed
85
  /**
XhmikosR's avatar
XhmikosR committed
86
87
88
   * --------------------------------------------------------------------------
   * Public Util Api
   * --------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
89
   */
Mark Otto's avatar
dist    
Mark Otto committed
90

Jacob Thornton's avatar
Jacob Thornton committed
91

XhmikosR's avatar
XhmikosR committed
92
93
94
95
96
  var getUID = function getUID(prefix) {
    do {
      // eslint-disable-next-line no-bitwise
      prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
    } while (document.getElementById(prefix));
Mark Otto's avatar
dist    
Mark Otto committed
97

XhmikosR's avatar
XhmikosR committed
98
99
    return prefix;
  };
Mark Otto's avatar
dist    
Mark Otto committed
100

XhmikosR's avatar
XhmikosR committed
101
102
103
104
105
106
107
108
109
110
  var getSelectorFromElement = function getSelectorFromElement(element) {
    var selector = element.getAttribute('data-target');

    if (!selector || selector === '#') {
      var hrefAttr = element.getAttribute('href');
      selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
    }

    try {
      return document.querySelector(selector) ? selector : null;
XhmikosR's avatar
Dist.    
XhmikosR committed
111
    } catch (error) {
XhmikosR's avatar
XhmikosR committed
112
113
114
115
116
117
118
119
      return null;
    }
  };

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

Mark Otto's avatar
dist    
Mark Otto committed
121

XhmikosR's avatar
XhmikosR committed
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
    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
140
141
142
    var evt = document.createEvent('HTMLEvents');
    evt.initEvent(TRANSITION_END, true, true);
    element.dispatchEvent(evt);
XhmikosR's avatar
XhmikosR committed
143
144
145
146
147
148
149
  };

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

  var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
XhmikosR's avatar
Dist    
XhmikosR committed
150
    var called = false;
XhmikosR's avatar
XhmikosR committed
151
152
153
154
    var durationPadding = 5;
    var emulatedDuration = duration + durationPadding;

    function listener() {
XhmikosR's avatar
Dist    
XhmikosR committed
155
      called = true;
XhmikosR's avatar
XhmikosR committed
156
157
158
159
      element.removeEventListener(TRANSITION_END, listener);
    }

    element.addEventListener(TRANSITION_END, listener);
XhmikosR's avatar
Dist    
XhmikosR committed
160
161
    setTimeout(function () {
      if (!called) {
XhmikosR's avatar
XhmikosR committed
162
        triggerTransitionEnd(element);
XhmikosR's avatar
Dist    
XhmikosR committed
163
      }
XhmikosR's avatar
XhmikosR committed
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
    }, emulatedDuration);
  };

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

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

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

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

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

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

    return false;
  };

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


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

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


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

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


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

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

XhmikosR's avatar
Dist    
XhmikosR committed
231
232
  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
233
234
   * Bootstrap (v4.3.1): dom/data.js
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
XhmikosR's avatar
Dist    
XhmikosR committed
235
236
   * --------------------------------------------------------------------------
   */
Mark Otto's avatar
dist    
Mark Otto committed
237

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

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

XhmikosR's avatar
XhmikosR committed
263
        var keyProperties = element.key;
XhmikosR's avatar
Dist    
XhmikosR committed
264

XhmikosR's avatar
XhmikosR committed
265
266
267
268
269
270
271
272
273
274
        if (keyProperties.key === key) {
          return storeData[keyProperties.id];
        }

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

XhmikosR's avatar
XhmikosR committed
276
277
278
279
280
281
        var keyProperties = element.key;

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

  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
298
299
300
301
302
303
  /* 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
304

XhmikosR's avatar
XhmikosR committed
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
  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
322

XhmikosR's avatar
XhmikosR committed
323
324
325
326
327
328
  var workingDefaultPrevented = function () {
    var e = document.createEvent('CustomEvent');
    e.initEvent('Bootstrap', true, true);
    e.preventDefault();
    return e.defaultPrevented;
  }();
XhmikosR's avatar
XhmikosR committed
329

XhmikosR's avatar
XhmikosR committed
330
331
  if (!workingDefaultPrevented) {
    var origPreventDefault = Event.prototype.preventDefault;
XhmikosR's avatar
Dist    
XhmikosR committed
332

XhmikosR's avatar
XhmikosR committed
333
334
335
    Event.prototype.preventDefault = function () {
      if (!this.cancelable) {
        return;
XhmikosR's avatar
XhmikosR committed
336
337
      }

XhmikosR's avatar
XhmikosR committed
338
339
340
341
342
343
344
345
346
      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
347
348


XhmikosR's avatar
XhmikosR committed
349
350
351
352
353
354
355
356
357
358
359
360
  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
361

XhmikosR's avatar
XhmikosR committed
362
363
364
  if (!matches) {
    matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
  }
XhmikosR's avatar
XhmikosR committed
365

XhmikosR's avatar
XhmikosR committed
366
367
368
  if (!closest) {
    closest = function closest(selector) {
      var element = this;
XhmikosR's avatar
XhmikosR committed
369

XhmikosR's avatar
XhmikosR committed
370
371
372
      do {
        if (matches.call(element, selector)) {
          return element;
XhmikosR's avatar
XhmikosR committed
373
374
        }

XhmikosR's avatar
XhmikosR committed
375
376
        element = element.parentElement || element.parentNode;
      } while (element !== null && element.nodeType === 1);
XhmikosR's avatar
XhmikosR committed
377

XhmikosR's avatar
XhmikosR committed
378
379
380
      return null;
    };
  }
XhmikosR's avatar
XhmikosR committed
381

XhmikosR's avatar
XhmikosR committed
382
  var scopeSelectorRegex = /:scope\b/;
XhmikosR's avatar
XhmikosR committed
383

XhmikosR's avatar
XhmikosR committed
384
385
  var supportScopeQuery = function () {
    var element = document.createElement('div');
XhmikosR's avatar
XhmikosR committed
386

XhmikosR's avatar
XhmikosR committed
387
388
389
390
    try {
      element.querySelectorAll(':scope *');
    } catch (error) {
      return false;
XhmikosR's avatar
XhmikosR committed
391
392
    }

XhmikosR's avatar
XhmikosR committed
393
    return true;
XhmikosR's avatar
XhmikosR committed
394
395
  }();

XhmikosR's avatar
XhmikosR committed
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
  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
437
438
  /**
   * --------------------------------------------------------------------------
439
   * Bootstrap (v4.3.1): dom/event-handler.js
XhmikosR's avatar
XhmikosR committed
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  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
474
475
    eventRegistry[uid] = eventRegistry[uid] || {};
    return eventRegistry[uid];
XhmikosR's avatar
XhmikosR committed
476
477
478
479
480
  }

  function fixEvent(event, element) {
    // Add which for key events
    if (event.which === null && keyEventRegex.test(event.type)) {
XhmikosR's avatar
Dist.    
XhmikosR committed
481
      event.which = event.charCode === null ? event.keyCode : event.charCode;
XhmikosR's avatar
XhmikosR committed
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
    }

    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
527
528
529
530
    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
531
532

      if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
Mark Otto's avatar
dist v5    
Mark Otto committed
533
        return event;
XhmikosR's avatar
XhmikosR committed
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
      }
    }

    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
585
    var fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
XhmikosR's avatar
XhmikosR committed
586
587
588
589
590
591
592
593
594
595
596
    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
597
    if (!fn) {
XhmikosR's avatar
XhmikosR committed
598
599
600
601
602
603
604
605
606
607
608
609
610
      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
611
      }
XhmikosR's avatar
XhmikosR committed
612
613
614
615
616
617
    });
  }

  var EventHandler = {
    on: function on(element, event, handler, delegationFn) {
      addHandler(element, event, handler, delegationFn, false);
XhmikosR's avatar
Dist    
XhmikosR committed
618
    },
XhmikosR's avatar
XhmikosR committed
619
620
621
622
623
624
625
    one: function one(element, event, handler, delegationFn) {
      addHandler(element, event, handler, delegationFn, true);
    },
    off: function off(element, originalTypeEvent, handler, delegationFn) {
      if (typeof originalTypeEvent !== 'string' || !element) {
        return;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
626

XhmikosR's avatar
XhmikosR committed
627
628
629
630
      var _normalizeParams2 = normalizeParams(originalTypeEvent, handler, delegationFn),
          delegation = _normalizeParams2[0],
          originalHandler = _normalizeParams2[1],
          typeEvent = _normalizeParams2[2];
XhmikosR's avatar
Dist    
XhmikosR committed
631

XhmikosR's avatar
XhmikosR committed
632
633
634
      var inNamespace = typeEvent !== originalTypeEvent;
      var events = getEvent(element);
      var isNamespace = originalTypeEvent.charAt(0) === '.';
XhmikosR's avatar
Dist    
XhmikosR committed
635

XhmikosR's avatar
XhmikosR committed
636
637
638
639
640
      if (typeof originalHandler !== 'undefined') {
        // Simplest case: handler is passed, remove that listener ONLY.
        if (!events || !events[typeEvent]) {
          return;
        }
XhmikosR's avatar
Dist    
XhmikosR committed
641

XhmikosR's avatar
XhmikosR committed
642
643
644
        removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
        return;
      }
XhmikosR's avatar
Dist    
XhmikosR committed
645

XhmikosR's avatar
XhmikosR committed
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
      if (isNamespace) {
        Object.keys(events).forEach(function (elementEvent) {
          removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.substr(1));
        });
      }

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

        if (!inNamespace || originalTypeEvent.indexOf(handlerKey) > -1) {
          var event = storeElementEvent[keyHandlers];
          removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
        }
      });
XhmikosR's avatar
Dist    
XhmikosR committed
661
    },
XhmikosR's avatar
XhmikosR committed
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
    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;

      if (inNamespace && typeof jQuery !== 'undefined') {
        jQueryEvent = jQuery.Event(event, args);
        jQuery(element).trigger(jQueryEvent);
        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
688
        evt = createCustomEvent(event, {
XhmikosR's avatar
XhmikosR committed
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
          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
708
        if (!defaultPreventedPreservedOnDispatch) {
XhmikosR's avatar
XhmikosR committed
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
          Object.defineProperty(evt, 'defaultPrevented', {
            get: function get() {
              return true;
            }
          });
        }
      }

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

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

      return evt;
    }
  };

  /**
   * --------------------------------------------------------------------------
731
   * Bootstrap (v4.3.1): dom/selector-engine.js
XhmikosR's avatar
XhmikosR committed
732
733
734
735
736
737
738
739
740
741
742
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * --------------------------------------------------------------------------
   */
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NODE_TEXT = 3;
  var SelectorEngine = {
XhmikosR's avatar
XhmikosR committed
743
744
    matches: function matches$1(element, selector) {
      return matches.call(element, selector);
XhmikosR's avatar
Dist    
XhmikosR committed
745
    },
XhmikosR's avatar
XhmikosR committed
746
    find: function find$1(selector, element) {
XhmikosR's avatar
XhmikosR committed
747
748
749
750
751
752
753
754
      if (element === void 0) {
        element = document.documentElement;
      }

      if (typeof selector !== 'string') {
        return null;
      }

XhmikosR's avatar
XhmikosR committed
755
      return find.call(element, selector);
XhmikosR's avatar
Dist    
XhmikosR committed
756
    },
XhmikosR's avatar
XhmikosR committed
757
    findOne: function findOne$1(selector, element) {
XhmikosR's avatar
XhmikosR committed
758
759
760
761
762
763
764
765
      if (element === void 0) {
        element = document.documentElement;
      }

      if (typeof selector !== 'string') {
        return null;
      }

XhmikosR's avatar
XhmikosR committed
766
      return findOne.call(element, selector);
XhmikosR's avatar
Dist    
XhmikosR committed
767
    },
XhmikosR's avatar
XhmikosR committed
768
769
770
771
772
773
774
775
776
777
778
    children: function children(element, selector) {
      var _this = this;

      if (typeof selector !== 'string') {
        return null;
      }

      var children = makeArray(element.children);
      return children.filter(function (child) {
        return _this.matches(child, selector);
      });
XhmikosR's avatar
Dist    
XhmikosR committed
779
    },
XhmikosR's avatar
XhmikosR committed
780
781
782
783
784
785
786
787
788
789
790
    parents: function parents(element, selector) {
      if (typeof selector !== 'string') {
        return null;
      }

      var parents = [];
      var ancestor = element.parentNode;

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

        ancestor = ancestor.parentNode;
Jacob Thornton's avatar
Jacob Thornton committed
794
      }
XhmikosR's avatar
XhmikosR committed
795
796

      return parents;
Mark Otto's avatar
dist    
Mark Otto committed
797
    },
XhmikosR's avatar
XhmikosR committed
798
    closest: function closest$1(element, selector) {
XhmikosR's avatar
XhmikosR committed
799
      if (typeof selector !== 'string') {
Mark Otto's avatar
dist    
Mark Otto committed
800
        return null;
XhmikosR's avatar
XhmikosR committed
801
      }
Mark Otto's avatar
dist    
Mark Otto committed
802

XhmikosR's avatar
XhmikosR committed
803
      return closest.call(element, selector);
XhmikosR's avatar
XhmikosR committed
804
805
806
807
    },
    prev: function prev(element, selector) {
      if (typeof selector !== 'string') {
        return null;
Mark Otto's avatar
dist    
Mark Otto committed
808
809
      }

XhmikosR's avatar
XhmikosR committed
810
811
      var siblings = [];
      var previous = element.previousSibling;
Mark Otto's avatar
dist    
Mark Otto committed
812

XhmikosR's avatar
XhmikosR committed
813
814
815
816
      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
817

XhmikosR's avatar
XhmikosR committed
818
        previous = previous.previousSibling;
Mark Otto's avatar
dist    
Mark Otto committed
819
820
      }

XhmikosR's avatar
XhmikosR committed
821
      return siblings;
XhmikosR's avatar
Dist    
XhmikosR committed
822
823
    }
  };
Mark Otto's avatar
dist    
Mark Otto committed
824

XhmikosR's avatar
Dist    
XhmikosR committed
825
826
827
828
829
830
831
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */

  var NAME = 'alert';
XhmikosR's avatar
XhmikosR committed
832
  var VERSION = '4.3.1';
XhmikosR's avatar
Dist    
XhmikosR committed
833
834
835
836
837
838
  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
839
  var Event$1 = {
XhmikosR's avatar
Dist    
XhmikosR committed
840
841
842
843
844
845
846
847
    CLOSE: "close" + EVENT_KEY,
    CLOSED: "closed" + EVENT_KEY,
    CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  };
  var ClassName = {
    ALERT: 'alert',
    FADE: 'fade',
    SHOW: 'show'
Mark Otto's avatar
dist    
Mark Otto committed
848
849
    /**
     * ------------------------------------------------------------------------
XhmikosR's avatar
Dist    
XhmikosR committed
850
     * Class Definition
Mark Otto's avatar
dist    
Mark Otto committed
851
852
     * ------------------------------------------------------------------------
     */
Jacob Thornton's avatar
Jacob Thornton committed
853

XhmikosR's avatar
Dist    
XhmikosR committed
854
  };
Jacob Thornton's avatar
Jacob Thornton committed
855

XhmikosR's avatar
Dist    
XhmikosR committed
856
857
858
859
860
  var Alert =
  /*#__PURE__*/
  function () {
    function Alert(element) {
      this._element = element;
XhmikosR's avatar
XhmikosR committed
861
862
863
864

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


XhmikosR's avatar
Dist    
XhmikosR committed
868
    var _proto = Alert.prototype;
Jacob Thornton's avatar
Jacob Thornton committed
869

XhmikosR's avatar
Dist    
XhmikosR committed
870
871
872
    // Public
    _proto.close = function close(element) {
      var rootElement = this._element;
Jacob Thornton's avatar
Jacob Thornton committed
873

XhmikosR's avatar
Dist    
XhmikosR committed
874
875
876
      if (element) {
        rootElement = this._getRootElement(element);
      }
Mark Otto's avatar
dist    
Mark Otto committed
877

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

XhmikosR's avatar
XhmikosR committed
880
      if (customEvent === null || customEvent.defaultPrevented) {
XhmikosR's avatar
Dist    
XhmikosR committed
881
882
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
883

XhmikosR's avatar
Dist    
XhmikosR committed
884
885
      this._removeElement(rootElement);
    };
Jacob Thornton's avatar
Jacob Thornton committed
886

XhmikosR's avatar
Dist    
XhmikosR committed
887
    _proto.dispose = function dispose() {
XhmikosR's avatar
XhmikosR committed
888
      Data.removeData(this._element, DATA_KEY);
XhmikosR's avatar
Dist    
XhmikosR committed
889
      this._element = null;
Mark Otto's avatar
Mark Otto committed
890
891
    } // Private
    ;
Jacob Thornton's avatar
Jacob Thornton committed
892

XhmikosR's avatar
Dist    
XhmikosR committed
893
    _proto._getRootElement = function _getRootElement(element) {
XhmikosR's avatar
XhmikosR committed
894
      var selector = getSelectorFromElement(element);
XhmikosR's avatar
Dist    
XhmikosR committed
895
      var parent = false;
Mark Otto's avatar
grunt    
Mark Otto committed
896

XhmikosR's avatar
Dist    
XhmikosR committed
897
      if (selector) {
XhmikosR's avatar
XhmikosR committed
898
        parent = SelectorEngine.findOne(selector);
XhmikosR's avatar
Dist    
XhmikosR committed
899
      }
Mark Otto's avatar
grunt    
Mark Otto committed
900

XhmikosR's avatar
Dist    
XhmikosR committed
901
      if (!parent) {
XhmikosR's avatar
XhmikosR committed
902
        parent = SelectorEngine.closest(element, "." + ClassName.ALERT);
XhmikosR's avatar
Dist    
XhmikosR committed
903
      }
Jacob Thornton's avatar
Jacob Thornton committed
904

XhmikosR's avatar
Dist    
XhmikosR committed
905
906
      return parent;
    };
Jacob Thornton's avatar
Jacob Thornton committed
907

XhmikosR's avatar
Dist    
XhmikosR committed
908
    _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
XhmikosR's avatar
XhmikosR committed
909
      return EventHandler.trigger(element, Event$1.CLOSE);
XhmikosR's avatar
Dist    
XhmikosR committed
910
    };
Jacob Thornton's avatar
Jacob Thornton committed
911

XhmikosR's avatar
Dist    
XhmikosR committed
912
913
    _proto._removeElement = function _removeElement(element) {
      var _this = this;
Mark Otto's avatar
grunt    
Mark Otto committed
914

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

XhmikosR's avatar
XhmikosR committed
917
      if (!element.classList.contains(ClassName.FADE)) {
XhmikosR's avatar
Dist    
XhmikosR committed
918
        this._destroyElement(element);
Mark Otto's avatar
dist    
Mark Otto committed
919

XhmikosR's avatar
Dist    
XhmikosR committed
920
921
        return;
      }
Jacob Thornton's avatar
Jacob Thornton committed
922

XhmikosR's avatar
XhmikosR committed
923
924
      var transitionDuration = getTransitionDurationFromElement(element);
      EventHandler.one(element, TRANSITION_END, function (event) {
XhmikosR's avatar
Dist    
XhmikosR committed
925
        return _this._destroyElement(element, event);
XhmikosR's avatar
XhmikosR committed
926
927
      });
      emulateTransitionEnd(element, transitionDuration);
XhmikosR's avatar
Dist    
XhmikosR committed
928
    };
Jacob Thornton's avatar
Jacob Thornton committed
929

XhmikosR's avatar
Dist    
XhmikosR committed
930
    _proto._destroyElement = function _destroyElement(element) {
XhmikosR's avatar
XhmikosR committed
931
932
933
934
935
      if (element.parentNode) {
        element.parentNode.removeChild(element);
      }

      EventHandler.trigger(element, Event$1.CLOSED);
Mark Otto's avatar
Mark Otto committed
936
937
    } // Static
    ;
Jacob Thornton's avatar
Jacob Thornton committed
938

XhmikosR's avatar
Dist    
XhmikosR committed
939
940
    Alert._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
XhmikosR's avatar
XhmikosR committed
941
        var data = Data.getData(this, DATA_KEY);
Jacob Thornton's avatar
Jacob Thornton committed
942

XhmikosR's avatar
Dist    
XhmikosR committed
943
944
945
        if (!data) {
          data = new Alert(this);
        }
Jacob Thornton's avatar
Jacob Thornton committed
946

XhmikosR's avatar
Dist    
XhmikosR committed
947
948
949
950
951
        if (config === 'close') {
          data[config](this);
        }
      });
    };
Jacob Thornton's avatar
Jacob Thornton committed
952

XhmikosR's avatar
Dist    
XhmikosR committed
953
954
955
956
957
    Alert._handleDismiss = function _handleDismiss(alertInstance) {
      return function (event) {
        if (event) {
          event.preventDefault();
        }
Jacob Thornton's avatar
Jacob Thornton committed
958

XhmikosR's avatar
Dist    
XhmikosR committed
959
        alertInstance.close(this);
Mark Otto's avatar
grunt    
Mark Otto committed
960
      };
XhmikosR's avatar
Dist    
XhmikosR committed
961
    };
Mark Otto's avatar
grunt    
Mark Otto committed
962

XhmikosR's avatar
XhmikosR committed
963
964
965
966
    Alert._getInstance = function _getInstance(element) {
      return Data.getData(element, DATA_KEY);
    };

XhmikosR's avatar
Dist    
XhmikosR committed
967
968
969
970
971
972
    _createClass(Alert, null, [{
      key: "VERSION",
      get: function get() {
        return VERSION;
      }
    }]);
Jacob Thornton's avatar
Jacob Thornton committed
973

XhmikosR's avatar
Dist    
XhmikosR committed
974
975
976
977
978
979
980
    return Alert;
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
Jacob Thornton's avatar
Jacob Thornton committed
981

Mark Otto's avatar
dist    
Mark Otto committed
982

XhmikosR's avatar
XhmikosR committed
983
  EventHandler.on(document, Event$1.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
XhmikosR's avatar
Dist    
XhmikosR committed
984
985
986
987
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
988
   * add .alert to jQuery only if jQuery is present
XhmikosR's avatar
Dist    
XhmikosR committed
989
   */
Jacob Thornton's avatar
Jacob Thornton committed
990

XhmikosR's avatar
XhmikosR committed
991
992
993
994
  if (typeof jQuery !== 'undefined') {
    var JQUERY_NO_CONFLICT = jQuery.fn[NAME];
    jQuery.fn[NAME] = Alert._jQueryInterface;
    jQuery.fn[NAME].Constructor = Alert;
Jacob Thornton's avatar
Jacob Thornton committed
995

XhmikosR's avatar
XhmikosR committed
996
997
998
999
1000
    jQuery.fn[NAME].noConflict = function () {
      jQuery.fn[NAME] = JQUERY_NO_CONFLICT;
      return Alert._jQueryInterface;
    };
  }
For faster browsing, not all history is shown. View entire blame