@tabler/core 1.0.0-beta10 → 1.0.0-beta11

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 (398) hide show
  1. package/README.md +33 -11
  2. package/dist/css/demo.css +2 -2
  3. package/dist/css/demo.min.css +2 -2
  4. package/dist/css/demo.rtl.css +2 -2
  5. package/dist/css/demo.rtl.min.css +2 -2
  6. package/dist/css/tabler-flags.css +2 -2
  7. package/dist/css/tabler-flags.min.css +2 -2
  8. package/dist/css/tabler-flags.rtl.css +2 -2
  9. package/dist/css/tabler-flags.rtl.min.css +2 -2
  10. package/dist/css/tabler-payments.css +2 -2
  11. package/dist/css/tabler-payments.min.css +2 -2
  12. package/dist/css/tabler-payments.rtl.css +2 -2
  13. package/dist/css/tabler-payments.rtl.min.css +2 -2
  14. package/dist/css/tabler-vendors.css +143 -29
  15. package/dist/css/tabler-vendors.min.css +3 -3
  16. package/dist/css/tabler-vendors.rtl.css +143 -29
  17. package/dist/css/tabler-vendors.rtl.min.css +3 -3
  18. package/dist/css/tabler.css +5741 -2725
  19. package/dist/css/tabler.min.css +4 -4
  20. package/dist/css/tabler.rtl.css +5743 -2743
  21. package/dist/css/tabler.rtl.min.css +4 -4
  22. package/dist/js/demo.js +2 -2
  23. package/dist/js/demo.min.js +2 -2
  24. package/dist/js/tabler.esm.js +1637 -1515
  25. package/dist/js/tabler.esm.min.js +3 -3
  26. package/dist/js/tabler.js +1637 -1515
  27. package/dist/js/tabler.min.js +3 -3
  28. package/dist/libs/apexcharts/dist/apexcharts.amd.js +2 -0
  29. package/dist/libs/apexcharts/dist/apexcharts.common.js +14 -0
  30. package/dist/libs/apexcharts/dist/apexcharts.css +691 -0
  31. package/dist/libs/apexcharts/dist/apexcharts.esm.js +14 -0
  32. package/dist/libs/apexcharts/dist/apexcharts.js +31960 -0
  33. package/dist/libs/apexcharts/dist/apexcharts.min.js +4 -4
  34. package/dist/libs/apexcharts/dist/locales/ar.json +63 -0
  35. package/dist/libs/apexcharts/dist/locales/ca.json +55 -0
  36. package/dist/libs/apexcharts/dist/locales/cs.json +55 -0
  37. package/dist/libs/apexcharts/dist/locales/de.json +55 -0
  38. package/dist/libs/apexcharts/dist/locales/el.json +55 -0
  39. package/dist/libs/apexcharts/dist/locales/en.json +55 -0
  40. package/dist/libs/apexcharts/dist/locales/es.json +55 -0
  41. package/dist/libs/apexcharts/dist/locales/et.json +63 -0
  42. package/dist/libs/apexcharts/dist/locales/fa.json +55 -0
  43. package/dist/libs/apexcharts/dist/locales/fi.json +55 -0
  44. package/dist/libs/apexcharts/dist/locales/fr.json +55 -0
  45. package/dist/libs/apexcharts/dist/locales/he.json +55 -0
  46. package/dist/libs/apexcharts/dist/locales/hi.json +55 -0
  47. package/dist/libs/apexcharts/dist/locales/hr.json +55 -0
  48. package/dist/libs/apexcharts/dist/locales/hu.json +64 -0
  49. package/dist/libs/apexcharts/dist/locales/hy.json +55 -0
  50. package/dist/libs/apexcharts/dist/locales/id.json +47 -0
  51. package/dist/libs/apexcharts/dist/locales/it.json +55 -0
  52. package/dist/libs/apexcharts/dist/locales/ja.json +55 -0
  53. package/dist/libs/apexcharts/dist/locales/ka.json +55 -0
  54. package/dist/libs/apexcharts/dist/locales/ko.json +55 -0
  55. package/dist/libs/apexcharts/dist/locales/lt.json +55 -0
  56. package/dist/libs/apexcharts/dist/locales/lv.json +64 -0
  57. package/dist/libs/apexcharts/dist/locales/nb.json +55 -0
  58. package/dist/libs/apexcharts/dist/locales/nl.json +55 -0
  59. package/dist/libs/apexcharts/dist/locales/pl.json +55 -0
  60. package/dist/libs/apexcharts/dist/locales/pt-br.json +55 -0
  61. package/dist/libs/apexcharts/dist/locales/pt.json +55 -0
  62. package/dist/libs/apexcharts/dist/locales/rs.json +55 -0
  63. package/dist/libs/apexcharts/dist/locales/ru.json +55 -0
  64. package/dist/libs/apexcharts/dist/locales/se.json +55 -0
  65. package/dist/libs/apexcharts/dist/locales/sk.json +55 -0
  66. package/dist/libs/apexcharts/dist/locales/sl.json +55 -0
  67. package/dist/libs/apexcharts/dist/locales/sq.json +55 -0
  68. package/dist/libs/apexcharts/dist/locales/th.json +55 -0
  69. package/dist/libs/apexcharts/dist/locales/tr.json +55 -0
  70. package/dist/libs/apexcharts/dist/locales/ua.json +55 -0
  71. package/dist/libs/apexcharts/dist/locales/zh-cn.json +55 -0
  72. package/dist/libs/apexcharts/dist/locales/zh-tw.json +55 -0
  73. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.js +7066 -0
  74. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.js.map +1 -0
  75. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js +3 -3
  76. package/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js.map +1 -0
  77. package/dist/libs/bootstrap/dist/js/bootstrap.esm.js +5204 -0
  78. package/dist/libs/bootstrap/dist/js/bootstrap.esm.js.map +1 -0
  79. package/dist/libs/bootstrap/dist/js/bootstrap.esm.min.js +7 -0
  80. package/dist/libs/bootstrap/dist/js/bootstrap.esm.min.js.map +1 -0
  81. package/dist/libs/bootstrap/dist/js/bootstrap.js +5251 -0
  82. package/dist/libs/bootstrap/dist/js/bootstrap.js.map +1 -0
  83. package/dist/libs/bootstrap/dist/js/bootstrap.min.js +7 -0
  84. package/dist/libs/bootstrap/dist/js/bootstrap.min.js.map +1 -0
  85. package/dist/libs/countup.js/dist/countUp.d.ts +61 -0
  86. package/dist/libs/countup.js/dist/countUp.js +25 -22
  87. package/dist/libs/countup.js/dist/countUp.min.js +1 -0
  88. package/dist/libs/countup.js/dist/countUp.umd.js +293 -0
  89. package/dist/libs/countup.js/dist/countUp.withPolyfill.min.js +1 -0
  90. package/dist/libs/dropzone/dist/basic.css +1 -0
  91. package/dist/libs/dropzone/dist/basic.css.map +1 -0
  92. package/dist/libs/dropzone/dist/dropzone-min.js +2 -0
  93. package/dist/libs/dropzone/dist/dropzone-min.js.map +1 -0
  94. package/dist/libs/dropzone/dist/dropzone.css +1 -0
  95. package/dist/libs/dropzone/dist/dropzone.css.map +1 -0
  96. package/dist/libs/dropzone/dist/dropzone.js +3068 -0
  97. package/dist/libs/dropzone/dist/dropzone.js.map +1 -0
  98. package/dist/libs/dropzone/dist/dropzone.mjs +2111 -0
  99. package/dist/libs/dropzone/dist/dropzone.mjs.map +1 -0
  100. package/dist/libs/fslightbox/LICENSE +21 -0
  101. package/dist/libs/fslightbox/README.md +62 -0
  102. package/dist/libs/fslightbox/index.js +1 -0
  103. package/dist/libs/fslightbox/jest-setup.js +1 -0
  104. package/dist/libs/fslightbox/package.json +72 -0
  105. package/dist/libs/jsvectormap/dist/js/jsvectormap.js +2663 -0
  106. package/dist/libs/jsvectormap/dist/js/jsvectormap.min.js +1 -1
  107. package/dist/libs/jsvectormap/dist/maps/world-merc.js +1 -1
  108. package/dist/libs/jsvectormap/dist/maps/world.js +1 -1
  109. package/dist/libs/list.js/dist/list.js +2020 -0
  110. package/dist/libs/list.js/dist/list.js.map +1 -0
  111. package/dist/libs/list.js/dist/list.min.js.map +1 -0
  112. package/dist/libs/litepicker/dist/bundle.js +52 -0
  113. package/dist/libs/litepicker/dist/css/litepicker.css +13 -0
  114. package/dist/libs/litepicker/dist/css/plugins/keyboardnav.js.css +12 -0
  115. package/dist/libs/litepicker/dist/css/plugins/mobilefriendly.js.css +133 -0
  116. package/dist/libs/litepicker/dist/css/plugins/multiselect.js.css +54 -0
  117. package/dist/libs/litepicker/dist/css/plugins/ranges.js.css +81 -0
  118. package/dist/libs/litepicker/dist/js/main.js +13 -0
  119. package/dist/libs/litepicker/dist/litepicker.amd.js +12 -0
  120. package/dist/libs/litepicker/dist/litepicker.commonjs2.js +12 -0
  121. package/dist/libs/litepicker/dist/litepicker.umd.js +12 -0
  122. package/dist/libs/litepicker/dist/nocss/litepicker.amd.js +12 -0
  123. package/dist/libs/litepicker/dist/nocss/litepicker.commonjs2.js +12 -0
  124. package/dist/libs/litepicker/dist/nocss/litepicker.js +12 -0
  125. package/dist/libs/litepicker/dist/nocss/litepicker.umd.js +12 -0
  126. package/dist/libs/litepicker/dist/nocss/plugins/keyboardnav.js +11 -0
  127. package/dist/libs/litepicker/dist/nocss/plugins/mobilefriendly.js +11 -0
  128. package/dist/libs/litepicker/dist/nocss/plugins/multiselect.js +11 -0
  129. package/dist/libs/litepicker/dist/nocss/plugins/ranges.js +11 -0
  130. package/dist/libs/litepicker/dist/plugins/keyboardnav.js +11 -0
  131. package/dist/libs/litepicker/dist/plugins/mobilefriendly.js +11 -0
  132. package/dist/libs/litepicker/dist/plugins/multiselect.js +11 -0
  133. package/dist/libs/litepicker/dist/plugins/ranges.js +11 -0
  134. package/dist/libs/litepicker/dist/types/calendar.d.ts +14 -0
  135. package/dist/libs/litepicker/dist/types/core.d.ts +23 -0
  136. package/dist/libs/litepicker/dist/types/datetime.d.ts +41 -0
  137. package/dist/libs/litepicker/dist/types/index.d.ts +4 -0
  138. package/dist/libs/litepicker/dist/types/interfaces.d.ts +80 -0
  139. package/dist/libs/litepicker/dist/types/litepicker.d.ts +25 -0
  140. package/dist/libs/litepicker/dist/types/methods.d.ts +20 -0
  141. package/dist/libs/litepicker/dist/types/utils.d.ts +4 -0
  142. package/dist/libs/litepicker/dist/types/window.d.ts +6 -0
  143. package/dist/libs/nouislider/dist/nouislider.css +304 -0
  144. package/dist/libs/nouislider/dist/nouislider.d.ts +198 -0
  145. package/dist/libs/nouislider/dist/nouislider.js +2254 -0
  146. package/dist/libs/nouislider/dist/nouislider.min.css +1 -0
  147. package/dist/libs/nouislider/dist/nouislider.min.js +1 -1
  148. package/dist/libs/nouislider/dist/nouislider.min.mjs +1 -0
  149. package/dist/libs/nouislider/dist/nouislider.mjs +2243 -0
  150. package/dist/libs/plyr/dist/plyr.css +1 -0
  151. package/dist/libs/plyr/dist/plyr.js +8764 -0
  152. package/dist/libs/plyr/dist/plyr.min.js +2 -0
  153. package/dist/libs/plyr/dist/plyr.min.js.map +1 -0
  154. package/dist/libs/plyr/dist/plyr.min.mjs +1 -0
  155. package/dist/libs/plyr/dist/plyr.min.mjs.map +1 -0
  156. package/dist/libs/plyr/dist/plyr.mjs +8756 -0
  157. package/dist/libs/plyr/dist/plyr.polyfilled.js +9301 -0
  158. package/dist/libs/plyr/dist/plyr.polyfilled.min.js +2 -0
  159. package/dist/libs/plyr/dist/plyr.polyfilled.min.js.map +1 -0
  160. package/dist/libs/plyr/dist/plyr.polyfilled.min.mjs +1 -0
  161. package/dist/libs/plyr/dist/plyr.polyfilled.min.mjs.map +1 -0
  162. package/dist/libs/plyr/dist/plyr.polyfilled.mjs +9293 -0
  163. package/dist/libs/plyr/dist/plyr.svg +1 -0
  164. package/dist/libs/tinymce/CHANGELOG.md +2957 -0
  165. package/dist/libs/tinymce/README.md +71 -0
  166. package/dist/libs/tinymce/bower.json +27 -0
  167. package/dist/libs/tinymce/composer.json +52 -0
  168. package/dist/libs/tinymce/icons/default/icons.js +182 -0
  169. package/dist/libs/tinymce/icons/default/icons.min.js +1 -0
  170. package/dist/libs/tinymce/icons/default/index.js +7 -0
  171. package/dist/libs/tinymce/license.txt +21 -0
  172. package/dist/libs/tinymce/models/dom/index.js +7 -0
  173. package/dist/libs/tinymce/models/dom/model.js +7975 -0
  174. package/dist/libs/tinymce/models/dom/model.min.js +4 -0
  175. package/dist/libs/tinymce/package.json +32 -0
  176. package/dist/libs/tinymce/plugins/advlist/index.js +7 -0
  177. package/dist/libs/tinymce/plugins/advlist/plugin.js +246 -0
  178. package/dist/libs/tinymce/plugins/advlist/plugin.min.js +4 -0
  179. package/dist/libs/tinymce/plugins/anchor/index.js +7 -0
  180. package/dist/libs/tinymce/plugins/anchor/plugin.js +195 -0
  181. package/dist/libs/tinymce/plugins/anchor/plugin.min.js +4 -0
  182. package/dist/libs/tinymce/plugins/autolink/index.js +7 -0
  183. package/dist/libs/tinymce/plugins/autolink/plugin.js +232 -0
  184. package/dist/libs/tinymce/plugins/autolink/plugin.min.js +4 -0
  185. package/dist/libs/tinymce/plugins/autoresize/index.js +7 -0
  186. package/dist/libs/tinymce/plugins/autoresize/plugin.js +156 -0
  187. package/dist/libs/tinymce/plugins/autoresize/plugin.min.js +4 -0
  188. package/dist/libs/tinymce/plugins/autosave/index.js +7 -0
  189. package/dist/libs/tinymce/plugins/autosave/plugin.js +232 -0
  190. package/dist/libs/tinymce/plugins/autosave/plugin.min.js +4 -0
  191. package/dist/libs/tinymce/plugins/charmap/index.js +7 -0
  192. package/dist/libs/tinymce/plugins/charmap/plugin.js +1636 -0
  193. package/dist/libs/tinymce/plugins/charmap/plugin.min.js +4 -0
  194. package/dist/libs/tinymce/plugins/code/index.js +7 -0
  195. package/dist/libs/tinymce/plugins/code/plugin.js +85 -0
  196. package/dist/libs/tinymce/plugins/code/plugin.min.js +4 -0
  197. package/dist/libs/tinymce/plugins/codesample/index.js +7 -0
  198. package/dist/libs/tinymce/plugins/codesample/plugin.js +2451 -0
  199. package/dist/libs/tinymce/plugins/codesample/plugin.min.js +4 -0
  200. package/dist/libs/tinymce/plugins/directionality/index.js +7 -0
  201. package/dist/libs/tinymce/plugins/directionality/plugin.js +384 -0
  202. package/dist/libs/tinymce/plugins/directionality/plugin.min.js +4 -0
  203. package/dist/libs/tinymce/plugins/emoticons/index.js +7 -0
  204. package/dist/libs/tinymce/plugins/emoticons/js/emojiimages.js +1 -0
  205. package/dist/libs/tinymce/plugins/emoticons/js/emojiimages.min.js +3 -0
  206. package/dist/libs/tinymce/plugins/emoticons/js/emojis.js +1 -0
  207. package/dist/libs/tinymce/plugins/emoticons/js/emojis.min.js +2 -0
  208. package/dist/libs/tinymce/plugins/emoticons/plugin.js +577 -0
  209. package/dist/libs/tinymce/plugins/emoticons/plugin.min.js +4 -0
  210. package/dist/libs/tinymce/plugins/fullscreen/index.js +7 -0
  211. package/dist/libs/tinymce/plugins/fullscreen/plugin.js +1190 -0
  212. package/dist/libs/tinymce/plugins/fullscreen/plugin.min.js +4 -0
  213. package/dist/libs/tinymce/plugins/help/index.js +7 -0
  214. package/dist/libs/tinymce/plugins/help/plugin.js +848 -0
  215. package/dist/libs/tinymce/plugins/help/plugin.min.js +4 -0
  216. package/dist/libs/tinymce/plugins/image/index.js +7 -0
  217. package/dist/libs/tinymce/plugins/image/plugin.js +1475 -0
  218. package/dist/libs/tinymce/plugins/image/plugin.min.js +4 -0
  219. package/dist/libs/tinymce/plugins/importcss/index.js +7 -0
  220. package/dist/libs/tinymce/plugins/importcss/plugin.js +342 -0
  221. package/dist/libs/tinymce/plugins/importcss/plugin.min.js +4 -0
  222. package/dist/libs/tinymce/plugins/insertdatetime/index.js +7 -0
  223. package/dist/libs/tinymce/plugins/insertdatetime/plugin.js +176 -0
  224. package/dist/libs/tinymce/plugins/insertdatetime/plugin.min.js +4 -0
  225. package/dist/libs/tinymce/plugins/link/index.js +7 -0
  226. package/dist/libs/tinymce/plugins/link/plugin.js +1190 -0
  227. package/dist/libs/tinymce/plugins/link/plugin.min.js +4 -0
  228. package/dist/libs/tinymce/plugins/lists/index.js +7 -0
  229. package/dist/libs/tinymce/plugins/lists/plugin.js +1820 -0
  230. package/dist/libs/tinymce/plugins/lists/plugin.min.js +4 -0
  231. package/dist/libs/tinymce/plugins/media/index.js +7 -0
  232. package/dist/libs/tinymce/plugins/media/plugin.js +1157 -0
  233. package/dist/libs/tinymce/plugins/media/plugin.min.js +4 -0
  234. package/dist/libs/tinymce/plugins/nonbreaking/index.js +7 -0
  235. package/dist/libs/tinymce/plugins/nonbreaking/plugin.js +111 -0
  236. package/dist/libs/tinymce/plugins/nonbreaking/plugin.min.js +4 -0
  237. package/dist/libs/tinymce/plugins/pagebreak/index.js +7 -0
  238. package/dist/libs/tinymce/plugins/pagebreak/plugin.js +105 -0
  239. package/dist/libs/tinymce/plugins/pagebreak/plugin.min.js +4 -0
  240. package/dist/libs/tinymce/plugins/preview/index.js +7 -0
  241. package/dist/libs/tinymce/plugins/preview/plugin.js +97 -0
  242. package/dist/libs/tinymce/plugins/preview/plugin.min.js +4 -0
  243. package/dist/libs/tinymce/plugins/quickbars/index.js +7 -0
  244. package/dist/libs/tinymce/plugins/quickbars/plugin.js +421 -0
  245. package/dist/libs/tinymce/plugins/quickbars/plugin.min.js +4 -0
  246. package/dist/libs/tinymce/plugins/save/index.js +7 -0
  247. package/dist/libs/tinymce/plugins/save/plugin.js +118 -0
  248. package/dist/libs/tinymce/plugins/save/plugin.min.js +4 -0
  249. package/dist/libs/tinymce/plugins/searchreplace/index.js +7 -0
  250. package/dist/libs/tinymce/plugins/searchreplace/plugin.js +1079 -0
  251. package/dist/libs/tinymce/plugins/searchreplace/plugin.min.js +4 -0
  252. package/dist/libs/tinymce/plugins/table/index.js +7 -0
  253. package/dist/libs/tinymce/plugins/table/plugin.js +3393 -0
  254. package/dist/libs/tinymce/plugins/table/plugin.min.js +4 -0
  255. package/dist/libs/tinymce/plugins/template/index.js +7 -0
  256. package/dist/libs/tinymce/plugins/template/plugin.js +548 -0
  257. package/dist/libs/tinymce/plugins/template/plugin.min.js +4 -0
  258. package/dist/libs/tinymce/plugins/visualblocks/index.js +7 -0
  259. package/dist/libs/tinymce/plugins/visualblocks/plugin.js +98 -0
  260. package/dist/libs/tinymce/plugins/visualblocks/plugin.min.js +4 -0
  261. package/dist/libs/tinymce/plugins/visualchars/index.js +7 -0
  262. package/dist/libs/tinymce/plugins/visualchars/plugin.js +506 -0
  263. package/dist/libs/tinymce/plugins/visualchars/plugin.min.js +4 -0
  264. package/dist/libs/tinymce/plugins/wordcount/index.js +7 -0
  265. package/dist/libs/tinymce/plugins/wordcount/plugin.js +404 -0
  266. package/dist/libs/tinymce/plugins/wordcount/plugin.min.js +4 -0
  267. package/dist/libs/tinymce/skins/content/dark/content.css +66 -0
  268. package/dist/libs/tinymce/skins/content/dark/content.min.css +1 -0
  269. package/dist/libs/tinymce/skins/content/default/content.css +61 -0
  270. package/dist/libs/tinymce/skins/content/default/content.min.css +1 -0
  271. package/dist/libs/tinymce/skins/content/document/content.css +66 -0
  272. package/dist/libs/tinymce/skins/content/document/content.min.css +1 -0
  273. package/dist/libs/tinymce/skins/content/tinymce-5/content.css +61 -0
  274. package/dist/libs/tinymce/skins/content/tinymce-5/content.min.css +1 -0
  275. package/dist/libs/tinymce/skins/content/tinymce-5-dark/content.css +66 -0
  276. package/dist/libs/tinymce/skins/content/tinymce-5-dark/content.min.css +1 -0
  277. package/dist/libs/tinymce/skins/content/writer/content.css +62 -0
  278. package/dist/libs/tinymce/skins/content/writer/content.min.css +1 -0
  279. package/dist/libs/tinymce/skins/ui/oxide/content.css +747 -0
  280. package/dist/libs/tinymce/skins/ui/oxide/content.inline.css +741 -0
  281. package/dist/libs/tinymce/skins/ui/oxide/content.inline.min.css +1 -0
  282. package/dist/libs/tinymce/skins/ui/oxide/content.min.css +1 -0
  283. package/dist/libs/tinymce/skins/ui/oxide/skin.css +3074 -0
  284. package/dist/libs/tinymce/skins/ui/oxide/skin.min.css +1 -0
  285. package/dist/libs/tinymce/skins/ui/oxide/skin.shadowdom.css +30 -0
  286. package/dist/libs/tinymce/skins/ui/oxide/skin.shadowdom.min.css +1 -0
  287. package/dist/libs/tinymce/skins/ui/oxide-dark/content.css +728 -0
  288. package/dist/libs/tinymce/skins/ui/oxide-dark/content.inline.css +741 -0
  289. package/dist/libs/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -0
  290. package/dist/libs/tinymce/skins/ui/oxide-dark/content.min.css +1 -0
  291. package/dist/libs/tinymce/skins/ui/oxide-dark/skin.css +3077 -0
  292. package/dist/libs/tinymce/skins/ui/oxide-dark/skin.min.css +1 -0
  293. package/dist/libs/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +30 -0
  294. package/dist/libs/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -0
  295. package/dist/libs/tinymce/skins/ui/tinymce-5/content.css +747 -0
  296. package/dist/libs/tinymce/skins/ui/tinymce-5/content.inline.css +741 -0
  297. package/dist/libs/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -0
  298. package/dist/libs/tinymce/skins/ui/tinymce-5/content.min.css +1 -0
  299. package/dist/libs/tinymce/skins/ui/tinymce-5/skin.css +3158 -0
  300. package/dist/libs/tinymce/skins/ui/tinymce-5/skin.min.css +1 -0
  301. package/dist/libs/tinymce/skins/ui/tinymce-5/skin.shadowdom.css +30 -0
  302. package/dist/libs/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css +1 -0
  303. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.css +728 -0
  304. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.inline.css +741 -0
  305. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -0
  306. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -0
  307. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.css +3158 -0
  308. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -0
  309. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.css +30 -0
  310. package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +1 -0
  311. package/dist/libs/tinymce/themes/silver/index.js +7 -0
  312. package/dist/libs/tinymce/themes/silver/theme.js +26184 -0
  313. package/dist/libs/tinymce/themes/silver/theme.min.js +4 -0
  314. package/dist/libs/tinymce/tinymce.d.ts +2895 -0
  315. package/dist/libs/tinymce/tinymce.js +29400 -0
  316. package/dist/libs/tinymce/tinymce.min.js +4 -0
  317. package/dist/libs/tom-select/dist/js/plugins/caret_position.js +170 -0
  318. package/dist/libs/tom-select/dist/js/plugins/caret_position.js.map +1 -0
  319. package/dist/libs/tom-select/dist/js/plugins/change_listener.js +58 -0
  320. package/dist/libs/tom-select/dist/js/plugins/change_listener.js.map +1 -0
  321. package/dist/libs/tom-select/dist/js/plugins/checkbox_options.js +182 -0
  322. package/dist/libs/tom-select/dist/js/plugins/checkbox_options.js.map +1 -0
  323. package/dist/libs/tom-select/dist/js/plugins/clear_button.js +99 -0
  324. package/dist/libs/tom-select/dist/js/plugins/clear_button.js.map +1 -0
  325. package/dist/libs/tom-select/dist/js/plugins/drag_drop.js +70 -0
  326. package/dist/libs/tom-select/dist/js/plugins/drag_drop.js.map +1 -0
  327. package/dist/libs/tom-select/dist/js/plugins/dropdown_header.js +126 -0
  328. package/dist/libs/tom-select/dist/js/plugins/dropdown_header.js.map +1 -0
  329. package/dist/libs/tom-select/dist/js/plugins/dropdown_input.js +240 -0
  330. package/dist/libs/tom-select/dist/js/plugins/dropdown_input.js.map +1 -0
  331. package/dist/libs/tom-select/dist/js/plugins/input_autogrow.js +84 -0
  332. package/dist/libs/tom-select/dist/js/plugins/input_autogrow.js.map +1 -0
  333. package/dist/libs/tom-select/dist/js/plugins/no_active_items.js +33 -0
  334. package/dist/libs/tom-select/dist/js/plugins/no_active_items.js.map +1 -0
  335. package/dist/libs/tom-select/dist/js/plugins/no_backspace_delete.js +40 -0
  336. package/dist/libs/tom-select/dist/js/plugins/no_backspace_delete.js.map +1 -0
  337. package/dist/libs/tom-select/dist/js/plugins/optgroup_columns.js +117 -0
  338. package/dist/libs/tom-select/dist/js/plugins/optgroup_columns.js.map +1 -0
  339. package/dist/libs/tom-select/dist/js/plugins/remove_button.js +154 -0
  340. package/dist/libs/tom-select/dist/js/plugins/remove_button.js.map +1 -0
  341. package/dist/libs/tom-select/dist/js/plugins/restore_on_backspace.js +51 -0
  342. package/dist/libs/tom-select/dist/js/plugins/restore_on_backspace.js.map +1 -0
  343. package/dist/libs/tom-select/dist/js/plugins/virtual_scroll.js +279 -0
  344. package/dist/libs/tom-select/dist/js/plugins/virtual_scroll.js.map +1 -0
  345. package/dist/libs/tom-select/dist/js/tom-select.base.js +4165 -0
  346. package/dist/libs/tom-select/dist/js/tom-select.base.js.map +1 -0
  347. package/dist/libs/tom-select/dist/js/tom-select.base.min.js +144 -144
  348. package/dist/libs/tom-select/dist/js/tom-select.base.min.js.map +1 -0
  349. package/dist/libs/tom-select/dist/js/tom-select.complete.js +4978 -0
  350. package/dist/libs/tom-select/dist/js/tom-select.complete.js.map +1 -0
  351. package/dist/libs/tom-select/dist/js/tom-select.complete.min.js +363 -0
  352. package/dist/libs/tom-select/dist/js/tom-select.complete.min.js.map +1 -0
  353. package/dist/libs/tom-select/dist/js/tom-select.popular.js +4419 -0
  354. package/dist/libs/tom-select/dist/js/tom-select.popular.js.map +1 -0
  355. package/dist/libs/tom-select/dist/js/tom-select.popular.min.js +323 -0
  356. package/dist/libs/tom-select/dist/js/tom-select.popular.min.js.map +1 -0
  357. package/package.json +50 -29
  358. package/src/scss/_bootstrap-components.scss +1 -1
  359. package/src/scss/_bootstrap-config.scss +1 -0
  360. package/src/scss/_core.scss +1 -0
  361. package/src/scss/_mixins-override.scss +26 -26
  362. package/src/scss/_variables.scss +17 -9
  363. package/src/scss/demo.scss +4 -4
  364. package/src/scss/layout/_core.scss +23 -15
  365. package/src/scss/layout/_dark.scss +17 -13
  366. package/src/scss/layout/_navbar.scss +11 -10
  367. package/src/scss/mixins/_functions.scss +0 -14
  368. package/src/scss/mixins/_mixins.scss +29 -3
  369. package/src/scss/tabler-vendors.scss +4 -0
  370. package/src/scss/ui/_accordion.scss +4 -0
  371. package/src/scss/ui/_alerts.scss +7 -7
  372. package/src/scss/ui/_avatars.scss +11 -11
  373. package/src/scss/ui/_breadcrumbs.scss +1 -1
  374. package/src/scss/ui/_buttons.scss +89 -105
  375. package/src/scss/ui/_cards.scss +25 -28
  376. package/src/scss/ui/_carousel.scss +1 -1
  377. package/src/scss/ui/_datagrid.scss +17 -0
  378. package/src/scss/ui/_flags.scss +1 -1
  379. package/src/scss/ui/_forms.scss +7 -6
  380. package/src/scss/ui/_grid.scss +5 -5
  381. package/src/scss/ui/_legend.scss +1 -1
  382. package/src/scss/ui/_lists.scss +4 -4
  383. package/src/scss/ui/_modals.scss +1 -1
  384. package/src/scss/ui/_nav.scss +1 -1
  385. package/src/scss/ui/_offcanvas.scss +1 -1
  386. package/src/scss/ui/_progress.scss +2 -2
  387. package/src/scss/ui/_status.scss +27 -26
  388. package/src/scss/ui/_toasts.scss +2 -2
  389. package/src/scss/ui/forms/_form-custom.scss +2 -2
  390. package/src/scss/ui/forms/_form-imagecheck.scss +1 -1
  391. package/src/scss/ui/forms/_validation.scss +1 -1
  392. package/src/scss/utils/_colors.scss +9 -7
  393. package/src/scss/vendor/_dropzone.scss +27 -0
  394. package/src/scss/vendor/_fslightbox.scss +13 -0
  395. package/src/scss/vendor/_jsvectormap.scss +5 -5
  396. package/src/scss/vendor/_litepicker.scss +4 -4
  397. package/src/scss/vendor/_plyr.scss +3 -0
  398. package/src/scss/vendor/_tinymce.scss +25 -0
