bootstrap 4.3.0 → 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 (158) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +17 -2
  3. data/CHANGELOG.md +2 -14
  4. data/README.md +7 -4
  5. data/assets/javascripts/bootstrap/alert.js +173 -137
  6. data/assets/javascripts/bootstrap/base-component.js +182 -0
  7. data/assets/javascripts/bootstrap/button.js +102 -143
  8. data/assets/javascripts/bootstrap/carousel.js +481 -410
  9. data/assets/javascripts/bootstrap/collapse.js +340 -274
  10. data/assets/javascripts/bootstrap/dom/data.js +68 -0
  11. data/assets/javascripts/bootstrap/dom/event-handler.js +322 -0
  12. data/assets/javascripts/bootstrap/dom/manipulator.js +88 -0
  13. data/assets/javascripts/bootstrap/dom/selector-engine.js +127 -0
  14. data/assets/javascripts/bootstrap/dropdown.js +494 -400
  15. data/assets/javascripts/bootstrap/modal.js +834 -450
  16. data/assets/javascripts/bootstrap/offcanvas.js +866 -0
  17. data/assets/javascripts/bootstrap/popover.js +122 -199
  18. data/assets/javascripts/bootstrap/scrollspy.js +257 -241
  19. data/assets/javascripts/bootstrap/tab.js +219 -155
  20. data/assets/javascripts/bootstrap/toast.js +330 -190
  21. data/assets/javascripts/bootstrap/tooltip.js +710 -472
  22. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  23. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  24. data/assets/javascripts/bootstrap-sprockets.js +8 -1
  25. data/assets/javascripts/bootstrap.js +3547 -2809
  26. data/assets/javascripts/bootstrap.min.js +4 -4
  27. data/assets/stylesheets/_bootstrap-grid.scss +54 -18
  28. data/assets/stylesheets/_bootstrap-reboot.scss +7 -4
  29. data/assets/stylesheets/_bootstrap.scss +20 -11
  30. data/assets/stylesheets/bootstrap/_accordion.scss +118 -0
  31. data/assets/stylesheets/bootstrap/_alert.scss +15 -9
  32. data/assets/stylesheets/bootstrap/_badge.scss +2 -27
  33. data/assets/stylesheets/bootstrap/_breadcrumb.scss +5 -18
  34. data/assets/stylesheets/bootstrap/_button-group.scss +21 -45
  35. data/assets/stylesheets/bootstrap/_buttons.scss +28 -54
  36. data/assets/stylesheets/bootstrap/_card.scss +52 -125
  37. data/assets/stylesheets/bootstrap/_carousel.scss +70 -38
  38. data/assets/stylesheets/bootstrap/_close.scss +30 -31
  39. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  40. data/assets/stylesheets/bootstrap/_dropdown.scss +88 -39
  41. data/assets/stylesheets/bootstrap/_forms.scss +9 -330
  42. data/assets/stylesheets/bootstrap/_functions.scss +237 -27
  43. data/assets/stylesheets/bootstrap/_grid.scss +14 -33
  44. data/assets/stylesheets/bootstrap/_helpers.scss +9 -0
  45. data/assets/stylesheets/bootstrap/_images.scss +3 -3
  46. data/assets/stylesheets/bootstrap/_list-group.scss +61 -36
  47. data/assets/stylesheets/bootstrap/_mixins.scss +12 -16
  48. data/assets/stylesheets/bootstrap/_modal.scss +64 -84
  49. data/assets/stylesheets/bootstrap/_nav.scss +29 -10
  50. data/assets/stylesheets/bootstrap/_navbar.scss +93 -52
  51. data/assets/stylesheets/bootstrap/_offcanvas.scss +83 -0
  52. data/assets/stylesheets/bootstrap/_pagination.scss +13 -22
  53. data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
  54. data/assets/stylesheets/bootstrap/_popover.scss +29 -42
  55. data/assets/stylesheets/bootstrap/_progress.scss +10 -5
  56. data/assets/stylesheets/bootstrap/_reboot.scss +350 -208
  57. data/assets/stylesheets/bootstrap/_root.scss +42 -8
  58. data/assets/stylesheets/bootstrap/_spinners.scss +21 -7
  59. data/assets/stylesheets/bootstrap/_tables.scss +80 -114
  60. data/assets/stylesheets/bootstrap/_toasts.scss +21 -14
  61. data/assets/stylesheets/bootstrap/_tooltip.scss +21 -21
  62. data/assets/stylesheets/bootstrap/_transitions.scss +8 -1
  63. data/assets/stylesheets/bootstrap/_type.scss +40 -61
  64. data/assets/stylesheets/bootstrap/_utilities.scss +630 -17
  65. data/assets/stylesheets/bootstrap/_variables.scss +993 -487
  66. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
  67. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +63 -0
  68. data/assets/stylesheets/bootstrap/forms/_form-check.scss +152 -0
  69. data/assets/stylesheets/bootstrap/forms/_form-control.scss +219 -0
  70. data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
  71. data/assets/stylesheets/bootstrap/forms/_form-select.scss +70 -0
  72. data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
  73. data/assets/stylesheets/bootstrap/forms/_input-group.scss +121 -0
  74. data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
  75. data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
  76. data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
  77. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
  78. data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
  79. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
  80. data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
  81. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  82. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  83. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
  84. data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
  85. data/assets/stylesheets/bootstrap/mixins/_alert.scss +3 -5
  86. data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
  87. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +37 -22
  88. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
  89. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +14 -10
  90. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +77 -51
  91. data/assets/stylesheets/bootstrap/mixins/_caret.scss +10 -8
  92. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
  93. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  94. data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
  95. data/assets/stylesheets/bootstrap/mixins/_forms.scss +67 -115
  96. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
  97. data/assets/stylesheets/bootstrap/mixins/_grid.scss +131 -32
  98. data/assets/stylesheets/bootstrap/mixins/_image.scss +0 -20
  99. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +5 -2
  100. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +17 -8
  101. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +1 -1
  102. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
  103. data/assets/stylesheets/bootstrap/mixins/_transition.scss +18 -8
  104. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +89 -0
  105. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +29 -0
  106. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  107. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +274 -132
  108. data/bootstrap.gemspec +4 -6
  109. data/lib/bootstrap/version.rb +2 -2
  110. data/tasks/updater/js.rb +25 -6
  111. data/tasks/updater/network.rb +8 -2
  112. data/test/dummy_rails/app/assets/config/manifest.js +3 -0
  113. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  114. data/test/dummy_rails/app/assets/stylesheets/.browserslistrc +1 -0
  115. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  116. data/test/dummy_rails/app/views/pages/root.html +89 -0
  117. data/test/dummy_rails/config/application.rb +0 -3
  118. data/test/gemfiles/rails_6_0.gemfile +7 -0
  119. data/test/gemfiles/rails_6_1.gemfile +7 -0
  120. data/test/support/dummy_rails_integration.rb +3 -1
  121. data/test/test_helper.rb +18 -13
  122. metadata +61 -79
  123. data/assets/javascripts/bootstrap/util.js +0 -171
  124. data/assets/stylesheets/bootstrap/_code.scss +0 -48
  125. data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -507
  126. data/assets/stylesheets/bootstrap/_input-group.scss +0 -193
  127. data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
  128. data/assets/stylesheets/bootstrap/_media.scss +0 -8
  129. data/assets/stylesheets/bootstrap/_print.scss +0 -141
  130. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -21
  131. data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
  132. data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
  133. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -66
  134. data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
  135. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -10
  136. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -33
  137. data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
  138. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
  139. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -16
  140. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
  141. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
  142. data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
  143. data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
  144. data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
  145. data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
  146. data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
  147. data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
  148. data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
  149. data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
  150. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
  151. data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
  152. data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
  153. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
  154. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
  155. data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
  156. data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
  157. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
  158. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
