bootstrap.esm.js 141 KB
Newer Older
XhmikosR's avatar
Dist.  
XhmikosR committed
1
/*!
XhmikosR's avatar
XhmikosR committed
2
  * Bootstrap v5.0.0-alpha2 (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)
XhmikosR's avatar
Dist.  
XhmikosR committed
5
6
7
  */
import Popper from 'popper.js';

XhmikosR's avatar
XhmikosR committed
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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;
}

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

      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) {
          target[key] = source[key];
        }
      }
XhmikosR's avatar
XhmikosR committed
34
35
    }

XhmikosR's avatar
XhmikosR committed
36
37
38
39
    return target;
  };

  return _extends.apply(this, arguments);
XhmikosR's avatar
XhmikosR committed
40
41
42
43
44
45
46
47
}

function _inheritsLoose(subClass, superClass) {
  subClass.prototype = Object.create(superClass.prototype);
  subClass.prototype.constructor = subClass;
  subClass.__proto__ = superClass;
}

XhmikosR's avatar
Dist.  
XhmikosR committed
48
49
/**
 * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
50
 * Bootstrap (v5.0.0-alpha2): util/index.js
XhmikosR's avatar
XhmikosR committed
51
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist.  
XhmikosR committed
52
53
 * --------------------------------------------------------------------------
 */
XhmikosR's avatar
XhmikosR committed
54
55
var MAX_UID = 1000000;
var MILLISECONDS_MULTIPLIER = 1000;
XhmikosR's avatar
XhmikosR committed
56
var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
XhmikosR's avatar
XhmikosR committed
57
58

var toType = function toType(obj) {
XhmikosR's avatar
XhmikosR committed
59
60
61
62
  if (obj === null || obj === undefined) {
    return "" + obj;
  }

XhmikosR's avatar
XhmikosR committed
63
64
  return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
};
XhmikosR's avatar
Dist.  
XhmikosR committed
65
66
67
68
69
70
71
/**
 * --------------------------------------------------------------------------
 * Public Util Api
 * --------------------------------------------------------------------------
 */


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

  return prefix;
};

XhmikosR's avatar
XhmikosR committed
80
var getSelector = function getSelector(element) {
XhmikosR's avatar
XhmikosR committed
81
  var selector = element.getAttribute('data-target');
XhmikosR's avatar
Dist.  
XhmikosR committed
82
83

  if (!selector || selector === '#') {
XhmikosR's avatar
XhmikosR committed
84
    var hrefAttr = element.getAttribute('href');
XhmikosR's avatar
XhmikosR committed
85
    selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
XhmikosR's avatar
Dist.  
XhmikosR committed
86
87
  }

XhmikosR's avatar
XhmikosR committed
88
89
90
91
92
93
94
  return selector;
};

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

  if (selector) {
XhmikosR's avatar
Dist.  
XhmikosR committed
95
96
    return document.querySelector(selector) ? selector : null;
  }
XhmikosR's avatar
XhmikosR committed
97
98
99
100
101
102
103

  return null;
};

var getElementFromSelector = function getElementFromSelector(element) {
  var selector = getSelector(element);
  return selector ? document.querySelector(selector) : null;
XhmikosR's avatar
Dist.  
XhmikosR committed
104
105
};

XhmikosR's avatar
XhmikosR committed
106
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
107
108
109
110
111
  if (!element) {
    return 0;
  } // Get transition-duration of the element


XhmikosR's avatar
XhmikosR committed
112
  var _window$getComputedSt = window.getComputedStyle(element),
XhmikosR's avatar
Dist.  
XhmikosR committed
113
114
115
      transitionDuration = _window$getComputedSt.transitionDuration,
      transitionDelay = _window$getComputedSt.transitionDelay;

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

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

XhmikosR's avatar
XhmikosR committed
129
var triggerTransitionEnd = function triggerTransitionEnd(element) {
XhmikosR's avatar
XhmikosR committed
130
  element.dispatchEvent(new Event(TRANSITION_END));
XhmikosR's avatar
Dist.  
XhmikosR committed
131
132
};

XhmikosR's avatar
XhmikosR committed
133
134
135
var isElement = function isElement(obj) {
  return (obj[0] || obj).nodeType;
};
XhmikosR's avatar
Dist.  
XhmikosR committed
136

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

  function listener() {
    called = true;
    element.removeEventListener(TRANSITION_END, listener);
  }

  element.addEventListener(TRANSITION_END, listener);
XhmikosR's avatar
XhmikosR committed
148
  setTimeout(function () {
XhmikosR's avatar
Dist.  
XhmikosR committed
149
150
151
152
153
154
    if (!called) {
      triggerTransitionEnd(element);
    }
  }, emulatedDuration);
};