package/dist/js/tabler.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * Tabler v1.0.0-beta10 (https://tabler.io)
3
- * @version 1.0.0-beta10
2
+ * Tabler v1.0.0-beta11 (https://tabler.io)
3
+ * @version 1.0.0-beta11
4
4
  * @link https://tabler.io
5
5
  * Copyright 2018-2022 The Tabler Authors
6
6
  * Copyright 2018-2022 codecalm.net Paweł Kuna
@@ -4637,18 +4637,18 @@
4637
4637
  });
4638
4638
 
4639
4639
  /*!
4640
- * Bootstrap v5.1.3 (https://getbootstrap.com/)
4641
- * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4640
+ * Bootstrap v5.2.0 (https://getbootstrap.com/)
4641
+ * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4642
4642
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
4643
4643
  */
4644
4644
  const MAX_UID = 1000000;
4645
4645
  const MILLISECONDS_MULTIPLIER = 1000;
4646
4646
  const TRANSITION_END = 'transitionend';
4647
- const toType = obj => {
4648
- if (obj === null || obj === undefined) {
4649
- return `${obj}`;
4647
+ const toType = object => {
4648
+ if (object === null || object === undefined) {
4649
+ return `${object}`;
4650
4650
  }
4651
- return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
4651
+ return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase();
4652
4652
  };
4653
4653
  const getUID = prefix => {
4654
4654
  do {
@@ -4659,14 +4659,14 @@
4659
4659
  const getSelector = element => {
4660
4660
  let selector = element.getAttribute('data-bs-target');
4661
4661
  if (!selector || selector === '#') {
4662
- let hrefAttr = element.getAttribute('href');
4663
- if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
4662
+ let hrefAttribute = element.getAttribute('href');
4663
+ if (!hrefAttribute || !hrefAttribute.includes('#') && !hrefAttribute.startsWith('.')) {
4664
4664
  return null;
4665
4665
  }
4666
- if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
4667
- hrefAttr = `#${hrefAttr.split('#')[1]}`;
4666
+ if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) {
4667
+ hrefAttribute = `#${hrefAttribute.split('#')[1]}`;
4668
4668
  }
4669
- selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
4669
+ selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null;
4670
4670
  }
4671
4671
  return selector;
4672
4672
  };
@@ -4701,39 +4701,43 @@
4701
4701
  const triggerTransitionEnd = element => {
4702
4702
  element.dispatchEvent(new Event(TRANSITION_END));
4703
4703
  };
4704
- const isElement = obj => {
4705
- if (!obj || typeof obj !== 'object') {
4704
+ const isElement = object => {
4705
+ if (!object || typeof object !== 'object') {
4706
4706
  return false;
4707
4707
  }
4708
- if (typeof obj.jquery !== 'undefined') {
4709
- obj = obj[0];
4708
+ if (typeof object.jquery !== 'undefined') {
4709
+ object = object[0];
4710
4710
  }
4711
- return typeof obj.nodeType !== 'undefined';
4711
+ return typeof object.nodeType !== 'undefined';
4712
4712
  };
4713
- const getElement = obj => {
4714
- if (isElement(obj)) {
4715
- return obj.jquery ? obj[0] : obj;
4713
+ const getElement = object => {
4714
+ if (isElement(object)) {
4715
+ return object.jquery ? object[0] : object;
4716
4716
  }
4717
- if (typeof obj === 'string' && obj.length > 0) {
4718
- return document.querySelector(obj);
4717
+ if (typeof object === 'string' && object.length > 0) {
4718
+ return document.querySelector(object);
4719
4719
  }
4720
4720
  return null;
4721
4721
  };
4722
- const typeCheckConfig = (componentName, config, configTypes) => {
4723
- Object.keys(configTypes).forEach(property => {
4724
- const expectedTypes = configTypes[property];
4725
- const value = config[property];
4726
- const valueType = value && isElement(value) ? 'element' : toType(value);
4727
- if (!new RegExp(expectedTypes).test(valueType)) {
4728
- throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
4729
- }
4730
- });
4731
- };
4732
4722
  const isVisible = element => {
4733
4723
  if (!isElement(element) || element.getClientRects().length === 0) {
4734
4724
  return false;
4735
4725
  }
4736
- return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
4726
+ const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible';
4727
+ const closedDetails = element.closest('details:not([open])');
4728
+ if (!closedDetails) {
4729
+ return elementIsVisible;
4730
+ }
4731
+ if (closedDetails !== element) {
4732
+ const summary = element.closest('summary');
4733
+ if (summary && summary.parentNode !== closedDetails) {
4734
+ return false;
4735
+ }
4736
+ if (summary === null) {
4737
+ return false;
4738
+ }
4739
+ }
4740
+ return elementIsVisible;
4737
4741
  };
4738
4742
  const isDisabled = element => {
4739
4743
  if (!element || element.nodeType !== Node.ELEMENT_NODE) {
@@ -4768,11 +4772,8 @@
4768
4772
  element.offsetHeight;
4769
4773
  };
4770
4774
  const getjQuery = () => {
4771
- const {
4772
- jQuery
4773
- } = window;
4774
- if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
4775
- return jQuery;
4775
+ if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
4776
+ return window.jQuery;
4776
4777
  }
4777
4778
  return null;
4778
4779
  };
@@ -4781,7 +4782,9 @@
4781
4782
  if (document.readyState === 'loading') {
4782
4783
  if (!DOMContentLoadedCallbacks.length) {
4783
4784
  document.addEventListener('DOMContentLoaded', () => {
4784
- DOMContentLoadedCallbacks.forEach(callback => callback());
4785
+ for (const callback of DOMContentLoadedCallbacks) {
4786
+ callback();
4787
+ }
4785
4788
  });
4786
4789
  }
4787
4790
  DOMContentLoadedCallbacks.push(callback);
@@ -4836,11 +4839,11 @@
4836
4839
  }, emulatedDuration);
4837
4840
  };
4838
4841
  const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
4842
+ const listLength = list.length;
4839
4843
  let index = list.indexOf(activeElement);
4840
4844
  if (index === -1) {
4841
- return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0];
4845
+ return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0];
4842
4846
  }
4843
- const listLength = list.length;
4844
4847
  index += shouldGetNext ? 1 : -1;
4845
4848
  if (isCycleAllowed) {
4846
4849
  index = (index + listLength) % listLength;
@@ -4856,20 +4859,21 @@
4856
4859
  mouseenter: 'mouseover',
4857
4860
  mouseleave: 'mouseout'
4858
4861
  };
4859
- const customEventsRegex = /^(mouseenter|mouseleave)/i;
4860
4862
  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']);
4861
- function getUidEvent(element, uid) {
4863
+ function makeEventUid(element, uid) {
4862
4864
  return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
4863
4865
  }
4864
- function getEvent(element) {
4865
- const uid = getUidEvent(element);
4866
+ function getElementEvents(element) {
4867
+ const uid = makeEventUid(element);
4866
4868
  element.uidEvent = uid;
4867
4869
  eventRegistry[uid] = eventRegistry[uid] || {};
4868
4870
  return eventRegistry[uid];
4869
4871
  }
4870
4872
  function bootstrapHandler(element, fn) {
4871
4873
  return function handler(event) {
4872
- event.delegateTarget = element;
4874
+ hydrateObj(event, {
4875
+ delegateTarget: element
4876
+ });
4873
4877
  if (handler.oneOff) {
4874
4878
  EventHandler.off(element, event.type, fn);
4875
4879
  }
@@ -4882,77 +4886,63 @@
4882
4886
  for (let {
4883
4887
  target
4884
4888
  } = event; target && target !== this; target = target.parentNode) {
4885
- for (let i = domElements.length; i--;) {
4886
- if (domElements[i] === target) {
4887
- event.delegateTarget = target;
4888
- if (handler.oneOff) {
4889
- EventHandler.off(element, event.type, selector, fn);
4890
- }
4891
- return fn.apply(target, [event]);
4889
+ for (const domElement of domElements) {
4890
+ if (domElement !== target) {
4891
+ continue;
4892
+ }
4893
+ hydrateObj(event, {
4894
+ delegateTarget: target
4895
+ });
4896
+ if (handler.oneOff) {
4897
+ EventHandler.off(element, event.type, selector, fn);
4892
4898
  }
4899
+ return fn.apply(target, [event]);
4893
4900
  }
4894
4901
  }
4895
- return null;
4896
4902
  };
4897
4903
  }
4898
- function findHandler(events, handler, delegationSelector = null) {
4899
- const uidEventList = Object.keys(events);
4900
- for (let i = 0, len = uidEventList.length; i < len; i++) {
4901
- const event = events[uidEventList[i]];
4902
- if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
4903
- return event;
4904
- }
4905
- }
4906
- return null;
4904
+ function findHandler(events, callable, delegationSelector = null) {
4905
+ return Object.values(events).find(event => event.callable === callable && event.delegationSelector === delegationSelector);
4907
4906
  }
4908
- function normalizeParams(originalTypeEvent, handler, delegationFn) {
4909
- const delegation = typeof handler === 'string';
4910
- const originalHandler = delegation ? delegationFn : handler;
4907
+ function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
4908
+ const isDelegated = typeof handler === 'string';
4909
+ const callable = isDelegated ? delegationFunction : handler || delegationFunction;
4911
4910
  let typeEvent = getTypeEvent(originalTypeEvent);
4912
- const isNative = nativeEvents.has(typeEvent);
4913
- if (!isNative) {
4911
+ if (!nativeEvents.has(typeEvent)) {
4914
4912
  typeEvent = originalTypeEvent;
4915
4913
  }
4916
- return [delegation, originalHandler, typeEvent];
4914
+ return [isDelegated, callable, typeEvent];
4917
4915
  }
4918
- function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
4916
+ function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {
4919
4917
  if (typeof originalTypeEvent !== 'string' || !element) {
4920
4918
  return;
4921
4919
  }
4922
- if (!handler) {
4923
- handler = delegationFn;
4924
- delegationFn = null;
4925
- }
4926
- if (customEventsRegex.test(originalTypeEvent)) {
4927
- const wrapFn = fn => {
4920
+ let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
4921
+ if (originalTypeEvent in customEvents) {
4922
+ const wrapFunction = fn => {
4928
4923
  return function (event) {
4929
4924
  if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
4930
4925
  return fn.call(this, event);
4931
4926
  }
4932
4927
  };
4933
4928
  };
4934
- if (delegationFn) {
4935
- delegationFn = wrapFn(delegationFn);
4936
- } else {
4937
- handler = wrapFn(handler);
4938
- }
4929
+ callable = wrapFunction(callable);
4939
4930
  }
4940
- const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
4941
- const events = getEvent(element);
4931
+ const events = getElementEvents(element);
4942
4932
  const handlers = events[typeEvent] || (events[typeEvent] = {});
4943
- const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
4944
- if (previousFn) {
4945
- previousFn.oneOff = previousFn.oneOff && oneOff;
4933
+ const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null);
4934
+ if (previousFunction) {
4935
+ previousFunction.oneOff = previousFunction.oneOff && oneOff;
4946
4936
  return;
4947
4937
  }
4948
- const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
4949
- const fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
4950
- fn.delegationSelector = delegation ? handler : null;
4951
- fn.originalHandler = originalHandler;
4938
+ const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ''));
4939
+ const fn = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable);
4940
+ fn.delegationSelector = isDelegated ? handler : null;
4941
+ fn.callable = callable;
4952
4942
  fn.oneOff = oneOff;
4953
4943
  fn.uidEvent = uid;
4954
4944
  handlers[uid] = fn;
4955
- element.addEventListener(typeEvent, fn, delegation);
4945
+ element.addEventListener(typeEvent, fn, isDelegated);
4956
4946
  }
4957
4947
  function removeHandler(element, events, typeEvent, handler, delegationSelector) {
4958
4948
  const fn = findHandler(events[typeEvent], handler, delegationSelector);
@@ -4964,52 +4954,52 @@
4964
4954
  }
4965
4955
  function removeNamespacedHandlers(element, events, typeEvent, namespace) {
4966
4956
  const storeElementEvent = events[typeEvent] || {};
4967
- Object.keys(storeElementEvent).forEach(handlerKey => {
4957
+ for (const handlerKey of Object.keys(storeElementEvent)) {
4968
4958
  if (handlerKey.includes(namespace)) {
4969
4959
  const event = storeElementEvent[handlerKey];
4970
- removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
4960
+ removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
4971
4961
  }
4972
- });
4962
+ }
4973
4963
  }
4974
4964
  function getTypeEvent(event) {
4975
4965
  event = event.replace(stripNameRegex, '');
4976
4966
  return customEvents[event] || event;
4977
4967
  }
4978
4968
  const EventHandler = {
4979
- on(element, event, handler, delegationFn) {
4980
- addHandler(element, event, handler, delegationFn, false);
4969
+ on(element, event, handler, delegationFunction) {
4970
+ addHandler(element, event, handler, delegationFunction, false);
4981
4971
  },
4982
- one(element, event, handler, delegationFn) {
4983
- addHandler(element, event, handler, delegationFn, true);
4972
+ one(element, event, handler, delegationFunction) {
4973
+ addHandler(element, event, handler, delegationFunction, true);
4984
4974
  },
4985
- off(element, originalTypeEvent, handler, delegationFn) {
4975
+ off(element, originalTypeEvent, handler, delegationFunction) {
4986
4976
  if (typeof originalTypeEvent !== 'string' || !element) {
4987
4977
  return;
4988
4978
  }
4989
- const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
4979
+ const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
4990
4980
  const inNamespace = typeEvent !== originalTypeEvent;
4991
- const events = getEvent(element);
4981
+ const events = getElementEvents(element);
4982
+ const storeElementEvent = events[typeEvent] || {};
4992
4983
  const isNamespace = originalTypeEvent.startsWith('.');
4993
- if (typeof originalHandler !== 'undefined') {
4994
- if (!events || !events[typeEvent]) {
4984
+ if (typeof callable !== 'undefined') {
4985
+ if (!Object.keys(storeElementEvent).length) {
4995
4986
  return;
4996
4987
  }
4997
- removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
4988
+ removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null);
4998
4989
  return;
4999
4990
  }
5000
4991
  if (isNamespace) {
5001
- Object.keys(events).forEach(elementEvent => {
4992
+ for (const elementEvent of Object.keys(events)) {
5002
4993
  removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
5003
- });
4994
+ }
5004
4995
  }
5005
- const storeElementEvent = events[typeEvent] || {};
5006
- Object.keys(storeElementEvent).forEach(keyHandlers => {
4996
+ for (const keyHandlers of Object.keys(storeElementEvent)) {
5007
4997
  const handlerKey = keyHandlers.replace(stripUidRegex, '');
5008
4998
  if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
5009
4999
  const event = storeElementEvent[keyHandlers];
5010
- removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
5000
+ removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
5011
5001
  }
5012
- });
5002
+ }
5013
5003
  },
5014
5004
  trigger(element, event, args) {
5015
5005
  if (typeof event !== 'string' || !element) {
@@ -5018,12 +5008,10 @@
5018
5008
  const $ = getjQuery();
5019
5009
  const typeEvent = getTypeEvent(event);
5020
5010
  const inNamespace = event !== typeEvent;
5021
- const isNative = nativeEvents.has(typeEvent);
5022
- let jQueryEvent;
5011
+ let jQueryEvent = null;
5023
5012
  let bubbles = true;
5024
5013
  let nativeDispatch = true;
5025
5014
  let defaultPrevented = false;
5026
- let evt = null;
5027
5015
  if (inNamespace && $) {
5028
5016
  jQueryEvent = $.Event(event, args);
5029
5017
  $(element).trigger(jQueryEvent);
@@ -5031,36 +5019,38 @@
5031
5019
  nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
5032
5020
  defaultPrevented = jQueryEvent.isDefaultPrevented();
5033
5021
  }
5034
- if (isNative) {
5035
- evt = document.createEvent('HTMLEvents');
5036
- evt.initEvent(typeEvent, bubbles, true);
5037
- } else {
5038
- evt = new CustomEvent(event, {
5039
- bubbles,
5040
- cancelable: true
5041
- });
5042
- }
5043
- if (typeof args !== 'undefined') {
5044
- Object.keys(args).forEach(key => {
5045
- Object.defineProperty(evt, key, {
5046
- get() {
5047
- return args[key];
5048
- }
5049
- });
5050
- });
5051
- }
5022
+ let evt = new Event(event, {
5023
+ bubbles,
5024
+ cancelable: true
5025
+ });
5026
+ evt = hydrateObj(evt, args);
5052
5027
  if (defaultPrevented) {
5053
5028
  evt.preventDefault();
5054
5029
  }
5055
5030
  if (nativeDispatch) {
5056
5031
  element.dispatchEvent(evt);
5057
5032
  }
5058
- if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') {
5033
+ if (evt.defaultPrevented && jQueryEvent) {
5059
5034
  jQueryEvent.preventDefault();
5060
5035
  }
5061
5036
  return evt;
5062
5037
  }
5063
5038
  };
5039
+ function hydrateObj(obj, meta) {
5040
+ for (const [key, value] of Object.entries(meta || {})) {
5041
+ try {
5042
+ obj[key] = value;
5043
+ } catch (_unused) {
5044
+ Object.defineProperty(obj, key, {
5045
+ configurable: true,
5046
+ get() {
5047
+ return value;
5048
+ }
5049
+ });
5050
+ }
5051
+ }
5052
+ return obj;
5053
+ }
5064
5054
  const elementMap = new Map();
5065
5055
  const Data = {
5066
5056
  set(element, key, instance) {
@@ -5091,26 +5081,121 @@
5091
5081
  }
5092
5082
  }
5093
5083
  };
5094
- const VERSION = '5.1.3';
5095
- class BaseComponent {
5096
- constructor(element) {
5084
+ function normalizeData(value) {
5085
+ if (value === 'true') {
5086
+ return true;
5087
+ }
5088
+ if (value === 'false') {
5089
+ return false;
5090
+ }
5091
+ if (value === Number(value).toString()) {
5092
+ return Number(value);
5093
+ }
5094
+ if (value === '' || value === 'null') {
5095
+ return null;
5096
+ }
5097
+ if (typeof value !== 'string') {
5098
+ return value;
5099
+ }
5100
+ try {
5101
+ return JSON.parse(decodeURIComponent(value));
5102
+ } catch (_unused) {
5103
+ return value;
5104
+ }
5105
+ }
5106
+ function normalizeDataKey(key) {
5107
+ return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`);
5108
+ }
5109
+ const Manipulator = {
5110
+ setDataAttribute(element, key, value) {
5111
+ element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
5112
+ },
5113
+ removeDataAttribute(element, key) {
5114
+ element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
5115
+ },
5116
+ getDataAttributes(element) {
5117
+ if (!element) {
5118
+ return {};
5119
+ }
5120
+ const attributes = {};
5121
+ const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig'));
5122
+ for (const key of bsKeys) {
5123
+ let pureKey = key.replace(/^bs/, '');
5124
+ pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
5125
+ attributes[pureKey] = normalizeData(element.dataset[key]);
5126
+ }
5127
+ return attributes;
5128
+ },
5129
+ getDataAttribute(element, key) {
5130
+ return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
5131
+ }
5132
+ };
5133
+ class Config {
5134
+ static get Default() {
5135
+ return {};
5136
+ }
5137
+ static get DefaultType() {
5138
+ return {};
5139
+ }
5140
+ static get NAME() {
5141
+ throw new Error('You have to implement the static method "NAME", for each component!');
5142
+ }
5143
+ _getConfig(config) {
5144
+ config = this._mergeConfigObj(config);
5145
+ config = this._configAfterMerge(config);
5146
+ this._typeCheckConfig(config);
5147
+ return config;
5148
+ }
5149
+ _configAfterMerge(config) {
5150
+ return config;
5151
+ }
5152
+ _mergeConfigObj(config, element) {
5153
+ const jsonConfig = isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {};
5154
+ return { ...this.constructor.Default,
5155
+ ...(typeof jsonConfig === 'object' ? jsonConfig : {}),
5156
+ ...(isElement(element) ? Manipulator.getDataAttributes(element) : {}),
5157
+ ...(typeof config === 'object' ? config : {})
5158
+ };
5159
+ }
5160
+ _typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
5161
+ for (const property of Object.keys(configTypes)) {
5162
+ const expectedTypes = configTypes[property];
5163
+ const value = config[property];
5164
+ const valueType = isElement(value) ? 'element' : toType(value);
5165
+ if (!new RegExp(expectedTypes).test(valueType)) {
5166
+ throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
5167
+ }
5168
+ }
5169
+ }
5170
+ }
5171
+ const VERSION = '5.2.0';
5172
+ class BaseComponent extends Config {
5173
+ constructor(element, config) {
5174
+ super();
5097
5175
  element = getElement(element);
5098
5176
  if (!element) {
5099
5177
  return;
5100
5178
  }
5101
5179
  this._element = element;
5180
+ this._config = this._getConfig(config);
5102
5181
  Data.set(this._element, this.constructor.DATA_KEY, this);
5103
5182
  }
5104
5183
  dispose() {
5105
5184
  Data.remove(this._element, this.constructor.DATA_KEY);
5106
5185
  EventHandler.off(this._element, this.constructor.EVENT_KEY);
5107
- Object.getOwnPropertyNames(this).forEach(propertyName => {
5186
+ for (const propertyName of Object.getOwnPropertyNames(this)) {
5108
5187
  this[propertyName] = null;
5109
- });
5188
+ }
5110
5189
  }
5111
5190
  _queueCallback(callback, element, isAnimated = true) {
5112
5191
  executeAfterTransition(callback, element, isAnimated);
5113
5192
  }
5193
+ _getConfig(config) {
5194
+ config = this._mergeConfigObj(config, this._element);
5195
+ config = this._configAfterMerge(config);
5196
+ this._typeCheckConfig(config);
5197
+ return config;
5198
+ }
5114
5199
  static getInstance(element) {
5115
5200
  return Data.get(getElement(element), this.DATA_KEY);
5116
5201
  }
@@ -5120,15 +5205,15 @@
5120
5205
  static get VERSION() {
5121
5206
  return VERSION;
5122
5207
  }
5123
- static get NAME() {
5124
- throw new Error('You have to implement the static method "NAME", for each component!');
5125
- }
5126
5208
  static get DATA_KEY() {
5127
5209
  return `bs.${this.NAME}`;
5128
5210
  }
5129
5211
  static get EVENT_KEY() {
5130
5212
  return `.${this.DATA_KEY}`;
5131
5213
  }
5214
+ static eventName(name) {
5215
+ return `${name}${this.EVENT_KEY}`;
5216
+ }
5132
5217
  }
5133
5218
  const enableDismissTrigger = (component, method = 'hide') => {
5134
5219
  const clickEvent = `click.dismiss${component.EVENT_KEY}`;
@@ -5145,16 +5230,16 @@
5145
5230
  instance[method]();
5146
5231
  });
5147
5232
  };
5148
- const NAME$d = 'alert';
5149
- const DATA_KEY$c = 'bs.alert';
5150
- const EVENT_KEY$c = `.${DATA_KEY$c}`;
5151
- const EVENT_CLOSE = `close${EVENT_KEY$c}`;
5152
- const EVENT_CLOSED = `closed${EVENT_KEY$c}`;
5233
+ const NAME$f = 'alert';
5234
+ const DATA_KEY$a = 'bs.alert';
5235
+ const EVENT_KEY$b = `.${DATA_KEY$a}`;
5236
+ const EVENT_CLOSE = `close${EVENT_KEY$b}`;
5237
+ const EVENT_CLOSED = `closed${EVENT_KEY$b}`;
5153
5238
  const CLASS_NAME_FADE$5 = 'fade';
5154
5239
  const CLASS_NAME_SHOW$8 = 'show';
5155
5240
  class Alert extends BaseComponent {
5156
5241
  static get NAME() {
5157
- return NAME$d;
5242
+ return NAME$f;
5158
5243
  }
5159
5244
  close() {
5160
5245
  const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
@@ -5185,16 +5270,16 @@
5185
5270
  }
5186
5271
  enableDismissTrigger(Alert, 'close');
5187
5272
  defineJQueryPlugin(Alert);
5188
- const NAME$c = 'button';
5189
- const DATA_KEY$b = 'bs.button';
5190
- const EVENT_KEY$b = `.${DATA_KEY$b}`;
5191
- const DATA_API_KEY$7 = '.data-api';
5273
+ const NAME$e = 'button';
5274
+ const DATA_KEY$9 = 'bs.button';
5275
+ const EVENT_KEY$a = `.${DATA_KEY$9}`;
5276
+ const DATA_API_KEY$6 = '.data-api';
5192
5277
  const CLASS_NAME_ACTIVE$3 = 'active';
5193
5278
  const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]';
5194
- const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$b}${DATA_API_KEY$7}`;
5279
+ const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
5195
5280
  class Button extends BaseComponent {
5196
5281
  static get NAME() {
5197
- return NAME$c;
5282
+ return NAME$e;
5198
5283
  }
5199
5284
  toggle() {
5200
5285
  this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE$3));
@@ -5215,61 +5300,6 @@
5215
5300
  data.toggle();
5216
5301
  });
5217
5302
  defineJQueryPlugin(Button);
5218
- function normalizeData(val) {
5219
- if (val === 'true') {
5220
- return true;
5221
- }
5222
- if (val === 'false') {
5223
- return false;
5224
- }
5225
- if (val === Number(val).toString()) {
5226
- return Number(val);
5227
- }
5228
- if (val === '' || val === 'null') {
5229
- return null;
5230
- }
5231
- return val;
5232
- }
5233
- function normalizeDataKey(key) {
5234
- return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`);
5235
- }
5236
- const Manipulator = {
5237
- setDataAttribute(element, key, value) {
5238
- element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
5239
- },
5240
- removeDataAttribute(element, key) {
5241
- element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
5242
- },
5243
- getDataAttributes(element) {
5244
- if (!element) {
5245
- return {};
5246
- }
5247
- const attributes = {};
5248
- Object.keys(element.dataset).filter(key => key.startsWith('bs')).forEach(key => {
5249
- let pureKey = key.replace(/^bs/, '');
5250
- pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
5251
- attributes[pureKey] = normalizeData(element.dataset[key]);
5252
- });
5253
- return attributes;
5254
- },
5255
- getDataAttribute(element, key) {
5256
- return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
5257
- },
5258
- offset(element) {
5259
- const rect = element.getBoundingClientRect();
5260
- return {
5261
- top: rect.top + window.pageYOffset,
5262
- left: rect.left + window.pageXOffset
5263
- };
5264
- },
5265
- position(element) {
5266
- return {
5267
- top: element.offsetTop,
5268
- left: element.offsetLeft
5269
- };
5270
- }
5271
- };
5272
- const NODE_TEXT = 3;
5273
5303
  const SelectorEngine = {
5274
5304
  find(selector, element = document.documentElement) {
5275
5305
  return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
@@ -5282,12 +5312,10 @@
5282
5312
  },
5283
5313
  parents(element, selector) {
5284
5314
  const parents = [];
5285
- let ancestor = element.parentNode;
5286
- while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
5287
- if (ancestor.matches(selector)) {
5288
- parents.push(ancestor);
5289
- }
5290
- ancestor = ancestor.parentNode;
5315
+ let ancestor = element.parentNode.closest(selector);
5316
+ while (ancestor) {
5317
+ parents.push(ancestor);
5318
+ ancestor = ancestor.parentNode.closest(selector);
5291
5319
  }
5292
5320
  return parents;
5293
5321
  },
@@ -5312,55 +5340,123 @@
5312
5340
  return [];
5313
5341
  },
5314
5342
  focusableChildren(element) {
5315
- const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(', ');
5343
+ const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(',');
5316
5344
  return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el));
5317
5345
  }
5318
5346
  };
5319
- const NAME$b = 'carousel';
5320
- const DATA_KEY$a = 'bs.carousel';
5321
- const EVENT_KEY$a = `.${DATA_KEY$a}`;
5322
- const DATA_API_KEY$6 = '.data-api';
5323
- const ARROW_LEFT_KEY = 'ArrowLeft';
5324
- const ARROW_RIGHT_KEY = 'ArrowRight';
5325
- const TOUCHEVENT_COMPAT_WAIT = 500;
5347
+ const NAME$d = 'swipe';
5348
+ const EVENT_KEY$9 = '.bs.swipe';
5349
+ const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`;
5350
+ const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`;
5351
+ const EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`;
5352
+ const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`;
5353
+ const EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`;
5354
+ const POINTER_TYPE_TOUCH = 'touch';
5355
+ const POINTER_TYPE_PEN = 'pen';
5356
+ const CLASS_NAME_POINTER_EVENT = 'pointer-event';
5326
5357
  const SWIPE_THRESHOLD = 40;
5327
- const Default$a = {
5328
- interval: 5000,
5329
- keyboard: true,
5330
- slide: false,
5331
- pause: 'hover',
5332
- wrap: true,
5333
- touch: true
5358
+ const Default$c = {
5359
+ endCallback: null,
5360
+ leftCallback: null,
5361
+ rightCallback: null
5334
5362
  };
5335
- const DefaultType$a = {
5336
- interval: '(number|boolean)',
5337
- keyboard: 'boolean',
5338
- slide: '(boolean|string)',
5339
- pause: '(string|boolean)',
5340
- wrap: 'boolean',
5341
- touch: 'boolean'
5363
+ const DefaultType$c = {
5364
+ endCallback: '(function|null)',
5365
+ leftCallback: '(function|null)',
5366
+ rightCallback: '(function|null)'
5342
5367
  };
5368
+ class Swipe extends Config {
5369
+ constructor(element, config) {
5370
+ super();
5371
+ this._element = element;
5372
+ if (!element || !Swipe.isSupported()) {
5373
+ return;
5374
+ }
5375
+ this._config = this._getConfig(config);
5376
+ this._deltaX = 0;
5377
+ this._supportPointerEvents = Boolean(window.PointerEvent);
5378
+ this._initEvents();
5379
+ }
5380
+ static get Default() {
5381
+ return Default$c;
5382
+ }
5383
+ static get DefaultType() {
5384
+ return DefaultType$c;
5385
+ }
5386
+ static get NAME() {
5387
+ return NAME$d;
5388
+ }
5389
+ dispose() {
5390
+ EventHandler.off(this._element, EVENT_KEY$9);
5391
+ }
5392
+ _start(event) {
5393
+ if (!this._supportPointerEvents) {
5394
+ this._deltaX = event.touches[0].clientX;
5395
+ return;
5396
+ }
5397
+ if (this._eventIsPointerPenTouch(event)) {
5398
+ this._deltaX = event.clientX;
5399
+ }
5400
+ }
5401
+ _end(event) {
5402
+ if (this._eventIsPointerPenTouch(event)) {
5403
+ this._deltaX = event.clientX - this._deltaX;
5404
+ }
5405
+ this._handleSwipe();
5406
+ execute(this._config.endCallback);
5407
+ }
5408
+ _move(event) {
5409
+ this._deltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this._deltaX;
5410
+ }
5411
+ _handleSwipe() {
5412
+ const absDeltaX = Math.abs(this._deltaX);
5413
+ if (absDeltaX <= SWIPE_THRESHOLD) {
5414
+ return;
5415
+ }
5416
+ const direction = absDeltaX / this._deltaX;
5417
+ this._deltaX = 0;
5418
+ if (!direction) {
5419
+ return;
5420
+ }
5421
+ execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback);
5422
+ }
5423
+ _initEvents() {
5424
+ if (this._supportPointerEvents) {
5425
+ EventHandler.on(this._element, EVENT_POINTERDOWN, event => this._start(event));
5426
+ EventHandler.on(this._element, EVENT_POINTERUP, event => this._end(event));
5427
+ this._element.classList.add(CLASS_NAME_POINTER_EVENT);
5428
+ } else {
5429
+ EventHandler.on(this._element, EVENT_TOUCHSTART, event => this._start(event));
5430
+ EventHandler.on(this._element, EVENT_TOUCHMOVE, event => this._move(event));
5431
+ EventHandler.on(this._element, EVENT_TOUCHEND, event => this._end(event));
5432
+ }
5433
+ }
5434
+ _eventIsPointerPenTouch(event) {
5435
+ return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH);
5436
+ }
5437
+ static isSupported() {
5438
+ return 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
5439
+ }
5440
+ }
5441
+ const NAME$c = 'carousel';
5442
+ const DATA_KEY$8 = 'bs.carousel';
5443
+ const EVENT_KEY$8 = `.${DATA_KEY$8}`;
5444
+ const DATA_API_KEY$5 = '.data-api';
5445
+ const ARROW_LEFT_KEY$1 = 'ArrowLeft';
5446
+ const ARROW_RIGHT_KEY$1 = 'ArrowRight';
5447
+ const TOUCHEVENT_COMPAT_WAIT = 500;
5343
5448
  const ORDER_NEXT = 'next';
5344
5449
  const ORDER_PREV = 'prev';
5345
5450
  const DIRECTION_LEFT = 'left';
5346
5451
  const DIRECTION_RIGHT = 'right';
5347
- const KEY_TO_DIRECTION = {
5348
- [ARROW_LEFT_KEY]: DIRECTION_RIGHT,
5349
- [ARROW_RIGHT_KEY]: DIRECTION_LEFT
5350
- };
5351
- const EVENT_SLIDE = `slide${EVENT_KEY$a}`;
5352
- const EVENT_SLID = `slid${EVENT_KEY$a}`;
5353
- const EVENT_KEYDOWN = `keydown${EVENT_KEY$a}`;
5354
- const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$a}`;
5355
- const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$a}`;
5356
- const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$a}`;
5357
- const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$a}`;
5358
- const EVENT_TOUCHEND = `touchend${EVENT_KEY$a}`;
5359
- const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$a}`;
5360
- const EVENT_POINTERUP = `pointerup${EVENT_KEY$a}`;
5361
- const EVENT_DRAG_START = `dragstart${EVENT_KEY$a}`;
5362
- const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$a}${DATA_API_KEY$6}`;
5363
- const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
5452
+ const EVENT_SLIDE = `slide${EVENT_KEY$8}`;
5453
+ const EVENT_SLID = `slid${EVENT_KEY$8}`;
5454
+ const EVENT_KEYDOWN$1 = `keydown${EVENT_KEY$8}`;
5455
+ const EVENT_MOUSEENTER$1 = `mouseenter${EVENT_KEY$8}`;
5456
+ const EVENT_MOUSELEAVE$1 = `mouseleave${EVENT_KEY$8}`;
5457
+ const EVENT_DRAG_START = `dragstart${EVENT_KEY$8}`;
5458
+ const EVENT_LOAD_DATA_API$3 = `load${EVENT_KEY$8}${DATA_API_KEY$5}`;
5459
+ const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
5364
5460
  const CLASS_NAME_CAROUSEL = 'carousel';
5365
5461
  const CLASS_NAME_ACTIVE$2 = 'active';
5366
5462
  const CLASS_NAME_SLIDE = 'slide';
@@ -5368,40 +5464,55 @@
5368
5464
  const CLASS_NAME_START = 'carousel-item-start';
5369
5465
  const CLASS_NAME_NEXT = 'carousel-item-next';
5370
5466
  const CLASS_NAME_PREV = 'carousel-item-prev';
5371
- const CLASS_NAME_POINTER_EVENT = 'pointer-event';
5372
- const SELECTOR_ACTIVE$1 = '.active';
5373
- const SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
5467
+ const SELECTOR_ACTIVE = '.active';
5374
5468
  const SELECTOR_ITEM = '.carousel-item';
5469
+ const SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM;
5375
5470
  const SELECTOR_ITEM_IMG = '.carousel-item img';
5376
- const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
5377
5471
  const SELECTOR_INDICATORS = '.carousel-indicators';
5378
- const SELECTOR_INDICATOR = '[data-bs-target]';
5379
5472
  const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
5380
5473
  const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
5381
- const POINTER_TYPE_TOUCH = 'touch';
5382
- const POINTER_TYPE_PEN = 'pen';
5474
+ const KEY_TO_DIRECTION = {
5475
+ [ARROW_LEFT_KEY$1]: DIRECTION_RIGHT,
5476
+ [ARROW_RIGHT_KEY$1]: DIRECTION_LEFT
5477
+ };
5478
+ const Default$b = {
5479
+ interval: 5000,
5480
+ keyboard: true,
5481
+ pause: 'hover',
5482
+ ride: false,
5483
+ touch: true,
5484
+ wrap: true
5485
+ };
5486
+ const DefaultType$b = {
5487
+ interval: '(number|boolean)',
5488
+ keyboard: 'boolean',
5489
+ pause: '(string|boolean)',
5490
+ ride: '(boolean|string)',
5491
+ touch: 'boolean',
5492
+ wrap: 'boolean'
5493
+ };
5383
5494
  class Carousel extends BaseComponent {
5384
5495
  constructor(element, config) {
5385
- super(element);
5386
- this._items = null;
5496
+ super(element, config);
5387
5497
  this._interval = null;
5388
5498
  this._activeElement = null;
5389
- this._isPaused = false;
5390
5499
  this._isSliding = false;
5391
5500
  this.touchTimeout = null;
5392
- this.touchStartX = 0;
5393
- this.touchDeltaX = 0;
5394
- this._config = this._getConfig(config);
5501
+ this._swipeHelper = null;
5395
5502
  this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
5396
- this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
5397
- this._pointerEvent = Boolean(window.PointerEvent);
5398
5503
  this._addEventListeners();
5504
+ if (this._config.ride === CLASS_NAME_CAROUSEL) {
5505
+ this.cycle();
5506
+ }
5399
5507
  }
5400
5508
  static get Default() {
5401
- return Default$a;
5509
+ return Default$b;
5510
+ }
5511
+ static get DefaultType() {
5512
+ return DefaultType$b;
5402
5513
  }
5403
5514
  static get NAME() {
5404
- return NAME$b;
5515
+ return NAME$c;
5405
5516
  }
5406
5517
  next() {
5407
5518
  this._slide(ORDER_NEXT);
@@ -5414,119 +5525,85 @@
5414
5525
  prev() {
5415
5526
  this._slide(ORDER_PREV);
5416
5527
  }
5417
- pause(event) {
5418
- if (!event) {
5419
- this._isPaused = true;
5420
- }
5421
- if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
5528
+ pause() {
5529
+ if (this._isSliding) {
5422
5530
  triggerTransitionEnd(this._element);
5423
- this.cycle(true);
5424
5531
  }
5425
- clearInterval(this._interval);
5426
- this._interval = null;
5532
+ this._clearInterval();
5427
5533
  }
5428
- cycle(event) {
5429
- if (!event) {
5430
- this._isPaused = false;
5431
- }
5432
- if (this._interval) {
5433
- clearInterval(this._interval);
5434
- this._interval = null;
5534
+ cycle() {
5535
+ this._clearInterval();
5536
+ this._updateInterval();
5537
+ this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval);
5538
+ }
5539
+ _maybeEnableCycle() {
5540
+ if (!this._config.ride) {
5541
+ return;
5435
5542
  }
5436
- if (this._config && this._config.interval && !this._isPaused) {
5437
- this._updateInterval();
5438
- this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
5543
+ if (this._isSliding) {
5544
+ EventHandler.one(this._element, EVENT_SLID, () => this.cycle());
5545
+ return;
5439
5546
  }
5547
+ this.cycle();
5440
5548
  }
5441
5549
  to(index) {
5442
- this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
5443
- const activeIndex = this._getItemIndex(this._activeElement);
5444
- if (index > this._items.length - 1 || index < 0) {
5550
+ const items = this._getItems();
5551
+ if (index > items.length - 1 || index < 0) {
5445
5552
  return;
5446
5553
  }
5447
5554
  if (this._isSliding) {
5448
5555
  EventHandler.one(this._element, EVENT_SLID, () => this.to(index));
5449
5556
  return;
5450
5557
  }
5558
+ const activeIndex = this._getItemIndex(this._getActive());
5451
5559
  if (activeIndex === index) {
5452
- this.pause();
5453
- this.cycle();
5454
5560
  return;
5455
5561
  }
5456
5562
  const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
5457
- this._slide(order, this._items[index]);
5563
+ this._slide(order, items[index]);
5458
5564
  }
5459
- _getConfig(config) {
5460
- config = { ...Default$a,
5461
- ...Manipulator.getDataAttributes(this._element),
5462
- ...(typeof config === 'object' ? config : {})
5463
- };
5464
- typeCheckConfig(NAME$b, config, DefaultType$a);
5565
+ dispose() {
5566
+ if (this._swipeHelper) {
5567
+ this._swipeHelper.dispose();
5568
+ }
5569
+ super.dispose();
5570
+ }
5571
+ _configAfterMerge(config) {
5572
+ config.defaultInterval = config.interval;
5465
5573
  return config;
5466
5574
  }
5467
- _handleSwipe() {
5468
- const absDeltax = Math.abs(this.touchDeltaX);
5469
- if (absDeltax <= SWIPE_THRESHOLD) {
5470
- return;
5471
- }
5472
- const direction = absDeltax / this.touchDeltaX;
5473
- this.touchDeltaX = 0;
5474
- if (!direction) {
5475
- return;
5476
- }
5477
- this._slide(direction > 0 ? DIRECTION_RIGHT : DIRECTION_LEFT);
5478
- }
5479
5575
  _addEventListeners() {
5480
5576
  if (this._config.keyboard) {
5481
- EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
5577
+ EventHandler.on(this._element, EVENT_KEYDOWN$1, event => this._keydown(event));
5482
5578
  }
5483
5579
  if (this._config.pause === 'hover') {
5484
- EventHandler.on(this._element, EVENT_MOUSEENTER, event => this.pause(event));
5485
- EventHandler.on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event));
5580
+ EventHandler.on(this._element, EVENT_MOUSEENTER$1, () => this.pause());
5581
+ EventHandler.on(this._element, EVENT_MOUSELEAVE$1, () => this._maybeEnableCycle());
5486
5582
  }
5487
- if (this._config.touch && this._touchSupported) {
5583
+ if (this._config.touch && Swipe.isSupported()) {
5488
5584
  this._addTouchEventListeners();
5489
5585
  }
5490
5586
  }
5491
5587
  _addTouchEventListeners() {
5492
- const hasPointerPenTouch = event => {
5493
- return this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH);
5494
- };
5495
- const start = event => {
5496
- if (hasPointerPenTouch(event)) {
5497
- this.touchStartX = event.clientX;
5498
- } else if (!this._pointerEvent) {
5499
- this.touchStartX = event.touches[0].clientX;
5588
+ for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) {
5589
+ EventHandler.on(img, EVENT_DRAG_START, event => event.preventDefault());
5590
+ }
5591
+ const endCallBack = () => {
5592
+ if (this._config.pause !== 'hover') {
5593
+ return;
5500
5594
  }
5501
- };
5502
- const move = event => {
5503
- this.touchDeltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this.touchStartX;
5504
- };
5505
- const end = event => {
5506
- if (hasPointerPenTouch(event)) {
5507
- this.touchDeltaX = event.clientX - this.touchStartX;
5508
- }
5509
- this._handleSwipe();
5510
- if (this._config.pause === 'hover') {
5511
- this.pause();
5512
- if (this.touchTimeout) {
5513
- clearTimeout(this.touchTimeout);
5514
- }
5515
- this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
5595
+ this.pause();
5596
+ if (this.touchTimeout) {
5597
+ clearTimeout(this.touchTimeout);
5516
5598
  }
5599
+ this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
5517
5600
  };
5518
- SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => {
5519
- EventHandler.on(itemImg, EVENT_DRAG_START, event => event.preventDefault());
5520
- });
5521
- if (this._pointerEvent) {
5522
- EventHandler.on(this._element, EVENT_POINTERDOWN, event => start(event));
5523
- EventHandler.on(this._element, EVENT_POINTERUP, event => end(event));
5524
- this._element.classList.add(CLASS_NAME_POINTER_EVENT);
5525
- } else {
5526
- EventHandler.on(this._element, EVENT_TOUCHSTART, event => start(event));
5527
- EventHandler.on(this._element, EVENT_TOUCHMOVE, event => move(event));
5528
- EventHandler.on(this._element, EVENT_TOUCHEND, event => end(event));
5529
- }
5601
+ const swipeConfig = {
5602
+ leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)),
5603
+ rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)),
5604
+ endCallback: endCallBack
5605
+ };
5606
+ this._swipeHelper = new Swipe(this._element, swipeConfig);
5530
5607
  }
5531
5608
  _keydown(event) {
5532
5609
  if (/input|textarea/i.test(event.target.tagName)) {
@@ -5535,207 +5612,162 @@
5535
5612
  const direction = KEY_TO_DIRECTION[event.key];
5536
5613
  if (direction) {
5537
5614
  event.preventDefault();
5538
- this._slide(direction);
5615
+ this._slide(this._directionToOrder(direction));
5539
5616
  }
5540
5617
  }
5541
5618
  _getItemIndex(element) {
5542
- this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : [];
5543
- return this._items.indexOf(element);
5544
- }
5545
- _getItemByOrder(order, activeElement) {
5546
- const isNext = order === ORDER_NEXT;
5547
- return getNextActiveElement(this._items, activeElement, isNext, this._config.wrap);
5548
- }
5549
- _triggerSlideEvent(relatedTarget, eventDirectionName) {
5550
- const targetIndex = this._getItemIndex(relatedTarget);
5551
- const fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element));
5552
- return EventHandler.trigger(this._element, EVENT_SLIDE, {
5553
- relatedTarget,
5554
- direction: eventDirectionName,
5555
- from: fromIndex,
5556
- to: targetIndex
5557
- });
5619
+ return this._getItems().indexOf(element);
5558
5620
  }
5559
- _setActiveIndicatorElement(element) {
5560
- if (this._indicatorsElement) {
5561
- const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE$1, this._indicatorsElement);
5562
- activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2);
5563
- activeIndicator.removeAttribute('aria-current');
5564
- const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement);
5565
- for (let i = 0; i < indicators.length; i++) {
5566
- if (Number.parseInt(indicators[i].getAttribute('data-bs-slide-to'), 10) === this._getItemIndex(element)) {
5567
- indicators[i].classList.add(CLASS_NAME_ACTIVE$2);
5568
- indicators[i].setAttribute('aria-current', 'true');
5569
- break;
5570
- }
5571
- }
5621
+ _setActiveIndicatorElement(index) {
5622
+ if (!this._indicatorsElement) {
5623
+ return;
5624
+ }
5625
+ const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement);
5626
+ activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2);
5627
+ activeIndicator.removeAttribute('aria-current');
5628
+ const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement);
5629
+ if (newActiveIndicator) {
5630
+ newActiveIndicator.classList.add(CLASS_NAME_ACTIVE$2);
5631
+ newActiveIndicator.setAttribute('aria-current', 'true');
5572
5632
  }
5573
5633
  }
5574
5634
  _updateInterval() {
5575
- const element = this._activeElement || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
5635
+ const element = this._activeElement || this._getActive();
5576
5636
  if (!element) {
5577
5637
  return;
5578
5638
  }
5579
5639
  const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10);
5580
- if (elementInterval) {
5581
- this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
5582
- this._config.interval = elementInterval;
5583
- } else {
5584
- this._config.interval = this._config.defaultInterval || this._config.interval;
5585
- }
5640
+ this._config.interval = elementInterval || this._config.defaultInterval;
5586
5641
  }
5587
- _slide(directionOrOrder, element) {
5588
- const order = this._directionToOrder(directionOrOrder);
5589
- const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
5590
- const activeElementIndex = this._getItemIndex(activeElement);
5591
- const nextElement = element || this._getItemByOrder(order, activeElement);
5592
- const nextElementIndex = this._getItemIndex(nextElement);
5593
- const isCycling = Boolean(this._interval);
5594
- const isNext = order === ORDER_NEXT;
5595
- const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
5596
- const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
5597
- const eventDirectionName = this._orderToDirection(order);
5598
- if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$2)) {
5599
- this._isSliding = false;
5642
+ _slide(order, element = null) {
5643
+ if (this._isSliding) {
5600
5644
  return;
5601
5645
  }
5602
- if (this._isSliding) {
5646
+ const activeElement = this._getActive();
5647
+ const isNext = order === ORDER_NEXT;
5648
+ const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap);
5649
+ if (nextElement === activeElement) {
5603
5650
  return;
5604
5651
  }
5605
- const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
5652
+ const nextElementIndex = this._getItemIndex(nextElement);
5653
+ const triggerEvent = eventName => {
5654
+ return EventHandler.trigger(this._element, eventName, {
5655
+ relatedTarget: nextElement,
5656
+ direction: this._orderToDirection(order),
5657
+ from: this._getItemIndex(activeElement),
5658
+ to: nextElementIndex
5659
+ });
5660
+ };
5661
+ const slideEvent = triggerEvent(EVENT_SLIDE);
5606
5662
  if (slideEvent.defaultPrevented) {
5607
5663
  return;
5608
5664
  }
5609
5665
  if (!activeElement || !nextElement) {
5610
5666
  return;
5611
5667
  }
5668
+ const isCycling = Boolean(this._interval);
5669
+ this.pause();
5612
5670
  this._isSliding = true;
5613
- if (isCycling) {
5614
- this.pause();
5615
- }
5616
- this._setActiveIndicatorElement(nextElement);
5671
+ this._setActiveIndicatorElement(nextElementIndex);
5617
5672
  this._activeElement = nextElement;
5618
- const triggerSlidEvent = () => {
5619
- EventHandler.trigger(this._element, EVENT_SLID, {
5620
- relatedTarget: nextElement,
5621
- direction: eventDirectionName,
5622
- from: activeElementIndex,
5623
- to: nextElementIndex
5624
- });
5625
- };
5626
- if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
5627
- nextElement.classList.add(orderClassName);
5628
- reflow(nextElement);
5629
- activeElement.classList.add(directionalClassName);
5630
- nextElement.classList.add(directionalClassName);
5631
- const completeCallBack = () => {
5632
- nextElement.classList.remove(directionalClassName, orderClassName);
5633
- nextElement.classList.add(CLASS_NAME_ACTIVE$2);
5634
- activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName);
5635
- this._isSliding = false;
5636
- setTimeout(triggerSlidEvent, 0);
5637
- };
5638
- this._queueCallback(completeCallBack, activeElement, true);
5639
- } else {
5640
- activeElement.classList.remove(CLASS_NAME_ACTIVE$2);
5673
+ const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
5674
+ const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
5675
+ nextElement.classList.add(orderClassName);
5676
+ reflow(nextElement);
5677
+ activeElement.classList.add(directionalClassName);
5678
+ nextElement.classList.add(directionalClassName);
5679
+ const completeCallBack = () => {
5680
+ nextElement.classList.remove(directionalClassName, orderClassName);
5641
5681
  nextElement.classList.add(CLASS_NAME_ACTIVE$2);
5682
+ activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName);
5642
5683
  this._isSliding = false;
5643
- triggerSlidEvent();
5644
- }
5684
+ triggerEvent(EVENT_SLID);
5685
+ };
5686
+ this._queueCallback(completeCallBack, activeElement, this._isAnimated());
5645
5687
  if (isCycling) {
5646
5688
  this.cycle();
5647
5689
  }
5648
5690
  }
5649
- _directionToOrder(direction) {
5650
- if (![DIRECTION_RIGHT, DIRECTION_LEFT].includes(direction)) {
5651
- return direction;
5691
+ _isAnimated() {
5692
+ return this._element.classList.contains(CLASS_NAME_SLIDE);
5693
+ }
5694
+ _getActive() {
5695
+ return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
5696
+ }
5697
+ _getItems() {
5698
+ return SelectorEngine.find(SELECTOR_ITEM, this._element);
5699
+ }
5700
+ _clearInterval() {
5701
+ if (this._interval) {
5702
+ clearInterval(this._interval);
5703
+ this._interval = null;
5652
5704
  }
5705
+ }
5706
+ _directionToOrder(direction) {
5653
5707
  if (isRTL()) {
5654
5708
  return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
5655
5709
  }
5656
5710
  return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
5657
5711
  }
5658
5712
  _orderToDirection(order) {
5659
- if (![ORDER_NEXT, ORDER_PREV].includes(order)) {
5660
- return order;
5661
- }
5662
5713
  if (isRTL()) {
5663
5714
  return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
5664
5715
  }
5665
5716
  return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
5666
5717
  }
5667
- static carouselInterface(element, config) {
5668
- const data = Carousel.getOrCreateInstance(element, config);
5669
- let {
5670
- _config
5671
- } = data;
5672
- if (typeof config === 'object') {
5673
- _config = { ..._config,
5674
- ...config
5675
- };
5676
- }
5677
- const action = typeof config === 'string' ? config : _config.slide;
5678
- if (typeof config === 'number') {
5679
- data.to(config);
5680
- } else if (typeof action === 'string') {
5681
- if (typeof data[action] === 'undefined') {
5682
- throw new TypeError(`No method named "${action}"`);
5683
- }
5684
- data[action]();
5685
- } else if (_config.interval && _config.ride) {
5686
- data.pause();
5687
- data.cycle();
5688
- }
5689
- }
5690
5718
  static jQueryInterface(config) {
5691
5719
  return this.each(function () {
5692
- Carousel.carouselInterface(this, config);
5720
+ const data = Carousel.getOrCreateInstance(this, config);
5721
+ if (typeof config === 'number') {
5722
+ data.to(config);
5723
+ return;
5724
+ }
5725
+ if (typeof config === 'string') {
5726
+ if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
5727
+ throw new TypeError(`No method named "${config}"`);
5728
+ }
5729
+ data[config]();
5730
+ }
5693
5731
  });
5694
5732
  }
5695
- static dataApiClickHandler(event) {
5696
- const target = getElementFromSelector(this);
5697
- if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
5698
- return;
5699
- }
5700
- const config = { ...Manipulator.getDataAttributes(target),
5701
- ...Manipulator.getDataAttributes(this)
5702
- };
5703
- const slideIndex = this.getAttribute('data-bs-slide-to');
5704
- if (slideIndex) {
5705
- config.interval = false;
5706
- }
5707
- Carousel.carouselInterface(target, config);
5708
- if (slideIndex) {
5709
- Carousel.getInstance(target).to(slideIndex);
5710
- }
5711
- event.preventDefault();
5712
- }
5713
5733
  }
5714
- EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
5715
- EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
5734
+ EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, function (event) {
5735
+ const target = getElementFromSelector(this);
5736
+ if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
5737
+ return;
5738
+ }
5739
+ event.preventDefault();
5740
+ const carousel = Carousel.getOrCreateInstance(target);
5741
+ const slideIndex = this.getAttribute('data-bs-slide-to');
5742
+ if (slideIndex) {
5743
+ carousel.to(slideIndex);
5744
+ carousel._maybeEnableCycle();
5745
+ return;
5746
+ }
5747
+ if (Manipulator.getDataAttribute(this, 'slide') === 'next') {
5748
+ carousel.next();
5749
+ carousel._maybeEnableCycle();
5750
+ return;
5751
+ }
5752
+ carousel.prev();
5753
+ carousel._maybeEnableCycle();
5754
+ });
5755
+ EventHandler.on(window, EVENT_LOAD_DATA_API$3, () => {
5716
5756
  const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
5717
- for (let i = 0, len = carousels.length; i < len; i++) {
5718
- Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i]));
5757
+ for (const carousel of carousels) {
5758
+ Carousel.getOrCreateInstance(carousel);
5719
5759
  }
