bootstrap 5.0.0.beta3 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/assets/javascripts/bootstrap-sprockets.js +1 -1
  4. data/assets/javascripts/bootstrap.js +1310 -1277
  5. data/assets/javascripts/bootstrap.min.js +2 -2
  6. data/assets/javascripts/bootstrap/alert.js +78 -107
  7. data/assets/javascripts/bootstrap/base-component.js +131 -10
  8. data/assets/javascripts/bootstrap/button.js +24 -24
  9. data/assets/javascripts/bootstrap/carousel.js +115 -133
  10. data/assets/javascripts/bootstrap/collapse.js +120 -177
  11. data/assets/javascripts/bootstrap/dom/data.js +2 -2
  12. data/assets/javascripts/bootstrap/dom/event-handler.js +32 -14
  13. data/assets/javascripts/bootstrap/dom/manipulator.js +4 -4
  14. data/assets/javascripts/bootstrap/dom/selector-engine.js +47 -5
  15. data/assets/javascripts/bootstrap/dropdown.js +218 -191
  16. data/assets/javascripts/bootstrap/modal.js +553 -271
  17. data/assets/javascripts/bootstrap/offcanvas.js +478 -120
  18. data/assets/javascripts/bootstrap/popover.js +27 -59
  19. data/assets/javascripts/bootstrap/scrollspy.js +65 -74
  20. data/assets/javascripts/bootstrap/tab.js +57 -71
  21. data/assets/javascripts/bootstrap/toast.js +176 -88
  22. data/assets/javascripts/bootstrap/tooltip.js +125 -182
  23. data/assets/stylesheets/_bootstrap-grid.scss +1 -1
  24. data/assets/stylesheets/_bootstrap-reboot.scss +1 -1
  25. data/assets/stylesheets/_bootstrap.scss +2 -1
  26. data/assets/stylesheets/bootstrap/_accordion.scss +4 -2
  27. data/assets/stylesheets/bootstrap/_card.scss +7 -6
  28. data/assets/stylesheets/bootstrap/_carousel.scss +2 -2
  29. data/assets/stylesheets/bootstrap/_dropdown.scss +11 -17
  30. data/assets/stylesheets/bootstrap/_functions.scss +94 -3
  31. data/assets/stylesheets/bootstrap/_grid.scss +11 -0
  32. data/assets/stylesheets/bootstrap/_helpers.scss +2 -0
  33. data/assets/stylesheets/bootstrap/_images.scss +1 -1
  34. data/assets/stylesheets/bootstrap/_list-group.scss +5 -5
  35. data/assets/stylesheets/bootstrap/_mixins.scss +2 -0
  36. data/assets/stylesheets/bootstrap/_modal.scss +7 -35
  37. data/assets/stylesheets/bootstrap/_navbar.scss +30 -1
  38. data/assets/stylesheets/bootstrap/_offcanvas.scss +19 -13
  39. data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
  40. data/assets/stylesheets/bootstrap/_popover.scss +10 -10
  41. data/assets/stylesheets/bootstrap/_reboot.scss +12 -8
  42. data/assets/stylesheets/bootstrap/_root.scss +39 -2
  43. data/assets/stylesheets/bootstrap/_spinners.scss +2 -2
  44. data/assets/stylesheets/bootstrap/_tables.scss +1 -0
  45. data/assets/stylesheets/bootstrap/_toasts.scss +3 -3
  46. data/assets/stylesheets/bootstrap/_tooltip.scss +4 -4
  47. data/assets/stylesheets/bootstrap/_transitions.scss +6 -0
  48. data/assets/stylesheets/bootstrap/_utilities.scss +44 -8
  49. data/assets/stylesheets/bootstrap/_variables.scss +193 -28
  50. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -1
  51. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +3 -1
  52. data/assets/stylesheets/bootstrap/forms/_form-check.scss +1 -1
  53. data/assets/stylesheets/bootstrap/forms/_form-control.scss +1 -1
  54. data/assets/stylesheets/bootstrap/forms/_form-range.scss +1 -1
  55. data/assets/stylesheets/bootstrap/forms/_form-select.scss +3 -0
  56. data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
  57. data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
  58. data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
  59. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +1 -1
  60. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  61. data/assets/stylesheets/bootstrap/mixins/_forms.scss +15 -5
  62. data/assets/stylesheets/bootstrap/mixins/_grid.scss +40 -10
  63. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +27 -6
  64. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +55 -13
  65. data/bootstrap.gemspec +3 -3
  66. data/lib/bootstrap/version.rb +2 -2
  67. data/tasks/updater/js.rb +6 -2
  68. metadata +15 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3cc0d2ec96c189e5fa13c010311e0f02b196239f6ebe8ddba7dc2e226139b13
4
- data.tar.gz: ad6dda67296a47b6256ed254ad2b3bb7df86a47167584b9e147b48a6fe702297
3
+ metadata.gz: eac9843149cd951a77a337af9060986d2d4bbf280433e8029acc9beb4803e127
4
+ data.tar.gz: 94246dd7243f819c6355cddc6cb4a1a70cfa8f7091081b85eed0308e170a64a8
5
5
  SHA512:
6
- metadata.gz: 68276da5ce5396260233830bf907f24fe6247bf378b73736644301d3280a38a0318cf34f27b5c4b37ac31050414fc5ddbe06056dc57788cd9ab096eceeeb454e
7
- data.tar.gz: a19d71e99d6fe5c2c0b5d0aafb74a3be68cf2e9b19abbe89209732b02d466bed1a0d688534ac3b7497697b331064d3e54e93081d938b8cc592be6d1f0ca2949b
6
+ metadata.gz: 2038973a9443b949dd806f9e4cf6aa11db3945b21ff73475054041784d21f0b925ac507ac1e6857fc6c3eb3337668522d55c3525ed4183e8502a3dadfa6e540f
7
+ data.tar.gz: 6ea2cde5c13fb286f58d14e20703356e6f614987de86d8f44487cb8441e4123ed877c59d417d5c9cd2889ad10299f38b5985b3cd5537402cbf3a048088dd44a7
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Bootstrap Ruby Gem [![Build Status](https://travis-ci.org/twbs/bootstrap-rubygem.svg?branch=master)](https://travis-ci.org/twbs/bootstrap-rubygem) [![Gem](https://img.shields.io/gem/v/bootstrap.svg)](https://rubygems.org/gems/bootstrap)
2
2
 
3
- [Bootstrap 4][bootstrap-home] ruby gem for Ruby on Rails (*Sprockets*) and Hanami (formerly Lotus).
3
+ [Bootstrap 5][bootstrap-home] ruby gem for Ruby on Rails (*Sprockets*) and Hanami (formerly Lotus).
4
4
 
5
5
  For Sass versions of Bootstrap 3 and 2 see [bootstrap-sass](https://github.com/twbs/bootstrap-sass) instead.
6
6
 
@@ -20,7 +20,7 @@ Please see the appropriate guide for your environment of choice:
20
20
  Add `bootstrap` to your Gemfile:
21
21
 
22
22
  ```ruby
23
- gem 'bootstrap', '~> 5.0.0.beta3'
23
+ gem 'bootstrap', '~> 5.1.0'
24
24
  ```
25
25
 
26
26
  Ensure that `sprockets-rails` is at least v2.3.2.
@@ -48,7 +48,7 @@ Then, remove all the `*= require` and `*= require_tree` statements from the Sass
48
48
  Do not use `*= require` in Sass or your other stylesheets will not be able to access the Bootstrap mixins and variables.
49
49
 
50
50
  Bootstrap JavaScript can optionally use jQuery.
51
- If you're using Rails 5.1+, you can add add the `jquery-rails` gem to your Gemfile:
51
+ If you're using Rails 5.1+, you can add the `jquery-rails` gem to your Gemfile:
52
52
 
53
53
  ```ruby
54
54
  gem 'jquery-rails'
@@ -1,7 +1,7 @@
1
1
  //= require ./bootstrap-global-this-define
2
2
  //= require ./bootstrap/dom/data
3
- //= require ./bootstrap/base-component
4
3
  //= require ./bootstrap/dom/event-handler
4
+ //= require ./bootstrap/base-component
5
5
  //= require ./bootstrap/alert
6
6
  //= require ./bootstrap/button
7
7
  //= require ./bootstrap/dom/manipulator
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Bootstrap v5.0.0-beta3 (https://getbootstrap.com/)
2
+ * Bootstrap v5.1.0 (https://getbootstrap.com/)
3
3
  * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
@@ -33,7 +33,7 @@
33
33
 
34
34
  /**
35
35
  * --------------------------------------------------------------------------
36
- * Bootstrap (v5.0.0-beta3): util/index.js
36
+ * Bootstrap (v5.1.0): util/index.js
37
37
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38
38
  * --------------------------------------------------------------------------
39
39
  */
@@ -78,7 +78,7 @@
78
78
 
79
79
 
80
80
  if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
81
- hrefAttr = '#' + hrefAttr.split('#')[1];
81
+ hrefAttr = `#${hrefAttr.split('#')[1]}`;
82
82
  }
83
83
 
84
84
  selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
@@ -129,24 +129,29 @@
129
129
  element.dispatchEvent(new Event(TRANSITION_END));
130
130
  };
131
131
 
132
- const isElement = obj => (obj[0] || obj).nodeType;
132
+ const isElement = obj => {
133
+ if (!obj || typeof obj !== 'object') {
134
+ return false;
135
+ }
133
136
 
134
- const emulateTransitionEnd = (element, duration) => {
135
- let called = false;
136
- const durationPadding = 5;
137
- const emulatedDuration = duration + durationPadding;
137
+ if (typeof obj.jquery !== 'undefined') {
138
+ obj = obj[0];
139
+ }
138
140
 
139
- function listener() {
140
- called = true;
141
- element.removeEventListener(TRANSITION_END, listener);
141
+ return typeof obj.nodeType !== 'undefined';
142
+ };
143
+
144
+ const getElement = obj => {
145
+ if (isElement(obj)) {
146
+ // it's a jQuery object or a node element
147
+ return obj.jquery ? obj[0] : obj;
142
148
  }
143
149
 
144
- element.addEventListener(TRANSITION_END, listener);
145
- setTimeout(() => {
146
- if (!called) {
147
- triggerTransitionEnd(element);
148
- }
149
- }, emulatedDuration);
150
+ if (typeof obj === 'string' && obj.length > 0) {
151
+ return document.querySelector(obj);
152
+ }
153
+
154
+ return null;
150
155
  };
151
156
 
152
157
  const typeCheckConfig = (componentName, config, configTypes) => {
@@ -156,23 +161,17 @@
156
161
  const valueType = value && isElement(value) ? 'element' : toType(value);
157
162
 
158
163
  if (!new RegExp(expectedTypes).test(valueType)) {
159
- throw new TypeError(`${componentName.toUpperCase()}: ` + `Option "${property}" provided type "${valueType}" ` + `but expected type "${expectedTypes}".`);
164
+ throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
160
165
  }
161
166
  });
162
167
  };
163
168
 
164
169
  const isVisible = element => {
165
- if (!element) {
170
+ if (!isElement(element) || element.getClientRects().length === 0) {
166
171
  return false;
167
172
  }
168
173
 
169
- if (element.style && element.parentNode && element.parentNode.style) {
170
- const elementStyle = getComputedStyle(element);
171
- const parentNodeStyle = getComputedStyle(element.parentNode);
172
- return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
173
- }
174
-
175
- return false;
174
+ return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
176
175
  };
177
176
 
178
177
  const isDisabled = element => {
@@ -214,9 +213,21 @@
214
213
  return findShadowRoot(element.parentNode);
215
214
  };
216
215
 
217
- const noop = () => function () {};
216
+ const noop = () => {};
217
+ /**
218
+ * Trick to restart an element's animation
219
+ *
220
+ * @param {HTMLElement} element
221
+ * @return void
222
+ *
223
+ * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
224
+ */
225
+
218
226
 
219
- const reflow = element => element.offsetHeight;
227
+ const reflow = element => {
228
+ // eslint-disable-next-line no-unused-expressions
229
+ element.offsetHeight;
230
+ };
220
231
 
221
232
  const getjQuery = () => {
222
233
  const {
@@ -230,9 +241,18 @@
230
241
  return null;
231
242
  };
232
243
 
244
+ const DOMContentLoadedCallbacks = [];
245
+
233
246
  const onDOMContentLoaded = callback => {
234
247
  if (document.readyState === 'loading') {
235
- document.addEventListener('DOMContentLoaded', callback);
248
+ // add listener on the first call when the document is in loading state
249
+ if (!DOMContentLoadedCallbacks.length) {
250
+ document.addEventListener('DOMContentLoaded', () => {
251
+ DOMContentLoadedCallbacks.forEach(callback => callback());
252
+ });
253
+ }
254
+
255
+ DOMContentLoadedCallbacks.push(callback);
236
256
  } else {
237
257
  callback();
238
258
  }
@@ -240,12 +260,13 @@
240
260
 
241
261
  const isRTL = () => document.documentElement.dir === 'rtl';
242
262
 
243
- const defineJQueryPlugin = (name, plugin) => {
263
+ const defineJQueryPlugin = plugin => {
244
264
  onDOMContentLoaded(() => {
245
265
  const $ = getjQuery();
246
266
  /* istanbul ignore if */
247
267
 
248
268
  if ($) {
269
+ const name = plugin.NAME;
249
270
  const JQUERY_NO_CONFLICT = $.fn[name];
250
271
  $.fn[name] = plugin.jQueryInterface;
251
272
  $.fn[name].Constructor = plugin;
@@ -258,63 +279,72 @@
258
279
  });
259
280
  };
260
281
 
261
- /**
262
- * --------------------------------------------------------------------------
263
- * Bootstrap (v5.0.0-beta3): dom/data.js
264
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
265
- * --------------------------------------------------------------------------
266
- */
282
+ const execute = callback => {
283
+ if (typeof callback === 'function') {
284
+ callback();
285
+ }
286
+ };
267
287
 
268
- /**
269
- * ------------------------------------------------------------------------
270
- * Constants
271
- * ------------------------------------------------------------------------
272
- */
273
- const elementMap = new Map();
274
- var Data = {
275
- set(element, key, instance) {
276
- if (!elementMap.has(element)) {
277
- elementMap.set(element, new Map());
278
- }
288
+ const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
289
+ if (!waitForTransition) {
290
+ execute(callback);
291
+ return;
292
+ }
279
293
 
280
- const instanceMap = elementMap.get(element); // make it clear we only want one instance per element
281
- // can be removed later when multiple key/instances are fine to be used
294
+ const durationPadding = 5;
295
+ const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
296
+ let called = false;
282
297
 
283
- if (!instanceMap.has(key) && instanceMap.size !== 0) {
284
- // eslint-disable-next-line no-console
285
- console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
298
+ const handler = ({
299
+ target
300
+ }) => {
301
+ if (target !== transitionElement) {
286
302
  return;
287
303
  }
288
304
 
289
- instanceMap.set(key, instance);
290
- },
305
+ called = true;
306
+ transitionElement.removeEventListener(TRANSITION_END, handler);
307
+ execute(callback);
308
+ };
291
309
 
292
- get(element, key) {
293
- if (elementMap.has(element)) {
294
- return elementMap.get(element).get(key) || null;
310
+ transitionElement.addEventListener(TRANSITION_END, handler);
311
+ setTimeout(() => {
312
+ if (!called) {
313
+ triggerTransitionEnd(transitionElement);
295
314
  }
315
+ }, emulatedDuration);
316
+ };
317
+ /**
318
+ * Return the previous/next element of a list.
319
+ *
320
+ * @param {array} list The list of elements
321
+ * @param activeElement The active element
322
+ * @param shouldGetNext Choose to get next or previous element
323
+ * @param isCycleAllowed
324
+ * @return {Element|elem} The proper element
325
+ */
296
326
 
297
- return null;
298
- },
299
327
 
300
- remove(element, key) {
301
- if (!elementMap.has(element)) {
302
- return;
303
- }
328
+ const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
329
+ let index = list.indexOf(activeElement); // if the element does not exist in the list return an element depending on the direction and if cycle is allowed
304
330
 
305
- const instanceMap = elementMap.get(element);
306
- instanceMap.delete(key); // free up element references if there are no instances left for an element
331
+ if (index === -1) {
332
+ return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0];
333
+ }
307
334
 
308
- if (instanceMap.size === 0) {
309
- elementMap.delete(element);
310
- }
335
+ const listLength = list.length;
336
+ index += shouldGetNext ? 1 : -1;
337
+
338
+ if (isCycleAllowed) {
339
+ index = (index + listLength) % listLength;
311
340
  }
312
341
 
342
+ return list[Math.max(0, Math.min(index, listLength - 1))];
313
343
  };
314
344
 
315
345
  /**
316
346
  * --------------------------------------------------------------------------
317
- * Bootstrap (v5.0.0-beta3): dom/event-handler.js
347
+ * Bootstrap (v5.1.0): dom/event-handler.js
318
348
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
319
349
  * --------------------------------------------------------------------------
320
350
  */
@@ -334,6 +364,7 @@
334
364
  mouseenter: 'mouseover',
335
365
  mouseleave: 'mouseout'
336
366
  };
367
+ const customEventsRegex = /^(mouseenter|mouseleave)/i;
337
368
  const 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']);
338
369
  /**
339
370
  * ------------------------------------------------------------------------
@@ -377,7 +408,7 @@
377
408
 
378
409
  if (handler.oneOff) {
379
410
  // eslint-disable-next-line unicorn/consistent-destructuring
380
- EventHandler.off(element, event.type, fn);
411
+ EventHandler.off(element, event.type, selector, fn);
381
412
  }
382
413
 
383
414
  return fn.apply(target, [event]);
@@ -406,15 +437,8 @@
406
437
 
407
438
  function normalizeParams(originalTypeEvent, handler, delegationFn) {
408
439
  const delegation = typeof handler === 'string';
409
- const originalHandler = delegation ? delegationFn : handler; // allow to get the native events from namespaced events ('click.bs.button' --> 'click')
410
-
411
- let typeEvent = originalTypeEvent.replace(stripNameRegex, '');
412
- const custom = customEvents[typeEvent];
413
-
414
- if (custom) {
415
- typeEvent = custom;
416
- }
417
-
440
+ const originalHandler = delegation ? delegationFn : handler;
441
+ let typeEvent = getTypeEvent(originalTypeEvent);
418
442
  const isNative = nativeEvents.has(typeEvent);
419
443
 
420
444
  if (!isNative) {
@@ -432,6 +456,24 @@
432
456
  if (!handler) {
433
457
  handler = delegationFn;
434
458
  delegationFn = null;
459
+ } // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
460
+ // this prevents the handler from being dispatched the same way as mouseover or mouseout does
461
+
462
+
463
+ if (customEventsRegex.test(originalTypeEvent)) {
464
+ const wrapFn = fn => {
465
+ return function (event) {
466
+ if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
467
+ return fn.call(this, event);
468
+ }
469
+ };
470
+ };
471
+
472
+ if (delegationFn) {
473
+ delegationFn = wrapFn(delegationFn);
474
+ } else {
475
+ handler = wrapFn(handler);
476
+ }
435
477
  }
436
478
 
437
479
  const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
@@ -475,6 +517,12 @@
475
517
  });
476
518
  }
477
519
 
520
+ function getTypeEvent(event) {
521
+ // allow to get the native events from namespaced events ('click.bs.button' --> 'click')
522
+ event = event.replace(stripNameRegex, '');
523
+ return customEvents[event] || event;
524
+ }
525
+
478
526
  const EventHandler = {
479
527
  on(element, event, handler, delegationFn) {
480
528
  addHandler(element, event, handler, delegationFn, false);
@@ -527,7 +575,7 @@
527
575
  }
528
576
 
529
577
  const $ = getjQuery();
530
- const typeEvent = event.replace(stripNameRegex, '');
578
+ const typeEvent = getTypeEvent(event);
531
579
  const inNamespace = event !== typeEvent;
532
580
  const isNative = nativeEvents.has(typeEvent);
533
581
  let jQueryEvent;
@@ -585,7 +633,61 @@
585
633
 
586
634
  /**
587
635
  * --------------------------------------------------------------------------
588
- * Bootstrap (v5.0.0-beta3): base-component.js
636
+ * Bootstrap (v5.1.0): dom/data.js
637
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
638
+ * --------------------------------------------------------------------------
639
+ */
640
+
641
+ /**
642
+ * ------------------------------------------------------------------------
643
+ * Constants
644
+ * ------------------------------------------------------------------------
645
+ */
646
+ const elementMap = new Map();
647
+ var Data = {
648
+ set(element, key, instance) {
649
+ if (!elementMap.has(element)) {
650
+ elementMap.set(element, new Map());
651
+ }
652
+
653
+ const instanceMap = elementMap.get(element); // make it clear we only want one instance per element
654
+ // can be removed later when multiple key/instances are fine to be used
655
+
656
+ if (!instanceMap.has(key) && instanceMap.size !== 0) {
657
+ // eslint-disable-next-line no-console
658
+ console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
659
+ return;
660
+ }
661
+
662
+ instanceMap.set(key, instance);
663
+ },
664
+
665
+ get(element, key) {
666
+ if (elementMap.has(element)) {
667
+ return elementMap.get(element).get(key) || null;
668
+ }
669
+
670
+ return null;
671
+ },
672
+
673
+ remove(element, key) {
674
+ if (!elementMap.has(element)) {
675
+ return;
676
+ }
677
+
678
+ const instanceMap = elementMap.get(element);
679
+ instanceMap.delete(key); // free up element references if there are no instances left for an element
680
+
681
+ if (instanceMap.size === 0) {
682
+ elementMap.delete(element);
683
+ }
684
+ }
685
+
686
+ };
687
+
688
+ /**
689
+ * --------------------------------------------------------------------------
690
+ * Bootstrap (v5.1.0): base-component.js
589
691
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
590
692
  * --------------------------------------------------------------------------
591
693
  */
@@ -595,11 +697,11 @@
595
697
  * ------------------------------------------------------------------------
596
698
  */
597
699
 
598
- const VERSION = '5.0.0-beta3';
700
+ const VERSION = '5.1.0';
599
701
 
600
702
  class BaseComponent {
601
703
  constructor(element) {
602
- element = typeof element === 'string' ? document.querySelector(element) : element;
704
+ element = getElement(element);
603
705
 
604
706
  if (!element) {
605
707
  return;
@@ -611,24 +713,73 @@
611
713
 
612
714
  dispose() {
613
715
  Data.remove(this._element, this.constructor.DATA_KEY);
614
- this._element = null;
716
+ EventHandler.off(this._element, this.constructor.EVENT_KEY);
717
+ Object.getOwnPropertyNames(this).forEach(propertyName => {
718
+ this[propertyName] = null;
719
+ });
720
+ }
721
+
722
+ _queueCallback(callback, element, isAnimated = true) {
723
+ executeAfterTransition(callback, element, isAnimated);
615
724
  }
616
725
  /** Static */
617
726
 
618
727
 
619
728
  static getInstance(element) {
620
- return Data.get(element, this.DATA_KEY);
729
+ return Data.get(getElement(element), this.DATA_KEY);
730
+ }
731
+
732
+ static getOrCreateInstance(element, config = {}) {
733
+ return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null);
621
734
  }
622
735
 
623
736
  static get VERSION() {
624
737
  return VERSION;
625
738
  }
626
739
 
740
+ static get NAME() {
741
+ throw new Error('You have to implement the static method "NAME", for each component!');
742
+ }
743
+
744
+ static get DATA_KEY() {
745
+ return `bs.${this.NAME}`;
746
+ }
747
+
748
+ static get EVENT_KEY() {
749
+ return `.${this.DATA_KEY}`;
750
+ }
751
+
627
752
  }
628
753
 
629
754
  /**
630
755
  * --------------------------------------------------------------------------
631
- * Bootstrap (v5.0.0-beta3): alert.js
756
+ * Bootstrap (v5.1.0): util/component-functions.js
757
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
758
+ * --------------------------------------------------------------------------
759
+ */
760
+
761
+ const enableDismissTrigger = (component, method = 'hide') => {
762
+ const clickEvent = `click.dismiss${component.EVENT_KEY}`;
763
+ const name = component.NAME;
764
+ EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
765
+ if (['A', 'AREA'].includes(this.tagName)) {
766
+ event.preventDefault();
767
+ }
768
+
769
+ if (isDisabled(this)) {
770
+ return;
771
+ }
772
+
773
+ const target = getElementFromSelector(this) || this.closest(`.${name}`);
774
+ const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
775
+
776
+ instance[method]();
777
+ });
778
+ };
779
+
780
+ /**
781
+ * --------------------------------------------------------------------------
782
+ * Bootstrap (v5.1.0): alert.js
632
783
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
633
784
  * --------------------------------------------------------------------------
634
785
  */
@@ -638,15 +789,11 @@
638
789
  * ------------------------------------------------------------------------
639
790
  */
640
791
 
641
- const NAME$b = 'alert';
642
- const DATA_KEY$b = 'bs.alert';
643
- const EVENT_KEY$b = `.${DATA_KEY$b}`;
644
- const DATA_API_KEY$8 = '.data-api';
645
- const SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
646
- const EVENT_CLOSE = `close${EVENT_KEY$b}`;
647
- const EVENT_CLOSED = `closed${EVENT_KEY$b}`;
648
- const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$b}${DATA_API_KEY$8}`;
649
- const CLASS_NAME_ALERT = 'alert';
792
+ const NAME$d = 'alert';
793
+ const DATA_KEY$c = 'bs.alert';
794
+ const EVENT_KEY$c = `.${DATA_KEY$c}`;
795
+ const EVENT_CLOSE = `close${EVENT_KEY$c}`;
796
+ const EVENT_CLOSED = `closed${EVENT_KEY$c}`;
650
797
  const CLASS_NAME_FADE$5 = 'fade';
651
798
  const CLASS_NAME_SHOW$8 = 'show';
652
799
  /**
@@ -657,77 +804,48 @@
657
804
 
658
805
  class Alert extends BaseComponent {
659
806
  // Getters
660
- static get DATA_KEY() {
661
- return DATA_KEY$b;
807
+ static get NAME() {
808
+ return NAME$d;
662
809
  } // Public
663
810
 
664
811
 
665
- close(element) {
666
- const rootElement = element ? this._getRootElement(element) : this._element;
812
+ close() {
813
+ const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
667
814
 
668
- const customEvent = this._triggerCloseEvent(rootElement);
669
-
670
- if (customEvent === null || customEvent.defaultPrevented) {
815
+ if (closeEvent.defaultPrevented) {
671
816
  return;
672
817
  }
673
818
 
674
- this._removeElement(rootElement);
675
- } // Private
676
-
677
-
678
- _getRootElement(element) {
679
- return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
680
- }
681
-
682
- _triggerCloseEvent(element) {
683
- return EventHandler.trigger(element, EVENT_CLOSE);
684
- }
685
-
686
- _removeElement(element) {
687
- element.classList.remove(CLASS_NAME_SHOW$8);
819
+ this._element.classList.remove(CLASS_NAME_SHOW$8);
688
820
 
689
- if (!element.classList.contains(CLASS_NAME_FADE$5)) {
690
- this._destroyElement(element);
821
+ const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5);
691
822
 
692
- return;
693
- }
823
+ this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
824
+ } // Private
694
825
 
695
- const transitionDuration = getTransitionDurationFromElement(element);
696
- EventHandler.one(element, 'transitionend', () => this._destroyElement(element));
697
- emulateTransitionEnd(element, transitionDuration);
698
- }
699
826
 
700
- _destroyElement(element) {
701
- if (element.parentNode) {
702
- element.parentNode.removeChild(element);
703
- }
827
+ _destroyElement() {
828
+ this._element.remove();
704
829
 
705
- EventHandler.trigger(element, EVENT_CLOSED);
830
+ EventHandler.trigger(this._element, EVENT_CLOSED);
831
+ this.dispose();
706
832
  } // Static
707
833
 
708
834
 
709
835
  static jQueryInterface(config) {
710
836
  return this.each(function () {
711
- let data = Data.get(this, DATA_KEY$b);
712
-
713
- if (!data) {
714
- data = new Alert(this);
715
- }
837
+ const data = Alert.getOrCreateInstance(this);
716
838
 
717
- if (config === 'close') {
718
- data[config](this);
839
+ if (typeof config !== 'string') {
840
+ return;
719
841
  }
720
- });
721
- }
722
842
 
723
- static handleDismiss(alertInstance) {
724
- return function (event) {
725
- if (event) {
726
- event.preventDefault();
843
+ if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
844
+ throw new TypeError(`No method named "${config}"`);
727
845
  }
728
846
 
729
- alertInstance.close(this);
730
- };
847
+ data[config](this);
848
+ });
731
849
  }
732
850
 
733
851
  }
@@ -738,7 +856,7 @@
738
856
  */
739
857
 
740
858
 
741
- EventHandler.on(document, EVENT_CLICK_DATA_API$7, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
859
+ enableDismissTrigger(Alert, 'close');
742
860
  /**
743
861
  * ------------------------------------------------------------------------
744
862
  * jQuery
@@ -746,11 +864,11 @@
746
864
  * add .Alert to jQuery only if jQuery is present
747
865
  */
748
866
 
749
- defineJQueryPlugin(NAME$b, Alert);
867
+ defineJQueryPlugin(Alert);
750
868
 
751
869
  /**
752
870
  * --------------------------------------------------------------------------
753
- * Bootstrap (v5.0.0-beta3): button.js
871
+ * Bootstrap (v5.1.0): button.js
754
872
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
755
873
  * --------------------------------------------------------------------------
756
874
  */
@@ -760,13 +878,13 @@
760
878
  * ------------------------------------------------------------------------
761
879
  */
762
880
 
763
- const NAME$a = 'button';
764
- const DATA_KEY$a = 'bs.button';
765
- const EVENT_KEY$a = `.${DATA_KEY$a}`;
881
+ const NAME$c = 'button';
882
+ const DATA_KEY$b = 'bs.button';
883
+ const EVENT_KEY$b = `.${DATA_KEY$b}`;
766
884
  const DATA_API_KEY$7 = '.data-api';
767
885
  const CLASS_NAME_ACTIVE$3 = 'active';
768
886
  const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]';
769
- const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$7}`;
887
+ const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$b}${DATA_API_KEY$7}`;
770
888
  /**
771
889
  * ------------------------------------------------------------------------
772
890
  * Class Definition
@@ -775,8 +893,8 @@
775
893
 
776
894
  class Button extends BaseComponent {
777
895
  // Getters
778
- static get DATA_KEY() {
779
- return DATA_KEY$a;
896
+ static get NAME() {
897
+ return NAME$c;
780
898
  } // Public
781
899
 
782
900
 
@@ -788,11 +906,7 @@
788
906
 
789
907
  static jQueryInterface(config) {
790
908
  return this.each(function () {
791
- let data = Data.get(this, DATA_KEY$a);
792
-
793
- if (!data) {
794
- data = new Button(this);
795
- }
909
+ const data = Button.getOrCreateInstance(this);
796
910
 
797
911
  if (config === 'toggle') {
798
912
  data[config]();
@@ -811,12 +925,7 @@
811
925
  EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event => {
812
926
  event.preventDefault();
813
927
  const button = event.target.closest(SELECTOR_DATA_TOGGLE$5);
814
- let data = Data.get(button, DATA_KEY$a);
815
-
816
- if (!data) {
817
- data = new Button(button);
818
- }
819
-
928
+ const data = Button.getOrCreateInstance(button);
820
929
  data.toggle();
821
930
  });
822
931
  /**
@@ -826,11 +935,11 @@
826
935
  * add .Button to jQuery only if jQuery is present
827
936
  */
828
937
 
829
- defineJQueryPlugin(NAME$a, Button);
938
+ defineJQueryPlugin(Button);
830
939
 
831
940
  /**
832
941
  * --------------------------------------------------------------------------
833
- * Bootstrap (v5.0.0-beta3): dom/manipulator.js
942
+ * Bootstrap (v5.1.0): dom/manipulator.js
834
943
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
835
944
  * --------------------------------------------------------------------------
836
945
  */
@@ -888,8 +997,8 @@
888
997
  offset(element) {
889
998
  const rect = element.getBoundingClientRect();
890
999
  return {
891
- top: rect.top + document.body.scrollTop,
892
- left: rect.left + document.body.scrollLeft
1000
+ top: rect.top + window.pageYOffset,
1001
+ left: rect.left + window.pageXOffset
893
1002
  };
894
1003
  },
895
1004
 
@@ -904,16 +1013,10 @@
904
1013
 
905
1014
  /**
906
1015
  * --------------------------------------------------------------------------
907
- * Bootstrap (v5.0.0-beta3): dom/selector-engine.js
1016
+ * Bootstrap (v5.1.0): dom/selector-engine.js
908
1017
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
909
1018
  * --------------------------------------------------------------------------
910
1019
  */
911
-
912
- /**
913
- * ------------------------------------------------------------------------
914
- * Constants
915
- * ------------------------------------------------------------------------
916
- */
917
1020
  const NODE_TEXT = 3;
918
1021
  const SelectorEngine = {
919
1022
  find(selector, element = document.documentElement) {
@@ -969,13 +1072,18 @@
969
1072
  }
970
1073
 
971
1074
  return [];
1075
+ },
1076
+
1077
+ focusableChildren(element) {
1078
+ const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(', ');
1079
+ return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el));
972
1080
  }
973
1081
 
974
1082
  };
975
1083
 
976
1084
  /**
977
1085
  * --------------------------------------------------------------------------
978
- * Bootstrap (v5.0.0-beta3): carousel.js
1086
+ * Bootstrap (v5.1.0): carousel.js
979
1087
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
980
1088
  * --------------------------------------------------------------------------
981
1089
  */
@@ -985,16 +1093,16 @@
985
1093
  * ------------------------------------------------------------------------
986
1094
  */
987
1095
 
988
- const NAME$9 = 'carousel';
989
- const DATA_KEY$9 = 'bs.carousel';
990
- const EVENT_KEY$9 = `.${DATA_KEY$9}`;
1096
+ const NAME$b = 'carousel';
1097
+ const DATA_KEY$a = 'bs.carousel';
1098
+ const EVENT_KEY$a = `.${DATA_KEY$a}`;
991
1099
  const DATA_API_KEY$6 = '.data-api';
992
1100
  const ARROW_LEFT_KEY = 'ArrowLeft';
993
1101
  const ARROW_RIGHT_KEY = 'ArrowRight';
994
1102
  const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
995
1103
 
996
1104
  const SWIPE_THRESHOLD = 40;
997
- const Default$8 = {
1105
+ const Default$a = {
998
1106
  interval: 5000,
999
1107
  keyboard: true,
1000
1108
  slide: false,
@@ -1002,7 +1110,7 @@
1002
1110
  wrap: true,
1003
1111
  touch: true
1004
1112
  };
1005
- const DefaultType$8 = {
1113
+ const DefaultType$a = {
1006
1114
  interval: '(number|boolean)',
1007
1115
  keyboard: 'boolean',
1008
1116
  slide: '(boolean|string)',
@@ -1014,19 +1122,23 @@
1014
1122
  const ORDER_PREV = 'prev';
1015
1123
  const DIRECTION_LEFT = 'left';
1016
1124
  const DIRECTION_RIGHT = 'right';
1017
- const EVENT_SLIDE = `slide${EVENT_KEY$9}`;
1018
- const EVENT_SLID = `slid${EVENT_KEY$9}`;
1019
- const EVENT_KEYDOWN = `keydown${EVENT_KEY$9}`;
1020
- const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$9}`;
1021
- const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$9}`;
1022
- const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`;
1023
- const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`;
1024
- const EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`;
1025
- const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`;
1026
- const EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`;
1027
- const EVENT_DRAG_START = `dragstart${EVENT_KEY$9}`;
1028
- const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$9}${DATA_API_KEY$6}`;
1029
- const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$9}${DATA_API_KEY$6}`;
1125
+ const KEY_TO_DIRECTION = {
1126
+ [ARROW_LEFT_KEY]: DIRECTION_RIGHT,
1127
+ [ARROW_RIGHT_KEY]: DIRECTION_LEFT
1128
+ };
1129
+ const EVENT_SLIDE = `slide${EVENT_KEY$a}`;
1130
+ const EVENT_SLID = `slid${EVENT_KEY$a}`;
1131
+ const EVENT_KEYDOWN = `keydown${EVENT_KEY$a}`;
1132
+ const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$a}`;
1133
+ const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$a}`;
1134
+ const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$a}`;
1135
+ const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$a}`;
1136
+ const EVENT_TOUCHEND = `touchend${EVENT_KEY$a}`;
1137
+ const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$a}`;
1138
+ const EVENT_POINTERUP = `pointerup${EVENT_KEY$a}`;
1139
+ const EVENT_DRAG_START = `dragstart${EVENT_KEY$a}`;
1140
+ const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$a}${DATA_API_KEY$6}`;
1141
+ const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
1030
1142
  const CLASS_NAME_CAROUSEL = 'carousel';
