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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

    return null;
  };

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

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


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

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

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


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

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

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

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

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

    element.addEventListener(TRANSITION_END, listener);
XhmikosR's avatar
Dist    
XhmikosR committed
152
153
    setTimeout(function () {
      if (!called) {
XhmikosR's avatar
XhmikosR committed
154
        triggerTransitionEnd(element);
XhmikosR's avatar
Dist    
XhmikosR committed
155
      }
XhmikosR's avatar
XhmikosR committed
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
    }, emulatedDuration);
  };

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

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

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

    if (element.style && element.parentNode && element.parentNode.style) {
XhmikosR's avatar
XhmikosR committed
177
178
179
      var elementStyle = getComputedStyle(element);
      var parentNodeStyle = getComputedStyle(element.parentNode);
      return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
XhmikosR's avatar
XhmikosR committed
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
    }

    return false;
  };

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


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

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


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

    return findShadowRoot(element.parentNode);
XhmikosR's avatar
XhmikosR committed
206
  };
XhmikosR's avatar
XhmikosR committed
207
208
209
210
211
212
213
214

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

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

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

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

    return null;
  };

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

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

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

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

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

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

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

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

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

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

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

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

  var uidEvent = 1;
  var customEvents = {
    mouseenter: 'mouseover',
    mouseleave: 'mouseout'
  };
XhmikosR's avatar
XhmikosR committed
324
  var nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']);
XhmikosR's avatar
XhmikosR committed
325
326
327
328
329
330
331
332
333
334
335
336
337
  /**
   * ------------------------------------------------------------------------
   * Private methods
   * ------------------------------------------------------------------------
   */

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

  function getEvent(element) {
    var uid = getUidEvent(element);
    element.uidEvent = uid;
XhmikosR's avatar
Dist.    
XhmikosR committed
338
339
    eventRegistry[uid] = eventRegistry[uid] || {};
    return eventRegistry[uid];
XhmikosR's avatar
XhmikosR committed
340
341
342
343
  }

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

XhmikosR's avatar
XhmikosR committed
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
      if (handler.oneOff) {
        EventHandler.off(element, event.type, fn);
      }

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

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

      for (var target = event.target; target && target !== this; target = target.parentNode) {
        for (var i = domElements.length; i--;) {
          if (domElements[i] === target) {
XhmikosR's avatar
XhmikosR committed
361
362
            event.delegateTarget = target;

XhmikosR's avatar
XhmikosR committed
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
            if (handler.oneOff) {
              EventHandler.off(element, event.type, fn);
            }

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


      return null;
    };
  }

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

Mark Otto's avatar
dist v5    
Mark Otto committed
382
383
384
385
    var uidEventList = Object.keys(events);

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

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

    return null;
  }

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

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

    if (custom) {
      typeEvent = custom;
    }

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

    if (!isNative) {
      typeEvent = originalTypeEvent;
    }

    return [delegation, originalHandler, typeEvent];
  }

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

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

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

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

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

    var uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
XhmikosR's avatar
Dist.    
XhmikosR committed
440
    var fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
XhmikosR's avatar
XhmikosR committed
441
442
443
444
445
446
447
448
449
450
451
    fn.delegationSelector = delegation ? handler : null;
    fn.originalHandler = originalHandler;
    fn.oneOff = oneOff;
    fn.uidEvent = uid;
    handlers[uid] = fn;
    element.addEventListener(typeEvent, fn, delegation);
  }

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