5720
5760
  });
5721
5761
  defineJQueryPlugin(Carousel);
5722
- const NAME$a = 'collapse';
5723
- const DATA_KEY$9 = 'bs.collapse';
5724
- const EVENT_KEY$9 = `.${DATA_KEY$9}`;
5725
- const DATA_API_KEY$5 = '.data-api';
5726
- const Default$9 = {
5727
- toggle: true,
5728
- parent: null
5729
- };
5730
- const DefaultType$9 = {
5731
- toggle: 'boolean',
5732
- parent: '(null|element)'
5733
- };
5734
- const EVENT_SHOW$5 = `show${EVENT_KEY$9}`;
5735
- const EVENT_SHOWN$5 = `shown${EVENT_KEY$9}`;
5736
- const EVENT_HIDE$5 = `hide${EVENT_KEY$9}`;
5737
- const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$9}`;
5738
- const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$9}${DATA_API_KEY$5}`;
5762
+ const NAME$b = 'collapse';
5763
+ const DATA_KEY$7 = 'bs.collapse';
5764
+ const EVENT_KEY$7 = `.${DATA_KEY$7}`;
5765
+ const DATA_API_KEY$4 = '.data-api';
5766
+ const EVENT_SHOW$6 = `show${EVENT_KEY$7}`;
5767
+ const EVENT_SHOWN$6 = `shown${EVENT_KEY$7}`;
5768
+ const EVENT_HIDE$6 = `hide${EVENT_KEY$7}`;
5769
+ const EVENT_HIDDEN$6 = `hidden${EVENT_KEY$7}`;
5770
+ const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
5739
5771
  const CLASS_NAME_SHOW$7 = 'show';