1031
1143
  const CLASS_NAME_ACTIVE$2 = 'active';
1032
1144
  const CLASS_NAME_SLIDE = 'slide';
@@ -1073,18 +1185,16 @@
1073
1185
 
1074
1186
 
1075
1187
  static get Default() {
1076
- return Default$8;
1188
+ return Default$a;
1077
1189
  }
1078
1190
 
1079
- static get DATA_KEY() {
1080
- return DATA_KEY$9;
1191
+ static get NAME() {
1192
+ return NAME$b;
1081
1193
  } // Public
1082
1194
 
1083
1195
 
1084
1196
  next() {
1085
- if (!this._isSliding) {
1086
- this._slide(ORDER_NEXT);
1087
- }
1197
+ this._slide(ORDER_NEXT);
1088
1198
  }
1089
1199
 
1090
1200
  nextWhenVisible() {
@@ -1096,9 +1206,7 @@
1096
1206
  }
1097
1207
 
1098
1208
  prev() {
1099
- if (!this._isSliding) {
1100
- this._slide(ORDER_PREV);
1101
- }
1209
+ this._slide(ORDER_PREV);
1102
1210
  }
1103
1211
 
1104
1212
  pause(event) {
@@ -1155,26 +1263,15 @@
1155
1263
  const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
1156
1264
 
1157
1265
  this._slide(order, this._items[index]);
1158
- }
1159
-
1160
- dispose() {
1161
- EventHandler.off(this._element, EVENT_KEY$9);
1162
- this._items = null;
1163
- this._config = null;
1164
- this._interval = null;
1165
- this._isPaused = null;
1166
- this._isSliding = null;
1167
- this._activeElement = null;
1168
- this._indicatorsElement = null;
1169
- super.dispose();
1170
1266
  } // Private
1171
1267
 
1172
1268
 
1173
1269
  _getConfig(config) {
1174
- config = { ...Default$8,
1175
- ...config
1270
+ config = { ...Default$a,
1271
+ ...Manipulator.getDataAttributes(this._element),
1272
+ ...(typeof config === 'object' ? config : {})
1176
1273
  };
1177
- typeCheckConfig(NAME$9, config, DefaultType$8);
1274
+ typeCheckConfig(NAME$b, config, DefaultType$a);
1178
1275
  return config;
1179
1276
  }
1180
1277
 
@@ -1270,14 +1367,12 @@
1270
1367
  return;
1271
1368
  }
1272
1369
 
1273
- if (event.key === ARROW_LEFT_KEY) {
1274
- event.preventDefault();
1370
+ const direction = KEY_TO_DIRECTION[event.key];
1275
1371
 
1276
- this._slide(DIRECTION_LEFT);
1277
- } else if (event.key === ARROW_RIGHT_KEY) {
1372
+ if (direction) {
1278
1373
  event.preventDefault();
1279
1374
 
1280
- this._slide(DIRECTION_RIGHT);
1375
+ this._slide(direction);
1281
1376
  }
1282
1377
  }
1283
1378
 
@@ -1288,20 +1383,7 @@
1288
1383
 
1289
1384
  _getItemByOrder(order, activeElement) {
1290
1385
  const isNext = order === ORDER_NEXT;
1291
- const isPrev = order === ORDER_PREV;
1292
-
1293
- const activeIndex = this._getItemIndex(activeElement);
1294
-
1295
- const lastItemIndex = this._items.length - 1;
1296
- const isGoingToWrap = isPrev && activeIndex === 0 || isNext && activeIndex === lastItemIndex;
1297
-
1298
- if (isGoingToWrap && !this._config.wrap) {
1299
- return activeElement;
1300
- }
1301
-
1302
- const delta = isPrev ? -1 : 1;
1303
- const itemIndex = (activeIndex + delta) % this._items.length;
1304
- return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
1386
+ return getNextActiveElement(this._items, activeElement, isNext, this._config.wrap);
1305
1387
  }
1306
1388
 
1307
1389
  _triggerSlideEvent(relatedTarget, eventDirectionName) {
@@ -1374,7 +1456,11 @@
1374
1456
  return;
1375
1457
  }
1376
1458
 
1377
- const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
1459
+ if (this._isSliding) {
1460
+ return;
1461
+ }
1462
+
1463
+ const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
1378
1464
 
1379
1465
  if (slideEvent.defaultPrevented) {
1380
1466
  return;
@@ -1395,37 +1481,35 @@
1395
1481
 
1396
1482
  this._activeElement = nextElement;
1397
1483
 
1484
+ const triggerSlidEvent = () => {
1485
+ EventHandler.trigger(this._element, EVENT_SLID, {
1486
+ relatedTarget: nextElement,
1487
+ direction: eventDirectionName,
1488
+ from: activeElementIndex,
1489
+ to: nextElementIndex
1490
+ });
1491
+ };
1492
+
1398
1493
  if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
1399
1494
  nextElement.classList.add(orderClassName);
1400
1495
  reflow(nextElement);
1401
1496
  activeElement.classList.add(directionalClassName);
1402
1497
  nextElement.classList.add(directionalClassName);
1403
- const transitionDuration = getTransitionDurationFromElement(activeElement);
1404
- EventHandler.one(activeElement, 'transitionend', () => {
1498
+
1499
+ const completeCallBack = () => {
1405
1500
  nextElement.classList.remove(directionalClassName, orderClassName);
1406
1501
  nextElement.classList.add(CLASS_NAME_ACTIVE$2);
1407
1502
  activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName);
1408
1503
  this._isSliding = false;
1409
- setTimeout(() => {
1410
- EventHandler.trigger(this._element, EVENT_SLID, {
1411
- relatedTarget: nextElement,
1412
- direction: eventDirectionName,
1413
- from: activeElementIndex,
1414
- to: nextElementIndex
1415
- });
1416
- }, 0);
1417
- });
1418
- emulateTransitionEnd(activeElement, transitionDuration);
1504
+ setTimeout(triggerSlidEvent, 0);
1505
+ };
1506
+
1507
+ this._queueCallback(completeCallBack, activeElement, true);
1419
1508
  } else {
1420
1509
  activeElement.classList.remove(CLASS_NAME_ACTIVE$2);
1421
1510
  nextElement.classList.add(CLASS_NAME_ACTIVE$2);
1422
1511
  this._isSliding = false;
1423
- EventHandler.trigger(this._element, EVENT_SLID, {
1424
- relatedTarget: nextElement,
1425
- direction: eventDirectionName,
1426
- from: activeElementIndex,
1427
- to: nextElementIndex
1428
- });
1512
+ triggerSlidEvent();
1429
1513
  }