@@ -1,82 +1,316 @@
1
1
  /*!
2
- * Bootstrap tooltip.js v4.3.0 (https://getbootstrap.com/)
3
- * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
2
+ * Bootstrap tooltip.js v5.1.0 (https://getbootstrap.com/)
3
+ * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('popper.js'), require('./util.js')) :
8
- typeof define === 'function' && define.amd ? define(['jquery', 'popper.js', './util.js'], factory) :
9
- (global = global || self, global.Tooltip = factory(global.jQuery, global.Popper, global.Util));
10
- }(this, function ($, Popper, Util) { 'use strict';
11
-
12
- $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
13
- Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
14
- Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
15
-
16
- function _defineProperties(target, props) {
17
- for (var i = 0; i < props.length; i++) {
18
- var descriptor = props[i];
19
- descriptor.enumerable = descriptor.enumerable || false;
20
- descriptor.configurable = true;
21
- if ("value" in descriptor) descriptor.writable = true;
22
- Object.defineProperty(target, descriptor.key, descriptor);
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./base-component.js')) :
8
+ typeof define === 'function' && define.amd ? define(['@popperjs/core', './dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global.Popper, global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
10
+ }(this, (function (Popper, Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict';
11
+
12
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
+
14
+ function _interopNamespace(e) {
15
+ if (e && e.__esModule) return e;
16
+ var n = Object.create(null);
17
+ if (e) {
18
+ Object.keys(e).forEach(function (k) {
19
+ if (k !== 'default') {
20
+ var d = Object.getOwnPropertyDescriptor(e, k);
21
+ Object.defineProperty(n, k, d.get ? d : {
22
+ enumerable: true,
23
+ get: function () {
24
+ return e[k];
25
+ }
26
+ });
27
+ }
28
+ });
23
29
  }
30
+ n['default'] = e;
31
+ return Object.freeze(n);
24
32
  }
25
33
 
26
- function _createClass(Constructor, protoProps, staticProps) {
27
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
28
- if (staticProps) _defineProperties(Constructor, staticProps);
29
- return Constructor;
30
- }
34
+ var Popper__namespace = /*#__PURE__*/_interopNamespace(Popper);
35
+ var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
36
+ var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
37
+ var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
38
+ var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
39
+ var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
31
40
 
32
- function _defineProperty(obj, key, value) {
33
- if (key in obj) {
34
- Object.defineProperty(obj, key, {
35
- value: value,
36
- enumerable: true,
37
- configurable: true,
38
- writable: true
39
- });
41
+ /**
42
+ * --------------------------------------------------------------------------
43
+ * Bootstrap (v5.1.0): util/index.js
44
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
45
+ * --------------------------------------------------------------------------
46
+ */
47
+ const MAX_UID = 1000000;
48
+
49
+ const toType = obj => {
50
+ if (obj === null || obj === undefined) {
51
+ return `${obj}`;
52
+ }
53
+
54
+ return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
55
+ };
56
+ /**
57
+ * --------------------------------------------------------------------------
58
+ * Public Util Api
59
+ * --------------------------------------------------------------------------
60
+ */
61
+
62
+
63
+ const getUID = prefix => {
64
+ do {
65
+ prefix += Math.floor(Math.random() * MAX_UID);
66
+ } while (document.getElementById(prefix));
67
+
68
+ return prefix;
69
+ };
70
+
71
+ const isElement = obj => {
72
+ if (!obj || typeof obj !== 'object') {
73
+ return false;
74
+ }
75
+
76
+ if (typeof obj.jquery !== 'undefined') {
77
+ obj = obj[0];
78
+ }
79
+
80
+ return typeof obj.nodeType !== 'undefined';
81
+ };
82
+
83
+ const getElement = obj => {
84
+ if (isElement(obj)) {
85
+ // it's a jQuery object or a node element
86
+ return obj.jquery ? obj[0] : obj;
87
+ }
88
+
89
+ if (typeof obj === 'string' && obj.length > 0) {
90
+ return document.querySelector(obj);
91
+ }
92
+
93
+ return null;
94
+ };
95
+
96
+ const typeCheckConfig = (componentName, config, configTypes) => {
97
+ Object.keys(configTypes).forEach(property => {
98
+ const expectedTypes = configTypes[property];
99
+ const value = config[property];
100
+ const valueType = value && isElement(value) ? 'element' : toType(value);
101
+
102
+ if (!new RegExp(expectedTypes).test(valueType)) {
103
+ throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
104
+ }
105
+ });
106
+ };
107
+
108
+ const findShadowRoot = element => {
109
+ if (!document.documentElement.attachShadow) {
110
+ return null;
111
+ } // Can find the shadow root otherwise it'll return the document
112
+
113
+
114
+ if (typeof element.getRootNode === 'function') {
115
+ const root = element.getRootNode();
116
+ return root instanceof ShadowRoot ? root : null;
117
+ }
118
+
119
+ if (element instanceof ShadowRoot) {
120
+ return element;
121
+ } // when we don't find a shadow root
122
+
123
+
124
+ if (!element.parentNode) {
125
+ return null;
126
+ }
127
+
128
+ return findShadowRoot(element.parentNode);
129
+ };
130
+
131
+ const noop = () => {};
132
+
133
+ const getjQuery = () => {
134
+ const {
135
+ jQuery
136
+ } = window;
137
+
138
+ if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
139
+ return jQuery;
140
+ }
141
+
142
+ return null;
143
+ };
144
+
145
+ const DOMContentLoadedCallbacks = [];
146
+
147
+ const onDOMContentLoaded = callback => {
148
+ if (document.readyState === 'loading') {
149
+ // add listener on the first call when the document is in loading state
150
+ if (!DOMContentLoadedCallbacks.length) {
151
+ document.addEventListener('DOMContentLoaded', () => {
152
+ DOMContentLoadedCallbacks.forEach(callback => callback());
153
+ });
154
+ }
155
+
156
+ DOMContentLoadedCallbacks.push(callback);
40
157
  } else {
41
- obj[key] = value;
158
+ callback();
42
159
  }
160
+ };
43
161
 
44
- return obj;
45
- }
162
+ const isRTL = () => document.documentElement.dir === 'rtl';
163
+
164
+ const defineJQueryPlugin = plugin => {
165
+ onDOMContentLoaded(() => {
166
+ const $ = getjQuery();
167
+ /* istanbul ignore if */
46
168
 
47
- function _objectSpread(target) {
48
- for (var i = 1; i < arguments.length; i++) {
49
- var source = arguments[i] != null ? arguments[i] : {};
50
- var ownKeys = Object.keys(source);
169
+ if ($) {
170
+ const name = plugin.NAME;
171
+ const JQUERY_NO_CONFLICT = $.fn[name];
172
+ $.fn[name] = plugin.jQueryInterface;
173
+ $.fn[name].Constructor = plugin;
51
174
 
52
- if (typeof Object.getOwnPropertySymbols === 'function') {
53
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
54
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
55
- }));
175
+ $.fn[name].noConflict = () => {
176
+ $.fn[name] = JQUERY_NO_CONFLICT;
177
+ return plugin.jQueryInterface;
178
+ };
56
179
  }
180
+ });
181
+ };
57
182
 