5740
5772
  const CLASS_NAME_COLLAPSE = 'collapse';
5741
5773
  const CLASS_NAME_COLLAPSING = 'collapsing';
@@ -5746,19 +5778,24 @@
5746
5778
  const HEIGHT = 'height';
5747
5779
  const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing';
5748
5780
  const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]';
5781
+ const Default$a = {
5782
+ parent: null,
5783
+ toggle: true
5784
+ };
5785
+ const DefaultType$a = {
5786
+ parent: '(null|element)',
5787
+ toggle: 'boolean'
5788
+ };
5749
5789
  class Collapse extends BaseComponent {
5750
5790
  constructor(element, config) {
5751
- super(element);
5791
+ super(element, config);
5752
5792
  this._isTransitioning = false;
5753
- this._config = this._getConfig(config);
5754
5793
  this._triggerArray = [];
5755
5794
  const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4);
5756
- for (let i = 0, len = toggleList.length; i < len; i++) {
5757
- const elem = toggleList[i];
5795
+ for (const elem of toggleList) {
5758
5796
  const selector = getSelectorFromElement(elem);
5759
- const filterElement = SelectorEngine.find(selector).filter(foundElem => foundElem === this._element);
5797
+ const filterElement = SelectorEngine.find(selector).filter(foundElement => foundElement === this._element);
5760
5798
  if (selector !== null && filterElement.length) {
5761
- this._selector = selector;
5762
5799
  this._triggerArray.push(elem);
5763
5800
  }
5764
5801
  }
@@ -5771,10 +5808,13 @@
5771
5808
  }
5772
5809
  }
5773
5810
  static get Default() {
5774
- return Default$9;
5811
+ return Default$a;
5812
+ }
5813
+ static get DefaultType() {
5814
+ return DefaultType$a;
5775
5815
  }
5776
5816
  static get NAME() {
5777
- return NAME$a;
5817
+ return NAME$b;
5778
5818
  }
5779
5819
  toggle() {
5780
5820
  if (this._isShown()) {
@@ -5787,34 +5827,22 @@
5787
5827
  if (this._isTransitioning || this._isShown()) {
5788
5828
  return;
5789
5829
  }
5790
- let actives = [];
5791
- let activesData;
5830
+ let activeChildren = [];
5792
5831
  if (this._config.parent) {
5793
- const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
5794
- actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem));
5795
- }
5796
- const container = SelectorEngine.findOne(this._selector);
5797
- if (actives.length) {
5798
- const tempActiveData = actives.find(elem => container !== elem);
5799
- activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
5800
- if (activesData && activesData._isTransitioning) {
5801
- return;
5802
- }
5832
+ activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter(element => element !== this._element).map(element => Collapse.getOrCreateInstance(element, {
5833
+ toggle: false
5834
+ }));
5835
+ }
5836
+ if (activeChildren.length && activeChildren[0]._isTransitioning) {
5837
+ return;
5803
5838
  }
5804
- const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$5);
5839
+ const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$6);
5805
5840
  if (startEvent.defaultPrevented) {
5806
5841
  return;
5807
5842
  }
5808
- actives.forEach(elemActive => {
5809
- if (container !== elemActive) {
5810
- Collapse.getOrCreateInstance(elemActive, {
5811
- toggle: false
5812
- }).hide();
5813
- }
5814
- if (!activesData) {
5815
- Data.set(elemActive, DATA_KEY$9, null);
5816
- }
5817
- });
5843
+ for (const activeInstance of activeChildren) {
5844
+ activeInstance.hide();
5845
+ }
5818
5846
  const dimension = this._getDimension();
5819
5847
  this._element.classList.remove(CLASS_NAME_COLLAPSE);
5820
5848
  this._element.classList.add(CLASS_NAME_COLLAPSING);
@@ -5826,7 +5854,7 @@
5826
5854
  this._element.classList.remove(CLASS_NAME_COLLAPSING);
5827
5855
  this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
5828
5856
  this._element.style[dimension] = '';
5829
- EventHandler.trigger(this._element, EVENT_SHOWN$5);
5857
+ EventHandler.trigger(this._element, EVENT_SHOWN$6);
5830
5858
  };
5831
5859
  const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
5832
5860
  const scrollSize = `scroll${capitalizedDimension}`;
@@ -5837,7 +5865,7 @@
5837
5865
  if (this._isTransitioning || !this._isShown()) {
5838
5866
  return;
5839
5867
  }
5840
- const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$5);
5868
+ const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$6);
5841
5869
  if (startEvent.defaultPrevented) {
5842
5870
  return;
5843
5871
  }
@@ -5846,11 +5874,9 @@
5846
5874
  reflow(this._element);
5847
5875
  this._element.classList.add(CLASS_NAME_COLLAPSING);
5848
5876
  this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
5849
- const triggerArrayLength = this._triggerArray.length;
5850
- for (let i = 0; i < triggerArrayLength; i++) {
5851
- const trigger = this._triggerArray[i];
5852
- const elem = getElementFromSelector(trigger);
5853
- if (elem && !this._isShown(elem)) {
5877
+ for (const trigger of this._triggerArray) {
5878
+ const element = getElementFromSelector(trigger);
5879
+ if (element && !this._isShown(element)) {
5854
5880
  this._addAriaAndCollapsedClass([trigger], false);
5855
5881
  }
5856
5882
  }
@@ -5859,7 +5885,7 @@
5859
5885
  this._isTransitioning = false;
5860
5886
  this._element.classList.remove(CLASS_NAME_COLLAPSING);
5861
5887
  this._element.classList.add(CLASS_NAME_COLLAPSE);
5862
- EventHandler.trigger(this._element, EVENT_HIDDEN$5);
5888
+ EventHandler.trigger(this._element, EVENT_HIDDEN$6);
5863
5889
  };
5864
5890
  this._element.style[dimension] = '';
5865
5891
  this._queueCallback(complete, this._element, true);
@@ -5867,14 +5893,9 @@
5867
5893
  _isShown(element = this._element) {
5868
5894
  return element.classList.contains(CLASS_NAME_SHOW$7);
5869
5895
  }
5870
- _getConfig(config) {
5871
- config = { ...Default$9,
5872
- ...Manipulator.getDataAttributes(this._element),
5873
- ...config
5874
- };
5896
+ _configAfterMerge(config) {
5875
5897
  config.toggle = Boolean(config.toggle);
5876
5898
  config.parent = getElement(config.parent);
5877
- typeCheckConfig(NAME$a, config, DefaultType$9);
5878
5899
  return config;
5879
5900
  }
5880
5901
  _getDimension() {
@@ -5884,33 +5905,33 @@
5884
5905
  if (!this._config.parent) {
5885
5906
  return;
5886
5907
  }
5887
- const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
5888
- SelectorEngine.find(SELECTOR_DATA_TOGGLE$4, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => {
5908
+ const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE$4);
5909
+ for (const element of children) {
5889
5910
  const selected = getElementFromSelector(element);
5890
5911
  if (selected) {
5891
5912
  this._addAriaAndCollapsedClass([element], this._isShown(selected));
5892
5913
  }
5893
- });
5914
+ }
5915
+ }
5916
+ _getFirstLevelChildren(selector) {
5917
+ const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
5918
+ return SelectorEngine.find(selector, this._config.parent).filter(element => !children.includes(element));
5894
5919
  }
5895
5920
  _addAriaAndCollapsedClass(triggerArray, isOpen) {
5896
5921
  if (!triggerArray.length) {
5897
5922
  return;
5898
5923
  }
5899
- triggerArray.forEach(elem => {
5900
- if (isOpen) {
5901
- elem.classList.remove(CLASS_NAME_COLLAPSED);
5902
- } else {
5903
- elem.classList.add(CLASS_NAME_COLLAPSED);
5904
- }
5905
- elem.setAttribute('aria-expanded', isOpen);
5906
- });
5924
+ for (const element of triggerArray) {
5925
+ element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen);
5926
+ element.setAttribute('aria-expanded', isOpen);
5927
+ }
5907
5928
  }
5908
5929
  static jQueryInterface(config) {
5930
+ const _config = {};
5931
+ if (typeof config === 'string' && /show|hide/.test(config)) {
5932
+ _config.toggle = false;
5933
+ }
5909
5934
  return this.each(function () {
5910
- const _config = {};
5911
- if (typeof config === 'string' && /show|hide/.test(config)) {
5912
- _config.toggle = false;
5913
- }
5914
5935
  const data = Collapse.getOrCreateInstance(this, _config);
5915
5936
  if (typeof config === 'string') {
5916
5937
  if (typeof data[config] === 'undefined') {
@@ -5927,38 +5948,39 @@
5927
5948
  }
5928
5949
  const selector = getSelectorFromElement(this);
5929
5950
  const selectorElements = SelectorEngine.find(selector);
5930
- selectorElements.forEach(element => {
5951
+ for (const element of selectorElements) {
5931
5952
  Collapse.getOrCreateInstance(element, {
5932
5953
  toggle: false
5933
5954
  }).toggle();
5934
- });
5955
+ }
5935
5956
  });
5936
5957
  defineJQueryPlugin(Collapse);
5937
- const NAME$9 = 'dropdown';
5938
- const DATA_KEY$8 = 'bs.dropdown';
5939
- const EVENT_KEY$8 = `.${DATA_KEY$8}`;
5940
- const DATA_API_KEY$4 = '.data-api';
5958
+ const NAME$a = 'dropdown';
5959
+ const DATA_KEY$6 = 'bs.dropdown';
5960
+ const EVENT_KEY$6 = `.${DATA_KEY$6}`;
5961
+ const DATA_API_KEY$3 = '.data-api';
5941
5962
  const ESCAPE_KEY$2 = 'Escape';
5942
- const SPACE_KEY = 'Space';
5943
5963
  const TAB_KEY$1 = 'Tab';
5944
- const ARROW_UP_KEY = 'ArrowUp';
5945
- const ARROW_DOWN_KEY = 'ArrowDown';
5964
+ const ARROW_UP_KEY$1 = 'ArrowUp';
5965
+ const ARROW_DOWN_KEY$1 = 'ArrowDown';
5946
5966
  const RIGHT_MOUSE_BUTTON = 2;
5947
- const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`);
5948
- const EVENT_HIDE$4 = `hide${EVENT_KEY$8}`;
5949
- const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$8}`;
5950
- const EVENT_SHOW$4 = `show${EVENT_KEY$8}`;
5951
- const EVENT_SHOWN$4 = `shown${EVENT_KEY$8}`;
5952
- const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$8}${DATA_API_KEY$4}`;
5953
- const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$8}${DATA_API_KEY$4}`;
5954
- const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$8}${DATA_API_KEY$4}`;
5967
+ const EVENT_HIDE$5 = `hide${EVENT_KEY$6}`;
5968
+ const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$6}`;
5969
+ const EVENT_SHOW$5 = `show${EVENT_KEY$6}`;
5970
+ const EVENT_SHOWN$5 = `shown${EVENT_KEY$6}`;
5971
+ const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
5972
+ const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$6}${DATA_API_KEY$3}`;
5973
+ const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$6}${DATA_API_KEY$3}`;
5955
5974
  const CLASS_NAME_SHOW$6 = 'show';
5956
5975
  const CLASS_NAME_DROPUP = 'dropup';
5957
5976
  const CLASS_NAME_DROPEND = 'dropend';
5958
5977
  const CLASS_NAME_DROPSTART = 'dropstart';