1430
1514
 
1431
1515
  if (isCycling) {
@@ -1439,10 +1523,10 @@
1439
1523
  }
1440
1524
 
1441
1525
  if (isRTL()) {
1442
- return direction === DIRECTION_RIGHT ? ORDER_PREV : ORDER_NEXT;
1526
+ return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
1443
1527
  }
1444
1528
 
1445
- return direction === DIRECTION_RIGHT ? ORDER_NEXT : ORDER_PREV;
1529
+ return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
1446
1530
  }
1447
1531
 
1448
1532
  _orderToDirection(order) {
@@ -1451,18 +1535,18 @@
1451
1535
  }
1452
1536
 
1453
1537
  if (isRTL()) {
1454
- return order === ORDER_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT;
1538
+ return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
1455
1539
  }
1456
1540
 
1457
- return order === ORDER_NEXT ? DIRECTION_RIGHT : DIRECTION_LEFT;
1541
+ return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
1458
1542
  } // Static
1459
1543
 
1460
1544
 
1461
1545
  static carouselInterface(element, config) {
1462
- let data = Data.get(element, DATA_KEY$9);
1463
- let _config = { ...Default$8,
1464
- ...Manipulator.getDataAttributes(element)
1465
- };
1546
+ const data = Carousel.getOrCreateInstance(element, config);
1547
+ let {
1548
+ _config
1549
+ } = data;
1466
1550
 
1467
1551
  if (typeof config === 'object') {
1468
1552
  _config = { ..._config,
@@ -1472,10 +1556,6 @@
1472
1556
 
1473
1557
  const action = typeof config === 'string' ? config : _config.slide;
1474
1558
 
1475
- if (!data) {
1476
- data = new Carousel(element, _config);
1477
- }
1478
-
1479
1559
  if (typeof config === 'number') {
1480
1560
  data.to(config);
1481
1561
  } else if (typeof action === 'string') {
@@ -1515,7 +1595,7 @@
1515
1595
  Carousel.carouselInterface(target, config);
1516
1596
 
1517
1597
  if (slideIndex) {
1518
- Data.get(target, DATA_KEY$9).to(slideIndex);
1598
+ Carousel.getInstance(target).to(slideIndex);
1519
1599
  }
1520
1600
 
1521
1601
  event.preventDefault();
@@ -1534,7 +1614,7 @@
1534
1614
  const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
1535
1615
 
1536
1616
  for (let i = 0, len = carousels.length; i < len; i++) {
1537
- Carousel.carouselInterface(carousels[i], Data.get(carousels[i], DATA_KEY$9));
1617
+ Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i]));
1538
1618
  }
1539
1619
  });
1540
1620
  /**
@@ -1544,11 +1624,11 @@
1544
1624
  * add .Carousel to jQuery only if jQuery is present
1545
1625
  */
1546
1626
 
1547
- defineJQueryPlugin(NAME$9, Carousel);
1627
+ defineJQueryPlugin(Carousel);
1548
1628
 
1549
1629
  /**
1550
1630
  * --------------------------------------------------------------------------
1551
- * Bootstrap (v5.0.0-beta3): collapse.js
1631
+ * Bootstrap (v5.1.0): collapse.js
1552
1632
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
1553
1633
  * --------------------------------------------------------------------------
1554
1634
  */
@@ -1558,27 +1638,28 @@
1558
1638
  * ------------------------------------------------------------------------
1559
1639
  */
1560
1640
 
1561
- const NAME$8 = 'collapse';
1562
- const DATA_KEY$8 = 'bs.collapse';
1563
- const EVENT_KEY$8 = `.${DATA_KEY$8}`;
1641
+ const NAME$a = 'collapse';
1642
+ const DATA_KEY$9 = 'bs.collapse';
1643
+ const EVENT_KEY$9 = `.${DATA_KEY$9}`;
1564
1644
  const DATA_API_KEY$5 = '.data-api';
1565
- const Default$7 = {
1645
+ const Default$9 = {
1566
1646
  toggle: true,
1567
- parent: ''
1647
+ parent: null
1568
1648
  };
1569
- const DefaultType$7 = {
1649
+ const DefaultType$9 = {
1570
1650
  toggle: 'boolean',
1571
- parent: '(string|element)'
1651
+ parent: '(null|element)'
1572
1652
  };
1573
- const EVENT_SHOW$5 = `show${EVENT_KEY$8}`;
1574
- const EVENT_SHOWN$5 = `shown${EVENT_KEY$8}`;
1575
- const EVENT_HIDE$5 = `hide${EVENT_KEY$8}`;
1576
- const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$8}`;
1577
- const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
1653
+ const EVENT_SHOW$5 = `show${EVENT_KEY$9}`;
1654
+ const EVENT_SHOWN$5 = `shown${EVENT_KEY$9}`;
1655
+ const EVENT_HIDE$5 = `hide${EVENT_KEY$9}`;
1656
+ const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$9}`;
1657
+ const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$9}${DATA_API_KEY$5}`;
1578
1658
  const CLASS_NAME_SHOW$7 = 'show';
1579
1659
  const CLASS_NAME_COLLAPSE = 'collapse';
1580
1660
  const CLASS_NAME_COLLAPSING = 'collapsing';
1581
1661
  const CLASS_NAME_COLLAPSED = 'collapsed';
1662
+ const CLASS_NAME_HORIZONTAL = 'collapse-horizontal';
1582
1663
  const WIDTH = 'width';
1583
1664
  const HEIGHT = 'height';
1584
1665
  const SELECTOR_ACTIVES = '.show, .collapsing';
@@ -1594,7 +1675,7 @@
1594
1675
  super(element);
1595
1676
  this._isTransitioning = false;
1596
1677
  this._config = this._getConfig(config);
1597
- this._triggerArray = SelectorEngine.find(`${SELECTOR_DATA_TOGGLE$4}[href="#${this._element.id}"],` + `${SELECTOR_DATA_TOGGLE$4}[data-bs-target="#${this._element.id}"]`);
1678
+ this._triggerArray = [];
1598
1679
  const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4);
1599
1680
 
1600
1681
  for (let i = 0, len = toggleList.length; i < len; i++) {
@@ -1609,10 +1690,10 @@
1609
1690
  }
1610
1691
  }
1611
1692
 
1612
- this._parent = this._config.parent ? this._getParent() : null;
1693
+ this._initializeChildren();
1613
1694
 
1614
1695
  if (!this._config.parent) {
1615
- this._addAriaAndCollapsedClass(this._element, this._triggerArray);
1696
+ this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
1616
1697
  }
1617
1698
 
1618
1699
  if (this._config.toggle) {
@@ -1622,16 +1703,16 @@
1622
1703
 
1623
1704
 
1624
1705
  static get Default() {
1625
- return Default$7;
1706
+ return Default$9;
1626
1707
  }
1627
1708
 
1628
- static get DATA_KEY() {
1629
- return DATA_KEY$8;
1709
+ static get NAME() {
1710
+ return NAME$a;
1630
1711
  } // Public
1631
1712
 
1632
1713
 
1633
1714
  toggle() {
1634
- if (this._element.classList.contains(CLASS_NAME_SHOW$7)) {
1715
+ if (this._isShown()) {
1635
1716
  this.hide();
1636
1717
  } else {
1637
1718
  this.show();
@@ -1639,32 +1720,23 @@
1639
1720
  }
1640
1721
 
1641
1722
  show() {
1642
- if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW$7)) {
1723
+ if (this._isTransitioning || this._isShown()) {
1643
1724
  return;
1644
1725
  }
1645
1726
 
1646
- let actives;
1727
+ let actives = [];
1647
1728
  let activesData;
1648
1729
 
1649
- if (this._parent) {
1650
- actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter(elem => {
1651
- if (typeof this._config.parent === 'string') {
1652
- return elem.getAttribute('data-bs-parent') === this._config.parent;
1653
- }
1654
-
1655
- return elem.classList.contains(CLASS_NAME_COLLAPSE);
1656
- });
1657
-
1658
- if (actives.length === 0) {
1659
- actives = null;
1660
- }
1730
+ if (this._config.parent) {
1731
+ const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent);
1732
+ actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)); // remove children if greater depth
1661
1733
  }
1662
1734
 
1663
1735
  const container = SelectorEngine.findOne(this._selector);
1664
1736
 
1665
- if (actives) {
1737
+ if (actives.length) {
1666
1738
  const tempActiveData = actives.find(elem => container !== elem);
1667
- activesData = tempActiveData ? Data.get(tempActiveData, DATA_KEY$8) : null;
1739
+ activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
1668
1740
 
1669
1741
  if (activesData && activesData._isTransitioning) {
1670
1742
  return;
@@ -1677,17 +1749,17 @@
1677
1749
  return;
1678
1750
  }
1679
1751
 
1680
- if (actives) {
1681
- actives.forEach(elemActive => {
1682
- if (container !== elemActive) {
1683
- Collapse.collapseInterface(elemActive, 'hide');
1684
- }
1752
+ actives.forEach(elemActive => {
1753
+ if (container !== elemActive) {
1754
+ Collapse.getOrCreateInstance(elemActive, {
1755
+ toggle: false
1756
+ }).hide();
1757
+ }
1685
1758
 
1686
- if (!activesData) {
1687
- Data.set(elemActive, DATA_KEY$8, null);
1688
- }
1689
- });
1690
- }
1759
+ if (!activesData) {
1760
+ Data.set(elemActive, DATA_KEY$9, null);
1761
+ }
1762
+ });
1691
1763
 
1692
1764
  const dimension = this._getDimension();
1693
1765
 
@@ -1697,35 +1769,31 @@
1697
1769
 
1698
1770
  this._element.style[dimension] = 0;
1699
1771
 
1700
- if (this._triggerArray.length) {
1701
- this._triggerArray.forEach(element => {
1702
- element.classList.remove(CLASS_NAME_COLLAPSED);
1703
- element.setAttribute('aria-expanded', true);
1704
- });
1705
- }
1772
+ this._addAriaAndCollapsedClass(this._triggerArray, true);
1706
1773
 
1707
- this.setTransitioning(true);
1774
+ this._isTransitioning = true;
1708
1775
 
1709
1776
  const complete = () => {
1777
+ this._isTransitioning = false;
1778
+
1710
1779
  this._element.classList.remove(CLASS_NAME_COLLAPSING);
1711
1780
 
1712
1781
  this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
1713
1782
 
1714
1783
  this._element.style[dimension] = '';
1715
- this.setTransitioning(false);
1716
1784
  EventHandler.trigger(this._element, EVENT_SHOWN$5);
1717
1785
  };
1718
1786
 
1719
1787
  const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
1720
1788
  const scrollSize = `scroll${capitalizedDimension}`;
1721
- const transitionDuration = getTransitionDurationFromElement(this._element);
1722
- EventHandler.one(this._element, 'transitionend', complete);
1723
- emulateTransitionEnd(this._element, transitionDuration);
1789
+
1790
+ this._queueCallback(complete, this._element, true);
1791
+
1724
1792
  this._element.style[dimension] = `${this._element[scrollSize]}px`;
1725
1793
  }
1726
1794
 
1727
1795
  hide() {
1728
- if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW$7)) {
1796
+ if (this._isTransitioning || !this._isShown()) {
1729
1797
  return;
1730
1798
  }
1731
1799
 
@@ -1746,22 +1814,19 @@
1746
1814
 
1747
1815
  const triggerArrayLength = this._triggerArray.length;
1748
1816
 
1749
- if (triggerArrayLength > 0) {
1750
- for (let i = 0; i < triggerArrayLength; i++) {
1751
- const trigger = this._triggerArray[i];
1752
- const elem = getElementFromSelector(trigger);
1817
+ for (let i = 0; i < triggerArrayLength; i++) {
1818
+ const trigger = this._triggerArray[i];
1819
+ const elem = getElementFromSelector(trigger);
1753
1820
 
1754
- if (elem && !elem.classList.contains(CLASS_NAME_SHOW$7)) {
1755
- trigger.classList.add(CLASS_NAME_COLLAPSED);
1756
- trigger.setAttribute('aria-expanded', false);
1757
- }
1821
+ if (elem && !this._isShown(elem)) {
1822
+ this._addAriaAndCollapsedClass([trigger], false);
1758
1823
  }
1759
1824
  }
1760
1825
 
1761
- this.setTransitioning(true);
1826
+ this._isTransitioning = true;
1762
1827
 
1763
1828
  const complete = () => {
1764
- this.setTransitioning(false);
1829
+ this._isTransitioning = false;
1765
1830
 
1766
1831
  this._element.classList.remove(CLASS_NAME_COLLAPSING);
1767
1832
 
@@ -1771,67 +1836,51 @@
1771
1836
  };
1772
1837
 
1773
1838
  this._element.style[dimension] = '';
1774
- const transitionDuration = getTransitionDurationFromElement(this._element);
1775
- EventHandler.one(this._element, 'transitionend', complete);
1776
- emulateTransitionEnd(this._element, transitionDuration);
1777
- }
1778
1839
 
1779
- setTransitioning(isTransitioning) {
1780
- this._isTransitioning = isTransitioning;
1840
+ this._queueCallback(complete, this._element, true);
1781
1841
  }
1782
1842
 
1783
- dispose() {
1784
- super.dispose();
1785
- this._config = null;
1786
- this._parent = null;
1787
- this._triggerArray = null;
1788
- this._isTransitioning = null;
1843
+ _isShown(element = this._element) {
1844
+ return element.classList.contains(CLASS_NAME_SHOW$7);
1789
1845
  } // Private
1790
1846
 
1791
1847
 
1792
1848
  _getConfig(config) {
1793
- config = { ...Default$7,
1849
+ config = { ...Default$9,
1850
+ ...Manipulator.getDataAttributes(this._element),
1794
1851
  ...config
1795
1852
  };
1796
1853
  config.toggle = Boolean(config.toggle); // Coerce string values
1797
1854
 
1798
- typeCheckConfig(NAME$8, config, DefaultType$7);
1855
+ config.parent = getElement(config.parent);
1856
+ typeCheckConfig(NAME$a, config, DefaultType$9);
1799
1857
  return config;
1800
1858
  }
1801
1859
 
1802
1860
  _getDimension() {
1803
- return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
1861
+ return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
1804
1862
  }
1805
1863
 
1806
- _getParent() {
1807
- let {
1808
- parent
1809
- } = this._config;
1810
-
1811
- if (isElement(parent)) {
1812
- // it's a jQuery object
1813
- if (typeof parent.jquery !== 'undefined' || typeof parent[0] !== 'undefined') {
1814
- parent = parent[0];
1815
- }
1816
- } else {
1817
- parent = SelectorEngine.findOne(parent);
1864
+ _initializeChildren() {
1865
+ if (!this._config.parent) {
1866
+ return;
1818
1867
  }
1819
1868
 
1820
- const selector = `${SELECTOR_DATA_TOGGLE$4}[data-bs-parent="${parent}"]`;
1821
- SelectorEngine.find(selector, parent).forEach(element => {
1869
+ const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent);
1870
+ SelectorEngine.find(SELECTOR_DATA_TOGGLE$4, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => {
1822
1871
  const selected = getElementFromSelector(element);
1823
1872
 
1824
- this._addAriaAndCollapsedClass(selected, [element]);
1873
+ if (selected) {
1874
+ this._addAriaAndCollapsedClass([element], this._isShown(selected));
1875
+ }
1825
1876
  });
1826
- return parent;
1827
1877
  }
1828
1878
 
1829
- _addAriaAndCollapsedClass(element, triggerArray) {
1830
- if (!element || !triggerArray.length) {
1879
+ _addAriaAndCollapsedClass(triggerArray, isOpen) {
1880
+ if (!triggerArray.length) {
1831
1881
  return;
1832
1882
  }
1833
1883
 
1834
- const isOpen = element.classList.contains(CLASS_NAME_SHOW$7);
1835
1884
  triggerArray.forEach(elem => {
1836
1885
  if (isOpen) {
1837
1886
  elem.classList.remove(CLASS_NAME_COLLAPSED);
@@ -1844,33 +1893,23 @@
1844
1893
  } // Static
1845
1894
 
1846
1895
 
1847
- static collapseInterface(element, config) {
1848
- let data = Data.get(element, DATA_KEY$8);
1849
- const _config = { ...Default$7,
1850
- ...Manipulator.getDataAttributes(element),
1851
- ...(typeof config === 'object' && config ? config : {})
1852
- };
1853
-
1854
- if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
1855
- _config.toggle = false;
1856
- }
1857
-
1858
- if (!data) {
1859
- data = new Collapse(element, _config);
1860
- }
1896
+ static jQueryInterface(config) {
1897
+ return this.each(function () {
1898
+ const _config = {};
1861
1899
 
1862
- if (typeof config === 'string') {
1863
- if (typeof data[config] === 'undefined') {
1864
- throw new TypeError(`No method named "${config}"`);
1900
+ if (typeof config === 'string' && /show|hide/.test(config)) {
1901
+ _config.toggle = false;
1865
1902
  }
1866
1903
 
1867
- data[config]();
1868
- }
1869
- }
1904
+ const data = Collapse.getOrCreateInstance(this, _config);
1870
1905
 
1871
- static jQueryInterface(config) {
1872
- return this.each(function () {
1873
- Collapse.collapseInterface(this, config);
1906
+ if (typeof config === 'string') {
1907
+ if (typeof data[config] === 'undefined') {
1908
+ throw new TypeError(`No method named "${config}"`);
1909
+ }
1910
+
1911
+ data[config]();
1912
+ }
1874
1913
  });
1875
1914
  }
1876
1915
 
@@ -1888,26 +1927,12 @@
1888
1927
  event.preventDefault();
1889
1928
  }
1890
1929
 
1891
- const triggerData = Manipulator.getDataAttributes(this);
1892
1930
  const selector = getSelectorFromElement(this);
1893
1931
  const selectorElements = SelectorEngine.find(selector);
1894
1932
  selectorElements.forEach(element => {
1895
- const data = Data.get(element, DATA_KEY$8);
1896
- let config;
1897
-
1898
- if (data) {
1899
- // update parent attribute
1900
- if (data._parent === null && typeof triggerData.parent === 'string') {
1901
- data._config.parent = triggerData.parent;
1902
- data._parent = data._getParent();
1903
- }
1904
-
1905
- config = 'toggle';
1906
- } else {
1907
- config = triggerData;
1908
- }
1909
-
1910
- Collapse.collapseInterface(element, config);
1933
+ Collapse.getOrCreateInstance(element, {
1934
+ toggle: false
1935
+ }).toggle();
1911
1936
  });
1912
1937
  });
1913
1938
  /**
@@ -1917,11 +1942,11 @@
1917
1942
  * add .Collapse to jQuery only if jQuery is present
1918
1943
  */
1919
1944
 
1920
- defineJQueryPlugin(NAME$8, Collapse);
1945
+ defineJQueryPlugin(Collapse);
1921
1946
 
1922
1947
  /**
1923
1948
  * --------------------------------------------------------------------------
1924
- * Bootstrap (v5.0.0-beta3): dropdown.js
1949
+ * Bootstrap (v5.1.0): dropdown.js
1925
1950
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
1926
1951
  * --------------------------------------------------------------------------
1927
1952
  */
@@ -1931,27 +1956,25 @@
1931
1956
  * ------------------------------------------------------------------------
1932
1957
  */
1933
1958
 
1934
- const NAME$7 = 'dropdown';
1935
- const DATA_KEY$7 = 'bs.dropdown';
1936
- const EVENT_KEY$7 = `.${DATA_KEY$7}`;
1959
+ const NAME$9 = 'dropdown';
1960
+ const DATA_KEY$8 = 'bs.dropdown';
1961
+ const EVENT_KEY$8 = `.${DATA_KEY$8}`;
1937
1962
  const DATA_API_KEY$4 = '.data-api';
1938
1963
  const ESCAPE_KEY$2 = 'Escape';
1939
1964
  const SPACE_KEY = 'Space';
1940
- const TAB_KEY = 'Tab';
1965
+ const TAB_KEY$1 = 'Tab';
1941
1966
  const ARROW_UP_KEY = 'ArrowUp';
1942
1967
  const ARROW_DOWN_KEY = 'ArrowDown';
1943
1968
  const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button
1944
1969
 
1945
1970
  const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`);