58
- ownKeys.forEach(function (key) {
59
- _defineProperty(target, key, source[key]);
183
+ /**
184
+ * --------------------------------------------------------------------------
185
+ * Bootstrap (v5.1.0): util/sanitizer.js
186
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
187
+ * --------------------------------------------------------------------------
188
+ */
189
+ const uriAttrs = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
190
+ const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
191
+ /**
192
+ * A pattern that recognizes a commonly useful subset of URLs that are safe.
193
+ *
194
+ * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
195
+ */
196
+
197
+ const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i;
198
+ /**
199
+ * A pattern that matches safe data URLs. Only matches image, video and audio types.
200
+ *
201
+ * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
202
+ */
203
+
204
+ const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
205
+
206
+ const allowedAttribute = (attr, allowedAttributeList) => {
207
+ const attrName = attr.nodeName.toLowerCase();
208
+
209
+ if (allowedAttributeList.includes(attrName)) {
210
+ if (uriAttrs.has(attrName)) {
211
+ return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue));
212
+ }
213
+
214
+ return true;
215
+ }
216
+
217
+ const regExp = allowedAttributeList.filter(attrRegex => attrRegex instanceof RegExp); // Check if a regular expression validates the attribute.
218
+
219
+ for (let i = 0, len = regExp.length; i < len; i++) {
220
+ if (regExp[i].test(attrName)) {
221
+ return true;
222
+ }
223
+ }
224
+
225
+ return false;
226
+ };
227
+
228
+ const DefaultAllowlist = {
229
+ // Global attributes allowed on any supplied element below.
230
+ '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
231
+ a: ['target', 'href', 'title', 'rel'],
232
+ area: [],
233
+ b: [],
234
+ br: [],
235
+ col: [],
236
+ code: [],
237
+ div: [],
238
+ em: [],
239
+ hr: [],
240
+ h1: [],
241
+ h2: [],
242
+ h3: [],
243
+ h4: [],
244
+ h5: [],
245
+ h6: [],
246
+ i: [],
247
+ img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
248
+ li: [],
249
+ ol: [],
250
+ p: [],
251
+ pre: [],
252
+ s: [],
253
+ small: [],
254
+ span: [],
255
+ sub: [],
256
+ sup: [],
257
+ strong: [],
258
+ u: [],
259
+ ul: []
260
+ };
261
+ function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
262
+ if (!unsafeHtml.length) {
263
+ return unsafeHtml;
264
+ }
265
+
266
+ if (sanitizeFn && typeof sanitizeFn === 'function') {
267
+ return sanitizeFn(unsafeHtml);
268
+ }
269
+
270
+ const domParser = new window.DOMParser();
271
+ const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
272
+ const allowlistKeys = Object.keys(allowList);
273
+ const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
274
+
275
+ for (let i = 0, len = elements.length; i < len; i++) {
276
+ const el = elements[i];
277
+ const elName = el.nodeName.toLowerCase();
278
+
279
+ if (!allowlistKeys.includes(elName)) {
280
+ el.remove();
281
+ continue;
282
+ }
283
+
284
+ const attributeList = [].concat(...el.attributes);
285
+ const allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []);
286
+ attributeList.forEach(attr => {
287
+ if (!allowedAttribute(attr, allowedAttributes)) {
288
+ el.removeAttribute(attr.nodeName);
289
+ }
60
290
  });
61
291
  }
62
292
 
63
- return target;
293
+ return createdDocument.body.innerHTML;
64
294
  }
65
295
 
296
+ /**
297
+ * --------------------------------------------------------------------------
298
+ * Bootstrap (v5.1.0): tooltip.js
299
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
300
+ * --------------------------------------------------------------------------
301
+ */
66
302
  /**
67
303
  * ------------------------------------------------------------------------
68
304
  * Constants
69
305
  * ------------------------------------------------------------------------
70
306
  */
71
307
 