5959
- const CLASS_NAME_NAVBAR = 'navbar';
5960
- const SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]';
5978
+ const CLASS_NAME_DROPUP_CENTER = 'dropup-center';
5979
+ const CLASS_NAME_DROPDOWN_CENTER = 'dropdown-center';
5980
+ const SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)';
5981
+ const SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE$3}.${CLASS_NAME_SHOW$6}`;
5961
5982
  const SELECTOR_MENU = '.dropdown-menu';
5983
+ const SELECTOR_NAVBAR = '.navbar';
5962
5984
  const SELECTOR_NAVBAR_NAV = '.navbar-nav';
5963
5985
  const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
5964
5986
  const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start';
@@ -5967,70 +5989,69 @@
5967
5989
  const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
5968
5990
  const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
5969
5991
  const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
5970
- const Default$8 = {
5971
- offset: [0, 2],
5992
+ const PLACEMENT_TOPCENTER = 'top';
5993
+ const PLACEMENT_BOTTOMCENTER = 'bottom';
5994
+ const Default$9 = {
5995
+ autoClose: true,
5972
5996
  boundary: 'clippingParents',
5973
- reference: 'toggle',
5974
5997
  display: 'dynamic',
5998
+ offset: [0, 2],
5975
5999
  popperConfig: null,
5976
- autoClose: true
6000
+ reference: 'toggle'
5977
6001
  };
5978
- const DefaultType$8 = {
5979
- offset: '(array|string|function)',
6002
+ const DefaultType$9 = {
6003
+ autoClose: '(boolean|string)',
5980
6004
  boundary: '(string|element)',
5981
- reference: '(string|element|object)',
5982
6005
  display: 'string',
6006
+ offset: '(array|string|function)',
5983
6007
  popperConfig: '(null|object|function)',
5984
- autoClose: '(boolean|string)'
6008
+ reference: '(string|element|object)'
5985
6009
  };
5986
6010
  class Dropdown extends BaseComponent {
5987
6011
  constructor(element, config) {
5988
- super(element);
6012
+ super(element, config);
5989
6013
  this._popper = null;
5990
- this._config = this._getConfig(config);
5991
- this._menu = this._getMenuElement();
6014
+ this._parent = this._element.parentNode;
6015
+ this._menu = SelectorEngine.findOne(SELECTOR_MENU, this._parent);
5992
6016
  this._inNavbar = this._detectNavbar();
5993
6017
  }
5994
6018
  static get Default() {
5995
- return Default$8;
6019
+ return Default$9;
5996
6020
  }
5997
6021
  static get DefaultType() {
5998
- return DefaultType$8;
6022
+ return DefaultType$9;
5999
6023
  }
6000
6024
  static get NAME() {
6001
- return NAME$9;
6025
+ return NAME$a;
6002
6026
  }
6003
6027
  toggle() {
6004
6028
  return this._isShown() ? this.hide() : this.show();
6005
6029
  }
6006
6030
  show() {
6007
- if (isDisabled(this._element) || this._isShown(this._menu)) {
6031
+ if (isDisabled(this._element) || this._isShown()) {
6008
6032
  return;
6009
6033
  }
6010
6034
  const relatedTarget = {
6011
6035
  relatedTarget: this._element
6012
6036
  };
6013
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, relatedTarget);
6037
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$5, relatedTarget);
6014
6038
  if (showEvent.defaultPrevented) {
6015
6039
  return;
6016
6040
  }
6017
- const parent = Dropdown.getParentFromElement(this._element);
6018
- if (this._inNavbar) {
6019
- Manipulator.setDataAttribute(this._menu, 'popper', 'none');
6020
- } else {
6021
- this._createPopper(parent);
6022
- }
6023
- if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
6024
- [].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', noop));
6041
+ this._createPopper();
6042
+ if ('ontouchstart' in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) {
6043
+ for (const element of [].concat(...document.body.children)) {
6044
+ EventHandler.on(element, 'mouseover', noop);
6045
+ }
6025
6046
  }
6026
6047
  this._element.focus();
6027
6048
  this._element.setAttribute('aria-expanded', true);
6028
6049
  this._menu.classList.add(CLASS_NAME_SHOW$6);
6029
6050
  this._element.classList.add(CLASS_NAME_SHOW$6);
6030
- EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget);
6051
+ EventHandler.trigger(this._element, EVENT_SHOWN$5, relatedTarget);
6031
6052
  }
6032
6053
  hide() {
6033
- if (isDisabled(this._element) || !this._isShown(this._menu)) {
6054
+ if (isDisabled(this._element) || !this._isShown()) {
6034
6055
  return;
6035
6056
  }
6036
6057
  const relatedTarget = {
@@ -6051,12 +6072,14 @@
6051
6072
  }
6052
6073
  }
6053
6074
  _completeHide(relatedTarget) {
6054
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
6075
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget);
6055
6076
  if (hideEvent.defaultPrevented) {
6056
6077
  return;
6057
6078
  }
6058
6079
  if ('ontouchstart' in document.documentElement) {
6059
- [].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', noop));
6080
+ for (const element of [].concat(...document.body.children)) {
6081
+ EventHandler.off(element, 'mouseover', noop);
6082
+ }
6060
6083
  }
6061
6084
  if (this._popper) {
6062
6085
  this._popper.destroy();
@@ -6065,52 +6088,47 @@
6065
6088
  this._element.classList.remove(CLASS_NAME_SHOW$6);
6066
6089
  this._element.setAttribute('aria-expanded', 'false');
6067
6090
  Manipulator.removeDataAttribute(this._menu, 'popper');
6068
- EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget);
6091
+ EventHandler.trigger(this._element, EVENT_HIDDEN$5, relatedTarget);
6069
6092
  }
6070
6093
  _getConfig(config) {
6071
- config = { ...this.constructor.Default,
6072
- ...Manipulator.getDataAttributes(this._element),
6073
- ...config
6074
- };
6075
- typeCheckConfig(NAME$9, config, this.constructor.DefaultType);
6094
+ config = super._getConfig(config);
6076
6095
  if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
6077
- throw new TypeError(`${NAME$9.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
6096
+ throw new TypeError(`${NAME$a.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
6078
6097
  }
6079
6098
  return config;
6080
6099
  }
6081
- _createPopper(parent) {
6100
+ _createPopper() {
6082
6101
  if (typeof Popper === 'undefined') {
6083
6102
  throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
6084
6103
  }
6085
6104
  let referenceElement = this._element;
6086
6105
  if (this._config.reference === 'parent') {
6087
- referenceElement = parent;
6106
+ referenceElement = this._parent;
6088
6107
  } else if (isElement(this._config.reference)) {
6089
6108
  referenceElement = getElement(this._config.reference);
6090
6109
  } else if (typeof this._config.reference === 'object') {
6091
6110
  referenceElement = this._config.reference;
6092
6111
  }
6093
6112
  const popperConfig = this._getPopperConfig();
6094
- const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
6095
6113
  this._popper = createPopper(referenceElement, this._menu, popperConfig);
6096
- if (isDisplayStatic) {
6097
- Manipulator.setDataAttribute(this._menu, 'popper', 'static');
6098
- }
6099
- }
6100
- _isShown(element = this._element) {
6101
- return element.classList.contains(CLASS_NAME_SHOW$6);
6102
6114
  }
6103
- _getMenuElement() {
6104
- return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
6115
+ _isShown() {
6116
+ return this._menu.classList.contains(CLASS_NAME_SHOW$6);
6105
6117
  }
6106
6118
  _getPlacement() {
6107
- const parentDropdown = this._element.parentNode;
6119
+ const parentDropdown = this._parent;
6108
6120
  if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
6109
6121
  return PLACEMENT_RIGHT;
6110
6122
  }
6111
6123
  if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
6112
6124
  return PLACEMENT_LEFT;
6113
6125
  }
6126
+ if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) {
6127
+ return PLACEMENT_TOPCENTER;
6128
+ }
6129
+ if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) {
6130
+ return PLACEMENT_BOTTOMCENTER;
6131
+ }
6114
6132
  const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end';
6115
6133
  if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
6116
6134
  return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
@@ -6118,14 +6136,14 @@
6118
6136
  return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
6119
6137
  }
6120
6138
  _detectNavbar() {
6121
- return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null;
6139
+ return this._element.closest(SELECTOR_NAVBAR) !== null;
6122
6140
  }
6123
6141
  _getOffset() {
6124
6142
  const {
6125
6143
  offset
6126
6144
  } = this._config;
6127
6145
  if (typeof offset === 'string') {
6128
- return offset.split(',').map(val => Number.parseInt(val, 10));
6146
+ return offset.split(',').map(value => Number.parseInt(value, 10));
6129
6147
  }
6130
6148
  if (typeof offset === 'function') {
6131
6149
  return popperData => offset(popperData, this._element);
@@ -6147,7 +6165,8 @@
6147
6165
  }
6148
6166
  }]
6149
6167
  };
6150
- if (this._config.display === 'static') {
6168
+ if (this._inNavbar || this._config.display === 'static') {
6169
+ Manipulator.setDataAttribute(this._menu, 'popper', 'static');
6151
6170
  defaultBsPopperConfig.modifiers = [{
6152
6171
  name: 'applyStyles',
6153
6172
  enabled: false
@@ -6161,11 +6180,11 @@
6161
6180
  key,
6162
6181
  target
6163
6182
  }) {
6164
- const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
6183
+ const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(element => isVisible(element));
6165
6184
  if (!items.length) {
6166
6185
  return;
6167
6186
  }
6168
- getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus();
6187
+ getNextActiveElement(items, target, key === ARROW_DOWN_KEY$1, !items.includes(target)).focus();
6169
6188
  }
6170
6189
  static jQueryInterface(config) {
6171
6190
  return this.each(function () {
@@ -6180,68 +6199,55 @@
6180
6199
  });
6181
6200
  }
6182
6201
  static clearMenus(event) {
6183
- if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1)) {
6202
+ if (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1) {
6184
6203
  return;
6185
6204
  }
6186
- const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$3);
6187
- for (let i = 0, len = toggles.length; i < len; i++) {
6188
- const context = Dropdown.getInstance(toggles[i]);
6205
+ const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN);
6206
+ for (const toggle of openToggles) {
6207
+ const context = Dropdown.getInstance(toggle);
6189
6208
  if (!context || context._config.autoClose === false) {
6190
6209
  continue;
6191
6210
  }
6192
- if (!context._isShown()) {
6211
+ const composedPath = event.composedPath();
6212
+ const isMenuTarget = composedPath.includes(context._menu);
6213
+ if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) {
6214
+ continue;
6215
+ }
6216
+ if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) {
6193
6217
  continue;
6194
6218
  }
6195
6219
  const relatedTarget = {
6196
6220
  relatedTarget: context._element
6197
6221
  };
6198
- if (event) {
6199
- const composedPath = event.composedPath();
6200
- const isMenuTarget = composedPath.includes(context._menu);
6201
- if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) {
6202
- continue;
6203
- }
6204
- if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) {
6205
- continue;
6206
- }
6207
- if (event.type === 'click') {
6208
- relatedTarget.clickEvent = event;
6209
- }
6222
+ if (event.type === 'click') {
6223
+ relatedTarget.clickEvent = event;
6210
6224
  }
6211
6225
  context._completeHide(relatedTarget);
6212
6226
  }
6213
6227
  }
6214
- static getParentFromElement(element) {
6215
- return getElementFromSelector(element) || element.parentNode;
6216
- }
6217
6228
  static dataApiKeydownHandler(event) {
6218
- if (/input|textarea/i.test(event.target.tagName) ? event.key === SPACE_KEY || event.key !== ESCAPE_KEY$2 && (event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY || event.target.closest(SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(event.key)) {
6229
+ const isInput = /input|textarea/i.test(event.target.tagName);
6230
+ const isEscapeEvent = event.key === ESCAPE_KEY$2;
6231
+ const isUpOrDownEvent = [ARROW_UP_KEY$1, ARROW_DOWN_KEY$1].includes(event.key);
6232
+ if (!isUpOrDownEvent && !isEscapeEvent) {
6219
6233
  return;
6220
6234
  }
6221
- const isActive = this.classList.contains(CLASS_NAME_SHOW$6);
6222
- if (!isActive && event.key === ESCAPE_KEY$2) {
6235
+ if (isInput && !isEscapeEvent) {
6223
6236
  return;
6224
6237
  }
6225
6238
  event.preventDefault();
6226
- event.stopPropagation();
6227
- if (isDisabled(this)) {
6228
- return;
6229
- }
6230
- const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
6239
+ const getToggleButton = SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$3, event.delegateTarget.parentNode);
6231
6240
  const instance = Dropdown.getOrCreateInstance(getToggleButton);
6232
- if (event.key === ESCAPE_KEY$2) {
6233
- instance.hide();
6234
- return;
6235
- }
6236
- if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
6237
- if (!isActive) {
6238
- instance.show();
6239
- }
6241
+ if (isUpOrDownEvent) {
6242
+ event.stopPropagation();
6243
+ instance.show();
6240
6244
  instance._selectMenuItem(event);
6241
6245
  return;
6242
6246
  }
6243
- if (!isActive || event.key === SPACE_KEY) {
6244
- Dropdown.clearMenus();
6247
+ if (instance._isShown()) {
6248
+ event.stopPropagation();
6249
+ instance.hide();
6250
+ getToggleButton.focus();
6245
6251
  }
6246
6252
  }
6247
6253
  }
@@ -6256,6 +6262,8 @@
6256
6262
  defineJQueryPlugin(Dropdown);
6257
6263
  const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
6258
6264
  const SELECTOR_STICKY_CONTENT = '.sticky-top';
6265
+ const PROPERTY_PADDING = 'padding-right';
6266
+ const PROPERTY_MARGIN = 'margin-right';
6259
6267
  class ScrollBarHelper {
6260
6268
  constructor() {
6261
6269
  this._element = document.body;
@@ -6267,95 +6275,108 @@
6267
6275
  hide() {
6268
6276
  const width = this.getWidth();
6269
6277
  this._disableOverFlow();
6270
- this._setElementAttributes(this._element, 'paddingRight', calculatedValue => calculatedValue + width);
6271
- this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
6272
- this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
6278
+ this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
6279
+ this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
6280
+ this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width);
6281
+ }
6282
+ reset() {
6283
+ this._resetElementAttributes(this._element, 'overflow');
6284
+ this._resetElementAttributes(this._element, PROPERTY_PADDING);
6285
+ this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING);
6286
+ this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN);
6287
+ }
6288
+ isOverflowing() {
6289
+ return this.getWidth() > 0;
6273
6290
  }
6274
6291
  _disableOverFlow() {
6275
6292
  this._saveInitialAttribute(this._element, 'overflow');
6276
6293
  this._element.style.overflow = 'hidden';
6277
6294
  }
6278
- _setElementAttributes(selector, styleProp, callback) {
6295
+ _setElementAttributes(selector, styleProperty, callback) {
6279
6296
  const scrollbarWidth = this.getWidth();
6280
6297
  const manipulationCallBack = element => {
6281
6298
  if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
6282
6299
  return;
6283
6300
  }
6284
- this._saveInitialAttribute(element, styleProp);
6285
- const calculatedValue = window.getComputedStyle(element)[styleProp];
6286
- element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
6301
+ this._saveInitialAttribute(element, styleProperty);
6302
+ const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty);
6303
+ element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`);
6287
6304
  };
6288
6305
  this._applyManipulationCallback(selector, manipulationCallBack);
6289
6306
  }
6290
- reset() {
6291
- this._resetElementAttributes(this._element, 'overflow');
6292
- this._resetElementAttributes(this._element, 'paddingRight');
6293
- this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
6294
- this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
6295
- }
6296
- _saveInitialAttribute(element, styleProp) {
6297
- const actualValue = element.style[styleProp];
6307
+ _saveInitialAttribute(element, styleProperty) {
6308
+ const actualValue = element.style.getPropertyValue(styleProperty);
6298
6309
  if (actualValue) {
6299
- Manipulator.setDataAttribute(element, styleProp, actualValue);
6310
+ Manipulator.setDataAttribute(element, styleProperty, actualValue);
6300
6311
  }
6301
6312
  }
6302
- _resetElementAttributes(selector, styleProp) {
6313
+ _resetElementAttributes(selector, styleProperty) {
6303
6314
  const manipulationCallBack = element => {
6304
- const value = Manipulator.getDataAttribute(element, styleProp);
6305
- if (typeof value === 'undefined') {
6306
- element.style.removeProperty(styleProp);
6307
- } else {
6308
- Manipulator.removeDataAttribute(element, styleProp);
6309
- element.style[styleProp] = value;
6315
+ const value = Manipulator.getDataAttribute(element, styleProperty);
6316
+ if (value === null) {
6317
+ element.style.removeProperty(styleProperty);
6318
+ return;
6310
6319
  }
6320
+ Manipulator.removeDataAttribute(element, styleProperty);
6321
+ element.style.setProperty(styleProperty, value);
6311
6322
  };
6312
6323
  this._applyManipulationCallback(selector, manipulationCallBack);
6313
6324
  }
6314
6325
  _applyManipulationCallback(selector, callBack) {
6315
6326
  if (isElement(selector)) {
6316
6327
  callBack(selector);
6317
- } else {
6318
- SelectorEngine.find(selector, this._element).forEach(callBack);
6328
+ return;
6329
+ }
6330
+ for (const sel of SelectorEngine.find(selector, this._element)) {
6331
+ callBack(sel);
6319
6332
  }
6320
- }
6321
- isOverflowing() {
6322
- return this.getWidth() > 0;
6323
6333
  }
6324
6334
  }
6325
- const Default$7 = {
6335
+ const NAME$9 = 'backdrop';
6336
+ const CLASS_NAME_FADE$4 = 'fade';
6337
+ const CLASS_NAME_SHOW$5 = 'show';
6338
+ const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`;
6339
+ const Default$8 = {
6326
6340
  className: 'modal-backdrop',
6327
- isVisible: true,
6341
+ clickCallback: null,
6328
6342
  isAnimated: false,
6329
- rootElement: 'body',
6330
- clickCallback: null
6343
+ isVisible: true,
6344
+ rootElement: 'body'
6331
6345
  };
6332
- const DefaultType$7 = {
6346
+ const DefaultType$8 = {
6333
6347
  className: 'string',
6334
- isVisible: 'boolean',
6348
+ clickCallback: '(function|null)',
6335
6349
  isAnimated: 'boolean',
6336
- rootElement: '(element|string)',
6337
- clickCallback: '(function|null)'
6350
+ isVisible: 'boolean',
6351
+ rootElement: '(element|string)'
6338
6352
  };
6339
- const NAME$8 = 'backdrop';
6340
- const CLASS_NAME_FADE$4 = 'fade';
6341
- const CLASS_NAME_SHOW$5 = 'show';
6342
- const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$8}`;
6343
- class Backdrop {
6353
+ class Backdrop extends Config {
6344
6354
  constructor(config) {
6355
+ super();
6345
6356
  this._config = this._getConfig(config);
6346
6357
  this._isAppended = false;
6347
6358
  this._element = null;
6348
6359
  }
6360
+ static get Default() {
6361
+ return Default$8;
6362
+ }
6363
+ static get DefaultType() {
6364
+ return DefaultType$8;
6365
+ }
6366
+ static get NAME() {
6367
+ return NAME$9;
6368
+ }
6349
6369
  show(callback) {
6350
6370
  if (!this._config.isVisible) {
6351
6371
  execute(callback);
6352
6372
  return;
6353
6373
  }
6354
6374
  this._append();
6375
+ const element = this._getElement();
6355
6376
  if (this._config.isAnimated) {
6356
- reflow(this._getElement());
6377
+ reflow(element);
6357
6378
  }
6358
- this._getElement().classList.add(CLASS_NAME_SHOW$5);
6379
+ element.classList.add(CLASS_NAME_SHOW$5);
6359
6380
  this._emulateAnimation(() => {
6360
6381
  execute(callback);
6361
6382
  });
@@ -6371,6 +6392,14 @@
6371
6392
  execute(callback);
6372
6393
  });
6373
6394
  }
6395
+ dispose() {
6396
+ if (!this._isAppended) {
6397
+ return;
6398
+ }
6399
+ EventHandler.off(this._element, EVENT_MOUSEDOWN);
6400
+ this._element.remove();
6401
+ this._isAppended = false;
6402
+ }
6374
6403
  _getElement() {
6375
6404
  if (!this._element) {
6376
6405
  const backdrop = document.createElement('div');
@@ -6382,71 +6411,66 @@
6382
6411
  }
6383
6412
  return this._element;
6384
6413
  }
6385
- _getConfig(config) {
6386
- config = { ...Default$7,
6387
- ...(typeof config === 'object' ? config : {})
6388
- };
6414
+ _configAfterMerge(config) {
6389
6415
  config.rootElement = getElement(config.rootElement);
6390
- typeCheckConfig(NAME$8, config, DefaultType$7);
6391
6416
  return config;
6392
6417
  }
6393
6418
  _append() {
6394
6419
  if (this._isAppended) {
6395
6420
  return;
6396
6421
  }
6397
- this._config.rootElement.append(this._getElement());
6398
- EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
6422
+ const element = this._getElement();
6423
+ this._config.rootElement.append(element);
6424
+ EventHandler.on(element, EVENT_MOUSEDOWN, () => {
6399
6425
  execute(this._config.clickCallback);
6400
6426
  });
6401
6427
  this._isAppended = true;
6402
6428
  }
6403
- dispose() {
6404
- if (!this._isAppended) {
6405
- return;
6406
- }
6407
- EventHandler.off(this._element, EVENT_MOUSEDOWN);
6408
- this._element.remove();
6409
- this._isAppended = false;
6410
- }
6411
6429
  _emulateAnimation(callback) {
6412
6430
  executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
6413
6431
  }
6414
6432
  }
6415
- const Default$6 = {
6416
- trapElement: null,
6417
- autofocus: true
6418
- };
6419
- const DefaultType$6 = {
6420
- trapElement: 'element',
6421
- autofocus: 'boolean'
6422
- };
6423
- const NAME$7 = 'focustrap';
6424
- const DATA_KEY$7 = 'bs.focustrap';
6425
- const EVENT_KEY$7 = `.${DATA_KEY$7}`;
6426
- const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$7}`;
6427
- const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$7}`;
6433
+ const NAME$8 = 'focustrap';
6434
+ const DATA_KEY$5 = 'bs.focustrap';
6435
+ const EVENT_KEY$5 = `.${DATA_KEY$5}`;
6436
+ const EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$5}`;
6437
+ const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$5}`;
6428
6438
  const TAB_KEY = 'Tab';
6429
6439
  const TAB_NAV_FORWARD = 'forward';
6430
6440
  const TAB_NAV_BACKWARD = 'backward';
6431
- class FocusTrap {
6432
- constructor(config) {
6433
- this._config = this._getConfig(config);
6441
+ const Default$7 = {
6442
+ autofocus: true,
6443
+ trapElement: null
6444
+ };
6445
+ const DefaultType$7 = {
6446
+ autofocus: 'boolean',
6447
+ trapElement: 'element'
6448
+ };
6449
+ class FocusTrap extends Config {
6450
+ constructor(config) {
6451
+ super();
6452
+ this._config = this._getConfig(config);
6434
6453
  this._isActive = false;
6435
6454
  this._lastTabNavDirection = null;
6436
6455
  }
6456
+ static get Default() {
6457
+ return Default$7;
6458
+ }
6459
+ static get DefaultType() {
6460
+ return DefaultType$7;
6461
+ }
6462
+ static get NAME() {
6463
+ return NAME$8;
6464
+ }
6437
6465
  activate() {
6438
- const {
6439
- trapElement,
6440
- autofocus
6441
- } = this._config;
6442
6466
  if (this._isActive) {
6443
6467
  return;
6444
6468
  }
6445
- if (autofocus) {
6446
- trapElement.focus();
6469
+ if (this._config.autofocus) {
6470
+ this._config.trapElement.focus();
6447
6471
  }
6448
- EventHandler.off(document, EVENT_KEY$7);
6449
- EventHandler.on(document, EVENT_FOCUSIN$1, event => this._handleFocusin(event));
6472
+ EventHandler.off(document, EVENT_KEY$5);
6473
+ EventHandler.on(document, EVENT_FOCUSIN$2, event => this._handleFocusin(event));
6450
6474
  EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
6451
6475
  this._isActive = true;
6452
6476
  }
@@ -6455,16 +6479,13 @@
6455
6479
  return;
6456
6480
  }
6457
6481
  this._isActive = false;
6458
- EventHandler.off(document, EVENT_KEY$7);
6482
+ EventHandler.off(document, EVENT_KEY$5);
6459
6483
  }
6460
6484
  _handleFocusin(event) {
6461
- const {
6462
- target
6463
- } = event;
6464
6485
  const {
6465
6486
  trapElement
6466
6487
  } = this._config;
6467
- if (target === document || target === trapElement || trapElement.contains(target)) {
6488
+ if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {
6468
6489
  return;
6469
6490
  }
6470
6491
  const elements = SelectorEngine.focusableChildren(trapElement);
@@ -6482,40 +6503,21 @@
6482
6503
  }
6483
6504
  this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
6484
6505
  }
6485
- _getConfig(config) {
6486
- config = { ...Default$6,
6487
- ...(typeof config === 'object' ? config : {})
6488
- };
6489
- typeCheckConfig(NAME$7, config, DefaultType$6);
6490
- return config;
6491
- }
6492
6506
  }
6493
- const NAME$6 = 'modal';
6494
- const DATA_KEY$6 = 'bs.modal';
6495
- const EVENT_KEY$6 = `.${DATA_KEY$6}`;
6496
- const DATA_API_KEY$3 = '.data-api';
6507
+ const NAME$7 = 'modal';
6508
+ const DATA_KEY$4 = 'bs.modal';
6509
+ const EVENT_KEY$4 = `.${DATA_KEY$4}`;
6510
+ const DATA_API_KEY$2 = '.data-api';
6497
6511
  const ESCAPE_KEY$1 = 'Escape';
6498
- const Default$5 = {
6499
- backdrop: true,
6500
- keyboard: true,
6501
- focus: true
6502
- };
6503
- const DefaultType$5 = {
6504
- backdrop: '(boolean|string)',
6505
- keyboard: 'boolean',
6506
- focus: 'boolean'
6507
- };
6508
- const EVENT_HIDE$3 = `hide${EVENT_KEY$6}`;
6509
- const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$6}`;
6510
- const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`;
6511
- const EVENT_SHOW$3 = `show${EVENT_KEY$6}`;
6512
- const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`;
6513
- const EVENT_RESIZE = `resize${EVENT_KEY$6}`;
6514
- const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$6}`;
6515
- const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`;
6516
- const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`;
6517
- const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`;
6518
- const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
6512
+ const EVENT_HIDE$4 = `hide${EVENT_KEY$4}`;
6513
+ const EVENT_HIDE_PREVENTED$1 = `hidePrevented${EVENT_KEY$4}`;
6514
+ const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$4}`;
6515
+ const EVENT_SHOW$4 = `show${EVENT_KEY$4}`;
6516
+ const EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`;
6517
+ const EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`;
6518
+ const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`;
6519
+ const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`;
6520
+ const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`;
6519
6521
  const CLASS_NAME_OPEN = 'modal-open';
6520
6522
  const CLASS_NAME_FADE$3 = 'fade';
6521
6523
  const CLASS_NAME_SHOW$4 = 'show';
@@ -6524,23 +6526,35 @@
6524
6526
  const SELECTOR_DIALOG = '.modal-dialog';
6525
6527
  const SELECTOR_MODAL_BODY = '.modal-body';
6526
6528
  const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
6529
+ const Default$6 = {
6530
+ backdrop: true,
6531
+ focus: true,
6532
+ keyboard: true
6533
+ };
6534
+ const DefaultType$6 = {
6535
+ backdrop: '(boolean|string)',
6536
+ focus: 'boolean',
6537
+ keyboard: 'boolean'
6538
+ };
6527
6539
  class Modal extends BaseComponent {
6528
6540
  constructor(element, config) {
6529
- super(element);
6530
- this._config = this._getConfig(config);
6541
+ super(element, config);
6531
6542
  this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
6532
6543
  this._backdrop = this._initializeBackDrop();
6533
6544
  this._focustrap = this._initializeFocusTrap();
6534
6545
  this._isShown = false;
6535
- this._ignoreBackdropClick = false;
6536
6546
  this._isTransitioning = false;
6537
6547
  this._scrollBar = new ScrollBarHelper();
6548
+ this._addEventListeners();
6538
6549
  }
6539
6550
  static get Default() {
6540
- return Default$5;
6551
+ return Default$6;
6552
+ }
6553
+ static get DefaultType() {
6554
+ return DefaultType$6;
6541
6555
  }
6542
6556
  static get NAME() {
6543
- return NAME$6;
6557
+ return NAME$7;
6544
6558
  }
6545
6559
  toggle(relatedTarget) {
6546
6560
  return this._isShown ? this.hide() : this.show(relatedTarget);
@@ -6549,53 +6563,37 @@
6549
6563
  if (this._isShown || this._isTransitioning) {
6550
6564
  return;
6551
6565
  }
6552
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
6566
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, {
6553
6567
  relatedTarget
6554
6568
  });
6555
6569
  if (showEvent.defaultPrevented) {
6556
6570
  return;
6557
6571
  }
6558
6572
  this._isShown = true;
6559
- if (this._isAnimated()) {
6560
- this._isTransitioning = true;
6561
- }
6573
+ this._isTransitioning = true;
6562
6574
  this._scrollBar.hide();
6563
6575
  document.body.classList.add(CLASS_NAME_OPEN);
6564
6576
  this._adjustDialog();
6565
- this._setEscapeEvent();
6566
- this._setResizeEvent();
6567
- EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
6568
- EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
6569
- if (event.target === this._element) {
6570
- this._ignoreBackdropClick = true;
6571
- }
6572
- });
6573
- });
6574
- this._showBackdrop(() => this._showElement(relatedTarget));
6577
+ this._backdrop.show(() => this._showElement(relatedTarget));
6575
6578
  }
6576
6579
  hide() {
6577
6580
  if (!this._isShown || this._isTransitioning) {
6578
6581
  return;
6579
6582
  }
6580
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
6583
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4);
6581
6584
  if (hideEvent.defaultPrevented) {
6582
6585
  return;
6583
6586
  }
6584
6587
  this._isShown = false;
6585
- const isAnimated = this._isAnimated();
6586
- if (isAnimated) {
6587
- this._isTransitioning = true;
6588
- }
6589
- this._setEscapeEvent();
6590
- this._setResizeEvent();
6588
+ this._isTransitioning = true;
6591
6589
  this._focustrap.deactivate();
6592
6590
  this._element.classList.remove(CLASS_NAME_SHOW$4);
6593
- EventHandler.off(this._element, EVENT_CLICK_DISMISS);
6594
- EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
6595
- this._queueCallback(() => this._hideModal(), this._element, isAnimated);
6591
+ this._queueCallback(() => this._hideModal(), this._element, this._isAnimated());
6596
6592
  }
6597
6593
  dispose() {
6598
- [window, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6));
6594
+ for (const htmlElement of [window, this._dialog]) {
6595
+ EventHandler.off(htmlElement, EVENT_KEY$4);
6596
+ }
6599
6597
  this._backdrop.dispose();
6600
6598
  this._focustrap.deactivate();
6601
6599
  super.dispose();
@@ -6614,18 +6612,8 @@
6614
6612
  trapElement: this._element
6615
6613
  });
6616
6614
  }
6617
- _getConfig(config) {
6618
- config = { ...Default$5,
6619
- ...Manipulator.getDataAttributes(this._element),
6620
- ...(typeof config === 'object' ? config : {})
6621
- };
6622
- typeCheckConfig(NAME$6, config, DefaultType$5);
6623
- return config;
6624
- }
6625
6615
  _showElement(relatedTarget) {
6626
- const isAnimated = this._isAnimated();
6627
- const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
6628
- if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
6616
+ if (!document.body.contains(this._element)) {
6629
6617
  document.body.append(this._element);
6630
6618
  }
6631
6619
  this._element.style.display = 'block';
@@ -6633,44 +6621,52 @@
6633
6621
  this._element.setAttribute('aria-modal', true);
6634
6622
  this._element.setAttribute('role', 'dialog');
6635
6623
  this._element.scrollTop = 0;
6624
+ const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
6636
6625
  if (modalBody) {
6637
6626
  modalBody.scrollTop = 0;
6638
6627
  }
6639
- if (isAnimated) {
6640
- reflow(this._element);
6641
- }
6628
+ reflow(this._element);
6642
6629
  this._element.classList.add(CLASS_NAME_SHOW$4);
6643
6630
  const transitionComplete = () => {
6644
6631
  if (this._config.focus) {
6645
6632
  this._focustrap.activate();
6646
6633
  }
6647
6634
  this._isTransitioning = false;
6648
- EventHandler.trigger(this._element, EVENT_SHOWN$3, {
6635
+ EventHandler.trigger(this._element, EVENT_SHOWN$4, {
6649
6636
  relatedTarget
6650
6637
  });
6651
6638
  };
6652
- this._queueCallback(transitionComplete, this._dialog, isAnimated);
6653
- }
6654
- _setEscapeEvent() {
6655
- if (this._isShown) {
6656
- EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
6657
- if (this._config.keyboard && event.key === ESCAPE_KEY$1) {
6658
- event.preventDefault();
6659
- this.hide();
6660
- } else if (!this._config.keyboard && event.key === ESCAPE_KEY$1) {
6661
- this._triggerBackdropTransition();
6662
- }
6663
- });
6664
- } else {
6665
- EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS$1);
6666
- }
6639
+ this._queueCallback(transitionComplete, this._dialog, this._isAnimated());
6667
6640
  }
6668
- _setResizeEvent() {
6669
- if (this._isShown) {
6670
- EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog());
6671
- } else {
6672
- EventHandler.off(window, EVENT_RESIZE);
6673
- }
6641
+ _addEventListeners() {
6642
+ EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
6643
+ if (event.key !== ESCAPE_KEY$1) {
6644
+ return;
6645
+ }
6646
+ if (this._config.keyboard) {
6647
+ event.preventDefault();
6648
+ this.hide();
6649
+ return;
6650
+ }
6651
+ this._triggerBackdropTransition();
6652
+ });
6653
+ EventHandler.on(window, EVENT_RESIZE$1, () => {
6654
+ if (this._isShown && !this._isTransitioning) {
6655
+ this._adjustDialog();
6656
+ }
6657
+ });
6658
+ EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {
6659
+ if (event.target !== event.currentTarget) {
6660
+ return;
6661
+ }
6662
+ if (this._config.backdrop === 'static') {
6663
+ this._triggerBackdropTransition();
6664
+ return;
6665
+ }
6666
+ if (this._config.backdrop) {
6667
+ this.hide();
6668
+ }
6669
+ });
6674
6670
  }
6675
6671
  _hideModal() {
6676
6672
  this._element.style.display = 'none';
@@ -6682,54 +6678,31 @@
6682
6678
  document.body.classList.remove(CLASS_NAME_OPEN);
6683
6679
  this._resetAdjustments();
6684
6680
  this._scrollBar.reset();
6685
- EventHandler.trigger(this._element, EVENT_HIDDEN$3);
6681
+ EventHandler.trigger(this._element, EVENT_HIDDEN$4);
6686
6682
  });
6687
6683
  }
6688
- _showBackdrop(callback) {
6689
- EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => {
6690
- if (this._ignoreBackdropClick) {
6691
- this._ignoreBackdropClick = false;
6692
- return;
6693
- }
6694
- if (event.target !== event.currentTarget) {
6695
- return;
6696
- }
6697
- if (this._config.backdrop === true) {
6698
- this.hide();
6699
- } else if (this._config.backdrop === 'static') {
6700
- this._triggerBackdropTransition();
6701
- }
6702
- });
6703
- this._backdrop.show(callback);
6704
- }
6705
6684
  _isAnimated() {
6706
6685
  return this._element.classList.contains(CLASS_NAME_FADE$3);
6707
6686
  }
6708
6687
  _triggerBackdropTransition() {
6709
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
6688
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED$1);
6710
6689
  if (hideEvent.defaultPrevented) {
6711
6690
  return;
6712
6691
  }
6713
- const {
6714
- classList,
6715
- scrollHeight,
6716
- style
6717
- } = this._element;
6718
- const isModalOverflowing = scrollHeight > document.documentElement.clientHeight;
6719
- if (!isModalOverflowing && style.overflowY === 'hidden' || classList.contains(CLASS_NAME_STATIC)) {
6692
+ const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
6693
+ const initialOverflowY = this._element.style.overflowY;
6694
+ if (initialOverflowY === 'hidden' || this._element.classList.contains(CLASS_NAME_STATIC)) {
6720
6695
  return;
6721
6696
  }
6722
6697
  if (!isModalOverflowing) {
6723
- style.overflowY = 'hidden';
6698
+ this._element.style.overflowY = 'hidden';
6724
6699
  }
6725
- classList.add(CLASS_NAME_STATIC);
6700
+ this._element.classList.add(CLASS_NAME_STATIC);
6726
6701
  this._queueCallback(() => {
6727
- classList.remove(CLASS_NAME_STATIC);
6728
- if (!isModalOverflowing) {
6729
- this._queueCallback(() => {
6730
- style.overflowY = '';
6731
- }, this._dialog);
6732
- }
6702
+ this._element.classList.remove(CLASS_NAME_STATIC);
6703
+ this._queueCallback(() => {
6704
+ this._element.style.overflowY = initialOverflowY;
6705
+ }, this._dialog);
6733
6706
  }, this._dialog);
6734
6707
  this._element.focus();
6735
6708
  }
@@ -6737,11 +6710,13 @@
6737
6710
  const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
6738
6711
  const scrollbarWidth = this._scrollBar.getWidth();
6739
6712
  const isBodyOverflowing = scrollbarWidth > 0;
6740
- if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) {
6741
- this._element.style.paddingLeft = `${scrollbarWidth}px`;
6713
+ if (isBodyOverflowing && !isModalOverflowing) {
6714
+ const property = isRTL() ? 'paddingLeft' : 'paddingRight';
6715
+ this._element.style[property] = `${scrollbarWidth}px`;
6742
6716
  }
6743
- if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) {
6744
- this._element.style.paddingRight = `${scrollbarWidth}px`;
6717
+ if (!isBodyOverflowing && isModalOverflowing) {
6718
+ const property = isRTL() ? 'paddingRight' : 'paddingLeft';
6719
+ this._element.style[property] = `${scrollbarWidth}px`;
6745
6720
  }
6746
6721
  }
6747
6722
  _resetAdjustments() {
@@ -6766,65 +6741,71 @@
6766
6741
  if (['A', 'AREA'].includes(this.tagName)) {
6767
6742
  event.preventDefault();
6768
6743
  }
6769
- EventHandler.one(target, EVENT_SHOW$3, showEvent => {
6744
+ EventHandler.one(target, EVENT_SHOW$4, showEvent => {
6770
6745
  if (showEvent.defaultPrevented) {
6771
6746
  return;
6772
6747
  }
6773
- EventHandler.one(target, EVENT_HIDDEN$3, () => {
6748
+ EventHandler.one(target, EVENT_HIDDEN$4, () => {
6774
6749
  if (isVisible(this)) {
6775
6750
  this.focus();
6776
6751
  }
6777
6752
  });
6778
6753
  });
6779
- const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
6780
- if (allReadyOpen) {
6781
- Modal.getInstance(allReadyOpen).hide();
6754
+ const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
6755
+ if (alreadyOpen) {
6756
+ Modal.getInstance(alreadyOpen).hide();
6782
6757
  }
6783
6758
  const data = Modal.getOrCreateInstance(target);
6784
6759
  data.toggle(this);
6785
6760
  });
6786
6761
  enableDismissTrigger(Modal);
6787
6762
  defineJQueryPlugin(Modal);
6788
- const NAME$5 = 'offcanvas';
6789
- const DATA_KEY$5 = 'bs.offcanvas';
6790
- const EVENT_KEY$5 = `.${DATA_KEY$5}`;
6791
- const DATA_API_KEY$2 = '.data-api';
6792
- const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$5}${DATA_API_KEY$2}`;
6763
+ const NAME$6 = 'offcanvas';
6764
+ const DATA_KEY$3 = 'bs.offcanvas';
6765
+ const EVENT_KEY$3 = `.${DATA_KEY$3}`;
6766
+ const DATA_API_KEY$1 = '.data-api';
6767
+ const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$3}${DATA_API_KEY$1}`;
6793
6768
  const ESCAPE_KEY = 'Escape';
6794
- const Default$4 = {
6769
+ const CLASS_NAME_SHOW$3 = 'show';
6770
+ const CLASS_NAME_SHOWING$1 = 'showing';
6771
+ const CLASS_NAME_HIDING = 'hiding';
6772
+ const CLASS_NAME_BACKDROP = 'offcanvas-backdrop';
6773
+ const OPEN_SELECTOR = '.offcanvas.show';
6774
+ const EVENT_SHOW$3 = `show${EVENT_KEY$3}`;
6775
+ const EVENT_SHOWN$3 = `shown${EVENT_KEY$3}`;
6776
+ const EVENT_HIDE$3 = `hide${EVENT_KEY$3}`;
6777
+ const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$3}`;
6778
+ const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$3}`;
6779
+ const EVENT_RESIZE = `resize${EVENT_KEY$3}`;
6780
+ const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$3}${DATA_API_KEY$1}`;
6781
+ const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$3}`;
6782
+ const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
6783
+ const Default$5 = {
6795
6784
  backdrop: true,
6796
6785
  keyboard: true,
6797
6786
  scroll: false
6798
6787
  };
6799
- const DefaultType$4 = {
6800
- backdrop: 'boolean',
6788
+ const DefaultType$5 = {
6789
+ backdrop: '(boolean|string)',
6801
6790
  keyboard: 'boolean',
6802
6791
  scroll: 'boolean'
6803
6792
  };
6804
- const CLASS_NAME_SHOW$3 = 'show';
6805
- const CLASS_NAME_BACKDROP = 'offcanvas-backdrop';
6806
- const OPEN_SELECTOR = '.offcanvas.show';
6807
- const EVENT_SHOW$2 = `show${EVENT_KEY$5}`;
6808
- const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`;
6809
- const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`;
6810
- const EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`;
6811
- const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`;
6812
- const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`;
6813
- const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
6814
6793
  class Offcanvas extends BaseComponent {
6815
6794
  constructor(element, config) {
6816
- super(element);
6817
- this._config = this._getConfig(config);
6795
+ super(element, config);
6818
6796
  this._isShown = false;
6819
6797
  this._backdrop = this._initializeBackDrop();
6820
6798
  this._focustrap = this._initializeFocusTrap();
6821
6799
  this._addEventListeners();
6822
6800
  }
6823
- static get NAME() {
6824
- return NAME$5;
6825
- }
6826
6801
  static get Default() {
6827
- return Default$4;
6802
+ return Default$5;
6803
+ }
6804
+ static get DefaultType() {
6805
+ return DefaultType$5;
6806
+ }
6807
+ static get NAME() {
6808
+ return NAME$6;
6828
6809
  }
6829
6810
  toggle(relatedTarget) {
6830
6811
  return this._isShown ? this.hide() : this.show(relatedTarget);
@@ -6833,27 +6814,27 @@
6833
6814
  if (this._isShown) {
6834
6815
  return;
6835
6816
  }
6836
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, {
6817
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
6837
6818
  relatedTarget
6838
6819
  });
6839
6820
  if (showEvent.defaultPrevented) {
6840
6821
  return;
6841
6822
  }
6842
6823
  this._isShown = true;
6843
- this._element.style.visibility = 'visible';
6844
6824
  this._backdrop.show();
6845
6825
  if (!this._config.scroll) {
6846
6826
  new ScrollBarHelper().hide();
6847
6827
  }
6848
- this._element.removeAttribute('aria-hidden');
6849
6828
  this._element.setAttribute('aria-modal', true);
6850
6829
  this._element.setAttribute('role', 'dialog');
6851
- this._element.classList.add(CLASS_NAME_SHOW$3);
6830
+ this._element.classList.add(CLASS_NAME_SHOWING$1);
6852
6831
  const completeCallBack = () => {
6853
- if (!this._config.scroll) {
6832
+ if (!this._config.scroll || this._config.backdrop) {
6854
6833
  this._focustrap.activate();
6855
6834
  }
6856
- EventHandler.trigger(this._element, EVENT_SHOWN$2, {
6835
+ this._element.classList.add(CLASS_NAME_SHOW$3);
6836
+ this._element.classList.remove(CLASS_NAME_SHOWING$1);
6837
+ EventHandler.trigger(this._element, EVENT_SHOWN$3, {
6857
6838
  relatedTarget
6858
6839
  });
6859
6840
  };
@@ -6863,24 +6844,23 @@
6863
6844
  if (!this._isShown) {
6864
6845
  return;
6865
6846
  }
6866
- const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2);
6847
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
6867
6848
  if (hideEvent.defaultPrevented) {
6868
6849
  return;
6869
6850
  }
6870
6851
  this._focustrap.deactivate();
6871
6852
  this._element.blur();
6872
6853
  this._isShown = false;
6873
- this._element.classList.remove(CLASS_NAME_SHOW$3);
6854
+ this._element.classList.add(CLASS_NAME_HIDING);
6874
6855
  this._backdrop.hide();
6875
6856
  const completeCallback = () => {
6876
- this._element.setAttribute('aria-hidden', true);
6857
+ this._element.classList.remove(CLASS_NAME_SHOW$3, CLASS_NAME_HIDING);
6877
6858
  this._element.removeAttribute('aria-modal');
6878
6859
  this._element.removeAttribute('role');
6879
- this._element.style.visibility = 'hidden';
6880
6860
  if (!this._config.scroll) {
6881
6861
  new ScrollBarHelper().reset();
6882
6862
  }
6883
- EventHandler.trigger(this._element, EVENT_HIDDEN$2);
6863
+ EventHandler.trigger(this._element, EVENT_HIDDEN$3);
6884
6864
  };
6885
6865
  this._queueCallback(completeCallback, this._element, true);
6886
6866
  }
@@ -6889,21 +6869,21 @@
6889
6869
  this._focustrap.deactivate();
6890
6870
  super.dispose();
6891
6871
  }
6892
- _getConfig(config) {
6893
- config = { ...Default$4,
6894
- ...Manipulator.getDataAttributes(this._element),
6895
- ...(typeof config === 'object' ? config : {})
6896
- };
6897
- typeCheckConfig(NAME$5, config, DefaultType$4);
6898
- return config;
6899
- }
6900
6872
  _initializeBackDrop() {
6873
+ const clickCallback = () => {
6874
+ if (this._config.backdrop === 'static') {
6875
+ EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
6876
+ return;
6877
+ }
6878
+ this.hide();
6879
+ };
6880
+ const isVisible = Boolean(this._config.backdrop);
6901
6881
  return new Backdrop({
6902
6882
  className: CLASS_NAME_BACKDROP,
6903
- isVisible: this._config.backdrop,
6883
+ isVisible,
6904
6884
  isAnimated: true,
6905
6885
  rootElement: this._element.parentNode,
6906
- clickCallback: () => this.hide()
6886
+ clickCallback: isVisible ? clickCallback : null
6907
6887
  });
6908
6888
  }
6909
6889
  _initializeFocusTrap() {
@@ -6913,9 +6893,14 @@
6913
6893
  }
6914
6894
  _addEventListeners() {
6915
6895
  EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
6916
- if (this._config.keyboard && event.key === ESCAPE_KEY) {
6917
- this.hide();
6896
+ if (event.key !== ESCAPE_KEY) {
6897
+ return;
6898
+ }
6899
+ if (!this._config.keyboard) {
6900
+ EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
6901
+ return;
6918
6902
  }
6903
+ this.hide();
6919
6904
  });
6920
6905
  }
