@swisspost/design-system-components 9.0.0-next.8 → 9.0.0-next.9

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 (349) hide show
  1. package/dist/cjs/check-url-3ffdd2fb.js +14 -0
  2. package/dist/cjs/debounce-1151afe3.js +12 -0
  3. package/dist/cjs/{index-e1f32cce.js → index-010dc207.js} +20 -27
  4. package/dist/cjs/{index-824d2b71.js → index-5d4e0aed.js} +2 -12
  5. package/dist/cjs/index.cjs.js +45 -42
  6. package/dist/cjs/loader.cjs.js +2 -2
  7. package/dist/cjs/{package-a2b895fc.js → package-8e810a59.js} +1 -1
  8. package/dist/cjs/{post-accordion-3ce01432.js → post-accordion-b9df8522.js} +2 -2
  9. package/dist/cjs/{post-accordion-item-81601b1e.js → post-accordion-item-ecc6749f.js} +8 -7
  10. package/dist/cjs/post-accordion-item.cjs.entry.js +5 -4
  11. package/dist/cjs/post-accordion.cjs.entry.js +3 -3
  12. package/dist/cjs/{post-avatar-b1c97f51.js → post-avatar-f7236084.js} +2 -2
  13. package/dist/cjs/post-avatar.cjs.entry.js +3 -3
  14. package/dist/cjs/post-back-to-top-60762f8e.js +75 -0
  15. package/dist/cjs/post-back-to-top.cjs.entry.js +4 -3
  16. package/dist/cjs/{post-banner-8611eab5.js → post-banner-9662f22c.js} +3 -3
  17. package/dist/cjs/post-banner.cjs.entry.js +5 -4
  18. package/dist/cjs/post-breadcrumb-b40732fc.js +111 -0
  19. package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +17 -0
  20. package/dist/cjs/post-breadcrumb.cjs.entry.js +13 -0
  21. package/dist/cjs/{post-card-control-acd30573.js → post-card-control-039c9a4b.js} +4 -4
  22. package/dist/cjs/post-card-control.cjs.entry.js +3 -3
  23. package/dist/cjs/post-closebutton_15.cjs.entry.js +33 -0
  24. package/dist/cjs/{post-collapsible-trigger-8ca4d85b.js → post-collapsible-trigger-143cf84a.js} +6 -14
  25. package/dist/cjs/post-collapsible_2.cjs.entry.js +6 -4
  26. package/dist/cjs/post-components.cjs.js +2 -2
  27. package/dist/cjs/post-footer-5f7fdf96.js +84 -0
  28. package/dist/cjs/post-footer.cjs.entry.js +11 -0
  29. package/dist/cjs/post-menu-item-bb0b0b9e.js +74 -0
  30. package/dist/cjs/{post-popover-c4f50134.js → post-popover-d0ce9dc6.js} +3 -3
  31. package/dist/cjs/post-popover.cjs.entry.js +3 -3
  32. package/dist/cjs/{post-rating-3a87ca46.js → post-rating-1082197c.js} +3 -3
  33. package/dist/cjs/post-rating.cjs.entry.js +3 -3
  34. package/dist/cjs/{post-tab-header-5fdb05a1.js → post-tab-header-4b6d8d54.js} +3 -3
  35. package/dist/cjs/post-tab-header.cjs.entry.js +3 -3
  36. package/dist/cjs/{post-tab-panel-34aed8e6.js → post-tab-panel-60f211a5.js} +3 -3
  37. package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
  38. package/dist/cjs/{post-tabs-dd2da5d2.js → post-tabs-1f797ce4.js} +8 -6
  39. package/dist/cjs/post-tabs.cjs.entry.js +3 -3
  40. package/dist/cjs/{post-tag-59232922.js → post-tag-ddaaaedc.js} +3 -3
  41. package/dist/cjs/post-tag.cjs.entry.js +3 -3
  42. package/dist/cjs/{post-megadropdown-trigger-7376d867.js → post-togglebutton-0984a694.js} +1789 -1234
  43. package/dist/cjs/{post-tooltip-3e0c1509.js → post-tooltip-38c839a4.js} +4 -4
  44. package/dist/cjs/post-tooltip.cjs.entry.js +5 -4
  45. package/dist/cjs/slide-5d51abe8.js +28 -0
  46. package/dist/collection/animations/slide.js +4 -4
  47. package/dist/collection/collection-manifest.json +12 -9
  48. package/dist/collection/components/post-accordion-item/post-accordion-item.js +7 -4
  49. package/dist/collection/components/post-back-to-top/post-back-to-top.css +1 -1
  50. package/dist/collection/components/post-back-to-top/post-back-to-top.js +2 -2
  51. package/dist/collection/components/post-breadcrumb/post-breadcrumb.css +3 -0
  52. package/dist/collection/components/post-breadcrumb/post-breadcrumb.js +161 -0
  53. package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.css +1 -1
  54. package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +11 -1
  55. package/dist/collection/components/post-card-control/post-card-control.js +2 -2
  56. package/dist/collection/components/post-closebutton/post-closebutton.js +1 -1
  57. package/dist/collection/components/post-collapsible/post-collapsible.js +1 -1
  58. package/dist/collection/components/post-footer/post-footer.css +1 -0
  59. package/dist/collection/components/post-footer/post-footer.js +75 -0
  60. package/dist/collection/components/post-header/post-header.css +1 -1
  61. package/dist/collection/components/post-header/post-header.js +74 -17
  62. package/dist/collection/components/post-icon/post-icon.js +1 -1
  63. package/dist/collection/components/post-language-option/post-language-option.css +1 -1
  64. package/dist/collection/components/post-language-option/post-language-option.js +25 -1
  65. package/dist/collection/components/post-language-switch/post-language-switch.css +1 -0
  66. package/dist/collection/components/post-language-switch/post-language-switch.js +163 -0
  67. package/dist/collection/components/post-language-switch/switch-variants.js +1 -0
  68. package/dist/collection/components/post-list/post-list.css +1 -1
  69. package/dist/collection/components/post-list/post-list.js +3 -3
  70. package/dist/collection/components/post-list-item/post-list-item.js +1 -1
  71. package/dist/collection/components/post-logo/post-logo.js +1 -1
  72. package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -1
  73. package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +15 -24
  74. package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
  75. package/dist/collection/components/post-megadropdown/post-megadropdown.js +82 -68
  76. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +1 -1
  77. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +80 -24
  78. package/dist/collection/components/post-menu/post-menu.js +6 -4
  79. package/dist/collection/components/post-menu-item/post-menu-item.js +1 -1
  80. package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +11 -1
  81. package/dist/collection/components/post-popover/post-popover.js +1 -1
  82. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +2 -2
  83. package/dist/collection/components/post-rating/post-rating.js +1 -1
  84. package/dist/collection/components/post-tab-header/post-tab-header.js +1 -1
  85. package/dist/collection/components/post-tab-panel/post-tab-panel.js +1 -1
  86. package/dist/collection/components/post-tabs/post-tabs.js +6 -4
  87. package/dist/collection/components/post-tag/post-tag.js +1 -1
  88. package/dist/collection/components/post-togglebutton/post-togglebutton.css +1 -1
  89. package/dist/collection/components/post-togglebutton/post-togglebutton.js +24 -6
  90. package/dist/collection/components/post-tooltip/post-tooltip.js +1 -1
  91. package/dist/collection/index.js +12 -9
  92. package/dist/collection/utils/breakpoints.js +46 -0
  93. package/dist/components/debounce.js +10 -0
  94. package/dist/components/index.js +12 -9
  95. package/dist/components/index2.js +1 -1
  96. package/dist/components/package.js +1 -1
  97. package/dist/components/post-accordion-item2.js +5 -4
  98. package/dist/components/post-back-to-top2.js +4 -27
  99. package/dist/components/post-breadcrumb-item2.js +13 -3
  100. package/dist/components/post-breadcrumb.d.ts +11 -0
  101. package/dist/components/post-breadcrumb.js +6 -0
  102. package/dist/components/post-breadcrumb2.js +168 -0
  103. package/dist/components/post-card-control2.js +2 -2
  104. package/dist/components/post-closebutton2.js +1 -1
  105. package/dist/components/post-collapsible-trigger2.js +1 -9
  106. package/dist/components/post-collapsible2.js +2 -2
  107. package/dist/components/post-footer.d.ts +11 -0
  108. package/dist/components/post-footer.js +6 -0
  109. package/dist/components/post-footer2.js +124 -0
  110. package/dist/components/post-header2.js +55 -14
  111. package/dist/components/post-icon2.js +2 -2
  112. package/dist/components/post-language-option2.js +5 -3
  113. package/dist/components/post-language-switch.d.ts +11 -0
  114. package/dist/components/post-language-switch.js +6 -0
  115. package/dist/components/post-language-switch2.js +146 -0
  116. package/dist/components/post-list-item2.js +1 -1
  117. package/dist/components/post-list2.js +4 -4
  118. package/dist/components/post-logo2.js +2 -2
  119. package/dist/components/post-mainnavigation2.js +17 -17
  120. package/dist/components/post-megadropdown-trigger2.js +63 -11
  121. package/dist/components/post-megadropdown2.js +48 -22
  122. package/dist/components/post-menu-item2.js +1 -1
  123. package/dist/components/post-menu-trigger2.js +11 -1
  124. package/dist/components/post-menu2.js +6 -4
  125. package/dist/components/post-popover2.js +1 -1
  126. package/dist/components/post-popovercontainer2.js +2 -2
  127. package/dist/components/post-rating2.js +1 -1
  128. package/dist/components/post-tab-header2.js +1 -1
  129. package/dist/components/post-tab-panel2.js +1 -1
  130. package/dist/components/post-tabs2.js +6 -4
  131. package/dist/components/post-tag2.js +1 -1
  132. package/dist/components/post-togglebutton2.js +23 -5
  133. package/dist/components/post-tooltip2.js +2 -2
  134. package/dist/components/slide.js +25 -0
  135. package/dist/docs.json +500 -123
  136. package/dist/esm/check-url-a974431e.js +12 -0
  137. package/dist/esm/debounce-abe98cc2.js +10 -0
  138. package/dist/esm/{index-f8a00dc0.js → index-b49c9904.js} +1 -11
  139. package/dist/esm/{index-e1b64755.js → index-fb8d6be7.js} +20 -27
  140. package/dist/esm/index.js +24 -24
  141. package/dist/esm/loader.js +3 -3
  142. package/dist/esm/package-4d81f3c2.js +3 -0
  143. package/dist/esm/{post-accordion-19e88941.js → post-accordion-ee54a3ef.js} +2 -2
  144. package/dist/esm/{post-accordion-item-33bbe4de.js → post-accordion-item-e10452dc.js} +8 -7
  145. package/dist/esm/post-accordion-item.entry.js +5 -4
  146. package/dist/esm/post-accordion.entry.js +3 -3
  147. package/dist/esm/{post-avatar-d15a9f9e.js → post-avatar-5572fa73.js} +2 -2
  148. package/dist/esm/post-avatar.entry.js +3 -3
  149. package/dist/esm/post-back-to-top-1d823c43.js +73 -0
  150. package/dist/esm/post-back-to-top.entry.js +4 -3
  151. package/dist/esm/{post-banner-bf5e6a18.js → post-banner-78480475.js} +3 -3
  152. package/dist/esm/post-banner.entry.js +5 -4
  153. package/dist/esm/post-breadcrumb-aaa77f74.js +109 -0
  154. package/dist/esm/post-breadcrumb-item_2.entry.js +8 -0
  155. package/dist/esm/post-breadcrumb.entry.js +5 -0
  156. package/dist/esm/{post-card-control-f0788f6f.js → post-card-control-862aa961.js} +4 -4
  157. package/dist/esm/post-card-control.entry.js +3 -3
  158. package/dist/esm/post-closebutton_15.entry.js +11 -0
  159. package/dist/esm/{post-collapsible-trigger-1d939eb6.js → post-collapsible-trigger-1c7833f8.js} +5 -13
  160. package/dist/esm/post-collapsible_2.entry.js +6 -4
  161. package/dist/esm/post-components.js +3 -3
  162. package/dist/esm/post-footer-b18875e7.js +82 -0
  163. package/dist/esm/post-footer.entry.js +3 -0
  164. package/dist/esm/post-menu-item-2906384b.js +71 -0
  165. package/dist/esm/{post-popover-7195d05a.js → post-popover-2432bb3f.js} +3 -3
  166. package/dist/esm/post-popover.entry.js +3 -3
  167. package/dist/esm/{post-rating-8baf86fe.js → post-rating-95cbdbb8.js} +3 -3
  168. package/dist/esm/post-rating.entry.js +3 -3
  169. package/dist/esm/{post-tab-header-a1d1d9d0.js → post-tab-header-dfea00ea.js} +3 -3
  170. package/dist/esm/post-tab-header.entry.js +3 -3
  171. package/dist/esm/{post-tab-panel-afce8d40.js → post-tab-panel-cafd9e04.js} +3 -3
  172. package/dist/esm/post-tab-panel.entry.js +3 -3
  173. package/dist/esm/{post-tabs-fbb42496.js → post-tabs-beef8eae.js} +8 -6
  174. package/dist/esm/post-tabs.entry.js +3 -3
  175. package/dist/esm/{post-tag-d67b6a19.js → post-tag-a77e7af6.js} +3 -3
  176. package/dist/esm/post-tag.entry.js +3 -3
  177. package/dist/esm/{post-megadropdown-trigger-210b4ab3.js → post-togglebutton-395bf3f0.js} +1785 -1235
  178. package/dist/esm/{post-tooltip-7101ed24.js → post-tooltip-b298039a.js} +4 -4
  179. package/dist/esm/post-tooltip.entry.js +5 -4
  180. package/dist/esm/slide-3422b8a3.js +25 -0
  181. package/dist/post-components/index.esm.js +1 -1
  182. package/dist/post-components/p-0711f76d.entry.js +1 -0
  183. package/dist/post-components/p-095a06f6.entry.js +1 -0
  184. package/dist/post-components/p-0b5a5f32.js +1 -0
  185. package/dist/post-components/{p-f0f8427e.js → p-135fa60f.js} +1 -1
  186. package/dist/post-components/p-18e38d8a.js +1 -0
  187. package/dist/post-components/p-2e1ec074.entry.js +1 -0
  188. package/dist/post-components/p-4202b433.entry.js +1 -0
  189. package/dist/post-components/p-45773f59.js +1 -0
  190. package/dist/post-components/{p-282115c4.js → p-4953de7e.js} +1 -1
  191. package/dist/post-components/p-4f67c5f5.entry.js +1 -0
  192. package/dist/post-components/{p-6cea23cd.js → p-4f9746f6.js} +2 -2
  193. package/dist/post-components/p-5075c672.entry.js +1 -0
  194. package/dist/post-components/p-515e0f96.js +1 -0
  195. package/dist/post-components/p-5467b223.js +1 -0
  196. package/dist/post-components/p-67036798.entry.js +1 -0
  197. package/dist/post-components/{p-d0b8820a.js → p-6d953fb2.js} +1 -1
  198. package/dist/post-components/p-6edb0ac5.js +1 -0
  199. package/dist/post-components/{p-939f2ba7.js → p-6f8f39ca.js} +1 -1
  200. package/dist/post-components/p-7503a623.js +1 -0
  201. package/dist/post-components/p-761b24c7.entry.js +1 -0
  202. package/dist/post-components/{p-00fa0152.js → p-77c4c1d2.js} +1 -1
  203. package/dist/post-components/p-7cf0c2ad.js +1 -0
  204. package/dist/post-components/p-856c14d6.entry.js +1 -0
  205. package/dist/post-components/p-866bf50a.entry.js +1 -0
  206. package/dist/post-components/p-8d621781.js +1 -0
  207. package/dist/post-components/p-8fe2d72c.entry.js +1 -0
  208. package/dist/post-components/p-9ad5088f.entry.js +1 -0
  209. package/dist/post-components/{p-485dafcf.js → p-a1d2b90e.js} +1 -1
  210. package/dist/post-components/p-a521419d.entry.js +1 -0
  211. package/dist/post-components/p-aa538648.js +1 -0
  212. package/dist/post-components/p-afdbee2f.js +1 -0
  213. package/dist/post-components/p-b02817f2.entry.js +1 -0
  214. package/dist/post-components/p-b157dcba.entry.js +1 -0
  215. package/dist/post-components/p-b22656b1.js +1 -0
  216. package/dist/post-components/{p-61e79941.js → p-bdbd11cb.js} +1 -1
  217. package/dist/post-components/{p-3eab790d.js → p-c0ae9886.js} +1 -1
  218. package/dist/post-components/p-c537e196.entry.js +1 -0
  219. package/dist/post-components/p-d4f93f2b.js +1 -0
  220. package/dist/post-components/p-dca4246a.entry.js +1 -0
  221. package/dist/post-components/{p-f627744e.js → p-f319b026.js} +1 -1
  222. package/dist/post-components/{p-ccb6dfa1.js → p-f4b7b379.js} +1 -1
  223. package/dist/post-components/p-fac66087.entry.js +1 -0
  224. package/dist/post-components/post-components.esm.js +1 -1
  225. package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +2 -0
  226. package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +3 -3
  227. package/dist/types/components/post-breadcrumb/post-breadcrumb.d.ts +30 -0
  228. package/dist/types/components/post-breadcrumb-item/post-breadcrumb-item.d.ts +1 -0
  229. package/dist/types/components/post-footer/post-footer.d.ts +23 -0
  230. package/dist/types/components/post-header/post-header.d.ts +13 -5
  231. package/dist/types/components/post-language-option/post-language-option.d.ts +5 -0
  232. package/dist/types/components/post-language-switch/post-language-switch.d.ts +31 -0
  233. package/dist/types/components/post-language-switch/switch-variants.d.ts +2 -0
  234. package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +10 -1
  235. package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +24 -12
  236. package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +20 -5
  237. package/dist/types/components/post-menu/post-menu.d.ts +1 -0
  238. package/dist/types/components/post-togglebutton/post-togglebutton.d.ts +4 -2
  239. package/dist/types/components.d.ts +129 -29
  240. package/dist/types/index.d.ts +12 -9
  241. package/dist/types/utils/breakpoints.d.ts +11 -0
  242. package/loaders/debounce.js +10 -0
  243. package/loaders/index.d.ts +6 -0
  244. package/loaders/index.js +3 -0
  245. package/loaders/index2.js +1 -1
  246. package/loaders/package.js +1 -1
  247. package/loaders/post-accordion-item.js +1 -99
  248. package/loaders/post-accordion-item2.js +102 -0
  249. package/loaders/post-back-to-top.js +4 -27
  250. package/loaders/post-banner.js +1 -1
  251. package/loaders/post-breadcrumb-item.js +1 -70
  252. package/loaders/post-breadcrumb-item2.js +82 -0
  253. package/loaders/post-breadcrumb.d.ts +11 -0
  254. package/loaders/post-breadcrumb.js +171 -0
  255. package/loaders/post-card-control.js +2 -2
  256. package/loaders/post-closebutton.js +1 -1
  257. package/loaders/post-collapsible-trigger2.js +1 -9
  258. package/loaders/post-collapsible2.js +1 -1
  259. package/loaders/post-footer.d.ts +11 -0
  260. package/loaders/post-footer.js +127 -0
  261. package/loaders/post-header.js +55 -14
  262. package/loaders/post-icon2.js +2 -2
  263. package/loaders/post-language-option.js +4 -2
  264. package/loaders/post-language-switch.d.ts +11 -0
  265. package/loaders/post-language-switch.js +149 -0
  266. package/loaders/post-list-item.js +1 -1
  267. package/loaders/post-list.js +4 -4
  268. package/loaders/post-logo.js +2 -2
  269. package/loaders/post-mainnavigation.js +17 -17
  270. package/loaders/post-megadropdown-trigger.js +63 -11
  271. package/loaders/post-megadropdown.js +48 -22
  272. package/loaders/post-menu-item.js +1 -31
  273. package/loaders/post-menu-item2.js +33 -0
  274. package/loaders/post-menu-trigger.js +1 -90
  275. package/{dist/esm/post-menu-trigger-80c2bdf4.js → loaders/post-menu-trigger2.js} +41 -12
  276. package/loaders/post-menu.js +1 -199
  277. package/{dist/esm/post-menu-e853e28b.js → loaders/post-menu2.js} +42 -13
  278. package/loaders/post-popover.js +1 -1
  279. package/loaders/post-popovercontainer2.js +2 -2
  280. package/loaders/post-rating.js +1 -1
  281. package/loaders/post-tab-header.js +1 -1
  282. package/loaders/post-tab-panel.js +1 -1
  283. package/loaders/post-tabs.js +6 -4
  284. package/loaders/post-tag.js +1 -1
  285. package/loaders/post-togglebutton.js +23 -5
  286. package/loaders/post-tooltip.js +1 -1
  287. package/loaders/slide.js +25 -0
  288. package/package.json +5 -4
  289. package/dist/cjs/post-back-to-top-0ce98569.js +0 -98
  290. package/dist/cjs/post-breadcrumb-item-2075462a.js +0 -49
  291. package/dist/cjs/post-breadcrumb-item.cjs.entry.js +0 -15
  292. package/dist/cjs/post-closebutton_10.cjs.entry.js +0 -25
  293. package/dist/cjs/post-language-option-cf32d0ed.js +0 -68
  294. package/dist/cjs/post-language-option.cjs.entry.js +0 -15
  295. package/dist/cjs/post-menu-a3b7b63b.js +0 -176
  296. package/dist/cjs/post-menu-item-28ab1a72.js +0 -20
  297. package/dist/cjs/post-menu-item.cjs.entry.js +0 -11
  298. package/dist/cjs/post-menu-trigger-821839f5.js +0 -75
  299. package/dist/cjs/post-menu-trigger.cjs.entry.js +0 -13
  300. package/dist/cjs/post-menu.cjs.entry.js +0 -11
  301. package/dist/cjs/post-togglebutton-59c6357b.js +0 -28
  302. package/dist/cjs/post-togglebutton.cjs.entry.js +0 -11
  303. package/dist/esm/package-9cafe148.js +0 -3
  304. package/dist/esm/post-back-to-top-bcf46150.js +0 -96
  305. package/dist/esm/post-breadcrumb-item-e3b41f74.js +0 -47
  306. package/dist/esm/post-breadcrumb-item.entry.js +0 -7
  307. package/dist/esm/post-closebutton_10.entry.js +0 -8
  308. package/dist/esm/post-language-option-1436370d.js +0 -66
  309. package/dist/esm/post-language-option.entry.js +0 -7
  310. package/dist/esm/post-menu-item-86d4c7ab.js +0 -18
  311. package/dist/esm/post-menu-item.entry.js +0 -3
  312. package/dist/esm/post-menu-trigger.entry.js +0 -5
  313. package/dist/esm/post-menu.entry.js +0 -3
  314. package/dist/esm/post-togglebutton-c3fb912d.js +0 -26
  315. package/dist/esm/post-togglebutton.entry.js +0 -3
  316. package/dist/post-components/p-0338f9da.js +0 -1
  317. package/dist/post-components/p-1667387e.entry.js +0 -1
  318. package/dist/post-components/p-19551c18.entry.js +0 -1
  319. package/dist/post-components/p-1b627f80.js +0 -1
  320. package/dist/post-components/p-24673919.js +0 -1
  321. package/dist/post-components/p-266b734f.entry.js +0 -1
  322. package/dist/post-components/p-2d0ffc1e.entry.js +0 -1
  323. package/dist/post-components/p-45018d7e.entry.js +0 -1
  324. package/dist/post-components/p-4a647a78.js +0 -1
  325. package/dist/post-components/p-4abfa65b.js +0 -1
  326. package/dist/post-components/p-517f2b1f.entry.js +0 -1
  327. package/dist/post-components/p-55224ee7.entry.js +0 -1
  328. package/dist/post-components/p-558a9849.js +0 -1
  329. package/dist/post-components/p-59b31557.js +0 -1
  330. package/dist/post-components/p-5d1db85c.entry.js +0 -1
  331. package/dist/post-components/p-679978de.entry.js +0 -1
  332. package/dist/post-components/p-6a842b96.entry.js +0 -1
  333. package/dist/post-components/p-71f03424.js +0 -1
  334. package/dist/post-components/p-8c2568c1.entry.js +0 -1
  335. package/dist/post-components/p-8fd3a3cb.entry.js +0 -1
  336. package/dist/post-components/p-a4c39296.entry.js +0 -1
  337. package/dist/post-components/p-af5d3b89.entry.js +0 -1
  338. package/dist/post-components/p-b4423249.entry.js +0 -1
  339. package/dist/post-components/p-c31a7d65.entry.js +0 -1
  340. package/dist/post-components/p-c544bb82.js +0 -1
  341. package/dist/post-components/p-d36adfb5.js +0 -1
  342. package/dist/post-components/p-da6a8268.entry.js +0 -1
  343. package/dist/post-components/p-ece14d88.js +0 -1
  344. package/dist/post-components/p-f2e1b4d8.js +0 -1
  345. package/dist/post-components/p-f7b6b96a.entry.js +0 -1
  346. package/dist/post-components/p-f812e93d.entry.js +0 -1
  347. package/dist/post-components/p-f8d41c32.js +0 -1
  348. package/dist/post-components/p-fe516cdf.entry.js +0 -1
  349. package/dist/post-components/p-fe7467fb.entry.js +0 -1