1946
- const EVENT_HIDE$4 = `hide${EVENT_KEY$7}`;
1947
- const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$7}`;
1948
- const EVENT_SHOW$4 = `show${EVENT_KEY$7}`;
1949
- const EVENT_SHOWN$4 = `shown${EVENT_KEY$7}`;
1950
- const EVENT_CLICK = `click${EVENT_KEY$7}`;
1951
- const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
1952
- const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$7}${DATA_API_KEY$4}`;
1953
- const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$7}${DATA_API_KEY$4}`;
1954
- const CLASS_NAME_DISABLED = 'disabled';
1971
+ const EVENT_HIDE$4 = `hide${EVENT_KEY$8}`;
1972
+ const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$8}`;
1973
+ const EVENT_SHOW$4 = `show${EVENT_KEY$8}`;
1974
+ const EVENT_SHOWN$4 = `shown${EVENT_KEY$8}`;
1975
+ const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$8}${DATA_API_KEY$4}`;
1976
+ const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$8}${DATA_API_KEY$4}`;
1977
+ const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$8}${DATA_API_KEY$4}`;
1955
1978
  const CLASS_NAME_SHOW$6 = 'show';
1956
1979
  const CLASS_NAME_DROPUP = 'dropup';
1957
1980
  const CLASS_NAME_DROPEND = 'dropend';
@@ -1967,19 +1990,21 @@
1967
1990
  const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
1968
1991
  const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
1969
1992
  const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
1970
- const Default$6 = {
1993
+ const Default$8 = {
1971
1994
  offset: [0, 2],
1972
1995
  boundary: 'clippingParents',
1973
1996
  reference: 'toggle',
1974
1997
  display: 'dynamic',
1975
- popperConfig: null
1998
+ popperConfig: null,
1999
+ autoClose: true
1976
2000
  };
1977
- const DefaultType$6 = {
2001
+ const DefaultType$8 = {
1978
2002
  offset: '(array|string|function)',
1979
2003
  boundary: '(string|element)',
1980
2004
  reference: '(string|element|object)',
1981
2005
  display: 'string',
1982
- popperConfig: '(null|object|function)'
2006
+ popperConfig: '(null|object|function)',
2007
+ autoClose: '(boolean|string)'
1983
2008
  };
1984
2009
  /**
1985
2010
  * ------------------------------------------------------------------------
@@ -1994,46 +2019,31 @@
1994
2019
  this._config = this._getConfig(config);
1995
2020
  this._menu = this._getMenuElement();
1996
2021
  this._inNavbar = this._detectNavbar();
1997
-
1998
- this._addEventListeners();
1999
2022
  } // Getters
2000
2023
 
2001
2024
 
2002
2025
  static get Default() {
2003
- return Default$6;
2026
+ return Default$8;
2004
2027
  }
2005
2028
 
2006
2029
  static get DefaultType() {
2007
- return DefaultType$6;
2030
+ return DefaultType$8;
2008
2031
  }
2009
2032
 
2010
- static get DATA_KEY() {
2011
- return DATA_KEY$7;
2033
+ static get NAME() {
2034
+ return NAME$9;
2012
2035
  } // Public
2013
2036
 
2014
2037
 
2015
2038
  toggle() {
2016
- if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED)) {
2017
- return;
2018
- }
2019
-
2020
- const isActive = this._element.classList.contains(CLASS_NAME_SHOW$6);
2021
-
2022
- Dropdown.clearMenus();
2023
-
2024
- if (isActive) {
2025
- return;
2026
- }
2027
-
2028
- this.show();
2039
+ return this._isShown() ? this.hide() : this.show();
2029
2040
  }
2030
2041
 
2031
2042
  show() {
2032
- if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || this._menu.classList.contains(CLASS_NAME_SHOW$6)) {
2043
+ if (isDisabled(this._element) || this._isShown(this._menu)) {
2033
2044
  return;
2034
2045
  }
2035
2046
 
2036
- const parent = Dropdown.getParentFromElement(this._element);
2037
2047
  const relatedTarget = {
2038
2048
  relatedTarget: this._element
2039
2049
  };
@@ -2041,38 +2051,14 @@
2041
2051
 
2042
2052
  if (showEvent.defaultPrevented) {
2043
2053
  return;
2044
- } // Totally disable Popper for Dropdowns in Navbar
2054
+ }
2045
2055
 
2056
+ const parent = Dropdown.getParentFromElement(this._element); // Totally disable Popper for Dropdowns in Navbar
2046
2057
 
2047
2058
  if (this._inNavbar) {
2048
2059
  Manipulator.setDataAttribute(this._menu, 'popper', 'none');
2049
2060
  } else {
2050
- if (typeof Popper__namespace === 'undefined') {
2051
- throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
2052
- }
2053
-
2054
- let referenceElement = this._element;
2055
-
2056
- if (this._config.reference === 'parent') {
2057
- referenceElement = parent;
2058
- } else if (isElement(this._config.reference)) {
2059
- referenceElement = this._config.reference; // Check if it's jQuery element
2060
-
2061
- if (typeof this._config.reference.jquery !== 'undefined') {
2062
- referenceElement = this._config.reference[0];
2063
- }
2064
- } else if (typeof this._config.reference === 'object') {
2065
- referenceElement = this._config.reference;
2066
- }
2067
-
2068
- const popperConfig = this._getPopperConfig();
2069
-
2070
- const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
2071
- this._popper = Popper__namespace.createPopper(referenceElement, this._menu, popperConfig);
2072
-
2073
- if (isDisplayStatic) {
2074
- Manipulator.setDataAttribute(this._menu, 'popper', 'static');
2075
- }
2061
+ this._createPopper(parent);
2076
2062
  } // If this is a touch-enabled device we add extra
2077
2063
  // empty mouseover listeners to the body's immediate children;
2078
2064
  // only needed because of broken event delegation on iOS
@@ -2080,54 +2066,35 @@
2080
2066
 
2081
2067
 
2082
2068
  if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
2083
- [].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', null, noop()));
2069
+ [].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', noop));
2084
2070
  }
2085
2071
 
2086
2072
  this._element.focus();
2087
2073
 
2088
2074
  this._element.setAttribute('aria-expanded', true);
2089
2075
 
2090
- this._menu.classList.toggle(CLASS_NAME_SHOW$6);
2076
+ this._menu.classList.add(CLASS_NAME_SHOW$6);
2091
2077
 
2092
- this._element.classList.toggle(CLASS_NAME_SHOW$6);
2078
+ this._element.classList.add(CLASS_NAME_SHOW$6);
2093
2079
 
2094
2080
  EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget);
2095
2081
  }
2096
2082
 
2097
2083
  hide() {
2098
- if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED) || !this._menu.classList.contains(CLASS_NAME_SHOW$6)) {
2084
+ if (isDisabled(this._element) || !this._isShown(this._menu)) {
2099
2085
  return;
2100
2086
  }
2101
2087
 
2102
2088
  const relatedTarget = {
2103
2089
  relatedTarget: this._element
2104
2090
  };
2105
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
2106
2091
 
2107
- if (hideEvent.defaultPrevented) {
2108
- return;
2109
- }
2110
-
2111
- if (this._popper) {
2112
- this._popper.destroy();
2113
- }
2114
-
2115
- this._menu.classList.toggle(CLASS_NAME_SHOW$6);
2116
-
2117
- this._element.classList.toggle(CLASS_NAME_SHOW$6);
2118
-
2119
- Manipulator.removeDataAttribute(this._menu, 'popper');
2120
- EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget);
2092
+ this._completeHide(relatedTarget);
2121
2093
  }
2122
2094
 
2123
2095
  dispose() {
2124
- EventHandler.off(this._element, EVENT_KEY$7);
2125
- this._menu = null;
2126
-
2127
2096
  if (this._popper) {
2128
2097
  this._popper.destroy();
2129
-
2130
- this._popper = null;
2131
2098
  }
2132
2099
 
2133
2100
  super.dispose();
@@ -2142,11 +2109,31 @@
2142
2109
  } // Private
2143
2110
 
2144
2111
 
2145
- _addEventListeners() {
2146
- EventHandler.on(this._element, EVENT_CLICK, event => {
2147
- event.preventDefault();
2148
- this.toggle();
2149
- });
2112
+ _completeHide(relatedTarget) {
2113
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
2114
+
2115
+ if (hideEvent.defaultPrevented) {
2116
+ return;
2117
+ } // If this is a touch-enabled device we remove the extra
2118
+ // empty mouseover listeners we added for iOS support
2119
+
2120
+
2121
+ if ('ontouchstart' in document.documentElement) {
2122
+ [].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', noop));
2123
+ }
2124
+
2125
+ if (this._popper) {
2126
+ this._popper.destroy();
2127
+ }
2128
+
2129
+ this._menu.classList.remove(CLASS_NAME_SHOW$6);
2130
+
2131
+ this._element.classList.remove(CLASS_NAME_SHOW$6);
2132
+
2133
+ this._element.setAttribute('aria-expanded', 'false');
2134
+
2135
+ Manipulator.removeDataAttribute(this._menu, 'popper');
2136
+ EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget);
2150
2137
  }
2151
2138
 
2152
2139
  _getConfig(config) {
@@ -2154,16 +2141,45 @@
2154
2141
  ...Manipulator.getDataAttributes(this._element),
2155
2142
  ...config
2156
2143
  };
2157
- typeCheckConfig(NAME$7, config, this.constructor.DefaultType);
2144
+ typeCheckConfig(NAME$9, config, this.constructor.DefaultType);
2158
2145
 
2159
2146
  if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
2160
2147
  // Popper virtual elements require a getBoundingClientRect method
2161
- throw new TypeError(`${NAME$7.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
2148
+ throw new TypeError(`${NAME$9.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
2162
2149
  }
2163
2150
 
2164
2151
  return config;
2165
2152
  }
2166
2153
 
2154
+ _createPopper(parent) {
2155
+ if (typeof Popper__namespace === 'undefined') {
2156
+ throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
2157
+ }
2158
+
2159
+ let referenceElement = this._element;
2160
+
2161
+ if (this._config.reference === 'parent') {
2162
+ referenceElement = parent;
2163
+ } else if (isElement(this._config.reference)) {
2164
+ referenceElement = getElement(this._config.reference);
2165
+ } else if (typeof this._config.reference === 'object') {
2166
+ referenceElement = this._config.reference;
2167
+ }
2168
+
2169
+ const popperConfig = this._getPopperConfig();
2170
+
2171
+ const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
2172
+ this._popper = Popper__namespace.createPopper(referenceElement, this._menu, popperConfig);
2173
+
2174
+ if (isDisplayStatic) {
2175
+ Manipulator.setDataAttribute(this._menu, 'popper', 'static');
2176
+ }
2177
+ }
2178
+
2179
+ _isShown(element = this._element) {
2180
+ return element.classList.contains(CLASS_NAME_SHOW$6);
2181
+ }
2182
+
2167
2183
  _getMenuElement() {
2168
2184
  return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
2169
2185
  }
@@ -2235,100 +2251,81 @@
2235
2251
  return { ...defaultBsPopperConfig,
2236
2252
  ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
2237
2253
  };
2238
- } // Static
2254
+ }
2239
2255
 
2256
+ _selectMenuItem({
2257
+ key,
2258
+ target
2259
+ }) {
2260
+ const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
2240
2261
 
2241
- static dropdownInterface(element, config) {
2242
- let data = Data.get(element, DATA_KEY$7);
2262
+ if (!items.length) {
2263
+ return;
2264
+ } // if target isn't included in items (e.g. when expanding the dropdown)
2265
+ // allow cycling to get the last item in case key equals ARROW_UP_KEY
2243
2266
 
2244
- const _config = typeof config === 'object' ? config : null;
2245
2267
 
2246
- if (!data) {
2247
- data = new Dropdown(element, _config);
2248
- }
2268
+ getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus();
2269
+ } // Static
2270
+
2271
+
2272
+ static jQueryInterface(config) {
2273
+ return this.each(function () {
2274
+ const data = Dropdown.getOrCreateInstance(this, config);
2275
+
2276
+ if (typeof config !== 'string') {
2277
+ return;
2278
+ }
2249
2279
 
2250
- if (typeof config === 'string') {
2251
2280
  if (typeof data[config] === 'undefined') {
2252
2281
  throw new TypeError(`No method named "${config}"`);
2253
2282
  }
2254
2283
 
2255
2284
  data[config]();
2256
- }
2257
- }
2258
-
2259
- static jQueryInterface(config) {
2260
- return this.each(function () {
2261
- Dropdown.dropdownInterface(this, config);
2262
2285
  });
2263
2286
  }
2264
2287
 
2265
2288
  static clearMenus(event) {
2266
- if (event) {
2267
- if (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY) {
2268
- return;
2269
- }
2270
-
2271
- if (/input|select|textarea|form/i.test(event.target.tagName)) {
2272
- return;
2273
- }
2289
+ if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1)) {
2290
+ return;
2274
2291
  }
2275
2292
 
2276
2293
  const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$3);
2277
2294
 
2278
2295
  for (let i = 0, len = toggles.length; i < len; i++) {
2279
- const context = Data.get(toggles[i], DATA_KEY$7);
2280
- const relatedTarget = {
2281
- relatedTarget: toggles[i]
2282
- };
2283
-
2284
- if (event && event.type === 'click') {
2285
- relatedTarget.clickEvent = event;
2286
- }
2296
+ const context = Dropdown.getInstance(toggles[i]);
2287
2297
 
2288
- if (!context) {
2298
+ if (!context || context._config.autoClose === false) {
2289
2299
  continue;
2290
2300
  }
2291
2301
 
2292
- const dropdownMenu = context._menu;
2293
-
2294
- if (!toggles[i].classList.contains(CLASS_NAME_SHOW$6)) {
2302
+ if (!context._isShown()) {
2295
2303
  continue;
2296
2304
  }
2297
2305
 
2306
+ const relatedTarget = {
2307
+ relatedTarget: context._element
2308
+ };
2309
+
2298
2310
  if (event) {
2299
- // Don't close the menu if the clicked element or one of its parents is the dropdown button
2300
- if ([context._element].some(element => event.composedPath().includes(element))) {
2311
+ const composedPath = event.composedPath();
2312
+ const isMenuTarget = composedPath.includes(context._menu);
2313
+
2314
+ if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) {
2301
2315
  continue;
2302
- } // Tab navigation through the dropdown menu shouldn't close the menu
2316
+ } // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
2303
2317
 
2304
2318
 
2305
- if (event.type === 'keyup' && event.key === TAB_KEY && dropdownMenu.contains(event.target)) {
2319
+ if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) {
2306
2320
  continue;
2307
2321
  }
2308
- }
2309
-
2310
- const hideEvent = EventHandler.trigger(toggles[i], EVENT_HIDE$4, relatedTarget);
2311
-
2312
- if (hideEvent.defaultPrevented) {
2313
- continue;
2314
- } // If this is a touch-enabled device we remove the extra
2315
- // empty mouseover listeners we added for iOS support
2316
-
2317
-
2318
- if ('ontouchstart' in document.documentElement) {
2319
- [].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', null, noop()));
2320
- }
2321
2322
 
2322
- toggles[i].setAttribute('aria-expanded', 'false');
2323
-
2324
- if (context._popper) {
2325
- context._popper.destroy();
2323
+ if (event.type === 'click') {
2324
+ relatedTarget.clickEvent = event;
2325
+ }
2326
2326
  }
2327
2327
 
2328
- dropdownMenu.classList.remove(CLASS_NAME_SHOW$6);
2329
- toggles[i].classList.remove(CLASS_NAME_SHOW$6);
2330
- Manipulator.removeDataAttribute(dropdownMenu, 'popper');
2331
- EventHandler.trigger(toggles[i], EVENT_HIDDEN$4, relatedTarget);
2328
+ context._completeHide(relatedTarget);
2332
2329
  }
2333
2330
  }
2334
2331
 
@@ -2348,54 +2345,40 @@
2348
2345
  return;
2349
2346
  }
2350
2347
 
2348
+ const isActive = this.classList.contains(CLASS_NAME_SHOW$6);
2349
+
2350
+ if (!isActive && event.key === ESCAPE_KEY$2) {
2351
+ return;
2352
+ }
2353
+
2351
2354
  event.preventDefault();
2352
2355
  event.stopPropagation();
2353
2356
 
2354
- if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED)) {
2357
+ if (isDisabled(this)) {
2355
2358
  return;
2356
2359
  }
2357
2360
 
2358
- const parent = Dropdown.getParentFromElement(this);
2359
- const isActive = this.classList.contains(CLASS_NAME_SHOW$6);
2361
+ const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
2362
+ const instance = Dropdown.getOrCreateInstance(getToggleButton);
2360
2363
 
2361
2364
  if (event.key === ESCAPE_KEY$2) {
2362
- const button = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
2363
- button.focus();
2364
- Dropdown.clearMenus();
2365
+ instance.hide();
2365
2366
  return;
2366
2367
  }
2367
2368
 
2368
- if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) {
2369
- const button = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
2370
- button.click();
2369
+ if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
2370
+ if (!isActive) {
2371
+ instance.show();
2372
+ }
2373
+
2374
+ instance._selectMenuItem(event);
2375
+
2371
2376
  return;
2372
2377
  }
2373
2378
 
2374
2379
  if (!isActive || event.key === SPACE_KEY) {
2375
2380
  Dropdown.clearMenus();
2376
- return;
2377
- }
2378
-
2379
- const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible);
2380
-
2381
- if (!items.length) {
2382
- return;
2383
2381
  }
2384
-
2385
- let index = items.indexOf(event.target); // Up
2386
-
2387
- if (event.key === ARROW_UP_KEY && index > 0) {
2388
- index--;
2389
- } // Down
2390
-
2391
-
2392
- if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
2393
- index++;
2394
- } // index is -1 if the first keydown is an ArrowUp
2395
-
2396
-
2397
- index = index === -1 ? 0 : index;
2398
- items[index].focus();
2399
2382
  }
2400
2383
 
2401
2384
  }
@@ -2412,7 +2395,7 @@
2412
2395
  EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
2413
2396
  EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) {
2414
2397
  event.preventDefault();
2415
- Dropdown.dropdownInterface(this);
2398
+ Dropdown.getOrCreateInstance(this).toggle();
2416
2399
  });
2417
2400
  /**
2418
2401
  * ------------------------------------------------------------------------
@@ -2421,26 +2404,357 @@
2421
2404
  * add .Dropdown to jQuery only if jQuery is present
2422
2405
  */
2423
2406
 
2424
- defineJQueryPlugin(NAME$7, Dropdown);
2407
+ defineJQueryPlugin(Dropdown);
2425
2408
 
2426
2409
  /**
2427
2410
  * --------------------------------------------------------------------------
2428
- * Bootstrap (v5.0.0-beta3): modal.js
2411
+ * Bootstrap (v5.1.0): util/scrollBar.js
2429
2412
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
2430
2413
  * --------------------------------------------------------------------------
2431
2414
  */
2432
- /**
2433
- * ------------------------------------------------------------------------
2434
- * Constants
2435
- * ------------------------------------------------------------------------
2436
- */
2415
+ const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
2416
+ const SELECTOR_STICKY_CONTENT = '.sticky-top';
2437
2417
 
2438
- const NAME$6 = 'modal';
2439
- const DATA_KEY$6 = 'bs.modal';
2440
- const EVENT_KEY$6 = `.${DATA_KEY$6}`;
2441
- const DATA_API_KEY$3 = '.data-api';
2442
- const ESCAPE_KEY$1 = 'Escape';
2443
- const Default$5 = {
2418
+ class ScrollBarHelper {
2419
+ constructor() {
2420
+ this._element = document.body;
2421
+ }
2422
+
2423
+ getWidth() {
2424
+ // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
2425
+ const documentWidth = document.documentElement.clientWidth;
2426
+ return Math.abs(window.innerWidth - documentWidth);
2427
+ }
2428
+
2429
+ hide() {
2430
+ const width = this.getWidth();
2431
+
2432
+ this._disableOverFlow(); // give padding to element to balance the hidden scrollbar width
2433
+
2434
+
2435
+ this._setElementAttributes(this._element, 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
2436
+
2437
+
2438
+ this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
2439
+
2440
+ this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
2441
+ }
2442
+
2443
+ _disableOverFlow() {
2444
+ this._saveInitialAttribute(this._element, 'overflow');
2445
+
2446
+ this._element.style.overflow = 'hidden';
2447
+ }
2448
+
2449
+ _setElementAttributes(selector, styleProp, callback) {
2450
+ const scrollbarWidth = this.getWidth();
2451
+
2452
+ const manipulationCallBack = element => {
2453
+ if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
2454
+ return;
2455
+ }
2456
+
2457
+ this._saveInitialAttribute(element, styleProp);
2458
+
2459
+ const calculatedValue = window.getComputedStyle(element)[styleProp];
2460
+ element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
2461
+ };
2462
+
2463
+ this._applyManipulationCallback(selector, manipulationCallBack);
2464
+ }
2465
+
2466
+ reset() {
2467
+ this._resetElementAttributes(this._element, 'overflow');
2468
+
2469
+ this._resetElementAttributes(this._element, 'paddingRight');
2470
+
2471
+ this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
2472
+
2473
+ this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
2474
+ }
2475
+
2476
+ _saveInitialAttribute(element, styleProp) {
2477
+ const actualValue = element.style[styleProp];
2478
+
2479
+ if (actualValue) {
2480
+ Manipulator.setDataAttribute(element, styleProp, actualValue);
2481
+ }
2482
+ }
2483
+
2484
+ _resetElementAttributes(selector, styleProp) {
2485
+ const manipulationCallBack = element => {
2486
+ const value = Manipulator.getDataAttribute(element, styleProp);
2487
+
2488
+ if (typeof value === 'undefined') {
2489
+ element.style.removeProperty(styleProp);
2490
+ } else {
2491
+ Manipulator.removeDataAttribute(element, styleProp);
2492
+ element.style[styleProp] = value;
2493
+ }
2494
+ };
2495
+
2496
+ this._applyManipulationCallback(selector, manipulationCallBack);
2497
+ }
2498
+
2499
+ _applyManipulationCallback(selector, callBack) {
2500
+ if (isElement(selector)) {
2501
+ callBack(selector);
2502
+ } else {
2503
+ SelectorEngine.find(selector, this._element).forEach(callBack);
2504
+ }
2505
+ }
2506
+
2507
+ isOverflowing() {
2508
+ return this.getWidth() > 0;
2509
+ }
2510
+
2511
+ }
2512
+
2513
+ /**
2514
+ * --------------------------------------------------------------------------
2515
+ * Bootstrap (v5.1.0): util/backdrop.js
2516
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
2517
+ * --------------------------------------------------------------------------
2518
+ */
2519
+ const Default$7 = {
2520
+ className: 'modal-backdrop',
2521
+ isVisible: true,
2522
+ // if false, we use the backdrop helper without adding any element to the dom
2523
+ isAnimated: false,
2524
+ rootElement: 'body',
2525
+ // give the choice to place backdrop under different elements
2526
+ clickCallback: null
2527
+ };
2528
+ const DefaultType$7 = {
2529
+ className: 'string',
2530
+ isVisible: 'boolean',
2531
+ isAnimated: 'boolean',
2532
+ rootElement: '(element|string)',
2533
+ clickCallback: '(function|null)'
2534
+ };
2535
+ const NAME$8 = 'backdrop';
2536
+ const CLASS_NAME_FADE$4 = 'fade';
2537
+ const CLASS_NAME_SHOW$5 = 'show';
2538
+ const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$8}`;
2539
+
2540
+ class Backdrop {
2541
+ constructor(config) {
2542
+ this._config = this._getConfig(config);
2543
+ this._isAppended = false;
2544
+ this._element = null;
2545
+ }
2546
+
2547
+ show(callback) {
2548
+ if (!this._config.isVisible) {
2549
+ execute(callback);
2550
+ return;
2551
+ }
2552
+
2553
+ this._append();
2554
+
2555
+ if (this._config.isAnimated) {
2556
+ reflow(this._getElement());
2557
+ }
2558
+
2559
+ this._getElement().classList.add(CLASS_NAME_SHOW$5);
2560
+
2561
+ this._emulateAnimation(() => {
2562
+ execute(callback);
2563
+ });
2564
+ }
2565
+
2566
+ hide(callback) {
2567
+ if (!this._config.isVisible) {
2568
+ execute(callback);
2569
+ return;
2570
+ }
2571
+
2572
+ this._getElement().classList.remove(CLASS_NAME_SHOW$5);
2573
+
2574
+ this._emulateAnimation(() => {
2575
+ this.dispose();
2576
+ execute(callback);
2577
+ });
2578
+ } // Private
2579
+
2580
+
2581
+ _getElement() {
2582
+ if (!this._element) {
2583
+ const backdrop = document.createElement('div');
2584
+ backdrop.className = this._config.className;
2585
+
2586
+ if (this._config.isAnimated) {
2587
+ backdrop.classList.add(CLASS_NAME_FADE$4);
2588
+ }
2589
+
2590
+ this._element = backdrop;
2591
+ }
2592
+
2593
+ return this._element;
2594
+ }
2595
+
2596
+ _getConfig(config) {
2597
+ config = { ...Default$7,
2598
+ ...(typeof config === 'object' ? config : {})
2599
+ }; // use getElement() with the default "body" to get a fresh Element on each instantiation
2600
+
2601
+ config.rootElement = getElement(config.rootElement);
2602
+ typeCheckConfig(NAME$8, config, DefaultType$7);
2603
+ return config;
2604
+ }
2605
+
2606
+ _append() {
2607
+ if (this._isAppended) {
2608
+ return;
2609
+ }
2610
+
2611
+ this._config.rootElement.append(this._getElement());
2612
+
2613
+ EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
2614
+ execute(this._config.clickCallback);
2615
+ });
2616
+ this._isAppended = true;
2617
+ }
2618
+
2619
+ dispose() {
2620
+ if (!this._isAppended) {
2621
+ return;
2622
+ }
2623
+
2624
+ EventHandler.off(this._element, EVENT_MOUSEDOWN);
2625
+
2626
+ this._element.remove();
2627
+
2628
+ this._isAppended = false;
2629
+ }
2630
+
2631
+ _emulateAnimation(callback) {
2632
+ executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
2633
+ }
2634
+
2635
+ }
2636
+
2637
+ /**
2638
+ * --------------------------------------------------------------------------
2639
+ * Bootstrap (v5.1.0): util/focustrap.js
2640
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
2641
+ * --------------------------------------------------------------------------
2642
+ */
2643
+ const Default$6 = {
2644
+ trapElement: null,
2645
+ // The element to trap focus inside of
2646
+ autofocus: true
2647
+ };
2648
+ const DefaultType$6 = {
2649
+ trapElement: 'element',
2650
+ autofocus: 'boolean'
2651
+ };
2652
+ const NAME$7 = 'focustrap';
2653
+ const DATA_KEY$7 = 'bs.focustrap';
2654
+ const EVENT_KEY$7 = `.${DATA_KEY$7}`;
2655
+ const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$7}`;
2656
+ const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$7}`;
2657
+ const TAB_KEY = 'Tab';
2658
+ const TAB_NAV_FORWARD = 'forward';
2659
+ const TAB_NAV_BACKWARD = 'backward';
2660
+
2661
+ class FocusTrap {
2662
+ constructor(config) {
2663
+ this._config = this._getConfig(config);
2664
+ this._isActive = false;
2665
+ this._lastTabNavDirection = null;
2666
+ }
2667
+
2668
+ activate() {
2669
+ const {
2670
+ trapElement,
2671
+ autofocus
2672
+ } = this._config;
2673
+
2674
+ if (this._isActive) {
2675
+ return;
2676
+ }
2677
+
2678
+ if (autofocus) {
2679
+ trapElement.focus();
2680
+ }
2681
+
2682
+ EventHandler.off(document, EVENT_KEY$7); // guard against infinite focus loop
2683
+
2684
+ EventHandler.on(document, EVENT_FOCUSIN$1, event => this._handleFocusin(event));
2685
+ EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
2686
+ this._isActive = true;
2687
+ }
2688
+
2689
+ deactivate() {
2690
+ if (!this._isActive) {
2691
+ return;
2692
+ }
2693
+
2694
+ this._isActive = false;
2695
+ EventHandler.off(document, EVENT_KEY$7);
2696
+ } // Private
2697
+
2698
+
2699
+ _handleFocusin(event) {
2700
+ const {
2701
+ target
2702
+ } = event;
2703
+ const {
2704
+ trapElement
2705
+ } = this._config;
2706
+
2707
+ if (target === document || target === trapElement || trapElement.contains(target)) {
2708
+ return;
2709
+ }
2710
+
2711
+ const elements = SelectorEngine.focusableChildren(trapElement);
2712
+
2713
+ if (elements.length === 0) {
2714
+ trapElement.focus();
2715
+ } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
2716
+ elements[elements.length - 1].focus();
2717
+ } else {
2718
+ elements[0].focus();
2719
+ }
2720
+ }
2721
+
2722
+ _handleKeydown(event) {
2723
+ if (event.key !== TAB_KEY) {
2724
+ return;
2725
+ }
2726
+
2727
+ this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
2728
+ }
2729
+
2730
+ _getConfig(config) {
2731
+ config = { ...Default$6,
2732
+ ...(typeof config === 'object' ? config : {})
2733
+ };
2734
+ typeCheckConfig(NAME$7, config, DefaultType$6);
2735
+ return config;
2736
+ }
2737
+
2738
+ }
2739
+
2740
+ /**
2741
+ * --------------------------------------------------------------------------
2742
+ * Bootstrap (v5.1.0): modal.js
2743
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
2744
+ * --------------------------------------------------------------------------
2745
+ */
2746
+ /**
2747
+ * ------------------------------------------------------------------------
2748
+ * Constants
2749
+ * ------------------------------------------------------------------------
2750
+ */
2751
+
2752
+ const NAME$6 = 'modal';
2753
+ const DATA_KEY$6 = 'bs.modal';
2754
+ const EVENT_KEY$6 = `.${DATA_KEY$6}`;
2755
+ const DATA_API_KEY$3 = '.data-api';
2756
+ const ESCAPE_KEY$1 = 'Escape';
2757
+ const Default$5 = {
2444
2758
  backdrop: true,
2445
2759
  keyboard: true,
2446
2760
  focus: true
@@ -2455,25 +2769,19 @@
2455
2769
  const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`;
2456
2770
  const EVENT_SHOW$3 = `show${EVENT_KEY$6}`;
2457
2771
  const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`;
2458
- const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$6}`;
2459
2772
  const EVENT_RESIZE = `resize${EVENT_KEY$6}`;
2460
- const EVENT_CLICK_DISMISS$2 = `click.dismiss${EVENT_KEY$6}`;
2461
- const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$6}`;
2773
+ const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$6}`;
2774
+ const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`;
2462
2775
  const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`;
2463
2776
  const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`;