6921
6906
  static jQueryInterface(config) {
@@ -6939,19 +6924,30 @@
6939
6924
  if (isDisabled(this)) {
6940
6925
  return;
6941
6926
  }
6942
- EventHandler.one(target, EVENT_HIDDEN$2, () => {
6927
+ EventHandler.one(target, EVENT_HIDDEN$3, () => {
6943
6928
  if (isVisible(this)) {
6944
6929
  this.focus();
6945
6930
  }
6946
6931
  });
6947
- const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
6948
- if (allReadyOpen && allReadyOpen !== target) {
6949
- Offcanvas.getInstance(allReadyOpen).hide();
6932
+ const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
6933
+ if (alreadyOpen && alreadyOpen !== target) {
6934
+ Offcanvas.getInstance(alreadyOpen).hide();
6950
6935
  }
6951
6936
  const data = Offcanvas.getOrCreateInstance(target);
6952
6937
  data.toggle(this);
6953
6938
  });
6954
- EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show()));
6939
+ EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
6940
+ for (const selector of SelectorEngine.find(OPEN_SELECTOR)) {
6941
+ Offcanvas.getOrCreateInstance(selector).show();
6942
+ }
6943
+ });
6944
+ EventHandler.on(window, EVENT_RESIZE, () => {
6945
+ for (const element of SelectorEngine.find('[aria-modal][class*=show][class*=offcanvas-]')) {
6946
+ if (getComputedStyle(element).position !== 'fixed') {
6947
+ Offcanvas.getOrCreateInstance(element).hide();
6948
+ }
6949
+ }
6950
+ });
6955
6951
  enableDismissTrigger(Offcanvas);
6956
6952
  defineJQueryPlugin(Offcanvas);
6957
6953
  const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
@@ -6966,13 +6962,7 @@
6966
6962
  }
6967
6963
  return true;
6968
6964
  }
6969
- const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp);
6970
- for (let i = 0, len = regExp.length; i < len; i++) {
6971
- if (regExp[i].test(attributeName)) {
6972
- return true;
6973
- }
6974
- }
6975
- return false;
6965
+ return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp).some(regex => regex.test(attributeName));
6976
6966
  };
6977
6967
  const DefaultAllowlist = {
6978
6968
  '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
@@ -7006,18 +6996,17 @@
7006
6996
  u: [],
7007
6997
  ul: []
7008
6998
  };
7009
- function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
6999
+ function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
7010
7000
  if (!unsafeHtml.length) {
7011
7001
  return unsafeHtml;
7012
7002
  }
7013
- if (sanitizeFn && typeof sanitizeFn === 'function') {
7014
- return sanitizeFn(unsafeHtml);
7003
+ if (sanitizeFunction && typeof sanitizeFunction === 'function') {
7004
+ return sanitizeFunction(unsafeHtml);
7015
7005
  }
7016
7006
  const domParser = new window.DOMParser();
7017
7007
  const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
7018
7008
  const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
7019
- for (let i = 0, len = elements.length; i < len; i++) {
7020
- const element = elements[i];
7009
+ for (const element of elements) {
7021
7010
  const elementName = element.nodeName.toLowerCase();
7022
7011
  if (!Object.keys(allowList).includes(elementName)) {
7023
7012
  element.remove();
@@ -7025,120 +7014,221 @@
7025
7014
  }
7026
7015
  const attributeList = [].concat(...element.attributes);
7027
7016
  const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []);
7028
- attributeList.forEach(attribute => {
7017
+ for (const attribute of attributeList) {
7029
7018
  if (!allowedAttribute(attribute, allowedAttributes)) {
7030
7019
  element.removeAttribute(attribute.nodeName);
7031
7020
  }
7032
- });
7021
+ }
7033
7022
  }
7034
7023
  return createdDocument.body.innerHTML;
7035
7024
  }
7036
- const NAME$4 = 'tooltip';
7037
- const DATA_KEY$4 = 'bs.tooltip';
7038
- const EVENT_KEY$4 = `.${DATA_KEY$4}`;
7039
- const CLASS_PREFIX$1 = 'bs-tooltip';
7040
- const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
7041
- const DefaultType$3 = {
7042
- animation: 'boolean',
7043
- template: 'string',
7044
- title: '(string|element|function)',
7045
- trigger: 'string',
7046
- delay: '(number|object)',
7047
- html: 'boolean',
7048
- selector: '(string|boolean)',
7049
- placement: '(string|function)',
7050
- offset: '(array|string|function)',
7051
- container: '(string|element|boolean)',
7052
- fallbackPlacements: 'array',
7053
- boundary: '(string|element)',
7054
- customClass: '(string|function)',
7055
- sanitize: 'boolean',
7056
- sanitizeFn: '(null|function)',
7057
- allowList: 'object',
7058
- popperConfig: '(null|object|function)'
7059
- };
7060
- const AttachmentMap = {
7061
- AUTO: 'auto',
7062
- TOP: 'top',
7063
- RIGHT: isRTL() ? 'left' : 'right',
7064
- BOTTOM: 'bottom',
7065
- LEFT: isRTL() ? 'right' : 'left'
7066
- };
7067
- const Default$3 = {
7068
- animation: true,
7069
- template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
7070
- trigger: 'hover focus',
7071
- title: '',
7072
- delay: 0,
7025
+ const NAME$5 = 'TemplateFactory';
7026
+ const Default$4 = {
7027
+ allowList: DefaultAllowlist,
7028
+ content: {},
7029
+ extraClass: '',
7073
7030
  html: false,
7074
- selector: false,
7075
- placement: 'top',
7076
- offset: [0, 0],
7077
- container: false,
7078
- fallbackPlacements: ['top', 'right', 'bottom', 'left'],
7079
- boundary: 'clippingParents',
7080
- customClass: '',
7081
7031
  sanitize: true,
7082
7032
  sanitizeFn: null,
7083
- allowList: DefaultAllowlist,
7084
- popperConfig: null
7033
+ template: '<div></div>'
7085
7034
  };
7086
- const Event$2 = {
7087
- HIDE: `hide${EVENT_KEY$4}`,
7088
- HIDDEN: `hidden${EVENT_KEY$4}`,
7089
- SHOW: `show${EVENT_KEY$4}`,
7090
- SHOWN: `shown${EVENT_KEY$4}`,
7091
- INSERTED: `inserted${EVENT_KEY$4}`,
7092
- CLICK: `click${EVENT_KEY$4}`,
7093
- FOCUSIN: `focusin${EVENT_KEY$4}`,
7094
- FOCUSOUT: `focusout${EVENT_KEY$4}`,
7095
- MOUSEENTER: `mouseenter${EVENT_KEY$4}`,
7096
- MOUSELEAVE: `mouseleave${EVENT_KEY$4}`
7035
+ const DefaultType$4 = {
7036
+ allowList: 'object',
7037
+ content: 'object',
7038
+ extraClass: '(string|function)',
7039
+ html: 'boolean',
7040
+ sanitize: 'boolean',
7041
+ sanitizeFn: '(null|function)',
7042
+ template: 'string'
7097
7043
  };
7098
- const CLASS_NAME_FADE$2 = 'fade';
7099
- const CLASS_NAME_MODAL = 'modal';
7100
- const CLASS_NAME_SHOW$2 = 'show';
7101
- const HOVER_STATE_SHOW = 'show';
7102
- const HOVER_STATE_OUT = 'out';
7103
- const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
7104
- const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
7105
- const EVENT_MODAL_HIDE = 'hide.bs.modal';
7106
- const TRIGGER_HOVER = 'hover';
7107
- const TRIGGER_FOCUS = 'focus';
7108
- const TRIGGER_CLICK = 'click';
7109
- const TRIGGER_MANUAL = 'manual';
7110
- class Tooltip extends BaseComponent {
7111
- constructor(element, config) {
7112
- if (typeof Popper === 'undefined') {
7113
- throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
7114
- }
7115
- super(element);
7116
- this._isEnabled = true;
7117
- this._timeout = 0;
7118
- this._hoverState = '';
7119
- this._activeTrigger = {};
7120
- this._popper = null;
7044
+ const DefaultContentType = {
7045
+ entry: '(string|element|function|null)',
7046
+ selector: '(string|element)'
7047
+ };
7048
+ class TemplateFactory extends Config {
7049
+ constructor(config) {
7050
+ super();
7121
7051
  this._config = this._getConfig(config);
7122
- this.tip = null;
7123
- this._setListeners();
7124
7052
  }
7125
7053
  static get Default() {
7126
- return Default$3;
7054
+ return Default$4;
7055
+ }
7056
+ static get DefaultType() {
7057
+ return DefaultType$4;
7127
7058
  }
7128
7059
  static get NAME() {
7129
- return NAME$4;
7060
+ return NAME$5;
7130
7061
  }
7131
- static get Event() {
7132
- return Event$2;
7062
+ getContent() {
7063
+ return Object.values(this._config.content).map(config => this._resolvePossibleFunction(config)).filter(Boolean);
7133
7064
  }
7134
- static get DefaultType() {
7135
- return DefaultType$3;
7065
+ hasContent() {
7066
+ return this.getContent().length > 0;
7136
7067
  }
7137
- enable() {
7138
- this._isEnabled = true;
7068
+ changeContent(content) {
7069
+ this._checkContent(content);
7070
+ this._config.content = { ...this._config.content,
7071
+ ...content
7072
+ };
7073
+ return this;
7139
7074
  }
7140
- disable() {
7141
- this._isEnabled = false;
7075
+ toHtml() {
7076
+ const templateWrapper = document.createElement('div');
7077
+ templateWrapper.innerHTML = this._maybeSanitize(this._config.template);
7078
+ for (const [selector, text] of Object.entries(this._config.content)) {
7079
+ this._setContent(templateWrapper, text, selector);
7080
+ }
7081
+ const template = templateWrapper.children[0];
7082
+ const extraClass = this._resolvePossibleFunction(this._config.extraClass);
7083
+ if (extraClass) {
7084
+ template.classList.add(...extraClass.split(' '));
7085
+ }
7086
+ return template;
7087
+ }
7088
+ _typeCheckConfig(config) {
7089
+ super._typeCheckConfig(config);
7090
+ this._checkContent(config.content);
7091
+ }
7092
+ _checkContent(arg) {
7093
+ for (const [selector, content] of Object.entries(arg)) {
7094
+ super._typeCheckConfig({
7095
+ selector,
7096
+ entry: content
7097
+ }, DefaultContentType);
7098
+ }
7099
+ }
7100
+ _setContent(template, content, selector) {
7101
+ const templateElement = SelectorEngine.findOne(selector, template);
7102
+ if (!templateElement) {
7103
+ return;
7104
+ }
7105
+ content = this._resolvePossibleFunction(content);
7106
+ if (!content) {
7107
+ templateElement.remove();
7108
+ return;
7109
+ }
7110
+ if (isElement(content)) {
7111
+ this._putElementInTemplate(getElement(content), templateElement);
7112
+ return;
7113
+ }
7114
+ if (this._config.html) {
7115
+ templateElement.innerHTML = this._maybeSanitize(content);
7116
+ return;
7117
+ }
7118
+ templateElement.textContent = content;
7119
+ }
7120
+ _maybeSanitize(arg) {
7121
+ return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg;
7122
+ }
7123
+ _resolvePossibleFunction(arg) {
7124
+ return typeof arg === 'function' ? arg(this) : arg;
7125
+ }
7126
+ _putElementInTemplate(element, templateElement) {
7127
+ if (this._config.html) {
7128
+ templateElement.innerHTML = '';
7129
+ templateElement.append(element);
7130
+ return;
7131
+ }
7132
+ templateElement.textContent = element.textContent;
7133
+ }
7134
+ }
7135
+ const NAME$4 = 'tooltip';
7136
+ const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
7137
+ const CLASS_NAME_FADE$2 = 'fade';
7138
+ const CLASS_NAME_MODAL = 'modal';
7139
+ const CLASS_NAME_SHOW$2 = 'show';
7140
+ const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
7141
+ const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
7142
+ const EVENT_MODAL_HIDE = 'hide.bs.modal';
7143
+ const TRIGGER_HOVER = 'hover';
7144
+ const TRIGGER_FOCUS = 'focus';
7145
+ const TRIGGER_CLICK = 'click';
7146
+ const TRIGGER_MANUAL = 'manual';
7147
+ const EVENT_HIDE$2 = 'hide';
7148
+ const EVENT_HIDDEN$2 = 'hidden';
7149
+ const EVENT_SHOW$2 = 'show';
7150
+ const EVENT_SHOWN$2 = 'shown';
7151
+ const EVENT_INSERTED = 'inserted';
7152
+ const EVENT_CLICK$1 = 'click';
7153
+ const EVENT_FOCUSIN$1 = 'focusin';
7154
+ const EVENT_FOCUSOUT$1 = 'focusout';
7155
+ const EVENT_MOUSEENTER = 'mouseenter';
7156
+ const EVENT_MOUSELEAVE = 'mouseleave';
7157
+ const AttachmentMap = {
7158
+ AUTO: 'auto',
7159
+ TOP: 'top',
7160
+ RIGHT: isRTL() ? 'left' : 'right',
7161
+ BOTTOM: 'bottom',
7162
+ LEFT: isRTL() ? 'right' : 'left'
7163
+ };
7164
+ const Default$3 = {
7165
+ allowList: DefaultAllowlist,
7166
+ animation: true,
7167
+ boundary: 'clippingParents',
7168
+ container: false,
7169
+ customClass: '',
7170
+ delay: 0,
7171
+ fallbackPlacements: ['top', 'right', 'bottom', 'left'],
7172
+ html: false,
7173
+ offset: [0, 0],
7174
+ placement: 'top',
7175
+ popperConfig: null,
7176
+ sanitize: true,
7177
+ sanitizeFn: null,
7178
+ selector: false,
7179
+ template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
7180
+ title: '',
7181
+ trigger: 'hover focus'
7182
+ };
7183
+ const DefaultType$3 = {
7184
+ allowList: 'object',
7185
+ animation: 'boolean',
7186
+ boundary: '(string|element)',
7187
+ container: '(string|element|boolean)',
7188
+ customClass: '(string|function)',
7189
+ delay: '(number|object)',
7190
+ fallbackPlacements: 'array',
7191
+ html: 'boolean',
7192
+ offset: '(array|string|function)',
7193
+ placement: '(string|function)',
7194
+ popperConfig: '(null|object|function)',
7195
+ sanitize: 'boolean',
7196
+ sanitizeFn: '(null|function)',
7197
+ selector: '(string|boolean)',
7198
+ template: 'string',
7199
+ title: '(string|element|function)',
7200
+ trigger: 'string'
7201
+ };
7202
+ class Tooltip extends BaseComponent {
7203
+ constructor(element, config) {
7204
+ if (typeof Popper === 'undefined') {
7205
+ throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
7206
+ }
7207
+ super(element, config);
7208
+ this._isEnabled = true;
7209
+ this._timeout = 0;
7210
+ this._isHovered = false;
7211
+ this._activeTrigger = {};
7212
+ this._popper = null;
7213
+ this._templateFactory = null;
7214
+ this._newContent = null;
7215
+ this.tip = null;
7216
+ this._setListeners();
7217
+ }
7218
+ static get Default() {
7219
+ return Default$3;
7220
+ }
7221
+ static get DefaultType() {
7222
+ return DefaultType$3;
7223
+ }
7224
+ static get NAME() {
7225
+ return NAME$4;
7226
+ }
7227
+ enable() {
7228
+ this._isEnabled = true;
7229
+ }
7230
+ disable() {
7231
+ this._isEnabled = false;
7142
7232
  }
7143
7233
  toggleEnabled() {
7144
7234
  this._isEnabled = !this._isEnabled;
@@ -7151,17 +7241,17 @@
7151
7241
  const context = this._initializeOnDelegatedTarget(event);
7152
7242
  context._activeTrigger.click = !context._activeTrigger.click;
7153
7243
  if (context._isWithActiveTrigger()) {
7154
- context._enter(null, context);
7244
+ context._enter();
7155
7245
  } else {
7156
- context._leave(null, context);
7246
+ context._leave();
7157
7247
  }
7158
- } else {
7159
- if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$2)) {
7160
- this._leave(null, this);
7161
- return;
7162
- }
7163
- this._enter(null, this);
7248
+ return;
7164
7249
  }
7250
+ if (this._isShown()) {
7251
+ this._leave();
7252
+ return;
7253
+ }
7254
+ this._enter();
7165
7255
  }
7166
7256
  dispose() {
7167
7257
  clearTimeout(this._timeout);
@@ -7176,182 +7266,163 @@
7176
7266
  if (this._element.style.display === 'none') {
7177
7267
  throw new Error('Please use show on visible elements');
7178
7268
  }
7179
- if (!(this.isWithContent() && this._isEnabled)) {
7269
+ if (!(this._isWithContent() && this._isEnabled)) {
7180
7270
  return;
7181
7271
  }
7182
- const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW);
7272
+ const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW$2));
7183
7273
  const shadowRoot = findShadowRoot(this._element);
7184
- const isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element);
7274
+ const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element);
7185
7275
  if (showEvent.defaultPrevented || !isInTheDom) {
7186
7276
  return;
7187
7277
  }
7188
- if (this.constructor.NAME === 'tooltip' && this.tip && this.getTitle() !== this.tip.querySelector(SELECTOR_TOOLTIP_INNER).innerHTML) {
7189
- this._disposePopper();
7278
+ if (this.tip) {
7190
7279
  this.tip.remove();
7191
7280
  this.tip = null;
7192
7281
  }
7193
- const tip = this.getTipElement();
7194
- const tipId = getUID(this.constructor.NAME);
7195
- tip.setAttribute('id', tipId);
7196
- this._element.setAttribute('aria-describedby', tipId);
7197
- if (this._config.animation) {
7198
- tip.classList.add(CLASS_NAME_FADE$2);
7199
- }
7200
- const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
7201
- const attachment = this._getAttachment(placement);
7202
- this._addAttachmentClass(attachment);
7282
+ const tip = this._getTipElement();
7283
+ this._element.setAttribute('aria-describedby', tip.getAttribute('id'));
7203
7284
  const {
7204
7285
  container
7205
7286
  } = this._config;
7206
- Data.set(tip, this.constructor.DATA_KEY, this);
7207
7287
  if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
7208
7288
  container.append(tip);
7209
- EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
7289
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED));
7210
7290
  }
7211
7291
  if (this._popper) {
7212
7292
  this._popper.update();
7213
7293
  } else {
7214
- this._popper = createPopper(this._element, tip, this._getPopperConfig(attachment));
7294
+ this._popper = this._createPopper(tip);
7215
7295
  }
7216
7296
  tip.classList.add(CLASS_NAME_SHOW$2);
7217
- const customClass = this._resolvePossibleFunction(this._config.customClass);
7218
- if (customClass) {
7219
- tip.classList.add(...customClass.split(' '));
7220
- }
7221
7297
  if ('ontouchstart' in document.documentElement) {
7222
- [].concat(...document.body.children).forEach(element => {
7298
+ for (const element of [].concat(...document.body.children)) {
7223
7299
  EventHandler.on(element, 'mouseover', noop);
7224
- });
7300
+ }
7225
7301
  }
7226
7302
  const complete = () => {
7227
- const prevHoverState = this._hoverState;
7228
- this._hoverState = null;
7229
- EventHandler.trigger(this._element, this.constructor.Event.SHOWN);
7230
- if (prevHoverState === HOVER_STATE_OUT) {
7231
- this._leave(null, this);
7303
+ const previousHoverState = this._isHovered;
7304
+ this._isHovered = false;
7305
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2));
7306
+ if (previousHoverState) {
7307
+ this._leave();
7232
7308
  }
7233
7309
  };