@@ -1,19 +1,271 @@
1
- import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-e1b64755.js';
2
- import { v as version } from './package-9cafe148.js';
3
- import { c as checkEmptyOrOneOf, d as checkEmptyOrType, b as checkEmptyOrUrl } from './index-f8a00dc0.js';
1
+ import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-fb8d6be7.js';
2
+ import { v as version } from './package-4d81f3c2.js';
3
+ import { s as slideUp, a as slideDown } from './slide-3422b8a3.js';
4
+ import { c as checkEmptyOrOneOf, d as checkEmptyOrType, b as checkEmptyOrUrl } from './index-b49c9904.js';
4
5
  import { c as checkNonEmpty } from './check-non-empty-58bd6b17.js';
5
6
  import { c as checkType } from './check-type-8828dbe4.js';
7
+ import { g as getRoot } from './get-root-7af2e0d1.js';
6
8
 
7
9
  const PostClosebutton = class {
8
10
  constructor(hostRef) {
9
11
  registerInstance(this, hostRef);
10
12
  }
11
13
  render() {
12
- return (h(Host, { key: '4e03f31cdefe37e70ae44d8c7baaa71abf660db4', "data-version": version }, h("button", { key: 'bcb645f50e587470fbdc6bee7b369c58aef403fd', class: "btn btn-icon-close" }, h("post-icon", { key: '5860a0b4c8a2cfd740cca788b22377e2e4bc9614', "aria-hidden": "true", name: "2043" }), h("span", { key: '4381a0a47c99703b0a6ca9f864b69437afff167f', class: "visually-hidden" }, h("slot", { key: '55a72682749ddac4716463c21f8bc31a89f285b9' })))));
14
+ return (h(Host, { key: 'cb5be35247053b1227c32f7949baca51ccc31081', "data-version": version }, h("button", { key: 'b68dc109cc7a9a99b85fc995447bc7c0b0ddc3bf', class: "btn btn-icon-close" }, h("post-icon", { key: '9276c885e5b48092a0a24285ec6cd4301a4fc032', "aria-hidden": "true", name: "closex" }), h("span", { key: '3e04657ab677186830d80b8dabe769d70b6b8e8e', class: "visually-hidden" }, h("slot", { key: 'c2c9e8df9f62516a1b88b1dbc3949287fbaa3991' })))));
13
15
  }
14
16
  get host() { return getElement(this); }
15
17
  };
16
18
 
19
+ /* eslint-disable no-undefined,no-param-reassign,no-shadow */
20
+
21
+ /**
22
+ * Throttle execution of a function. Especially useful for rate limiting
23
+ * execution of handlers on events like resize and scroll.
24
+ *
25
+ * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
26
+ * are most useful.
27
+ * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
28
+ * as-is, to `callback` when the throttled-function is executed.
29
+ * @param {object} [options] - An object to configure options.
30
+ * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
31
+ * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
32
+ * one final time after the last throttled-function call. (After the throttled-function has not been called for
33
+ * `delay` milliseconds, the internal counter is reset).
34
+ * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
35
+ * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
36
+ * callback will never executed if both noLeading = true and noTrailing = true.
37
+ * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
38
+ * false (at end), schedule `callback` to execute after `delay` ms.
39
+ *
40
+ * @returns {Function} A new, throttled, function.
41
+ */
42
+ function throttle (delay, callback, options) {
43
+ var _ref = options || {},
44
+ _ref$noTrailing = _ref.noTrailing,
45
+ noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,
46
+ _ref$noLeading = _ref.noLeading,
47
+ noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,
48
+ _ref$debounceMode = _ref.debounceMode,
49
+ debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;
50
+ /*
51
+ * After wrapper has stopped being called, this timeout ensures that
52
+ * `callback` is executed at the proper times in `throttle` and `end`
53
+ * debounce modes.
54
+ */
55
+ var timeoutID;
56
+ var cancelled = false;
57
+
58
+ // Keep track of the last time `callback` was executed.
59
+ var lastExec = 0;
60
+
61
+ // Function to clear existing timeout
62
+ function clearExistingTimeout() {
63
+ if (timeoutID) {
64
+ clearTimeout(timeoutID);
65
+ }
66
+ }
67
+
68
+ // Function to cancel next exec
69
+ function cancel(options) {
70
+ var _ref2 = options || {},
71
+ _ref2$upcomingOnly = _ref2.upcomingOnly,
72
+ upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
73
+ clearExistingTimeout();
74
+ cancelled = !upcomingOnly;
75
+ }
76
+
77
+ /*
78
+ * The `wrapper` function encapsulates all of the throttling / debouncing
79
+ * functionality and when executed will limit the rate at which `callback`
80
+ * is executed.
81
+ */
82
+ function wrapper() {
83
+ for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
84
+ arguments_[_key] = arguments[_key];
85
+ }
86
+ var self = this;
87
+ var elapsed = Date.now() - lastExec;
88
+ if (cancelled) {
89
+ return;
90
+ }
91
+
92
+ // Execute `callback` and update the `lastExec` timestamp.
93
+ function exec() {
94
+ lastExec = Date.now();
95
+ callback.apply(self, arguments_);
96
+ }
97
+
98
+ /*
99
+ * If `debounceMode` is true (at begin) this is used to clear the flag
100
+ * to allow future `callback` executions.
101
+ */
102
+ function clear() {
103
+ timeoutID = undefined;
104
+ }
105
+ if (!noLeading && debounceMode && !timeoutID) {
106
+ /*
107
+ * Since `wrapper` is being called for the first time and
108
+ * `debounceMode` is true (at begin), execute `callback`
109
+ * and noLeading != true.
110
+ */
111
+ exec();
112
+ }
113
+ clearExistingTimeout();
114
+ if (debounceMode === undefined && elapsed > delay) {
115
+ if (noLeading) {
116
+ /*
117
+ * In throttle mode with noLeading, if `delay` time has
118
+ * been exceeded, update `lastExec` and schedule `callback`
119
+ * to execute after `delay` ms.
120
+ */
121
+ lastExec = Date.now();
122
+ if (!noTrailing) {
123
+ timeoutID = setTimeout(debounceMode ? clear : exec, delay);
124
+ }
125
+ } else {
126
+ /*
127
+ * In throttle mode without noLeading, if `delay` time has been exceeded, execute
128
+ * `callback`.
129
+ */
130
+ exec();
131
+ }
132
+ } else if (noTrailing !== true) {
133
+ /*
134
+ * In trailing throttle mode, since `delay` time has not been
135
+ * exceeded, schedule `callback` to execute `delay` ms after most
136
+ * recent execution.
137
+ *
138
+ * If `debounceMode` is true (at begin), schedule `clear` to execute
139
+ * after `delay` ms.
140
+ *
141
+ * If `debounceMode` is false (at end), schedule `callback` to
142
+ * execute after `delay` ms.
143
+ */
144
+ timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
145
+ }
146
+ }
147
+ wrapper.cancel = cancel;
148
+
149
+ // Return the wrapper function.
150
+ return wrapper;
151
+ }
152
+
153
+ const postHeaderCss = "*,::before,::after{box-sizing:border-box}:host{--global-header-height:72px;--global-header-minimal-height:24px;--main-header-height:56px;--header-height:calc(var(--global-header-height) + var(--main-header-height))}@media screen and (min-width: 1024px){:host{display:block;position:sticky;inset-inline:0;inset-block-start:calc(-1*(var(--global-header-height) + var(--main-header-height) - var(--global-header-minimal-height)));box-shadow:var(--post-core-elevation-3)}}@media screen and (max-width: 1023.99px){:host{--global-header-height:64px;--main-header-height:48px}}.d-flex{display:flex}.space-between{justify-content:space-between}.global-header{background-color:#fc0;display:flex;justify-content:space-between;align-items:center;position:sticky;padding-inline:var(--post-core-dimension-4);height:var(--global-header-height);z-index:1}@media screen and (max-width: 1023.99px){.global-header{inset-block-start:0}}@media screen and (min-width: 1024px){.global-header{padding-inline-end:var(--post-core-dimension-12);top:calc((var(--global-header-height) - var(--global-header-minimal-height))*-1)}}slot[name=post-logo]{align-self:flex-end}.global-sub{display:flex;align-items:center;gap:var(--post-core-dimension-24);height:var(--global-header-height)}.align-end{align-items:flex-end}.logo{flex:1 0 auto;height:var(--global-header-height);width:var(--global-header-height);min-height:var(--global-header-minimal-height);align-self:flex-end}@media screen and (min-width: 1024px){.logo{height:calc(var(--global-header-height) - var(--header-scroll-top))}}::slotted(ul){margin-block:0;list-style:none;display:flex;padding-left:0;gap:1rem}.title-header{display:flex;align-items:center;gap:var(--post-core-dimension-4);height:var(--main-header-height);background:var(--post-core-color-brand-white)}@media screen and (min-width: 1024px){.title-header{padding:var(--post-core-dimension-18) var(--post-core-dimension-16) var(--post-core-dimension-4) var(--post-core-dimension-12)}}@media screen and (max-width: 1023.99px){.title-header{position:sticky;z-index:1;inset-block-start:var(--global-header-height);padding-inline:var(--post-core-dimension-8) var(--post-core-dimension-16)}}:host(:not(:has([slot=title]))) .title-header{display:none}::slotted(h1){margin:0 !important}@media screen and (min-width: 1024px){::slotted(h1){font-size:var(--post-core-font-size-28) !important}}@media screen and (max-width: 1023.99px){::slotted(h1){font-size:var(--post-core-font-size-20) !important}}@media screen and (min-width: 1024px){.mobile-toggle{display:none}}.navigation{background:var(--post-core-color-brand-white)}@media screen and (min-width: 1024px){.navigation{position:sticky;z-index:1;inset-block-start:var(--global-header-minimal-height)}}@media screen and (max-width: 1023.99px){.navigation{position:fixed;inset-inline:0;inset-block-end:calc(100vh - var(--header-height));box-shadow:var(--post-core-elevation-3);min-height:var(--post-core-dimension-10);max-height:calc(100vh - var(--header-height));overflow:auto}::slotted(post-mainnavigation),.navigation-footer{display:none;flex-direction:column;padding-block:var(--post-core-dimension-16) var(--post-core-dimension-24);padding-inline:var(--post-core-dimension-32)}.navigation.extended ::slotted(post-mainnavigation),.navigation.extended .navigation-footer{display:flex}::slotted(post-mainnavigation){background-color:var(--post-core-color-sandgrey-002);gap:var(--post-core-dimension-32)}.navigation-footer{background-color:var(--post-core-color-sandgrey-006);gap:var(--post-core-dimension-24)}}";
154
+ const PostHeaderStyle0 = postHeaderCss;
155
+
156
+ const PostHeader = class {
157
+ constructor(hostRef) {
158
+ registerInstance(this, hostRef);
159
+ this.scrollParent = null;
160
+ this.throttledScroll = () => this.handleScrollEvent();
161
+ this.throttledResize = throttle(50, () => this.handleResize());
162
+ this.device = null;
163
+ this.mobileMenuExtended = false;
164
+ }
165
+ componentWillRender() {
166
+ this.scrollParent = this.getScrollParent(this.host);
167
+ this.scrollParent.addEventListener('scroll', this.throttledScroll, { passive: true });
168
+ window.addEventListener('resize', this.throttledResize, { passive: true });
169
+ this.handleResize();
170
+ this.handleScrollEvent();
171
+ }
172
+ frozeBody(isMobileMenuExtended) {
173
+ document.body.style.overflow = isMobileMenuExtended ? 'hidden' : '';
174
+ }
175
+ /**
176
+ * Toggles the mobile navigation.
177
+ */
178
+ async toggleMobileMenu() {
179
+ if (this.device === 'desktop')
180
+ return;
181
+ this.mobileMenuAnimation = this.mobileMenuExtended
182
+ ? slideUp(this.mobileMenu)
183
+ : slideDown(this.mobileMenu);
184
+ // Update the state of the toggle button
185
+ const menuButton = this.host.querySelector('post-togglebutton');
186
+ menuButton.toggled = !this.mobileMenuExtended;
187
+ // Toggle menu visibility before it slides down and after it slides back up
188
+ if (this.mobileMenuExtended)
189
+ await this.mobileMenuAnimation.finished;
190
+ this.mobileMenuExtended = !this.mobileMenuExtended;
191
+ if (!this.mobileMenuExtended)
192
+ await this.mobileMenuAnimation.finished;
193
+ }
194
+ handleScrollEvent() {
195
+ // Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
196
+ const st = Math.max(0, this.scrollParent instanceof Document
197
+ ? this.scrollParent.documentElement.scrollTop
198
+ : this.scrollParent.scrollTop);
199
+ this.host.style.setProperty('--header-scroll-top', `${st}px`);
200
+ }
201
+ getScrollParent(node) {
202
+ let currentParent = node.parentElement;
203
+ while (currentParent) {
204
+ if (currentParent.nodeName === 'BODY') {
205
+ return document;
206
+ }
207
+ if (this.isScrollable(currentParent)) {
208
+ return currentParent;
209
+ }
210
+ currentParent = currentParent.parentElement;
211
+ }
212
+ return document;
213
+ }
214
+ isScrollable(node) {
215
+ if (!(node instanceof HTMLElement || node instanceof SVGElement)) {
216
+ return false;
217
+ }
218
+ const style = getComputedStyle(node);
219
+ return ['overflow', 'overflow-x', 'overflow-y'].some(propertyName => {
220
+ const value = style.getPropertyValue(propertyName);
221
+ return value === 'auto' || value === 'scroll';
222
+ });
223
+ }
224
+ handleResize() {
225
+ const previousDevice = this.device;
226
+ let newDevice;
227
+ const width = window === null || window === void 0 ? void 0 : window.innerWidth;
228
+ if (width >= 1024) {
229
+ newDevice = 'desktop';
230
+ }
231
+ else if (width >= 600) {
232
+ newDevice = 'tablet';
233
+ }
234
+ else {
235
+ newDevice = 'mobile';
236
+ }
237
+ // Close any open mobile menu
238
+ if (newDevice === 'desktop' && this.mobileMenuExtended) {
239
+ this.toggleMobileMenu();
240
+ this.mobileMenuAnimation.finish(); // no animation
241
+ }
242
+ // Apply only on change for doing work only when necessary
243
+ if (newDevice !== previousDevice) {
244
+ this.device = newDevice;
245
+ window.requestAnimationFrame(() => {
246
+ this.switchLanguageSwitchMode();
247
+ });
248
+ }
249
+ }
250
+ switchLanguageSwitchMode() {
251
+ var _a;
252
+ const variant = this.device === 'desktop' ? 'dropdown' : 'list';
253
+ (_a = this.host.querySelector('post-language-switch')) === null || _a === void 0 ? void 0 : _a.setAttribute('variant', variant);
254
+ }
255
+ render() {
256
+ const navigationClasses = ['navigation'];
257
+ if (this.mobileMenuExtended) {
258
+ navigationClasses.push('extended');
259
+ }
260
+ return (h(Host, { key: 'd96b46b64946ef425059463d127fa1188c99ea58', version: version }, h("div", { key: '831ebc53d0f598a99e72d46a1530c2c34c196948', class: "global-header" }, h("div", { key: '69f3b3bc47a61810eea3ae60d7b2423af1750416', class: "global-sub" }, h("div", { key: 'ad6d36c7e7f029edfdee223ab1df664a1b7002f8', class: "logo" }, h("slot", { key: '95adfc2ad9e63fde9eef3cc71b63247e140fba3d', name: "post-logo" }))), h("div", { key: '741e62693a4df8558213c85d7a837efb8b0cfa6d', class: "global-sub" }, this.device === 'desktop' && h("slot", { key: '992844b617955cb77079a175fcaaf54943a6eef2', name: "meta-navigation" }), h("slot", { key: '4384ae4c04d239bf1b1947ba6d1457ae6879a5cf', name: "global-controls" }), this.device === 'desktop' && h("slot", { key: 'c5b33b6bfb8c00d44710ec997a80d56720aab760', name: "post-language-switch" }), h("div", { key: '25a629a419c94fc4789eb374b87cf7c159b746c6', onClick: () => this.toggleMobileMenu(), class: "mobile-toggle" }, h("slot", { key: '3f3078832237abc5a6df79b4a57fe20fae926aa3', name: "post-togglebutton" })))), h("div", { key: 'e11ca83bc108d4677e849b7386ad7bd09d8c9331', class: "title-header d-flex space-between align-center" }, h("slot", { key: '87430ad15ab09f800b714be45be00a50e5b7dc0a', name: "title" }), h("div", { key: '494a198d3ee8185a26b16fce97a85bed01d6b3f7', class: "global-sub" }, h("slot", { key: '8a54e3d1366d39c11d64c0de90f35a4330836428', name: "local-controls" }), h("slot", { key: '63f841457e0f7b7722a3f8b1ea83ff0d78d9c08e' }))), h("div", { key: '90cf667c412d90f8e466e7e7925fa4a2f8223ad8', ref: el => (this.mobileMenu = el), class: navigationClasses.join(' ') }, h("slot", { key: 'a046286cb6cc770bfb8fb4439cdacac7c351001b', name: "post-mainnavigation" }), (this.device === 'mobile' || this.device === 'tablet') && (h("div", { key: '6e0ad5841ef53daf0c0885b75efdf12d69f4a72d', class: "navigation-footer" }, h("slot", { key: '1eaebace0d5e37794867ae2a317a104726bb873a', name: "meta-navigation" }), h("slot", { key: '79217cd6fd16d4c6ef3e8aaa656e6dc0a8842b23', name: "post-language-switch" }))))));
261
+ }
262
+ get host() { return getElement(this); }
263
+ static get watchers() { return {
264
+ "mobileMenuExtended": ["frozeBody"]
265
+ }; }
266
+ };
267
+ PostHeader.style = PostHeaderStyle0;
268
+
17
269
  const postIconCss = ":host{container-name:post-icon;container-type:inline-size;display:inline-block;width:1em;height:1em;vertical-align:-0.15em}svg{display:block;width:100%;height:100%;fill:currentColor;forced-color-adjust:preserve-parent-color}@container post-icon (max-width: 23.98px){svg{--pis-16: block}}@container post-icon (min-width: 24px) and (max-width: 31.98px){svg{--pis-24: block}}@container post-icon (min-width: 32px) and (max-width: 39.98px){svg{--pis-32: block}}@container post-icon (min-width: 40px) and (max-width: 47.98px){svg{--pis-40: block}}@container post-icon (min-width: 48px) and (max-width: 63.98px){svg{--pis-48: block}}@container post-icon (min-width: 64px){svg{--pis-64: block}}:host([flip-h]:not([flip-h=false])){scale:-1 1}:host([flip-v]:not([flip-v=false])){scale:1 -1}:host([flip-h][flip-v]:not([flip-h=false],[flip-v=false])){scale:-1}:host([animation]){transform-origin:center}:host([animation=cylon]){animation:icon-animation-cylon .75s ease-in-out infinite alternate}:host([animation=cylon-vertical]){animation:icon-animation-cylon-vertical .75s ease-in-out infinite alternate}:host([animation=spin]){animation:icon-animation-spin 2s linear infinite normal}:host([animation=spin-reverse]){animation:icon-animation-spin 2s linear infinite reverse}:host([animation=fade]){animation:icon-animation-fade .75s ease-in-out infinite alternate}:host([animation=throb]){animation:icon-animation-throb .75s ease-in-out infinite alternate}@keyframes icon-animation-cylon{from{transform:translateX(-25%)}to{transform:translateX(25%)}}@keyframes icon-animation-cylon-vertical{from{transform:translateY(25%)}to{transform:translateY(-25%)}}@keyframes icon-animation-fade{from{opacity:.1}to{opacity:1}}@keyframes icon-animation-spin{from{transform:rotate(0deg)}to{transform:rotate(359deg)}}@keyframes icon-animation-throb{from{opacity:.5;transform:scale(0.5)}to{opacity:1;transform:scale(1)}}";
18
270
  const PostIconStyle0 = postIconCss;
19
271
 
@@ -90,7 +342,7 @@ const PostIcon = class {
90
342
  this.validateAnimation();
91
343
  }
92
344
  render() {
93
- return (h(Host, { key: '1a04eea6f1039329937a9f58d64778c272088018', "data-version": version }, h("svg", { key: '843d95a54a58f839bfa1031d2aa834c70fbc6f9e', style: this.getStyles() }, h("use", { key: 'e93c6a6fd50ebd4757c92c1ee02f9c8cd65a65b7', href: this.getPath() }))));
345
+ return (h(Host, { key: '7864661c5ba45508fa3902c49fd0da1d6c026795', "data-version": version }, h("svg", { key: '588f70bd81afc4cc5a312388aa6225bc9c853b57', style: this.getStyles() }, h("use", { key: 'c4505cf12ddf083ad86b3b9304ffbf37ac3489d1', href: this.getPath() }))));
94
346
  }
95
347
  get host() { return getElement(this); }