2464
2777
  const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
2465
- const CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
2466
- const CLASS_NAME_BACKDROP = 'modal-backdrop';
2467
2778
  const CLASS_NAME_OPEN = 'modal-open';
2468
- const CLASS_NAME_FADE$4 = 'fade';
2469
- const CLASS_NAME_SHOW$5 = 'show';
2779
+ const CLASS_NAME_FADE$3 = 'fade';
2780
+ const CLASS_NAME_SHOW$4 = 'show';
2470
2781
  const CLASS_NAME_STATIC = 'modal-static';
2471
2782
  const SELECTOR_DIALOG = '.modal-dialog';
2472
2783
  const SELECTOR_MODAL_BODY = '.modal-body';
2473
2784
  const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
2474
- const SELECTOR_DATA_DISMISS$2 = '[data-bs-dismiss="modal"]';
2475
- const SELECTOR_FIXED_CONTENT$1 = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
2476
- const SELECTOR_STICKY_CONTENT$1 = '.sticky-top';
2477
2785
  /**
2478
2786
  * ------------------------------------------------------------------------
2479
2787
  * Class Definition
@@ -2485,12 +2793,12 @@
2485
2793
  super(element);
2486
2794
  this._config = this._getConfig(config);
2487
2795
  this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
2488
- this._backdrop = null;
2796
+ this._backdrop = this._initializeBackDrop();
2797
+ this._focustrap = this._initializeFocusTrap();
2489
2798
  this._isShown = false;
2490
- this._isBodyOverflowing = false;
2491
2799
  this._ignoreBackdropClick = false;
2492
2800
  this._isTransitioning = false;
2493
- this._scrollbarWidth = 0;
2801
+ this._scrollBar = new ScrollBarHelper();
2494
2802
  } // Getters
2495
2803
 
2496
2804
 
@@ -2498,8 +2806,8 @@
2498
2806
  return Default$5;
2499
2807
  }
2500
2808
 
2501
- static get DATA_KEY() {
2502
- return DATA_KEY$6;
2809
+ static get NAME() {
2810
+ return NAME$6;
2503
2811
  } // Public
2504
2812
 
2505
2813
 
@@ -2512,23 +2820,23 @@
2512
2820
  return;
2513
2821
  }
2514
2822
 
2515
- if (this._isAnimated()) {
2516
- this._isTransitioning = true;
2517
- }
2518
-
2519
2823
  const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
2520
2824
  relatedTarget
2521
2825
  });
2522
2826
 
2523
- if (this._isShown || showEvent.defaultPrevented) {
2827
+ if (showEvent.defaultPrevented) {
2524
2828
  return;
2525
2829
  }
2526
2830
 
2527
2831
  this._isShown = true;
2528
2832
 
2529
- this._checkScrollbar();
2833
+ if (this._isAnimated()) {
2834
+ this._isTransitioning = true;
2835
+ }
2836
+
2837
+ this._scrollBar.hide();
2530
2838
 
2531
- this._setScrollbar();
2839
+ document.body.classList.add(CLASS_NAME_OPEN);
2532
2840
 
2533
2841
  this._adjustDialog();
2534
2842
 
@@ -2536,7 +2844,6 @@
2536
2844
 
2537
2845
  this._setResizeEvent();
2538
2846
 
2539
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, SELECTOR_DATA_DISMISS$2, event => this.hide(event));
2540
2847
  EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
2541
2848
  EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
2542
2849
  if (event.target === this._element) {
@@ -2548,11 +2855,7 @@
2548
2855
  this._showBackdrop(() => this._showElement(relatedTarget));
2549
2856
  }
2550
2857
 
2551
- hide(event) {
2552
- if (event) {
2553
- event.preventDefault();
2554
- }
2555
-
2858
+ hide() {
2556
2859
  if (!this._isShown || this._isTransitioning) {
2557
2860
  return;
2558
2861
  }
@@ -2575,40 +2878,24 @@
2575
2878
 
2576
2879
  this._setResizeEvent();
2577
2880
 
2578
- EventHandler.off(document, EVENT_FOCUSIN$1);
2881
+ this._focustrap.deactivate();
2579
2882
 
2580
- this._element.classList.remove(CLASS_NAME_SHOW$5);
2883
+ this._element.classList.remove(CLASS_NAME_SHOW$4);
2581
2884
 
2582
- EventHandler.off(this._element, EVENT_CLICK_DISMISS$2);
2885
+ EventHandler.off(this._element, EVENT_CLICK_DISMISS);
2583
2886
  EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
2584
2887
 
2585
- if (isAnimated) {
2586
- const transitionDuration = getTransitionDurationFromElement(this._element);
2587
- EventHandler.one(this._element, 'transitionend', event => this._hideModal(event));
2588
- emulateTransitionEnd(this._element, transitionDuration);
2589
- } else {
2590
- this._hideModal();
2591
- }
2888
+ this._queueCallback(() => this._hideModal(), this._element, isAnimated);
2592
2889
  }
2593
2890
 
2594
2891
  dispose() {
2595
- [window, this._element, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6));
2892
+ [window, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6));
2893
+
2894
+ this._backdrop.dispose();
2895
+
2896
+ this._focustrap.deactivate();
2897
+
2596
2898
  super.dispose();
2597
- /**
2598
- * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
2599
- * Do not move `document` in `htmlElements` array
2600
- * It will remove `EVENT_CLICK_DATA_API` event that should remain
2601
- */
2602
-
2603
- EventHandler.off(document, EVENT_FOCUSIN$1);
2604
- this._config = null;
2605
- this._dialog = null;
2606
- this._backdrop = null;
2607
- this._isShown = null;
2608
- this._isBodyOverflowing = null;
2609
- this._ignoreBackdropClick = null;
2610
- this._isTransitioning = null;
2611
- this._scrollbarWidth = null;
2612
2899
  }
2613
2900
 
2614
2901
  handleUpdate() {
@@ -2616,9 +2903,24 @@
2616
2903
  } // Private
2617
2904
 
2618
2905
 
2906
+ _initializeBackDrop() {
2907
+ return new Backdrop({
2908
+ isVisible: Boolean(this._config.backdrop),
2909
+ // 'static' option will be translated to true, and booleans will keep their value
2910
+ isAnimated: this._isAnimated()
2911
+ });
2912
+ }
2913
+
2914
+ _initializeFocusTrap() {
2915
+ return new FocusTrap({
2916
+ trapElement: this._element
2917
+ });
2918
+ }
2919
+
2619
2920
  _getConfig(config) {
2620
2921
  config = { ...Default$5,
2621
- ...config
2922
+ ...Manipulator.getDataAttributes(this._element),
2923
+ ...(typeof config === 'object' ? config : {})
2622
2924
  };
2623
2925
  typeCheckConfig(NAME$6, config, DefaultType$5);
2624
2926
  return config;
@@ -2631,7 +2933,7 @@
2631
2933
 
2632
2934
  if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
2633
2935
  // Don't move modal's DOM position
2634
- document.body.appendChild(this._element);
2936
+ document.body.append(this._element);
2635
2937
  }
2636
2938
 
2637
2939
  this._element.style.display = 'block';
@@ -2652,15 +2954,11 @@
2652
2954
  reflow(this._element);
2653
2955
  }
2654
2956
 
2655
- this._element.classList.add(CLASS_NAME_SHOW$5);
2656
-
2657
- if (this._config.focus) {
2658
- this._enforceFocus();
2659
- }
2957
+ this._element.classList.add(CLASS_NAME_SHOW$4);
2660
2958
 
2661
2959
  const transitionComplete = () => {
2662
2960
  if (this._config.focus) {
2663
- this._element.focus();
2961
+ this._focustrap.activate();
2664
2962
  }
2665
2963
 
2666
2964
  this._isTransitioning = false;
@@ -2669,28 +2967,12 @@
2669
2967
  });
2670
2968
  };
2671
2969
 
2672
- if (isAnimated) {
2673
- const transitionDuration = getTransitionDurationFromElement(this._dialog);
2674
- EventHandler.one(this._dialog, 'transitionend', transitionComplete);
2675
- emulateTransitionEnd(this._dialog, transitionDuration);
2676
- } else {
2677
- transitionComplete();
2678
- }
2679
- }
2680
-
2681
- _enforceFocus() {
2682
- EventHandler.off(document, EVENT_FOCUSIN$1); // guard against infinite focus loop
2683
-
2684
- EventHandler.on(document, EVENT_FOCUSIN$1, event => {
2685
- if (document !== event.target && this._element !== event.target && !this._element.contains(event.target)) {
2686
- this._element.focus();
2687
- }
2688
- });
2970
+ this._queueCallback(transitionComplete, this._dialog, isAnimated);
2689
2971
  }
2690
2972
 
2691
2973
  _setEscapeEvent() {
2692
2974
  if (this._isShown) {
2693
- EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
2975
+ EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
2694
2976
  if (this._config.keyboard && event.key === ESCAPE_KEY$1) {
2695
2977
  event.preventDefault();
2696
2978
  this.hide();
@@ -2699,7 +2981,7 @@
2699
2981
  }
2700
2982
  });
2701
2983
  } else {
2702
- EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS);
2984
+ EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS$1);
2703
2985
  }
2704
2986
  }
2705
2987
 
@@ -2722,89 +3004,40 @@
2722
3004
 
2723
3005
  this._isTransitioning = false;
2724
3006
 