7234
- const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
7235
- this._queueCallback(complete, this.tip, isAnimated);
7310
+ this._queueCallback(complete, this.tip, this._isAnimated());
7236
7311
  }
7237
7312
  hide() {
7238
- if (!this._popper) {
7313
+ if (!this._isShown()) {
7239
7314
  return;
7240
7315
  }
7241
- const tip = this.getTipElement();
7242
- const complete = () => {
7243
- if (this._isWithActiveTrigger()) {
7244
- return;
7245
- }
7246
- if (this._hoverState !== HOVER_STATE_SHOW) {
7247
- tip.remove();
7248
- }
7249
- this._cleanTipClass();
7250
- this._element.removeAttribute('aria-describedby');
7251
- EventHandler.trigger(this._element, this.constructor.Event.HIDDEN);
7252
- this._disposePopper();
7253
- };
7254
- const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE);
7316
+ const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE$2));
7255
7317
  if (hideEvent.defaultPrevented) {
7256
7318
  return;
7257
7319
  }
7320
+ const tip = this._getTipElement();
7258
7321
  tip.classList.remove(CLASS_NAME_SHOW$2);
7259
7322
  if ('ontouchstart' in document.documentElement) {
7260
- [].concat(...document.body.children).forEach(element => EventHandler.off(element, 'mouseover', noop));
7323
+ for (const element of [].concat(...document.body.children)) {
7324
+ EventHandler.off(element, 'mouseover', noop);
7325
+ }
7261
7326
  }
7262
7327
  this._activeTrigger[TRIGGER_CLICK] = false;
7263
7328
  this._activeTrigger[TRIGGER_FOCUS] = false;
7264
7329
  this._activeTrigger[TRIGGER_HOVER] = false;
7265
- const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
7266
- this._queueCallback(complete, this.tip, isAnimated);
7267
- this._hoverState = '';
7330
+ this._isHovered = false;
7331
+ const complete = () => {
7332
+ if (this._isWithActiveTrigger()) {
7333
+ return;
7334
+ }
7335
+ if (!this._isHovered) {
7336
+ tip.remove();
7337
+ }
7338
+ this._element.removeAttribute('aria-describedby');
7339
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN$2));
7340
+ this._disposePopper();
7341
+ };
7342
+ this._queueCallback(complete, this.tip, this._isAnimated());
7268
7343
  }