96
348
  static get watchers() { return {
@@ -105,59 +357,671 @@ const PostIcon = class {
105
357
  };
106
358
  PostIcon.style = PostIconStyle0;
107
359
 
108
- const postLogoCss = ":host,.logo{display:inline-block}:host,:host .logo>svg,.logo,.logo .logo>svg{height:100%}.description{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}";
109
- const PostLogoStyle0 = postLogoCss;
360
+ const postLanguageOptionCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:inline-block;width:fit-content}button{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button}a{color:inherit;text-decoration:none}:is(a,button){cursor:pointer;display:flex;align-items:center;justify-content:center;height:100%;width:100%;padding:var(--post-language-option-padding)}.post-language-option-list{border-radius:2px;width:40px;height:40px}.post-language-option-list{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.post-language-option-list:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-option-list:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.post-language-option-list:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-option-list:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.post-language-option-list[aria-current=true],.post-language-option-list[aria-current=page]{background-color:#050400;color:#fff}.post-language-option-dropdown{padding-block:13px;padding-inline:24px;box-sizing:border-box;position:relative}.post-language-option-dropdown[aria-current=true]::after,.post-language-option-dropdown[aria-current=page]::after{content:\"\";left:-2px;height:3px;background-color:#504f4b;width:calc(100% + 4px);display:block;position:absolute;bottom:3px}.post-language-option-dropdown[aria-current=true]:focus::after,.post-language-option-dropdown[aria-current=page]:focus::after{width:calc(100% - 5px);left:2px}";
361
+ const PostLanguageOptionStyle0 = postLanguageOptionCss;
110
362
 
111
- const PostLogo = class {
363
+ const PostLanguageOption = class {
112
364
  constructor(hostRef) {
113
365
  registerInstance(this, hostRef);
366
+ this.postChange = createEvent(this, "postChange", 7);
367
+ this.code = undefined;
368
+ this.active = undefined;
369
+ this.variant = undefined;
370
+ this.name = undefined;
114
371
  this.url = undefined;
115
372
  }
116
- validateUrl() {
117
- checkEmptyOrUrl(this.url, 'The "url" property of the post-logo is invalid');
373
+ validateCode(value = this.code) {
374
+ checkType(value, 'string', 'The "code" property of the post-language-option component must be a string.');
375
+ }
376
+ validateActiveProp(value = this.active) {
377
+ checkEmptyOrType(value, 'boolean', 'The "active" property of the post-language-option component must be a boolean value.');
378
+ }
379
+ validateName(value = this.name) {
380
+ checkEmptyOrType(value, 'string', 'The "name" property of the post-language-option component must be a string.');
381
+ }
382
+ validateUrl(value = this.url) {
383
+ checkEmptyOrType(value, 'string', 'The "url" property of the post-language-option component must be a valid URL.');
118
384
  }
119
385
  componentDidLoad() {
386
+ this.validateCode();
387
+ this.validateActiveProp();
388
+ this.validateName();
120
389
  this.validateUrl();
121
- this.checkDescription();
122
- }
123
- checkDescription() {
124
- if (!this.host.textContent) {
125
- console.warn('Be sure to add descriptive text in the post-logo to ensure good accessibility of the component.');
390
+ if (!this.name && this.isNameRequired()) {
391
+ throw new Error('The "name" property of the post-language-option component is required when the full language name is not displayed.');
126
392
  }
127
393
  }
394
+ /**
395
+ * Selects the language option programmatically.
396
+ */
397
+ async select() {
398
+ this.active = true;
399
+ this.emitChange();
400
+ }
401
+ emitChange() {
402
+ this.postChange.emit(this.code);
403
+ }
404
+ isNameRequired() {
405
+ return this.host.textContent.toLowerCase() === this.code.toLowerCase();
406
+ }
128
407
  render() {
129
- const logoLink = this.url && (typeof this.url === 'string' ? this.url : this.url.href);
130
- const LogoTag = logoLink ? 'a' : 'span';
131
- return (h(Host, { key: 'ec5f82baaa08c75a03808a6cda7a9971152a54d6', "data-version": version, slot: "post-logo" }, h(LogoTag, Object.assign({ key: 'ce6aeff4dfab0612376e4c6aa14c74c438213b5d', class: "logo" }, (logoLink ? { href: logoLink } : {})), h("span", { key: 'fa6f8ecaf3c3a4a8e60a8c8e2171dbd25d585ede', class: "description" }, h("slot", { key: '2dcff76129e8e054e58244b2aa77a5b51e059b6b', onSlotchange: () => this.checkDescription() })), h("svg", { key: '468282e3c21fb6cfc97fccee64298abe43542da5', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 72 72", "aria-hidden": "true" }, h("g", { key: 'd3f4e0a6a7372991ccef5be9fad206cab2f553e7', id: "Logo" }, h("rect", { key: '3f17ddd240131ce23faf1e73a76ca4f702b029d7', fill: "#ffcc00", x: "0", y: "0", width: "72", height: "72" }), h("polygon", { key: '1b714023d9e587a57571fd86a9515701ec77f993', fill: "#ff0000", points: "34,32.3 34,19 19.7,19 19.7,29.1 10,29.1 10,42.9 19.7,42.9 19.7,53 34,53 34,39.7 30.6,39.7 30.6,49.8 23.1,49.8 23.1,39.7 13.4,39.7 13.4,32.3 23.1,32.3 23.1,22.2 30.6,22.2 30.6,32.3" }), h("path", { key: 'b4064875cbad1263ac2278613fdf5db8d1697c2a', d: "M53.56234,31.10526c0,2.41272-1.99154,4.29475-4.51723,4.29475H45.2v-8.3h3.84511C51.66802,27.1,53.56234,28.78889,53.56234,31.10526z M50.69666,19H36v34h9.2V42.9h5.49666c6.75131,0,11.9971-5.15137,11.9971-11.8057C62.69376,24.39136,57.35099,19,50.69666,19z" }))))));
408
+ const lang = this.code.toLowerCase();
409
+ return (h(Host, { key: '9a3f49ee993b69393ea8f81b671cd5482049ff1c', "data-version": version, role: "listitem" }, this.url ? (h("a", { class: this.variant ? `post-language-option-${this.variant}` : '', "aria-current": this.active ? 'page' : undefined, "aria-label": this.name, href: this.url, hrefLang: lang, lang: lang, onClick: () => this.emitChange() }, h("slot", null))) : (h("button", { class: this.variant ? `post-language-option-${this.variant}` : '', "aria-current": this.active ? 'true' : undefined, "aria-label": this.name, lang: lang, onClick: () => this.emitChange() }, h("slot", null)))));
132
410
  }
133
411
  get host() { return getElement(this); }
134
412
  static get watchers() { return {
413
+ "code": ["validateCode"],
414
+ "active": ["validateActiveProp"],
415
+ "name": ["validateName"],
135
416
  "url": ["validateUrl"]
136
417
  }; }
137
418
  };
138
- PostLogo.style = PostLogoStyle0;
419
+ PostLanguageOption.style = PostLanguageOptionStyle0;
139
420
 
140
- /**
141
- * Custom positioning reference element.
142
- * @see https://floating-ui.com/docs/virtual-elements
143
- */
421
+ const SWITCH_VARIANTS = ['list', 'dropdown'];
144
422
 
145
- const sides = ['top', 'right', 'bottom', 'left'];
146
- const alignments = ['start', 'end'];
147
- const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
148
- const min = Math.min;
149
- const max = Math.max;
150
- const round = Math.round;
151
- const floor = Math.floor;
152
- const createCoords = v => ({
153
- x: v,
154
- y: v
155
- });
156
- const oppositeSideMap = {
157
- left: 'right',
158
- right: 'left',
159
- bottom: 'top',
160
- top: 'bottom'
423
+ const urlAlphabet =
424
+ 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
425
+
426
+ let nanoid = (size = 21) => {
427
+ let id = '';
428
+ let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)));
429
+ while (size--) {
430
+ id += urlAlphabet[bytes[size] & 63];
431
+ }
432
+ return id
433
+ };
434
+
435
+ const postLanguageSwitchCss = ":host{display:block}.post-language-switch-dropdown-container{display:flex;flex-direction:column}.post-language-switch-trigger{cursor:pointer;padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-decoration:none;display:inline-flex;align-items:center;gap:var(--post-core-dimension-6);border-radius:var(--post-core-dimension-24);font-size:var(--post-core-font-size-16);padding:var(--post-core-dimension-3) var(--post-core-dimension-10)}.post-language-switch-trigger{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.post-language-switch-trigger:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.post-language-switch-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.post-language-switch-trigger:not(:disabled):hover,.post-language-switch-trigger.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}.post-language-switch-trigger post-icon{height:var(--post-core-dimension-16);width:var(--post-core-dimension-16)}";
436
+ const PostLanguageSwitchStyle0 = postLanguageSwitchCss;
437
+
438
+ const PostLanguageSwitch = class {
439
+ constructor(hostRef) {
440
+ registerInstance(this, hostRef);
441
+ this.menuId = `p${nanoid(11)}`;
442
+ this.caption = undefined;
443
+ this.description = undefined;
444
+ this.variant = 'list';
445
+ this.activeLang = undefined;
446
+ }
447
+ validateCaption(value = this.caption) {
448
+ checkType(value, 'string', 'The "caption" property of the post-language-switch component must be a string.');
449
+ }
450
+ validateDescription(value = this.description) {
451
+ checkType(value, 'string', 'The "description" property of the post-language-switch component must be a string.');
452
+ }
453
+ validateVariant(value = this.variant) {
454
+ checkEmptyOrOneOf(value, SWITCH_VARIANTS, `The "variant" property of the post-language-switch component must be: ${SWITCH_VARIANTS.join(', ')}`);
455
+ }
456
+ connectedCallback() {
457
+ this.updateChildrenVariant();
458
+ // Get the active language based on children's active state
459
+ this.activeLang = Array.from(this.host.querySelectorAll('post-language-option'))
460
+ .find(el => el.getAttribute('active') == 'true')
461
+ .getAttribute('code');
462
+ }
463
+ // Update post-language-option variant to have the correct style
464
+ updateChildrenVariant() {
465
+ this.host.querySelectorAll('post-language-option').forEach(el => {
466
+ el.setAttribute('variant', this.variant);
467
+ });
468
+ }
469
+ componentShouldUpdate() {
470
+ this.updateChildrenVariant();
471
+ }
472
+ componentDidLoad() {
473
+ this.validateCaption();
474
+ this.validateDescription();
475
+ this.validateVariant();
476
+ // Detects a change in the active language
477
+ this.host.addEventListener('postChange', (el) => {
478
+ this.activeLang = el.detail;
479
+ // Update the active state in the children post-language-option components
480
+ this.host.querySelectorAll('post-language-option').forEach(lang => {
481
+ if (lang.code && lang.code === this.activeLang) {
482
+ lang.setAttribute('active', 'true');
483
+ }
484
+ else {
485
+ lang.setAttribute('active', 'false');
486
+ }
487
+ });
488
+ // Hides the dropdown when an option has been clicked
489
+ if (this.variant === 'dropdown') {
490
+ const menu = this.host.shadowRoot.querySelector('post-menu');
491
+ menu.toggle(menu);
492
+ }
493
+ });
494
+ }
495
+ renderList() {
496
+ return (h(Host, { "data-version": version, "aria-label": `${this.caption}, ${this.description}`, "aria-role": "list" }, h("slot", null)));
497
+ }
498
+ renderDropdown() {
499
+ return (h(Host, { "data-version": version }, h("post-menu-trigger", { for: this.menuId }, h("button", { class: "post-language-switch-trigger", "aria-label": `${this.caption}, ${this.description}` }, this.activeLang.toUpperCase(), h("post-icon", { "aria-hidden": "true", name: "chevrondown" }))), h("post-menu", { id: this.menuId }, h("div", { class: "post-language-switch-dropdown-container" }, h("slot", null)))));
500
+ }
501
+ render() {
502
+ return this.variant === 'list' ? this.renderList() : this.renderDropdown();
503
+ }
504
+ get host() { return getElement(this); }
505
+ static get watchers() { return {
506
+ "caption": ["validateCaption"],
507
+ "description": ["validateDescription"],
508
+ "variant": ["validateVariant"]
509
+ }; }
510
+ };
511
+ PostLanguageSwitch.style = PostLanguageSwitchStyle0;
512
+
513
+ const postListCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */post-list{display:flex;flex-direction:column;gap:var(--post-list-title-gap, 0)}post-list>[role=list]{display:flex;flex-direction:column;gap:var(--post-list-item-gap, 0)}post-list:where([horizontal]:not([horizontal=false])){flex-direction:row;align-items:center}post-list:where([horizontal]:not([horizontal=false]))>[role=list]{flex-direction:row;align-items:center}post-list>.list-title.visually-hidden{width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}post-list>.list-title.visually-hidden:not(caption){position:absolute !important}";
514
+ const PostListStyle0 = postListCss;
515
+
516
+ const PostList = class {
517
+ constructor(hostRef) {
518
+ registerInstance(this, hostRef);
519
+ this.titleId = undefined;
520
+ this.titleHidden = false;
521
+ this.horizontal = false;
522
+ }
523
+ componentWillLoad() {
524
+ /**
525
+ * Get the id set on the host element or use a random id by default
526
+ */
527
+ this.titleId = `title-${this.host.id || crypto.randomUUID()}`;
528
+ }
529
+ componentDidLoad() {
530
+ this.checkTitle();
531
+ }
532
+ checkTitle() {
533
+ if (!this.titleEl.textContent.trim()) {
534
+ throw new Error('Please provide a title to the list component. Title is mandatory for accessibility purposes.');
535
+ }
536
+ }
537
+ render() {
538
+ return (h(Host, { key: '4f982e717530514589c5528553b70463d678b676', "data-version": version }, h("div", { key: 'cc65ed208f48e7a22482af96fd069d05363f2617', ref: el => (this.titleEl = el), id: this.titleId, class: `list-title${this.titleHidden ? ' visually-hidden' : ''}` }, h("slot", { key: '0f8bbeade50b59e53767ce2169dd57bb79644705' })), h("div", { key: '7fa5de37a169e6f76928c2088c46ee747427887e', role: "list", "aria-labelledby": this.titleId }, h("slot", { key: '86b4d71b83671babb61dd12e842710d67350a09e', name: "post-list-item" }))));
539
+ }
540
+ get host() { return getElement(this); }
541
+ };
542
+ PostList.style = PostListStyle0;
543
+
544
+ const postListItemCss = ":host{display:flex}";
545
+ const PostListItemStyle0 = postListItemCss;
546
+
547
+ const PostListItem = class {
548
+ constructor(hostRef) {
549
+ registerInstance(this, hostRef);
550
+ }
551
+ connectedCallback() {
552
+ this.host.setAttribute('slot', 'post-list-item');
553
+ }
554
+ render() {
555
+ return (h(Host, { key: 'aa9a31c64e3e8ba5dcac1d03b54ab3c886149c1f', role: "listitem", slot: "post-list-item" }, h("slot", { key: '06353140f8917fc5373de6d56708467af2ef52b2' })));
556
+ }
557
+ get host() { return getElement(this); }
558
+ };
559
+ PostListItem.style = PostListItemStyle0;
560
+
561
+ const postLogoCss = ":host,.logo{display:inline-block}:host,:host .logo>svg,.logo,.logo .logo>svg{height:100%}.description{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}";
562
+ const PostLogoStyle0 = postLogoCss;
563
+
564
+ const PostLogo = class {
565
+ constructor(hostRef) {
566
+ registerInstance(this, hostRef);
567
+ this.url = undefined;
568
+ }
569
+ validateUrl() {
570
+ checkEmptyOrUrl(this.url, 'The "url" property of the post-logo is invalid');
571
+ }
572
+ componentDidLoad() {
573
+ this.validateUrl();
574
+ this.checkDescription();
575
+ }
576
+ checkDescription() {
577
+ if (!this.host.textContent) {
578
+ console.warn('Be sure to add descriptive text in the post-logo to ensure good accessibility of the component.');
579
+ }
580
+ }
581
+ render() {
582
+ const logoLink = this.url && (typeof this.url === 'string' ? this.url : this.url.href);
583
+ const LogoTag = logoLink ? 'a' : 'span';
584
+ return (h(Host, { key: 'b8d47e2530eb39f7b05370b4cea0b728cb00a1fb', "data-version": version, slot: "post-logo" }, h(LogoTag, Object.assign({ key: '47a4d88622aab30e652a08827e221dacda36cb48', class: "logo" }, (logoLink ? { href: logoLink } : {})), h("span", { key: '4eb6ad1bc6c165197b6bcce8fe1146eb9d48fb21', class: "description" }, h("slot", { key: 'c66a4385f19711daab6f4ba87d5f78f59ad8b263', onSlotchange: () => this.checkDescription() })), h("svg", { key: '824643e64a3fb0914082f8f78a11753d66c98842', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 72 72", "aria-hidden": "true" }, h("g", { key: 'e4f63d237c1fe1128005f29ea604c865f6b50943', id: "Logo" }, h("rect", { key: '34fec89177fb5461318d3e8fcc725f32dd97057a', fill: "#ffcc00", x: "0", y: "0", width: "72", height: "72" }), h("polygon", { key: '5600de7c21a8e363fffa35710a3f41e4295b76c7', fill: "#ff0000", points: "34,32.3 34,19 19.7,19 19.7,29.1 10,29.1 10,42.9 19.7,42.9 19.7,53 34,53 34,39.7 30.6,39.7 30.6,49.8 23.1,49.8 23.1,39.7 13.4,39.7 13.4,32.3 23.1,32.3 23.1,22.2 30.6,22.2 30.6,32.3" }), h("path", { key: '719be82825355704c4eac3c60fb461f6303734f7', d: "M53.56234,31.10526c0,2.41272-1.99154,4.29475-4.51723,4.29475H45.2v-8.3h3.84511C51.66802,27.1,53.56234,28.78889,53.56234,31.10526z M50.69666,19H36v34h9.2V42.9h5.49666c6.75131,0,11.9971-5.15137,11.9971-11.8057C62.69376,24.39136,57.35099,19,50.69666,19z" }))))));
585
+ }
586
+ get host() { return getElement(this); }
587
+ static get watchers() { return {
588
+ "url": ["validateUrl"]
589
+ }; }
590
+ };
591
+ PostLogo.style = PostLogoStyle0;
592
+
593
+ const postMainnavigationCss = "post-mainnavigation post-list-item>a{text-decoration:none;border-radius:0}post-mainnavigation post-list-item post-megadropdown-trigger button{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-align:start}post-mainnavigation post-list-item post-megadropdown-trigger button{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{display:flex;align-items:center;justify-content:space-between}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{color:var(--post-scheme-color-interactive-primary-hover-fg1)}post-mainnavigation post-list-item>a:focus-visible,post-mainnavigation post-list-item>button:focus-visible,post-mainnavigation post-list-item post-megadropdown-trigger button:focus-visible{border-radius:var(--post-core-dimension-4);z-index:1}@media screen and (min-width: 1024px){post-mainnavigation nav{position:relative;max-width:100vw;max-height:var(--post-core-dimension-56);user-select:none}post-mainnavigation post-list{margin-inline:var(--post-core-dimension-4)}post-mainnavigation post-list>[role=list]{flex-direction:row;max-width:100vw;transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{padding-inline:var(--post-core-dimension-12);height:var(--post-core-dimension-56);gap:var(--post-core-dimension-4);font-size:var(--post-core-font-size-16);border-block:0 solid rgba(0,0,0,0);border-block-end-color:currentColor}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{border-block-width:var(--post-core-dimension-2)}post-mainnavigation post-list-item>a.selected,post-mainnavigation post-list-item>a[aria-expanded=true],post-mainnavigation post-list-item>button.selected,post-mainnavigation post-list-item>button[aria-expanded=true],post-mainnavigation post-list-item post-megadropdown-trigger button.selected,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]{border-block-width:var(--post-core-dimension-4);font-weight:var(--post-core-font-weight-700)}post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{padding-inline-end:var(--post-core-dimension-12);transition:border-block-end-color 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>button::after,post-mainnavigation post-list-item post-megadropdown-trigger button::after{content:\"\";-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m23.6 13.2-7.5 7.6-7.6-7.6.9-.9 6.6 6.6 6.6-6.6z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m23.6 13.2-7.5 7.6-7.6-7.6.9-.9 6.6 6.6 6.6-6.6z'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;height:var(--post-core-dimension-24);width:var(--post-core-dimension-24);transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>button.selected::after,post-mainnavigation post-list-item>button[aria-expanded=true]::after,post-mainnavigation post-list-item post-megadropdown-trigger button.selected::after,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]::after{transform:rotate(180deg)}post-mainnavigation [slot=back-button]{display:none}}@media screen and (max-width: 1023.99px){post-mainnavigation post-list>[role=list]{transform:none !important}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{width:100%;height:var(--post-core-dimension-48);padding-inline-end:var(--post-core-dimension-6);gap:var(--post-core-dimension-16);border-block:var(--post-core-dimension-1) solid rgba(0,0,0,0);border-block-end-color:currentColor;font-weight:var(--post-core-font-weight-700)}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>a.selected,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item>button.selected,post-mainnavigation post-list-item post-megadropdown-trigger button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button.selected{border-block-width:var(--post-core-dimension-3)}post-mainnavigation post-list-item>a:hover::after,post-mainnavigation post-list-item>button:hover::after,post-mainnavigation post-list-item post-megadropdown-trigger button:hover::after{content:\"\";display:block;-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.667 5.333H18.8L29.467 16H0v1.333h29.467L18.8 28h1.867L32 16.667z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.667 5.333H18.8L29.467 16H0v1.333h29.467L18.8 28h1.867L32 16.667z'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;width:var(--post-core-dimension-24);height:var(--post-core-dimension-24)}}";
594
+ const PostMainnavigationStyle0 = postMainnavigationCss;
595
+
596
+ const PostMainnavigation = class {
597
+ constructor(hostRef) {
598
+ registerInstance(this, hostRef);
599
+ this.postToggle = createEvent(this, "postToggle", 7);
600
+ }
601
+ /**
602
+ * Retrieves a reference to the closest 'post-header' element when the main navigation is added to the DOM.
603
+ */
604
+ connectedCallback() {
605
+ this.header = this.host.closest('post-header');
606
+ }
607
+ /**
608
+ * Cleans up references and disconnects the MutationObserver when the main navigation is removed from the DOM.
609
+ */
610
+ disconnectedCallback() {
611
+ this.header = null;
612
+ }
613
+ handleBackButtonClick() {
614
+ if (this.header)
615
+ this.header.toggleMobileMenu();
616
+ }
617
+ render() {
618
+ return (h(Host, { key: 'f21c438ac0bbcb08e08fd419589bf92b7d8b3a61', slot: "post-mainnavigation" }, h("div", { key: '1925f47932d7e842e8b9f059d7ade955c577fa50', onClick: () => this.handleBackButtonClick(), class: "back-button" }, h("slot", { key: 'fe18f6859a6d79c7ae701b65a31be1eab9c8b2ac', name: "back-button" })), h("nav", { key: 'ad2b0a52bc0bcf78a3c3340ba163ee6167be2c73' }, h("slot", { key: '8fc7b01cc0f3729cd2c12c4967ec87891fe0dcf5' }))));
619
+ }
620
+ get host() { return getElement(this); }
621
+ };
622
+ PostMainnavigation.style = PostMainnavigationStyle0;
623
+
624
+ const postMegadropdownCss = "@keyframes slide-in{0%{transform:translateX(100%)}100%{transform:translateX(0%)}}@keyframes slide-out{from{transform:translateX(0%)}to{transform:translateX(100%)}}*,::before,::after{box-sizing:border-box}post-popovercontainer{--post-global-header-height:72px;--post-main-header-height:56px;--post-header-height:calc(var(--post-global-header-height) + var(--post-main-header-height));background-color:#fafafa;border:none;border-top:1px solid #e1e0dc;width:100%;border-radius:0;box-shadow:0 8px 6px rgba(0,0,0,.16)}@media screen and (max-width: 1023.99px){post-popovercontainer{--post-global-header-height:64px;position:absolute;top:var(--post-header-height) !important;bottom:0;left:0;width:100%;height:auto}post-popovercontainer.slide-in{animation:slide-in;animation-duration:350ms;animation-fill-mode:forwards}post-popovercontainer.slide-out{animation:slide-out;animation-duration:350ms;animation-fill-mode:forwards}}.megadropdown{padding:31px 40px 40px}@media screen and (max-width: 1023.99px){.megadropdown{padding:16px 32px 24px}}.megadropdown .megadropdown-content{gap:1.5rem;display:grid;grid-template-columns:repeat(auto-fit, minmax(min(15vw, 100%), 1fr));grid-auto-rows:1fr auto;grid-auto-flow:dense}@media screen and (max-width: 1023.99px){.megadropdown .megadropdown-content{grid-template-columns:repeat(auto-fit, minmax(min(35vw, 100%), 1fr))}}@media screen and (max-width: 599.99px){.megadropdown .megadropdown-content{grid-template-columns:1fr}}.megadropdown h2{display:none;margin-top:0;margin-bottom:8px;font-weight:900}.megadropdown h2 a{text-decoration:none;font-weight:inherit;border-bottom:0;border-top:0}@media screen and (max-width: 1023.99px){.megadropdown h2{display:block;font-size:20px}}.megadropdown a:hover{border-block-width:0}.megadropdown a:hover::after{content:unset}.megadropdown post-list{display:grid;grid-row:span 2;grid-template-rows:subgrid;row-gap:0px}.megadropdown post-list>[role=list]{flex-direction:unset;display:unset}.megadropdown post-list>*{width:100%}.megadropdown post-list .list-title{display:flex;flex-direction:column-reverse;height:100%}.megadropdown post-list .list-title h3{font-size:20px;border-bottom:1px solid #050400;padding:15px 12px 14px 0;display:block;font-weight:900}.megadropdown post-list .list-title h3 a{text-decoration:none;width:100%;font-size:inherit;display:inline-block;font-weight:inherit;height:unset;padding:0;border:0}@media screen and (max-width: 1023.99px){.megadropdown post-list .list-title h3{font-size:16px;padding:12px 12px 11px 0}}.megadropdown post-list-item{border-bottom:1px solid #050400}.megadropdown post-list-item>a{padding:13px 12px 12px 0;display:block;text-decoration:none;width:100%;border-bottom:0;height:auto;border-top:0}@media screen and (max-width: 1023.99px){.megadropdown post-list-item>a{padding:12px 12px 11px 0}}.megadropdown .back-button{display:none;margin-bottom:2rem}.megadropdown .back-button .btn{width:auto}.megadropdown .back-button post-icon{transform:rotate(180deg)}@media screen and (max-width: 1023.99px){.megadropdown .back-button{display:block}}.megadropdown .close-button{position:absolute;top:1rem;right:1rem}@media screen and (max-width: 1023.99px){.megadropdown .close-button{display:none}}";
625
+ const PostMegadropdownStyle0 = postMegadropdownCss;
626
+
627
+ const PostMegadropdown = class {
628
+ constructor(hostRef) {
629
+ registerInstance(this, hostRef);
630
+ this.postToggleMegadropdown = createEvent(this, "postToggleMegadropdown", 7);
631
+ this.isVisible = false;
632
+ this.animationClass = null;
633
+ }
634
+ componentDidLoad() {
635
+ this.popoverRef.addEventListener('postToggle', (event) => {
636
+ this.isVisible = event.detail;
637
+ this.postToggleMegadropdown.emit(this.isVisible);
638
+ });
639
+ this.popoverRef.addEventListener('animationend', () => {
640
+ if (this.animationClass === 'slide-out') {
641
+ this.hide();
642
+ }
643
+ });
644
+ }
645
+ /**
646
+ * Toggles the dropdown visibility based on its current state.
647
+ */
648
+ async toggle(target) {
649
+ this.isVisible ? this.hide() : await this.show(target);
650
+ }
651
+ /**
652
+ * Displays the popover dropdown
653
+ *
654
+ * @param target - The HTML element relative to which the popover dropdown should be displayed.
655
+ */
656
+ async show(target) {
657
+ if (this.popoverRef) {
658
+ await this.popoverRef.show(target);
659
+ this.animationClass = 'slide-in';
660
+ }
661
+ else {
662
+ console.error('show: popoverRef is null or undefined');
663
+ }
664
+ }
665
+ /**
666
+ * Hides the popover dropdown
667
+ */
668
+ hide() {
669
+ if (this.popoverRef) {
670
+ this.popoverRef.hide();
671
+ }
672
+ else {
673
+ console.error('hide: popoverRef is null or undefined');
674
+ }
675
+ }
676
+ handleBackButtonClick() {
677
+ this.animationClass = 'slide-out';
678
+ }
679
+ handleCloseButtonClick() {
680
+ this.popoverRef.hide();
681
+ }
682
+ render() {
683
+ return (h(Host, { key: 'cfd4e6c7bb87c50e471d304a4b4f086266e1c2fe' }, h("post-popovercontainer", { key: '31dc3a5e98a5c60a4db8d47375491a6f3957af0b', class: this.animationClass, placement: "bottom", "edge-gap": "0", ref: el => (this.popoverRef = el) }, h("div", { key: '7001d0e108544a0244af088be0bde49f90a3dea3', class: "megadropdown" }, h("div", { key: '513b0710163e8f58677b6b50d2ba2d241cf9ff35', onClick: () => this.handleBackButtonClick(), class: "back-button" }, h("slot", { key: '5457c0b9bfff045f39f470e600b5aa31036c0807', name: "back-button" })), h("div", { key: 'c3314a4ae4f386224a2db7fe32203f72f6a1b284', onClick: () => this.handleCloseButtonClick(), class: "close-button" }, h("slot", { key: '8feeec24fe5f2522ba1a54ab0b7c682d3a152086', name: "close-button" })), h("slot", { key: '6d9426756a809ed26045c9cd56cacf0f36aa9400', name: "megadropdown-title" }), h("div", { key: 'fd3b0ac7998eec76700ccc6668d8b2e3fcc4c63a', class: "megadropdown-content" }, h("slot", { key: '23638936fdffa224de9631bfd599c0872202a30d' }))))));
684
+ }
685
+ get host() { return getElement(this); }
686
+ };
687
+ PostMegadropdown.style = PostMegadropdownStyle0;
688
+
689
+ const postMegadropdownTriggerCss = "post-megadropdown-trigger{width:100%}";
690
+ const PostMegadropdownTriggerStyle0 = postMegadropdownTriggerCss;
691
+
692
+ const PostMegadropdownTrigger = class {
693
+ constructor(hostRef) {
694
+ registerInstance(this, hostRef);
695
+ /**
696
+ * Reference to the slotted button within the trigger, if present.
697
+ * Used to manage click and key events for mega dropdown control.
698
+ */
699
+ this.slottedButton = null;
700
+ this.for = undefined;
701
+ this.ariaExpanded = false;
702
+ }
703
+ /**
704
+ * Watch for changes to the `for` property to validate its type and ensure it is a string.
705
+ * @param forValue - The new value of the `for` property.
706
+ */
707
+ validateControlFor(forValue = this.for) {
708
+ checkType(forValue, 'string', 'The "for" property is required and should be a string.');
709
+ }
710
+ get megadropdown() {
711
+ const ref = document.getElementById(this.for);
712
+ return ref && ref.localName === 'post-megadropdown'
713
+ ? ref
714
+ : null;
715
+ }
716
+ handleToggle() {
717
+ if (this.megadropdown) {
718
+ this.megadropdown.toggle(this.host);
719
+ }
720
+ else {
721
+ console.warn(`No post-megadropdown found with ID: ${this.for}`);
722
+ }
723
+ }
724
+ componentDidLoad() {
725
+ this.validateControlFor();
726
+ // Check if the mega dropdown attached to the trigger is expanded or not
727
+ document.addEventListener('postToggleMegadropdown', (event) => {
728
+ if (event.target.id === this.for) {
729
+ this.ariaExpanded = event.detail;
730
+ if (this.slottedButton) {
731
+ this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
732
+ }
733
+ }
734
+ });
735
+ this.slottedButton = this.host.querySelector('button');
736
+ if (this.slottedButton) {
737
+ this.slottedButton.setAttribute('aria-haspopup', 'menu');
738
+ this.slottedButton.addEventListener('click', () => {
739
+ this.handleToggle();
740
+ });
741
+ }
742
+ else {
743
+ console.warn('No button found within post-megadropdown-trigger');
744
+ }
745
+ }
746
+ render() {
747
+ return (h(Host, { key: '4ab919adeaa51fc12d45131fa540c76fb3ba73d9', "data-version": version, "tab-index": "-1" }, h("button", { key: 'e7dac321691cdb19a4874fd0b2097227d077af35' }, h("slot", { key: 'beffc38d2d35a67e74364c3b40b6d39896aa4de3' }))));
748
+ }
749
+ get host() { return getElement(this); }
750
+ static get watchers() { return {
751
+ "for": ["validateControlFor"]
752
+ }; }
753
+ };
754
+ PostMegadropdownTrigger.style = PostMegadropdownTriggerStyle0;
755
+
756
+ const focusableSelector = `:where(${[
757
+ 'button',
758
+ 'input:not([type="hidden"])',
759
+ '[tabindex]',
760
+ 'select',
761
+ 'textarea',
762
+ '[contenteditable]',
763
+ 'a[href]',
764
+ 'iframe',
765
+ 'audio[controls]',
766
+ 'video[controls]',
767
+ 'area[href]',
768
+ 'details > summary:first-of-type',
769
+ ].join(',')})`;
770
+ const focusDisablingSelector = `:where(${[
771
+ '[inert]',
772
+ '[inert] *',
773
+ ':disabled',
774
+ 'dialog:not([open]) *',
775
+ '[popover]:not(:popover-open) *',
776
+ 'details:not([open]) > *:not(details > summary:first-of-type)',
777
+ 'details:not([open]) > *:not(details > summary:first-of-type) *',
778
+ ].join(',')})`;
779
+ const isFocusable = (element) => {
780
+ return (element === null || element === void 0 ? void 0 : element.matches(focusableSelector)) && !(element === null || element === void 0 ? void 0 : element.matches(focusDisablingSelector));
781
+ };
782
+
783
+ const postMenuCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:block}post-popovercontainer{padding:var(--post-menu-padding);background-color:var(--post-menu-bg, #ffffff);border-color:var(--post-menu-bg, #ffffff)}";
784
+ const PostMenuStyle0 = postMenuCss;
785
+
786
+ const PostMenu = class {
787
+ constructor(hostRef) {
788
+ registerInstance(this, hostRef);
789
+ this.toggleMenu = createEvent(this, "toggleMenu", 7);
790
+ this.lastFocusedElement = null;
791
+ this.KEYCODES = {
792
+ SPACE: ' ',
793
+ ENTER: 'Enter',
794
+ UP: 'ArrowUp',
795
+ DOWN: 'ArrowDown',
796
+ TAB: 'Tab',
797
+ HOME: 'Home',
798
+ END: 'End',
799
+ ESCAPE: 'Escape',
800
+ };
801
+ this.handleKeyDown = (e) => {
802
+ e.stopPropagation();
803
+ if (e.key === this.KEYCODES.ESCAPE) {
804
+ this.toggle(this.host);
805
+ return;
806
+ }
807
+ if (Object.values(this.KEYCODES).includes(e.key)) {
808
+ this.controlKeyDownHandler(e);
809
+ }
810
+ };
811
+ this.handleClick = (e) => {
812
+ const target = e.target;
813
+ if (['BUTTON', 'A', 'INPUT', 'SELECT', 'TEXTAREA'].includes(target.tagName)) {
814
+ this.toggle(this.host);
815
+ }
816
+ };
817
+ this.placement = 'bottom';
818
+ this.isVisible = false;
819
+ }
820
+ connectedCallback() {
821
+ this.root = getRoot(this.host);
822
+ this.host.addEventListener('keydown', this.handleKeyDown);
823
+ this.host.addEventListener('click', this.handleClick);
824
+ }
825
+ disconnectedCallback() {
826
+ this.host.removeEventListener('keydown', this.handleKeyDown);
827
+ this.host.removeEventListener('click', this.handleClick);
828
+ }
829
+ componentDidLoad() {
830
+ this.popoverRef.addEventListener('postToggle', (event) => {
831
+ this.isVisible = event.detail;
832
+ this.toggleMenu.emit(this.isVisible);
833
+ });
834
+ }
835
+ /**
836
+ * Toggles the menu visibility based on its current state.
837
+ */
838
+ async toggle(target) {
839
+ this.isVisible ? await this.hide() : await this.show(target);
840
+ }
841
+ /**
842
+ * Displays the popover menu, focusing the first menu item.
843
+ *
844
+ * @param target - The HTML element relative to which the popover menu should be displayed.
845
+ */
846
+ async show(target) {
847
+ if (this.popoverRef) {
848
+ await this.popoverRef.show(target);
849
+ this.lastFocusedElement = this.root.activeElement; // Use root's activeElement
850
+ const menuItems = this.getSlottedItems();
851
+ if (menuItems.length > 0) {
852
+ menuItems[0].focus();
853
+ }
854
+ }
855
+ else {
856
+ console.error('show: popoverRef is null or undefined');
857
+ }
858
+ }
859
+ /**
860
+ * Hides the popover menu and restores focus to the previously focused element.
861
+ */
862
+ async hide() {
863
+ if (this.popoverRef) {
864
+ await this.popoverRef.hide();
865
+ if (this.lastFocusedElement) {
866
+ this.lastFocusedElement.focus();
867
+ }
868
+ }
869
+ else {
870
+ console.error('hide: popoverRef is null or undefined');
871
+ }
872
+ }
873
+ controlKeyDownHandler(e) {
874
+ const menuItems = this.getSlottedItems();
875
+ if (!menuItems.length) {
876
+ return;
877
+ }
878
+ const currentFocusedElement = this.root.activeElement; // Use root's activeElement
879
+ let currentIndex = menuItems.findIndex(el => el === currentFocusedElement);
880
+ switch (e.key) {
881
+ case this.KEYCODES.UP:
882
+ e.preventDefault();
883
+ currentIndex = (currentIndex - 1 + menuItems.length) % menuItems.length;
884
+ break;
885
+ case this.KEYCODES.DOWN:
886
+ e.preventDefault();
887
+ currentIndex = (currentIndex + 1) % menuItems.length;
888
+ break;
889
+ case this.KEYCODES.HOME:
890
+ currentIndex = 0;
891
+ break;
892
+ case this.KEYCODES.END:
893
+ currentIndex = menuItems.length - 1;
894
+ break;
895
+ case this.KEYCODES.SPACE:
896
+ case this.KEYCODES.ENTER:
897
+ this.toggle(this.host);
898
+ return;
899
+ case this.KEYCODES.TAB:
900
+ this.toggle(this.host);
901
+ break;
902
+ }
903
+ if (menuItems[currentIndex]) {
904
+ menuItems[currentIndex].focus();
905
+ }
906
+ }
907
+ getSlottedItems() {
908
+ const slot = this.host.shadowRoot.querySelector('slot');
909
+ const slottedElements = slot ? slot.assignedElements() : [];
910
+ const menuItems = slottedElements
911
+ .filter(el => el.tagName === 'POST-MENU-ITEM')
912
+ .map(el => {
913
+ const slot = el.shadowRoot.querySelector('slot');
914
+ const assignedElements = slot ? slot.assignedElements() : [];
915
+ return assignedElements.filter(isFocusable);
916
+ })
917
+ .flat();
918
+ return menuItems;
919
+ }
920
+ render() {
921
+ return (h(Host, { key: '48e04f36dc7a3d8ed81b9570d1a4c931ace3cadd', "data-version": version }, h("post-popovercontainer", { key: '58532143bd7a8be7ea77cbd0a929fa74ee0ee890', placement: this.placement, ref: e => (this.popoverRef = e) }, h("div", { key: '967bf8aa936611ac6d533d9a8a1e176ee84b2a73', class: "popover-container", part: "popover-container" }, h("slot", { key: '4eb6b7fe34e8ea1df0d7cd8de31b57452442c3bb' })))));
922
+ }
923
+ get host() { return getElement(this); }
924
+ };
925
+ PostMenu.style = PostMenuStyle0;
926
+
927
+ const postMenuTriggerCss = ":host{display:inline-block}";
928
+ const PostMenuTriggerStyle0 = postMenuTriggerCss;
929
+
930
+ const PostMenuTrigger = class {
931
+ constructor(hostRef) {
932
+ registerInstance(this, hostRef);
933
+ /**
934
+ * Reference to the slotted button within the trigger, if present.
935
+ * Used to manage click and key events for menu control.
936
+ */
937
+ this.slottedButton = null;
938
+ this.handleKeyDown = (e) => {
939
+ if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
940
+ e.preventDefault();
941
+ this.handleToggle();
942
+ }
943
+ };
944
+ this.for = undefined;
945
+ this.ariaExpanded = false;
946
+ }
947
+ /**
948
+ * Watch for changes to the `for` property to validate its type and ensure it is a string.
949
+ * @param forValue - The new value of the `for` property.
950
+ */
951
+ validateControlFor(forValue = this.for) {
952
+ checkType(forValue, 'string', 'The "for" property is required and should be a string.');
953
+ }
954
+ get menu() {
955
+ const ref = this.root.getElementById(this.for);
956
+ return ref && ref.localName === 'post-menu' ? ref : null;
957
+ }
958
+ handleToggle() {
959
+ const menu = this.menu;
960
+ if (menu && this.slottedButton) {
961
+ this.ariaExpanded = !this.ariaExpanded;
962
+ this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
963
+ menu.toggle(this.host);
964
+ }
965
+ else {
966
+ console.warn(`No post-menu found with ID: ${this.for}`);
967
+ }
968
+ }
969
+ componentDidLoad() {
970
+ this.root = getRoot(this.host);
971
+ this.validateControlFor();
972
+ this.slottedButton = this.host.querySelector('button');
973
+ // Check if the slottedButton is within a web component
974
+ if (!this.slottedButton) {
975
+ const webComponent = this.host.querySelector('.menu-trigger-webc');
976
+ if (webComponent.shadowRoot) {
977
+ const slottedButton = webComponent.shadowRoot.querySelector('button');
978
+ if (slottedButton) {
979
+ this.slottedButton = slottedButton;
980
+ }
981
+ }
982
+ }
983
+ if (this.slottedButton) {
984
+ this.slottedButton.setAttribute('aria-haspopup', 'menu');
985
+ this.slottedButton.addEventListener('click', () => {
986
+ this.handleToggle();
987
+ });
988
+ this.slottedButton.addEventListener('keydown', this.handleKeyDown);
989
+ }
990
+ else {
991
+ console.warn('No button found within post-menu-trigger');
992
+ }
993
+ }
994
+ render() {
995
+ return (h(Host, { key: '64e9e7e6448160c7b52fc732b5107e94e9776678', "data-version": version, "tab-index": "-1" }, h("slot", { key: '711d641147cec0c26c7a3917f9302f1bbbee0d73' })));
996
+ }
997
+ get host() { return getElement(this); }
998
+ static get watchers() { return {
999
+ "for": ["validateControlFor"]
1000
+ }; }
1001
+ };
1002
+ PostMenuTrigger.style = PostMenuTriggerStyle0;
1003
+
1004
+ /**
1005
+ * Custom positioning reference element.
1006
+ * @see https://floating-ui.com/docs/virtual-elements
1007
+ */
1008
+
1009
+ const sides = ['top', 'right', 'bottom', 'left'];
1010
+ const alignments = ['start', 'end'];
1011
+ const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
1012
+ const min = Math.min;
1013
+ const max = Math.max;
1014
+ const round = Math.round;
1015
+ const floor = Math.floor;
1016
+ const createCoords = v => ({
1017
+ x: v,
1018
+ y: v
1019
+ });
1020
+ const oppositeSideMap = {
1021
+ left: 'right',
1022
+ right: 'left',
1023
+ bottom: 'top',
1024
+ top: 'bottom'
161
1025
  };
162
1026
  const oppositeAlignmentMap = {
163
1027
  start: 'end',
@@ -1334,1340 +2198,1026 @@ function isOverflowElement(element) {
1334
2198
  } = getComputedStyle$1(element);
1335
2199
  return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
1336
2200
  }
1337
- function isTableElement(element) {
1338
- return ['table', 'td', 'th'].includes(getNodeName(element));
1339
- }
1340
- function isTopLayer(element) {
1341
- return [':popover-open', ':modal'].some(selector => {
1342
- try {
1343
- return element.matches(selector);
1344
- } catch (e) {
1345
- return false;
1346
- }
1347
- });
1348
- }
1349
- function isContainingBlock(elementOrCss) {
1350
- const webkit = isWebKit();
1351
- const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
1352
-
1353
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1354
- return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
1355
- }
1356
- function getContainingBlock(element) {
1357
- let currentNode = getParentNode(element);
1358
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1359
- if (isContainingBlock(currentNode)) {
1360
- return currentNode;
1361
- } else if (isTopLayer(currentNode)) {
1362
- return null;
1363
- }
1364
- currentNode = getParentNode(currentNode);
1365
- }
1366
- return null;
1367
- }
1368
- function isWebKit() {
1369
- if (typeof CSS === 'undefined' || !CSS.supports) return false;
1370
- return CSS.supports('-webkit-backdrop-filter', 'none');
1371
- }
1372
- function isLastTraversableNode(node) {
1373
- return ['html', 'body', '#document'].includes(getNodeName(node));
1374
- }
1375
- function getComputedStyle$1(element) {
1376
- return getWindow(element).getComputedStyle(element);
1377
- }
1378
- function getNodeScroll(element) {
1379
- if (isElement(element)) {
1380
- return {
1381
- scrollLeft: element.scrollLeft,
1382
- scrollTop: element.scrollTop
1383
- };
1384
- }
1385
- return {
1386
- scrollLeft: element.scrollX,
1387
- scrollTop: element.scrollY
1388
- };
1389
- }
1390
- function getParentNode(node) {
1391
- if (getNodeName(node) === 'html') {
1392
- return node;
1393
- }
1394
- const result =
1395
- // Step into the shadow DOM of the parent of a slotted node.
1396
- node.assignedSlot ||
1397
- // DOM Element detected.
1398
- node.parentNode ||
1399
- // ShadowRoot detected.
1400
- isShadowRoot(node) && node.host ||
1401
- // Fallback.
1402
- getDocumentElement(node);
1403
- return isShadowRoot(result) ? result.host : result;
1404
- }
1405
- function getNearestOverflowAncestor(node) {
1406
- const parentNode = getParentNode(node);
1407
- if (isLastTraversableNode(parentNode)) {
1408
- return node.ownerDocument ? node.ownerDocument.body : node.body;
1409
- }
1410
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1411
- return parentNode;
1412
- }
1413
- return getNearestOverflowAncestor(parentNode);
1414
- }
1415
- function getOverflowAncestors(node, list, traverseIframes) {
1416
- var _node$ownerDocument2;
1417
- if (list === void 0) {
1418
- list = [];
1419
- }
1420
- if (traverseIframes === void 0) {
1421
- traverseIframes = true;
1422
- }
1423
- const scrollableAncestor = getNearestOverflowAncestor(node);
1424
- const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1425
- const win = getWindow(scrollableAncestor);
1426
- if (isBody) {
1427
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
1428
- }
1429
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1430
- }
1431
-
1432
- function getCssDimensions(element) {
1433
- const css = getComputedStyle$1(element);
1434
- // In testing environments, the `width` and `height` properties are empty
1435
- // strings for SVG elements, returning NaN. Fallback to `0` in this case.
1436
- let width = parseFloat(css.width) || 0;
1437
- let height = parseFloat(css.height) || 0;
1438
- const hasOffset = isHTMLElement(element);
1439
- const offsetWidth = hasOffset ? element.offsetWidth : width;
1440
- const offsetHeight = hasOffset ? element.offsetHeight : height;
1441
- const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1442
- if (shouldFallback) {
1443
- width = offsetWidth;
1444
- height = offsetHeight;
1445
- }
1446
- return {
1447
- width,
1448
- height,
1449
- $: shouldFallback
1450
- };
1451
- }
1452
-
1453
- function unwrapElement(element) {
1454
- return !isElement(element) ? element.contextElement : element;
1455
- }
1456
-
1457
- function getScale(element) {
1458
- const domElement = unwrapElement(element);
1459
- if (!isHTMLElement(domElement)) {
1460
- return createCoords(1);
1461
- }
1462
- const rect = domElement.getBoundingClientRect();
1463
- const {
1464
- width,
1465
- height,
1466
- $
1467
- } = getCssDimensions(domElement);
1468
- let x = ($ ? round(rect.width) : rect.width) / width;
1469
- let y = ($ ? round(rect.height) : rect.height) / height;
1470
-
1471
- // 0, NaN, or Infinity should always fallback to 1.
1472
-
1473
- if (!x || !Number.isFinite(x)) {
1474
- x = 1;
1475
- }
1476
- if (!y || !Number.isFinite(y)) {
1477
- y = 1;
1478
- }
1479
- return {
1480
- x,
1481
- y
1482
- };
1483
- }
1484
-
1485
- const noOffsets = /*#__PURE__*/createCoords(0);
1486
- function getVisualOffsets(element) {
1487
- const win = getWindow(element);
1488
- if (!isWebKit() || !win.visualViewport) {
1489
- return noOffsets;
1490
- }
1491
- return {
1492
- x: win.visualViewport.offsetLeft,
1493
- y: win.visualViewport.offsetTop
1494
- };
1495
- }
1496
- function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1497
- if (isFixed === void 0) {
1498
- isFixed = false;
1499
- }
1500
- if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1501
- return false;
1502
- }
1503
- return isFixed;
1504
- }
1505
-
1506
- function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1507
- if (includeScale === void 0) {
1508
- includeScale = false;
1509
- }
1510
- if (isFixedStrategy === void 0) {
1511
- isFixedStrategy = false;
1512
- }
1513
- const clientRect = element.getBoundingClientRect();
1514
- const domElement = unwrapElement(element);
1515
- let scale = createCoords(1);
1516
- if (includeScale) {
1517
- if (offsetParent) {
1518
- if (isElement(offsetParent)) {
1519
- scale = getScale(offsetParent);
1520
- }
1521
- } else {
1522
- scale = getScale(element);
1523
- }
1524
- }
1525
- const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1526
- let x = (clientRect.left + visualOffsets.x) / scale.x;
1527
- let y = (clientRect.top + visualOffsets.y) / scale.y;
1528
- let width = clientRect.width / scale.x;
1529
- let height = clientRect.height / scale.y;
1530
- if (domElement) {
1531
- const win = getWindow(domElement);
1532
- const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1533
- let currentWin = win;
1534
- let currentIFrame = currentWin.frameElement;
1535
- while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1536
- const iframeScale = getScale(currentIFrame);
1537
- const iframeRect = currentIFrame.getBoundingClientRect();
1538
- const css = getComputedStyle$1(currentIFrame);
1539
- const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1540
- const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1541
- x *= iframeScale.x;
1542
- y *= iframeScale.y;
1543
- width *= iframeScale.x;
1544
- height *= iframeScale.y;
1545
- x += left;
1546
- y += top;
1547
- currentWin = getWindow(currentIFrame);
1548
- currentIFrame = currentWin.frameElement;
2201
+ function isTableElement(element) {
2202
+ return ['table', 'td', 'th'].includes(getNodeName(element));
2203
+ }
2204
+ function isTopLayer(element) {
2205
+ return [':popover-open', ':modal'].some(selector => {
2206
+ try {
2207
+ return element.matches(selector);
2208
+ } catch (e) {
2209
+ return false;
1549
2210
  }
1550
- }
1551
- return rectToClientRect({
1552
- width,
1553
- height,
1554
- x,
1555
- y
1556
2211
  });
1557
2212
  }
2213
+ function isContainingBlock(elementOrCss) {
2214
+ const webkit = isWebKit();
2215
+ const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
1558
2216
 
1559
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1560
- let {
1561
- elements,
1562
- rect,
1563
- offsetParent,
1564
- strategy
1565
- } = _ref;
1566
- const isFixed = strategy === 'fixed';
1567
- const documentElement = getDocumentElement(offsetParent);
1568
- const topLayer = elements ? isTopLayer(elements.floating) : false;
1569
- if (offsetParent === documentElement || topLayer && isFixed) {
1570
- return rect;
1571
- }
1572
- let scroll = {
1573
- scrollLeft: 0,
1574
- scrollTop: 0
1575
- };
1576
- let scale = createCoords(1);
1577
- const offsets = createCoords(0);
1578
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1579
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1580
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1581
- scroll = getNodeScroll(offsetParent);
1582
- }
1583
- if (isHTMLElement(offsetParent)) {
1584
- const offsetRect = getBoundingClientRect(offsetParent);
1585
- scale = getScale(offsetParent);
1586
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1587
- offsets.y = offsetRect.y + offsetParent.clientTop;
2217
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
2218
+ return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
2219
+ }
2220
+ function getContainingBlock(element) {
2221
+ let currentNode = getParentNode(element);
2222
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
2223
+ if (isContainingBlock(currentNode)) {
2224
+ return currentNode;
2225
+ } else if (isTopLayer(currentNode)) {
2226
+ return null;
1588
2227
  }
2228
+ currentNode = getParentNode(currentNode);
1589
2229
  }
1590
- return {
1591
- width: rect.width * scale.x,
1592
- height: rect.height * scale.y,
1593
- x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
1594
- y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
1595
- };
2230
+ return null;
1596
2231
  }
1597
-
1598
- function getClientRects(element) {
1599
- return Array.from(element.getClientRects());
2232
+ function isWebKit() {
2233
+ if (typeof CSS === 'undefined' || !CSS.supports) return false;
2234
+ return CSS.supports('-webkit-backdrop-filter', 'none');
1600
2235
  }
1601
-
1602
- function getWindowScrollBarX(element) {
1603
- // If <html> has a CSS width greater than the viewport, then this will be
1604
- // incorrect for RTL.
1605
- return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
2236
+ function isLastTraversableNode(node) {
2237
+ return ['html', 'body', '#document'].includes(getNodeName(node));
1606
2238
  }
1607
-
1608
- // Gets the entire size of the scrollable document area, even extending outside
1609
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1610
- function getDocumentRect(element) {
1611
- const html = getDocumentElement(element);
1612
- const scroll = getNodeScroll(element);
1613
- const body = element.ownerDocument.body;
1614
- const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1615
- const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1616
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1617
- const y = -scroll.scrollTop;
1618
- if (getComputedStyle$1(body).direction === 'rtl') {
1619
- x += max(html.clientWidth, body.clientWidth) - width;
1620
- }
1621
- return {
1622
- width,
1623
- height,
1624
- x,
1625
- y
1626
- };
2239
+ function getComputedStyle$1(element) {
2240
+ return getWindow(element).getComputedStyle(element);
1627
2241
  }
1628
-
1629
- function getViewportRect(element, strategy) {
1630
- const win = getWindow(element);
1631
- const html = getDocumentElement(element);
1632
- const visualViewport = win.visualViewport;
1633
- let width = html.clientWidth;
1634
- let height = html.clientHeight;
1635
- let x = 0;
1636
- let y = 0;
1637
- if (visualViewport) {
1638
- width = visualViewport.width;
1639
- height = visualViewport.height;
1640
- const visualViewportBased = isWebKit();
1641
- if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1642
- x = visualViewport.offsetLeft;
1643
- y = visualViewport.offsetTop;
1644
- }
2242
+ function getNodeScroll(element) {
2243
+ if (isElement(element)) {
2244
+ return {
2245
+ scrollLeft: element.scrollLeft,
2246
+ scrollTop: element.scrollTop
2247
+ };
1645
2248
  }
1646
2249
  return {
1647
- width,
1648
- height,
1649
- x,
1650
- y
1651
- };
1652
- }
1653
-
1654
- // Returns the inner client rect, subtracting scrollbars if present.
1655
- function getInnerBoundingClientRect(element, strategy) {
1656
- const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1657
- const top = clientRect.top + element.clientTop;
1658
- const left = clientRect.left + element.clientLeft;
1659
- const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1660
- const width = element.clientWidth * scale.x;
1661
- const height = element.clientHeight * scale.y;
1662
- const x = left * scale.x;
1663
- const y = top * scale.y;
1664
- return {
1665
- width,
1666
- height,
1667
- x,
1668
- y
2250
+ scrollLeft: element.scrollX,
2251
+ scrollTop: element.scrollY
1669
2252
  };
1670
2253
  }
1671
- function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1672
- let rect;
1673
- if (clippingAncestor === 'viewport') {
1674
- rect = getViewportRect(element, strategy);
1675
- } else if (clippingAncestor === 'document') {
1676
- rect = getDocumentRect(getDocumentElement(element));
1677
- } else if (isElement(clippingAncestor)) {
1678
- rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1679
- } else {
1680
- const visualOffsets = getVisualOffsets(element);
1681
- rect = {
1682
- ...clippingAncestor,
1683
- x: clippingAncestor.x - visualOffsets.x,
1684
- y: clippingAncestor.y - visualOffsets.y
1685
- };
2254
+ function getParentNode(node) {
2255
+ if (getNodeName(node) === 'html') {
2256
+ return node;
1686
2257
  }
1687
- return rectToClientRect(rect);
2258
+ const result =
2259
+ // Step into the shadow DOM of the parent of a slotted node.
2260
+ node.assignedSlot ||
2261
+ // DOM Element detected.
2262
+ node.parentNode ||
2263
+ // ShadowRoot detected.
2264
+ isShadowRoot(node) && node.host ||
2265
+ // Fallback.
2266
+ getDocumentElement(node);
2267
+ return isShadowRoot(result) ? result.host : result;
1688
2268
  }
1689
- function hasFixedPositionAncestor(element, stopNode) {
1690
- const parentNode = getParentNode(element);
1691
- if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1692
- return false;
2269
+ function getNearestOverflowAncestor(node) {
2270
+ const parentNode = getParentNode(node);
2271
+ if (isLastTraversableNode(parentNode)) {
2272
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
1693
2273
  }
1694
- return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
2274
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
2275
+ return parentNode;
2276
+ }
2277
+ return getNearestOverflowAncestor(parentNode);
1695
2278
  }
1696
-
1697
- // A "clipping ancestor" is an `overflow` element with the characteristic of
1698
- // clipping (or hiding) child elements. This returns all clipping ancestors
1699
- // of the given element up the tree.
1700
- function getClippingElementAncestors(element, cache) {
1701
- const cachedResult = cache.get(element);
1702
- if (cachedResult) {
1703
- return cachedResult;
2279
+ function getOverflowAncestors(node, list, traverseIframes) {
2280
+ var _node$ownerDocument2;
2281
+ if (list === void 0) {
2282
+ list = [];
1704
2283
  }
1705
- let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1706
- let currentContainingBlockComputedStyle = null;
1707
- const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
1708
- let currentNode = elementIsFixed ? getParentNode(element) : element;
1709
-
1710
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1711
- while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1712
- const computedStyle = getComputedStyle$1(currentNode);
1713
- const currentNodeIsContaining = isContainingBlock(currentNode);
1714
- if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1715
- currentContainingBlockComputedStyle = null;
1716
- }
1717
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1718
- if (shouldDropCurrentNode) {
1719
- // Drop non-containing blocks.
1720
- result = result.filter(ancestor => ancestor !== currentNode);
1721
- } else {
1722
- // Record last containing block for next iteration.
1723
- currentContainingBlockComputedStyle = computedStyle;
1724
- }
1725
- currentNode = getParentNode(currentNode);
2284
+ if (traverseIframes === void 0) {
2285
+ traverseIframes = true;
1726
2286
  }
1727
- cache.set(element, result);
1728
- return result;
1729
- }
1730
-
1731
- // Gets the maximum area that the element is visible in due to any number of
1732
- // clipping ancestors.
1733
- function getClippingRect(_ref) {
1734
- let {
1735
- element,
1736
- boundary,
1737
- rootBoundary,
1738
- strategy
1739
- } = _ref;
1740
- const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1741
- const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1742
- const firstClippingAncestor = clippingAncestors[0];
1743
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1744
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1745
- accRect.top = max(rect.top, accRect.top);
1746
- accRect.right = min(rect.right, accRect.right);
1747
- accRect.bottom = min(rect.bottom, accRect.bottom);
1748
- accRect.left = max(rect.left, accRect.left);
1749
- return accRect;
1750
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1751
- return {
1752
- width: clippingRect.right - clippingRect.left,
1753
- height: clippingRect.bottom - clippingRect.top,
1754
- x: clippingRect.left,
1755
- y: clippingRect.top
1756
- };
2287
+ const scrollableAncestor = getNearestOverflowAncestor(node);
2288
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
2289
+ const win = getWindow(scrollableAncestor);
2290
+ if (isBody) {
2291
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
2292
+ }
2293
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1757
2294
  }
1758
2295
 
1759
- function getDimensions(element) {
1760
- const {
1761
- width,
1762
- height
1763
- } = getCssDimensions(element);
2296
+ function getCssDimensions(element) {
2297
+ const css = getComputedStyle$1(element);
2298
+ // In testing environments, the `width` and `height` properties are empty
2299
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
2300
+ let width = parseFloat(css.width) || 0;
2301
+ let height = parseFloat(css.height) || 0;
2302
+ const hasOffset = isHTMLElement(element);
2303
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
2304
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
2305
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
2306
+ if (shouldFallback) {
2307
+ width = offsetWidth;
2308
+ height = offsetHeight;
2309
+ }
1764
2310
  return {
1765
2311
  width,
1766
- height
2312
+ height,
2313
+ $: shouldFallback
1767
2314
  };
1768
2315
  }
1769
2316
 
1770
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1771
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1772
- const documentElement = getDocumentElement(offsetParent);
1773
- const isFixed = strategy === 'fixed';
1774
- const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1775
- let scroll = {
1776
- scrollLeft: 0,
1777
- scrollTop: 0
1778
- };
1779
- const offsets = createCoords(0);
1780
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1781
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1782
- scroll = getNodeScroll(offsetParent);
1783
- }
1784
- if (isOffsetParentAnElement) {
1785
- const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1786
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1787
- offsets.y = offsetRect.y + offsetParent.clientTop;
1788
- } else if (documentElement) {
1789
- offsets.x = getWindowScrollBarX(documentElement);
1790
- }
1791
- }
1792
- const x = rect.left + scroll.scrollLeft - offsets.x;
1793
- const y = rect.top + scroll.scrollTop - offsets.y;
1794
- return {
1795
- x,
1796
- y,
1797
- width: rect.width,
1798
- height: rect.height
1799
- };
2317
+ function unwrapElement(element) {
2318
+ return !isElement(element) ? element.contextElement : element;
1800
2319
  }
1801
2320
 
1802
- function isStaticPositioned(element) {
1803
- return getComputedStyle$1(element).position === 'static';
1804
- }
2321
+ function getScale(element) {
2322
+ const domElement = unwrapElement(element);
2323
+ if (!isHTMLElement(domElement)) {
2324
+ return createCoords(1);
2325
+ }
2326
+ const rect = domElement.getBoundingClientRect();
2327
+ const {
2328
+ width,
2329
+ height,
2330
+ $
2331
+ } = getCssDimensions(domElement);
2332
+ let x = ($ ? round(rect.width) : rect.width) / width;
2333
+ let y = ($ ? round(rect.height) : rect.height) / height;
1805
2334
 
1806
- function getTrueOffsetParent(element, polyfill) {
1807
- if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
1808
- return null;
2335
+ // 0, NaN, or Infinity should always fallback to 1.
2336
+
2337
+ if (!x || !Number.isFinite(x)) {
2338
+ x = 1;
1809
2339
  }
1810
- if (polyfill) {
1811
- return polyfill(element);
2340
+ if (!y || !Number.isFinite(y)) {
2341
+ y = 1;
1812
2342
  }
1813
- return element.offsetParent;
2343
+ return {
2344
+ x,
2345
+ y
2346
+ };
1814
2347
  }
1815
2348
 
1816
- // Gets the closest ancestor positioned element. Handles some edge cases,
1817
- // such as table ancestors and cross browser bugs.
1818
- function getOffsetParent(element, polyfill) {
2349
+ const noOffsets = /*#__PURE__*/createCoords(0);
2350
+ function getVisualOffsets(element) {
1819
2351
  const win = getWindow(element);
1820
- if (isTopLayer(element)) {
1821
- return win;
1822
- }
1823
- if (!isHTMLElement(element)) {
1824
- let svgOffsetParent = getParentNode(element);
1825
- while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1826
- if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1827
- return svgOffsetParent;
1828
- }
1829
- svgOffsetParent = getParentNode(svgOffsetParent);
1830
- }
1831
- return win;
1832
- }
1833
- let offsetParent = getTrueOffsetParent(element, polyfill);
1834
- while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1835
- offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1836
- }
1837
- if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1838
- return win;
2352
+ if (!isWebKit() || !win.visualViewport) {
2353
+ return noOffsets;
1839
2354
  }
1840
- return offsetParent || getContainingBlock(element) || win;
1841
- }
1842
-
1843
- const getElementRects = async function (data) {
1844
- const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1845
- const getDimensionsFn = this.getDimensions;
1846
- const floatingDimensions = await getDimensionsFn(data.floating);
1847
2355
  return {
1848
- reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1849
- floating: {
1850
- x: 0,
1851
- y: 0,
1852
- width: floatingDimensions.width,
1853
- height: floatingDimensions.height
1854
- }
2356
+ x: win.visualViewport.offsetLeft,
2357
+ y: win.visualViewport.offsetTop
1855
2358
  };
1856
- };
1857
-
1858
- function isRTL(element) {
1859
- return getComputedStyle$1(element).direction === 'rtl';
2359
+ }
2360
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
2361
+ if (isFixed === void 0) {
2362
+ isFixed = false;
2363
+ }
2364
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
2365
+ return false;
2366
+ }
2367
+ return isFixed;
1860
2368
  }
1861
2369
 
1862
- const platform = {
1863
- convertOffsetParentRelativeRectToViewportRelativeRect,
1864
- getDocumentElement,
1865
- getClippingRect,
1866
- getOffsetParent,
1867
- getElementRects,
1868
- getClientRects,
1869
- getDimensions,
1870
- getScale,
1871
- isElement,
1872
- isRTL
1873
- };
1874
-
1875
- // https://samthor.au/2021/observing-dom/
1876
- function observeMove(element, onMove) {
1877
- let io = null;
1878
- let timeoutId;
1879
- const root = getDocumentElement(element);
1880
- function cleanup() {
1881
- var _io;
1882
- clearTimeout(timeoutId);
1883
- (_io = io) == null || _io.disconnect();
1884
- io = null;
2370
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
2371
+ if (includeScale === void 0) {
2372
+ includeScale = false;
1885
2373
  }
1886
- function refresh(skip, threshold) {
1887
- if (skip === void 0) {
1888
- skip = false;
1889
- }
1890
- if (threshold === void 0) {
1891
- threshold = 1;
1892
- }
1893
- cleanup();
1894
- const {
1895
- left,
1896
- top,
1897
- width,
1898
- height
1899
- } = element.getBoundingClientRect();
1900
- if (!skip) {
1901
- onMove();
1902
- }
1903
- if (!width || !height) {
1904
- return;
1905
- }
1906
- const insetTop = floor(top);
1907
- const insetRight = floor(root.clientWidth - (left + width));
1908
- const insetBottom = floor(root.clientHeight - (top + height));
1909
- const insetLeft = floor(left);
1910
- const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1911
- const options = {
1912
- rootMargin,
1913
- threshold: max(0, min(1, threshold)) || 1
1914
- };
1915
- let isFirstUpdate = true;
1916
- function handleObserve(entries) {
1917
- const ratio = entries[0].intersectionRatio;
1918
- if (ratio !== threshold) {
1919
- if (!isFirstUpdate) {
1920
- return refresh();
1921
- }
1922
- if (!ratio) {
1923
- // If the reference is clipped, the ratio is 0. Throttle the refresh
1924
- // to prevent an infinite loop of updates.
1925
- timeoutId = setTimeout(() => {
1926
- refresh(false, 1e-7);
1927
- }, 1000);
1928
- } else {
1929
- refresh(false, ratio);
1930
- }
2374
+ if (isFixedStrategy === void 0) {
2375
+ isFixedStrategy = false;
2376
+ }
2377
+ const clientRect = element.getBoundingClientRect();
2378
+ const domElement = unwrapElement(element);
2379
+ let scale = createCoords(1);
2380
+ if (includeScale) {
2381
+ if (offsetParent) {
2382
+ if (isElement(offsetParent)) {
2383
+ scale = getScale(offsetParent);
1931
2384
  }
1932
- isFirstUpdate = false;
2385
+ } else {
2386
+ scale = getScale(element);
1933
2387
  }
1934
-
1935
- // Older browsers don't support a `document` as the root and will throw an
1936
- // error.
1937
- try {
1938
- io = new IntersectionObserver(handleObserve, {
1939
- ...options,
1940
- // Handle <iframe>s
1941
- root: root.ownerDocument
1942
- });
1943
- } catch (e) {
1944
- io = new IntersectionObserver(handleObserve, options);
2388
+ }
2389
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
2390
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
2391
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
2392
+ let width = clientRect.width / scale.x;
2393
+ let height = clientRect.height / scale.y;
2394
+ if (domElement) {
2395
+ const win = getWindow(domElement);
2396
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
2397
+ let currentWin = win;
2398
+ let currentIFrame = currentWin.frameElement;
2399
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
2400
+ const iframeScale = getScale(currentIFrame);
2401
+ const iframeRect = currentIFrame.getBoundingClientRect();
2402
+ const css = getComputedStyle$1(currentIFrame);
2403
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
2404
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
2405
+ x *= iframeScale.x;
2406
+ y *= iframeScale.y;
2407
+ width *= iframeScale.x;
2408
+ height *= iframeScale.y;
2409
+ x += left;
2410
+ y += top;
2411
+ currentWin = getWindow(currentIFrame);
2412
+ currentIFrame = currentWin.frameElement;
1945
2413
  }
1946
- io.observe(element);
1947
2414
  }
1948
- refresh(true);
1949
- return cleanup;
2415
+ return rectToClientRect({
2416
+ width,
2417
+ height,
2418
+ x,
2419
+ y
2420
+ });
1950
2421
  }
1951
2422
 
1952
- /**
1953
- * Automatically updates the position of the floating element when necessary.
1954
- * Should only be called when the floating element is mounted on the DOM or
1955
- * visible on the screen.
1956
- * @returns cleanup function that should be invoked when the floating element is
1957
- * removed from the DOM or hidden from the screen.
1958
- * @see https://floating-ui.com/docs/autoUpdate
1959
- */
1960
- function autoUpdate(reference, floating, update, options) {
1961
- if (options === void 0) {
1962
- options = {};
2423
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
2424
+ let {
2425
+ elements,
2426
+ rect,
2427
+ offsetParent,
2428
+ strategy
2429
+ } = _ref;
2430
+ const isFixed = strategy === 'fixed';
2431
+ const documentElement = getDocumentElement(offsetParent);
2432
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
2433
+ if (offsetParent === documentElement || topLayer && isFixed) {
2434
+ return rect;
1963
2435
  }
1964
- const {
1965
- ancestorScroll = true,
1966
- ancestorResize = true,
1967
- elementResize = typeof ResizeObserver === 'function',
1968
- layoutShift = typeof IntersectionObserver === 'function',
1969
- animationFrame = false
1970
- } = options;
1971
- const referenceEl = unwrapElement(reference);
1972
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
1973
- ancestors.forEach(ancestor => {
1974
- ancestorScroll && ancestor.addEventListener('scroll', update, {
1975
- passive: true
1976
- });
1977
- ancestorResize && ancestor.addEventListener('resize', update);
1978
- });
1979
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1980
- let reobserveFrame = -1;
1981
- let resizeObserver = null;
1982
- if (elementResize) {
1983
- resizeObserver = new ResizeObserver(_ref => {
1984
- let [firstEntry] = _ref;
1985
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1986
- // Prevent update loops when using the `size` middleware.
1987
- // https://github.com/floating-ui/floating-ui/issues/1740
1988
- resizeObserver.unobserve(floating);
1989
- cancelAnimationFrame(reobserveFrame);
1990
- reobserveFrame = requestAnimationFrame(() => {
1991
- var _resizeObserver;
1992
- (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1993
- });
1994
- }
1995
- update();
1996
- });
1997
- if (referenceEl && !animationFrame) {
1998
- resizeObserver.observe(referenceEl);
2436
+ let scroll = {
2437
+ scrollLeft: 0,
2438
+ scrollTop: 0
2439
+ };
2440
+ let scale = createCoords(1);
2441
+ const offsets = createCoords(0);
2442
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
2443
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
2444
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2445
+ scroll = getNodeScroll(offsetParent);
1999
2446
  }
2000
- resizeObserver.observe(floating);
2001
- }
2002
- let frameId;
2003
- let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
2004
- if (animationFrame) {
2005
- frameLoop();
2006
- }
2007
- function frameLoop() {
2008
- const nextRefRect = getBoundingClientRect(reference);
2009
- if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
2010
- update();
2447
+ if (isHTMLElement(offsetParent)) {
2448
+ const offsetRect = getBoundingClientRect(offsetParent);
2449
+ scale = getScale(offsetParent);
2450
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
2451
+ offsets.y = offsetRect.y + offsetParent.clientTop;
2011
2452
  }
2012
- prevRefRect = nextRefRect;
2013
- frameId = requestAnimationFrame(frameLoop);
2014
2453
  }
2015
- update();
2016
- return () => {
2017
- var _resizeObserver2;
2018
- ancestors.forEach(ancestor => {
2019
- ancestorScroll && ancestor.removeEventListener('scroll', update);
2020
- ancestorResize && ancestor.removeEventListener('resize', update);
2021
- });
2022
- cleanupIo == null || cleanupIo();
2023
- (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
2024
- resizeObserver = null;
2025
- if (animationFrame) {
2026
- cancelAnimationFrame(frameId);
2027
- }
2454
+ return {
2455
+ width: rect.width * scale.x,
2456
+ height: rect.height * scale.y,
2457
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
2458
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
2028
2459
  };
2029
2460
  }
2030
2461
 
2031
- /**
2032
- * Modifies the placement by translating the floating element along the
2033
- * specified axes.
2034
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
2035
- * object may be passed.
2036
- * @see https://floating-ui.com/docs/offset
2037
- */
2038
- const offset = offset$1;
2039
-
2040
- /**
2041
- * Optimizes the visibility of the floating element by choosing the placement
2042
- * that has the most space available automatically, without needing to specify a
2043
- * preferred placement. Alternative to `flip`.
2044
- * @see https://floating-ui.com/docs/autoPlacement
2045
- */
2046
- autoPlacement;
2047
-
2048
- /**
2049
- * Optimizes the visibility of the floating element by shifting it in order to
2050
- * keep it in view when it will overflow the clipping boundary.
2051
- * @see https://floating-ui.com/docs/shift
2052
- */
2053
- const shift = shift$1;
2462
+ function getClientRects(element) {
2463
+ return Array.from(element.getClientRects());
2464
+ }
2054
2465
 
2055
- /**
2056
- * Optimizes the visibility of the floating element by flipping the `placement`
2057
- * in order to keep it in view when the preferred placement(s) will overflow the
2058
- * clipping boundary. Alternative to `autoPlacement`.
2059
- * @see https://floating-ui.com/docs/flip
2060
- */
2061
- const flip = flip$1;
2466
+ function getWindowScrollBarX(element) {
2467
+ // If <html> has a CSS width greater than the viewport, then this will be
2468
+ // incorrect for RTL.
2469
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
2470
+ }
2062
2471
 
2063
- /**
2064
- * Provides data that allows you to change the size of the floating element —
2065
- * for instance, prevent it from overflowing the clipping boundary or match the
2066
- * width of the reference element.
2067
- * @see https://floating-ui.com/docs/size
2068
- */
2069
- const size = size$1;
2472
+ // Gets the entire size of the scrollable document area, even extending outside
2473
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
2474
+ function getDocumentRect(element) {
2475
+ const html = getDocumentElement(element);
2476
+ const scroll = getNodeScroll(element);
2477
+ const body = element.ownerDocument.body;
2478
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
2479
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
2480
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
2481
+ const y = -scroll.scrollTop;
2482
+ if (getComputedStyle$1(body).direction === 'rtl') {
2483
+ x += max(html.clientWidth, body.clientWidth) - width;
2484
+ }
2485
+ return {
2486
+ width,
2487
+ height,
2488
+ x,
2489
+ y
2490
+ };
2491
+ }
2070
2492
 
2071
- /**
2072
- * Provides data to hide the floating element in applicable situations, such as
2073
- * when it is not in the same clipping context as the reference element.
2074
- * @see https://floating-ui.com/docs/hide
2075
- */
2076
- hide;
2493
+ function getViewportRect(element, strategy) {
2494
+ const win = getWindow(element);
2495
+ const html = getDocumentElement(element);
2496
+ const visualViewport = win.visualViewport;
2497
+ let width = html.clientWidth;
2498
+ let height = html.clientHeight;
2499
+ let x = 0;
2500
+ let y = 0;
2501
+ if (visualViewport) {
2502
+ width = visualViewport.width;
2503
+ height = visualViewport.height;
2504
+ const visualViewportBased = isWebKit();
2505
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
2506
+ x = visualViewport.offsetLeft;
2507
+ y = visualViewport.offsetTop;
2508
+ }
2509
+ }
2510
+ return {
2511
+ width,
2512
+ height,
2513
+ x,
2514
+ y
2515
+ };
2516
+ }
2077
2517
 
2078
- /**
2079
- * Provides data to position an inner element of the floating element so that it
2080
- * appears centered to the reference element.
2081
- * @see https://floating-ui.com/docs/arrow
2082
- */
2083
- const arrow = arrow$1;
2518
+ // Returns the inner client rect, subtracting scrollbars if present.
2519
+ function getInnerBoundingClientRect(element, strategy) {
2520
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
2521
+ const top = clientRect.top + element.clientTop;
2522
+ const left = clientRect.left + element.clientLeft;
2523
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
2524
+ const width = element.clientWidth * scale.x;
2525
+ const height = element.clientHeight * scale.y;
2526
+ const x = left * scale.x;
2527
+ const y = top * scale.y;
2528
+ return {
2529
+ width,
2530
+ height,
2531
+ x,
2532
+ y
2533
+ };
2534
+ }
2535
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
2536
+ let rect;
2537
+ if (clippingAncestor === 'viewport') {
2538
+ rect = getViewportRect(element, strategy);
2539
+ } else if (clippingAncestor === 'document') {
2540
+ rect = getDocumentRect(getDocumentElement(element));
2541
+ } else if (isElement(clippingAncestor)) {
2542
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
2543
+ } else {
2544
+ const visualOffsets = getVisualOffsets(element);
2545
+ rect = {
2546
+ ...clippingAncestor,
2547
+ x: clippingAncestor.x - visualOffsets.x,
2548
+ y: clippingAncestor.y - visualOffsets.y
2549
+ };
2550
+ }
2551
+ return rectToClientRect(rect);
2552
+ }
2553
+ function hasFixedPositionAncestor(element, stopNode) {
2554
+ const parentNode = getParentNode(element);
2555
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
2556
+ return false;
2557
+ }
2558
+ return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
2559
+ }
2084
2560
 
2085
- /**
2086
- * Provides improved positioning for inline reference elements that can span
2087
- * over multiple lines, such as hyperlinks or range selections.
2088
- * @see https://floating-ui.com/docs/inline
2089
- */
2090
- const inline = inline$1;
2561
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
2562
+ // clipping (or hiding) child elements. This returns all clipping ancestors
2563
+ // of the given element up the tree.
2564
+ function getClippingElementAncestors(element, cache) {
2565
+ const cachedResult = cache.get(element);
2566
+ if (cachedResult) {
2567
+ return cachedResult;
2568
+ }
2569
+ let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
2570
+ let currentContainingBlockComputedStyle = null;
2571
+ const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
2572
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
2091
2573
 
2092
- /**
2093
- * Built-in `limiter` that will stop `shift()` at a certain point.
2094
- */
2095
- const limitShift = limitShift$1;
2574
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
2575
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
2576
+ const computedStyle = getComputedStyle$1(currentNode);
2577
+ const currentNodeIsContaining = isContainingBlock(currentNode);
2578
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
2579
+ currentContainingBlockComputedStyle = null;
2580
+ }
2581
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
2582
+ if (shouldDropCurrentNode) {
2583
+ // Drop non-containing blocks.
2584
+ result = result.filter(ancestor => ancestor !== currentNode);
2585
+ } else {
2586
+ // Record last containing block for next iteration.
2587
+ currentContainingBlockComputedStyle = computedStyle;
2588
+ }
2589
+ currentNode = getParentNode(currentNode);
2590
+ }
2591
+ cache.set(element, result);
2592
+ return result;
2593
+ }
2096
2594
 
2097
- /**
2098
- * Computes the `x` and `y` coordinates that will place the floating element
2099
- * next to a given reference element.
2100
- */
2101
- const computePosition = (reference, floating, options) => {
2102
- // This caches the expensive `getClippingElementAncestors` function so that
2103
- // multiple lifecycle resets re-use the same result. It only lives for a
2104
- // single call. If other functions become expensive, we can add them as well.
2105
- const cache = new Map();
2106
- const mergedOptions = {
2107
- platform,
2108
- ...options
2595
+ // Gets the maximum area that the element is visible in due to any number of
2596
+ // clipping ancestors.
2597
+ function getClippingRect(_ref) {
2598
+ let {
2599
+ element,
2600
+ boundary,
2601
+ rootBoundary,
2602
+ strategy
2603
+ } = _ref;
2604
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
2605
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
2606
+ const firstClippingAncestor = clippingAncestors[0];
2607
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
2608
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
2609
+ accRect.top = max(rect.top, accRect.top);
2610
+ accRect.right = min(rect.right, accRect.right);
2611
+ accRect.bottom = min(rect.bottom, accRect.bottom);
2612
+ accRect.left = max(rect.left, accRect.left);
2613
+ return accRect;
2614
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
2615
+ return {
2616
+ width: clippingRect.right - clippingRect.left,
2617
+ height: clippingRect.bottom - clippingRect.top,
2618
+ x: clippingRect.left,
2619
+ y: clippingRect.top
2109
2620
  };
2110
- const platformWithCache = {
2111
- ...mergedOptions.platform,
2112
- _c: cache
2621
+ }
2622
+
2623
+ function getDimensions(element) {
2624
+ const {
2625
+ width,
2626
+ height
2627
+ } = getCssDimensions(element);
2628
+ return {
2629
+ width,
2630
+ height
2113
2631
  };
2114
- return computePosition$1(reference, floating, {
2115
- ...mergedOptions,
2116
- platform: platformWithCache
2117
- });
2118
- };
2632
+ }
2119
2633
 
2120
- (()=>{var c=class extends Event{oldState;newState;constructor(t,{oldState:o="",newState:r="",...i}={}){super(t,i),this.oldState=String(o||""),this.newState=String(r||"");}},R=new WeakMap;function A(e,t,o){R.set(e,setTimeout(()=>{R.has(e)&&e.dispatchEvent(new c("toggle",{cancelable:!1,oldState:t,newState:o}));},0));}var D=globalThis.ShadowRoot||function(){},z=globalThis.HTMLDialogElement||function(){},M=new WeakMap,p=new WeakMap,h=new WeakMap;function L(e){return h.get(e)||"hidden"}var b=new WeakMap;function O(e){let t=e.popoverTargetElement;if(!(t instanceof HTMLElement))return;let o=L(t);e.popoverTargetAction==="show"&&o==="showing"||e.popoverTargetAction==="hide"&&o==="hidden"||(o==="showing"?m(t,!0,!0):d(t,!1)&&(b.set(t,e),S(t)));}function d(e,t){return !(e.popover!=="auto"&&e.popover!=="manual"||!e.isConnected||t&&L(e)!=="showing"||!t&&L(e)!=="hidden"||e instanceof z&&e.hasAttribute("open")||document.fullscreenElement===e)}function N(e){return e?Array.from(p.get(e.ownerDocument)||[]).indexOf(e)+1:0}function V(e){let t=W(e),o=U(e);return N(t)>N(o)?t:o}function y(e){let t=p.get(e);for(let o of t||[])if(!o.isConnected)t.delete(o);else return o;return null}function v(e){return typeof e.getRootNode=="function"?e.getRootNode():e.parentNode?v(e.parentNode):e}function W(e){for(;e;){if(e instanceof HTMLElement&&e.popover==="auto"&&h.get(e)==="showing")return e;if(e=e.parentElement||v(e),e instanceof D&&(e=e.host),e instanceof Document)return}}function U(e){for(;e;){let t=e.popoverTargetElement;if(t instanceof HTMLElement)return t;if(e=e.parentElement||v(e),e instanceof D&&(e=e.host),e instanceof Document)return}}function G(e){let t=new Map,o=0,r=e.ownerDocument;for(let a of p.get(r)||[])t.set(a,o),o+=1;t.set(e,o),o+=1;let i=null;function l(a){let g=W(a);if(g===null)return null;let n=t.get(g);(i===null||t.get(i)<n)&&(i=g);}return l(e?.parentElement),i}function Q(e){return e.hidden||e instanceof D||(e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLOptGroupElement||e instanceof HTMLOptionElement||e instanceof HTMLFieldSetElement)&&e.disabled||e instanceof HTMLInputElement&&e.type==="hidden"||e instanceof HTMLAnchorElement&&e.href===""?!1:typeof e.tabIndex=="number"&&e.tabIndex!==-1}function _(e){if(e.shadowRoot&&e.shadowRoot.delegatesFocus!==!0)return null;let t=e;t.shadowRoot&&(t=t.shadowRoot);let o=t.querySelector("[autofocus]");if(o)return o;{let l=t.querySelectorAll("slot");for(let a of l){let g=a.assignedElements({flatten:!0});for(let n of g){if(n.hasAttribute("autofocus"))return n;if(o=n.querySelector("[autofocus]"),o)return o}}}let r=e.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),i=r.currentNode;for(;i;){if(Q(i))return i;i=r.nextNode();}}function $(e){_(e)?.focus();}var H=new WeakMap;function S(e){if(!d(e,!1))return;let t=e.ownerDocument;if(!e.dispatchEvent(new c("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"}))||!d(e,!1))return;let o=!1;if(e.popover==="auto"){let i=e.getAttribute("popover"),l=G(e)||t;if(T(l,!1,!0),i!==e.getAttribute("popover")||!d(e,!1))return}y(t)||(o=!0),H.delete(e);let r=t.activeElement;e.classList.add(":popover-open"),h.set(e,"showing"),M.has(t)||M.set(t,new Set),M.get(t).add(e),$(e),e.popover==="auto"&&(p.has(t)||p.set(t,new Set),p.get(t).add(e),q(b.get(e),!0)),o&&r&&e.popover==="auto"&&H.set(e,r),A(e,"closed","open");}function m(e,t=!1,o=!1){if(!d(e,!0))return;let r=e.ownerDocument;if(e.popover==="auto"&&(T(e,t,o),!d(e,!0))||(q(b.get(e),!1),b.delete(e),o&&(e.dispatchEvent(new c("beforetoggle",{oldState:"open",newState:"closed"})),!d(e,!0))))return;M.get(r)?.delete(e),p.get(r)?.delete(e),e.classList.remove(":popover-open"),h.set(e,"hidden"),o&&A(e,"open","closed");let i=H.get(e);i&&(H.delete(e),t&&i.focus());}function F(e,t=!1,o=!1){let r=y(e);for(;r;)m(r,t,o),r=y(e);}function T(e,t,o){let r=e.ownerDocument||e;if(e instanceof Document)return F(r,t,o);let i=null,l=!1;for(let a of p.get(r)||[])if(a===e)l=!0;else if(l){i=a;break}if(!l)return F(r,t,o);for(;i&&L(i)==="showing"&&p.get(r)?.size;)m(i,t,o);}var P=new WeakMap;function x(e){if(!e.isTrusted)return;let t=e.composedPath()[0];if(!t)return;let o=t.ownerDocument;if(!y(o))return;let i=V(t);if(i&&e.type==="pointerdown")P.set(o,i);else if(e.type==="pointerup"){let l=P.get(o)===i;P.delete(o),l&&T(i||o,!1,!0);}}var k=new WeakMap;function q(e,t=!1){if(!e)return;k.has(e)||k.set(e,e.getAttribute("aria-expanded"));let o=e.popoverTargetElement;if(o instanceof HTMLElement&&o.popover==="auto")e.setAttribute("aria-expanded",String(t));else {let r=k.get(e);r?e.setAttribute("aria-expanded",r):e.removeAttribute("aria-expanded");}}var B=globalThis.ShadowRoot||function(){};function j(){return typeof HTMLElement<"u"&&typeof HTMLElement.prototype=="object"&&"popover"in HTMLElement.prototype}function f(e,t,o){let r=e[t];Object.defineProperty(e,t,{value(i){return r.call(this,o(i))}});}var J=/(^|[^\\]):popover-open\b/g,C=`
2121
- :where([popover]) {
2122
- position: fixed;
2123
- z-index: 2147483647;
2124
- inset: 0;
2125
- padding: 0.25em;
2126
- width: fit-content;
2127
- height: fit-content;
2128
- border-width: initial;
2129
- border-color: initial;
2130
- border-image: initial;
2131
- border-style: solid;
2132
- background-color: canvas;
2133
- color: canvastext;
2134
- overflow: auto;
2135
- margin: auto;
2634
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
2635
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
2636
+ const documentElement = getDocumentElement(offsetParent);
2637
+ const isFixed = strategy === 'fixed';
2638
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
2639
+ let scroll = {
2640
+ scrollLeft: 0,
2641
+ scrollTop: 0
2642
+ };
2643
+ const offsets = createCoords(0);
2644
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
2645
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2646
+ scroll = getNodeScroll(offsetParent);
2647
+ }
2648
+ if (isOffsetParentAnElement) {
2649
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
2650
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
2651
+ offsets.y = offsetRect.y + offsetParent.clientTop;
2652
+ } else if (documentElement) {
2653
+ offsets.x = getWindowScrollBarX(documentElement);
2654
+ }
2136
2655
  }
2656
+ const x = rect.left + scroll.scrollLeft - offsets.x;
2657
+ const y = rect.top + scroll.scrollTop - offsets.y;
2658
+ return {
2659
+ x,
2660
+ y,
2661
+ width: rect.width,
2662
+ height: rect.height
2663
+ };
2664
+ }
2137
2665
 
2138
- :where(dialog[popover][open]) {
2139
- display: revert;
2140
- }
2666
+ function isStaticPositioned(element) {
2667
+ return getComputedStyle$1(element).position === 'static';
2668
+ }
2141
2669
 
2142
- :where([anchor].\\:popover-open) {
2143
- inset: auto;
2670
+ function getTrueOffsetParent(element, polyfill) {
2671
+ if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
2672
+ return null;
2144
2673
  }
2145
-
2146
- :where([anchor]:popover-open) {
2147
- inset: auto;
2674
+ if (polyfill) {
2675
+ return polyfill(element);
2148
2676
  }
2677
+ return element.offsetParent;
2678
+ }
2149
2679
 
2150
- @supports not (background-color: canvas) {
2151
- :where([popover]) {
2152
- background-color: white;
2153
- color: black;
2154
- }
2680
+ // Gets the closest ancestor positioned element. Handles some edge cases,
2681
+ // such as table ancestors and cross browser bugs.
2682
+ function getOffsetParent(element, polyfill) {
2683
+ const win = getWindow(element);
2684
+ if (isTopLayer(element)) {
2685
+ return win;
2155
2686
  }
2156
-
2157
- @supports (width: -moz-fit-content) {
2158
- :where([popover]) {
2159
- width: -moz-fit-content;
2160
- height: -moz-fit-content;
2687
+ if (!isHTMLElement(element)) {
2688
+ let svgOffsetParent = getParentNode(element);
2689
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
2690
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
2691
+ return svgOffsetParent;
2692
+ }
2693
+ svgOffsetParent = getParentNode(svgOffsetParent);
2161
2694
  }
2695
+ return win;
2162
2696
  }
2163
-
2164
- @supports not (inset: 0) {
2165
- :where([popover]) {
2166
- top: 0;
2167
- left: 0;
2168
- right: 0;
2169
- bottom: 0;
2170
- }
2697
+ let offsetParent = getTrueOffsetParent(element, polyfill);
2698
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
2699
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
2171
2700
  }
2172
-
2173
- :where([popover]:not(.\\:popover-open)) {
2174
- display: none;
2701
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
2702
+ return win;
2175
2703
  }
2176
- `,E=null;function I(e){if(E===null)try{E=new CSSStyleSheet,E.replaceSync(C);}catch{E=!1;}if(E===!1){let t=document.createElement("style");t.textContent=C,e instanceof Document?e.head.prepend(t):e.prepend(t);}else e.adoptedStyleSheets=[E,...e.adoptedStyleSheets];}function K(){window.ToggleEvent=window.ToggleEvent||c;function e(n){return n?.includes(":popover-open")&&(n=n.replace(J,"$1.\\:popover-open")),n}f(Document.prototype,"querySelector",e),f(Document.prototype,"querySelectorAll",e),f(Element.prototype,"querySelector",e),f(Element.prototype,"querySelectorAll",e),f(Element.prototype,"matches",e),f(Element.prototype,"closest",e),f(DocumentFragment.prototype,"querySelectorAll",e),f(DocumentFragment.prototype,"querySelectorAll",e),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if(!this.hasAttribute("popover"))return null;let n=(this.getAttribute("popover")||"").toLowerCase();return n===""||n=="auto"?"auto":"manual"},set(n){this.setAttribute("popover",n);}},showPopover:{enumerable:!0,configurable:!0,value(){S(this);}},hidePopover:{enumerable:!0,configurable:!0,value(){m(this,!0,!0);}},togglePopover:{enumerable:!0,configurable:!0,value(n){h.get(this)==="showing"&&n===void 0||n===!1?m(this,!0,!0):(n===void 0||n===!0)&&S(this);}}});let t=Element.prototype.attachShadow;t&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(n){let s=t.call(this,n);return I(s),s}}});let o=HTMLElement.prototype.attachInternals;o&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){let n=o.call(this);return n.shadowRoot&&I(n.shadowRoot),n}}});let r=new WeakMap;function i(n){Object.defineProperties(n.prototype,{popoverTargetElement:{enumerable:!0,configurable:!0,set(s){if(s===null)this.removeAttribute("popovertarget"),r.delete(this);else if(s instanceof Element)this.setAttribute("popovertarget",""),r.set(this,s);else throw new TypeError("popoverTargetElement must be an element or null")},get(){if(this.localName!=="button"&&this.localName!=="input"||this.localName==="input"&&this.type!=="reset"&&this.type!=="image"&&this.type!=="button"||this.disabled||this.form&&this.type==="submit")return null;let s=r.get(this);if(s&&s.isConnected)return s;if(s&&!s.isConnected)return r.delete(this),null;let u=v(this),w=this.getAttribute("popovertarget");return (u instanceof Document||u instanceof B)&&w&&u.getElementById(w)||null}},popoverTargetAction:{enumerable:!0,configurable:!0,get(){let s=(this.getAttribute("popovertargetaction")||"").toLowerCase();return s==="show"||s==="hide"?s:"toggle"},set(s){this.setAttribute("popovertargetaction",s);}}});}i(HTMLButtonElement),i(HTMLInputElement);let l=n=>{if(!n.isTrusted)return;let s=n.composedPath()[0];if(!(s instanceof Element)||s?.shadowRoot)return;let u=v(s);if(!(u instanceof B||u instanceof Document))return;let w=s.closest("[popovertargetaction],[popovertarget]");if(w){O(w),n.preventDefault();return}},a=n=>{let s=n.key,u=n.target;!n.defaultPrevented&&u&&(s==="Escape"||s==="Esc")&&T(u.ownerDocument,!0,!0);};(n=>{n.addEventListener("click",l),n.addEventListener("keydown",a),n.addEventListener("pointerdown",x),n.addEventListener("pointerup",x);})(document),I(document);}j()||K();})();
2177
-
2178
- const postPopovercontainerCss = "@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}:where(post-popovercontainer){box-shadow:.5px 3px 4px rgba(0,0,0,.1),2px 4px 10px 4px rgba(0,0,0,.12);position:fixed;z-index:1060;width:max-content;margin:0;padding:0;box-sizing:border-box;color:var(--post-contrast-color);background-color:rgb(var(--post-bg-rgb));border:2px solid rgba(0,0,0,0);border-radius:4px;overflow:visible}:where(post-popovercontainer)[tooltip]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}:where(post-popovercontainer) .arrow{position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}:where(post-popovercontainer) .arrow.top{border-left:2px solid rgba(0,0,0,0);border-top:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.right{border-right:2px solid rgba(0,0,0,0);border-top:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.left{border-left:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.bottom{border-right:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0)}";
2179
- const PostPopovercontainerStyle0 = postPopovercontainerCss;
2704
+ return offsetParent || getContainingBlock(element) || win;
2705
+ }
2180
2706
 
2181
- const SIDE_MAP = {
2182
- top: 'bottom',
2183
- right: 'left',
2184
- bottom: 'top',
2185
- left: 'right',
2186
- };
2187
- const PostPopovercontainer = class {
2188
- constructor(hostRef) {
2189
- registerInstance(this, hostRef);
2190
- this.postToggle = createEvent(this, "postToggle", 7);
2191
- this.placement = 'top';
2192
- this.edgeGap = 8;
2193
- this.arrow = false;
2194
- }
2195
- componentDidLoad() {
2196
- this.host.setAttribute('popover', '');
2197
- this.host.addEventListener('beforetoggle', this.handleToggle.bind(this));
2198
- }
2199
- disconnectedCallback() {
2200
- if (typeof this.clearAutoUpdate === 'function')
2201
- this.clearAutoUpdate();
2202
- }
2203
- /**
2204
- * Programmatically display the tooltip
2205
- * @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
2206
- */
2207
- async show(target) {
2208
- if (!this.toggleTimeoutId) {
2209
- this.eventTarget = target;
2210
- this.calculatePosition();
2211
- this.host.showPopover();
2212
- }
2707
+ const getElementRects = async function (data) {
2708
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
2709
+ const getDimensionsFn = this.getDimensions;
2710
+ const floatingDimensions = await getDimensionsFn(data.floating);
2711
+ return {
2712
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
2713
+ floating: {
2714
+ x: 0,
2715
+ y: 0,
2716
+ width: floatingDimensions.width,
2717
+ height: floatingDimensions.height
2213
2718
  }
2214
- /**
2215
- * Programmatically hide this tooltip
2216
- */
2217
- async hide() {
2218
- if (!this.toggleTimeoutId) {
2219
- this.eventTarget = null;
2220
- this.host.hidePopover();
2221
- }
2719
+ };
2720
+ };
2721
+
2722
+ function isRTL(element) {
2723
+ return getComputedStyle$1(element).direction === 'rtl';
2724
+ }
2725
+
2726
+ const platform = {
2727
+ convertOffsetParentRelativeRectToViewportRelativeRect,
2728
+ getDocumentElement,
2729
+ getClippingRect,
2730
+ getOffsetParent,
2731
+ getElementRects,
2732
+ getClientRects,
2733
+ getDimensions,
2734
+ getScale,
2735
+ isElement,
2736
+ isRTL
2737
+ };
2738
+
2739
+ // https://samthor.au/2021/observing-dom/
2740
+ function observeMove(element, onMove) {
2741
+ let io = null;
2742
+ let timeoutId;
2743
+ const root = getDocumentElement(element);
2744
+ function cleanup() {
2745
+ var _io;
2746
+ clearTimeout(timeoutId);
2747
+ (_io = io) == null || _io.disconnect();
2748
+ io = null;
2749
+ }
2750
+ function refresh(skip, threshold) {
2751
+ if (skip === void 0) {
2752
+ skip = false;
2222
2753
  }
2223
- /**
2224
- * Toggle tooltip display
2225
- * @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
2226
- * @param force Pass true to always show or false to always hide
2227
- */
2228
- async toggle(target, force) {
2229
- // Prevent instant double toggle
2230
- if (!this.toggleTimeoutId) {
2231
- this.eventTarget = target;
2232
- this.calculatePosition();
2233
- this.host.togglePopover(force);
2234
- this.toggleTimeoutId = null;
2235
- }
2236
- return this.host.matches(':where(:popover-open, .popover-open');
2754
+ if (threshold === void 0) {
2755
+ threshold = 1;
2237
2756
  }
2238
- /**
2239
- * Start or stop auto updates based on tooltip events.
2240
- * Tooltips can be closed or opened with other methods than class members,
2241
- * therefore listening to the toggle event is safer for cleaning up.
2242
- * @param e ToggleEvent
2243
- */
2244
- handleToggle(e) {
2245
- this.toggleTimeoutId = window.setTimeout(() => (this.toggleTimeoutId = null), 10);
2246
- const isOpen = e.newState === 'open';
2247
- if (isOpen) {
2248
- this.startAutoupdates();
2249
- }
2250
- else {
2251
- if (typeof this.clearAutoUpdate === 'function')
2252
- this.clearAutoUpdate();
2253
- }
2254
- this.postToggle.emit(isOpen);
2757
+ cleanup();
2758
+ const {
2759
+ left,
2760
+ top,
2761
+ width,
2762
+ height
2763
+ } = element.getBoundingClientRect();
2764
+ if (!skip) {
2765
+ onMove();
2255
2766
  }
2256
- /**
2257
- * Start listening for DOM updates, scroll events etc. that have
2258
- * an influence on tooltip positioning
2259
- */
2260
- startAutoupdates() {
2261
- this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.calculatePosition.bind(this));
2767
+ if (!width || !height) {
2768
+ return;
2262
2769
  }
2263
- async calculatePosition() {
2264
- const gap = this.edgeGap;
2265
- const middleware = [
2266
- flip(),
2267
- inline(),
2268
- shift({
2269
- padding: gap,
2270
- // Prevents shifting away from the anchor too far, while shifting as far as possible
2271
- // https://floating-ui.com/docs/shift#limiter
2272
- limiter: limitShift({
2273
- offset: 32,
2274
- }),
2275
- }),
2276
- size({
2277
- apply({ availableWidth, elements }) {
2278
- Object.assign(elements.floating.style, {
2279
- maxWidth: `${availableWidth - gap * 2}px`,
2280
- });
2281
- },
2282
- }),
2283
- offset(this.arrow ? gap + 4 : gap), // 4px outside of element to account for focus outline + ~arrow size
2284
- ];
2285
- if (this.arrow) {
2286
- middleware.push(arrow({ element: this.arrowRef, padding: gap }));
2770
+ const insetTop = floor(top);
2771
+ const insetRight = floor(root.clientWidth - (left + width));
2772
+ const insetBottom = floor(root.clientHeight - (top + height));
2773
+ const insetLeft = floor(left);
2774
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
2775
+ const options = {
2776
+ rootMargin,
2777
+ threshold: max(0, min(1, threshold)) || 1
2778
+ };
2779
+ let isFirstUpdate = true;
2780
+ function handleObserve(entries) {
2781
+ const ratio = entries[0].intersectionRatio;
2782
+ if (ratio !== threshold) {
2783
+ if (!isFirstUpdate) {
2784
+ return refresh();
2287
2785
  }
2288
- const { x, y, middlewareData, placement: currentPlacement, } = await computePosition(this.eventTarget, this.host, {
2289
- placement: this.placement || 'top',
2290
- strategy: 'fixed',
2291
- middleware,
2292
- });
2293
- // Tooltip
2294
- this.host.style.left = `${x}px`;
2295
- this.host.style.top = `${y}px`;
2296
- // Arrow
2297
- if (this.arrow) {
2298
- // Tutorial: https://codesandbox.io/s/mystifying-kare-ee3hmh?file=/src/index.js
2299
- const side = currentPlacement.split('-')[0];
2300
- const { x: arrowX, y: arrowY } = middlewareData.arrow;
2301
- const staticSide = SIDE_MAP[side];
2302
- const offsetBorderLineJoin = 2;
2303
- Object.assign(this.arrowRef.style, {
2304
- top: arrowY ? `${arrowY}px` : '',
2305
- left: arrowX ? `${arrowX}px` : '',
2306
- [staticSide]: `${-this.arrowRef.offsetWidth / 2 - offsetBorderLineJoin}px`,
2307
- });
2308
- // Add position as a class to be able to style arrow for HCM
2309
- this.arrowRef.classList.remove(...Object.values(SIDE_MAP));
2310
- this.arrowRef.classList.add(staticSide);
2786
+ if (!ratio) {
2787
+ // If the reference is clipped, the ratio is 0. Throttle the refresh
2788
+ // to prevent an infinite loop of updates.
2789
+ timeoutId = setTimeout(() => {
2790
+ refresh(false, 1e-7);
2791
+ }, 1000);
2792
+ } else {
2793
+ refresh(false, ratio);
2311
2794
  }
2795
+ }
2796
+ isFirstUpdate = false;
2312
2797
  }
2313
- render() {
2314
- return (h(Host, { key: 'b8be8594adfd503c47f85872508d5bbd3473cc5a', "data-version": version }, this.arrow && (h("span", { key: 'f046737966eb3b801af1e888555178543ea015eb', class: "arrow", ref: el => {
2315
- this.arrowRef = el;
2316
- } })), h("slot", { key: '5d478472a83442d47e4f16ff8121782c8e6a524b' })));
2317
- }
2318
- get host() { return getElement(this); }
2319
- };
2320
- PostPopovercontainer.style = PostPopovercontainerStyle0;
2321
-
2322
- const postListCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */post-list{display:flex;gap:var(--post-list-title-gap);flex-direction:column;align-items:flex-start}post-list>div[role=list]{flex-direction:column;display:flex;gap:var(--post-list-item-gap)}post-list[horizontal]:not([horizontal=false]){flex-direction:row;align-items:baseline}post-list[horizontal]:not([horizontal=false])>div[role=list]{flex-direction:row;align-items:center}post-list>.list-title.visually-hidden{width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}post-list>.list-title.visually-hidden:not(caption){position:absolute !important}";
2323
- const PostListStyle0 = postListCss;
2324
2798
 
2325
- const PostList = class {
2326
- constructor(hostRef) {
2327
- registerInstance(this, hostRef);
2328
- this.titleId = undefined;
2329
- this.titleHidden = false;
2330
- this.horizontal = false;
2331
- }
2332
- componentWillLoad() {
2333
- /**
2334
- * Get the id set on the host element or use a random id by default
2335
- */
2336
- this.titleId = `list-${crypto.randomUUID()}`;
2337
- }
2338
- componentDidLoad() {
2339
- this.checkTitle();
2799
+ // Older browsers don't support a `document` as the root and will throw an
2800
+ // error.
2801
+ try {
2802
+ io = new IntersectionObserver(handleObserve, {
2803
+ ...options,
2804
+ // Handle <iframe>s
2805
+ root: root.ownerDocument
2806
+ });
2807
+ } catch (e) {
2808
+ io = new IntersectionObserver(handleObserve, options);
2340
2809
  }
2341
- checkTitle() {
2342
- if (!this.titleEl.textContent.trim()) {
2343
- throw new Error('Please provide a title to the list component. Title is mandatory for accessibility purposes.');
2344
- }
2810
+ io.observe(element);
2811
+ }
2812
+ refresh(true);
2813
+ return cleanup;
2814
+ }
2815
+
2816
+ /**
2817
+ * Automatically updates the position of the floating element when necessary.
2818
+ * Should only be called when the floating element is mounted on the DOM or
2819
+ * visible on the screen.
2820
+ * @returns cleanup function that should be invoked when the floating element is
2821
+ * removed from the DOM or hidden from the screen.
2822
+ * @see https://floating-ui.com/docs/autoUpdate
2823
+ */
2824
+ function autoUpdate(reference, floating, update, options) {
2825
+ if (options === void 0) {
2826
+ options = {};
2827
+ }
2828
+ const {
2829
+ ancestorScroll = true,
2830
+ ancestorResize = true,
2831
+ elementResize = typeof ResizeObserver === 'function',
2832
+ layoutShift = typeof IntersectionObserver === 'function',
2833
+ animationFrame = false
2834
+ } = options;
2835
+ const referenceEl = unwrapElement(reference);
2836
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
2837
+ ancestors.forEach(ancestor => {
2838
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
2839
+ passive: true
2840
+ });
2841
+ ancestorResize && ancestor.addEventListener('resize', update);
2842
+ });
2843
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
2844
+ let reobserveFrame = -1;
2845
+ let resizeObserver = null;
2846
+ if (elementResize) {
2847
+ resizeObserver = new ResizeObserver(_ref => {
2848
+ let [firstEntry] = _ref;
2849
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
2850
+ // Prevent update loops when using the `size` middleware.
2851
+ // https://github.com/floating-ui/floating-ui/issues/1740
2852
+ resizeObserver.unobserve(floating);
2853
+ cancelAnimationFrame(reobserveFrame);
2854
+ reobserveFrame = requestAnimationFrame(() => {
2855
+ var _resizeObserver;
2856
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
2857
+ });
2858
+ }
2859
+ update();
2860
+ });
2861
+ if (referenceEl && !animationFrame) {
2862
+ resizeObserver.observe(referenceEl);
2345
2863
  }
2346
- render() {
2347
- return (h(Host, { key: '017f05c43fa95bb93c856bbeddd5d26cbc2f4cfa', "data-version": version }, h("div", { key: '71fd7d32c761cecf7b4d5d5f39cedb3bf668a0cb', ref: el => (this.titleEl = el), id: this.titleId, class: `list-title${this.titleHidden ? ' visually-hidden' : ''}` }, h("slot", { key: 'fe0e03d5d25f6a975e04be00549facae49a0970b' })), h("div", { key: 'bb717e4338396c86fa28dbf8236f5f185823f9be', role: "list", "aria-labelledby": this.titleId }, h("slot", { key: '7fd25cab433f5fbbafaa7ca01f42774823cbf579', name: "post-list-item" }))));
2864
+ resizeObserver.observe(floating);
2865
+ }
2866
+ let frameId;
2867
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
2868
+ if (animationFrame) {
2869
+ frameLoop();
2870
+ }
2871
+ function frameLoop() {
2872
+ const nextRefRect = getBoundingClientRect(reference);
2873
+ if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
2874
+ update();
2348
2875
  }
2349
- get host() { return getElement(this); }
2350
- };
2351
- PostList.style = PostListStyle0;
2876
+ prevRefRect = nextRefRect;
2877
+ frameId = requestAnimationFrame(frameLoop);
2878
+ }
2879
+ update();
2880
+ return () => {
2881
+ var _resizeObserver2;
2882
+ ancestors.forEach(ancestor => {
2883
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
2884
+ ancestorResize && ancestor.removeEventListener('resize', update);
2885
+ });
2886
+ cleanupIo == null || cleanupIo();
2887
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
2888
+ resizeObserver = null;
2889
+ if (animationFrame) {
2890
+ cancelAnimationFrame(frameId);
2891
+ }
2892
+ };
2893
+ }
2352
2894
 
2353
- const postListItemCss = ":host{display:flex}";
2354
- const PostListItemStyle0 = postListItemCss;
2895
+ /**
2896
+ * Modifies the placement by translating the floating element along the
2897
+ * specified axes.
2898
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
2899
+ * object may be passed.
2900
+ * @see https://floating-ui.com/docs/offset
2901
+ */
2902
+ const offset = offset$1;
2355
2903
 
2356
- const PostListItem = class {
2357
- constructor(hostRef) {
2358
- registerInstance(this, hostRef);
2359
- }
2360
- connectedCallback() {
2361
- this.host.setAttribute('slot', 'post-list-item');
2362
- }
2363
- render() {
2364
- return (h(Host, { key: 'bbf12424f2997b7d2e7cd9e272def0bf2838f94f', role: "listitem" }, h("slot", { key: '2ce4e71879485f16ad90dfddbd1b79512107bdb0' })));
2365
- }
2366
- get host() { return getElement(this); }
2367
- };
2368
- PostListItem.style = PostListItemStyle0;
2904
+ /**
2905
+ * Optimizes the visibility of the floating element by choosing the placement
2906
+ * that has the most space available automatically, without needing to specify a
2907
+ * preferred placement. Alternative to `flip`.
2908
+ * @see https://floating-ui.com/docs/autoPlacement
2909
+ */
2910
+ autoPlacement;
2369
2911
 
2370
- /* eslint-disable no-undefined,no-param-reassign,no-shadow */
2912
+ /**
2913
+ * Optimizes the visibility of the floating element by shifting it in order to
2914
+ * keep it in view when it will overflow the clipping boundary.
2915
+ * @see https://floating-ui.com/docs/shift
2916
+ */
2917
+ const shift = shift$1;
2371
2918
 
2372
2919
  /**
2373
- * Throttle execution of a function. Especially useful for rate limiting
2374
- * execution of handlers on events like resize and scroll.
2375
- *
2376
- * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
2377
- * are most useful.
2378
- * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
2379
- * as-is, to `callback` when the throttled-function is executed.
2380
- * @param {object} [options] - An object to configure options.
2381
- * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
2382
- * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
2383
- * one final time after the last throttled-function call. (After the throttled-function has not been called for
2384
- * `delay` milliseconds, the internal counter is reset).
2385
- * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
2386
- * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
2387
- * callback will never executed if both noLeading = true and noTrailing = true.
2388
- * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
2389
- * false (at end), schedule `callback` to execute after `delay` ms.
2390
- *
2391
- * @returns {Function} A new, throttled, function.
2920
+ * Optimizes the visibility of the floating element by flipping the `placement`
2921
+ * in order to keep it in view when the preferred placement(s) will overflow the
2922
+ * clipping boundary. Alternative to `autoPlacement`.
2923
+ * @see https://floating-ui.com/docs/flip
2392
2924
  */
2393
- function throttle (delay, callback, options) {
2394
- var _ref = options || {},
2395
- _ref$noTrailing = _ref.noTrailing,
2396
- noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,
2397
- _ref$noLeading = _ref.noLeading,
2398
- noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,
2399
- _ref$debounceMode = _ref.debounceMode,
2400
- debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;
2401
- /*
2402
- * After wrapper has stopped being called, this timeout ensures that
2403
- * `callback` is executed at the proper times in `throttle` and `end`
2404
- * debounce modes.
2405
- */
2406
- var timeoutID;
2407
- var cancelled = false;
2925
+ const flip = flip$1;
2408
2926
 
2409
- // Keep track of the last time `callback` was executed.
2410
- var lastExec = 0;
2927
+ /**
2928
+ * Provides data that allows you to change the size of the floating element —
2929
+ * for instance, prevent it from overflowing the clipping boundary or match the
2930
+ * width of the reference element.
2931
+ * @see https://floating-ui.com/docs/size
2932
+ */
2933
+ const size = size$1;
2411
2934
 
2412
- // Function to clear existing timeout
2413
- function clearExistingTimeout() {
2414
- if (timeoutID) {
2415
- clearTimeout(timeoutID);
2416
- }
2417
- }
2935
+ /**
2936
+ * Provides data to hide the floating element in applicable situations, such as
2937
+ * when it is not in the same clipping context as the reference element.
2938
+ * @see https://floating-ui.com/docs/hide
2939
+ */
2940
+ hide;
2418
2941
 
2419
- // Function to cancel next exec
2420
- function cancel(options) {
2421
- var _ref2 = options || {},
2422
- _ref2$upcomingOnly = _ref2.upcomingOnly,
2423
- upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
2424
- clearExistingTimeout();
2425
- cancelled = !upcomingOnly;
2426
- }
2942
+ /**
2943
+ * Provides data to position an inner element of the floating element so that it
2944
+ * appears centered to the reference element.
2945
+ * @see https://floating-ui.com/docs/arrow
2946
+ */
2947
+ const arrow = arrow$1;
2427
2948
 
2428
- /*
2429
- * The `wrapper` function encapsulates all of the throttling / debouncing
2430
- * functionality and when executed will limit the rate at which `callback`
2431
- * is executed.
2432
- */
2433
- function wrapper() {
2434
- for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
2435
- arguments_[_key] = arguments[_key];
2436
- }
2437
- var self = this;
2438
- var elapsed = Date.now() - lastExec;
2439
- if (cancelled) {
2440
- return;
2441
- }
2949
+ /**
2950
+ * Provides improved positioning for inline reference elements that can span
2951
+ * over multiple lines, such as hyperlinks or range selections.
2952
+ * @see https://floating-ui.com/docs/inline
2953
+ */
2954
+ const inline = inline$1;
2442
2955
 
2443
- // Execute `callback` and update the `lastExec` timestamp.
2444
- function exec() {
2445
- lastExec = Date.now();
2446
- callback.apply(self, arguments_);
2447
- }
2956
+ /**
2957
+ * Built-in `limiter` that will stop `shift()` at a certain point.
2958
+ */
2959
+ const limitShift = limitShift$1;
2448
2960
 
2449
- /*
2450
- * If `debounceMode` is true (at begin) this is used to clear the flag
2451
- * to allow future `callback` executions.
2452
- */
2453
- function clear() {
2454
- timeoutID = undefined;
2455
- }
2456
- if (!noLeading && debounceMode && !timeoutID) {
2457
- /*
2458
- * Since `wrapper` is being called for the first time and
2459
- * `debounceMode` is true (at begin), execute `callback`
2460
- * and noLeading != true.
2461
- */
2462
- exec();
2463
- }
2464
- clearExistingTimeout();
2465
- if (debounceMode === undefined && elapsed > delay) {
2466
- if (noLeading) {
2467
- /*
2468
- * In throttle mode with noLeading, if `delay` time has
2469
- * been exceeded, update `lastExec` and schedule `callback`
2470
- * to execute after `delay` ms.
2471
- */
2472
- lastExec = Date.now();
2473
- if (!noTrailing) {
2474
- timeoutID = setTimeout(debounceMode ? clear : exec, delay);
2475
- }
2476
- } else {
2477
- /*
2478
- * In throttle mode without noLeading, if `delay` time has been exceeded, execute
2479
- * `callback`.
2480
- */
2481
- exec();
2482
- }
2483
- } else if (noTrailing !== true) {
2484
- /*
2485
- * In trailing throttle mode, since `delay` time has not been
2486
- * exceeded, schedule `callback` to execute `delay` ms after most
2487
- * recent execution.
2488
- *
2489
- * If `debounceMode` is true (at begin), schedule `clear` to execute
2490
- * after `delay` ms.
2491
- *
2492
- * If `debounceMode` is false (at end), schedule `callback` to
2493
- * execute after `delay` ms.
2494
- */
2495
- timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
2496
- }
2961
+ /**
2962
+ * Computes the `x` and `y` coordinates that will place the floating element
2963
+ * next to a given reference element.
2964
+ */
2965
+ const computePosition = (reference, floating, options) => {
2966
+ // This caches the expensive `getClippingElementAncestors` function so that
2967
+ // multiple lifecycle resets re-use the same result. It only lives for a
2968
+ // single call. If other functions become expensive, we can add them as well.
2969
+ const cache = new Map();
2970
+ const mergedOptions = {
2971
+ platform,
2972
+ ...options
2973
+ };
2974
+ const platformWithCache = {
2975
+ ...mergedOptions.platform,
2976
+ _c: cache
2977
+ };
2978
+ return computePosition$1(reference, floating, {
2979
+ ...mergedOptions,
2980
+ platform: platformWithCache
2981
+ });
2982
+ };
2983
+
2984
+ (()=>{var c=class extends Event{oldState;newState;constructor(t,{oldState:o="",newState:r="",...i}={}){super(t,i),this.oldState=String(o||""),this.newState=String(r||"");}},R=new WeakMap;function A(e,t,o){R.set(e,setTimeout(()=>{R.has(e)&&e.dispatchEvent(new c("toggle",{cancelable:!1,oldState:t,newState:o}));},0));}var D=globalThis.ShadowRoot||function(){},z=globalThis.HTMLDialogElement||function(){},M=new WeakMap,p=new WeakMap,h=new WeakMap;function L(e){return h.get(e)||"hidden"}var b=new WeakMap;function O(e){let t=e.popoverTargetElement;if(!(t instanceof HTMLElement))return;let o=L(t);e.popoverTargetAction==="show"&&o==="showing"||e.popoverTargetAction==="hide"&&o==="hidden"||(o==="showing"?m(t,!0,!0):d(t,!1)&&(b.set(t,e),S(t)));}function d(e,t){return !(e.popover!=="auto"&&e.popover!=="manual"||!e.isConnected||t&&L(e)!=="showing"||!t&&L(e)!=="hidden"||e instanceof z&&e.hasAttribute("open")||document.fullscreenElement===e)}function N(e){return e?Array.from(p.get(e.ownerDocument)||[]).indexOf(e)+1:0}function V(e){let t=W(e),o=U(e);return N(t)>N(o)?t:o}function y(e){let t=p.get(e);for(let o of t||[])if(!o.isConnected)t.delete(o);else return o;return null}function v(e){return typeof e.getRootNode=="function"?e.getRootNode():e.parentNode?v(e.parentNode):e}function W(e){for(;e;){if(e instanceof HTMLElement&&e.popover==="auto"&&h.get(e)==="showing")return e;if(e=e.parentElement||v(e),e instanceof D&&(e=e.host),e instanceof Document)return}}function U(e){for(;e;){let t=e.popoverTargetElement;if(t instanceof HTMLElement)return t;if(e=e.parentElement||v(e),e instanceof D&&(e=e.host),e instanceof Document)return}}function G(e){let t=new Map,o=0,r=e.ownerDocument;for(let a of p.get(r)||[])t.set(a,o),o+=1;t.set(e,o),o+=1;let i=null;function l(a){let g=W(a);if(g===null)return null;let n=t.get(g);(i===null||t.get(i)<n)&&(i=g);}return l(e?.parentElement),i}function Q(e){return e.hidden||e instanceof D||(e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLOptGroupElement||e instanceof HTMLOptionElement||e instanceof HTMLFieldSetElement)&&e.disabled||e instanceof HTMLInputElement&&e.type==="hidden"||e instanceof HTMLAnchorElement&&e.href===""?!1:typeof e.tabIndex=="number"&&e.tabIndex!==-1}function _(e){if(e.shadowRoot&&e.shadowRoot.delegatesFocus!==!0)return null;let t=e;t.shadowRoot&&(t=t.shadowRoot);let o=t.querySelector("[autofocus]");if(o)return o;{let l=t.querySelectorAll("slot");for(let a of l){let g=a.assignedElements({flatten:!0});for(let n of g){if(n.hasAttribute("autofocus"))return n;if(o=n.querySelector("[autofocus]"),o)return o}}}let r=e.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),i=r.currentNode;for(;i;){if(Q(i))return i;i=r.nextNode();}}function $(e){_(e)?.focus();}var H=new WeakMap;function S(e){if(!d(e,!1))return;let t=e.ownerDocument;if(!e.dispatchEvent(new c("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"}))||!d(e,!1))return;let o=!1;if(e.popover==="auto"){let i=e.getAttribute("popover"),l=G(e)||t;if(T(l,!1,!0),i!==e.getAttribute("popover")||!d(e,!1))return}y(t)||(o=!0),H.delete(e);let r=t.activeElement;e.classList.add(":popover-open"),h.set(e,"showing"),M.has(t)||M.set(t,new Set),M.get(t).add(e),$(e),e.popover==="auto"&&(p.has(t)||p.set(t,new Set),p.get(t).add(e),q(b.get(e),!0)),o&&r&&e.popover==="auto"&&H.set(e,r),A(e,"closed","open");}function m(e,t=!1,o=!1){if(!d(e,!0))return;let r=e.ownerDocument;if(e.popover==="auto"&&(T(e,t,o),!d(e,!0))||(q(b.get(e),!1),b.delete(e),o&&(e.dispatchEvent(new c("beforetoggle",{oldState:"open",newState:"closed"})),!d(e,!0))))return;M.get(r)?.delete(e),p.get(r)?.delete(e),e.classList.remove(":popover-open"),h.set(e,"hidden"),o&&A(e,"open","closed");let i=H.get(e);i&&(H.delete(e),t&&i.focus());}function F(e,t=!1,o=!1){let r=y(e);for(;r;)m(r,t,o),r=y(e);}function T(e,t,o){let r=e.ownerDocument||e;if(e instanceof Document)return F(r,t,o);let i=null,l=!1;for(let a of p.get(r)||[])if(a===e)l=!0;else if(l){i=a;break}if(!l)return F(r,t,o);for(;i&&L(i)==="showing"&&p.get(r)?.size;)m(i,t,o);}var P=new WeakMap;function x(e){if(!e.isTrusted)return;let t=e.composedPath()[0];if(!t)return;let o=t.ownerDocument;if(!y(o))return;let i=V(t);if(i&&e.type==="pointerdown")P.set(o,i);else if(e.type==="pointerup"){let l=P.get(o)===i;P.delete(o),l&&T(i||o,!1,!0);}}var k=new WeakMap;function q(e,t=!1){if(!e)return;k.has(e)||k.set(e,e.getAttribute("aria-expanded"));let o=e.popoverTargetElement;if(o instanceof HTMLElement&&o.popover==="auto")e.setAttribute("aria-expanded",String(t));else {let r=k.get(e);r?e.setAttribute("aria-expanded",r):e.removeAttribute("aria-expanded");}}var B=globalThis.ShadowRoot||function(){};function j(){return typeof HTMLElement<"u"&&typeof HTMLElement.prototype=="object"&&"popover"in HTMLElement.prototype}function f(e,t,o){let r=e[t];Object.defineProperty(e,t,{value(i){return r.call(this,o(i))}});}var J=/(^|[^\\]):popover-open\b/g,C=`
2985
+ :where([popover]) {
2986
+ position: fixed;
2987
+ z-index: 2147483647;
2988
+ inset: 0;
2989
+ padding: 0.25em;
2990
+ width: fit-content;
2991
+ height: fit-content;
2992
+ border-width: initial;
2993
+ border-color: initial;
2994
+ border-image: initial;
2995
+ border-style: solid;
2996
+ background-color: canvas;
2997
+ color: canvastext;
2998
+ overflow: auto;
2999
+ margin: auto;
2497
3000
  }
2498
- wrapper.cancel = cancel;
2499
3001
 
2500
- // Return the wrapper function.
2501
- return wrapper;
2502
- }
3002
+ :where(dialog[popover][open]) {
3003
+ display: revert;
3004
+ }
2503
3005
 
2504
- const postHeaderCss = "*,::before,::after{box-sizing:border-box}:host{--global-header-height:72px;--main-header-height:56px;--header-height:calc(var(--global-header-height) + var(--main-header-height))}@media screen and (max-width: 1023.99px){:host{--global-header-height:64px}}.d-flex{display:flex}.space-between{justify-content:space-between}.global-header{background-color:#fc0;display:flex;justify-content:space-between;align-items:center;position:sticky;padding-inline-start:4px;padding-inline-end:12px;height:var(--global-header-height)}@media screen and (max-width: 1023.99px){.global-header{top:0}}@media screen and (min-width: 1024px){.global-header{top:calc((var(--global-header-height) - 24px)*-1)}}slot[name=post-logo]{align-self:flex-end}.global-sub{display:flex;align-items:center;gap:2rem;height:var(--global-header-height)}.align-end{align-items:flex-end}.logo{flex:1 0 auto;height:var(--global-header-height);width:var(--global-header-height);min-height:24px;align-self:flex-end}@media screen and (min-width: 1024px){.logo{height:calc(var(--global-header-height) - var(--header-scroll-top))}}::slotted(ul){margin-block:0;list-style:none;display:flex;padding-left:0;gap:1rem}.title-header,.main-navigation{display:flex;align-items:center;padding-inline:12px;background:#fff}.title-header{height:var(--main-header-height);display:flex;align-items:center}@media screen and (max-width: 1023.99px){.title-header{border-bottom:1px solid #000}}:host(:not(:has([slot=title]))) .title-header{display:none}::slotted(h1){margin:0 !important;font-size:28px !important}.main-navigation{position:sticky;top:24px;height:var(--main-header-height)}@media screen and (min-width: 1024px){.main-navigation{border-bottom:1px solid #000}}@media screen and (max-width: 1023.99px){.main-navigation{display:none;position:absolute;top:var(--header-height);bottom:0;width:100%;background-color:#fff;height:auto}.main-navigation.extended{display:block}}@media screen and (min-width: 1024px){.mobile-toggle{display:none}}";
2505
- const PostHeaderStyle0 = postHeaderCss;
3006
+ :where([anchor].\\:popover-open) {
3007
+ inset: auto;
3008
+ }
2506
3009
 
2507
- const PostHeader = class {
2508
- constructor(hostRef) {
2509
- registerInstance(this, hostRef);
2510
- this.scrollParent = null;
2511
- this.throttledScroll = () => this.handleScrollEvent();
2512
- this.throttledResize = throttle(50, () => this.handleResize());
2513
- this.device = null;
2514
- this.mobileMenuExtended = false;
2515
- }
2516
- componentWillRender() {
2517
- this.scrollParent = this.getScrollParent(this.host);
2518
- this.scrollParent.addEventListener('scroll', this.throttledScroll, { passive: true });
2519
- window.addEventListener('resize', this.throttledResize, { passive: true });
2520
- this.handleResize();
2521
- this.handleScrollEvent();
2522
- }
2523
- handlePostMainNavigationClosed() {
2524
- this.mobileMenuExtended = false;
2525
- }
2526
- handleScrollEvent() {
2527
- // Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
2528
- const st = Math.max(0, this.scrollParent instanceof Document
2529
- ? this.scrollParent.documentElement.scrollTop
2530
- : this.scrollParent.scrollTop);
2531
- this.host.style.setProperty('--header-scroll-top', `${st}px`);
2532
- }
2533
- getScrollParent(node) {
2534
- let currentParent = node.parentElement;
2535
- while (currentParent) {
2536
- if (currentParent.nodeName === 'BODY') {
2537
- return document;
2538
- }
2539
- if (this.isScrollable(currentParent)) {
2540
- return currentParent;
2541
- }
2542
- currentParent = currentParent.parentElement;
2543
- }
2544
- return document;
2545
- }
2546
- isScrollable(node) {
2547
- if (!(node instanceof HTMLElement || node instanceof SVGElement)) {
2548
- return false;
2549
- }
2550
- const style = getComputedStyle(node);
2551
- return ['overflow', 'overflow-x', 'overflow-y'].some(propertyName => {
2552
- const value = style.getPropertyValue(propertyName);
2553
- return value === 'auto' || value === 'scroll';
2554
- });
2555
- }
2556
- handleResize() {
2557
- const width = window === null || window === void 0 ? void 0 : window.innerWidth;
2558
- if (width >= 1024) {
2559
- this.device = 'desktop';
2560
- this.mobileMenuExtended = false; // Close any open mobile menu
2561
- }
2562
- else if (width >= 600) {
2563
- this.device = 'tablet';
2564
- }
2565
- else {
2566
- this.device = 'mobile';
2567
- }
3010
+ :where([anchor]:popover-open) {
3011
+ inset: auto;
3012
+ }
3013
+
3014
+ @supports not (background-color: canvas) {
3015
+ :where([popover]) {
3016
+ background-color: white;
3017
+ color: black;
2568
3018
  }
2569
- handleMobileMenuToggle() {
2570
- this.mobileMenuExtended = !this.mobileMenuExtended;
3019
+ }
3020
+
3021
+ @supports (width: -moz-fit-content) {
3022
+ :where([popover]) {
3023
+ width: -moz-fit-content;
3024
+ height: -moz-fit-content;
2571
3025
  }
2572
- render() {
2573
- const mainNavClasses = ['main-navigation'];
2574
- if (this.mobileMenuExtended) {
2575
- mainNavClasses.push('extended');
2576
- }
2577
- return (h(Host, { key: 'a09985740ff01e4f38e7bbe5e0b9012d77e7cba2', version: version }, h("div", { key: 'c612b90e757d916036bee002d7bba8abfeb19073', class: "global-header" }, h("div", { key: 'd11c51f756d1c7a8c0b4f3b9625cfbe8cae88435', class: "global-sub" }, h("div", { key: '43fb63bfe0350ffca0e44fd611bb6bbe6c3eef0c', class: "logo" }, h("slot", { key: '8d90d7f20b0fd6a7cbc93e5dd95ad8200c027822', name: "post-logo" }))), h("div", { key: 'b1bc83b4fcb3a0af6ffd99976af4acf454b3d29d', class: "global-sub" }, this.device === 'desktop' && h("slot", { key: 'bbe38f3e0d070bfd84e1656e7dd631816df0101c', name: "meta-navigation" }), h("slot", { key: 'b1483eea11ecdc9cddf122077cf0746d88f69239', name: "global-controls" }), this.device === 'desktop' && h("slot", { key: '785f557f30bffc5cd282a0505e9ffc7e3e6e1029', name: "post-language-switch" }), h("div", { key: 'f088ddb3df417929525b22a09fa3be113042e48f', onClick: () => this.handleMobileMenuToggle(), class: "mobile-toggle" }, h("slot", { key: 'de65884a443290e057ed911289818d5a323f5a9c', name: "post-togglebutton" })))), h("div", { key: '56ebdec46003a6ead4f3710dc9c0f60e9a86ed8d', class: "title-header d-flex space-between align-center" }, h("slot", { key: '8e61e4711ea8018e51fd11c5b5faa30a1ad9445c', name: "title" }), h("div", { key: '4d762d1f4d3f45470d52af167c7f4a71651e7970', class: "global-sub" }, h("slot", { key: 'c8c5b73b1fa0e665a7133ae8db0212ef8948ba29', name: "local-controls" }), h("slot", { key: '212640155af85dfab34182ab236bfe72456e77b1' }))), h("div", { key: 'c4004d443fd546fac8a2651482725fae99c2db6c', class: mainNavClasses.join(' ') }, h("slot", { key: '783787f85d25d9e42d96213ae77f6c689f872b70', name: "post-mainnavigation" }), (this.device === 'mobile' || this.device === 'tablet') && (h("slot", { key: '04cfd7d09d03ab85ac9c12f9c3d6cb31fbb65fc2', name: "meta-navigation" })), (this.device === 'mobile' || this.device === 'tablet') && (h("slot", { key: '117e76f18fdc93493115428e1cd0d6a119c7a652', name: "post-language-switch" })))));
3026
+ }
3027
+
3028
+ @supports not (inset: 0) {
3029
+ :where([popover]) {
3030
+ top: 0;
3031
+ left: 0;
3032
+ right: 0;
3033
+ bottom: 0;
2578
3034
  }
2579
- get host() { return getElement(this); }
2580
- };
2581
- PostHeader.style = PostHeaderStyle0;
3035
+ }
2582
3036
 
2583
- const postMainnavigationCss = "*,::before,::after{box-sizing:border-box}@media screen and (min-width: 1024px){slot[name=back-button],[slot=back-button]{display:none}}@media screen and (min-width: 1024px){h2{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}}post-mainnavigation{height:100%}:host{height:100%;display:block}.main-navigation{margin-block:0;list-style:none;display:flex;padding-left:0;gap:1rem}@media screen and (max-width: 1023.99px){.main-navigation{flex-direction:column}}.main-navigation>post-list{display:flex;align-items:stretch;gap:1rem;height:100%}@media screen and (max-width: 1023.99px){.main-navigation>post-list{flex-direction:column}}.main-navigation a,.main-navigation post-megadropdown-toggle{height:100%;display:flex;align-items:center}";
2584
- const PostMainnavigationStyle0 = postMainnavigationCss;
3037
+ :where([popover]:not(.\\:popover-open)) {
3038
+ display: none;
3039
+ }
3040
+ `,E=null;function I(e){if(E===null)try{E=new CSSStyleSheet,E.replaceSync(C);}catch{E=!1;}if(E===!1){let t=document.createElement("style");t.textContent=C,e instanceof Document?e.head.prepend(t):e.prepend(t);}else e.adoptedStyleSheets=[E,...e.adoptedStyleSheets];}function K(){window.ToggleEvent=window.ToggleEvent||c;function e(n){return n?.includes(":popover-open")&&(n=n.replace(J,"$1.\\:popover-open")),n}f(Document.prototype,"querySelector",e),f(Document.prototype,"querySelectorAll",e),f(Element.prototype,"querySelector",e),f(Element.prototype,"querySelectorAll",e),f(Element.prototype,"matches",e),f(Element.prototype,"closest",e),f(DocumentFragment.prototype,"querySelectorAll",e),f(DocumentFragment.prototype,"querySelectorAll",e),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if(!this.hasAttribute("popover"))return null;let n=(this.getAttribute("popover")||"").toLowerCase();return n===""||n=="auto"?"auto":"manual"},set(n){this.setAttribute("popover",n);}},showPopover:{enumerable:!0,configurable:!0,value(){S(this);}},hidePopover:{enumerable:!0,configurable:!0,value(){m(this,!0,!0);}},togglePopover:{enumerable:!0,configurable:!0,value(n){h.get(this)==="showing"&&n===void 0||n===!1?m(this,!0,!0):(n===void 0||n===!0)&&S(this);}}});let t=Element.prototype.attachShadow;t&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(n){let s=t.call(this,n);return I(s),s}}});let o=HTMLElement.prototype.attachInternals;o&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){let n=o.call(this);return n.shadowRoot&&I(n.shadowRoot),n}}});let r=new WeakMap;function i(n){Object.defineProperties(n.prototype,{popoverTargetElement:{enumerable:!0,configurable:!0,set(s){if(s===null)this.removeAttribute("popovertarget"),r.delete(this);else if(s instanceof Element)this.setAttribute("popovertarget",""),r.set(this,s);else throw new TypeError("popoverTargetElement must be an element or null")},get(){if(this.localName!=="button"&&this.localName!=="input"||this.localName==="input"&&this.type!=="reset"&&this.type!=="image"&&this.type!=="button"||this.disabled||this.form&&this.type==="submit")return null;let s=r.get(this);if(s&&s.isConnected)return s;if(s&&!s.isConnected)return r.delete(this),null;let u=v(this),w=this.getAttribute("popovertarget");return (u instanceof Document||u instanceof B)&&w&&u.getElementById(w)||null}},popoverTargetAction:{enumerable:!0,configurable:!0,get(){let s=(this.getAttribute("popovertargetaction")||"").toLowerCase();return s==="show"||s==="hide"?s:"toggle"},set(s){this.setAttribute("popovertargetaction",s);}}});}i(HTMLButtonElement),i(HTMLInputElement);let l=n=>{if(!n.isTrusted)return;let s=n.composedPath()[0];if(!(s instanceof Element)||s?.shadowRoot)return;let u=v(s);if(!(u instanceof B||u instanceof Document))return;let w=s.closest("[popovertargetaction],[popovertarget]");if(w){O(w),n.preventDefault();return}},a=n=>{let s=n.key,u=n.target;!n.defaultPrevented&&u&&(s==="Escape"||s==="Esc")&&T(u.ownerDocument,!0,!0);};(n=>{n.addEventListener("click",l),n.addEventListener("keydown",a),n.addEventListener("pointerdown",x),n.addEventListener("pointerup",x);})(document),I(document);}j()||K();})();
2585
3041
 