2725
- this._showBackdrop(() => {
3007
+ this._backdrop.hide(() => {
2726
3008
  document.body.classList.remove(CLASS_NAME_OPEN);
2727
3009
 
2728
3010
  this._resetAdjustments();
2729
3011
 
2730
- this._resetScrollbar();
3012
+ this._scrollBar.reset();
2731
3013
 
2732
3014
  EventHandler.trigger(this._element, EVENT_HIDDEN$3);
2733
3015
  });
2734
3016
  }
2735
3017
 
2736
- _removeBackdrop() {
2737
- this._backdrop.parentNode.removeChild(this._backdrop);
2738
-
2739
- this._backdrop = null;
2740
- }
2741
-
2742
3018
  _showBackdrop(callback) {
2743
- const isAnimated = this._isAnimated();
2744
-
2745
- if (this._isShown && this._config.backdrop) {
2746
- this._backdrop = document.createElement('div');
2747
- this._backdrop.className = CLASS_NAME_BACKDROP;
2748
-
2749
- if (isAnimated) {
2750
- this._backdrop.classList.add(CLASS_NAME_FADE$4);
2751
- }
2752
-
2753
- document.body.appendChild(this._backdrop);
2754
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, event => {
2755
- if (this._ignoreBackdropClick) {
2756
- this._ignoreBackdropClick = false;
2757
- return;
2758
- }
2759
-
2760
- if (event.target !== event.currentTarget) {
2761
- return;
2762
- }
2763
-
2764
- if (this._config.backdrop === 'static') {
2765
- this._triggerBackdropTransition();
2766
- } else {
2767
- this.hide();
2768
- }
2769
- });
2770
-
2771
- if (isAnimated) {
2772
- reflow(this._backdrop);
3019
+ EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => {
3020
+ if (this._ignoreBackdropClick) {
3021
+ this._ignoreBackdropClick = false;
3022
+ return;
2773
3023
  }
2774
3024
 
2775
- this._backdrop.classList.add(CLASS_NAME_SHOW$5);
2776
-
2777
- if (!isAnimated) {
2778
- callback();
3025
+ if (event.target !== event.currentTarget) {
2779
3026
  return;
2780
3027
  }
2781
3028
 
2782
- const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
2783
- EventHandler.one(this._backdrop, 'transitionend', callback);
2784
- emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
2785
- } else if (!this._isShown && this._backdrop) {
2786
- this._backdrop.classList.remove(CLASS_NAME_SHOW$5);
2787
-
2788
- const callbackRemove = () => {
2789
- this._removeBackdrop();
2790
-
2791
- callback();
2792
- };
2793
-
2794
- if (isAnimated) {
2795
- const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
2796
- EventHandler.one(this._backdrop, 'transitionend', callbackRemove);
2797
- emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
2798
- } else {
2799
- callbackRemove();
3029
+ if (this._config.backdrop === true) {
3030
+ this.hide();
3031
+ } else if (this._config.backdrop === 'static') {
3032
+ this._triggerBackdropTransition();
2800
3033
  }
2801
- } else {
2802
- callback();
2803
- }
3034
+ });
3035
+
3036
+ this._backdrop.show(callback);
2804
3037
  }
2805
3038
 
2806
3039
  _isAnimated() {
2807
- return this._element.classList.contains(CLASS_NAME_FADE$4);
3040
+ return this._element.classList.contains(CLASS_NAME_FADE$3);
2808
3041
  }
2809
3042
 
2810
3043
  _triggerBackdropTransition() {
@@ -2814,27 +3047,32 @@
2814
3047
  return;
2815
3048
  }
2816
3049
 
2817
- const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
3050
+ const {
3051
+ classList,
3052
+ scrollHeight,
3053
+ style
3054
+ } = this._element;
3055
+ const isModalOverflowing = scrollHeight > document.documentElement.clientHeight; // return if the following background transition hasn't yet completed
3056
+
3057
+ if (!isModalOverflowing && style.overflowY === 'hidden' || classList.contains(CLASS_NAME_STATIC)) {
3058
+ return;
3059
+ }
2818
3060
 
2819
3061
  if (!isModalOverflowing) {
2820
- this._element.style.overflowY = 'hidden';
3062
+ style.overflowY = 'hidden';
2821
3063
  }
2822
3064
 
2823
- this._element.classList.add(CLASS_NAME_STATIC);
3065
+ classList.add(CLASS_NAME_STATIC);
2824
3066
 
2825
- const modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
2826
- EventHandler.off(this._element, 'transitionend');
2827
- EventHandler.one(this._element, 'transitionend', () => {
2828
- this._element.classList.remove(CLASS_NAME_STATIC);
3067
+ this._queueCallback(() => {
3068
+ classList.remove(CLASS_NAME_STATIC);
2829
3069
 
2830
3070
  if (!isModalOverflowing) {
2831
- EventHandler.one(this._element, 'transitionend', () => {
2832
- this._element.style.overflowY = '';
2833
- });
2834
- emulateTransitionEnd(this._element, modalTransitionDuration);
3071
+ this._queueCallback(() => {
3072
+ style.overflowY = '';
3073
+ }, this._dialog);
2835
3074
  }
2836
- });
2837
- emulateTransitionEnd(this._element, modalTransitionDuration);
3075
+ }, this._dialog);
2838
3076
 
2839
3077
  this._element.focus();
2840
3078
  } // ----------------------------------------------------------------------
@@ -2845,102 +3083,38 @@
2845
3083
  _adjustDialog() {
2846
3084
  const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
2847
3085
 
2848
- if (!this._isBodyOverflowing && isModalOverflowing && !isRTL() || this._isBodyOverflowing && !isModalOverflowing && isRTL()) {
2849
- this._element.style.paddingLeft = `${this._scrollbarWidth}px`;
3086
+ const scrollbarWidth = this._scrollBar.getWidth();
3087
+
3088
+ const isBodyOverflowing = scrollbarWidth > 0;
3089
+
3090
+ if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) {
3091
+ this._element.style.paddingLeft = `${scrollbarWidth}px`;
2850
3092
  }
2851
3093
 
2852
- if (this._isBodyOverflowing && !isModalOverflowing && !isRTL() || !this._isBodyOverflowing && isModalOverflowing && isRTL()) {
2853
- this._element.style.paddingRight = `${this._scrollbarWidth}px`;
3094
+ if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) {
3095
+ this._element.style.paddingRight = `${scrollbarWidth}px`;
2854
3096
  }
2855
3097
  }
2856
3098
 
2857
3099
  _resetAdjustments() {
2858
3100
  this._element.style.paddingLeft = '';
2859
3101
  this._element.style.paddingRight = '';
2860
- }
2861
-
2862
- _checkScrollbar() {
2863
- const rect = document.body.getBoundingClientRect();
2864
- this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
2865
- this._scrollbarWidth = this._getScrollbarWidth();
2866
- }
2867
-
2868
- _setScrollbar() {
2869
- if (this._isBodyOverflowing) {
2870
- this._setElementAttributes(SELECTOR_FIXED_CONTENT$1, 'paddingRight', calculatedValue => calculatedValue + this._scrollbarWidth);
2871
-
2872
- this._setElementAttributes(SELECTOR_STICKY_CONTENT$1, 'marginRight', calculatedValue => calculatedValue - this._scrollbarWidth);
2873
-
2874
- this._setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + this._scrollbarWidth);
2875
- }
2876
-
2877
- document.body.classList.add(CLASS_NAME_OPEN);
2878
- }
2879
-
2880
- _setElementAttributes(selector, styleProp, callback) {
2881
- SelectorEngine.find(selector).forEach(element => {
2882
- if (element !== document.body && window.innerWidth > element.clientWidth + this._scrollbarWidth) {
2883
- return;
2884
- }
2885
-
2886
- const actualValue = element.style[styleProp];
2887
- const calculatedValue = window.getComputedStyle(element)[styleProp];
2888
- Manipulator.setDataAttribute(element, styleProp, actualValue);
2889
- element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
2890
- });
2891
- }
2892
-
2893
- _resetScrollbar() {
2894
- this._resetElementAttributes(SELECTOR_FIXED_CONTENT$1, 'paddingRight');
2895
-
2896
- this._resetElementAttributes(SELECTOR_STICKY_CONTENT$1, 'marginRight');
2897
-
2898
- this._resetElementAttributes('body', 'paddingRight');
2899
- }
2900
-
2901
- _resetElementAttributes(selector, styleProp) {
2902
- SelectorEngine.find(selector).forEach(element => {
2903
- const value = Manipulator.getDataAttribute(element, styleProp);
2904
-
2905
- if (typeof value === 'undefined' && element === document.body) {
2906
- element.style[styleProp] = '';
2907
- } else {
2908
- Manipulator.removeDataAttribute(element, styleProp);
2909
- element.style[styleProp] = value;
2910
- }
2911
- });
2912
- }
2913
-
2914
- _getScrollbarWidth() {
2915
- // thx d.walsh
2916
- const scrollDiv = document.createElement('div');
2917
- scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
2918
- document.body.appendChild(scrollDiv);
2919
- const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
2920
- document.body.removeChild(scrollDiv);
2921
- return scrollbarWidth;
2922
3102
  } // Static
2923
3103
 
2924
3104
 
2925
3105
  static jQueryInterface(config, relatedTarget) {
2926
3106
  return this.each(function () {
2927
- let data = Data.get(this, DATA_KEY$6);
2928
- const _config = { ...Default$5,
2929
- ...Manipulator.getDataAttributes(this),
2930
- ...(typeof config === 'object' && config ? config : {})
2931
- };
3107
+ const data = Modal.getOrCreateInstance(this, config);
2932
3108
 
2933
- if (!data) {
2934
- data = new Modal(this, _config);
3109
+ if (typeof config !== 'string') {
3110
+ return;
2935
3111
  }
2936
3112
 
2937
- if (typeof config === 'string') {
2938
- if (typeof data[config] === 'undefined') {
2939
- throw new TypeError(`No method named "${config}"`);
2940
- }
2941
-
2942
- data[config](relatedTarget);
3113
+ if (typeof data[config] === 'undefined') {
3114
+ throw new TypeError(`No method named "${config}"`);
2943
3115
  }
3116
+
3117
+ data[config](relatedTarget);
2944
3118
  });
2945
3119
  }
2946
3120
 
@@ -2955,7 +3129,7 @@
2955
3129
  EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) {
2956
3130
  const target = getElementFromSelector(this);
2957
3131
 
2958
- if (this.tagName === 'A' || this.tagName === 'AREA') {
3132
+ if (['A', 'AREA'].includes(this.tagName)) {
2959
3133
  event.preventDefault();
2960
3134
  }
2961
3135
 
@@ -2971,17 +3145,10 @@
2971
3145
  }
2972
3146
  });
2973
3147
  });
2974
- let data = Data.get(target, DATA_KEY$6);
2975
-
2976
- if (!data) {
2977
- const config = { ...Manipulator.getDataAttributes(target),
2978
- ...Manipulator.getDataAttributes(this)
2979
- };
2980
- data = new Modal(target, config);
2981
- }
2982
-
3148
+ const data = Modal.getOrCreateInstance(target);
2983
3149
  data.toggle(this);
2984
3150
  });
3151
+ enableDismissTrigger(Modal);
2985
3152
  /**
2986
3153
  * ------------------------------------------------------------------------
2987
3154
  * jQuery
@@ -2989,73 +3156,11 @@
2989
3156
  * add .Modal to jQuery only if jQuery is present
2990
3157
  */
2991
3158
 
2992
- defineJQueryPlugin(NAME$6, Modal);
3159
+ defineJQueryPlugin(Modal);
2993
3160
 
2994
3161
  /**
2995
3162
  * --------------------------------------------------------------------------
2996
- * Bootstrap (v5.0.0-beta3): util/scrollBar.js
2997
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
2998
- * --------------------------------------------------------------------------
2999
- */
3000
- const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed';
3001
- const SELECTOR_STICKY_CONTENT = '.sticky-top';
3002
-
3003
- const getWidth = () => {
3004
- // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
3005
- const documentWidth = document.documentElement.clientWidth;
3006
- return Math.abs(window.innerWidth - documentWidth);
3007
- };
3008
-
3009
- const hide = (width = getWidth()) => {
3010
- document.body.style.overflow = 'hidden';
3011
-
3012
- _setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
3013
-
3014
- _setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
3015
-
3016
- _setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + width);
3017
- };
3018
-
3019
- const _setElementAttributes = (selector, styleProp, callback) => {
3020
- const scrollbarWidth = getWidth();
3021
- SelectorEngine.find(selector).forEach(element => {
3022
- if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) {
3023
- return;
3024
- }
3025
-
3026
- const actualValue = element.style[styleProp];
3027
- const calculatedValue = window.getComputedStyle(element)[styleProp];
3028
- Manipulator.setDataAttribute(element, styleProp, actualValue);
3029
- element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
3030
- });
3031
- };
3032
-
3033
- const reset = () => {
3034
- document.body.style.overflow = 'auto';
3035
-
3036
- _resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
3037
-
3038
- _resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
3039
-
3040
- _resetElementAttributes('body', 'paddingRight');
3041
- };
3042
-
3043
- const _resetElementAttributes = (selector, styleProp) => {
3044
- SelectorEngine.find(selector).forEach(element => {
3045
- const value = Manipulator.getDataAttribute(element, styleProp);
3046
-
3047
- if (typeof value === 'undefined' && element === document.body) {
3048
- element.style.removeProperty(styleProp);
3049
- } else {
3050
- Manipulator.removeDataAttribute(element, styleProp);
3051
- element.style[styleProp] = value;
3052
- }
3053
- });
3054
- };
3055
-
3056
- /**
3057
- * --------------------------------------------------------------------------
3058
- * Bootstrap (v5.0.0-beta3): offcanvas.js
3163
+ * Bootstrap (v5.1.0): offcanvas.js
3059
3164
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
3060
3165
  * --------------------------------------------------------------------------
3061
3166
  */
@@ -3081,19 +3186,15 @@
3081
3186
  keyboard: 'boolean',
3082
3187
  scroll: 'boolean'
3083
3188
  };
3084
- const CLASS_NAME_BACKDROP_BODY = 'offcanvas-backdrop';
3085
- const CLASS_NAME_SHOW$4 = 'show';
3086
- const CLASS_NAME_TOGGLING = 'offcanvas-toggling';
3189
+ const CLASS_NAME_SHOW$3 = 'show';
3190
+ const CLASS_NAME_BACKDROP = 'offcanvas-backdrop';
3087
3191
  const OPEN_SELECTOR = '.offcanvas.show';
3088
- const ACTIVE_SELECTOR = `${OPEN_SELECTOR}, .${CLASS_NAME_TOGGLING}`;
3089
3192
  const EVENT_SHOW$2 = `show${EVENT_KEY$5}`;
3090
3193
  const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`;
3091
3194
  const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`;
3092
3195
  const EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`;
3093
- const EVENT_FOCUSIN = `focusin${EVENT_KEY$5}`;
3094
3196
  const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`;
3095
- const EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$5}`;
3096
- const SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="offcanvas"]';
3197
+ const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`;
3097
3198
  const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
3098
3199
  /**
3099
3200
  * ------------------------------------------------------------------------
@@ -3106,17 +3207,19 @@
3106
3207
  super(element);
3107
3208
  this._config = this._getConfig(config);
3108
3209
  this._isShown = false;
3210
+ this._backdrop = this._initializeBackDrop();
3211
+ this._focustrap = this._initializeFocusTrap();
3109
3212
 
3110
3213
  this._addEventListeners();
3111
3214
  } // Getters
3112
3215
 
3113
3216
 
3114
- static get Default() {
3115
- return Default$4;
3217
+ static get NAME() {
3218
+ return NAME$5;
3116
3219
  }
3117
3220
 
3118
- static get DATA_KEY() {
3119
- return DATA_KEY$5;
3221
+ static get Default() {
3222
+ return Default$4;
3120
3223
  } // Public
3121
3224
 
3122
3225
 
@@ -3140,35 +3243,31 @@
3140
3243
  this._isShown = true;
3141
3244
  this._element.style.visibility = 'visible';
3142
3245
 
3143
- if (this._config.backdrop) {
3144
- document.body.classList.add(CLASS_NAME_BACKDROP_BODY);
3145
- }
3246
+ this._backdrop.show();
3146
3247
 
3147
3248
  if (!this._config.scroll) {
3148
- hide();
3249
+ new ScrollBarHelper().hide();
3149
3250
  }
3150
3251
 
3151
- this._element.classList.add(CLASS_NAME_TOGGLING);
3152
-
3153
3252
  this._element.removeAttribute('aria-hidden');
3154
3253
 
3155
3254
  this._element.setAttribute('aria-modal', true);
3156
3255
 
3157
3256
  this._element.setAttribute('role', 'dialog');
3158
3257
 
3159
- this._element.classList.add(CLASS_NAME_SHOW$4);
3258
+ this._element.classList.add(CLASS_NAME_SHOW$3);
3160
3259
 
3161
3260
  const completeCallBack = () => {
3162
- this._element.classList.remove(CLASS_NAME_TOGGLING);
3261
+ if (!this._config.scroll) {
3262
+ this._focustrap.activate();
3263
+ }
3163
3264
 
3164
3265
  EventHandler.trigger(this._element, EVENT_SHOWN$2, {
3165
3266
  relatedTarget
3166
3267
  });
3167
-
3168
- this._enforceFocusOnElement(this._element);
3169
3268
  };
3170
3269
 
3171
- setTimeout(completeCallBack, getTransitionDurationFromElement(this._element));
3270
+ this._queueCallback(completeCallBack, this._element, true);
3172
3271
  }
3173
3272
 
3174
3273
  hide() {
@@ -3182,15 +3281,15 @@
3182
3281
  return;
3183
3282
  }
3184
3283
 
3185
- this._element.classList.add(CLASS_NAME_TOGGLING);
3186
-
3187
- EventHandler.off(document, EVENT_FOCUSIN);
3284
+ this._focustrap.deactivate();
3188
3285
 
3189
3286
  this._element.blur();
3190
3287
 
3191
3288
  this._isShown = false;
3192
3289
 
3193
- this._element.classList.remove(CLASS_NAME_SHOW$4);
3290
+ this._element.classList.remove(CLASS_NAME_SHOW$3);
3291
+
3292
+ this._backdrop.hide();
3194
3293
 
3195
3294
  const completeCallback = () => {
3196
3295
  this._element.setAttribute('aria-hidden', true);
@@ -3201,20 +3300,22 @@
3201
3300
 
3202
3301
  this._element.style.visibility = 'hidden';
3203
3302
 
3204
- if (this._config.backdrop) {
3205
- document.body.classList.remove(CLASS_NAME_BACKDROP_BODY);
3206
- }
3207
-
3208
3303
  if (!this._config.scroll) {
3209
- reset();
3304
+ new ScrollBarHelper().reset();
3210
3305
  }
3211
3306
 
3212
3307
  EventHandler.trigger(this._element, EVENT_HIDDEN$2);
3213
-
3214
- this._element.classList.remove(CLASS_NAME_TOGGLING);
3215
3308
  };
3216
3309
 
3217
- setTimeout(completeCallback, getTransitionDurationFromElement(this._element));
3310
+ this._queueCallback(completeCallback, this._element, true);
3311
+ }
3312
+
3313
+ dispose() {
3314
+ this._backdrop.dispose();
3315
+
3316
+ this._focustrap.deactivate();
3317
+
3318
+ super.dispose();
3218
3319
  } // Private
3219
3320
 
3220
3321
 
@@ -3227,37 +3328,34 @@
3227
3328
  return config;
3228
3329
  }
3229
3330
 
3230
- _enforceFocusOnElement(element) {
3231
- EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop
3331
+ _initializeBackDrop() {
3332
+ return new Backdrop({
3333
+ className: CLASS_NAME_BACKDROP,
3334
+ isVisible: this._config.backdrop,
3335
+ isAnimated: true,
3336
+ rootElement: this._element.parentNode,
3337
+ clickCallback: () => this.hide()
3338
+ });
3339
+ }
3232
3340
 
3233
- EventHandler.on(document, EVENT_FOCUSIN, event => {
3234
- if (document !== event.target && element !== event.target && !element.contains(event.target)) {
3235
- element.focus();
3236
- }
3341
+ _initializeFocusTrap() {
3342
+ return new FocusTrap({
3343
+ trapElement: this._element
3237
3344
  });
3238
- element.focus();
3239
3345
  }
3240
3346
 
3241
3347
  _addEventListeners() {
3242
- EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide());
3243
- EventHandler.on(document, 'keydown', event => {
3348
+ EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
3244
3349
  if (this._config.keyboard && event.key === ESCAPE_KEY) {
3245
3350
  this.hide();
3246
3351
  }
3247
3352
  });
3248
- EventHandler.on(document, EVENT_CLICK_DATA_API$1, event => {
3249
- const target = SelectorEngine.findOne(getSelectorFromElement(event.target));
3250
-
3251
- if (!this._element.contains(event.target) && target !== this._element) {
3252
- this.hide();
3253
- }
3254
- });
3255
3353
  } // Static
3256
3354
 
3257
3355
 
3258
3356
  static jQueryInterface(config) {
3259
3357
  return this.each(function () {
3260
- const data = Data.get(this, DATA_KEY$5) || new Offcanvas(this, typeof config === 'object' ? config : {});
3358
+ const data = Offcanvas.getOrCreateInstance(this, config);
3261
3359
 
3262
3360
  if (typeof config !== 'string') {
3263
3361
  return;
@@ -3297,29 +3395,28 @@
3297
3395
  }
3298
3396
  }); // avoid conflict when clicking a toggler of an offcanvas, while another is open
3299
3397
 
3300
- const allReadyOpen = SelectorEngine.findOne(ACTIVE_SELECTOR);
3398
+ const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
3301
3399
 
3302
3400
  if (allReadyOpen && allReadyOpen !== target) {
3303
- return;
3401
+ Offcanvas.getInstance(allReadyOpen).hide();
3304
3402
  }
3305
3403
 
3306
- const data = Data.get(target, DATA_KEY$5) || new Offcanvas(target);
3404
+ const data = Offcanvas.getOrCreateInstance(target);
3307
3405
  data.toggle(this);
3308
3406
  });
3309
- EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => {
3310
- SelectorEngine.find(OPEN_SELECTOR).forEach(el => (Data.get(el, DATA_KEY$5) || new Offcanvas(el)).show());
3311
- });
3407
+ EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show()));
3408
+ enableDismissTrigger(Offcanvas);
3312
3409
  /**
3313
3410
  * ------------------------------------------------------------------------
3314
3411
  * jQuery
3315
3412
  * ------------------------------------------------------------------------
3316
3413
  */
3317
3414
 
3318
- defineJQueryPlugin(NAME$5, Offcanvas);
3415
+ defineJQueryPlugin(Offcanvas);
3319
3416
 
3320
3417
  /**
3321
3418
  * --------------------------------------------------------------------------
3322
- * Bootstrap (v5.0.0-beta3): util/sanitizer.js
3419
+ * Bootstrap (v5.1.0): util/sanitizer.js
3323
3420
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
3324
3421
  * --------------------------------------------------------------------------
3325
3422
  */
@@ -3414,7 +3511,7 @@
3414
3511
  const elName = el.nodeName.toLowerCase();
3415
3512
 
3416
3513
  if (!allowlistKeys.includes(elName)) {
3417
- el.parentNode.removeChild(el);
3514
+ el.remove();
3418
3515
  continue;
3419
3516
  }
3420
3517
 
@@ -3432,7 +3529,7 @@
3432
3529
 