72
- var NAME = 'tooltip';
73
- var VERSION = '4.3.0';
74
- var DATA_KEY = 'bs.tooltip';
75
- var EVENT_KEY = "." + DATA_KEY;
76
- var JQUERY_NO_CONFLICT = $.fn[NAME];
77
- var CLASS_PREFIX = 'bs-tooltip';
78
- var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
79
- var DefaultType = {
308
+ const NAME = 'tooltip';
309
+ const DATA_KEY = 'bs.tooltip';
310
+ const EVENT_KEY = `.${DATA_KEY}`;
311
+ const CLASS_PREFIX = 'bs-tooltip';
312
+ const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
313
+ const DefaultType = {
80
314
  animation: 'boolean',
81
315
  template: 'string',
82
316
  title: '(string|element|function)',
@@ -85,82 +319,79 @@
85
319
  html: 'boolean',
86
320
  selector: '(string|boolean)',
87
321
  placement: '(string|function)',
88
- offset: '(number|string|function)',
322
+ offset: '(array|string|function)',
89
323
  container: '(string|element|boolean)',
90
- fallbackPlacement: '(string|array)',
91
- boundary: '(string|element)'
324
+ fallbackPlacements: 'array',
325
+ boundary: '(string|element)',
326
+ customClass: '(string|function)',
327
+ sanitize: 'boolean',
328
+ sanitizeFn: '(null|function)',
329
+ allowList: 'object',
330
+ popperConfig: '(null|object|function)'
92
331
  };
93
- var AttachmentMap = {
332
+ const AttachmentMap = {
94
333
  AUTO: 'auto',
95
334
  TOP: 'top',
96
- RIGHT: 'right',
335
+ RIGHT: isRTL() ? 'left' : 'right',
97
336
  BOTTOM: 'bottom',
98
- LEFT: 'left'
337
+ LEFT: isRTL() ? 'right' : 'left'
99
338
  };
100
- var Default = {
339
+ const Default = {
101
340
  animation: true,
102
- template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
341
+ template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
103
342
  trigger: 'hover focus',
104
343
  title: '',
105
344
  delay: 0,
106
345
  html: false,
107
346
  selector: false,
108
347
  placement: 'top',
109
- offset: 0,
348
+ offset: [0, 0],
110
349
  container: false,
111
- fallbackPlacement: 'flip',
112
- boundary: 'scrollParent'
113
- };
114
- var HoverState = {
115
- SHOW: 'show',
116
- OUT: 'out'
117
- };
118
- var Event = {
119
- HIDE: "hide" + EVENT_KEY,
120
- HIDDEN: "hidden" + EVENT_KEY,
121
- SHOW: "show" + EVENT_KEY,
122
- SHOWN: "shown" + EVENT_KEY,
123
- INSERTED: "inserted" + EVENT_KEY,
124
- CLICK: "click" + EVENT_KEY,
125
- FOCUSIN: "focusin" + EVENT_KEY,
126
- FOCUSOUT: "focusout" + EVENT_KEY,
127
- MOUSEENTER: "mouseenter" + EVENT_KEY,
128
- MOUSELEAVE: "mouseleave" + EVENT_KEY
129
- };
130
- var ClassName = {
131
- FADE: 'fade',
132
- SHOW: 'show'
133
- };
134
- var Selector = {
135
- TOOLTIP: '.tooltip',
136
- TOOLTIP_INNER: '.tooltip-inner',
137
- ARROW: '.arrow'
350
+ fallbackPlacements: ['top', 'right', 'bottom', 'left'],
351
+ boundary: 'clippingParents',
352
+ customClass: '',
353
+ sanitize: true,
354
+ sanitizeFn: null,
355
+ allowList: DefaultAllowlist,
356
+ popperConfig: null
138
357
  };
139
- var Trigger = {
140
- HOVER: 'hover',
141
- FOCUS: 'focus',
142
- CLICK: 'click',
143
- MANUAL: 'manual'
144
- /**
145
- * ------------------------------------------------------------------------
146
- * Class Definition
147
- * ------------------------------------------------------------------------
148
- */
149
-
358
+ const Event = {
359
+ HIDE: `hide${EVENT_KEY}`,
360
+ HIDDEN: `hidden${EVENT_KEY}`,
361
+ SHOW: `show${EVENT_KEY}`,
362
+ SHOWN: `shown${EVENT_KEY}`,
363
+ INSERTED: `inserted${EVENT_KEY}`,
364
+ CLICK: `click${EVENT_KEY}`,
365
+ FOCUSIN: `focusin${EVENT_KEY}`,
366
+ FOCUSOUT: `focusout${EVENT_KEY}`,
367
+ MOUSEENTER: `mouseenter${EVENT_KEY}`,
368
+ MOUSELEAVE: `mouseleave${EVENT_KEY}`
150
369
  };
370
+ const CLASS_NAME_FADE = 'fade';
371
+ const CLASS_NAME_MODAL = 'modal';
372
+ const CLASS_NAME_SHOW = 'show';
373
+ const HOVER_STATE_SHOW = 'show';
374
+ const HOVER_STATE_OUT = 'out';
375
+ const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
376
+ const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
377
+ const EVENT_MODAL_HIDE = 'hide.bs.modal';
378
+ const TRIGGER_HOVER = 'hover';
379
+ const TRIGGER_FOCUS = 'focus';
380
+ const TRIGGER_CLICK = 'click';
381
+ const TRIGGER_MANUAL = 'manual';
382
+ /**
383
+ * ------------------------------------------------------------------------
384
+ * Class Definition
385
+ * ------------------------------------------------------------------------
386
+ */
151
387
 
152
- var Tooltip =
153
- /*#__PURE__*/
154
- function () {
155
- function Tooltip(element, config) {
156
- /**
157
- * Check for Popper dependency
158
- * Popper - https://popper.js.org
159
- */
160
- if (typeof Popper === 'undefined') {
161
- throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
162
- } // private
388
+ class Tooltip extends BaseComponent__default['default'] {
389
+ constructor(element, config) {
390
+ if (typeof Popper__namespace === 'undefined') {
391
+ throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
392
+ }
163
393
 
394
+ super(element); // private
164
395
 
165
396
  this._isEnabled = true;
166
397
  this._timeout = 0;
@@ -168,42 +399,49 @@
168
399
  this._activeTrigger = {};
169
400
  this._popper = null; // Protected
170
401
 
171
- this.element = element;
172
- this.config = this._getConfig(config);
402
+ this._config = this._getConfig(config);
173
403
  this.tip = null;
174
404
 
175
405
  this._setListeners();
176
406
  } // Getters
177
407
 
178
408
 
179
- var _proto = Tooltip.prototype;
409
+ static get Default() {
410
+ return Default;
411
+ }
412
+
413
+ static get NAME() {
414
+ return NAME;
415
+ }
416
+
417
+ static get Event() {
418
+ return Event;
419
+ }
420
+
421
+ static get DefaultType() {
422
+ return DefaultType;
423
+ } // Public
424
+
180
425
 
181
- // Public
182
- _proto.enable = function enable() {
426
+ enable() {
183
427
  this._isEnabled = true;
184
- };
428
+ }
185
429
 
186
- _proto.disable = function disable() {
430
+ disable() {
187
431
  this._isEnabled = false;
188
- };
432
+ }
189
433
 
190
- _proto.toggleEnabled = function toggleEnabled() {
434
+ toggleEnabled() {
191
435
  this._isEnabled = !this._isEnabled;
192
- };
436
+ }
193
437
 
194
- _proto.toggle = function toggle(event) {
438
+ toggle(event) {
195
439
  if (!this._isEnabled) {
196
440
  return;
197
441
  }
198
442
 
199
443
  if (event) {
200
- var dataKey = this.constructor.DATA_KEY;
201
- var context = $(event.currentTarget).data(dataKey);
202
-
203
- if (!context) {
204
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
205
- $(event.currentTarget).data(dataKey, context);
206
- }
444
+ const context = this._initializeOnDelegatedTarget(event);
207
445
 
208
446
  context._activeTrigger.click = !context._activeTrigger.click;
209
447
 
@@ -213,7 +451,7 @@
213
451
  context._leave(null, context);
214
452
  }
215
453
  } else {
216
- if ($(this.getTipElement()).hasClass(ClassName.SHOW)) {
454
+ if (this.getTipElement().classList.contains(CLASS_NAME_SHOW)) {
217
455
  this._leave(null, this);
218
456
 
219
457
  return;
@@ -221,359 +459,400 @@
221
459
 
222
460
  this._enter(null, this);
223
461
  }
224
- };
462
+ }
225
463
 
226
- _proto.dispose = function dispose() {
464
+ dispose() {
227
465
  clearTimeout(this._timeout);
228
- $.removeData(this.element, this.constructor.DATA_KEY);
229
- $(this.element).off(this.constructor.EVENT_KEY);
230
- $(this.element).closest('.modal').off('hide.bs.modal');
466
+ EventHandler__default['default'].off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
231
467
 
232
468
  if (this.tip) {
233
- $(this.tip).remove();
469
+ this.tip.remove();
234
470
  }
235
471
 
236
- this._isEnabled = null;
237
- this._timeout = null;
238
- this._hoverState = null;
239
- this._activeTrigger = null;
240
-
241
- if (this._popper !== null) {
472
+ if (this._popper) {
242
473
  this._popper.destroy();
243
474
  }
244
475
 
245
- this._popper = null;
246
- this.element = null;
247
- this.config = null;
248
- this.tip = null;
249
- };
250
-
251
- _proto.show = function show() {
252
- var _this = this;
476
+ super.dispose();
477
+ }
253
478
 
254
- if ($(this.element).css('display') === 'none') {
479
+ show() {
480
+ if (this._element.style.display === 'none') {
255
481
  throw new Error('Please use show on visible elements');
256
482
  }
257
483
 
258
- var showEvent = $.Event(this.constructor.Event.SHOW);
484
+ if (!(this.isWithContent() && this._isEnabled)) {
485
+ return;
486
+ }
259
487
 
260
- if (this.isWithContent() && this._isEnabled) {
261
- $(this.element).trigger(showEvent);
262
- var shadowRoot = Util.findShadowRoot(this.element);
263
- var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
488
+ const showEvent = EventHandler__default['default'].trigger(this._element, this.constructor.Event.SHOW);
489
+ const shadowRoot = findShadowRoot(this._element);
490
+ const isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element);
264
491
 
265
- if (showEvent.isDefaultPrevented() || !isInTheDom) {
266
- return;
267
- }
492
+ if (showEvent.defaultPrevented || !isInTheDom) {
493
+ return;
494
+ }
268
495
 
269
- var tip = this.getTipElement();
270
- var tipId = Util.getUID(this.constructor.NAME);
271
- tip.setAttribute('id', tipId);
272
- this.element.setAttribute('aria-describedby', tipId);
273
- this.setContent();
496
+ const tip = this.getTipElement();
497
+ const tipId = getUID(this.constructor.NAME);
498
+ tip.setAttribute('id', tipId);
274
499
 
275
- if (this.config.animation) {
276
- $(tip).addClass(ClassName.FADE);
277
- }
500
+ this._element.setAttribute('aria-describedby', tipId);
501
+
502
+ if (this._config.animation) {
503
+ tip.classList.add(CLASS_NAME_FADE);
504
+ }
278
505
 
279
- var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
506
+ const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
280
507
 
281
- var attachment = this._getAttachment(placement);
508
+ const attachment = this._getAttachment(placement);
282
509
 
283
- this.addAttachmentClass(attachment);
510
+ this._addAttachmentClass(attachment);
284
511
 
285
- var container = this._getContainer();
512
+ const {
513
+ container
514
+ } = this._config;
515
+ Data__default['default'].set(tip, this.constructor.DATA_KEY, this);
286
516
 
287
- $(tip).data(this.constructor.DATA_KEY, this);
517
+ if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
518
+ container.append(tip);
519
+ EventHandler__default['default'].trigger(this._element, this.constructor.Event.INSERTED);
520
+ }
288
521
 
289
- if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
290
- $(tip).appendTo(container);
291
- }
522
+ if (this._popper) {
523
+ this._popper.update();
524
+ } else {
525
+ this._popper = Popper__namespace.createPopper(this._element, tip, this._getPopperConfig(attachment));
526
+ }
292
527
 
293
- $(this.element).trigger(this.constructor.Event.INSERTED);
294
- this._popper = new Popper(this.element, tip, {
295
- placement: attachment,
296
- modifiers: {
297
- offset: this._getOffset(),
298
- flip: {
299
- behavior: this.config.fallbackPlacement
300
- },
301
- arrow: {
302
- element: Selector.ARROW
303
- },
304
- preventOverflow: {
305
- boundariesElement: this.config.boundary
306
- }
307
- },
308
- onCreate: function onCreate(data) {
309
- if (data.originalPlacement !== data.placement) {
310
- _this._handlePopperPlacementChange(data);
311
- }
312
- },
313
- onUpdate: function onUpdate(data) {
314
- return _this._handlePopperPlacementChange(data);
315
- }
316
- });
317
- $(tip).addClass(ClassName.SHOW); // If this is a touch-enabled device we add extra
318
- // empty mouseover listeners to the body's immediate children;
319
- // only needed because of broken event delegation on iOS
320
- // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
528
+ tip.classList.add(CLASS_NAME_SHOW);
321
529
 
322
- if ('ontouchstart' in document.documentElement) {
323
- $(document.body).children().on('mouseover', null, $.noop);
324
- }
530
+ const customClass = this._resolvePossibleFunction(this._config.customClass);
325
531
 
326
- var complete = function complete() {
327
- if (_this.config.animation) {
328
- _this._fixTransition();
329
- }
532
+ if (customClass) {
533
+ tip.classList.add(...customClass.split(' '));
534
+ } // If this is a touch-enabled device we add extra
535
+ // empty mouseover listeners to the body's immediate children;
536
+ // only needed because of broken event delegation on iOS
537
+ // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
330
538
 
331
- var prevHoverState = _this._hoverState;
332
- _this._hoverState = null;
333
- $(_this.element).trigger(_this.constructor.Event.SHOWN);
334
539
 
335
- if (prevHoverState === HoverState.OUT) {
336
- _this._leave(null, _this);
337
- }
338
- };
540
+ if ('ontouchstart' in document.documentElement) {
541
+ [].concat(...document.body.children).forEach(element => {
542
+ EventHandler__default['default'].on(element, 'mouseover', noop);
543
+ });
544
+ }
339
545
 
340
- if ($(this.tip).hasClass(ClassName.FADE)) {
341
- var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
342
- $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
343
- } else {
344
- complete();
546
+ const complete = () => {
547
+ const prevHoverState = this._hoverState;
548
+ this._hoverState = null;
549
+ EventHandler__default['default'].trigger(this._element, this.constructor.Event.SHOWN);
550
+
551
+ if (prevHoverState === HOVER_STATE_OUT) {
552
+ this._leave(null, this);
345
553
  }
554
+ };
555
+
556
+ const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE);
557
+
558
+ this._queueCallback(complete, this.tip, isAnimated);
559
+ }
560
+
561
+ hide() {
562
+ if (!this._popper) {
563
+ return;
346
564
  }
347
- };
348
565
 
349
- _proto.hide = function hide(callback) {
350
- var _this2 = this;
566
+ const tip = this.getTipElement();
351
567
 
352
- var tip = this.getTipElement();
353
- var hideEvent = $.Event(this.constructor.Event.HIDE);
568
+ const complete = () => {
569
+ if (this._isWithActiveTrigger()) {
570
+ return;
571
+ }
354
572
 
355
- var complete = function complete() {
356
- if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
357
- tip.parentNode.removeChild(tip);
573
+ if (this._hoverState !== HOVER_STATE_SHOW) {
574
+ tip.remove();
358
575
  }
359
576
 
360
- _this2._cleanTipClass();
577
+ this._cleanTipClass();
361
578
 
362
- _this2.element.removeAttribute('aria-describedby');
579
+ this._element.removeAttribute('aria-describedby');
363
580
 
364
- $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
581
+ EventHandler__default['default'].trigger(this._element, this.constructor.Event.HIDDEN);
365
582
 
366
- if (_this2._popper !== null) {
367
- _this2._popper.destroy();
368
- }
583
+ if (this._popper) {
584
+ this._popper.destroy();
369
585
 
370
- if (callback) {
371
- callback();
586
+ this._popper = null;
372
587
  }
373
588
  };
374
589
 
375
- $(this.element).trigger(hideEvent);
590
+ const hideEvent = EventHandler__default['default'].trigger(this._element, this.constructor.Event.HIDE);
376
591
 
377
- if (hideEvent.isDefaultPrevented()) {
592
+ if (hideEvent.defaultPrevented) {
378
593
  return;
379
594
  }
380
595
 
381
- $(tip).removeClass(ClassName.SHOW); // If this is a touch-enabled device we remove the extra
596
+ tip.classList.remove(CLASS_NAME_SHOW); // If this is a touch-enabled device we remove the extra
382
597
  // empty mouseover listeners we added for iOS support
383
598
 
384
599
  if ('ontouchstart' in document.documentElement) {
385
- $(document.body).children().off('mouseover', null, $.noop);
600
+ [].concat(...document.body.children).forEach(element => EventHandler__default['default'].off(element, 'mouseover', noop));
386
601
  }
387
602
 
388
- this._activeTrigger[Trigger.CLICK] = false;
389
- this._activeTrigger[Trigger.FOCUS] = false;
390
- this._activeTrigger[Trigger.HOVER] = false;
603
+ this._activeTrigger[TRIGGER_CLICK] = false;
604
+ this._activeTrigger[TRIGGER_FOCUS] = false;
605
+ this._activeTrigger[TRIGGER_HOVER] = false;
606
+ const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE);
391
607
 
392
- if ($(this.tip).hasClass(ClassName.FADE)) {
393
- var transitionDuration = Util.getTransitionDurationFromElement(tip);
394
- $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
395
- } else {
396
- complete();
397
- }
608
+ this._queueCallback(complete, this.tip, isAnimated);
398
609
 
399
610
  this._hoverState = '';
400
- };
611
+ }
401
612
 
402
- _proto.update = function update() {
613
+ update() {
403
614
  if (this._popper !== null) {
404
- this._popper.scheduleUpdate();
615
+ this._popper.update();
405
616
  }
406
617
  } // Protected
407
- ;
408
618
 
409
- _proto.isWithContent = function isWithContent() {
619
+
620
+ isWithContent() {
410
621
  return Boolean(this.getTitle());
411
- };
622
+ }
412
623
 
413
- _proto.addAttachmentClass = function addAttachmentClass(attachment) {
414
- $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
415
- };
624
+ getTipElement() {
625
+ if (this.tip) {
626
+ return this.tip;
627
+ }
416
628
 
417
- _proto.getTipElement = function getTipElement() {
418
- this.tip = this.tip || $(this.config.template)[0];
629
+ const element = document.createElement('div');
630
+ element.innerHTML = this._config.template;
631
+ const tip = element.children[0];
632
+ this.setContent(tip);
633
+ tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
634
+ this.tip = tip;
419
635
  return this.tip;
420
- };
421
-
422
- _proto.setContent = function setContent() {
423
- var tip = this.getTipElement();
424
- this.setElementContent($(tip.querySelectorAll(Selector.TOOLTIP_INNER)), this.getTitle());
425
- $(tip).removeClass(ClassName.FADE + " " + ClassName.SHOW);
426
- };
427
-
428
- _proto.setElementContent = function setElementContent($element, content) {
429
- var html = this.config.html;
430
-
431
- if (typeof content === 'object' && (content.nodeType || content.jquery)) {
432
- // Content is a DOM node or a jQuery
433
- if (html) {
434
- if (!$(content).parent().is($element)) {
435
- $element.empty().append(content);
636
+ }
637
+
638
+ setContent(tip) {
639
+ this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER);
640
+ }
641
+
642
+ _sanitizeAndSetContent(template, content, selector) {
643
+ const templateElement = SelectorEngine__default['default'].findOne(selector, template);
644
+
645
+ if (!content && templateElement) {
646
+ templateElement.remove();
647
+ return;
648
+ } // we use append for html objects to maintain js events
649
+
650
+
651
+ this.setElementContent(templateElement, content);
652
+ }
653
+
654
+ setElementContent(element, content) {
655
+ if (element === null) {
656
+ return;
657
+ }
658
+
659
+ if (isElement(content)) {
660
+ content = getElement(content); // content is a DOM node or a jQuery
661
+
662
+ if (this._config.html) {
663
+ if (content.parentNode !== element) {
664
+ element.innerHTML = '';
665
+ element.append(content);
436
666
  }
437
667
  } else {
438
- $element.text($(content).text());
668
+ element.textContent = content.textContent;
439
669
  }
670
+
671
+ return;
672
+ }
673
+
674
+ if (this._config.html) {
675
+ if (this._config.sanitize) {
676
+ content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn);
677
+ }
678
+
679
+ element.innerHTML = content;
440
680
  } else {
441
- $element[html ? 'html' : 'text'](content);
681
+ element.textContent = content;
442
682
  }
443
- };
683
+ }
684
+
685
+ getTitle() {
686
+ const title = this._element.getAttribute('data-bs-original-title') || this._config.title;
444
687
 
445
- _proto.getTitle = function getTitle() {
446
- var title = this.element.getAttribute('data-original-title');
688
+ return this._resolvePossibleFunction(title);
689
+ }
690
+
691
+ updateAttachment(attachment) {
692
+ if (attachment === 'right') {
693
+ return 'end';
694
+ }
447
695
 
448
- if (!title) {
449
- title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
696
+ if (attachment === 'left') {
697
+ return 'start';
450
698
  }
451
699
 
452
- return title;
700
+ return attachment;
453
701
  } // Private
454
- ;
455
702
 
456
- _proto._getOffset = function _getOffset() {
457
- var _this3 = this;
458
703
 
459
- var offset = {};
704
+ _initializeOnDelegatedTarget(event, context) {
705
+ return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
706
+ }
707
+
708
+ _getOffset() {
709
+ const {
710
+ offset
711
+ } = this._config;
460
712
 
461
- if (typeof this.config.offset === 'function') {
462
- offset.fn = function (data) {
463
- data.offsets = _objectSpread({}, data.offsets, _this3.config.offset(data.offsets, _this3.element) || {});
464
- return data;
465
- };
466
- } else {
467
- offset.offset = this.config.offset;
713
+ if (typeof offset === 'string') {
714
+ return offset.split(',').map(val => Number.parseInt(val, 10));
715
+ }
716
+
717
+ if (typeof offset === 'function') {
718
+ return popperData => offset(popperData, this._element);
468
719
  }
469
720
 
470
721
  return offset;
471
- };
722
+ }
472
723
 
473
- _proto._getContainer = function _getContainer() {
474
- if (this.config.container === false) {
475
- return document.body;
476
- }
724
+ _resolvePossibleFunction(content) {
725
+ return typeof content === 'function' ? content.call(this._element) : content;
726
+ }
477
727
 
478
- if (Util.isElement(this.config.container)) {
479
- return $(this.config.container);
480
- }
728
+ _getPopperConfig(attachment) {
729
+ const defaultBsPopperConfig = {
730
+ placement: attachment,
731
+ modifiers: [{
732
+ name: 'flip',
733
+ options: {
734
+ fallbackPlacements: this._config.fallbackPlacements
735
+ }
736
+ }, {
737
+ name: 'offset',
738
+ options: {
739
+ offset: this._getOffset()
740
+ }
741
+ }, {
742
+ name: 'preventOverflow',
743
+ options: {
744
+ boundary: this._config.boundary
745
+ }
746
+ }, {
747
+ name: 'arrow',
748
+ options: {
749
+ element: `.${this.constructor.NAME}-arrow`
750
+ }
751
+ }, {
752
+ name: 'onChange',
753
+ enabled: true,
754
+ phase: 'afterWrite',
755
+ fn: data => this._handlePopperPlacementChange(data)
756
+ }],
757
+ onFirstUpdate: data => {
758
+ if (data.options.placement !== data.placement) {
759
+ this._handlePopperPlacementChange(data);
760
+ }
761
+ }
762
+ };
763
+ return { ...defaultBsPopperConfig,
764
+ ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
765
+ };
766
+ }
481
767
 
482
- return $(document).find(this.config.container);
483
- };
768
+ _addAttachmentClass(attachment) {
769
+ this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`);
770
+ }
484
771
 
485
- _proto._getAttachment = function _getAttachment(placement) {
772
+ _getAttachment(placement) {
486
773
  return AttachmentMap[placement.toUpperCase()];
487
- };
774
+ }
488
775
 
489
- _proto._setListeners = function _setListeners() {
490
- var _this4 = this;
776
+ _setListeners() {
777
+ const triggers = this._config.trigger.split(' ');
491
778
 
492
- var triggers = this.config.trigger.split(' ');
493
- triggers.forEach(function (trigger) {
779
+ triggers.forEach(trigger => {
494
780
  if (trigger === 'click') {
495
- $(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, function (event) {
496
- return _this4.toggle(event);
497
- });
498
- } else if (trigger !== Trigger.MANUAL) {
499
- var eventIn = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN;
500
- var eventOut = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT;
501
- $(_this4.element).on(eventIn, _this4.config.selector, function (event) {
502
- return _this4._enter(event);
503
- }).on(eventOut, _this4.config.selector, function (event) {
504
- return _this4._leave(event);
505
- });
781
+ EventHandler__default['default'].on(this._element, this.constructor.Event.CLICK, this._config.selector, event => this.toggle(event));
782
+ } else if (trigger !== TRIGGER_MANUAL) {
783
+ const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN;
784
+ const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT;
785
+ EventHandler__default['default'].on(this._element, eventIn, this._config.selector, event => this._enter(event));
786
+ EventHandler__default['default'].on(this._element, eventOut, this._config.selector, event => this._leave(event));
506
787
  }
507
788
  });
508
- $(this.element).closest('.modal').on('hide.bs.modal', function () {
509
- if (_this4.element) {
510
- _this4.hide();
789
+
790
+ this._hideModalHandler = () => {
791
+ if (this._element) {
792
+ this.hide();
511
793
  }
512
- });
794
+ };
795
+
796
+ EventHandler__default['default'].on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
513
797
 
514
- if (this.config.selector) {
515
- this.config = _objectSpread({}, this.config, {
798
+ if (this._config.selector) {
799
+ this._config = { ...this._config,
516
800
  trigger: 'manual',
517
801
  selector: ''
518
- });
802
+ };
519
803
  } else {
520
804
  this._fixTitle();
521
805
  }
522
- };
806
+ }
523
807
 
524
- _proto._fixTitle = function _fixTitle() {
525
- var titleType = typeof this.element.getAttribute('data-original-title');
808
+ _fixTitle() {
809
+ const title = this._element.getAttribute('title');
526
810
 
527
- if (this.element.getAttribute('title') || titleType !== 'string') {
528
- this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
529
- this.element.setAttribute('title', '');
530
- }
531
- };
811
+ const originalTitleType = typeof this._element.getAttribute('data-bs-original-title');
532
812
 
533
- _proto._enter = function _enter(event, context) {
534
- var dataKey = this.constructor.DATA_KEY;
535
- context = context || $(event.currentTarget).data(dataKey);
813
+ if (title || originalTitleType !== 'string') {
814
+ this._element.setAttribute('data-bs-original-title', title || '');
815
+
816
+ if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) {
817
+ this._element.setAttribute('aria-label', title);
818
+ }
536
819
 
537
- if (!context) {
538
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
539
- $(event.currentTarget).data(dataKey, context);
820
+ this._element.setAttribute('title', '');
540
821
  }
822
+ }
823
+
824
+ _enter(event, context) {
825
+ context = this._initializeOnDelegatedTarget(event, context);
541
826
 
542
827
  if (event) {
543
- context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
828
+ context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
544
829
  }
545
830
 
546
- if ($(context.getTipElement()).hasClass(ClassName.SHOW) || context._hoverState === HoverState.SHOW) {
547
- context._hoverState = HoverState.SHOW;
831
+ if (context.getTipElement().classList.contains(CLASS_NAME_SHOW) || context._hoverState === HOVER_STATE_SHOW) {
832
+ context._hoverState = HOVER_STATE_SHOW;
548
833
  return;
549
834
  }
550
835
 
551
836
  clearTimeout(context._timeout);
552
- context._hoverState = HoverState.SHOW;
837
+ context._hoverState = HOVER_STATE_SHOW;
553
838
 
554
- if (!context.config.delay || !context.config.delay.show) {
839
+ if (!context._config.delay || !context._config.delay.show) {
555
840
  context.show();
556
841
  return;
557
842
  }
558
843
 
559
- context._timeout = setTimeout(function () {
560
- if (context._hoverState === HoverState.SHOW) {
844
+ context._timeout = setTimeout(() => {
845
+ if (context._hoverState === HOVER_STATE_SHOW) {
561
846
  context.show();
562
847
  }
563
- }, context.config.delay.show);
564
- };
565
-
566
- _proto._leave = function _leave(event, context) {
567
- var dataKey = this.constructor.DATA_KEY;
568
- context = context || $(event.currentTarget).data(dataKey);
848
+ }, context._config.delay.show);
849
+ }
569
850
 
570
- if (!context) {
571
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
572
- $(event.currentTarget).data(dataKey, context);
573
- }
851
+ _leave(event, context) {
852
+ context = this._initializeOnDelegatedTarget(event, context);
574
853
 
575
854
  if (event) {
576
- context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
855
+ context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
577
856
  }
578
857
 
579
858
  if (context._isWithActiveTrigger()) {
@@ -581,32 +860,42 @@
581
860
  }
582
861
 
583
862
  clearTimeout(context._timeout);
584
- context._hoverState = HoverState.OUT;
863
+ context._hoverState = HOVER_STATE_OUT;
585
864
 
586
- if (!context.config.delay || !context.config.delay.hide) {
865
+ if (!context._config.delay || !context._config.delay.hide) {
587
866
  context.hide();
588
867
  return;
589
868
  }
590
869
 
591
- context._timeout = setTimeout(function () {
592
- if (context._hoverState === HoverState.OUT) {
870
+ context._timeout = setTimeout(() => {
871
+ if (context._hoverState === HOVER_STATE_OUT) {
593
872
  context.hide();
594
873
  }
595
- }, context.config.delay.hide);
596
- };
874
+ }, context._config.delay.hide);
875
+ }
597
876
 
598
- _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
599
- for (var trigger in this._activeTrigger) {
877
+ _isWithActiveTrigger() {
878
+ for (const trigger in this._activeTrigger) {
600
879
  if (this._activeTrigger[trigger]) {
601
880
  return true;
602
881
  }
603
882
  }
604
883
 
605
884
  return false;
606
- };
885
+ }
607
886
 
608
- _proto._getConfig = function _getConfig(config) {
609
- config = _objectSpread({}, this.constructor.Default, $(this.element).data(), typeof config === 'object' && config ? config : {});
887
+ _getConfig(config) {
888
+ const dataAttributes = Manipulator__default['default'].getDataAttributes(this._element);
889
+ Object.keys(dataAttributes).forEach(dataAttr => {
890
+ if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
891
+ delete dataAttributes[dataAttr];
892
+ }
893
+ });
894
+ config = { ...this.constructor.Default,
895
+ ...dataAttributes,
896
+ ...(typeof config === 'object' && config ? config : {})
897
+ };
898
+ config.container = config.container === false ? document.body : getElement(config.container);
610
899
 
611
900
  if (typeof config.delay === 'number') {
612
901
  config.delay = {
@@ -623,137 +912,86 @@
623
912
  config.content = config.content.toString();
624
913
  }
625
914
 
626
- Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
915
+ typeCheckConfig(NAME, config, this.constructor.DefaultType);
916
+
917
+ if (config.sanitize) {
918
+ config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn);
919
+ }
920
+
627
921
  return config;
628
- };
922
+ }
629
923
 
630
- _proto._getDelegateConfig = function _getDelegateConfig() {
631
- var config = {};
924
+ _getDelegateConfig() {
925
+ const config = {};
632
926
 
633
- if (this.config) {
634
- for (var key in this.config) {
635
- if (this.constructor.Default[key] !== this.config[key]) {
636
- config[key] = this.config[key];
637
- }
927
+ for (const key in this._config) {
928
+ if (this.constructor.Default[key] !== this._config[key]) {
929
+ config[key] = this._config[key];
638
930
  }
639
- }
931
+ } // In the future can be replaced with:
932
+ // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
933
+ // `Object.fromEntries(keysWithDifferentValues)`
934
+
640
935
 
641
936
  return config;
642
- };
937
+ }
643
938
 
644
- _proto._cleanTipClass = function _cleanTipClass() {
645
- var $tip = $(this.getTipElement());
646
- var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
939
+ _cleanTipClass() {
940
+ const tip = this.getTipElement();
941
+ const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g');
942
+ const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex);
647
943
 
648
- if (tabClass !== null && tabClass.length) {
649
- $tip.removeClass(tabClass.join(''));
944
+ if (tabClass !== null && tabClass.length > 0) {
945
+ tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
650
946
  }
651
- };
652
-
653
- _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
654
- var popperInstance = popperData.instance;
655
- this.tip = popperInstance.popper;
656
-
657
- this._cleanTipClass();
947
+ }
658
948
 
659
- this.addAttachmentClass(this._getAttachment(popperData.placement));
660
- };
949
+ _getBasicClassPrefix() {
950
+ return CLASS_PREFIX;
951
+ }
661
952
 
662
- _proto._fixTransition = function _fixTransition() {
663
- var tip = this.getTipElement();
664
- var initConfigAnimation = this.config.animation;
953
+ _handlePopperPlacementChange(popperData) {
954
+ const {
955
+ state
956
+ } = popperData;
665
957
 
666
- if (tip.getAttribute('x-placement') !== null) {
958
+ if (!state) {
667
959
  return;
668
960
  }
669
961
 
670
- $(tip).removeClass(ClassName.FADE);
671
- this.config.animation = false;
672
- this.hide();
673
- this.show();
674
- this.config.animation = initConfigAnimation;
675
- } // Static
676
- ;
962
+ this.tip = state.elements.popper;
677
963
 
678
- Tooltip._jQueryInterface = function _jQueryInterface(config) {
679
- return this.each(function () {
680
- var data = $(this).data(DATA_KEY);
964
+ this._cleanTipClass();
681
965
 
682
- var _config = typeof config === 'object' && config;
966
+ this._addAttachmentClass(this._getAttachment(state.placement));
967
+ } // Static
683
968
 
684
- if (!data && /dispose|hide/.test(config)) {
685
- return;
686
- }
687
969
 
688
- if (!data) {
689
- data = new Tooltip(this, _config);
690
- $(this).data(DATA_KEY, data);
691
- }
970
+ static jQueryInterface(config) {
971
+ return this.each(function () {
972
+ const data = Tooltip.getOrCreateInstance(this, config);
692
973
 
693
974
  if (typeof config === 'string') {
694
975
  if (typeof data[config] === 'undefined') {
695
- throw new TypeError("No method named \"" + config + "\"");
976
+ throw new TypeError(`No method named "${config}"`);
696
977
  }
697
978
 
698
979
  data[config]();
699
980
  }
700
981
  });
701
- };
702
-
703
- _createClass(Tooltip, null, [{
704
- key: "VERSION",
705
- get: function get() {
706
- return VERSION;
707
- }
708
- }, {
709
- key: "Default",
710
- get: function get() {
711
- return Default;
712
- }
713
- }, {
714
- key: "NAME",
715
- get: function get() {
716
- return NAME;
717
- }
718
- }, {
719
- key: "DATA_KEY",
720
- get: function get() {
721
- return DATA_KEY;
722
- }
723
- }, {
724
- key: "Event",
725
- get: function get() {
726
- return Event;
727
- }
728
- }, {
729
- key: "EVENT_KEY",
730
- get: function get() {
731
- return EVENT_KEY;
732
- }
733
- }, {
734
- key: "DefaultType",
735
- get: function get() {
736
- return DefaultType;
737
- }
738
- }]);
739
-
740
- return Tooltip;
741
- }();
982
+ }
983
+
984
+ }
742
985
  /**
743
986
  * ------------------------------------------------------------------------
744
987
  * jQuery
745
988
  * ------------------------------------------------------------------------
989
+ * add .Tooltip to jQuery only if jQuery is present
746
990
  */
747
991
 
748
992
 
749
- $.fn[NAME] = Tooltip._jQueryInterface;
750
- $.fn[NAME].Constructor = Tooltip;
751
-
752
- $.fn[NAME].noConflict = function () {
753
- $.fn[NAME] = JQUERY_NO_CONFLICT;
754
- return Tooltip._jQueryInterface;
755
- };
993
+ defineJQueryPlugin(Tooltip);
756
994
 
757
995
  return Tooltip;
758
996
 
759
- }));
997
+ })));