2586
- const PostMainnavigation = class {
3042
+ const postPopovercontainerCss = "@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}:where(post-popovercontainer){box-shadow:.5px 3px 4px rgba(0,0,0,.1),2px 4px 10px 4px rgba(0,0,0,.12);position:fixed;z-index:1060;width:max-content;margin:0;padding:0;box-sizing:border-box;color:var(--post-contrast-color);background-color:rgb(var(--post-bg-rgb));border:2px solid rgba(0,0,0,0);border-radius:4px;overflow:visible}:where(post-popovercontainer)[tooltip]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}:where(post-popovercontainer) .arrow{position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}:where(post-popovercontainer) .arrow.top{border-left:2px solid rgba(0,0,0,0);border-top:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.right{border-right:2px solid rgba(0,0,0,0);border-top:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.left{border-left:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.bottom{border-right:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0)}";
3043
+ const PostPopovercontainerStyle0 = postPopovercontainerCss;
3044
+
3045
+ const SIDE_MAP = {
3046
+ top: 'bottom',
3047
+ right: 'left',
3048
+ bottom: 'top',
3049
+ left: 'right',
3050
+ };
3051
+ const PostPopovercontainer = class {
2587
3052
  constructor(hostRef) {
2588
3053
  registerInstance(this, hostRef);
2589
3054
  this.postToggle = createEvent(this, "postToggle", 7);
3055
+ this.placement = 'top';
3056
+ this.edgeGap = 8;
3057
+ this.arrow = false;
2590
3058
  }
2591
- handleMegadropdownToggled(event) {
2592
- // Find next element sibling
2593
- let megalodon;
2594
- let target = event.target;
2595
- while (target !== null) {
2596
- if (target.tagName === 'POST-MEGADROPDOWN') {
2597
- megalodon = target;
2598
- break;
2599
- }
2600
- target = target.nextElementSibling;
2601
- }
2602
- if (megalodon)
2603
- megalodon.toggle(event.target);
3059
+ componentDidLoad() {
3060
+ this.host.setAttribute('popover', '');
3061
+ this.host.addEventListener('beforetoggle', this.handleToggle.bind(this));
2604
3062
  }
2605
- handleBackButtonClick() {
2606
- this.postToggle.emit();
3063
+ disconnectedCallback() {
3064
+ if (typeof this.clearAutoUpdate === 'function')
3065
+ this.clearAutoUpdate();
2607
3066
  }
2608
- render() {
2609
- return (h(Host, { key: '7179d087e93ab9e14dc21e16b52beaf965c53cd3', slot: "post-mainnavigation" }, h("div", { key: '2aede886c29972bf1dfebbe4513c4acf2e47c6ea', onClick: () => this.handleBackButtonClick(), class: "back-button" }, h("slot", { key: '4697ec520be78fccee832a358b349f68081b2f54', name: "back-button" })), h("nav", { key: '5bae57025152af07b9d68a19a07b61d0149d31dc', class: "main-navigation" }, h("slot", { key: 'e2a73a4b814a39a7cb1f7733f87c3c588f484006' }))));
3067
+ /**
3068
+ * Programmatically display the tooltip
3069
+ * @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
3070
+ */
3071
+ async show(target) {
3072
+ if (!this.toggleTimeoutId) {
3073
+ this.eventTarget = target;
3074
+ this.calculatePosition();
3075
+ this.host.showPopover();
3076
+ }
2610
3077
  }
2611
- };
2612
- PostMainnavigation.style = PostMainnavigationStyle0;
2613
-
2614
- const postMegadropdownCss = "*,::before,::after{box-sizing:border-box}post-popovercontainer{background-color:#fafafa;width:100%;border-bottom:1px solid #000}@media screen and (max-width: 1023.99px){post-popovercontainer{position:absolute;top:var(--header-height) !important;bottom:0;left:0;width:100%;height:auto}}.megadropdown{display:flex;gap:1rem;padding:1.5rem;border-radius:0 0 3px 3px}@media screen and (max-width: 1023.99px){.megadropdown{flex-direction:column}}.megadropdown post-list{display:flex;flex-direction:column;gap:.5rem}.megadropdown post-list-item{border-bottom:1px solid gray}.megadropdown post-list-item>a{padding-block:.25rem;display:block;text-decoration:none}.back-button{display:none}@media screen and (max-width: 1023.99px){.back-button{display:block}}post-closebutton{margin-left:auto}@media screen and (max-width: 1023.99px){post-closebutton{display:none}}h3{font-size:20px}";
2615
- const PostMegadropdownStyle0 = postMegadropdownCss;
2616
-
2617
- const PostMegadropdown = class {
2618
- constructor(hostRef) {
2619
- registerInstance(this, hostRef);
3078
+ /**
3079
+ * Programmatically hide this tooltip
3080
+ */
3081
+ async hide() {
3082
+ if (!this.toggleTimeoutId) {
3083
+ this.eventTarget = null;
3084
+ this.host.hidePopover();
3085
+ }
2620
3086
  }
2621
3087
  /**
2622
- * Show megadropdown
2623
- * @param element HTMLElement
2624
- * @returns boolean
3088
+ * Toggle tooltip display
3089
+ * @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
3090
+ * @param force Pass true to always show or false to always hide
2625
3091
  */
2626
- async show(element) {
2627
- return this.popoverRef.show(element);
3092
+ async toggle(target, force) {
3093
+ // Prevent instant double toggle
3094
+ if (!this.toggleTimeoutId) {
3095
+ this.eventTarget = target;
3096
+ this.calculatePosition();
3097
+ this.host.togglePopover(force);
3098
+ this.toggleTimeoutId = null;
3099
+ }
3100
+ return this.host.matches(':where(:popover-open, .popover-open');
2628
3101
  }
2629
3102
  /**
2630
- * Hide megadropdown
2631
- * @returns boolean
3103
+ * Start or stop auto updates based on tooltip events.
3104
+ * Tooltips can be closed or opened with other methods than class members,
3105
+ * therefore listening to the toggle event is safer for cleaning up.
3106
+ * @param e ToggleEvent
2632
3107
  */
2633
- async hide() {
2634
- return this.popoverRef.hide();
3108
+ handleToggle(e) {
3109
+ this.toggleTimeoutId = window.setTimeout(() => (this.toggleTimeoutId = null), 10);
3110
+ const isOpen = e.newState === 'open';
3111
+ if (isOpen) {
3112
+ this.startAutoupdates();
3113
+ }
3114
+ else {
3115
+ if (typeof this.clearAutoUpdate === 'function')
3116
+ this.clearAutoUpdate();
3117
+ }
3118
+ this.postToggle.emit(isOpen);
2635
3119
  }
2636
3120
  /**
2637
- * Toggle megadropdown
2638
- * @param element HTMLElement
2639
- * @param force boolean
2640
- * @returns boolean
3121
+ * Start listening for DOM updates, scroll events etc. that have
3122
+ * an influence on tooltip positioning
2641
3123
  */
2642
- async toggle(element, force) {
2643
- return this.popoverRef.toggle(element, force !== null && force !== void 0 ? force : undefined);
3124
+ startAutoupdates() {
3125
+ this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.calculatePosition.bind(this));
2644
3126
  }
2645
- handleBackButtonClick() {
2646
- this.hide();
3127
+ async calculatePosition() {
3128
+ const gap = this.edgeGap;
3129
+ const middleware = [
3130
+ flip(),
3131
+ inline(),
3132
+ shift({
3133
+ padding: gap,
3134
+ // Prevents shifting away from the anchor too far, while shifting as far as possible
3135
+ // https://floating-ui.com/docs/shift#limiter
3136
+ limiter: limitShift({
3137
+ offset: 32,
3138
+ }),
3139
+ }),
3140
+ size({
3141
+ apply({ availableWidth, elements }) {
3142
+ Object.assign(elements.floating.style, {
3143
+ maxWidth: `${availableWidth - gap * 2}px`,
3144
+ });
3145
+ },
3146
+ }),
3147
+ offset(this.arrow ? gap + 4 : gap), // 4px outside of element to account for focus outline + ~arrow size
3148
+ ];
3149
+ if (this.arrow) {
3150
+ middleware.push(arrow({ element: this.arrowRef, padding: gap }));
3151
+ }
3152
+ const { x, y, middlewareData, placement: currentPlacement, } = await computePosition(this.eventTarget, this.host, {
3153
+ placement: this.placement || 'top',
3154
+ strategy: 'fixed',
3155
+ middleware,
3156
+ });
3157
+ // Tooltip
3158
+ this.host.style.left = `${x}px`;
3159
+ this.host.style.top = `${y}px`;
3160
+ // Arrow
3161
+ if (this.arrow) {
3162
+ // Tutorial: https://codesandbox.io/s/mystifying-kare-ee3hmh?file=/src/index.js
3163
+ const side = currentPlacement.split('-')[0];
3164
+ const { x: arrowX, y: arrowY } = middlewareData.arrow;
3165
+ const staticSide = SIDE_MAP[side];
3166
+ const offsetBorderLineJoin = 2;
3167
+ Object.assign(this.arrowRef.style, {
3168
+ top: arrowY ? `${arrowY}px` : '',
3169
+ left: arrowX ? `${arrowX}px` : '',
3170
+ [staticSide]: `${-this.arrowRef.offsetWidth / 2 - offsetBorderLineJoin}px`,
3171
+ });
3172
+ // Add position as a class to be able to style arrow for HCM
3173
+ this.arrowRef.classList.remove(...Object.values(SIDE_MAP));
3174
+ this.arrowRef.classList.add(staticSide);
3175
+ }
2647
3176
  }
2648
3177
  render() {
2649
- return (h(Host, { key: '9b8e17f4120259f55ed3dbce4780559cb8876540', slot: "post-mainnavigation" }, h("post-popovercontainer", { key: 'ac48d1fffbcdff5aa20d9f2f6fed9beb4dd3be23', placement: "bottom", "edge-gap": "0", ref: el => (this.popoverRef = el) }, h("div", { key: 'af02d9fd35973b6d889b639f1d856dd3d9921ae1', class: "megadropdown" }, h("div", { key: '445aa9b1a04e63c0d2b17466c610a30662f3db0e', onClick: () => this.handleBackButtonClick(), class: "back-button" }, h("slot", { key: '8d8f4cad3d5860fdfc1c615e7122ab5dd2ca5ed3', name: "back-button" })), h("slot", { key: 'c9ba8c0941f86fd29a44153e186cd679bcd678f5' })))));
3178
+ return (h(Host, { key: '23e391236e263f7ae7c66c994b2847bcba269b37', "data-version": version }, this.arrow && (h("span", { key: '6c6053b2fd315a5940a2c3493182249782b2492c', class: "arrow", ref: el => {
3179
+ this.arrowRef = el;
3180
+ } })), h("slot", { key: 'ff998f110f42a22e886eba398285c41d94718bab' })));
2650
3181
  }
3182
+ get host() { return getElement(this); }
2651
3183
  };
2652
- PostMegadropdown.style = PostMegadropdownStyle0;
3184
+ PostPopovercontainer.style = PostPopovercontainerStyle0;
2653
3185
 
2654
- const postMegadropdownTriggerCss = ":host{display:inline-block}";
2655
- const PostMegadropdownTriggerStyle0 = postMegadropdownTriggerCss;
3186
+ const postTogglebuttonCss = ":host{cursor:pointer;outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}:host(:focus-visible){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(:focus-visible){outline-color:Highlight !important}}:host([aria-pressed=true]) ::slotted([data-showwhen=untoggled]){display:none}:host([aria-pressed=false]) ::slotted([data-showwhen=toggled]){display:none}";
3187
+ const PostTogglebuttonStyle0 = postTogglebuttonCss;
2656
3188
 
2657
- const PostMegadropdownTrigger = class {
3189
+ const PostTogglebutton = class {
2658
3190
  constructor(hostRef) {
2659
3191
  registerInstance(this, hostRef);
2660
- this.postToggle = createEvent(this, "postToggle", 7);
3192
+ this.handleClick = () => {
3193
+ this.toggled = !this.toggled;
3194
+ };
3195
+ this.handleKeydown = (event) => {
3196
+ // perform a click when enter or spaced are pressed to mimic the button behavior
3197
+ if (event.key === 'Enter' || event.key === ' ') {
3198
+ event.preventDefault(); // prevents the page from scrolling when space is pressed
3199
+ this.host.click();
3200
+ }
3201
+ };
2661
3202
  this.toggled = false;
2662
3203
  }
2663
- handleClick() {
2664
- this.toggled = !this.toggled;
2665
- this.postToggle.emit();
3204
+ validateToggled(value = this.toggled) {
3205
+ checkType(value, 'boolean', 'The "toggled" property of the post-togglebutton must be a boolean.');
3206
+ }
3207
+ componentWillLoad() {
3208
+ this.validateToggled();
3209
+ // add event listener to not override listener that might be set on the host
3210
+ this.host.addEventListener('click', () => this.handleClick());
3211
+ this.host.addEventListener('keydown', (e) => this.handleKeydown(e));
2666
3212
  }
2667
3213
  render() {
2668
- return (h(Host, { key: 'd139b405fe28c7334c01eec4846a6f8b5bf1e261', slot: "post-megadropdown-trigger" }, h("button", { key: 'd3aee53488359a79764974d440d7a058d5d96873', "aria-expanded": this.toggled, onClick: () => this.handleClick() }, h("slot", { key: '7012055defbb7c8058481db5c4129919847010c6' }))));
3214
+ return (h(Host, { key: 'f20b7e5f7cd14c1b0addf12600df27e7e5dab841', slot: "post-togglebutton", "data-version": version, role: "button", tabindex: "0", "aria-pressed": this.toggled.toString() }, h("slot", { key: '526540ce9a66fa08f0142e674811fe88e3abcfa6' })));
2669
3215
  }
3216
+ get host() { return getElement(this); }
3217
+ static get watchers() { return {
3218
+ "toggled": ["validateToggled"]
3219
+ }; }
2670
3220
  };
2671
- PostMegadropdownTrigger.style = PostMegadropdownTriggerStyle0;
3221
+ PostTogglebutton.style = PostTogglebuttonStyle0;
2672
3222
 
2673
- export { PostClosebutton as P, PostIcon as a, PostLogo as b, PostPopovercontainer as c, PostList as d, PostListItem as e, PostHeader as f, PostMainnavigation as g, PostMegadropdown as h, PostMegadropdownTrigger as i };
3223
+ export { PostClosebutton as P, PostHeader as a, PostIcon as b, PostLanguageOption as c, PostLanguageSwitch as d, PostList as e, PostListItem as f, PostLogo as g, PostMainnavigation as h, PostMegadropdown as i, PostMegadropdownTrigger as j, PostMenu as k, PostMenuTrigger as l, PostPopovercontainer as m, PostTogglebutton as n };