3433
3530
  /**
3434
3531
  * --------------------------------------------------------------------------
3435
- * Bootstrap (v5.0.0-beta3): tooltip.js
3532
+ * Bootstrap (v5.1.0): tooltip.js
3436
3533
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
3437
3534
  * --------------------------------------------------------------------------
3438
3535
  */
@@ -3446,7 +3543,6 @@
3446
3543
  const DATA_KEY$4 = 'bs.tooltip';
3447
3544
  const EVENT_KEY$4 = `.${DATA_KEY$4}`;
3448
3545
  const CLASS_PREFIX$1 = 'bs-tooltip';
3449
- const BSCLS_PREFIX_REGEX$1 = new RegExp(`(^|\\s)${CLASS_PREFIX$1}\\S+`, 'g');
3450
3546
  const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
3451
3547
  const DefaultType$3 = {
3452
3548
  animation: 'boolean',
@@ -3505,12 +3601,14 @@
3505
3601
  MOUSEENTER: `mouseenter${EVENT_KEY$4}`,
3506
3602
  MOUSELEAVE: `mouseleave${EVENT_KEY$4}`
3507
3603
  };
3508
- const CLASS_NAME_FADE$3 = 'fade';
3604
+ const CLASS_NAME_FADE$2 = 'fade';
3509
3605
  const CLASS_NAME_MODAL = 'modal';
3510
- const CLASS_NAME_SHOW$3 = 'show';
3606
+ const CLASS_NAME_SHOW$2 = 'show';
3511
3607
  const HOVER_STATE_SHOW = 'show';
3512
3608
  const HOVER_STATE_OUT = 'out';
3513
3609
  const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
3610
+ const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
3611
+ const EVENT_MODAL_HIDE = 'hide.bs.modal';
3514
3612
  const TRIGGER_HOVER = 'hover';
3515
3613
  const TRIGGER_FOCUS = 'focus';
3516
3614
  const TRIGGER_CLICK = 'click';
@@ -3535,7 +3633,7 @@
3535
3633
  this._activeTrigger = {};
3536
3634
  this._popper = null; // Protected
3537
3635
 
3538
- this.config = this._getConfig(config);
3636
+ this._config = this._getConfig(config);
3539
3637
  this.tip = null;
3540
3638
 
3541
3639
  this._setListeners();
@@ -3550,18 +3648,10 @@
3550
3648
  return NAME$4;
3551
3649
  }
3552
3650
 
3553
- static get DATA_KEY() {
3554
- return DATA_KEY$4;
3555
- }
3556
-
3557
3651
  static get Event() {
3558
3652
  return Event$2;
3559
3653
  }
3560
3654
 
3561
- static get EVENT_KEY() {
3562
- return EVENT_KEY$4;
3563
- }
3564
-
3565
3655
  static get DefaultType() {
3566
3656
  return DefaultType$3;
3567
3657
  } // Public
@@ -3595,7 +3685,7 @@
3595
3685
  context._leave(null, context);
3596
3686
  }
3597
3687
  } else {
3598
- if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) {
3688
+ if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$2)) {
3599
3689
  this._leave(null, this);
3600
3690
 
3601
3691
  return;
@@ -3607,25 +3697,16 @@
3607
3697
 
3608
3698
  dispose() {
3609
3699
  clearTimeout(this._timeout);
3610
- EventHandler.off(this._element, this.constructor.EVENT_KEY);
3611
- EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
3700
+ EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
3612
3701
 
3613
- if (this.tip && this.tip.parentNode) {
3614
- this.tip.parentNode.removeChild(this.tip);
3702
+ if (this.tip) {
3703
+ this.tip.remove();
3615
3704
  }
3616
3705
 
3617
- this._isEnabled = null;
3618
- this._timeout = null;
3619
- this._hoverState = null;
3620
- this._activeTrigger = null;
3621
-
3622
3706
  if (this._popper) {
3623
3707
  this._popper.destroy();
3624
3708
  }
3625
3709
 
3626
- this._popper = null;
3627
- this.config = null;
3628
- this.tip = null;
3629
3710
  super.dispose();
3630
3711
  }
3631
3712
 
@@ -3652,24 +3733,23 @@
3652
3733
 
3653
3734
  this._element.setAttribute('aria-describedby', tipId);
3654
3735
 
3655
- this.setContent();
3656
-
3657
- if (this.config.animation) {
3658
- tip.classList.add(CLASS_NAME_FADE$3);
3736
+ if (this._config.animation) {
3737
+ tip.classList.add(CLASS_NAME_FADE$2);
3659
3738
  }
3660
3739
 
3661
- const placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this._element) : this.config.placement;
3740
+ const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
3662
3741
 
3663
3742
  const attachment = this._getAttachment(placement);
3664
3743
 
3665
3744
  this._addAttachmentClass(attachment);
3666
3745
 
3667
- const container = this._getContainer();
3668
-
3746
+ const {
3747
+ container
3748
+ } = this._config;
3669
3749
  Data.set(tip, this.constructor.DATA_KEY, this);
3670
3750
 
3671
3751
  if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
3672
- container.appendChild(tip);
3752
+ container.append(tip);
3673
3753
  EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
3674
3754
  }
3675
3755
 
@@ -3679,8 +3759,9 @@
3679
3759
  this._popper = Popper__namespace.createPopper(this._element, tip, this._getPopperConfig(attachment));
3680
3760
  }
3681
3761
 
3682
- tip.classList.add(CLASS_NAME_SHOW$3);
3683
- const customClass = typeof this.config.customClass === 'function' ? this.config.customClass() : this.config.customClass;
3762
+ tip.classList.add(CLASS_NAME_SHOW$2);
3763
+
3764
+ const customClass = this._resolvePossibleFunction(this._config.customClass);
3684
3765
 
3685
3766
  if (customClass) {
3686
3767
  tip.classList.add(...customClass.split(' '));
@@ -3692,7 +3773,7 @@
3692
3773
 
3693
3774
  if ('ontouchstart' in document.documentElement) {
3694
3775
  [].concat(...document.body.children).forEach(element => {
3695
- EventHandler.on(element, 'mouseover', noop());
3776
+ EventHandler.on(element, 'mouseover', noop);
3696
3777
  });
3697
3778
  }
3698
3779
 
@@ -3706,13 +3787,9 @@
3706
3787
  }
3707
3788
  };
3708
3789
 
3709
- if (this.tip.classList.contains(CLASS_NAME_FADE$3)) {
3710
- const transitionDuration = getTransitionDurationFromElement(this.tip);
3711
- EventHandler.one(this.tip, 'transitionend', complete);
3712
- emulateTransitionEnd(this.tip, transitionDuration);
3713
- } else {
3714
- complete();
3715
- }
3790
+ const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
3791
+
3792
+ this._queueCallback(complete, this.tip, isAnimated);
3716
3793
  }
3717
3794
 
3718
3795
  hide() {
@@ -3727,8 +3804,8 @@
3727
3804
  return;
3728
3805
  }
3729
3806
 
3730
- if (this._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
3731
- tip.parentNode.removeChild(tip);
3807
+ if (this._hoverState !== HOVER_STATE_SHOW) {
3808
+ tip.remove();
3732
3809
  }
3733
3810
 
3734
3811
  this._cleanTipClass();
@@ -3750,7 +3827,7 @@
3750
3827
  return;
3751
3828
  }
3752
3829
 
3753
- tip.classList.remove(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra
3830
+ tip.classList.remove(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we remove the extra
3754
3831
  // empty mouseover listeners we added for iOS support
3755
3832
 
3756
3833
  if ('ontouchstart' in document.documentElement) {
@@ -3760,14 +3837,9 @@
3760
3837
  this._activeTrigger[TRIGGER_CLICK] = false;
3761
3838
  this._activeTrigger[TRIGGER_FOCUS] = false;
3762
3839
  this._activeTrigger[TRIGGER_HOVER] = false;
3840
+ const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
3763
3841
 
3764
- if (this.tip.classList.contains(CLASS_NAME_FADE$3)) {
3765
- const transitionDuration = getTransitionDurationFromElement(tip);
3766
- EventHandler.one(tip, 'transitionend', complete);
3767
- emulateTransitionEnd(tip, transitionDuration);
3768
- } else {
3769
- complete();
3770
- }
3842
+ this._queueCallback(complete, this.tip, isAnimated);
3771
3843
 
3772
3844
  this._hoverState = '';
3773
3845
  }
@@ -3789,15 +3861,28 @@
3789
3861
  }
3790
3862
 
3791
3863
  const element = document.createElement('div');
3792
- element.innerHTML = this.config.template;
3793
- this.tip = element.children[0];
3864
+ element.innerHTML = this._config.template;
3865
+ const tip = element.children[0];
3866
+ this.setContent(tip);
3867
+ tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
3868
+ this.tip = tip;
3794
3869
  return this.tip;
3795
3870
  }
3796
3871
 
3797
- setContent() {
3798
- const tip = this.getTipElement();
3799
- this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
3800
- tip.classList.remove(CLASS_NAME_FADE$3, CLASS_NAME_SHOW$3);
3872
+ setContent(tip) {
3873
+ this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER);
3874
+ }
3875
+
3876
+ _sanitizeAndSetContent(template, content, selector) {
3877
+ const templateElement = SelectorEngine.findOne(selector, template);
3878
+
3879
+ if (!content && templateElement) {
3880
+ templateElement.remove();
3881
+ return;
3882
+ } // we use append for html objects to maintain js events
3883
+
3884
+
3885
+ this.setElementContent(templateElement, content);
3801
3886
  }
3802
3887
 
3803
3888
  setElementContent(element, content) {
@@ -3805,16 +3890,13 @@
3805
3890
  return;
3806
3891
  }
3807
3892
 
3808
- if (typeof content === 'object' && isElement(content)) {
3809
- if (content.jquery) {
3810
- content = content[0];
3811
- } // content is a DOM node or a jQuery
3812
-
3893
+ if (isElement(content)) {
3894
+ content = getElement(content); // content is a DOM node or a jQuery
3813
3895
 
3814
- if (this.config.html) {
3896
+ if (this._config.html) {
3815
3897
  if (content.parentNode !== element) {
3816
3898
  element.innerHTML = '';
3817
- element.appendChild(content);
3899
+ element.append(content);
3818
3900
  }
3819
3901
  } else {
3820
3902
  element.textContent = content.textContent;
@@ -3823,9 +3905,9 @@
3823
3905
  return;
3824
3906
  }
3825
3907
 
3826
- if (this.config.html) {
3827
- if (this.config.sanitize) {
3828
- content = sanitizeHtml(content, this.config.allowList, this.config.sanitizeFn);
3908
+ if (this._config.html) {
3909
+ if (this._config.sanitize) {
3910
+ content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn);
3829
3911
  }
3830
3912
 
3831
3913
  element.innerHTML = content;
@@ -3835,13 +3917,9 @@
3835
3917
  }
3836
3918
 
3837
3919
  getTitle() {
3838
- let title = this._element.getAttribute('data-bs-original-title');
3839
-
3840
- if (!title) {
3841
- title = typeof this.config.title === 'function' ? this.config.title.call(this._element) : this.config.title;
3842
- }
3920
+ const title = this._element.getAttribute('data-bs-original-title') || this._config.title;
3843
3921
 
3844
- return title;
3922
+ return this._resolvePossibleFunction(title);
3845
3923
  }
3846
3924
 
3847
3925
  updateAttachment(attachment) {
@@ -3858,21 +3936,13 @@
3858
3936
 
3859
3937
 
3860
3938
  _initializeOnDelegatedTarget(event, context) {
3861
- const dataKey = this.constructor.DATA_KEY;
3862
- context = context || Data.get(event.delegateTarget, dataKey);
3863
-
3864
- if (!context) {
3865
- context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
3866
- Data.set(event.delegateTarget, dataKey, context);
3867
- }
3868
-
3869
- return context;
3939
+ return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
3870
3940
  }
3871
3941
 
3872
3942
  _getOffset() {
3873
3943
  const {
3874
3944
  offset
3875
- } = this.config;
3945
+ } = this._config;
3876
3946
 
3877
3947
  if (typeof offset === 'string') {
3878
3948
  return offset.split(',').map(val => Number.parseInt(val, 10));
@@ -3885,14 +3955,17 @@
3885
3955
  return offset;
3886
3956
  }
3887
3957
 
3958
+ _resolvePossibleFunction(content) {
3959
+ return typeof content === 'function' ? content.call(this._element) : content;
3960
+ }
3961
+
3888
3962
  _getPopperConfig(attachment) {
3889
3963
  const defaultBsPopperConfig = {
3890
3964
  placement: attachment,
3891
3965
  modifiers: [{
3892
3966
  name: 'flip',
3893
3967
  options: {
3894
- altBoundary: true,
3895
- fallbackPlacements: this.config.fallbackPlacements
3968
+ fallbackPlacements: this._config.fallbackPlacements
3896
3969
  }
3897
3970
  }, {
3898
3971
  name: 'offset',
@@ -3902,7 +3975,7 @@
3902
3975
  }, {
3903
3976
  name: 'preventOverflow',
3904
3977
  options: {
3905
- boundary: this.config.boundary
3978
+ boundary: this._config.boundary
3906
3979
  }
3907
3980
  }, {
3908
3981
  name: 'arrow',
@@ -3922,24 +3995,12 @@
3922
3995
  }
3923
3996
  };
3924
3997
  return { ...defaultBsPopperConfig,
3925
- ...(typeof this.config.popperConfig === 'function' ? this.config.popperConfig(defaultBsPopperConfig) : this.config.popperConfig)
3998
+ ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
3926
3999
  };
3927
4000
  }
3928
4001
 
3929
4002
  _addAttachmentClass(attachment) {
3930
- this.getTipElement().classList.add(`${CLASS_PREFIX$1}-${this.updateAttachment(attachment)}`);
3931
- }
3932
-
3933
- _getContainer() {
3934
- if (this.config.container === false) {
3935
- return document.body;
3936
- }
3937
-
3938
- if (isElement(this.config.container)) {
3939
- return this.config.container;
3940
- }
3941
-
3942
- return SelectorEngine.findOne(this.config.container);
4003
+ this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`);
3943
4004
  }
3944
4005
 
3945
4006
  _getAttachment(placement) {
@@ -3947,15 +4008,16 @@
3947
4008
  }
3948
4009
 
3949
4010
  _setListeners() {
3950
- const triggers = this.config.trigger.split(' ');
4011
+ const triggers = this._config.trigger.split(' ');
4012
+
3951
4013
  triggers.forEach(trigger => {
3952
4014
  if (trigger === 'click') {
3953
- EventHandler.on(this._element, this.constructor.Event.CLICK, this.config.selector, event => this.toggle(event));
4015
+ EventHandler.on(this._element, this.constructor.Event.CLICK, this._config.selector, event => this.toggle(event));
3954
4016
  } else if (trigger !== TRIGGER_MANUAL) {
3955
4017
  const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN;
3956
4018
  const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT;
3957
- EventHandler.on(this._element, eventIn, this.config.selector, event => this._enter(event));
3958
- EventHandler.on(this._element, eventOut, this.config.selector, event => this._leave(event));
4019
+ EventHandler.on(this._element, eventIn, this._config.selector, event => this._enter(event));
4020
+ EventHandler.on(this._element, eventOut, this._config.selector, event => this._leave(event));
3959
4021
  }
3960
4022
  });
3961
4023
 
@@ -3965,10 +4027,10 @@
3965
4027
  }
3966
4028
  };
3967
4029
 
3968
- EventHandler.on(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
4030
+ EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
3969
4031
 
3970
- if (this.config.selector) {
3971
- this.config = { ...this.config,
4032
+ if (this._config.selector) {
4033
+ this._config = { ...this._config,
3972
4034
  trigger: 'manual',
3973
4035
  selector: ''
3974
4036
  };
@@ -4000,7 +4062,7 @@
4000
4062
  context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
4001
4063
  }
4002
4064
 
4003
- if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) {
4065
+ if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$2) || context._hoverState === HOVER_STATE_SHOW) {
4004
4066
  context._hoverState = HOVER_STATE_SHOW;
4005
4067
  return;
4006
4068
  }
@@ -4008,7 +4070,7 @@
4008
4070
  clearTimeout(context._timeout);
4009
4071
  context._hoverState = HOVER_STATE_SHOW;
4010
4072
 
4011
- if (!context.config.delay || !context.config.delay.show) {
4073
+ if (!context._config.delay || !context._config.delay.show) {
4012
4074
  context.show();
4013
4075
  return;
4014
4076
  }
@@ -4017,7 +4079,7 @@
4017
4079
  if (context._hoverState === HOVER_STATE_SHOW) {
4018
4080
  context.show();
4019
4081
  }
4020
- }, context.config.delay.show);
4082
+ }, context._config.delay.show);
4021
4083
  }
4022
4084
 
4023
4085
  _leave(event, context) {
@@ -4034,7 +4096,7 @@
4034
4096
  clearTimeout(context._timeout);
4035
4097
  context._hoverState = HOVER_STATE_OUT;
4036
4098
 
4037
- if (!context.config.delay || !context.config.delay.hide) {
4099
+ if (!context._config.delay || !context._config.delay.hide) {
4038
4100
  context.hide();
4039
4101
  return;
4040
4102
  }
@@ -4043,7 +4105,7 @@
4043
4105
  if (context._hoverState === HOVER_STATE_OUT) {
4044
4106
  context.hide();
4045
4107
  }
4046
- }, context.config.delay.hide);
4108
+ }, context._config.delay.hide);
4047
4109
  }
4048
4110
 
4049
4111
  _isWithActiveTrigger() {
@@ -4063,15 +4125,11 @@
4063
4125
  delete dataAttributes[dataAttr];
4064
4126
  }
4065
4127
  });
4066
-
4067
- if (config && typeof config.container === 'object' && config.container.jquery) {
4068
- config.container = config.container[0];
4069
- }
4070
-
4071
4128
  config = { ...this.constructor.Default,
4072
4129
  ...dataAttributes,
4073
4130
  ...(typeof config === 'object' && config ? config : {})
4074
4131
  };
4132
+ config.container = config.container === false ? document.body : getElement(config.container);
4075
4133
 
4076
4134
  if (typeof config.delay === 'number') {
4077
4135
  config.delay = {
@@ -4100,26 +4158,32 @@
4100
4158
  _getDelegateConfig() {
4101
4159
  const config = {};
4102
4160
 
4103
- if (this.config) {
4104
- for (const key in this.config) {
4105
- if (this.constructor.Default[key] !== this.config[key]) {
4106
- config[key] = this.config[key];
4107
- }
4161
+ for (const key in this._config) {
4162
+ if (this.constructor.Default[key] !== this._config[key]) {
4163
+ config[key] = this._config[key];
4108
4164
  }
4109
- }
4165
+ } // In the future can be replaced with:
4166
+ // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
4167
+ // `Object.fromEntries(keysWithDifferentValues)`
4168
+
4110
4169
 
4111
4170
  return config;
4112
4171
  }
4113
4172
 
4114
4173
  _cleanTipClass() {
4115
4174
  const tip = this.getTipElement();
4116
- const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX$1);
4175
+ const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g');
4176
+ const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex);
4117
4177
 
4118
4178
  if (tabClass !== null && tabClass.length > 0) {
4119
4179
  tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
4120
4180
  }
4121
4181
  }
4122
4182
 
4183
+ _getBasicClassPrefix() {
4184
+ return CLASS_PREFIX$1;
4185
+ }
4186
+
4123
4187
  _handlePopperPlacementChange(popperData) {
4124
4188
  const {
4125
4189
  state
@@ -4139,17 +4203,7 @@
4139
4203
 
4140
4204
  static jQueryInterface(config) {
4141
4205
  return this.each(function () {
4142
- let data = Data.get(this, DATA_KEY$4);
4143
-
4144
- const _config = typeof config === 'object' && config;
4145
-
4146
- if (!data && /dispose|hide/.test(config)) {
4147
- return;
4148
- }
4149
-
4150
- if (!data) {
4151
- data = new Tooltip(this, _config);
4152
- }
4206
+ const data = Tooltip.getOrCreateInstance(this, config);
4153
4207
 
4154
4208
  if (typeof config === 'string') {
4155
4209
  if (typeof data[config] === 'undefined') {
@@ -4170,11 +4224,11 @@
4170
4224
  */
4171
4225
 
4172
4226
 
4173
- defineJQueryPlugin(NAME$4, Tooltip);
4227
+ defineJQueryPlugin(Tooltip);
4174
4228
 
4175
4229
  /**
4176
4230
  * --------------------------------------------------------------------------
4177
- * Bootstrap (v5.0.0-beta3): popover.js
4231
+ * Bootstrap (v5.1.0): popover.js
4178
4232
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
4179
4233
  * --------------------------------------------------------------------------
4180
4234
  */
@@ -4188,7 +4242,6 @@
4188
4242
  const DATA_KEY$3 = 'bs.popover';
4189
4243
  const EVENT_KEY$3 = `.${DATA_KEY$3}`;
4190
4244
  const CLASS_PREFIX = 'bs-popover';
4191
- const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
4192
4245
  const Default$2 = { ...Tooltip.Default,
4193
4246
  placement: 'right',
4194
4247
  offset: [0, 8],
@@ -4211,8 +4264,6 @@
4211
4264
  MOUSEENTER: `mouseenter${EVENT_KEY$3}`,
4212
4265
  MOUSELEAVE: `mouseleave${EVENT_KEY$3}`
4213
4266
  };
4214
- const CLASS_NAME_FADE$2 = 'fade';
4215
- const CLASS_NAME_SHOW$2 = 'show';
4216
4267
  const SELECTOR_TITLE = '.popover-header';
4217
4268
  const SELECTOR_CONTENT = '.popover-body';
4218
4269
  /**
@@ -4231,18 +4282,10 @@
4231
4282
  return NAME$3;
4232
4283
  }
4233
4284
 
4234
- static get DATA_KEY() {
4235
- return DATA_KEY$3;
4236
- }
4237
-
4238
4285
  static get Event() {
4239
4286
  return Event$1;
4240
4287
  }
4241
4288
 
4242
- static get EVENT_KEY() {
4243
- return EVENT_KEY$3;
4244
- }
4245
-
4246
4289
  static get DefaultType() {
4247
4290
  return DefaultType$2;
4248
4291
  } // Overrides
@@ -4252,54 +4295,25 @@
4252
4295
  return this.getTitle() || this._getContent();
4253
4296
  }
4254
4297
 
4255
- setContent() {
4256
- const tip = this.getTipElement(); // we use append for html objects to maintain js events
4257
-
4258
- this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
4259
-
4260
- let content = this._getContent();
4261
-
4262
- if (typeof content === 'function') {
4263
- content = content.call(this._element);
4264
- }
4298
+ setContent(tip) {
4299
+ this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE);
4265
4300
 
4266
- this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
4267
- tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
4301
+ this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT);
4268
4302
  } // Private
4269
4303
 
4270
4304
 
4271
- _addAttachmentClass(attachment) {
4272
- this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
4273
- }
4274
-
4275
4305
  _getContent() {
4276
- return this._element.getAttribute('data-bs-content') || this.config.content;
4306
+ return this._resolvePossibleFunction(this._config.content);
4277
4307
  }
4278
4308
 
4279
- _cleanTipClass() {
4280
- const tip = this.getTipElement();
4281
- const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
4282
-
4283
- if (tabClass !== null && tabClass.length > 0) {
4284
- tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
4285
- }
4309
+ _getBasicClassPrefix() {
4310
+ return CLASS_PREFIX;
4286
4311
  } // Static
4287
4312
 
4288
4313
 
4289
4314
  static jQueryInterface(config) {
4290
4315
  return this.each(function () {
4291
- let data = Data.get(this, DATA_KEY$3);
4292
-
4293
- const _config = typeof config === 'object' ? config : null;
4294
-
4295
- if (!data && /dispose|hide/.test(config)) {
4296
- return;
4297
- }
4298
-
4299
- if (!data) {
4300
- data = new Popover(this, _config);
4301
- Data.set(this, DATA_KEY$3, data);
4302
- }
4316
+ const data = Popover.getOrCreateInstance(this, config);
4303
4317
 
4304
4318
  if (typeof config === 'string') {
4305
4319
  if (typeof data[config] === 'undefined') {
@@ -4320,11 +4334,11 @@
4320
4334
  */
4321
4335
 
4322
4336
 
4323
- defineJQueryPlugin(NAME$3, Popover);
4337
+ defineJQueryPlugin(Popover);
4324
4338
 
4325
4339
  /**
4326
4340
  * --------------------------------------------------------------------------
4327
- * Bootstrap (v5.0.0-beta3): scrollspy.js
4341
+ * Bootstrap (v5.1.0): scrollspy.js
4328
4342
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
4329
4343
  * --------------------------------------------------------------------------
4330
4344
  */
@@ -4358,6 +4372,7 @@
4358
4372
  const SELECTOR_NAV_LINKS = '.nav-link';
4359
4373
  const SELECTOR_NAV_ITEMS = '.nav-item';
4360
4374
  const SELECTOR_LIST_ITEMS = '.list-group-item';
4375
+ const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}, .${CLASS_NAME_DROPDOWN_ITEM}`;
4361
4376
  const SELECTOR_DROPDOWN$1 = '.dropdown';
4362
4377
  const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
4363
4378
  const METHOD_OFFSET = 'offset';
@@ -4373,7 +4388,6 @@
4373
4388
  super(element);
4374
4389
  this._scrollElement = this._element.tagName === 'BODY' ? window : this._element;
4375
4390
  this._config = this._getConfig(config);
4376
- this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS}, ${this._config.target} ${SELECTOR_LIST_ITEMS}, ${this._config.target} .${CLASS_NAME_DROPDOWN_ITEM}`;
4377
4391
  this._offsets = [];
4378
4392
  this._targets = [];
4379
4393
  this._activeTarget = null;
@@ -4389,8 +4403,8 @@
4389
4403
  return Default$1;
4390
4404
  }
4391
4405
 
4392
- static get DATA_KEY() {
4393
- return DATA_KEY$2;
4406
+ static get NAME() {
4407
+ return NAME$2;
4394
4408
  } // Public
4395
4409
 
4396
4410
 
@@ -4401,7 +4415,7 @@
4401
4415
  this._offsets = [];
4402
4416
  this._targets = [];
4403
4417
  this._scrollHeight = this._getScrollHeight();
4404
- const targets = SelectorEngine.find(this._selector);
4418
+ const targets = SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target);
4405
4419
  targets.map(element => {
4406
4420
  const targetSelector = getSelectorFromElement(element);
4407
4421
  const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null;
@@ -4423,36 +4437,17 @@
4423
4437
  }
4424
4438
 
4425
4439
  dispose() {
4426
- super.dispose();
4427
4440
  EventHandler.off(this._scrollElement, EVENT_KEY$2);
4428
- this._scrollElement = null;
4429
- this._config = null;
4430
- this._selector = null;
4431
- this._offsets = null;
4432
- this._targets = null;
4433
- this._activeTarget = null;
4434
- this._scrollHeight = null;
4441
+ super.dispose();
4435
4442
  } // Private
4436
4443
 
4437
4444
 
4438
4445
  _getConfig(config) {
4439
4446
  config = { ...Default$1,
4447
+ ...Manipulator.getDataAttributes(this._element),
4440
4448
  ...(typeof config === 'object' && config ? config : {})
4441
4449
  };
4442
-
4443
- if (typeof config.target !== 'string' && isElement(config.target)) {
4444
- let {
4445
- id
4446
- } = config.target;
4447
-
4448
- if (!id) {
4449
- id = getUID(NAME$2);
4450
- config.target.id = id;
4451
- }
4452
-
4453
- config.target = `#${id}`;
4454
- }
4455
-
4450
+ config.target = getElement(config.target) || document.documentElement;
4456
4451
  typeCheckConfig(NAME$2, config, DefaultType$1);
4457
4452
  return config;
4458
4453
  }
@@ -4512,16 +4507,13 @@
4512
4507
 
4513
4508
  this._clear();
4514
4509
 
4515
- const queries = this._selector.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
4516
-
4517
- const link = SelectorEngine.findOne(queries.join(','));
4510
+ const queries = SELECTOR_LINK_ITEMS.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
4511
+ const link = SelectorEngine.findOne(queries.join(','), this._config.target);
4512
+ link.classList.add(CLASS_NAME_ACTIVE$1);
4518
4513
 
4519
4514
  if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
4520
4515
  SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, link.closest(SELECTOR_DROPDOWN$1)).classList.add(CLASS_NAME_ACTIVE$1);
4521
- link.classList.add(CLASS_NAME_ACTIVE$1);
4522
4516
  } else {
4523
- // Set triggered link as active
4524
- link.classList.add(CLASS_NAME_ACTIVE$1);
4525
4517
  SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP$1).forEach(listGroup => {
4526
4518
  // Set triggered links parents as active
4527
4519
  // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
@@ -4539,27 +4531,23 @@
4539
4531
  }
4540
4532
 
4541
4533
  _clear() {
4542
- SelectorEngine.find(this._selector).filter(node => node.classList.contains(CLASS_NAME_ACTIVE$1)).forEach(node => node.classList.remove(CLASS_NAME_ACTIVE$1));
4534
+ SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target).filter(node => node.classList.contains(CLASS_NAME_ACTIVE$1)).forEach(node => node.classList.remove(CLASS_NAME_ACTIVE$1));
4543
4535
  } // Static
4544
4536
 
4545
4537
 
4546
4538
  static jQueryInterface(config) {
4547
4539
  return this.each(function () {
4548
- let data = Data.get(this, DATA_KEY$2);
4540
+ const data = ScrollSpy.getOrCreateInstance(this, config);
4549
4541
 
4550
- const _config = typeof config === 'object' && config;
4551
-
4552
- if (!data) {
4553
- data = new ScrollSpy(this, _config);
4542
+ if (typeof config !== 'string') {
4543
+ return;
4554
4544
  }
4555
4545
 
4556
- if (typeof config === 'string') {
4557
- if (typeof data[config] === 'undefined') {
4558
- throw new TypeError(`No method named "${config}"`);
4559
- }
4560
-
4561
- data[config]();
4546
+ if (typeof data[config] === 'undefined') {
4547
+ throw new TypeError(`No method named "${config}"`);
4562
4548
  }
4549
+
4550
+ data[config]();
4563
4551
  });
4564
4552
  }
4565
4553
 
@@ -4572,7 +4560,7 @@
4572
4560
 
4573
4561
 
4574
4562
  EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
4575
- SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy, Manipulator.getDataAttributes(spy)));
4563
+ SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy));
4576
4564
  });