Mark Otto's avatar
dist v5    
Mark Otto committed
452
    if (!fn) {
XhmikosR's avatar
XhmikosR committed
453
454
455
456
457
458
459
460
461
462
      return;
    }

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

  function removeNamespacedHandlers(element, events, typeEvent, namespace) {
    var storeElementEvent = events[typeEvent] || {};
    Object.keys(storeElementEvent).forEach(function (handlerKey) {
XhmikosR's avatar
XhmikosR committed
463
      if (handlerKey.includes(namespace)) {
XhmikosR's avatar
XhmikosR committed
464
465
        var event = storeElementEvent[handlerKey];
        removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
Mark Otto's avatar
Mark Otto committed
466
      }
XhmikosR's avatar
XhmikosR committed
467
468
469
470
471
472
    });
  }

  var EventHandler = {
    on: function on(element, event, handler, delegationFn) {
      addHandler(element, event, handler, delegationFn, false);
XhmikosR's avatar
Dist    
XhmikosR committed
473
    },
XhmikosR's avatar
XhmikosR committed
474
475
476
477
478
479
480
    one: function one(element, event, handler, delegationFn) {
      addHandler(element, event, handler, delegationFn, true);
    },
    off: function off(element, originalTypeEvent, handler, delegationFn) {
      if (typeof originalTypeEvent !== 'string' || !element) {
        return;
      }
Mark Otto's avatar
dist    
Mark Otto committed
481

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

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

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

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

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

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

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

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

XhmikosR's avatar
XhmikosR committed
532
533
534
      if (inNamespace && $) {
        jQueryEvent = $.Event(event, args);
        $(element).trigger(jQueryEvent);
XhmikosR's avatar
XhmikosR committed
535
536
537
538
539
540
541
542
543
        bubbles = !jQueryEvent.isPropagationStopped();
        nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
        defaultPrevented = jQueryEvent.isDefaultPrevented();
      }

      if (isNative) {
        evt = document.createEvent('HTMLEvents');
        evt.initEvent(typeEvent, bubbles, true);
      } else {
XhmikosR's avatar
XhmikosR committed
544
        evt = new CustomEvent(event, {
XhmikosR's avatar
XhmikosR committed
545
546
547
          bubbles: bubbles,
          cancelable: true
        });
XhmikosR's avatar
XhmikosR committed
548
      } // merge custom information in our event
XhmikosR's avatar
XhmikosR committed
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576


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

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

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

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

      return evt;
    }
  };

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

  var NAME = 'alert';
XhmikosR's avatar
XhmikosR committed
584
  var VERSION = '5.0.0-alpha3';
XhmikosR's avatar
Dist    
XhmikosR committed
585
586
587
  var DATA_KEY = 'bs.alert';
  var EVENT_KEY = "." + DATA_KEY;
  var DATA_API_KEY = '.data-api';
XhmikosR's avatar
XhmikosR committed
588
  var SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
XhmikosR's avatar
XhmikosR committed
589
590
591
592
593
594
  var EVENT_CLOSE = "close" + EVENT_KEY;
  var EVENT_CLOSED = "closed" + EVENT_KEY;
  var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
  var CLASSNAME_ALERT = 'alert';
  var CLASSNAME_FADE = 'fade';
  var CLASSNAME_SHOW = 'show';
XhmikosR's avatar
XhmikosR committed
595
596
597
598
599
  /**
   * ------------------------------------------------------------------------
   * Class Definition
   * ------------------------------------------------------------------------
   */
Mark Otto's avatar
dist  
Mark Otto committed
600

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Mark Otto's avatar
dist    
Mark Otto committed
710

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

  /**
   * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
846
   * Bootstrap (v5.0.0-alpha3): dom/manipulator.js
XhmikosR's avatar
XhmikosR committed
847
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
XhmikosR committed
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
   * --------------------------------------------------------------------------
   */
  function normalizeData(val) {
    if (val === 'true') {
      return true;
    }

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

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

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

    return val;
  }

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

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

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

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

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

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

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

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

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

      return children.filter(function (child) {
        return child.matches(selector);
      });
    },
    parents: function parents(element, selector) {
      var parents = [];
      var ancestor = element.parentNode;

      while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
        if (this.matches(ancestor, selector)) {
          parents.push(ancestor);
        }

        ancestor = ancestor.parentNode;
      }

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

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

        previous = previous.previousElementSibling;
      }

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

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

        next = next.nextElementSibling;
      }

      return [];
    }
  };

Mark Otto's avatar
dist  
Mark Otto committed
1000
  /**
For faster browsing, not all history is shown. View entire blame