XhmikosR's avatar
XhmikosR committed
155
156
157
158
159
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);
XhmikosR's avatar
Dist.  
XhmikosR committed
160
161

    if (!new RegExp(expectedTypes).test(valueType)) {
XhmikosR's avatar
XhmikosR committed
162
      throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
XhmikosR's avatar
Dist.  
XhmikosR committed
163
164
165
166
    }
  });
};

XhmikosR's avatar
XhmikosR committed
167
var isVisible = function isVisible(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
168
169
170
171
172
  if (!element) {
    return false;
  }

  if (element.style && element.parentNode && element.parentNode.style) {
XhmikosR's avatar
XhmikosR committed
173
174
175
    var elementStyle = getComputedStyle(element);
    var parentNodeStyle = getComputedStyle(element.parentNode);
    return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
XhmikosR's avatar
Dist.  
XhmikosR committed
176
177
178
179
180
  }

  return false;
};

XhmikosR's avatar
XhmikosR committed
181
var findShadowRoot = function findShadowRoot(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
182
183
184
185
186
187
  if (!document.documentElement.attachShadow) {
    return null;
  } // Can find the shadow root otherwise it'll return the document


  if (typeof element.getRootNode === 'function') {
XhmikosR's avatar
XhmikosR committed
188
    var root = element.getRootNode();
XhmikosR's avatar
Dist.  
XhmikosR committed
189
190
191
192
193
194
195
196
197
198
199
200
201
    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
202
};
XhmikosR's avatar
Dist.  
XhmikosR committed
203

XhmikosR's avatar
XhmikosR committed
204
205
206
var noop = function noop() {
  return function () {};
};
XhmikosR's avatar
Dist.  
XhmikosR committed
207

XhmikosR's avatar
XhmikosR committed
208
209
210
var reflow = function reflow(element) {
  return element.offsetHeight;
};
XhmikosR's avatar
Dist.  
XhmikosR committed
211

XhmikosR's avatar
XhmikosR committed
212
213
214
215
216
217
218
219
220
221
222
var getjQuery = function getjQuery() {
  var _window = window,
      jQuery = _window.jQuery;

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

  return null;
};

XhmikosR's avatar
Dist.  
XhmikosR committed
223
224
/**
 * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
225
 * Bootstrap (v5.0.0-alpha2): dom/data.js
XhmikosR's avatar
XhmikosR committed
226
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist.  
XhmikosR committed
227
228
229
230
231
232
233
234
 * --------------------------------------------------------------------------
 */

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
XhmikosR committed
235
236
237
var mapData = function () {
  var storeData = {};
  var id = 1;
XhmikosR's avatar
Dist.  
XhmikosR committed
238
  return {
XhmikosR's avatar
XhmikosR committed
239
    set: function set(element, key, data) {
XhmikosR's avatar
XhmikosR committed
240
241
      if (typeof element.bsKey === 'undefined') {
        element.bsKey = {
XhmikosR's avatar
XhmikosR committed
242
243
          key: key,
          id: id
XhmikosR's avatar
Dist.  
XhmikosR committed
244
245
246
247
        };
        id++;
      }

XhmikosR's avatar
XhmikosR committed
248
      storeData[element.bsKey.id] = data;
XhmikosR's avatar
Dist.  
XhmikosR committed
249
    },
XhmikosR's avatar
XhmikosR committed
250
    get: function get(element, key) {
XhmikosR's avatar
XhmikosR committed
251
      if (!element || typeof element.bsKey === 'undefined') {
XhmikosR's avatar
Dist.  
XhmikosR committed
252
253
254
        return null;
      }

XhmikosR's avatar
XhmikosR committed
255
      var keyProperties = element.bsKey;
XhmikosR's avatar
Dist.  
XhmikosR committed
256
257
258
259
260
261
262

      if (keyProperties.key === key) {
        return storeData[keyProperties.id];
      }

      return null;
    },
XhmikosR's avatar
XhmikosR committed
263
    delete: function _delete(element, key) {
XhmikosR's avatar
XhmikosR committed
264
      if (typeof element.bsKey === 'undefined') {
XhmikosR's avatar
Dist.  
XhmikosR committed
265
266
267
        return;
      }

XhmikosR's avatar
XhmikosR committed
268
      var keyProperties = element.bsKey;
XhmikosR's avatar
Dist.  
XhmikosR committed
269
270
271

      if (keyProperties.key === key) {
        delete storeData[keyProperties.id];
XhmikosR's avatar
XhmikosR committed
272
        delete element.bsKey;
XhmikosR's avatar
Dist.  
XhmikosR committed
273
274
275
      }
    }
  };
XhmikosR's avatar
XhmikosR committed
276
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
277

XhmikosR's avatar
XhmikosR committed
278
279
var Data = {
  setData: function setData(instance, key, data) {
XhmikosR's avatar
Dist.  
XhmikosR committed
280
281
    mapData.set(instance, key, data);
  },
XhmikosR's avatar
XhmikosR committed
282
  getData: function getData(instance, key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
283
284
    return mapData.get(instance, key);
  },
XhmikosR's avatar
XhmikosR committed
285
  removeData: function removeData(instance, key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
286
287
    mapData.delete(instance, key);
  }
XhmikosR's avatar
XhmikosR committed
288
};
XhmikosR's avatar
Dist.  
XhmikosR committed
289

XhmikosR's avatar
XhmikosR committed
290
291
/* istanbul ignore file */
var find = Element.prototype.querySelectorAll;
XhmikosR's avatar
XhmikosR committed
292
var findOne = Element.prototype.querySelector; // MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached
XhmikosR's avatar
Dist.  
XhmikosR committed
293

XhmikosR's avatar
XhmikosR committed
294
var defaultPreventedPreservedOnDispatch = function () {
XhmikosR's avatar
XhmikosR committed
295
  var e = new CustomEvent('Bootstrap', {
XhmikosR's avatar
XhmikosR committed
296
297
298
299
300
301
302
303
304
305
    cancelable: true
  });
  var element = document.createElement('div');
  element.addEventListener('Bootstrap', function () {
    return null;
  });
  e.preventDefault();
  element.dispatchEvent(e);
  return e.defaultPrevented;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
306

XhmikosR's avatar
XhmikosR committed
307
var scopeSelectorRegex = /:scope\b/;
XhmikosR's avatar
Dist.  
XhmikosR committed
308

XhmikosR's avatar
XhmikosR committed
309
310
var supportScopeQuery = function () {
  var element = document.createElement('div');
XhmikosR's avatar
Dist.  
XhmikosR committed
311

XhmikosR's avatar
XhmikosR committed
312
313
  try {
    element.querySelectorAll(':scope *');
XhmikosR's avatar
XhmikosR committed
314
  } catch (_) {
XhmikosR's avatar
XhmikosR committed
315
316
    return false;
  }
XhmikosR's avatar
Dist.  
XhmikosR committed
317

XhmikosR's avatar
XhmikosR committed
318
319
320
321
322
323
324
325
326
327
  return true;
}();

if (!supportScopeQuery) {
  find = function find(selector) {
    if (!scopeSelectorRegex.test(selector)) {
      return this.querySelectorAll(selector);
    }

    var hasId = Boolean(this.id);
XhmikosR's avatar
Dist.  
XhmikosR committed
328

XhmikosR's avatar
XhmikosR committed
329
330
331
332
333
    if (!hasId) {
      this.id = getUID('scope');
    }

    var nodeList = null;
XhmikosR's avatar
Dist.  
XhmikosR committed
334

XhmikosR's avatar
XhmikosR committed
335
336
337
338
339
340
    try {
      selector = selector.replace(scopeSelectorRegex, "#" + this.id);
      nodeList = this.querySelectorAll(selector);
    } finally {
      if (!hasId) {
        this.removeAttribute('id');
XhmikosR's avatar
Dist.  
XhmikosR committed
341
      }
XhmikosR's avatar
XhmikosR committed
342
    }
XhmikosR's avatar
Dist.  
XhmikosR committed
343

XhmikosR's avatar
XhmikosR committed
344
345
    return nodeList;
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
346

XhmikosR's avatar
XhmikosR committed
347
348
349
350
351
352
353
354
355
356
357
358
  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
Dist.  
XhmikosR committed
359
  };
XhmikosR's avatar
XhmikosR committed
360
}
XhmikosR's avatar
Dist.  
XhmikosR committed
361
362
363

/**
 * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
364
 * Bootstrap (v5.0.0-alpha2): dom/event-handler.js
XhmikosR's avatar
XhmikosR committed
365
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist.  
XhmikosR committed
366
367
368
369
370
371
372
373
 * --------------------------------------------------------------------------
 */
/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
374
var $ = getjQuery();
XhmikosR's avatar
XhmikosR committed
375
376
377
378
var namespaceRegex = /[^.]*(?=\..*)\.|.*/;
var stripNameRegex = /\..*/;
var stripUidRegex = /::\d+$/;
var eventRegistry = {}; // Events storage
XhmikosR's avatar
Dist.  
XhmikosR committed
379

XhmikosR's avatar
XhmikosR committed
380
381
var uidEvent = 1;
var customEvents = {
XhmikosR's avatar
Dist.  
XhmikosR committed
382
383
384
  mouseenter: 'mouseover',
  mouseleave: 'mouseout'
};
XhmikosR's avatar
XhmikosR committed
385
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'];
XhmikosR's avatar
Dist.  
XhmikosR committed
386
387
388
389
390
391
392
/**
 * ------------------------------------------------------------------------
 * Private methods
 * ------------------------------------------------------------------------
 */

function getUidEvent(element, uid) {
XhmikosR's avatar
XhmikosR committed
393
  return uid && uid + "::" + uidEvent++ || element.uidEvent || uidEvent++;
XhmikosR's avatar
Dist.  
XhmikosR committed
394
395
396
}

function getEvent(element) {
XhmikosR's avatar
XhmikosR committed
397
  var uid = getUidEvent(element);
XhmikosR's avatar
Dist.  
XhmikosR committed
398
399
400
401
402
403
404
  element.uidEvent = uid;
  eventRegistry[uid] = eventRegistry[uid] || {};
  return eventRegistry[uid];
}

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

XhmikosR's avatar
Dist.  
XhmikosR committed
407
408
409
410
411
412
413
414
415
416
    if (handler.oneOff) {
      EventHandler.off(element, event.type, fn);
    }

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

function bootstrapDelegationHandler(element, selector, fn) {
  return function handler(event) {
XhmikosR's avatar
XhmikosR committed
417
    var domElements = element.querySelectorAll(selector);
XhmikosR's avatar
Dist.  
XhmikosR committed
418

XhmikosR's avatar
XhmikosR committed
419
420
    for (var target = event.target; target && target !== this; target = target.parentNode) {
      for (var i = domElements.length; i--;) {
XhmikosR's avatar
Dist.  
XhmikosR committed
421
        if (domElements[i] === target) {
XhmikosR's avatar
XhmikosR committed
422
423
          event.delegateTarget = target;

XhmikosR's avatar
Dist.  
XhmikosR committed
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
          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
443
444
445
446
  var uidEventList = Object.keys(events);

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

    if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
Mark Otto's avatar
dist v5    
Mark Otto committed
449
      return event;
XhmikosR's avatar
Dist.  
XhmikosR committed
450
451
452
453
454
455
456
    }
  }

  return null;
}

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

XhmikosR's avatar
XhmikosR committed
460
461
  var typeEvent = originalTypeEvent.replace(stripNameRegex, '');
  var custom = customEvents[typeEvent];
XhmikosR's avatar
Dist.  
XhmikosR committed
462
463
464
465
466

  if (custom) {
    typeEvent = custom;
  }

XhmikosR's avatar
XhmikosR committed
467
  var isNative = nativeEvents.indexOf(typeEvent) > -1;
XhmikosR's avatar
Dist.  
XhmikosR committed
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485

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

XhmikosR's avatar
XhmikosR committed
486
487
488
489
  var _normalizeParams = normalizeParams(originalTypeEvent, handler, delegationFn),
      delegation = _normalizeParams[0],
      originalHandler = _normalizeParams[1],
      typeEvent = _normalizeParams[2];
XhmikosR's avatar
Dist.  
XhmikosR committed
490

XhmikosR's avatar
XhmikosR committed
491
492
493
  var events = getEvent(element);
  var handlers = events[typeEvent] || (events[typeEvent] = {});
  var previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
XhmikosR's avatar
Dist.  
XhmikosR committed
494
495
496
497
498
499

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

XhmikosR's avatar
XhmikosR committed
500
501
  var uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
  var fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
XhmikosR's avatar
Dist.  
XhmikosR committed
502
503
504
505
506
507
508
509
510
  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) {
XhmikosR's avatar
XhmikosR committed
511
  var fn = findHandler(events[typeEvent], handler, delegationSelector);
XhmikosR's avatar
Dist.  
XhmikosR committed
512

Mark Otto's avatar
dist v5    
Mark Otto committed
513
  if (!fn) {
XhmikosR's avatar
Dist.  
XhmikosR committed
514
515
516
517
518
519
520
521
    return;
  }

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

function removeNamespacedHandlers(element, events, typeEvent, namespace) {
XhmikosR's avatar
XhmikosR committed
522
523
  var storeElementEvent = events[typeEvent] || {};
  Object.keys(storeElementEvent).forEach(function (handlerKey) {
XhmikosR's avatar
Dist.  
XhmikosR committed
524
    if (handlerKey.indexOf(namespace) > -1) {
XhmikosR's avatar
XhmikosR committed
525
      var event = storeElementEvent[handlerKey];
XhmikosR's avatar
Dist.  
XhmikosR committed
526
527
528
529
530
      removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
    }
  });
}

XhmikosR's avatar
XhmikosR committed
531
532
var EventHandler = {
  on: function on(element, event, handler, delegationFn) {
XhmikosR's avatar
Dist.  
XhmikosR committed
533
534
    addHandler(element, event, handler, delegationFn, false);
  },
XhmikosR's avatar
XhmikosR committed
535
  one: function one(element, event, handler, delegationFn) {
XhmikosR's avatar
Dist.  
XhmikosR committed
536
537
    addHandler(element, event, handler, delegationFn, true);
  },
XhmikosR's avatar
XhmikosR committed
538
  off: function off(element, originalTypeEvent, handler, delegationFn) {
XhmikosR's avatar
Dist.  
XhmikosR committed
539
540
541
542
    if (typeof originalTypeEvent !== 'string' || !element) {
      return;
    }

XhmikosR's avatar
XhmikosR committed
543
544
545
546
    var _normalizeParams2 = normalizeParams(originalTypeEvent, handler, delegationFn),
        delegation = _normalizeParams2[0],
        originalHandler = _normalizeParams2[1],
        typeEvent = _normalizeParams2[2];
XhmikosR's avatar
Dist.  
XhmikosR committed
547

XhmikosR's avatar
XhmikosR committed
548
549
550
    var inNamespace = typeEvent !== originalTypeEvent;
    var events = getEvent(element);
    var isNamespace = originalTypeEvent.charAt(0) === '.';
XhmikosR's avatar
Dist.  
XhmikosR committed
551
552
553
554
555
556
557
558
559
560
561
562

    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) {
XhmikosR's avatar
XhmikosR committed
563
      Object.keys(events).forEach(function (elementEvent) {
XhmikosR's avatar
XhmikosR committed
564
        removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
XhmikosR's avatar
Dist.  
XhmikosR committed
565
566
567
      });
    }

XhmikosR's avatar
XhmikosR committed
568
569
570
    var storeElementEvent = events[typeEvent] || {};
    Object.keys(storeElementEvent).forEach(function (keyHandlers) {
      var handlerKey = keyHandlers.replace(stripUidRegex, '');
XhmikosR's avatar
Dist.  
XhmikosR committed
571
572

      if (!inNamespace || originalTypeEvent.indexOf(handlerKey) > -1) {
XhmikosR's avatar
XhmikosR committed
573
        var event = storeElementEvent[keyHandlers];
XhmikosR's avatar
Dist.  
XhmikosR committed
574
575
576
577
        removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
      }
    });
  },
XhmikosR's avatar
XhmikosR committed
578
  trigger: function trigger(element, event, args) {
XhmikosR's avatar
Dist.  
XhmikosR committed
579
580
581
582
    if (typeof event !== 'string' || !element) {
      return null;
    }

XhmikosR's avatar
XhmikosR committed
583
584
585
586
587
588
589
590
    var typeEvent = event.replace(stripNameRegex, '');
    var inNamespace = event !== typeEvent;
    var isNative = nativeEvents.indexOf(typeEvent) > -1;
    var jQueryEvent;
    var bubbles = true;
    var nativeDispatch = true;
    var defaultPrevented = false;
    var evt = null;
XhmikosR's avatar
Dist.  
XhmikosR committed
591

XhmikosR's avatar
XhmikosR committed
592
593
594
    if (inNamespace && $) {
      jQueryEvent = $.Event(event, args);
      $(element).trigger(jQueryEvent);
XhmikosR's avatar
Dist.  
XhmikosR committed
595
596
597
598
599
600
601
602
603
      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
604
      evt = new CustomEvent(event, {
XhmikosR's avatar
XhmikosR committed
605
        bubbles: bubbles,
XhmikosR's avatar
Dist.  
XhmikosR committed
606
607
        cancelable: true
      });
XhmikosR's avatar
XhmikosR committed
608
    } // merge custom information in our event
XhmikosR's avatar
Dist.  
XhmikosR committed
609
610
611


    if (typeof args !== 'undefined') {
XhmikosR's avatar
XhmikosR committed
612
      Object.keys(args).forEach(function (key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
613
        Object.defineProperty(evt, key, {
XhmikosR's avatar
XhmikosR committed
614
          get: function get() {
XhmikosR's avatar
Dist.  
XhmikosR committed
615
616
617
618
619
620
621
622
623
            return args[key];
          }
        });
      });
    }

    if (defaultPrevented) {
      evt.preventDefault();

XhmikosR's avatar
XhmikosR committed
624
      if (!defaultPreventedPreservedOnDispatch) {
XhmikosR's avatar
Dist.  
XhmikosR committed
625
        Object.defineProperty(evt, 'defaultPrevented', {
XhmikosR's avatar
XhmikosR committed
626
627
628
          get: function get() {
            return true;
          }
XhmikosR's avatar
Dist.  
XhmikosR committed
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
        });
      }
    }

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

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

    return evt;
  }
};

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
651
var NAME = 'alert';
XhmikosR's avatar
XhmikosR committed
652
var VERSION = '5.0.0-alpha2';
XhmikosR's avatar
XhmikosR committed
653
654
655
var DATA_KEY = 'bs.alert';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
XhmikosR's avatar
XhmikosR committed
656
657
658
659
660
661
662
var SELECTOR_DISMISS = '[data-dismiss="alert"]';
var EVENT_CLOSE = "close" + EVENT_KEY;
var EVENT_CLOSED = "closed" + EVENT_KEY;
var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
var CLASSNAME_ALERT = 'alert';
var CLASSNAME_FADE = 'fade';
var CLASSNAME_SHOW = 'show';
XhmikosR's avatar
XhmikosR committed
663
664
665
666
667
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
668

XhmikosR's avatar
XhmikosR committed
669
var Alert = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
670
  function Alert(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
671
672
673
674
675
676
677
678
    this._element = element;

    if (this._element) {
      Data.setData(element, DATA_KEY, this);
    }
  } // Getters


XhmikosR's avatar
XhmikosR committed
679
  var _proto = Alert.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
680

XhmikosR's avatar
XhmikosR committed
681
682
  // Public
  _proto.close = function close(element) {
XhmikosR's avatar
XhmikosR committed
683
    var rootElement = element ? this._getRootElement(element) : this._element;
XhmikosR's avatar
Dist.  
XhmikosR committed
684

XhmikosR's avatar
XhmikosR committed
685
    var customEvent = this._triggerCloseEvent(rootElement);
XhmikosR's avatar
Dist.  
XhmikosR committed
686
687
688
689
690
691

    if (customEvent === null || customEvent.defaultPrevented) {
      return;
    }

    this._removeElement(rootElement);
XhmikosR's avatar
XhmikosR committed
692
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
693

XhmikosR's avatar
XhmikosR committed
694
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
695
696
697
    Data.removeData(this._element, DATA_KEY);
    this._element = null;
  } // Private
XhmikosR's avatar
XhmikosR committed
698
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
699

XhmikosR's avatar
XhmikosR committed
700
  _proto._getRootElement = function _getRootElement(element) {
XhmikosR's avatar
XhmikosR committed
701
    return getElementFromSelector(element) || element.closest("." + CLASSNAME_ALERT);
XhmikosR's avatar
XhmikosR committed
702
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
703

XhmikosR's avatar
XhmikosR committed
704
  _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
XhmikosR's avatar
XhmikosR committed
705
    return EventHandler.trigger(element, EVENT_CLOSE);
XhmikosR's avatar
XhmikosR committed
706
707
708
709
  };

  _proto._removeElement = function _removeElement(element) {
    var _this = this;
XhmikosR's avatar
Dist.  
XhmikosR committed
710

XhmikosR's avatar
XhmikosR committed
711
    element.classList.remove(CLASSNAME_SHOW);
XhmikosR's avatar
Dist.  
XhmikosR committed
712

XhmikosR's avatar
XhmikosR committed
713
    if (!element.classList.contains(CLASSNAME_FADE)) {
XhmikosR's avatar
Dist.  
XhmikosR committed
714
715
716
717
718
      this._destroyElement(element);

      return;
    }

XhmikosR's avatar
XhmikosR committed
719
    var transitionDuration = getTransitionDurationFromElement(element);
720
721
    EventHandler.one(element, TRANSITION_END, function () {
      return _this._destroyElement(element);
XhmikosR's avatar
XhmikosR committed
722
    });
XhmikosR's avatar
Dist.  
XhmikosR committed
723
    emulateTransitionEnd(element, transitionDuration);
XhmikosR's avatar
XhmikosR committed
724
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
725

XhmikosR's avatar
XhmikosR committed
726
  _proto._destroyElement = function _destroyElement(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
727
728
729
730
    if (element.parentNode) {
      element.parentNode.removeChild(element);
    }

XhmikosR's avatar
XhmikosR committed
731
    EventHandler.trigger(element, EVENT_CLOSED);
XhmikosR's avatar
Dist.  
XhmikosR committed
732
  } // Static
XhmikosR's avatar
XhmikosR committed
733
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
734

XhmikosR's avatar
XhmikosR committed
735
  Alert.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
736
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
737
      var data = Data.getData(this, DATA_KEY);
XhmikosR's avatar
Dist.  
XhmikosR committed
738
739
740
741
742
743
744
745
746

      if (!data) {
        data = new Alert(this);
      }

      if (config === 'close') {
        data[config](this);
      }
    });
XhmikosR's avatar
XhmikosR committed
747
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
748

XhmikosR's avatar
XhmikosR committed
749
  Alert.handleDismiss = function handleDismiss(alertInstance) {
XhmikosR's avatar
Dist.  
XhmikosR committed
750
751
752
753
754
755
756
    return function (event) {
      if (event) {
        event.preventDefault();
      }

      alertInstance.close(this);
    };
XhmikosR's avatar
XhmikosR committed
757
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
758

XhmikosR's avatar
XhmikosR committed
759
  Alert.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
760
    return Data.getData(element, DATA_KEY);
XhmikosR's avatar
XhmikosR committed
761
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
762

XhmikosR's avatar
XhmikosR committed
763
764
765
766
767
768
769
770
771
  _createClass(Alert, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION;
    }
  }]);

  return Alert;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
772
773
774
775
776
777
778
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
779
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
XhmikosR's avatar
XhmikosR committed
780
var $$1 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
781
782
783
784
785
786
787
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .alert to jQuery only if jQuery is present
 */

788
789
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
790
791
792
793
if ($$1) {
  var JQUERY_NO_CONFLICT = $$1.fn[NAME];
  $$1.fn[NAME] = Alert.jQueryInterface;
  $$1.fn[NAME].Constructor = Alert;
XhmikosR's avatar
Dist.  
XhmikosR committed
794

XhmikosR's avatar
XhmikosR committed
795
796
797
  $$1.fn[NAME].noConflict = function () {
    $$1.fn[NAME] = JQUERY_NO_CONFLICT;
    return Alert.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
798
799
800
801
802
803
804
805
806
  };
}

/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

XhmikosR's avatar
XhmikosR committed
807
var NAME$1 = 'button';
XhmikosR's avatar
XhmikosR committed
808
var VERSION$1 = '5.0.0-alpha2';
XhmikosR's avatar
XhmikosR committed
809
810
811
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
812
var CLASS_NAME_ACTIVE = 'active';
XhmikosR's avatar
XhmikosR committed
813
var SELECTOR_DATA_TOGGLE = '[data-toggle="button"]';
XhmikosR's avatar
XhmikosR committed
814
var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1;
XhmikosR's avatar
XhmikosR committed
815
816
817
818
819
/**
 * ------------------------------------------------------------------------
 * Class Definition
 * ------------------------------------------------------------------------
 */
XhmikosR's avatar
Dist.  
XhmikosR committed
820

XhmikosR's avatar
XhmikosR committed
821
var Button = /*#__PURE__*/function () {
XhmikosR's avatar
XhmikosR committed
822
  function Button(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
823
824
825
826
827
    this._element = element;
    Data.setData(element, DATA_KEY$1, this);
  } // Getters


XhmikosR's avatar
XhmikosR committed
828
  var _proto = Button.prototype;
XhmikosR's avatar
Dist.  
XhmikosR committed
829

XhmikosR's avatar
XhmikosR committed
830
831
  // Public
  _proto.toggle = function toggle() {
XhmikosR's avatar
XhmikosR committed
832
833
    // 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
XhmikosR committed
834
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
835

XhmikosR's avatar
XhmikosR committed
836
  _proto.dispose = function dispose() {
XhmikosR's avatar
Dist.  
XhmikosR committed
837
838
839
    Data.removeData(this._element, DATA_KEY$1);
    this._element = null;
  } // Static
XhmikosR's avatar
XhmikosR committed
840
  ;
XhmikosR's avatar
Dist.  
XhmikosR committed
841

XhmikosR's avatar
XhmikosR committed
842
  Button.jQueryInterface = function jQueryInterface(config) {
XhmikosR's avatar
Dist.  
XhmikosR committed
843
    return this.each(function () {
XhmikosR's avatar
XhmikosR committed
844
      var data = Data.getData(this, DATA_KEY$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
845
846
847
848
849
850
851
852
853

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

      if (config === 'toggle') {
        data[config]();
      }
    });
XhmikosR's avatar
XhmikosR committed
854
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
855

XhmikosR's avatar
XhmikosR committed
856
  Button.getInstance = function getInstance(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
857
    return Data.getData(element, DATA_KEY$1);
XhmikosR's avatar
XhmikosR committed
858
  };
XhmikosR's avatar
Dist.  
XhmikosR committed
859

XhmikosR's avatar
XhmikosR committed
860
861
862
863
864
865
866
867
868
  _createClass(Button, null, [{
    key: "VERSION",
    get: function get() {
      return VERSION$1;
    }
  }]);

  return Button;
}();
XhmikosR's avatar
Dist.  
XhmikosR committed
869
870
871
872
873
874
875
/**
 * ------------------------------------------------------------------------
 * Data Api implementation
 * ------------------------------------------------------------------------
 */


XhmikosR's avatar
XhmikosR committed
876
EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE, function (event) {
XhmikosR's avatar
Dist.  
XhmikosR committed
877
  event.preventDefault();
XhmikosR's avatar
XhmikosR committed
878
  var button = event.target.closest(SELECTOR_DATA_TOGGLE);
XhmikosR's avatar
XhmikosR committed
879
  var data = Data.getData(button, DATA_KEY$1);
XhmikosR's avatar
Dist.  
XhmikosR committed
880
881
882
883
884
885
886

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

  data.toggle();
});
XhmikosR's avatar
XhmikosR committed
887
var $$2 = getjQuery();
XhmikosR's avatar
Dist.  
XhmikosR committed
888
889
890
891
892
893
894
/**
 * ------------------------------------------------------------------------
 * jQuery
 * ------------------------------------------------------------------------
 * add .button to jQuery only if jQuery is present
 */

895
896
/* istanbul ignore if */

XhmikosR's avatar
XhmikosR committed
897
898
899
900
if ($$2) {
  var JQUERY_NO_CONFLICT$1 = $$2.fn[NAME$1];
  $$2.fn[NAME$1] = Button.jQueryInterface;
  $$2.fn[NAME$1].Constructor = Button;
XhmikosR's avatar
Dist.  
XhmikosR committed
901

XhmikosR's avatar
XhmikosR committed
902
903
904
  $$2.fn[NAME$1].noConflict = function () {
    $$2.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
    return Button.jQueryInterface;
XhmikosR's avatar
Dist.  
XhmikosR committed
905
906
907
908
909
  };
}

/**
 * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
910
 * Bootstrap (v5.0.0-alpha2): dom/manipulator.js
XhmikosR's avatar
XhmikosR committed
911
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
XhmikosR's avatar
Dist.  
XhmikosR committed
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
 * --------------------------------------------------------------------------
 */
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) {
XhmikosR's avatar
XhmikosR committed
935
  return key.replace(/[A-Z]/g, function (chr) {
XhmikosR's avatar
XhmikosR committed
936
    return "-" + chr.toLowerCase();
XhmikosR's avatar
XhmikosR committed
937
  });
XhmikosR's avatar
Dist.  
XhmikosR committed
938
939
}

XhmikosR's avatar
XhmikosR committed
940
941
942
var Manipulator = {
  setDataAttribute: function setDataAttribute(element, key, value) {
    element.setAttribute("data-" + normalizeDataKey(key), value);
XhmikosR's avatar
Dist.  
XhmikosR committed
943
  },
XhmikosR's avatar
XhmikosR committed
944
945
  removeDataAttribute: function removeDataAttribute(element, key) {
    element.removeAttribute("data-" + normalizeDataKey(key));
XhmikosR's avatar
Dist.  
XhmikosR committed
946
  },
XhmikosR's avatar
XhmikosR committed
947
  getDataAttributes: function getDataAttributes(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
948
949
950
951
    if (!element) {
      return {};
    }

XhmikosR's avatar
XhmikosR committed
952
    var attributes = _extends({}, element.dataset);
XhmikosR's avatar
Dist.  
XhmikosR committed
953

XhmikosR's avatar
XhmikosR committed
954
    Object.keys(attributes).forEach(function (key) {
XhmikosR's avatar
Dist.  
XhmikosR committed
955
956
957
958
      attributes[key] = normalizeData(attributes[key]);
    });
    return attributes;
  },
XhmikosR's avatar
XhmikosR committed
959
960
  getDataAttribute: function getDataAttribute(element, key) {
    return normalizeData(element.getAttribute("data-" + normalizeDataKey(key)));
XhmikosR's avatar
Dist.  
XhmikosR committed
961
  },
XhmikosR's avatar
XhmikosR committed
962
963
  offset: function offset(element) {
    var rect = element.getBoundingClientRect();
XhmikosR's avatar
Dist.  
XhmikosR committed
964
965
966
967
968
    return {
      top: rect.top + document.body.scrollTop,
      left: rect.left + document.body.scrollLeft
    };
  },
XhmikosR's avatar
XhmikosR committed
969
  position: function position(element) {
XhmikosR's avatar
Dist.  
XhmikosR committed
970
971
972
973
974
    return {
      top: element.offsetTop,
      left: element.offsetLeft
    };
  },
XhmikosR's avatar
XhmikosR committed
975
  toggleClass: function toggleClass(element, className) {
XhmikosR's avatar
Dist.  
XhmikosR committed
976
977
978
979
980
981
982
983
984
985
986
987
    if (!element) {
      return;
    }

    if (element.classList.contains(className)) {
      element.classList.remove(className);
    } else {
      element.classList.add(className);
    }
  }
};

XhmikosR's avatar
XhmikosR committed
988
989
/**
 * --------------------------------------------------------------------------
XhmikosR's avatar
XhmikosR committed
990
 * Bootstrap (v5.0.0-alpha2): dom/selector-engine.js
XhmikosR's avatar
XhmikosR committed
991
992
993
994
995
996
997
998
999
1000
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
 * --------------------------------------------------------------------------
 */
/**
 * ------------------------------------------------------------------------
 * Constants
 * ------------------------------------------------------------------------
 */

var NODE_TEXT = 3;
For faster browsing, not all history is shown. View entire blame