7269
7344
  update() {
7270
- if (this._popper !== null) {
7345
+ if (this._popper) {
7271
7346
  this._popper.update();
7272
7347
  }
7273
7348
  }
7274
- isWithContent() {
7275
- return Boolean(this.getTitle());
7349
+ _isWithContent() {
7350
+ return Boolean(this._getTitle());
7276
7351
  }
7277
- getTipElement() {
7278
- if (this.tip) {
7279
- return this.tip;
7352
+ _getTipElement() {
7353
+ if (!this.tip) {
7354
+ this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
7280
7355
  }
7281
- const element = document.createElement('div');
7282
- element.innerHTML = this._config.template;
7283
- const tip = element.children[0];
7284
- this.setContent(tip);
7285
- tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
7286
- this.tip = tip;
7287
7356
  return this.tip;
7288
7357
  }
7289
- setContent(tip) {
7290
- this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER);
7291
- }
7292
- _sanitizeAndSetContent(template, content, selector) {
7293
- const templateElement = SelectorEngine.findOne(selector, template);
7294
- if (!content && templateElement) {
7295
- templateElement.remove();
7296
- return;
7358
+ _createTipElement(content) {
7359
+ const tip = this._getTemplateFactory(content).toHtml();
7360
+ if (!tip) {
7361
+ return null;
7297
7362
  }
7298
- this.setElementContent(templateElement, content);
7299
- }
7300
- setElementContent(element, content) {
7301
- if (element === null) {
7302
- return;
7363
+ tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
7364
+ tip.classList.add(`bs-${this.constructor.NAME}-auto`);
7365
+ const tipId = getUID(this.constructor.NAME).toString();
7366
+ tip.setAttribute('id', tipId);
7367
+ if (this._isAnimated()) {
7368
+ tip.classList.add(CLASS_NAME_FADE$2);
7303
7369
  }
7304
- if (isElement(content)) {
7305
- content = getElement(content);
7306
- if (this._config.html) {
7307
- if (content.parentNode !== element) {
7308
- element.innerHTML = '';
7309
- element.append(content);
7310
- }
7311
- } else {
7312
- element.textContent = content.textContent;
7313
- }
7314
- return;
7370
+ return tip;
7371
+ }
7372
+ setContent(content) {
7373
+ this._newContent = content;
7374
+ if (this._isShown()) {
7375
+ this._disposePopper();
7376
+ this.show();
7315
7377
  }
7316
- if (this._config.html) {
7317
- if (this._config.sanitize) {
7318
- content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn);
7319
- }
7320
- element.innerHTML = content;
7378
+ }
7379
+ _getTemplateFactory(content) {
7380
+ if (this._templateFactory) {
7381
+ this._templateFactory.changeContent(content);
7321
7382
  } else {
7322
- element.textContent = content;
7383
+ this._templateFactory = new TemplateFactory({ ...this._config,
7384
+ content,
7385
+ extraClass: this._resolvePossibleFunction(this._config.customClass)
7386
+ });
7323
7387
  }
7388
+ return this._templateFactory;
7324
7389
  }
7325
- getTitle() {
7326
- const title = this._element.getAttribute('data-bs-original-title') || this._config.title;
7327
- return this._resolvePossibleFunction(title);
7390
+ _getContentForTemplate() {
7391
+ return {
7392
+ [SELECTOR_TOOLTIP_INNER]: this._getTitle()
7393
+ };
7328
7394
  }
7329
- updateAttachment(attachment) {
7330
- if (attachment === 'right') {
7331
- return 'end';
7332
- }
7333
- if (attachment === 'left') {
7334
- return 'start';
7335
- }
7336
- return attachment;
7395
+ _getTitle() {
7396
+ return this._resolvePossibleFunction(this._config.title) || this._config.originalTitle;
7397
+ }
7398
+ _initializeOnDelegatedTarget(event) {
7399
+ return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
7337
7400
  }
7338
- _initializeOnDelegatedTarget(event, context) {
7339
- return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
7401
+ _isAnimated() {
7402
+ return this._config.animation || this.tip && this.tip.classList.contains(CLASS_NAME_FADE$2);
7403
+ }
7404
+ _isShown() {
7405
+ return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW$2);
7406
+ }
7407
+ _createPopper(tip) {
7408
+ const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
7409
+ const attachment = AttachmentMap[placement.toUpperCase()];
7410
+ return createPopper(this._element, tip, this._getPopperConfig(attachment));
7340
7411
  }
7341
7412
  _getOffset() {
7342
7413
  const {
7343
7414
  offset
7344
7415
  } = this._config;
7345
7416
  if (typeof offset === 'string') {
7346
- return offset.split(',').map(val => Number.parseInt(val, 10));
7417
+ return offset.split(',').map(value => Number.parseInt(value, 10));
7347
7418
  }
7348
7419
  if (typeof offset === 'function') {
7349
7420
  return popperData => offset(popperData, this._element);
7350
7421
  }
7351
7422
  return offset;
7352
7423
  }
7353
- _resolvePossibleFunction(content) {
7354
- return typeof content === 'function' ? content.call(this._element) : content;
7424
+ _resolvePossibleFunction(arg) {
7425
+ return typeof arg === 'function' ? arg.call(this._element) : arg;
7355
7426
  }
7356
7427
  _getPopperConfig(attachment) {
7357
7428
  const defaultBsPopperConfig = {
@@ -7377,39 +7448,38 @@
7377
7448
  element: `.${this.constructor.NAME}-arrow`
7378
7449
  }
7379
7450
  }, {
7380
- name: 'onChange',
7451
+ name: 'preSetPlacement',
7381
7452
  enabled: true,
7382
- phase: 'afterWrite',
7383
- fn: data => this._handlePopperPlacementChange(data)
7384
- }],
7385
- onFirstUpdate: data => {
7386
- if (data.options.placement !== data.placement) {
7387
- this._handlePopperPlacementChange(data);
7453
+ phase: 'beforeMain',
7454
+ fn: data => {
7455
+ this._getTipElement().setAttribute('data-popper-placement', data.state.placement);
7388
7456
  }
7389
- }
7457
+ }]
7390
7458
  };
7391
7459
  return { ...defaultBsPopperConfig,
7392
7460
  ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
7393
7461
  };
7394
7462
  }
7395
- _addAttachmentClass(attachment) {
7396
- this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`);
7397
- }
7398
- _getAttachment(placement) {
7399
- return AttachmentMap[placement.toUpperCase()];
7400
- }
7401
7463
  _setListeners() {
7402
7464
  const triggers = this._config.trigger.split(' ');
7403
- triggers.forEach(trigger => {
7465
+ for (const trigger of triggers) {
7404
7466
  if (trigger === 'click') {
7405
- EventHandler.on(this._element, this.constructor.Event.CLICK, this._config.selector, event => this.toggle(event));
7467
+ EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, event => this.toggle(event));
7406
7468
  } else if (trigger !== TRIGGER_MANUAL) {
7407
- const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN;
7408
- const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT;
7409
- EventHandler.on(this._element, eventIn, this._config.selector, event => this._enter(event));
7410
- EventHandler.on(this._element, eventOut, this._config.selector, event => this._leave(event));
7469
+ const eventIn = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN$1);
7470
+ const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT$1);
7471
+ EventHandler.on(this._element, eventIn, this._config.selector, event => {
7472
+ const context = this._initializeOnDelegatedTarget(event);
7473
+ context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
7474
+ context._enter();
7475
+ });
7476
+ EventHandler.on(this._element, eventOut, this._config.selector, event => {
7477
+ const context = this._initializeOnDelegatedTarget(event);
7478
+ context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
7479
+ context._leave();
7480
+ });
7411
7481
  }
7412
- });
7482
+ }
7413
7483
  this._hideModalHandler = () => {
7414
7484
  if (this._element) {
7415
7485
  this.hide();
@@ -7426,76 +7496,61 @@
7426
7496
  }
7427
7497
  }
7428
7498
  _fixTitle() {
7429
- const title = this._element.getAttribute('title');
7430
- const originalTitleType = typeof this._element.getAttribute('data-bs-original-title');
7431
- if (title || originalTitleType !== 'string') {
7432
- this._element.setAttribute('data-bs-original-title', title || '');
7433
- if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) {
7434
- this._element.setAttribute('aria-label', title);
7435
- }
7436
- this._element.setAttribute('title', '');
7437
- }
7438
- }
7439
- _enter(event, context) {
7440
- context = this._initializeOnDelegatedTarget(event, context);
7441
- if (event) {
7442
- context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
7443
- }
7444
- if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$2) || context._hoverState === HOVER_STATE_SHOW) {
7445
- context._hoverState = HOVER_STATE_SHOW;
7499
+ const title = this._config.originalTitle;
7500
+ if (!title) {
7446
7501
  return;
7447
7502
  }
7448
- clearTimeout(context._timeout);
7449
- context._hoverState = HOVER_STATE_SHOW;
7450
- if (!context._config.delay || !context._config.delay.show) {
7451
- context.show();
7452
- return;
7503
+ if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {
7504
+ this._element.setAttribute('aria-label', title);
7453
7505
  }
7454
- context._timeout = setTimeout(() => {
7455
- if (context._hoverState === HOVER_STATE_SHOW) {
7456
- context.show();
7457
- }
7458
- }, context._config.delay.show);
7506
+ this._element.removeAttribute('title');
7459
7507
  }
7460
- _leave(event, context) {
7461
- context = this._initializeOnDelegatedTarget(event, context);
7462
- if (event) {
7463
- context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
7464
- }
7465
- if (context._isWithActiveTrigger()) {
7508
+ _enter() {
7509
+ if (this._isShown() || this._isHovered) {
7510
+ this._isHovered = true;
7466
7511
  return;
7467
7512
  }
7468
- clearTimeout(context._timeout);
7469
- context._hoverState = HOVER_STATE_OUT;
7470
- if (!context._config.delay || !context._config.delay.hide) {
7471
- context.hide();
7513
+ this._isHovered = true;
7514
+ this._setTimeout(() => {
7515
+ if (this._isHovered) {
7516
+ this.show();
7517
+ }
7518
+ }, this._config.delay.show);
7519
+ }
7520
+ _leave() {
7521
+ if (this._isWithActiveTrigger()) {
7472
7522
  return;
7473
7523
  }
7474
- context._timeout = setTimeout(() => {
7475
- if (context._hoverState === HOVER_STATE_OUT) {
7476
- context.hide();
7524
+ this._isHovered = false;
7525
+ this._setTimeout(() => {
7526
+ if (!this._isHovered) {
7527
+ this.hide();
7477
7528
  }
7478
- }, context._config.delay.hide);
7529
+ }, this._config.delay.hide);
7530
+ }
7531
+ _setTimeout(handler, timeout) {
7532
+ clearTimeout(this._timeout);
7533
+ this._timeout = setTimeout(handler, timeout);
7479
7534
  }
7480
7535
  _isWithActiveTrigger() {
7481
- for (const trigger in this._activeTrigger) {
7482
- if (this._activeTrigger[trigger]) {
7483
- return true;
7484
- }
7485
- }
7486
- return false;
7536
+ return Object.values(this._activeTrigger).includes(true);
7487
7537
  }
7488
7538
  _getConfig(config) {
7489
7539
  const dataAttributes = Manipulator.getDataAttributes(this._element);
7490
- Object.keys(dataAttributes).forEach(dataAttr => {
7491
- if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
7492
- delete dataAttributes[dataAttr];
7540
+ for (const dataAttribute of Object.keys(dataAttributes)) {
7541
+ if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {
7542
+ delete dataAttributes[dataAttribute];
7493
7543
  }
7494
- });
7495
- config = { ...this.constructor.Default,
7496
- ...dataAttributes,
7544
+ }
7545
+ config = { ...dataAttributes,
7497
7546
  ...(typeof config === 'object' && config ? config : {})
7498
7547
  };
7548
+ config = this._mergeConfigObj(config);
7549
+ config = this._configAfterMerge(config);
7550
+ this._typeCheckConfig(config);
7551
+ return config;
7552
+ }
7553
+ _configAfterMerge(config) {
7499
7554
  config.container = config.container === false ? document.body : getElement(config.container);
7500
7555
  if (typeof config.delay === 'number') {
7501
7556
  config.delay = {
@@ -7503,16 +7558,13 @@
7503
7558
  hide: config.delay
7504
7559
  };
7505
7560
  }
7561
+ config.originalTitle = this._element.getAttribute('title') || '';
7506
7562
  if (typeof config.title === 'number') {
7507
7563
  config.title = config.title.toString();
7508
7564
  }
7509
7565
  if (typeof config.content === 'number') {
7510
7566
  config.content = config.content.toString();
7511
7567
  }
7512
- typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
7513
- if (config.sanitize) {
7514
- config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn);
7515
- }
7516
7568
  return config;
7517
7569
  }
7518
7570
  _getDelegateConfig() {
@@ -7524,28 +7576,6 @@
7524
7576
  }
7525
7577
  return config;
7526
7578
  }
7527
- _cleanTipClass() {
7528
- const tip = this.getTipElement();
7529
- const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g');
7530
- const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex);
7531
- if (tabClass !== null && tabClass.length > 0) {
7532
- tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
7533
- }
7534
- }
7535
- _getBasicClassPrefix() {
7536
- return CLASS_PREFIX$1;
7537
- }
7538
- _handlePopperPlacementChange(popperData) {
7539
- const {
7540
- state
7541
- } = popperData;
7542
- if (!state) {
7543
- return;
7544
- }
7545
- this.tip = state.elements.popper;
7546
- this._cleanTipClass();
7547
- this._addAttachmentClass(this._getAttachment(state.placement));
7548
- }
7549
7579
  _disposePopper() {
7550
7580
  if (this._popper) {
7551
7581
  this._popper.destroy();
@@ -7555,79 +7585,62 @@
7555
7585
  static jQueryInterface(config) {
7556
7586
  return this.each(function () {
7557
7587
  const data = Tooltip.getOrCreateInstance(this, config);
7558
- if (typeof config === 'string') {
7559
- if (typeof data[config] === 'undefined') {
7560
- throw new TypeError(`No method named "${config}"`);
7561
- }
7562
- data[config]();
7588
+ if (typeof config !== 'string') {
7589
+ return;
7590
+ }
7591
+ if (typeof data[config] === 'undefined') {
7592
+ throw new TypeError(`No method named "${config}"`);
7563
7593
  }
7594
+ data[config]();
7564
7595
  });
7565
7596
  }
7566
7597
  }
7567
7598
  defineJQueryPlugin(Tooltip);
7568
7599
  const NAME$3 = 'popover';
7569
- const DATA_KEY$3 = 'bs.popover';
7570
- const EVENT_KEY$3 = `.${DATA_KEY$3}`;
7571
- const CLASS_PREFIX = 'bs-popover';
7600
+ const SELECTOR_TITLE = '.popover-header';
7601
+ const SELECTOR_CONTENT = '.popover-body';
7572
7602
  const Default$2 = { ...Tooltip.Default,
7573
- placement: 'right',
7574
- offset: [0, 8],
7575
- trigger: 'click',
7576
7603
  content: '',
7577
- template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>'
7604
+ offset: [0, 8],
7605
+ placement: 'right',
7606
+ template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>',
7607
+ trigger: 'click'
7578
7608
  };
7579
7609
  const DefaultType$2 = { ...Tooltip.DefaultType,
7580
- content: '(string|element|function)'
7610
+ content: '(null|string|element|function)'
7581
7611
  };
7582
- const Event$1 = {
7583
- HIDE: `hide${EVENT_KEY$3}`,
7584
- HIDDEN: `hidden${EVENT_KEY$3}`,
7585
- SHOW: `show${EVENT_KEY$3}`,
7586
- SHOWN: `shown${EVENT_KEY$3}`,
7587
- INSERTED: `inserted${EVENT_KEY$3}`,
7588
- CLICK: `click${EVENT_KEY$3}`,
7589
- FOCUSIN: `focusin${EVENT_KEY$3}`,
7590
- FOCUSOUT: `focusout${EVENT_KEY$3}`,
7591
- MOUSEENTER: `mouseenter${EVENT_KEY$3}`,
7592
- MOUSELEAVE: `mouseleave${EVENT_KEY$3}`
7593
- };
7594
- const SELECTOR_TITLE = '.popover-header';
7595
- const SELECTOR_CONTENT = '.popover-body';
7596
7612
  class Popover extends Tooltip {
7597
7613
  static get Default() {
7598
7614
  return Default$2;
7599
7615
  }
7600
- static get NAME() {
7601
- return NAME$3;
7602
- }
7603
- static get Event() {
7604
- return Event$1;
7605
- }
7606
7616
  static get DefaultType() {
7607
7617
  return DefaultType$2;
7608
7618
  }
7609
- isWithContent() {
7610
- return this.getTitle() || this._getContent();
7619
+ static get NAME() {
7620
+ return NAME$3;
7611
7621
  }
7612
- setContent(tip) {
7613
- this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE);
7614
- this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT);
7622
+ _isWithContent() {
7623
+ return this._getTitle() || this._getContent();
7624
+ }
7625
+ _getContentForTemplate() {
7626
+ return {
7627
+ [SELECTOR_TITLE]: this._getTitle(),
7628
+ [SELECTOR_CONTENT]: this._getContent()
7629
+ };
7615
7630
  }
7616
7631
  _getContent() {
7617
7632
  return this._resolvePossibleFunction(this._config.content);
7618
7633
  }
7619
- _getBasicClassPrefix() {
7620
- return CLASS_PREFIX;
7621
- }
7622
7634
  static jQueryInterface(config) {
7623
7635
  return this.each(function () {
7624
7636
  const data = Popover.getOrCreateInstance(this, config);
7625
- if (typeof config === 'string') {
7626
- if (typeof data[config] === 'undefined') {
7627
- throw new TypeError(`No method named "${config}"`);
7628
- }
7629
- data[config]();
7637
+ if (typeof config !== 'string') {
7638
+ return;
7639
+ }
7640
+ if (typeof data[config] === 'undefined') {
7641
+ throw new TypeError(`No method named "${config}"`);
7630
7642
  }
7643
+ data[config]();
7631
7644
  });
7632
7645
  }
7633
7646
  }
@@ -7635,144 +7648,181 @@
7635
7648
  const NAME$2 = 'scrollspy';
7636
7649
  const DATA_KEY$2 = 'bs.scrollspy';
7637
7650
  const EVENT_KEY$2 = `.${DATA_KEY$2}`;
7638
- const DATA_API_KEY$1 = '.data-api';
7639
- const Default$1 = {
7640
- offset: 10,
7641
- method: 'auto',
7642
- target: ''
7643
- };
7644
- const DefaultType$1 = {
7645
- offset: 'number',
7646
- method: 'string',
7647
- target: '(string|element)'
7648
- };
7651
+ const DATA_API_KEY = '.data-api';
7649
7652
  const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`;
7650
- const EVENT_SCROLL = `scroll${EVENT_KEY$2}`;
7651
- const EVENT_LOAD_DATA_API = `load${EVENT_KEY$2}${DATA_API_KEY$1}`;
7653
+ const EVENT_CLICK = `click${EVENT_KEY$2}`;
7654
+ const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$2}${DATA_API_KEY}`;
7652
7655
  const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
7653
7656
  const CLASS_NAME_ACTIVE$1 = 'active';
7654
7657
  const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
7655
- const SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
7658
+ const SELECTOR_TARGET_LINKS = '[href]';
7659
+ const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
7656
7660
  const SELECTOR_NAV_LINKS = '.nav-link';
7657
7661
  const SELECTOR_NAV_ITEMS = '.nav-item';
7658
7662
  const SELECTOR_LIST_ITEMS = '.list-group-item';
7659
- const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}, .${CLASS_NAME_DROPDOWN_ITEM}`;
7660
- const SELECTOR_DROPDOWN$1 = '.dropdown';
7663
+ const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`;
7664
+ const SELECTOR_DROPDOWN = '.dropdown';
7661
7665
  const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
7662
- const METHOD_OFFSET = 'offset';
7663
- const METHOD_POSITION = 'position';
7666
+ const Default$1 = {
7667
+ offset: null,
7668
+ rootMargin: '0px 0px -25%',
7669
+ smoothScroll: false,
7670
+ target: null
7671
+ };
7672
+ const DefaultType$1 = {
7673
+ offset: '(number|null)',
7674
+ rootMargin: 'string',
7675
+ smoothScroll: 'boolean',
7676
+ target: 'element'
7677
+ };
7664
7678
  class ScrollSpy extends BaseComponent {
7665
7679
  constructor(element, config) {
7666
- super(element);
7667
- this._scrollElement = this._element.tagName === 'BODY' ? window : this._element;
7668
- this._config = this._getConfig(config);
7669
- this._offsets = [];
7670
- this._targets = [];
7680
+ super(element, config);
7681
+ this._targetLinks = new Map();
7682
+ this._observableSections = new Map();
7683
+ this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element;
7671
7684
  this._activeTarget = null;
7672
- this._scrollHeight = 0;
7673
- EventHandler.on(this._scrollElement, EVENT_SCROLL, () => this._process());
7685
+ this._observer = null;
7686
+ this._previousScrollData = {
7687
+ visibleEntryTop: 0,
7688
+ parentScrollTop: 0
7689
+ };
7674
7690
  this.refresh();
7675
- this._process();
7676
7691
  }
7677
7692
  static get Default() {
7678
7693
  return Default$1;
7679
7694
  }
7695
+ static get DefaultType() {
7696
+ return DefaultType$1;
7697
+ }
7680
7698
  static get NAME() {
7681
7699
  return NAME$2;
7682
7700
  }
7683
7701
  refresh() {
7684
- const autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
7685
- const offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
7686
- const offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
7687
- this._offsets = [];
7688
- this._targets = [];
7689
- this._scrollHeight = this._getScrollHeight();
7690
- const targets = SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target);
7691
- targets.map(element => {
7692
- const targetSelector = getSelectorFromElement(element);
7693
- const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null;
7694
- if (target) {
7695
- const targetBCR = target.getBoundingClientRect();
7696
- if (targetBCR.width || targetBCR.height) {
7697
- return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
7698
- }
7699
- }
7700
- return null;
7701
- }).filter(item => item).sort((a, b) => a[0] - b[0]).forEach(item => {
7702
- this._offsets.push(item[0]);
7703
- this._targets.push(item[1]);
7704
- });
7702
+ this._initializeTargetsAndObservables();
7703
+ this._maybeEnableSmoothScroll();
7704
+ if (this._observer) {
7705
+ this._observer.disconnect();
7706
+ } else {
7707
+ this._observer = this._getNewObserver();
7708
+ }
7709
+ for (const section of this._observableSections.values()) {
7710
+ this._observer.observe(section);
7711
+ }
7705
7712
  }
7706
7713
  dispose() {
7707
- EventHandler.off(this._scrollElement, EVENT_KEY$2);
7714
+ this._observer.disconnect();
7708
7715
  super.dispose();
7709
7716
  }
7710
- _getConfig(config) {
7711
- config = { ...Default$1,
7712
- ...Manipulator.getDataAttributes(this._element),
7713
- ...(typeof config === 'object' && config ? config : {})
7714
- };
7715
- config.target = getElement(config.target) || document.documentElement;
7716
- typeCheckConfig(NAME$2, config, DefaultType$1);
7717
+ _configAfterMerge(config) {
7718
+ config.target = getElement(config.target) || document.body;
7717
7719
  return config;
7718
7720
  }
7719
- _getScrollTop() {
7720
- return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
7721
- }
7722
- _getScrollHeight() {
7723
- return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
7721
+ _maybeEnableSmoothScroll() {
7722
+ if (!this._config.smoothScroll) {
7723
+ return;
7724
+ }
7725
+ EventHandler.off(this._config.target, EVENT_CLICK);
7726
+ EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => {
7727
+ const observableSection = this._observableSections.get(event.target.hash);
7728
+ if (observableSection) {
7729
+ event.preventDefault();
7730
+ const root = this._rootElement || window;
7731
+ const height = observableSection.offsetTop - this._element.offsetTop;
7732
+ if (root.scrollTo) {
7733
+ root.scrollTo({
7734
+ top: height,
7735
+ behavior: 'smooth'
7736
+ });
7737
+ return;
7738
+ }
7739
+ root.scrollTop = height;
7740
+ }
7741
+ });
7724
7742
  }
7725
- _getOffsetHeight() {
7726
- return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
7743
+ _getNewObserver() {
7744
+ const options = {
7745
+ root: this._rootElement,
7746
+ threshold: [0.1, 0.5, 1],
7747
+ rootMargin: this._getRootMargin()
7748
+ };
7749
+ return new IntersectionObserver(entries => this._observerCallback(entries), options);
7727
7750
  }
7728
- _process() {
7729
- const scrollTop = this._getScrollTop() + this._config.offset;
7730
- const scrollHeight = this._getScrollHeight();
7731
- const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
7732
- if (this._scrollHeight !== scrollHeight) {
7733
- this.refresh();
7751
+ _observerCallback(entries) {
7752
+ const targetElement = entry => this._targetLinks.get(`#${entry.target.id}`);
7753
+ const activate = entry => {
7754
+ this._previousScrollData.visibleEntryTop = entry.target.offsetTop;
7755
+ this._process(targetElement(entry));
7756
+ };
7757
+ const parentScrollTop = (this._rootElement || document.documentElement).scrollTop;
7758
+ const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop;
7759
+ this._previousScrollData.parentScrollTop = parentScrollTop;
7760
+ for (const entry of entries) {
7761
+ if (!entry.isIntersecting) {
7762
+ this._activeTarget = null;
7763
+ this._clearActiveClass(targetElement(entry));
7764
+ continue;
7765
+ }
7766
+ const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop;
7767
+ if (userScrollsDown && entryIsLowerThanPrevious) {
7768
+ activate(entry);
7769
+ if (!parentScrollTop) {
7770
+ return;
7771
+ }
7772
+ continue;
7773
+ }
7774
+ if (!userScrollsDown && !entryIsLowerThanPrevious) {
7775
+ activate(entry);
7776
+ }
7734
7777
  }
7735
- if (scrollTop >= maxScroll) {
7736
- const target = this._targets[this._targets.length - 1];
7737
- if (this._activeTarget !== target) {
7738
- this._activate(target);
7778
+ }
7779
+ _getRootMargin() {
7780
+ return this._config.offset ? `${this._config.offset}px 0px -30%` : this._config.rootMargin;
7781
+ }
7782
+ _initializeTargetsAndObservables() {
7783
+ this._targetLinks = new Map();
7784
+ this._observableSections = new Map();
7785
+ const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target);
7786
+ for (const anchor of targetLinks) {
7787
+ if (!anchor.hash || isDisabled(anchor)) {
7788
+ continue;
7739
7789
  }
7790
+ const observableSection = SelectorEngine.findOne(anchor.hash, this._element);
7791
+ if (isVisible(observableSection)) {
7792
+ this._targetLinks.set(anchor.hash, anchor);
7793
+ this._observableSections.set(anchor.hash, observableSection);
7794
+ }
7795
+ }
7796
+ }
7797
+ _process(target) {
7798
+ if (this._activeTarget === target) {
7740
7799
  return;
7741
7800
  }
7742
- if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
7743
- this._activeTarget = null;
7744
- this._clear();
7801
+ this._clearActiveClass(this._config.target);
7802
+ this._activeTarget = target;
7803
+ target.classList.add(CLASS_NAME_ACTIVE$1);
7804
+ this._activateParents(target);
7805
+ EventHandler.trigger(this._element, EVENT_ACTIVATE, {
7806
+ relatedTarget: target
7807
+ });
7808
+ }
7809
+ _activateParents(target) {
7810
+ if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
7811
+ SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$1);
7745
7812
  return;
7746
7813
  }
7747
- for (let i = this._offsets.length; i--;) {
7748
- const isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
7749
- if (isActiveTarget) {
7750
- this._activate(this._targets[i]);
7814
+ for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) {
7815
+ for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) {
7816
+ item.classList.add(CLASS_NAME_ACTIVE$1);
7751
7817
  }
7752
7818
  }
7753
7819
  }
7754
- _activate(target) {
7755
- this._activeTarget = target;
7756
- this._clear();
7757
- const queries = SELECTOR_LINK_ITEMS.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
7758
- const link = SelectorEngine.findOne(queries.join(','), this._config.target);
7759
- link.classList.add(CLASS_NAME_ACTIVE$1);
7760
- if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
7761
- SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, link.closest(SELECTOR_DROPDOWN$1)).classList.add(CLASS_NAME_ACTIVE$1);
7762
- } else {
7763
- SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP$1).forEach(listGroup => {
7764
- SelectorEngine.prev(listGroup, `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`).forEach(item => item.classList.add(CLASS_NAME_ACTIVE$1));
7765
- SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach(navItem => {
7766
- SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach(item => item.classList.add(CLASS_NAME_ACTIVE$1));
7767
- });
7768
- });
7820
+ _clearActiveClass(parent) {
7821
+ parent.classList.remove(CLASS_NAME_ACTIVE$1);
7822
+ const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE$1}`, parent);
7823
+ for (const node of activeNodes) {
7824
+ node.classList.remove(CLASS_NAME_ACTIVE$1);
7769
7825
  }
7770
- EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, {
7771
- relatedTarget: target
7772
- });
7773
- }
7774
- _clear() {
7775
- 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));
7776
7826
  }
7777
7827
  static jQueryInterface(config) {
7778
7828
  return this.each(function () {
@@ -7780,132 +7830,208 @@
7780
7830
  if (typeof config !== 'string') {
7781
7831
  return;
7782
7832
  }
7783
- if (typeof data[config] === 'undefined') {
7833
+ if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
7784
7834
  throw new TypeError(`No method named "${config}"`);
7785
7835
  }
7786
7836
  data[config]();
7787
7837
  });
7788
7838
  }
7789
7839
  }
7790
- EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
7791
- SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy));
7840
+ EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => {
7841
+ for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) {
7842
+ ScrollSpy.getOrCreateInstance(spy);
7843
+ }
7792
7844
  });
7793
7845
  defineJQueryPlugin(ScrollSpy);
7794
7846
  const NAME$1 = 'tab';
7795
7847
  const DATA_KEY$1 = 'bs.tab';
7796
7848
  const EVENT_KEY$1 = `.${DATA_KEY$1}`;
7797
- const DATA_API_KEY = '.data-api';
7798
7849
  const EVENT_HIDE$1 = `hide${EVENT_KEY$1}`;
7799
7850
  const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`;
7800
7851
  const EVENT_SHOW$1 = `show${EVENT_KEY$1}`;
7801
7852
  const EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`;
7802
- const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}${DATA_API_KEY}`;
7803
- const CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
7853
+ const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}`;
7854
+ const EVENT_KEYDOWN = `keydown${EVENT_KEY$1}`;
7855
+ const EVENT_LOAD_DATA_API = `load${EVENT_KEY$1}`;
7856
+ const ARROW_LEFT_KEY = 'ArrowLeft';
7857
+ const ARROW_RIGHT_KEY = 'ArrowRight';
7858
+ const ARROW_UP_KEY = 'ArrowUp';
7859
+ const ARROW_DOWN_KEY = 'ArrowDown';
7804
7860
  const CLASS_NAME_ACTIVE = 'active';
7805
7861
  const CLASS_NAME_FADE$1 = 'fade';
7806
7862
  const CLASS_NAME_SHOW$1 = 'show';
7807
- const SELECTOR_DROPDOWN = '.dropdown';
7808
- const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
7809
- const SELECTOR_ACTIVE = '.active';
7810
- const SELECTOR_ACTIVE_UL = ':scope > li > .active';
7811
- const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
7863
+ const CLASS_DROPDOWN = 'dropdown';
7812
7864
  const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
7813
- const SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
7865
+ const SELECTOR_DROPDOWN_MENU = '.dropdown-menu';
7866
+ const SELECTOR_DROPDOWN_ITEM = '.dropdown-item';
7867
+ const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)';
7868
+ const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]';
7869
+ const SELECTOR_OUTER = '.nav-item, .list-group-item';
7870
+ const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`;
7871
+ const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
7872
+ const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`;
7873
+ const SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]`;
7814
7874
  class Tab extends BaseComponent {
7875
+ constructor(element) {
7876
+ super(element);
7877
+ this._parent = this._element.closest(SELECTOR_TAB_PANEL);
7878
+ if (!this._parent) {
7879
+ return;
7880
+ }
7881
+ this._setInitialAttributes(this._parent, this._getChildren());
7882
+ EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
7883
+ }
7815
7884
  static get NAME() {
7816
7885
  return NAME$1;
7817
7886
  }
7818
7887
  show() {
7819
- if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
7888
+ const innerElem = this._element;
7889
+ if (this._elemIsActive(innerElem)) {
7820
7890
  return;
7821
7891
  }
7822
- let previous;
7823
- const target = getElementFromSelector(this._element);
7824
- const listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP);
7825
- if (listElement) {
7826
- const itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE;
7827
- previous = SelectorEngine.find(itemSelector, listElement);
7828
- previous = previous[previous.length - 1];
7829
- }
7830
- const hideEvent = previous ? EventHandler.trigger(previous, EVENT_HIDE$1, {
7831
- relatedTarget: this._element
7892
+ const active = this._getActiveElem();
7893
+ const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE$1, {
7894
+ relatedTarget: innerElem
7832
7895
  }) : null;
7833
- const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$1, {
7834
- relatedTarget: previous
7896
+ const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW$1, {
7897
+ relatedTarget: active
7835
7898
  });
7836
- if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) {
7899
+ if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) {
7837
7900
  return;
7838
7901
  }
7839
- this._activate(this._element, listElement);
7902
+ this._deactivate(active, innerElem);
7903
+ this._activate(innerElem, active);
7904
+ }
7905
+ _activate(element, relatedElem) {
7906
+ if (!element) {
7907
+ return;
7908
+ }
7909
+ element.classList.add(CLASS_NAME_ACTIVE);
7910
+ this._activate(getElementFromSelector(element));
7840
7911
  const complete = () => {
7841
- EventHandler.trigger(previous, EVENT_HIDDEN$1, {
7842
- relatedTarget: this._element
7912
+ if (element.getAttribute('role') !== 'tab') {
7913
+ element.classList.add(CLASS_NAME_SHOW$1);
7914
+ return;
7915
+ }
7916
+ element.focus();
7917
+ element.removeAttribute('tabindex');
7918
+ element.setAttribute('aria-selected', true);
7919
+ this._toggleDropDown(element, true);
7920
+ EventHandler.trigger(element, EVENT_SHOWN$1, {
7921
+ relatedTarget: relatedElem
7843
7922
  });
7844
- EventHandler.trigger(this._element, EVENT_SHOWN$1, {
7845
- relatedTarget: previous
7923
+ };
7924
+ this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
7925
+ }
7926
+ _deactivate(element, relatedElem) {
7927
+ if (!element) {
7928
+ return;
7929
+ }
7930
+ element.classList.remove(CLASS_NAME_ACTIVE);
7931
+ element.blur();
7932
+ this._deactivate(getElementFromSelector(element));
7933
+ const complete = () => {
7934
+ if (element.getAttribute('role') !== 'tab') {
7935
+ element.classList.remove(CLASS_NAME_SHOW$1);
7936
+ return;
7937
+ }
7938
+ element.setAttribute('aria-selected', false);
7939
+ element.setAttribute('tabindex', '-1');
7940
+ this._toggleDropDown(element, false);
7941
+ EventHandler.trigger(element, EVENT_HIDDEN$1, {
7942
+ relatedTarget: relatedElem
7846
7943
  });
7847
7944
  };
7848
- if (target) {
7849
- this._activate(target, target.parentNode, complete);
7850
- } else {
7851
- complete();
7945
+ this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
7946
+ }
7947
+ _keydown(event) {
7948
+ if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)) {
7949
+ return;
7950
+ }
7951
+ event.stopPropagation();
7952
+ event.preventDefault();
7953
+ const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key);
7954
+ const nextActiveElement = getNextActiveElement(this._getChildren().filter(element => !isDisabled(element)), event.target, isNext, true);
7955
+ if (nextActiveElement) {
7956
+ Tab.getOrCreateInstance(nextActiveElement).show();
7852
7957
  }
7853
7958
  }
7854
- _activate(element, container, callback) {
7855
- const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE);
7856
- const active = activeElements[0];
7857
- const isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$1);
7858
- const complete = () => this._transitionComplete(element, active, callback);
7859
- if (active && isTransitioning) {
7860
- active.classList.remove(CLASS_NAME_SHOW$1);
7861
- this._queueCallback(complete, element, true);
7862
- } else {
7863
- complete();
7959
+ _getChildren() {
7960
+ return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent);
7961
+ }
7962
+ _getActiveElem() {
7963
+ return this._getChildren().find(child => this._elemIsActive(child)) || null;
7964
+ }
7965
+ _setInitialAttributes(parent, children) {
7966
+ this._setAttributeIfNotExists(parent, 'role', 'tablist');
7967
+ for (const child of children) {
7968
+ this._setInitialAttributesOnChild(child);
7864
7969
  }
7865
7970
  }
7866
- _transitionComplete(element, active, callback) {
7867
- if (active) {
7868
- active.classList.remove(CLASS_NAME_ACTIVE);
7869
- const dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode);
7870
- if (dropdownChild) {
7871
- dropdownChild.classList.remove(CLASS_NAME_ACTIVE);
7872
- }
7873
- if (active.getAttribute('role') === 'tab') {
7874
- active.setAttribute('aria-selected', false);
7875
- }
7971
+ _setInitialAttributesOnChild(child) {
7972
+ child = this._getInnerElement(child);
7973
+ const isActive = this._elemIsActive(child);
7974
+ const outerElem = this._getOuterElement(child);
7975
+ child.setAttribute('aria-selected', isActive);
7976
+ if (outerElem !== child) {
7977
+ this._setAttributeIfNotExists(outerElem, 'role', 'presentation');
7876
7978
  }
7877
- element.classList.add(CLASS_NAME_ACTIVE);
7878
- if (element.getAttribute('role') === 'tab') {
7879
- element.setAttribute('aria-selected', true);
7979
+ if (!isActive) {
7980
+ child.setAttribute('tabindex', '-1');
7981
+ }
7982
+ this._setAttributeIfNotExists(child, 'role', 'tab');
7983
+ this._setInitialAttributesOnTargetPanel(child);
7984
+ }
7985
+ _setInitialAttributesOnTargetPanel(child) {
7986
+ const target = getElementFromSelector(child);
7987
+ if (!target) {
7988
+ return;
7880
7989
  }
7881
- reflow(element);
7882
- if (element.classList.contains(CLASS_NAME_FADE$1)) {
7883
- element.classList.add(CLASS_NAME_SHOW$1);
7990
+ this._setAttributeIfNotExists(target, 'role', 'tabpanel');
7991
+ if (child.id) {
7992
+ this._setAttributeIfNotExists(target, 'aria-labelledby', `#${child.id}`);
7884
7993
  }
7885
- let parent = element.parentNode;
7886
- if (parent && parent.nodeName === 'LI') {
7887
- parent = parent.parentNode;
7994
+ }
7995
+ _toggleDropDown(element, open) {
7996
+ const outerElem = this._getOuterElement(element);
7997
+ if (!outerElem.classList.contains(CLASS_DROPDOWN)) {
7998
+ return;
7888
7999
  }
7889
- if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
7890
- const dropdownElement = element.closest(SELECTOR_DROPDOWN);
7891
- if (dropdownElement) {
7892
- SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE));
8000
+ const toggle = (selector, className) => {
8001
+ const element = SelectorEngine.findOne(selector, outerElem);
8002
+ if (element) {
8003
+ element.classList.toggle(className, open);
7893
8004
  }
7894
- element.setAttribute('aria-expanded', true);
7895
- }
7896
- if (callback) {
7897
- callback();
8005
+ };
8006
+ toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE);
8007
+ toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW$1);
8008
+ toggle(SELECTOR_DROPDOWN_ITEM, CLASS_NAME_ACTIVE);
8009
+ outerElem.setAttribute('aria-expanded', open);
8010
+ }
8011
+ _setAttributeIfNotExists(element, attribute, value) {
8012
+ if (!element.hasAttribute(attribute)) {
8013
+ element.setAttribute(attribute, value);
7898
8014
  }
7899
8015
  }
8016
+ _elemIsActive(elem) {
8017
+ return elem.classList.contains(CLASS_NAME_ACTIVE);
8018
+ }
8019
+ _getInnerElement(elem) {
8020
+ return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem);
8021
+ }
8022
+ _getOuterElement(elem) {
8023
+ return elem.closest(SELECTOR_OUTER) || elem;
8024
+ }
7900
8025
  static jQueryInterface(config) {
7901
8026
  return this.each(function () {
7902
8027
  const data = Tab.getOrCreateInstance(this);
7903
- if (typeof config === 'string') {
7904
- if (typeof data[config] === 'undefined') {
7905
- throw new TypeError(`No method named "${config}"`);
7906
- }
7907
- data[config]();
8028
+ if (typeof config !== 'string') {
8029
+ return;
7908
8030
  }
8031
+ if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
8032
+ throw new TypeError(`No method named "${config}"`);
8033
+ }
8034
+ data[config]();
7909
8035
  });
7910
8036
  }
7911
8037
  }
@@ -7916,8 +8042,12 @@
7916
8042
  if (isDisabled(this)) {
7917
8043
  return;
7918
8044
  }
7919
- const data = Tab.getOrCreateInstance(this);
7920
- data.show();
8045
+ Tab.getOrCreateInstance(this).show();
8046
+ });
8047
+ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
8048
+ for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) {
8049
+ Tab.getOrCreateInstance(element);
8050
+ }
7921
8051
  });
7922
8052
  defineJQueryPlugin(Tab);
7923
8053
  const NAME = 'toast';
@@ -7947,19 +8077,18 @@
7947
8077
  };
7948
8078
  class Toast extends BaseComponent {
7949
8079
  constructor(element, config) {
7950
- super(element);
7951
- this._config = this._getConfig(config);
8080
+ super(element, config);
7952
8081
  this._timeout = null;
7953
8082
  this._hasMouseInteraction = false;
7954
8083
  this._hasKeyboardInteraction = false;
7955
8084
  this._setListeners();
7956
8085
  }
7957
- static get DefaultType() {
7958
- return DefaultType;
7959
- }
7960
8086
  static get Default() {
7961
8087
  return Default;
7962
8088
  }
8089
+ static get DefaultType() {
8090
+ return DefaultType;
8091
+ }
7963
8092
  static get NAME() {
7964
8093
  return NAME;
7965
8094
  }
@@ -7979,12 +8108,11 @@
7979
8108
  };
7980
8109
  this._element.classList.remove(CLASS_NAME_HIDE);
7981
8110
  reflow(this._element);
7982
- this._element.classList.add(CLASS_NAME_SHOW);
7983
- this._element.classList.add(CLASS_NAME_SHOWING);
8111
+ this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING);
7984
8112
  this._queueCallback(complete, this._element, this._config.animation);
7985
8113
  }
7986
8114
  hide() {
7987
- if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
8115
+ if (!this.isShown()) {
7988
8116
  return;
7989
8117
  }
7990
8118
  const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
@@ -7993,8 +8121,7 @@
7993
8121
  }
7994
8122
  const complete = () => {
7995
8123
  this._element.classList.add(CLASS_NAME_HIDE);
7996
- this._element.classList.remove(CLASS_NAME_SHOWING);
7997
- this._element.classList.remove(CLASS_NAME_SHOW);
8124
+ this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW);
7998
8125
  EventHandler.trigger(this._element, EVENT_HIDDEN);
7999
8126
  };
8000
8127
  this._element.classList.add(CLASS_NAME_SHOWING);
@@ -8002,18 +8129,13 @@
8002
8129
  }
8003
8130
  dispose() {
8004
8131
  this._clearTimeout();
8005
- if (this._element.classList.contains(CLASS_NAME_SHOW)) {
8132
+ if (this.isShown()) {
8006
8133
  this._element.classList.remove(CLASS_NAME_SHOW);
8007
8134
  }
8008
8135
  super.dispose();
8009
8136
  }
8010
- _getConfig(config) {
8011
- config = { ...Default,
8012
- ...Manipulator.getDataAttributes(this._element),
8013
- ...(typeof config === 'object' && config ? config : {})
8014
- };
8015
- typeCheckConfig(NAME, config, this.constructor.DefaultType);
8016
- return config;
8137
+ isShown() {
8138
+ return this._element.classList.contains(CLASS_NAME_SHOW);
8017
8139
  }
8018
8140
  _maybeScheduleHide() {
8019
8141
  if (!this._config.autohide) {