4577
4565
  /**
4578
4566
  * ------------------------------------------------------------------------
@@ -4581,11 +4569,11 @@
4581
4569
  * add .ScrollSpy to jQuery only if jQuery is present
4582
4570
  */
4583
4571
 
4584
- defineJQueryPlugin(NAME$2, ScrollSpy);
4572
+ defineJQueryPlugin(ScrollSpy);
4585
4573
 
4586
4574
  /**
4587
4575
  * --------------------------------------------------------------------------
4588
- * Bootstrap (v5.0.0-beta3): tab.js
4576
+ * Bootstrap (v5.1.0): tab.js
4589
4577
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
4590
4578
  * --------------------------------------------------------------------------
4591
4579
  */
@@ -4623,13 +4611,13 @@
4623
4611
 
4624
4612
  class Tab extends BaseComponent {
4625
4613
  // Getters
4626
- static get DATA_KEY() {
4627
- return DATA_KEY$1;
4614
+ static get NAME() {
4615
+ return NAME$1;
4628
4616
  } // Public
4629
4617
 
4630
4618
 
4631
4619
  show() {
4632
- if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE) || isDisabled(this._element)) {
4620
+ if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
4633
4621
  return;
4634
4622
  }
4635
4623
 
@@ -4682,10 +4670,9 @@
4682
4670
  const complete = () => this._transitionComplete(element, active, callback);
4683
4671
 
4684
4672
  if (active && isTransitioning) {
4685
- const transitionDuration = getTransitionDurationFromElement(active);
4686
4673
  active.classList.remove(CLASS_NAME_SHOW$1);
4687
- EventHandler.one(active, 'transitionend', complete);
4688
- emulateTransitionEnd(active, transitionDuration);
4674
+
4675
+ this._queueCallback(complete, element, true);
4689
4676
  } else {
4690
4677
  complete();
4691
4678
  }
@@ -4717,11 +4704,17 @@
4717
4704
  element.classList.add(CLASS_NAME_SHOW$1);
4718
4705
  }
4719
4706
 
4720
- if (element.parentNode && element.parentNode.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
4707
+ let parent = element.parentNode;
4708
+
4709
+ if (parent && parent.nodeName === 'LI') {
4710
+ parent = parent.parentNode;
4711
+ }
4712
+
4713
+ if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
4721
4714
  const dropdownElement = element.closest(SELECTOR_DROPDOWN);
4722
4715
 
4723
4716
  if (dropdownElement) {
4724
- SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE));
4717
+ SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE));
4725
4718
  }
4726
4719
 
4727
4720
  element.setAttribute('aria-expanded', true);
@@ -4735,7 +4728,7 @@
4735
4728
 
4736
4729
  static jQueryInterface(config) {
4737
4730
  return this.each(function () {
4738
- const data = Data.get(this, DATA_KEY$1) || new Tab(this);
4731
+ const data = Tab.getOrCreateInstance(this);
4739
4732
 
4740
4733
  if (typeof config === 'string') {
4741
4734
  if (typeof data[config] === 'undefined') {
@@ -4756,8 +4749,15 @@
4756
4749
 
4757
4750
 
4758
4751
  EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
4759
- event.preventDefault();
4760
- const data = Data.get(this, DATA_KEY$1) || new Tab(this);
4752
+ if (['A', 'AREA'].includes(this.tagName)) {
4753
+ event.preventDefault();
4754
+ }
4755
+
4756
+ if (isDisabled(this)) {
4757
+ return;
4758
+ }
4759
+
4760
+ const data = Tab.getOrCreateInstance(this);
4761
4761
  data.show();
4762
4762
  });
4763
4763
  /**
@@ -4767,11 +4767,11 @@
4767
4767
  * add .Tab to jQuery only if jQuery is present
4768
4768
  */
4769
4769
 
4770
- defineJQueryPlugin(NAME$1, Tab);
4770
+ defineJQueryPlugin(Tab);
4771
4771
 
4772
4772
  /**
4773
4773
  * --------------------------------------------------------------------------
4774
- * Bootstrap (v5.0.0-beta3): toast.js
4774
+ * Bootstrap (v5.1.0): toast.js
4775
4775
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
4776
4776
  * --------------------------------------------------------------------------
4777
4777
  */
@@ -4784,13 +4784,17 @@
4784
4784
  const NAME = 'toast';
4785
4785
  const DATA_KEY = 'bs.toast';
4786
4786
  const EVENT_KEY = `.${DATA_KEY}`;
4787
- const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
4787
+ const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
4788
+ const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
4789
+ const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
4790
+ const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`;
4788
4791
  const EVENT_HIDE = `hide${EVENT_KEY}`;
4789
4792
  const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
4790
4793
  const EVENT_SHOW = `show${EVENT_KEY}`;
4791
4794
  const EVENT_SHOWN = `shown${EVENT_KEY}`;
4792
4795
  const CLASS_NAME_FADE = 'fade';
4793
- const CLASS_NAME_HIDE = 'hide';
4796
+ const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
4797
+
4794
4798
  const CLASS_NAME_SHOW = 'show';
4795
4799
  const CLASS_NAME_SHOWING = 'showing';
4796
4800
  const DefaultType = {
@@ -4803,7 +4807,6 @@
4803
4807
  autohide: true,
4804
4808
  delay: 5000
4805
4809
  };
4806
- const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]';
4807
4810
  /**
4808
4811
  * ------------------------------------------------------------------------
4809
4812
  * Class Definition
@@ -4815,6 +4818,8 @@
4815
4818
  super(element);
4816
4819
  this._config = this._getConfig(config);
4817
4820
  this._timeout = null;
4821
+ this._hasMouseInteraction = false;
4822
+ this._hasKeyboardInteraction = false;
4818
4823
 
4819
4824
  this._setListeners();
4820
4825
  } // Getters
@@ -4828,8 +4833,8 @@
4828
4833
  return Default;
4829
4834
  }
4830
4835
 
4831
- static get DATA_KEY() {
4832
- return DATA_KEY;
4836
+ static get NAME() {
4837
+ return NAME;
4833
4838
  } // Public
4834
4839
 
4835
4840
 
@@ -4849,30 +4854,21 @@
4849
4854
  const complete = () => {
4850
4855
  this._element.classList.remove(CLASS_NAME_SHOWING);
4851
4856
 
4852
- this._element.classList.add(CLASS_NAME_SHOW);
4853
-
4854
4857
  EventHandler.trigger(this._element, EVENT_SHOWN);
4855
4858
 
4856
- if (this._config.autohide) {
4857
- this._timeout = setTimeout(() => {
4858
- this.hide();
4859
- }, this._config.delay);
4860
- }
4859
+ this._maybeScheduleHide();
4861
4860
  };
4862
4861
 
4863
- this._element.classList.remove(CLASS_NAME_HIDE);
4862
+ this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
4863
+
4864
4864
 
4865
4865
  reflow(this._element);
4866
4866
 
4867
+ this._element.classList.add(CLASS_NAME_SHOW);
4868
+
4867
4869
  this._element.classList.add(CLASS_NAME_SHOWING);
4868
4870
 
4869
- if (this._config.animation) {
4870
- const transitionDuration = getTransitionDurationFromElement(this._element);
4871
- EventHandler.one(this._element, 'transitionend', complete);
4872
- emulateTransitionEnd(this._element, transitionDuration);
4873
- } else {
4874
- complete();
4875
- }
4871
+ this._queueCallback(complete, this._element, this._config.animation);
4876
4872
  }
4877
4873
 
4878
4874
  hide() {
@@ -4887,20 +4883,19 @@
4887
4883
  }
4888
4884
 
4889
4885
  const complete = () => {
4890
- this._element.classList.add(CLASS_NAME_HIDE);
4886
+ this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
4887
+
4888
+
4889
+ this._element.classList.remove(CLASS_NAME_SHOWING);
4890
+
4891
+ this._element.classList.remove(CLASS_NAME_SHOW);
4891
4892
 
4892
4893
  EventHandler.trigger(this._element, EVENT_HIDDEN);
4893
4894
  };
4894
4895
 
4895
- this._element.classList.remove(CLASS_NAME_SHOW);
4896
+ this._element.classList.add(CLASS_NAME_SHOWING);
4896
4897
 
4897
- if (this._config.animation) {
4898
- const transitionDuration = getTransitionDurationFromElement(this._element);
4899
- EventHandler.one(this._element, 'transitionend', complete);
4900
- emulateTransitionEnd(this._element, transitionDuration);
4901
- } else {
4902
- complete();
4903
- }
4898
+ this._queueCallback(complete, this._element, this._config.animation);
4904
4899
  }
4905
4900
 
4906
4901
  dispose() {
@@ -4910,9 +4905,7 @@
4910
4905
  this._element.classList.remove(CLASS_NAME_SHOW);
4911
4906
  }
4912
4907
 
4913
- EventHandler.off(this._element, EVENT_CLICK_DISMISS);
4914
4908
  super.dispose();
4915
- this._config = null;
4916
4909
  } // Private
4917
4910
 
4918
4911
 
@@ -4925,8 +4918,53 @@
4925
4918
  return config;
4926
4919
  }
4927
4920
 
4921
+ _maybeScheduleHide() {
4922
+ if (!this._config.autohide) {
4923
+ return;
4924
+ }
4925
+
4926
+ if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
4927
+ return;
4928
+ }
4929
+
4930
+ this._timeout = setTimeout(() => {
4931
+ this.hide();
4932
+ }, this._config.delay);
4933
+ }
4934
+
4935
+ _onInteraction(event, isInteracting) {
4936
+ switch (event.type) {
4937
+ case 'mouseover':
4938
+ case 'mouseout':
4939
+ this._hasMouseInteraction = isInteracting;
4940
+ break;
4941
+
4942
+ case 'focusin':
4943
+ case 'focusout':
4944
+ this._hasKeyboardInteraction = isInteracting;
4945
+ break;
4946
+ }
4947
+
4948
+ if (isInteracting) {
4949
+ this._clearTimeout();
4950
+
4951
+ return;
4952
+ }
4953
+
4954
+ const nextElement = event.relatedTarget;
4955
+
4956
+ if (this._element === nextElement || this._element.contains(nextElement)) {
4957
+ return;
4958
+ }
4959
+
4960
+ this._maybeScheduleHide();
4961
+ }
4962
+
4928
4963
  _setListeners() {
4929
- EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
4964
+ EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
4965
+ EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
4966
+ EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
4967
+ EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false));
4930
4968
  }
4931
4969
 
4932
4970
  _clearTimeout() {
@@ -4937,13 +4975,7 @@
4937
4975
 
4938
4976
  static jQueryInterface(config) {
4939
4977
  return this.each(function () {
4940
- let data = Data.get(this, DATA_KEY);
4941
-
4942
- const _config = typeof config === 'object' && config;
4943
-
4944
- if (!data) {
4945
- data = new Toast(this, _config);
4946
- }
4978
+ const data = Toast.getOrCreateInstance(this, config);
4947
4979
 
4948
4980
  if (typeof config === 'string') {
4949
4981
  if (typeof data[config] === 'undefined') {
@@ -4956,6 +4988,8 @@
4956
4988
  }
4957
4989
 
4958
4990
  }
4991
+
4992
+ enableDismissTrigger(Toast);
4959
4993
  /**
4960
4994
  * ------------------------------------------------------------------------
4961
4995
  * jQuery
@@ -4963,12 +4997,11 @@
4963
4997
  * add .Toast to jQuery only if jQuery is present
4964
4998
  */
4965
4999
 
4966
-
4967
- defineJQueryPlugin(NAME, Toast);
5000
+ defineJQueryPlugin(Toast);
4968
5001
 
4969
5002
  /**
4970
5003
  * --------------------------------------------------------------------------
4971
- * Bootstrap (v5.0.0-beta3): index.umd.js
5004
+ * Bootstrap (v5.1.0): index.umd.js
4972
5005
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
4973
5006
  * --------------------------------------------------------------------------
4974
5007
  */