@swisspost/design-system-components 9.0.0-next.3 → 9.0.0-next.30

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 (539) hide show
  1. package/dist/.config/bindings.angular.js +4 -0
  2. package/dist/cjs/{attribute-observer-10f08c04.js → attribute-observer-6d8b886b.js} +4 -4
  3. package/dist/cjs/breakpoints-c6247c71.js +54 -0
  4. package/dist/cjs/check-non-empty-bd99d236.js +15 -0
  5. package/dist/cjs/check-one-of-75d270b5.js +13 -0
  6. package/dist/cjs/check-type-cdbf6d29.js +21 -0
  7. package/dist/cjs/check-url-220a286c.js +19 -0
  8. package/dist/cjs/debounce-158fd76f.js +13 -0
  9. package/dist/cjs/fade-72d5ef55.js +14 -0
  10. package/dist/cjs/get-root-7a3498ef.js +11 -0
  11. package/dist/cjs/index-23e36ff7.js +37 -0
  12. package/dist/cjs/{index-e1f32cce.js → index-d6bf2c66.js} +30 -18
  13. package/dist/cjs/index.browser-2f65f583.js +15 -0
  14. package/dist/cjs/index.cjs.js +56 -30
  15. package/dist/cjs/loader.cjs.js +2 -2
  16. package/dist/cjs/{package-ef26e62c.js → package-c3dbd35b.js} +1 -1
  17. package/dist/cjs/{post-accordion-3878bf43.js → post-accordion-2108bc31.js} +9 -8
  18. package/dist/cjs/post-accordion-item-64051590.js +64 -0
  19. package/dist/cjs/post-accordion-item.cjs.entry.js +8 -5
  20. package/dist/cjs/post-accordion.cjs.entry.js +4 -4
  21. package/dist/cjs/{post-avatar-2bcfc016.js → post-avatar-2db58753.js} +10 -14
  22. package/dist/cjs/post-avatar.cjs.entry.js +4 -4
  23. package/dist/cjs/post-back-to-top-e64d70c8.js +76 -0
  24. package/dist/cjs/post-back-to-top.cjs.entry.js +15 -0
  25. package/dist/cjs/post-banner-caa5e06d.js +96 -0
  26. package/dist/cjs/post-banner.cjs.entry.js +19 -0
  27. package/dist/cjs/post-breadcrumb-acb6890e.js +112 -0
  28. package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +17 -0
  29. package/dist/cjs/post-breadcrumb.cjs.entry.js +13 -0
  30. package/dist/cjs/post-card-control-e2421427.js +283 -0
  31. package/dist/cjs/post-card-control.cjs.entry.js +5 -5
  32. package/dist/cjs/post-closebutton_15.cjs.entry.js +35 -0
  33. package/dist/cjs/{post-collapsible-trigger-6ae59c64.js → post-collapsible-trigger-13b87403.js} +50 -56
  34. package/dist/cjs/post-collapsible_2.cjs.entry.js +10 -6
  35. package/dist/cjs/post-components.cjs.js +2 -2
  36. package/dist/cjs/post-footer-057ce0a8.js +38 -0
  37. package/dist/cjs/post-footer.cjs.entry.js +12 -0
  38. package/dist/cjs/post-linkarea-e2b39f1a.js +30 -0
  39. package/dist/cjs/post-linkarea.cjs.entry.js +11 -0
  40. package/dist/cjs/post-menu-item-3f6c1fcb.js +68 -0
  41. package/dist/cjs/post-popover-dccede57.js +106 -0
  42. package/dist/cjs/post-popover.cjs.entry.js +4 -4
  43. package/dist/cjs/{post-rating-1d2c59b7.js → post-rating-bec67143.js} +16 -6
  44. package/dist/cjs/post-rating.cjs.entry.js +3 -3
  45. package/dist/cjs/post-tab-header-d32947dc.js +33 -0
  46. package/dist/cjs/post-tab-header.cjs.entry.js +5 -4
  47. package/dist/cjs/{post-tab-panel-80b1f3ee.js → post-tab-panel-07d462ac.js} +6 -5
  48. package/dist/cjs/post-tab-panel.cjs.entry.js +4 -3
  49. package/dist/cjs/{post-tabs-c2d42035.js → post-tabs-e5e71053.js} +23 -16
  50. package/dist/cjs/post-tabs.cjs.entry.js +4 -4
  51. package/dist/cjs/post-tag-380a1bf0.js +47 -0
  52. package/dist/cjs/post-tag.cjs.entry.js +3 -3
  53. package/dist/cjs/post-togglebutton-553316f3.js +3965 -0
  54. package/dist/cjs/{post-tooltip-9a120b2e.js → post-tooltip-40812a6b.js} +38 -25
  55. package/dist/cjs/post-tooltip.cjs.entry.js +8 -6
  56. package/dist/cjs/slide-cd1f09b3.js +28 -0
  57. package/dist/collection/animations/collapse.js +5 -5
  58. package/dist/collection/animations/fade.js +6 -2
  59. package/dist/collection/animations/slide.js +23 -0
  60. package/dist/collection/collection-manifest.json +20 -3
  61. package/dist/collection/components/post-accordion/post-accordion.css +1 -1
  62. package/dist/collection/components/post-accordion/post-accordion.js +5 -3
  63. package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
  64. package/dist/collection/components/post-accordion-item/post-accordion-item.js +26 -9
  65. package/dist/collection/components/post-avatar/post-avatar.js +8 -11
  66. package/dist/collection/components/post-back-to-top/post-back-to-top.css +1 -0
  67. package/dist/collection/components/post-back-to-top/post-back-to-top.js +109 -0
  68. package/dist/collection/components/post-banner/banner-types.js +1 -0
  69. package/dist/collection/components/post-banner/post-banner.css +3 -0
  70. package/dist/collection/components/{post-alert/post-alert.js → post-banner/post-banner.js} +50 -72
  71. package/dist/collection/components/post-breadcrumb/post-breadcrumb.css +3 -0
  72. package/dist/collection/components/post-breadcrumb/post-breadcrumb.js +163 -0
  73. package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.css +1 -0
  74. package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +98 -0
  75. package/dist/collection/components/post-card-control/post-card-control.css +1 -1
  76. package/dist/collection/components/post-card-control/post-card-control.js +55 -43
  77. package/dist/collection/components/post-closebutton/post-closebutton.js +13 -0
  78. package/dist/collection/components/post-collapsible/post-collapsible.css +1 -1
  79. package/dist/collection/components/post-collapsible/post-collapsible.js +15 -6
  80. package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +21 -20
  81. package/dist/collection/components/post-footer/post-footer.css +1 -0
  82. package/dist/collection/components/post-footer/post-footer.js +76 -0
  83. package/dist/collection/components/post-header/post-header.css +1 -0
  84. package/dist/collection/components/post-header/post-header.js +323 -0
  85. package/dist/collection/components/post-icon/post-icon.js +79 -46
  86. package/dist/collection/components/post-language-option/post-language-option.css +1 -1
  87. package/dist/collection/components/post-language-option/post-language-option.js +65 -10
  88. package/dist/collection/components/post-language-switch/post-language-switch.css +1 -0
  89. package/dist/collection/components/post-language-switch/post-language-switch.js +192 -0
  90. package/dist/collection/components/post-language-switch/switch-variants.js +1 -0
  91. package/dist/collection/components/post-linkarea/post-linkarea.css +1 -0
  92. package/dist/collection/components/post-linkarea/post-linkarea.js +30 -0
  93. package/dist/collection/components/post-list/post-list.css +3 -0
  94. package/dist/collection/components/post-list/post-list.js +90 -0
  95. package/dist/collection/components/post-list-item/post-list-item.css +1 -0
  96. package/dist/collection/components/post-list-item/post-list-item.js +26 -0
  97. package/dist/collection/components/post-logo/post-logo.css +1 -1
  98. package/dist/collection/components/post-logo/post-logo.js +3 -2
  99. package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -0
  100. package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +267 -0
  101. package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -0
  102. package/dist/collection/components/post-megadropdown/post-megadropdown.js +284 -0
  103. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +1 -0
  104. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +127 -0
  105. package/dist/collection/components/post-menu/post-menu.css +3 -0
  106. package/dist/collection/components/post-menu/post-menu.js +297 -0
  107. package/dist/collection/components/post-menu-item/post-menu-item.js +8 -0
  108. package/dist/collection/components/post-menu-trigger/post-menu-trigger.css +1 -0
  109. package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +122 -0
  110. package/dist/collection/components/post-popover/post-popover.css +1 -1
  111. package/dist/collection/components/post-popover/post-popover.js +6 -3
  112. package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -1
  113. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +203 -39
  114. package/dist/collection/components/post-rating/post-rating.css +1 -1
  115. package/dist/collection/components/post-rating/post-rating.js +13 -2
  116. package/dist/collection/components/post-tab-header/post-tab-header.css +2 -2
  117. package/dist/collection/components/post-tab-header/post-tab-header.js +6 -4
  118. package/dist/collection/components/post-tab-panel/post-tab-panel.js +4 -2
  119. package/dist/collection/components/post-tabs/post-tabs.css +1 -1
  120. package/dist/collection/components/post-tabs/post-tabs.js +17 -14
  121. package/dist/collection/components/post-tag/post-tag.css +1 -1
  122. package/dist/collection/components/post-tag/post-tag.js +3 -2
  123. package/dist/collection/components/post-togglebutton/post-togglebutton.css +1 -0
  124. package/dist/collection/components/post-togglebutton/post-togglebutton.js +75 -0
  125. package/dist/collection/components/post-tooltip/post-tooltip.css +1 -1
  126. package/dist/collection/components/post-tooltip/post-tooltip.js +35 -17
  127. package/dist/collection/index.js +19 -2
  128. package/dist/collection/utils/attribute-observer.js +4 -4
  129. package/dist/collection/utils/breakpoints.js +50 -0
  130. package/dist/collection/utils/component-on-ready.js +4 -4
  131. package/dist/collection/utils/debounce.js +2 -1
  132. package/dist/collection/utils/get-focusable-children.js +33 -0
  133. package/dist/collection/utils/property-checkers/check-non-empty.js +6 -2
  134. package/dist/collection/utils/property-checkers/check-one-of.js +8 -3
  135. package/dist/collection/utils/property-checkers/check-pattern.js +8 -3
  136. package/dist/collection/utils/property-checkers/check-type.js +11 -6
  137. package/dist/collection/utils/property-checkers/check-url.js +11 -6
  138. package/dist/collection/utils/property-checkers/empty-or.js +5 -2
  139. package/dist/collection/utils/sass-export.js +8 -5
  140. package/dist/components/attribute-observer.js +4 -4
  141. package/dist/components/breakpoints.js +52 -0
  142. package/dist/components/check-non-empty.js +6 -2
  143. package/dist/components/check-one-of.js +8 -3
  144. package/dist/components/check-type.js +11 -6
  145. package/dist/components/debounce.js +11 -0
  146. package/dist/components/fade.js +6 -2
  147. package/dist/components/get-focusable-children.js +35 -0
  148. package/dist/components/get-root.js +9 -0
  149. package/dist/components/index.browser.js +13 -0
  150. package/dist/components/index.js +19 -2
  151. package/dist/components/index2.js +25 -12
  152. package/dist/components/package.js +1 -1
  153. package/dist/components/post-accordion-item2.js +33 -14
  154. package/dist/components/post-accordion2.js +6 -5
  155. package/dist/components/post-avatar2.js +7 -11
  156. package/dist/components/post-back-to-top.d.ts +11 -0
  157. package/dist/components/post-back-to-top.js +6 -0
  158. package/dist/components/post-back-to-top2.js +101 -0
  159. package/dist/components/post-banner.d.ts +11 -0
  160. package/dist/components/post-banner.js +6 -0
  161. package/dist/components/post-banner2.js +131 -0
  162. package/dist/components/post-breadcrumb-item.d.ts +11 -0
  163. package/dist/components/post-breadcrumb-item.js +6 -0
  164. package/dist/components/post-breadcrumb-item2.js +82 -0
  165. package/dist/components/post-breadcrumb.d.ts +11 -0
  166. package/dist/components/post-breadcrumb.js +6 -0
  167. package/dist/components/post-breadcrumb2.js +169 -0
  168. package/dist/components/post-card-control2.js +50 -39
  169. package/dist/components/post-closebutton.d.ts +11 -0
  170. package/dist/components/post-closebutton.js +6 -0
  171. package/dist/components/post-closebutton2.js +34 -0
  172. package/dist/components/post-collapsible-trigger2.js +23 -38
  173. package/dist/components/post-collapsible2.js +22 -14
  174. package/dist/components/post-footer.d.ts +11 -0
  175. package/dist/components/post-footer.js +6 -0
  176. package/dist/components/post-footer2.js +78 -0
  177. package/dist/components/post-header.d.ts +11 -0
  178. package/dist/components/post-header.js +6 -0
  179. package/dist/components/post-header2.js +401 -0
  180. package/dist/components/post-icon2.js +81 -45
  181. package/dist/components/post-language-option2.js +32 -14
  182. package/dist/components/post-language-switch.d.ts +11 -0
  183. package/dist/components/post-language-switch.js +6 -0
  184. package/dist/components/post-language-switch2.js +148 -0
  185. package/dist/components/post-linkarea.d.ts +11 -0
  186. package/dist/components/post-linkarea.js +6 -0
  187. package/dist/components/post-linkarea2.js +42 -0
  188. package/dist/components/post-list-item.d.ts +11 -0
  189. package/dist/components/post-list-item.js +6 -0
  190. package/dist/components/post-list-item2.js +35 -0
  191. package/dist/components/{post-alert.d.ts → post-list.d.ts} +4 -4
  192. package/dist/components/post-list.js +6 -0
  193. package/dist/components/post-list2.js +55 -0
  194. package/dist/components/post-logo2.js +4 -4
  195. package/dist/components/post-mainnavigation.d.ts +11 -0
  196. package/dist/components/post-mainnavigation.js +6 -0
  197. package/dist/components/post-mainnavigation2.js +270 -0
  198. package/dist/components/post-megadropdown-trigger.d.ts +11 -0
  199. package/dist/components/post-megadropdown-trigger.js +6 -0
  200. package/dist/components/post-megadropdown-trigger2.js +113 -0
  201. package/dist/components/post-megadropdown.d.ts +11 -0
  202. package/dist/components/post-megadropdown.js +6 -0
  203. package/dist/components/post-megadropdown2.js +198 -0
  204. package/dist/components/post-menu-item.d.ts +11 -0
  205. package/dist/components/post-menu-item.js +6 -0
  206. package/dist/components/post-menu-item2.js +27 -0
  207. package/dist/components/post-menu-trigger.d.ts +11 -0
  208. package/dist/components/post-menu-trigger.js +6 -0
  209. package/dist/components/post-menu-trigger2.js +109 -0
  210. package/dist/components/post-menu.d.ts +11 -0
  211. package/dist/components/post-menu.js +6 -0
  212. package/dist/components/post-menu2.js +193 -0
  213. package/dist/components/post-popover2.js +6 -4
  214. package/dist/components/post-popovercontainer2.js +249 -72
  215. package/dist/components/post-rating2.js +14 -4
  216. package/dist/components/post-tab-header2.js +7 -6
  217. package/dist/components/post-tab-panel2.js +4 -3
  218. package/dist/components/post-tabs2.js +20 -13
  219. package/dist/components/post-tag2.js +3 -3
  220. package/dist/components/post-togglebutton.d.ts +11 -0
  221. package/dist/components/post-togglebutton.js +6 -0
  222. package/dist/components/post-togglebutton2.js +61 -0
  223. package/dist/components/post-tooltip2.js +35 -22
  224. package/dist/components/slide.js +25 -0
  225. package/dist/docs.json +1653 -186
  226. package/dist/esm/{attribute-observer-37fa950a.js → attribute-observer-2f203993.js} +4 -4
  227. package/dist/esm/breakpoints-bbe0c54e.js +52 -0
  228. package/dist/esm/check-non-empty-258a56b3.js +13 -0
  229. package/dist/esm/check-one-of-0bee20f5.js +11 -0
  230. package/dist/esm/check-type-37d5d307.js +19 -0
  231. package/dist/esm/check-url-17962bc8.js +17 -0
  232. package/dist/esm/debounce-e54c7131.js +11 -0
  233. package/dist/esm/fade-1f3cacf4.js +11 -0
  234. package/dist/esm/get-root-7af2e0d1.js +9 -0
  235. package/dist/esm/{index-e1b64755.js → index-3419e46d.js} +30 -18
  236. package/dist/esm/index-8f8fe5b0.js +32 -0
  237. package/dist/esm/index.browser-51485f85.js +13 -0
  238. package/dist/esm/index.js +33 -24
  239. package/dist/esm/loader.js +3 -3
  240. package/dist/esm/package-da1ccbc7.js +3 -0
  241. package/dist/esm/{post-accordion-01d49d83.js → post-accordion-f5e449c0.js} +9 -8
  242. package/dist/esm/post-accordion-item-1195d94a.js +62 -0
  243. package/dist/esm/post-accordion-item.entry.js +8 -5
  244. package/dist/esm/post-accordion.entry.js +4 -4
  245. package/dist/esm/{post-avatar-6f24d1ab.js → post-avatar-9b85c11c.js} +10 -14
  246. package/dist/esm/post-avatar.entry.js +4 -4
  247. package/dist/esm/post-back-to-top-335075d4.js +74 -0
  248. package/dist/esm/post-back-to-top.entry.js +7 -0
  249. package/dist/esm/post-banner-6b939740.js +94 -0
  250. package/dist/esm/post-banner.entry.js +11 -0
  251. package/dist/esm/post-breadcrumb-5a61269c.js +110 -0
  252. package/dist/esm/post-breadcrumb-item_2.entry.js +8 -0
  253. package/dist/esm/post-breadcrumb.entry.js +5 -0
  254. package/dist/esm/post-card-control-7fe3804c.js +281 -0
  255. package/dist/esm/post-card-control.entry.js +5 -5
  256. package/dist/esm/post-closebutton_15.entry.js +13 -0
  257. package/dist/esm/{post-collapsible-trigger-654bf2b0.js → post-collapsible-trigger-e3ef47ff.js} +49 -55
  258. package/dist/esm/post-collapsible_2.entry.js +10 -6
  259. package/dist/esm/post-components.js +3 -3
  260. package/dist/esm/post-footer-e68c21a1.js +36 -0
  261. package/dist/esm/post-footer.entry.js +4 -0
  262. package/dist/esm/post-linkarea-bc607c52.js +28 -0
  263. package/dist/esm/post-linkarea.entry.js +3 -0
  264. package/dist/esm/post-menu-item-ab01683c.js +65 -0
  265. package/dist/esm/{post-popover-7d44a85c.js → post-popover-7427bb6d.js} +9 -7
  266. package/dist/esm/post-popover.entry.js +4 -4
  267. package/dist/esm/{post-rating-3cd3e97b.js → post-rating-16c9ada8.js} +16 -6
  268. package/dist/esm/post-rating.entry.js +3 -3
  269. package/dist/esm/post-tab-header-e0f39999.js +31 -0
  270. package/dist/esm/post-tab-header.entry.js +5 -4
  271. package/dist/esm/{post-tab-panel-163e6c99.js → post-tab-panel-9a8b852c.js} +6 -5
  272. package/dist/esm/post-tab-panel.entry.js +4 -3
  273. package/dist/esm/{post-tabs-8cb1bce9.js → post-tabs-34f70c88.js} +23 -16
  274. package/dist/esm/post-tabs.entry.js +4 -4
  275. package/dist/esm/post-tag-ec5578c2.js +45 -0
  276. package/dist/esm/post-tag.entry.js +3 -3
  277. package/dist/esm/post-togglebutton-5fb5e500.js +3949 -0
  278. package/dist/esm/{post-tooltip-dc7e1a21.js → post-tooltip-c201c4db.js} +38 -25
  279. package/dist/esm/post-tooltip.entry.js +8 -6
  280. package/dist/esm/slide-cd2850ee.js +25 -0
  281. package/dist/post-components/index.esm.js +1 -1
  282. package/dist/post-components/p-02f1cb03.js +1 -0
  283. package/dist/post-components/p-037755f5.js +1 -0
  284. package/dist/post-components/p-11cac89a.js +1 -0
  285. package/dist/post-components/p-181c73d5.js +1 -0
  286. package/dist/post-components/p-2995938c.entry.js +1 -0
  287. package/dist/post-components/p-2adbc7bf.js +1 -0
  288. package/dist/post-components/p-2ea2ced2.js +1 -0
  289. package/dist/post-components/p-2ff7f948.js +1 -0
  290. package/dist/post-components/p-32815e91.js +1 -0
  291. package/dist/post-components/{p-0ad93d89.js → p-33a5eac4.js} +3 -3
  292. package/dist/post-components/p-38c39936.js +1 -0
  293. package/dist/post-components/p-3a9ddb5a.entry.js +1 -0
  294. package/dist/post-components/p-3dbda892.entry.js +1 -0
  295. package/dist/post-components/p-3ea156c8.js +1 -0
  296. package/dist/post-components/p-4620784a.entry.js +1 -0
  297. package/dist/post-components/p-52231570.entry.js +1 -0
  298. package/dist/post-components/p-54ecbfaf.entry.js +1 -0
  299. package/dist/post-components/p-5959f2bd.js +1 -0
  300. package/dist/post-components/p-5aeb3656.js +1 -0
  301. package/dist/post-components/{p-3eab790d.js → p-5c758f41.js} +1 -1
  302. package/dist/post-components/p-61946a7e.js +1 -0
  303. package/dist/post-components/p-64e3de38.js +1 -0
  304. package/dist/post-components/p-66f2e7cb.js +1 -0
  305. package/dist/post-components/p-6912bf0f.entry.js +1 -0
  306. package/dist/post-components/p-691c07e3.entry.js +1 -0
  307. package/dist/post-components/p-6ed2e162.js +1 -0
  308. package/dist/post-components/p-712670a6.js +1 -0
  309. package/dist/post-components/p-7709c14a.js +1 -0
  310. package/dist/post-components/p-7f695ad8.js +1 -0
  311. package/dist/post-components/p-804c1f5f.entry.js +1 -0
  312. package/dist/post-components/p-85fdc2d3.js +1 -0
  313. package/dist/post-components/p-8779d765.entry.js +1 -0
  314. package/dist/post-components/p-8d625b78.entry.js +1 -0
  315. package/dist/post-components/p-9748a355.js +1 -0
  316. package/dist/post-components/p-9b052461.js +1 -0
  317. package/dist/post-components/p-a205b34d.entry.js +1 -0
  318. package/dist/post-components/p-b21729d2.entry.js +1 -0
  319. package/dist/post-components/p-b240727d.js +1 -0
  320. package/dist/post-components/p-b5318286.js +1 -0
  321. package/dist/post-components/p-be16b84d.entry.js +1 -0
  322. package/dist/post-components/p-c222539e.js +1 -0
  323. package/dist/post-components/p-c8afafa1.js +1 -0
  324. package/dist/post-components/p-d295b769.entry.js +1 -0
  325. package/dist/post-components/p-d45df336.js +1 -0
  326. package/dist/post-components/p-d58f5eaf.js +1 -0
  327. package/dist/post-components/p-e1baac59.js +1 -0
  328. package/dist/post-components/p-e585c6fe.js +1 -0
  329. package/dist/post-components/p-e644a698.entry.js +1 -0
  330. package/dist/post-components/p-e689bfbb.entry.js +1 -0
  331. package/dist/post-components/p-f17be52c.entry.js +1 -0
  332. package/dist/post-components/p-f4850dea.entry.js +1 -0
  333. package/dist/post-components/p-fc91cbc2.js +1 -0
  334. package/dist/post-components/post-components.esm.js +1 -1
  335. package/dist/types/animations/collapse.d.ts +2 -2
  336. package/dist/types/animations/fade.d.ts +2 -2
  337. package/dist/types/animations/slide.d.ts +2 -0
  338. package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +8 -2
  339. package/dist/types/components/post-avatar/post-avatar.d.ts +1 -1
  340. package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +19 -0
  341. package/dist/types/components/post-banner/banner-types.d.ts +2 -0
  342. package/dist/types/components/post-banner/post-banner.d.ts +49 -0
  343. package/dist/types/components/post-breadcrumb/post-breadcrumb.d.ts +30 -0
  344. package/dist/types/components/post-breadcrumb-item/post-breadcrumb-item.d.ts +20 -0
  345. package/dist/types/components/post-card-control/post-card-control.d.ts +9 -9
  346. package/dist/types/components/post-closebutton/post-closebutton.d.ts +7 -0
  347. package/dist/types/components/post-footer/post-footer.d.ts +23 -0
  348. package/dist/types/components/post-header/post-header.d.ts +51 -0
  349. package/dist/types/components/post-icon/post-icon.d.ts +13 -11
  350. package/dist/types/components/post-language-option/post-language-option.d.ts +13 -4
  351. package/dist/types/components/post-language-switch/post-language-switch.d.ts +39 -0
  352. package/dist/types/components/post-language-switch/switch-variants.d.ts +2 -0
  353. package/dist/types/components/post-linkarea/post-linkarea.d.ts +5 -0
  354. package/dist/types/components/post-list/post-list.d.ts +24 -0
  355. package/dist/types/components/post-list-item/post-list-item.d.ts +8 -0
  356. package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +71 -0
  357. package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +59 -0
  358. package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +31 -0
  359. package/dist/types/components/post-menu/post-menu.d.ts +48 -0
  360. package/dist/types/components/post-menu-item/post-menu-item.d.ts +3 -0
  361. package/dist/types/components/post-menu-trigger/post-menu-trigger.d.ts +28 -0
  362. package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +27 -1
  363. package/dist/types/components/post-tab-header/post-tab-header.d.ts +1 -1
  364. package/dist/types/components/post-tabs/post-tabs.d.ts +1 -1
  365. package/dist/types/components/post-tag/post-tag.d.ts +1 -1
  366. package/dist/types/components/post-togglebutton/post-togglebutton.d.ts +15 -0
  367. package/dist/types/components.d.ts +532 -76
  368. package/dist/types/home/runner/work/design-system/design-system/packages/components/.stencil/.config/bindings.angular.d.ts +2 -0
  369. package/dist/types/index.d.ts +20 -3
  370. package/dist/types/utils/attribute-observer.d.ts +1 -1
  371. package/dist/types/utils/breakpoints.d.ts +12 -0
  372. package/dist/types/utils/component-on-ready.d.ts +1 -1
  373. package/dist/types/utils/get-focusable-children.d.ts +1 -0
  374. package/dist/types/utils/get-root.d.ts +1 -1
  375. package/dist/types/utils/property-checkers/check-non-empty.d.ts +3 -1
  376. package/dist/types/utils/property-checkers/check-one-of.d.ts +3 -1
  377. package/dist/types/utils/property-checkers/check-pattern.d.ts +3 -1
  378. package/dist/types/utils/property-checkers/check-type.d.ts +3 -1
  379. package/dist/types/utils/property-checkers/check-url.d.ts +3 -1
  380. package/dist/types/utils/property-checkers/index.d.ts +12 -4
  381. package/dist/types/utils/sass-export.d.ts +5 -1
  382. package/loaders/attribute-observer.js +4 -4
  383. package/loaders/breakpoints.js +52 -0
  384. package/loaders/check-non-empty.js +6 -2
  385. package/loaders/check-one-of.js +8 -3
  386. package/loaders/check-type.js +11 -6
  387. package/loaders/debounce.js +11 -0
  388. package/loaders/fade.js +6 -2
  389. package/loaders/get-focusable-children.js +35 -0
  390. package/loaders/get-root.js +9 -0
  391. package/loaders/index.browser.js +13 -0
  392. package/loaders/index.d.ts +36 -2
  393. package/loaders/index.js +20 -2
  394. package/loaders/index2.js +25 -12
  395. package/loaders/package.js +1 -1
  396. package/loaders/post-accordion-item.js +1 -82
  397. package/loaders/post-accordion-item2.js +103 -0
  398. package/loaders/post-accordion.js +6 -5
  399. package/loaders/post-avatar.js +7 -11
  400. package/loaders/post-back-to-top.d.ts +11 -0
  401. package/loaders/post-back-to-top.js +104 -0
  402. package/loaders/post-banner.d.ts +11 -0
  403. package/loaders/post-banner.js +134 -0
  404. package/loaders/post-breadcrumb-item.d.ts +11 -0
  405. package/loaders/post-breadcrumb-item.js +6 -0
  406. package/loaders/post-breadcrumb-item2.js +82 -0
  407. package/loaders/post-breadcrumb.d.ts +11 -0
  408. package/loaders/post-breadcrumb.js +172 -0
  409. package/loaders/post-card-control.js +50 -39
  410. package/loaders/post-closebutton.d.ts +11 -0
  411. package/loaders/post-closebutton.js +37 -0
  412. package/loaders/post-collapsible-trigger2.js +23 -38
  413. package/loaders/post-collapsible2.js +21 -13
  414. package/loaders/post-footer.d.ts +11 -0
  415. package/loaders/post-footer.js +81 -0
  416. package/loaders/post-header.d.ts +11 -0
  417. package/loaders/post-header.js +404 -0
  418. package/loaders/post-icon2.js +81 -45
  419. package/loaders/post-language-option.js +31 -13
  420. package/loaders/post-language-switch.d.ts +11 -0
  421. package/loaders/post-language-switch.js +151 -0
  422. package/loaders/post-linkarea.d.ts +11 -0
  423. package/loaders/post-linkarea.js +45 -0
  424. package/loaders/post-list-item.d.ts +11 -0
  425. package/loaders/post-list-item.js +38 -0
  426. package/loaders/{post-alert.d.ts → post-list.d.ts} +4 -4
  427. package/loaders/post-list.js +58 -0
  428. package/loaders/post-logo.js +5 -5
  429. package/loaders/post-mainnavigation.d.ts +11 -0
  430. package/loaders/post-mainnavigation.js +273 -0
  431. package/loaders/post-megadropdown-trigger.d.ts +11 -0
  432. package/loaders/post-megadropdown-trigger.js +116 -0
  433. package/loaders/post-megadropdown.d.ts +11 -0
  434. package/loaders/post-megadropdown.js +201 -0
  435. package/loaders/post-menu-item.d.ts +11 -0
  436. package/loaders/post-menu-item.js +6 -0
  437. package/loaders/post-menu-item2.js +27 -0
  438. package/loaders/post-menu-trigger.d.ts +11 -0
  439. package/loaders/post-menu-trigger.js +6 -0
  440. package/loaders/post-menu-trigger2.js +109 -0
  441. package/loaders/post-menu.d.ts +11 -0
  442. package/loaders/post-menu.js +6 -0
  443. package/loaders/post-menu2.js +193 -0
  444. package/loaders/post-popover.js +6 -4
  445. package/loaders/post-popovercontainer2.js +249 -72
  446. package/loaders/post-rating.js +14 -4
  447. package/loaders/post-tab-header.js +7 -6
  448. package/loaders/post-tab-panel.js +4 -3
  449. package/loaders/post-tabs.js +20 -13
  450. package/loaders/post-tag.js +3 -3
  451. package/loaders/post-togglebutton.d.ts +11 -0
  452. package/loaders/post-togglebutton.js +64 -0
  453. package/loaders/post-tooltip.js +34 -21
  454. package/loaders/slide.js +25 -0
  455. package/package.json +26 -20
  456. package/dist/cjs/check-non-empty-eeaa8f77.js +0 -11
  457. package/dist/cjs/check-one-of-f4f5d0c0.js +0 -8
  458. package/dist/cjs/fade-35a3633a.js +0 -10
  459. package/dist/cjs/index-01f30442.js +0 -52
  460. package/dist/cjs/post-accordion-item-0278e6e2.js +0 -52
  461. package/dist/cjs/post-alert-5f795d9c.js +0 -98
  462. package/dist/cjs/post-alert.cjs.entry.js +0 -16
  463. package/dist/cjs/post-card-control-5ffcd201.js +0 -272
  464. package/dist/cjs/post-icon-1f71aa0f.js +0 -104
  465. package/dist/cjs/post-icon.cjs.entry.js +0 -15
  466. package/dist/cjs/post-language-option-4a3ecaeb.js +0 -67
  467. package/dist/cjs/post-language-option.cjs.entry.js +0 -14
  468. package/dist/cjs/post-logo-7070d727.js +0 -39
  469. package/dist/cjs/post-logo.cjs.entry.js +0 -14
  470. package/dist/cjs/post-popover-de1b8d95.js +0 -104
  471. package/dist/cjs/post-popovercontainer-6a25713a.js +0 -2186
  472. package/dist/cjs/post-popovercontainer.cjs.entry.js +0 -11
  473. package/dist/cjs/post-tab-header-877676bf.js +0 -32
  474. package/dist/cjs/post-tag-5e2c7798.js +0 -47
  475. package/dist/collection/components/post-alert/alert-types.js +0 -1
  476. package/dist/collection/components/post-alert/post-alert.css +0 -7
  477. package/dist/components/post-alert.js +0 -6
  478. package/dist/components/post-alert2.js +0 -136
  479. package/dist/esm/check-non-empty-58bd6b17.js +0 -9
  480. package/dist/esm/check-one-of-6b3ef8eb.js +0 -6
  481. package/dist/esm/fade-7fd71785.js +0 -7
  482. package/dist/esm/index-f41b763f.js +0 -46
  483. package/dist/esm/package-0311770e.js +0 -3
  484. package/dist/esm/post-accordion-item-366f385b.js +0 -50
  485. package/dist/esm/post-alert-5a69f40d.js +0 -96
  486. package/dist/esm/post-alert.entry.js +0 -8
  487. package/dist/esm/post-card-control-2a7939c3.js +0 -270
  488. package/dist/esm/post-icon-885f17e9.js +0 -102
  489. package/dist/esm/post-icon.entry.js +0 -7
  490. package/dist/esm/post-language-option-0c2818aa.js +0 -65
  491. package/dist/esm/post-language-option.entry.js +0 -6
  492. package/dist/esm/post-logo-dd425f2e.js +0 -37
  493. package/dist/esm/post-logo.entry.js +0 -6
  494. package/dist/esm/post-popovercontainer-e6d11d81.js +0 -2184
  495. package/dist/esm/post-popovercontainer.entry.js +0 -3
  496. package/dist/esm/post-tab-header-776a991a.js +0 -30
  497. package/dist/esm/post-tag-deefcc86.js +0 -45
  498. package/dist/post-components/p-048538ea.js +0 -1
  499. package/dist/post-components/p-0a1f5e13.entry.js +0 -1
  500. package/dist/post-components/p-0a4318ff.js +0 -1
  501. package/dist/post-components/p-0d64ef0c.entry.js +0 -1
  502. package/dist/post-components/p-1198a5f2.entry.js +0 -1
  503. package/dist/post-components/p-13d1bef7.entry.js +0 -1
  504. package/dist/post-components/p-16d057a6.js +0 -1
  505. package/dist/post-components/p-1a091fca.entry.js +0 -1
  506. package/dist/post-components/p-1f35b0ba.entry.js +0 -1
  507. package/dist/post-components/p-246a6d28.js +0 -1
  508. package/dist/post-components/p-2737eaf5.js +0 -1
  509. package/dist/post-components/p-3aa5e1e5.js +0 -1
  510. package/dist/post-components/p-3d3795f9.js +0 -1
  511. package/dist/post-components/p-3fabf6e4.entry.js +0 -1
  512. package/dist/post-components/p-4f0617e6.js +0 -1
  513. package/dist/post-components/p-53bacbbc.js +0 -1
  514. package/dist/post-components/p-5c8cb76f.entry.js +0 -1
  515. package/dist/post-components/p-5eee8d31.entry.js +0 -1
  516. package/dist/post-components/p-60e72b25.js +0 -1
  517. package/dist/post-components/p-611b3c41.js +0 -1
  518. package/dist/post-components/p-66ed33a9.js +0 -1
  519. package/dist/post-components/p-681b751d.entry.js +0 -1
  520. package/dist/post-components/p-6adeaa6c.js +0 -1
  521. package/dist/post-components/p-6b6a1e82.entry.js +0 -1
  522. package/dist/post-components/p-752e6a98.entry.js +0 -1
  523. package/dist/post-components/p-8734876e.js +0 -1
  524. package/dist/post-components/p-9ac2a947.js +0 -1
  525. package/dist/post-components/p-9d211a45.js +0 -1
  526. package/dist/post-components/p-b095519d.js +0 -1
  527. package/dist/post-components/p-b38eaabf.js +0 -1
  528. package/dist/post-components/p-cdfcc758.entry.js +0 -1
  529. package/dist/post-components/p-d50d4ec1.entry.js +0 -1
  530. package/dist/post-components/p-d785856c.js +0 -1
  531. package/dist/post-components/p-deb4131c.js +0 -1
  532. package/dist/post-components/p-e18f3639.js +0 -1
  533. package/dist/post-components/p-f1b7797f.entry.js +0 -1
  534. package/dist/post-components/p-f6efc76b.entry.js +0 -1
  535. package/dist/post-components/p-f825d681.js +0 -1
  536. package/dist/post-components/p-fff1c2ee.entry.js +0 -1
  537. package/dist/types/components/post-alert/alert-types.d.ts +0 -2
  538. package/dist/types/components/post-alert/post-alert.d.ts +0 -54
  539. package/loaders/post-alert.js +0 -139
@@ -0,0 +1,3949 @@
1
+ import { r as registerInstance, g as getElement, h, H as Host, c as createEvent } from './index-3419e46d.js';
2
+ import { v as version } from './package-da1ccbc7.js';
3
+ import { a as slideUp, s as slideDown } from './slide-cd2850ee.js';
4
+ import { c as checkEmptyOrOneOf, d as checkEmptyOrType, b as checkEmptyOrUrl } from './index-8f8fe5b0.js';
5
+ import { c as checkNonEmpty } from './check-non-empty-258a56b3.js';
6
+ import { c as checkType } from './check-type-37d5d307.js';
7
+ import { n as nanoid } from './index.browser-51485f85.js';
8
+ import { b as breakpoint } from './breakpoints-bbe0c54e.js';
9
+ import { g as getRoot } from './get-root-7af2e0d1.js';
10
+
11
+ const PostClosebutton = class {
12
+ constructor(hostRef) {
13
+ registerInstance(this, hostRef);
14
+ }
15
+ get host() { return getElement(this); }
16
+ render() {
17
+ return (h(Host, { key: 'c03f50379252ba13992bc3d021989ac07dba9f79', "data-version": version }, h("button", { key: 'e97a86bb6e1eace89a1a3a78fb231047f065dd5e', class: "btn btn-icon-close", type: "button" }, h("post-icon", { key: 'aca522d4c251a8183c91c2bd4d810d0716a2fe13', "aria-hidden": "true", name: "closex" }), h("span", { key: '6873522961b1683d1261163b07ee022f93eed836', class: "visually-hidden" }, h("slot", { key: 'bf4b13356c9a0164f1481d1fedc3a78a53e5f8e0' })))));
18
+ }
19
+ };
20
+
21
+ /* eslint-disable no-undefined,no-param-reassign,no-shadow */
22
+
23
+ /**
24
+ * Throttle execution of a function. Especially useful for rate limiting
25
+ * execution of handlers on events like resize and scroll.
26
+ *
27
+ * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
28
+ * are most useful.
29
+ * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
30
+ * as-is, to `callback` when the throttled-function is executed.
31
+ * @param {object} [options] - An object to configure options.
32
+ * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
33
+ * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
34
+ * one final time after the last throttled-function call. (After the throttled-function has not been called for
35
+ * `delay` milliseconds, the internal counter is reset).
36
+ * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
37
+ * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
38
+ * callback will never executed if both noLeading = true and noTrailing = true.
39
+ * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
40
+ * false (at end), schedule `callback` to execute after `delay` ms.
41
+ *
42
+ * @returns {Function} A new, throttled, function.
43
+ */
44
+ function throttle (delay, callback, options) {
45
+ var _ref = options || {},
46
+ _ref$noTrailing = _ref.noTrailing,
47
+ noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,
48
+ _ref$noLeading = _ref.noLeading,
49
+ noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,
50
+ _ref$debounceMode = _ref.debounceMode,
51
+ debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;
52
+ /*
53
+ * After wrapper has stopped being called, this timeout ensures that
54
+ * `callback` is executed at the proper times in `throttle` and `end`
55
+ * debounce modes.
56
+ */
57
+ var timeoutID;
58
+ var cancelled = false;
59
+
60
+ // Keep track of the last time `callback` was executed.
61
+ var lastExec = 0;
62
+
63
+ // Function to clear existing timeout
64
+ function clearExistingTimeout() {
65
+ if (timeoutID) {
66
+ clearTimeout(timeoutID);
67
+ }
68
+ }
69
+
70
+ // Function to cancel next exec
71
+ function cancel(options) {
72
+ var _ref2 = options || {},
73
+ _ref2$upcomingOnly = _ref2.upcomingOnly,
74
+ upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
75
+ clearExistingTimeout();
76
+ cancelled = !upcomingOnly;
77
+ }
78
+
79
+ /*
80
+ * The `wrapper` function encapsulates all of the throttling / debouncing
81
+ * functionality and when executed will limit the rate at which `callback`
82
+ * is executed.
83
+ */
84
+ function wrapper() {
85
+ for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
86
+ arguments_[_key] = arguments[_key];
87
+ }
88
+ var self = this;
89
+ var elapsed = Date.now() - lastExec;
90
+ if (cancelled) {
91
+ return;
92
+ }
93
+
94
+ // Execute `callback` and update the `lastExec` timestamp.
95
+ function exec() {
96
+ lastExec = Date.now();
97
+ callback.apply(self, arguments_);
98
+ }
99
+
100
+ /*
101
+ * If `debounceMode` is true (at begin) this is used to clear the flag
102
+ * to allow future `callback` executions.
103
+ */
104
+ function clear() {
105
+ timeoutID = undefined;
106
+ }
107
+ if (!noLeading && debounceMode && !timeoutID) {
108
+ /*
109
+ * Since `wrapper` is being called for the first time and
110
+ * `debounceMode` is true (at begin), execute `callback`
111
+ * and noLeading != true.
112
+ */
113
+ exec();
114
+ }
115
+ clearExistingTimeout();
116
+ if (debounceMode === undefined && elapsed > delay) {
117
+ if (noLeading) {
118
+ /*
119
+ * In throttle mode with noLeading, if `delay` time has
120
+ * been exceeded, update `lastExec` and schedule `callback`
121
+ * to execute after `delay` ms.
122
+ */
123
+ lastExec = Date.now();
124
+ if (!noTrailing) {
125
+ timeoutID = setTimeout(debounceMode ? clear : exec, delay);
126
+ }
127
+ } else {
128
+ /*
129
+ * In throttle mode without noLeading, if `delay` time has been exceeded, execute
130
+ * `callback`.
131
+ */
132
+ exec();
133
+ }
134
+ } else if (noTrailing !== true) {
135
+ /*
136
+ * In trailing throttle mode, since `delay` time has not been
137
+ * exceeded, schedule `callback` to execute `delay` ms after most
138
+ * recent execution.
139
+ *
140
+ * If `debounceMode` is true (at begin), schedule `clear` to execute
141
+ * after `delay` ms.
142
+ *
143
+ * If `debounceMode` is false (at end), schedule `callback` to
144
+ * execute after `delay` ms.
145
+ */
146
+ timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
147
+ }
148
+ }
149
+ wrapper.cancel = cancel;
150
+
151
+ // Return the wrapper function.
152
+ return wrapper;
153
+ }
154
+
155
+ const focusableSelector = `:where(${[
156
+ 'button',
157
+ 'input:not([type="hidden"])',
158
+ '[tabindex]',
159
+ 'select',
160
+ 'textarea',
161
+ '[contenteditable]',
162
+ 'a[href]',
163
+ 'iframe',
164
+ 'audio[controls]',
165
+ 'video[controls]',
166
+ 'area[href]',
167
+ 'details > summary:first-of-type',
168
+ ].join(',')})`;
169
+ const focusDisablingSelector = `:where(${[
170
+ '[inert]',
171
+ '[inert] *',
172
+ ':disabled',
173
+ 'dialog:not([open]) *',
174
+ '[popover]:not(:popover-open) *',
175
+ 'details:not([open]) > *:not(details > summary:first-of-type)',
176
+ 'details:not([open]) > *:not(details > summary:first-of-type) *',
177
+ '[tabindex^="-"]',
178
+ '[hidden]:not([hidden="false"])',
179
+ ].join(',')})`;
180
+ function getFocusableChildren(element) {
181
+ const focusableChildren = element.querySelectorAll(`${focusableSelector}:not(${focusDisablingSelector})`);
182
+ const visibleFocusableChildren = Array.from(focusableChildren).filter(child => {
183
+ const style = window.getComputedStyle(child.parentElement);
184
+ return style.display !== 'none' && style.visibility !== 'hidden';
185
+ });
186
+ return visibleFocusableChildren;
187
+ }
188
+
189
+ const postHeaderCss = "*,::before,::after{box-sizing:border-box}:host{z-index:1020;position:relative}:host(:not(:has([slot=title]))) .local-header{padding-block-start:0}:host(:not(:has([slot=title]))) .local-sub{display:none}.d-flex{display:flex}.space-between{justify-content:space-between}.global-header{background-color:#fc0;display:flex;justify-content:space-between;position:sticky;padding-inline:4px;height:var(--global-header-height)}@media screen and (max-width: 1023.98px){.global-header{z-index:3;inset-block-start:0}}@media screen and (min-width: 1024px){.global-header{z-index:5;padding-inline-end:12px;inset-block-start:calc((var(--global-header-height) - var(--global-header-reduced-height))*-1)}}.global-sub{display:flex;align-items:center;gap:24px}.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-reduced-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 !important;list-style:none;display:flex;padding-left:0;gap:1rem;flex-shrink:0 !important}.local-header{display:flex;position:sticky;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:4px;min-height:var(--local-header-min-height);background:#fff;transition:box-shadow .2s ease-in-out}.local-header::after{content:\"\";position:absolute;width:100%;height:1px;background-color:#e1e0dc;bottom:-1px;z-index:1}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.local-header::after{background-color:Highlight}}@media screen and (min-width: 1024px){.local-header{z-index:3;inset-block-start:calc(-1*(var(--local-header-height) - var(--main-navigation-height)) + var(--global-header-reduced-height));padding-block-start:18px;box-shadow:var(--post-device-elevation-300)}}@media screen and (max-width: 1023.98px){.local-header{z-index:2;inset-block-start:var(--global-header-height);padding-block:12px;flex-wrap:wrap;gap:16px}.local-header.local-header-mobile-extended::after{bottom:0}.local-header:not(.local-header-mobile-extended){box-shadow:var(--post-device-elevation-300)}}.local-sub{margin-inline-end:16px}::slotted(.list-inline){margin:0 !important;z-index:3 !important;position:relative !important}@media screen and (min-width: 1024px){.mobile-toggle{display:none}}.navigation{width:100%}@media screen and (min-width: 1024px){.navigation{inset-block-start:var(--global-header-reduced-height)}.navigation::before{display:block;content:\"\";position:absolute;inset:0;z-index:2;background:#fff}}@media screen and (max-width: 1023.98px){.navigation{position:fixed;z-index:1;inset-inline:0;inset-block-start:calc(var(--header-scroll-top) + var(--header-height))}.mobile-menu{background-color:#fafafa}::slotted(post-mainnavigation),.navigation-footer{display:none;flex-direction:column;padding-block:16px 24px;padding-inline:32px}.navigation.extended ::slotted(post-mainnavigation),.navigation.extended .navigation-footer{display:flex}.navigation.extended>div{display:flex;flex-direction:column;overflow-y:auto;overflow-x:hidden;height:calc(min(var(--header-scroll-parent-height, 100dvh),100dvh) - var(--header-height))}.navigation.extended.megadropdown-open>div{overflow-y:hidden}.navigation.extended ::slotted(post-mainnavigation){flex-grow:1 !important}::slotted(post-mainnavigation){gap:32px}.navigation-footer{background-color:#f0efed;gap:24px}}@media screen and (max-width: 599.98px){::slotted(post-mainnavigation),.navigation-footer{padding-inline:16px}}";
190
+ const PostHeaderStyle0 = postHeaderCss;
191
+
192
+ const PostHeader = class {
193
+ firstFocusableEl;
194
+ lastFocusableEl;
195
+ mobileMenu;
196
+ mobileMenuAnimation;
197
+ throttledResize = throttle(50, () => this.handleResize());
198
+ scrollParentResizeObserver;
199
+ localHeaderResizeObserver;
200
+ get scrollParent() {
201
+ const frozenScrollParent = document.querySelector('[data-post-scroll-locked]');
202
+ if (frozenScrollParent)
203
+ return frozenScrollParent;
204
+ let element = this.host.parentElement;
205
+ while (element) {
206
+ const overflow = getComputedStyle(element).overflowY;
207
+ if (['auto', 'scroll'].includes(overflow)) {
208
+ return element;
209
+ }
210
+ element = element.parentElement;
211
+ }
212
+ return document.body;
213
+ }
214
+ get host() { return getElement(this); }
215
+ lockBody(newValue, _oldValue, propName) {
216
+ const scrollParent = this.scrollParent;
217
+ const mobileMenuExtended = propName === 'mobileMenuExtended' ? newValue : this.mobileMenuExtended;
218
+ if (this.device !== 'desktop' && mobileMenuExtended) {
219
+ scrollParent.setAttribute('data-post-scroll-locked', '');
220
+ this.host.addEventListener('keydown', this.keyboardHandler);
221
+ }
222
+ else {
223
+ scrollParent.removeAttribute('data-post-scroll-locked');
224
+ this.host.removeEventListener('keydown', this.keyboardHandler);
225
+ }
226
+ }
227
+ /**
228
+ * An event emitted when the device has changed
229
+ */
230
+ postUpdateDevice;
231
+ constructor(hostRef) {
232
+ registerInstance(this, hostRef);
233
+ this.postUpdateDevice = createEvent(this, "postUpdateDevice", 7);
234
+ this.device = null;
235
+ this.mobileMenuExtended = false;
236
+ this.megadropdownOpen = false;
237
+ this.handleScrollEvent = this.handleScrollEvent.bind(this);
238
+ this.updateScrollParentHeight = this.updateScrollParentHeight.bind(this);
239
+ this.updateLocalHeaderHeight = this.updateLocalHeaderHeight.bind(this);
240
+ this.megedropdownStateHandler = this.megedropdownStateHandler.bind(this);
241
+ this.keyboardHandler = this.keyboardHandler.bind(this);
242
+ this.handleLinkClick = this.handleLinkClick.bind(this);
243
+ }
244
+ connectedCallback() {
245
+ window.addEventListener('resize', this.throttledResize, { passive: true });
246
+ window.addEventListener('scroll', this.handleScrollEvent, {
247
+ passive: true,
248
+ });
249
+ this.scrollParent.addEventListener('scroll', this.handleScrollEvent, {
250
+ passive: true,
251
+ });
252
+ document.addEventListener('postToggleMegadropdown', this.megedropdownStateHandler);
253
+ this.host.addEventListener('click', this.handleLinkClick);
254
+ this.handleResize();
255
+ this.handleScrollEvent();
256
+ this.handleScrollParentResize();
257
+ this.lockBody(false, this.mobileMenuExtended, 'mobileMenuExtended');
258
+ }
259
+ componentDidRender() {
260
+ this.getFocusableElements();
261
+ this.handleLocalHeaderResize();
262
+ }
263
+ // Clean up possible side effects when post-header is disconnected
264
+ disconnectedCallback() {
265
+ const scrollParent = this.scrollParent;
266
+ window.removeEventListener('resize', this.throttledResize);
267
+ window.removeEventListener('scroll', this.handleScrollEvent);
268
+ scrollParent.removeEventListener('scroll', this.handleScrollEvent);
269
+ document.removeEventListener('postToggleMegadropdown', this.megedropdownStateHandler);
270
+ this.host.removeEventListener('keydown', this.keyboardHandler);
271
+ this.host.removeEventListener('click', this.handleLinkClick);
272
+ if (this.scrollParentResizeObserver) {
273
+ this.scrollParentResizeObserver.disconnect();
274
+ this.scrollParentResizeObserver = null;
275
+ }
276
+ if (this.localHeaderResizeObserver) {
277
+ this.localHeaderResizeObserver.disconnect();
278
+ this.localHeaderResizeObserver = null;
279
+ }
280
+ this.mobileMenuExtended = false;
281
+ }
282
+ /**
283
+ * Toggles the mobile navigation.
284
+ */
285
+ async toggleMobileMenu(force) {
286
+ if (this.device === 'desktop')
287
+ return;
288
+ this.mobileMenuAnimation = this.mobileMenuExtended
289
+ ? slideUp(this.mobileMenu)
290
+ : slideDown(this.mobileMenu);
291
+ // Update the state of the toggle button
292
+ const menuButton = this.host.querySelector('post-togglebutton');
293
+ menuButton.toggled = force ?? !this.mobileMenuExtended;
294
+ // Toggle menu visibility before it slides down and after it slides back up
295
+ if (this.mobileMenuExtended)
296
+ await this.mobileMenuAnimation.finished;
297
+ this.mobileMenuExtended = force ?? !this.mobileMenuExtended;
298
+ if (this.mobileMenuExtended === false) {
299
+ Array.from(this.host.querySelectorAll('post-megadropdown')).forEach(dropdown => {
300
+ dropdown.hide(false, true);
301
+ });
302
+ }
303
+ }
304
+ megedropdownStateHandler(event) {
305
+ this.megadropdownOpen = event.detail.isVisible;
306
+ }
307
+ // Get all the focusable elements in the post-header mobile menu
308
+ getFocusableElements() {
309
+ // Get elements in the correct order (different as the DOM order)
310
+ const focusableEls = [
311
+ ...Array.from(this.host.querySelectorAll('.list-inline:not([slot="meta-navigation"]) > li')),
312
+ ...Array.from(this.host.querySelectorAll('nav > post-list > div > post-list-item, post-mainnavigation > .back-button, post-megadropdown-trigger')),
313
+ ...Array.from(this.host.querySelectorAll('.list-inline[slot="meta-navigation"] > li, post-language-option')),
314
+ ];
315
+ // Add the main toggle menu button to the list of focusable children
316
+ const focusableChildren = [
317
+ this.host.querySelector('post-togglebutton'),
318
+ ...focusableEls.flatMap(el => Array.from(getFocusableChildren(el))),
319
+ ];
320
+ this.firstFocusableEl = focusableChildren[0];
321
+ this.lastFocusableEl = focusableChildren[focusableChildren.length - 1];
322
+ }
323
+ keyboardHandler(e) {
324
+ if (e.key === 'Tab' && this.mobileMenuExtended) {
325
+ if (e.shiftKey && document.activeElement === this.firstFocusableEl) {
326
+ // If back tab (Tab + Shift) and first element is focused, focus goes to the last element of the megadropdown
327
+ e.preventDefault();
328
+ this.lastFocusableEl.focus();
329
+ }
330
+ else if (!e.shiftKey && document.activeElement === this.lastFocusableEl) {
331
+ // If Tab and last element is focused, focus goes back to the first element of the megadropdown
332
+ e.preventDefault();
333
+ this.firstFocusableEl.focus();
334
+ }
335
+ }
336
+ }
337
+ handleScrollEvent() {
338
+ const scrollTop = this.scrollParent === document.body ? window.scrollY : this.scrollParent.scrollTop;
339
+ this.host.style.setProperty('--header-scroll-top', `${scrollTop}px`);
340
+ }
341
+ updateLocalHeaderHeight() {
342
+ const localHeaderHeight = this.host.shadowRoot.querySelector('.local-header')?.clientHeight || 0;
343
+ this.host.style.setProperty('--local-header-height', `${localHeaderHeight}px`);
344
+ }
345
+ updateScrollParentHeight() {
346
+ this.host.style.setProperty('--header-scroll-parent-height', `${this.scrollParent.clientHeight}px`);
347
+ }
348
+ handleLinkClick(event) {
349
+ const target = event.target;
350
+ const isLinkInMainNav = target.closest('post-mainnavigation a');
351
+ const isLinkInMegadropdown = target.closest('post-megadropdown a');
352
+ if (!isLinkInMainNav && !isLinkInMegadropdown) {
353
+ return;
354
+ }
355
+ if (this.mobileMenuExtended && (isLinkInMainNav || isLinkInMegadropdown)) {
356
+ this.toggleMobileMenu(false);
357
+ }
358
+ if (this.device === 'desktop' && isLinkInMegadropdown) {
359
+ const megadropdownLink = target.closest('post-megadropdown a');
360
+ if (megadropdownLink) {
361
+ target.closest('post-megadropdown').hide(true);
362
+ }
363
+ }
364
+ }
365
+ handleResize() {
366
+ const previousDevice = this.device;
367
+ let newDevice;
368
+ const width = window?.innerWidth;
369
+ if (width >= 1024) {
370
+ newDevice = 'desktop';
371
+ }
372
+ else if (width >= 600) {
373
+ newDevice = 'tablet';
374
+ }
375
+ else {
376
+ newDevice = 'mobile';
377
+ }
378
+ // Apply only on change for doing work only when necessary
379
+ if (newDevice !== previousDevice) {
380
+ this.device = newDevice;
381
+ this.postUpdateDevice.emit(this.device);
382
+ window.requestAnimationFrame(() => {
383
+ this.switchLanguageSwitchMode();
384
+ });
385
+ }
386
+ }
387
+ handleScrollParentResize() {
388
+ if (this.scrollParent) {
389
+ this.scrollParentResizeObserver = new ResizeObserver(this.updateScrollParentHeight);
390
+ this.scrollParentResizeObserver.observe(this.scrollParent);
391
+ }
392
+ }
393
+ handleLocalHeaderResize() {
394
+ const localHeader = this.host.shadowRoot.querySelector('.local-header');
395
+ if (localHeader && !this.localHeaderResizeObserver) {
396
+ this.localHeaderResizeObserver = new ResizeObserver(this.updateLocalHeaderHeight);
397
+ this.localHeaderResizeObserver.observe(localHeader);
398
+ }
399
+ }
400
+ switchLanguageSwitchMode() {
401
+ const variant = this.device === 'desktop' ? 'menu' : 'list';
402
+ Array.from(this.host.querySelectorAll('post-language-switch')).forEach(languageSwitch => {
403
+ languageSwitch?.setAttribute('variant', variant);
404
+ });
405
+ }
406
+ renderNavigation() {
407
+ const navigationClasses = ['navigation'];
408
+ const mobileMenuScrollTop = this.mobileMenu?.scrollTop ?? 0;
409
+ if (this.mobileMenuExtended) {
410
+ navigationClasses.push('extended');
411
+ }
412
+ if (this.megadropdownOpen) {
413
+ navigationClasses.push('megadropdown-open');
414
+ }
415
+ return (h("div", { class: navigationClasses.join(' '), style: { '--header-navigation-current-inset': `${mobileMenuScrollTop}px` } }, h("div", { class: "mobile-menu", ref: el => (this.mobileMenu = el) }, h("slot", { name: "post-mainnavigation" }), (this.device === 'mobile' || this.device === 'tablet') && (h("div", { class: "navigation-footer" }, h("slot", { name: "meta-navigation" }), h("slot", { name: "post-language-switch" }))))));
416
+ }
417
+ render() {
418
+ return (h(Host, { key: '1cc6cb8fb53d744a3e857b39fe6d59dcc52616f6', version: version }, h("div", { key: 'f2b0993095d6173cd6e6652f68a6d86cccaca0cf', class: "global-header" }, h("div", { key: '3199a8bfe40e617b9aa41235a836b0346afe3f5f', class: "global-sub" }, h("div", { key: 'acf05b7b78ca758b75b4c999a262506dc43b1692', class: "logo" }, h("slot", { key: '21d50a2e983f3572ce33828fd69a3eff01983206', name: "post-logo" }))), h("div", { key: '7222c559dca81ae94b18a5a88825169fa05b887e', class: "global-sub" }, this.device === 'desktop' && h("slot", { key: '4948c8d13318987f9c419ac73d901e558f763d0d', name: "meta-navigation" }), h("slot", { key: '2a10e4dc73716b3fd39fd9fb534678c6203f60e3', name: "global-controls" }), this.device === 'desktop' && h("slot", { key: '5786dcda4ca017500916ea4c9da604da46a0e2f5', name: "post-language-switch" }), h("div", { key: 'a2326d26003bb8101dc0236426b26f1f11bdd9df', onClick: () => this.toggleMobileMenu(), class: "mobile-toggle" }, h("slot", { key: 'e75d428c8a5644bcd979607de1ca85ad435e096d', name: "post-togglebutton" })))), h("div", { key: 'c40d1e10ce6e13e2cae5f8395ad9281dce50975e', class: 'local-header ' + (this.mobileMenuExtended ? 'local-header-mobile-extended' : '') }, h("slot", { key: 'e37002ea2d9d74fdfa0773cb2ca90f7e9560f193', name: "title" }), h("div", { key: 'fe1e158e00458d1232c5b0e9ae22c63e77b25ac6', class: "local-sub" }, h("slot", { key: '4b504f9652a403cf89b0a371a803251923758155', name: "local-controls" }), h("slot", { key: 'c02b89240f8df106f138bc14312031511c5462f6' })), this.device === 'desktop' && this.renderNavigation()), this.device !== 'desktop' && this.renderNavigation()));
419
+ }
420
+ static get watchers() { return {
421
+ "device": ["lockBody"],
422
+ "mobileMenuExtended": ["lockBody"]
423
+ }; }
424
+ };
425
+ PostHeader.style = PostHeaderStyle0;
426
+
427
+ const postIconCss = ":host{display:inline-block;width:1em;height:1em;vertical-align:-0.15em}span{display:block;width:100%;height:100%;fill:currentColor;forced-color-adjust:preserve-parent-color;background-color:currentColor;-webkit-mask-position:center center;mask-position:center center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:100%;mask-size:100%}: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)}}";
428
+ const PostIconStyle0 = postIconCss;
429
+
430
+ const CDN_URL = 'https://unpkg.com/@swisspost/design-system-icons/public/post-icons/';
431
+ const ANIMATION_NAMES = [
432
+ 'cylon',
433
+ 'cylon-vertical',
434
+ 'spin',
435
+ 'spin-reverse',
436
+ 'fade',
437
+ 'throb',
438
+ ];
439
+ const ANIMATION_KEYS = [...ANIMATION_NAMES];
440
+ const PostIcon = class {
441
+ constructor(hostRef) {
442
+ registerInstance(this, hostRef);
443
+ this.animation = null;
444
+ this.base = null;
445
+ this.flipH = false;
446
+ this.flipV = false;
447
+ this.name = undefined;
448
+ this.rotate = null;
449
+ this.scale = null;
450
+ }
451
+ isSSR = typeof window === 'undefined';
452
+ get host() { return getElement(this); }
453
+ validateAnimation(newValue = this.animation) {
454
+ if (newValue !== undefined)
455
+ checkEmptyOrOneOf(this, 'animation', ANIMATION_KEYS);
456
+ }
457
+ validateBase() {
458
+ checkEmptyOrType(this, 'base', 'string');
459
+ }
460
+ validateFlipH() {
461
+ checkEmptyOrType(this, 'flipH', 'boolean');
462
+ }
463
+ validateFlipV() {
464
+ checkEmptyOrType(this, 'flipV', 'boolean');
465
+ }
466
+ validateName() {
467
+ checkNonEmpty(this, 'name');
468
+ checkType(this, 'name', 'string');
469
+ }
470
+ validateRotate() {
471
+ checkEmptyOrType(this, 'rotate', 'number');
472
+ }
473
+ validateScale() {
474
+ checkEmptyOrType(this, 'scale', 'number');
475
+ }
476
+ // Construct the icon url from different possible sources
477
+ getUrl() {
478
+ let url;
479
+ const file = `${this.name}.svg`;
480
+ // the first definition object which defines a domain, will be used to set the domain of the file url
481
+ // the first definition object which defines a slug, will be used to set the slug of the file url
482
+ const urlDefinitions = [this.getUrlDefinition(this.base, 'both')];
483
+ if (!this.isSSR) {
484
+ urlDefinitions.push(this.getUrlDefinition(document.head
485
+ .querySelector('meta[name="design-system-settings"][data-post-icon-base]')
486
+ ?.getAttribute('data-post-icon-base'), 'relative'));
487
+ urlDefinitions.push(this.getUrlDefinition(document.querySelector('base[href]')?.getAttribute('href'), 'both'));
488
+ }
489
+ // in case no definition defines a domain, a relative url is used to load the icon
490
+ const origin = urlDefinitions.find(d => d.definesDomain)?.url?.origin;
491
+ // in case no definition defines a slug either, the cdn url is used as a fallback
492
+ const slug = urlDefinitions.find(d => d.definesSlug)?.url?.pathname;
493
+ if (origin && slug) {
494
+ url = `${origin}${slug}${file}`;
495
+ }
496
+ else if (!origin && slug) {
497
+ url = `${slug}${file}`;
498
+ }
499
+ else {
500
+ url = `${CDN_URL}${file}`;
501
+ }
502
+ return url;
503
+ }
504
+ getUrlDefinition(url, allow) {
505
+ return {
506
+ url: this.getUrlObject(url),
507
+ definesDomain: allow !== 'relative' ? this.definesDomain(url) : false,
508
+ definesSlug: allow !== 'absolute' ? this.definesSlug(url) : false,
509
+ };
510
+ }
511
+ getUrlObject(url) {
512
+ if (url) {
513
+ url = url?.endsWith('/') ? url : `${url}/`;
514
+ return new URL(url, 'https://url.base');
515
+ }
516
+ else {
517
+ return null;
518
+ }
519
+ }
520
+ definesDomain(url) {
521
+ return url ? /^https?:\/\//.test(url) : false;
522
+ }
523
+ definesSlug(url) {
524
+ return Boolean(/^\/.+/.test(this.getUrlObject(url)?.pathname));
525
+ }
526
+ getStyles() {
527
+ const url = this.getUrl();
528
+ return Object.entries({
529
+ '-webkit-mask-image': `url(${url})`,
530
+ 'mask-image': `url('${url}')`,
531
+ 'transform': (this.scale && !isNaN(Number(this.scale)) ? 'scale(' + this.scale + ')' : '') +
532
+ (this.rotate && !isNaN(Number(this.rotate)) ? ' rotate(' + this.rotate + 'deg)' : ''),
533
+ })
534
+ .filter(([_key, value]) => value !== null)
535
+ .reduce((styles, [key, value]) => Object.assign(styles, { [key]: value }), {});
536
+ }
537
+ componentDidLoad() {
538
+ this.validateBase();
539
+ this.validateName();
540
+ this.validateFlipH();
541
+ this.validateFlipV();
542
+ this.validateScale();
543
+ this.validateRotate();
544
+ this.validateAnimation();
545
+ }
546
+ render() {
547
+ return (h(Host, { key: 'c80aaf693f730902c4ae57ca78360eee5dedf624', "data-version": version }, h("span", { key: '7e01e1cf7e4fec380e8f054d3cc8fa5404c7a829', style: this.getStyles() })));
548
+ }
549
+ static get watchers() { return {
550
+ "animation": ["validateAnimation"],
551
+ "base": ["validateBase"],
552
+ "flipH": ["validateFlipH"],
553
+ "flipV": ["validateFlipV"],
554
+ "name": ["validateName"],
555
+ "rotate": ["validateRotate"],
556
+ "scale": ["validateScale"]
557
+ }; }
558
+ };
559
+ PostIcon.style = PostIconStyle0;
560
+
561
+ const postLanguageOptionCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */post-language-option{display:inline-block}post-language-option button{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option button{background-color:ButtonFace !important}post-language-option button:hover{background-color:Highlight !important}}post-language-option a{color:inherit;text-decoration:none}post-language-option :is(a,button){cursor:pointer;display:flex;align-items:center;justify-content:center;width:100%;height:100%;border-radius:2px;text-transform:uppercase}post-language-option :is(a,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-language-option :is(a,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-language-option :is(a,button):is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-language-option :is(a,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-language-option :is(a,button):is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}post-language-option:where([variant=list]) :is(a,button){padding-inline:0;width:40px;height:40px;border-radius:2px}post-language-option:where([variant=list]) :is(a,button):hover{color:#504f4b}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option:where([variant=list]) :is(a,button){border:1px solid ButtonBorder;color:ButtonText}}post-language-option:where([variant=list])[active]:not([active=false]) :is(a,button){background-color:#050400 !important;color:#fff;pointer-events:none}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option:where([variant=list])[active]:not([active=false]) :is(a,button){background-color:Highlight !important}}post-language-option:where([variant=menu]){min-width:72px}post-language-option:where([variant=menu])[active]:not([active=false]){display:none}post-language-option:where([variant=menu]) :is(a,button){padding-block:13px;padding-inline:16px;box-sizing:border-box;justify-content:flex-start;position:relative}post-language-option:where([variant=menu]) :is(a,button):hover{color:#fff;background-color:#504f4b}";
562
+ const PostLanguageOptionStyle0 = postLanguageOptionCss;
563
+
564
+ const PostLanguageOption = class {
565
+ constructor(hostRef) {
566
+ registerInstance(this, hostRef);
567
+ this.postChange = createEvent(this, "postChange", 7);
568
+ this.postLanguageOptionInitiallyActive = createEvent(this, "postLanguageOptionInitiallyActive", 7);
569
+ this.code = undefined;
570
+ this.active = undefined;
571
+ this.variant = undefined;
572
+ this.name = undefined;
573
+ this.url = undefined;
574
+ }
575
+ get host() { return getElement(this); }
576
+ validateCode() {
577
+ checkType(this, 'code', 'string');
578
+ }
579
+ validateActiveProp() {
580
+ checkEmptyOrType(this, 'active', 'boolean');
581
+ }
582
+ validateName() {
583
+ checkEmptyOrType(this, 'name', 'string');
584
+ }
585
+ validateUrl() {
586
+ checkEmptyOrType(this, 'url', 'string');
587
+ }
588
+ componentDidLoad() {
589
+ this.validateCode();
590
+ this.validateActiveProp();
591
+ this.validateName();
592
+ this.validateUrl();
593
+ if (!this.name && this.isNameRequired()) {
594
+ throw new Error('The "name" property of the post-language-option component is required when the full language name is not displayed.');
595
+ }
596
+ if (this.active) {
597
+ this.postLanguageOptionInitiallyActive.emit(this.code);
598
+ }
599
+ }
600
+ /**
601
+ * An event emitted when the language option is clicked. The payload is the ISO 639 code of the language.
602
+ */
603
+ postChange;
604
+ /**
605
+ * An event emitted when the language option is initially active. The payload is the ISO 639 code of the language.
606
+ */
607
+ postLanguageOptionInitiallyActive;
608
+ /**
609
+ * Selects the language option programmatically.
610
+ */
611
+ async select() {
612
+ this.active = true;
613
+ this.emitChange();
614
+ }
615
+ emitChange() {
616
+ this.postChange.emit(this.code);
617
+ }
618
+ isNameRequired() {
619
+ return this.host.textContent.toLowerCase() === this.code.toLowerCase();
620
+ }
621
+ render() {
622
+ const lang = this.code.toLowerCase();
623
+ const emitOnKeyDown = (e) => {
624
+ if (e.key === 'Enter' || e.key === ' ') {
625
+ this.emitChange();
626
+ }
627
+ };
628
+ return (h(Host, { key: '23bf186d9cc718b2697cbc5bc54b44f6c9ead54f', "data-version": version, role: this.variant ? `${this.variant}item` : null }, this.url ? (h("a", { "aria-current": this.active ? 'page' : undefined, "aria-label": this.name, href: this.url, hrefLang: lang, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null))) : (h("button", { "aria-current": this.active ? 'true' : undefined, "aria-label": this.name, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null)))));
629
+ }
630
+ static get watchers() { return {
631
+ "code": ["validateCode"],
632
+ "active": ["validateActiveProp"],
633
+ "name": ["validateName"],
634
+ "url": ["validateUrl"]
635
+ }; }
636
+ };
637
+ PostLanguageOption.style = PostLanguageOptionStyle0;
638
+
639
+ const SWITCH_VARIANTS = ['list', 'menu'];
640
+
641
+ const postLanguageSwitchCss = ":host{display:flex !important;flex-wrap:wrap;gap:.5rem}.post-language-switch-dropdown-container{display:flex;flex-direction:column}.post-language-switch-trigger{cursor:pointer;text-transform:uppercase;padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-decoration:none;display:inline-flex;align-items:center;gap:6px;border-radius:24px;font-size:16px;padding:3px 10px}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger{background-color:ButtonFace !important}.post-language-switch-trigger:hover{background-color:Highlight !important}}.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:24px;width:24px}.post-language-switch-trigger[aria-expanded=true]{background-color:#050400;color:#fff}.post-language-switch-trigger[aria-expanded=true] post-icon{transform:rotate(180deg)}.post-language-switch-trigger[aria-expanded=true]:hover{background-color:#504f4b;color:#fff}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger{border:1px solid ButtonBorder}.post-language-switch-trigger[aria-expanded=true] post-icon,.post-language-switch-trigger:hover post-icon{color:HighlightText}}";
642
+ const PostLanguageSwitchStyle0 = postLanguageSwitchCss;
643
+
644
+ const PostLanguageSwitch = class {
645
+ constructor(hostRef) {
646
+ registerInstance(this, hostRef);
647
+ this.caption = undefined;
648
+ this.description = undefined;
649
+ this.variant = 'list';
650
+ this.activeLang = undefined;
651
+ }
652
+ get host() { return getElement(this); }
653
+ validateCaption() {
654
+ checkType(this, 'caption', 'string');
655
+ }
656
+ validateDescription() {
657
+ checkType(this, 'description', 'string');
658
+ }
659
+ validateVariant() {
660
+ checkEmptyOrOneOf(this, 'variant', SWITCH_VARIANTS);
661
+ this.updateChildrenVariant();
662
+ }
663
+ componentDidLoad() {
664
+ this.validateCaption();
665
+ this.validateDescription();
666
+ this.validateVariant();
667
+ // Initially set variants and active language
668
+ // Handles cases where the language-switch is rendered after the language-options have been rendered
669
+ this.updateChildrenVariant();
670
+ this.updateActiveLanguage();
671
+ }
672
+ handlePostChange(event) {
673
+ this.activeLang = event.detail;
674
+ // Update the active state in the children post-language-option components
675
+ this.languageOptions.forEach(lang => {
676
+ if (lang.code && lang.code === this.activeLang) {
677
+ lang.setAttribute('active', '');
678
+ }
679
+ else {
680
+ lang.removeAttribute('active');
681
+ }
682
+ });
683
+ // Hides the dropdown when an option has been clicked
684
+ if (this.variant === 'menu') {
685
+ const menu = this.host.shadowRoot.querySelector('post-menu');
686
+ menu.hide();
687
+ }
688
+ }
689
+ /**
690
+ * Handles cases where the language switch is being rendered before options are available
691
+ * @param event Initially emitted by <post-langauge-option>
692
+ */
693
+ handleInitiallyActive(event) {
694
+ this.activeLang = event.detail;
695
+ }
696
+ get languageOptions() {
697
+ return this.host.querySelectorAll('post-language-option');
698
+ }
699
+ get activeLanguageOption() {
700
+ return this.host.querySelector('post-language-option[active]:not([active="false"])');
701
+ }
702
+ handleSlotChange() {
703
+ this.updateActiveLanguage();
704
+ }
705
+ updateActiveLanguage() {
706
+ this.activeLang = this.activeLanguageOption.getAttribute('code');
707
+ }
708
+ // Update post-language-option variant to have the correct style
709
+ updateChildrenVariant() {
710
+ this.languageOptions.forEach(el => {
711
+ el.setAttribute('variant', this.variant);
712
+ });
713
+ }
714
+ menuId = `p${nanoid(11)}`;
715
+ renderList() {
716
+ return (h(Host, { "data-version": version, role: "list", "aria-label": this.caption }, h("div", { class: "post-language-switch-list", role: "group", "aria-label": this.description }, h("slot", { onSlotchange: () => this.handleSlotChange() }))));
717
+ }
718
+ renderDropdown() {
719
+ return (h(Host, { "data-version": version }, h("post-menu-trigger", { for: this.menuId }, h("button", { class: "post-language-switch-trigger", "aria-label": this.description }, this.activeLang, h("post-icon", { "aria-hidden": "true", name: "chevrondown" }))), h("post-menu", { id: this.menuId, class: "post-language-switch-dropdown-container", "aria-label": this.caption }, h("slot", { onSlotchange: () => this.handleSlotChange() }))));
720
+ }
721
+ render() {
722
+ return this.variant === 'list' ? this.renderList() : this.renderDropdown();
723
+ }
724
+ static get watchers() { return {
725
+ "caption": ["validateCaption"],
726
+ "description": ["validateDescription"],
727
+ "variant": ["validateVariant"]
728
+ }; }
729
+ };
730
+ PostLanguageSwitch.style = PostLanguageSwitchStyle0;
731
+
732
+ 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}";
733
+ const PostListStyle0 = postListCss;
734
+
735
+ const PostList = class {
736
+ constructor(hostRef) {
737
+ registerInstance(this, hostRef);
738
+ this.titleId = undefined;
739
+ this.titleHidden = false;
740
+ this.horizontal = false;
741
+ }
742
+ get host() { return getElement(this); }
743
+ titleEl;
744
+ componentWillLoad() {
745
+ /**
746
+ * Get the id set on the host element or use a random id by default
747
+ */
748
+ this.titleId = `title-${this.host.id || nanoid(6)}`;
749
+ }
750
+ componentDidLoad() {
751
+ this.checkTitle();
752
+ }
753
+ checkTitle() {
754
+ if (!this.titleEl.textContent.trim()) {
755
+ console.error('Please provide a title to the list component. Title is mandatory for accessibility purposes.');
756
+ }
757
+ }
758
+ render() {
759
+ return (h(Host, { key: '085a63d7b4cc85461f2c8fd0c7b9d9f48f42055a', "data-version": version }, h("div", { key: 'd13a66ba16b71eff1a86666b04ca2f41957962e1', ref: el => (this.titleEl = el), id: this.titleId, class: `list-title${this.titleHidden ? ' visually-hidden' : ''}` }, h("slot", { key: '0270bcd71c8a3a34390b98b6374a1a2f06e0d606' })), h("div", { key: 'de04b08bf94900435c53f972c8fcd0798c8a5faf', role: "list", "aria-labelledby": this.titleId }, h("slot", { key: 'f7aa9976b3283ee4da3d32d84b36e2549c29e80f', name: "post-list-item" }))));
760
+ }
761
+ };
762
+ PostList.style = PostListStyle0;
763
+
764
+ const postListItemCss = ":host{display:flex}";
765
+ const PostListItemStyle0 = postListItemCss;
766
+
767
+ const PostListItem = class {
768
+ constructor(hostRef) {
769
+ registerInstance(this, hostRef);
770
+ }
771
+ get host() { return getElement(this); }
772
+ connectedCallback() {
773
+ this.host.setAttribute('slot', 'post-list-item');
774
+ }
775
+ render() {
776
+ return (h(Host, { key: '8e209e77859bd05d62cae41aec9dec6fb2e820cb', role: "listitem", slot: "post-list-item" }, h("slot", { key: 'ce79a335e80401465b74208957e22983d6df4ce0' })));
777
+ }
778
+ };
779
+ PostListItem.style = PostListItemStyle0;
780
+
781
+ 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}.logo-link{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}.logo-link: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){.logo-link:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.logo-link: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){.logo-link:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.logo-link :focus,:focus-visible{border-radius:2px}";
782
+ const PostLogoStyle0 = postLogoCss;
783
+
784
+ const PostLogo = class {
785
+ constructor(hostRef) {
786
+ registerInstance(this, hostRef);
787
+ this.url = undefined;
788
+ }
789
+ get host() { return getElement(this); }
790
+ validateUrl() {
791
+ checkEmptyOrUrl(this, 'url');
792
+ }
793
+ componentDidLoad() {
794
+ this.validateUrl();
795
+ this.checkDescription();
796
+ }
797
+ checkDescription() {
798
+ if (!this.host.textContent) {
799
+ console.warn('Be sure to add descriptive text in the post-logo to ensure good accessibility of the component.');
800
+ }
801
+ }
802
+ render() {
803
+ const logoLink = this.url && (typeof this.url === 'string' ? this.url : this.url.href);
804
+ const LogoTag = logoLink ? 'a' : 'span';
805
+ return (h(Host, { key: '128604612a51624b537f30b0b9c91d9ea6b950be', "data-version": version }, h(LogoTag, { key: '885f057200f9da839fd38cb7070f319f6c89793e', class: `logo ${logoLink ? 'logo-link' : ''}`, ...(logoLink ? { href: logoLink } : {}) }, h("span", { key: 'bee12585bf74fe5c2ce8a644c540c86626295526', class: "description" }, h("slot", { key: 'e516075c5138cef9378d3dc7137eb6c28d02b279', onSlotchange: () => this.checkDescription() })), h("svg", { key: 'c0056463b93f7c0e5da07db4656d9c8dc9161c32', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 72 72", "aria-hidden": "true" }, h("g", { key: '1dfc33886c9b1fb6cd3b08f448a89c11a6080598', id: "Logo" }, h("rect", { key: 'dd84426568259714379a92a3f56349c6b3220a61', fill: "#ffcc00", x: "0", y: "0", width: "72", height: "72" }), h("polygon", { key: '56fa6445c184a41355a968365098b75387a16f48', 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: 'f2abb1db77a2e795f477662453d7296a28882756', 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" }))))));
806
+ }
807
+ static get watchers() { return {
808
+ "url": ["validateUrl"]
809
+ }; }
810
+ };
811
+ PostLogo.style = PostLogoStyle0;
812
+
813
+ 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:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-align:start}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button{background-color:ButtonFace !important}post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:Highlight !important}}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item post-megadropdown-trigger button{flex:0 0 fit-content;white-space:nowrap;display:flex;align-items:center;justify-content:space-between}post-mainnavigation post-list-item>a: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 post-megadropdown-trigger button:focus-visible{border-radius:4px;outline-offset:-2px !important}post-mainnavigation .back-button post-icon{transform:rotate(180deg)}@media screen and (max-width: 1023.98px){post-mainnavigation .back-button{font-size:16px}}@media screen and (max-width: 599.98px){post-mainnavigation .back-button{font-size:14px}}post-mainnavigation>button::after,post-mainnavigation post-megadropdown-trigger button::after{content:\"\";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:24px;width:24px}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation>button,post-mainnavigation post-megadropdown-trigger button{border:1px solid ButtonBorder !important}post-mainnavigation>button:hover::after,post-mainnavigation>button[aria-expanded=true]::after,post-mainnavigation post-megadropdown-trigger button:hover::after,post-mainnavigation post-megadropdown-trigger button[aria-expanded=true]::after{color:HighlightText}}@media screen and (min-width: 1024px){post-mainnavigation{display:block;overflow-x:hidden}post-mainnavigation nav{max-width:100%;background:#fff;max-height:var(--main-navigation-height);user-select:none;transition:margin 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation .left-scroll-button,post-mainnavigation .right-scroll-button{z-index:4;position:absolute;inset-block-end:0;overflow:hidden}post-mainnavigation .left-scroll-button button,post-mainnavigation .right-scroll-button button{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;background:#fff;padding:16px;box-shadow:var(--post-device-elevation-500);line-height:100%;height:var(--main-navigation-height)}}@media screen and (min-width: 1024px)and (forced-colors: active),screen and (min-width: 1024px)and (-ms-high-contrast: active),screen and (min-width: 1024px)and (-ms-high-contrast: white-on-black){post-mainnavigation .left-scroll-button button,post-mainnavigation .right-scroll-button button{background-color:ButtonFace !important}post-mainnavigation .left-scroll-button button:hover,post-mainnavigation .right-scroll-button button:hover{background-color:Highlight !important}}@media screen and (min-width: 1024px){post-mainnavigation .left-scroll-button button post-icon,post-mainnavigation .right-scroll-button button post-icon{font-size:1rem}}@media screen and (min-width: 1024px){post-mainnavigation .left-scroll-button.d-none,post-mainnavigation .right-scroll-button.d-none{display:none}}@media screen and (min-width: 1024px){post-mainnavigation .left-scroll-button{inset-inline-start:0;padding-inline-end:2rem}}@media screen and (min-width: 1024px){post-mainnavigation .right-scroll-button{inset-inline-end:0;padding-inline-start:2rem}}@media screen and (min-width: 1024px){post-mainnavigation post-list>[role=list]{flex-direction:row;max-width:100vw}}@media screen and (min-width: 1024px){post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{position:sticky;padding-inline:12px;height:var(--main-navigation-height);gap:4px;font-size:16px;z-index:4}post-mainnavigation post-list-item>a .nav-el-active,post-mainnavigation post-list-item>button .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-active{font-weight:700;text-align:center;opacity:0}post-mainnavigation post-list-item>a .nav-el-inactive,post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{position:absolute;opacity:1;text-align:center;width:100%;left:0}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]{background-color:#050400;color:#fff;font-weight:700}post-mainnavigation post-list-item>a.selected .nav-el-active,post-mainnavigation post-list-item>a[aria-expanded=true] .nav-el-active,post-mainnavigation post-list-item>button.selected .nav-el-active,post-mainnavigation post-list-item>button[aria-expanded=true] .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button.selected .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true] .nav-el-active{opacity:1}post-mainnavigation post-list-item>a.selected .nav-el-inactive,post-mainnavigation post-list-item>a[aria-expanded=true] .nav-el-inactive,post-mainnavigation post-list-item>button.selected .nav-el-inactive,post-mainnavigation post-list-item>button[aria-expanded=true] .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button.selected .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true] .nav-el-inactive{opacity:0}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:#504f4b;color:#fff}}@media screen and (min-width: 1024px)and (max-width: 599.98px){post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{font-size:14px}}@media screen and (min-width: 1024px){post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{padding-inline-end:12px;transition:border-block-end-color 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{width:calc(100% - 28px)}post-mainnavigation post-list-item>button::after,post-mainnavigation post-list-item post-megadropdown-trigger button::after{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)}}@media screen and (min-width: 1024px){post-mainnavigation post-megadropdown button:not(.btn-icon-close),post-mainnavigation post-megadropdown a{width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative}post-mainnavigation post-megadropdown button:not(.btn-icon-close)::before,post-mainnavigation post-megadropdown a::before{content:\"\";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}post-mainnavigation post-megadropdown button:not(.btn-icon-close).selected,post-mainnavigation post-megadropdown button:not(.btn-icon-close)[aria-expanded=true],post-mainnavigation post-megadropdown a.selected,post-mainnavigation post-megadropdown a[aria-expanded=true]{background-color:#050400;color:#fff}post-mainnavigation post-megadropdown button:not(.btn-icon-close):hover,post-mainnavigation post-megadropdown a:hover{background-color:#504f4b;color:#fff}post-mainnavigation post-megadropdown button:not(.btn-icon-close):hover::before,post-mainnavigation post-megadropdown a:hover::before{background-color:#504f4b}}@media screen and (min-width: 1024px){post-mainnavigation [slot=back-button]{display:none}}@media screen and (max-width: 1023.98px){post-mainnavigation nav{transform:none !important}post-mainnavigation .left-scroll-button,post-mainnavigation .right-scroll-button{display:none}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative}post-mainnavigation post-list-item>a::before,post-mainnavigation post-list-item>button::before,post-mainnavigation post-list-item post-megadropdown-trigger button::before{content:\"\";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}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]{background-color:#050400;color:#fff}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:#504f4b;color:#fff}post-mainnavigation post-list-item>a:hover::before,post-mainnavigation post-list-item>button:hover::before,post-mainnavigation post-list-item post-megadropdown-trigger button:hover::before{background-color:#504f4b}post-mainnavigation post-list-item>a .nav-el-inactive,post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{display:none}post-mainnavigation>button::after,post-mainnavigation post-megadropdown-trigger button::after{transform:rotate(-90deg)}}post-mainnavigation .back-button .btn{padding-inline:0}";
814
+ const PostMainnavigationStyle0 = postMainnavigationCss;
815
+
816
+ const SCROLL_REPEAT_INTERVAL = 100; // Interval for repeated scrolling when holding down scroll button
817
+ const NAVBAR_DISABLE_DURATION = 400; // Duration to temporarily disable navbar interactions during scrolling
818
+ const NAVIGATION_LIST_SELECTOR = 'post-list > [role="list"]:not(post-megadropdown *)';
819
+ const NAVIGATION_ITEM_SELECTOR = 'post-list-item :is(a, button):not(post-megadropdown *)';
820
+ const PostMainnavigation = class {
821
+ constructor(hostRef) {
822
+ registerInstance(this, hostRef);
823
+ this.canScrollLeft = false;
824
+ this.canScrollRight = false;
825
+ this.translationAmount = 0;
826
+ }
827
+ header;
828
+ navbar;
829
+ rightScrollButton;
830
+ leftScrollButton;
831
+ scrollRepeatInterval;
832
+ navbarDisableTimer;
833
+ resizeObserver;
834
+ mutationObserver = new MutationObserver(async (mutations) => {
835
+ // Wait for all elements to be hydrated
836
+ await Promise.all(mutations
837
+ .flatMap((mutation) => Array.from(mutation.addedNodes))
838
+ .map((item) => item.componentOnReady ? item.componentOnReady() : Promise.resolve(item)));
839
+ // Recalculate scrollability after DOM changes
840
+ this.checkScrollability();
841
+ });
842
+ get host() { return getElement(this); }
843
+ /**
844
+ * Update navbar translation when 'translateAmount' changes and recalculate scrollability
845
+ */
846
+ onTranslateAmountChanges(value) {
847
+ this.navbar.style.marginInlineStart = `-${value}px`;
848
+ this.checkScrollability();
849
+ }
850
+ /**
851
+ * Retrieves a reference to the closest 'post-header' element when the main navigation is added to the DOM.
852
+ * This ensures that we can interact with the header for mobile menu toggling.
853
+ */
854
+ connectedCallback() {
855
+ this.header = this.host.closest('post-header');
856
+ }
857
+ /**
858
+ * Cleans up references and disconnects the MutationObserver when the main navigation is removed from the DOM.
859
+ */
860
+ disconnectedCallback() {
861
+ this.header = null;
862
+ this.mutationObserver.disconnect();
863
+ if (this.resizeObserver) {
864
+ this.resizeObserver.disconnect();
865
+ }
866
+ }
867
+ componentDidLoad() {
868
+ setTimeout(() => this.checkScrollability()); // Initial check to determine if scrolling is needed
869
+ this.resizeObserver = new ResizeObserver(() => {
870
+ this.checkScrollability();
871
+ });
872
+ // Observe the navbar and the navigation list for size changes
873
+ if (this.navbar) {
874
+ this.resizeObserver.observe(this.navbar);
875
+ const navList = this.navigationList;
876
+ if (navList) {
877
+ this.resizeObserver.observe(navList);
878
+ }
879
+ }
880
+ this.mutationObserver.observe(this.navigationList, { subtree: true, childList: true }); // Recheck scrollability when navigation list changes
881
+ this.fixLayoutShift();
882
+ // Handle focus changes and adjust scroll as needed
883
+ this.navbar.addEventListener('focusin', e => this.adjustTranslation(e));
884
+ }
885
+ // Hack that duplicates navigation elements to fix the layout shift on active elements
886
+ fixLayoutShift() {
887
+ // Select first level of main navigation elements, both the links and the megadropdown trigger buttons
888
+ const children = this.host.querySelectorAll('nav > post-list > div > post-list-item > a, nav > post-list > div > post-list-item > post-megadropdown-trigger > button');
889
+ // Update HTML so that the content is duplicated
890
+ children.forEach(child => (child.innerHTML = `<span class="nav-el-active">${child.innerHTML}</span><span class="nav-el-inactive"aria-hidden="true">${child.innerHTML}</span>`));
891
+ }
892
+ handleBackButtonClick() {
893
+ if (this.header)
894
+ this.header.toggleMobileMenu();
895
+ }
896
+ /**
897
+ * Moves focus on the navbar and adjusts scrolling to bring focused element into view.
898
+ */
899
+ adjustTranslation(e) {
900
+ const focusedElement = e.target;
901
+ if (!this.canScroll || !focusedElement.matches(NAVIGATION_ITEM_SELECTOR))
902
+ return;
903
+ // We need to move the element into the view before it is focused to avoid browser default behavior
904
+ e.preventDefault();
905
+ this.withoutTransition(() => {
906
+ // Try scrolling in both directions, only the necessary translation will actually occur
907
+ this.translateRightTo(focusedElement);
908
+ this.translateLeftTo(focusedElement);
909
+ focusedElement.focus();
910
+ });
911
+ }
912
+ /**
913
+ * Checks if scrolling is possible in either direction (left or right) and updates the state accordingly.
914
+ */
915
+ checkScrollability() {
916
+ const { scrollWidth, clientWidth } = this.navbar;
917
+ const couldScroll = this.canScroll;
918
+ if (scrollWidth === clientWidth) {
919
+ // If scroll width equals client width, scrolling is disabled in both directions
920
+ this.canScrollLeft = this.canScrollRight = false;
921
+ }
922
+ else {
923
+ this.canScrollLeft = this.translationAmount > 0; // Scrolling left is possible if not at the start
924
+ this.canScrollRight = clientWidth + this.translationAmount < scrollWidth; // Scrolling right is possible if not at the end
925
+ }
926
+ if (couldScroll && !this.canScroll) {
927
+ this.withoutTransition(() => (this.translationAmount = 0));
928
+ }
929
+ }
930
+ /**
931
+ * Returns whether scrolling is enabled in either the left or right direction.
932
+ */
933
+ get canScroll() {
934
+ return this.canScrollLeft || this.canScrollRight;
935
+ }
936
+ /**
937
+ * Handles the scrolling behavior when a user clicks on the left or right scroll buttons.
938
+ */
939
+ handleScrollButtonClick(direction) {
940
+ if (!this.canScroll)
941
+ return;
942
+ // Disable interaction with the navbar during scrolling
943
+ this.disableNavbar();
944
+ // Perform the initial scroll action
945
+ this.scroll(direction);
946
+ // Repeat the scrolling action while the button is held down
947
+ this.scrollRepeatInterval = setInterval(() => {
948
+ this.scroll(direction);
949
+ }, SCROLL_REPEAT_INTERVAL);
950
+ }
951
+ /**
952
+ * Stops the repeated scrolling when the mouse button is released.
953
+ */
954
+ stopScrolling() {
955
+ if (this.scrollRepeatInterval)
956
+ clearInterval(this.scrollRepeatInterval);
957
+ }
958
+ scroll(direction) {
959
+ const navigationItems = Array.from(this.navigationItems);
960
+ if (direction === 'left')
961
+ navigationItems.reverse();
962
+ for (const item of navigationItems) {
963
+ const couldScroll = direction === 'left' ? this.translateLeftTo(item, true) : this.translateRightTo(item, true);
964
+ if (couldScroll)
965
+ break;
966
+ }
967
+ }
968
+ translateRightTo(navigationItem, skipSmallTranslation = false) {
969
+ const listItem = navigationItem.closest('post-list-item');
970
+ // Calculate the right edge position of the list item relative to the left of the screen
971
+ const rightEdgePosition = listItem.offsetLeft + listItem.offsetWidth;
972
+ // Calculate the last visible position on the screen, right before the right scroll button
973
+ const lastVisiblePosition = this.host.clientWidth - this.rightScrollButton.clientWidth;
974
+ // If the item is already fully visible, no translation is needed
975
+ if (rightEdgePosition < lastVisiblePosition)
976
+ return false;
977
+ const translationIncrease = rightEdgePosition - lastVisiblePosition + 1; // + 1 because offset values are rounded
978
+ // If the required scroll distance is too small (less than half the width of the item), avoid unnecessary scroll
979
+ if (skipSmallTranslation && translationIncrease < listItem.clientWidth / 2)
980
+ return false;
981
+ // Calculate the maximum translation amount to prevent scrolling past the end of the content
982
+ const maximumTranslation = this.navbar.scrollWidth - this.host.clientWidth;
983
+ // Adjust the translation amount, ensuring it doesn't exceed the maximum scrollable area
984
+ const { marginRight } = getComputedStyle(this.navigationList);
985
+ this.translationAmount =
986
+ Math.min(this.translationAmount + translationIncrease, maximumTranslation) +
987
+ parseInt(marginRight);
988
+ return true;
989
+ }
990
+ translateLeftTo(navigationItem, skipSmallTranslation = false) {
991
+ const listItem = navigationItem.closest('post-list-item');
992
+ // Get the left edge position of the list item relative to the left of the screen
993
+ const leftEdgePosition = listItem.offsetLeft;
994
+ // Calculate the first visible position on the screen to the left, right after the left scroll button
995
+ const firstVisiblePosition = this.leftScrollButton.clientWidth;
996
+ // If the item is already fully visible, no translation is needed
997
+ if (leftEdgePosition > firstVisiblePosition)
998
+ return false;
999
+ const translationDecrease = firstVisiblePosition - leftEdgePosition + 1; // + 1 because offset values are rounded
1000
+ // If the required scroll distance is too small (less than half the width of the item), don't perform the scroll
1001
+ if (skipSmallTranslation && translationDecrease < listItem.clientWidth / 2)
1002
+ return false;
1003
+ // Calculate the minimum allowed translation amount (no negative scrolling allowed)
1004
+ const minimumTranslation = 0;
1005
+ // Adjust the translation amount, ensuring it doesn't go below the minimum scrollable area
1006
+ const { marginLeft } = getComputedStyle(this.navigationList);
1007
+ this.translationAmount = Math.max(this.translationAmount - translationDecrease - parseInt(marginLeft), minimumTranslation);
1008
+ return true;
1009
+ }
1010
+ /**
1011
+ * Returns the navigation list container element
1012
+ */
1013
+ get navigationList() {
1014
+ return this.navbar.querySelector(NAVIGATION_LIST_SELECTOR);
1015
+ }
1016
+ /**
1017
+ * Returns the navigation items
1018
+ */
1019
+ get navigationItems() {
1020
+ return this.navbar.querySelectorAll(NAVIGATION_ITEM_SELECTOR);
1021
+ }
1022
+ /**
1023
+ * Temporarily disables interactions with the navbar during scrolling to prevent accidental clicks.
1024
+ * Re-enables interactions after a brief delay to avoid blocking the user entirely.
1025
+ */
1026
+ disableNavbar() {
1027
+ if (this.navbarDisableTimer)
1028
+ clearTimeout(this.navbarDisableTimer);
1029
+ this.navbar.style.pointerEvents = 'none';
1030
+ this.navbarDisableTimer = setTimeout(() => {
1031
+ this.navbar.style.pointerEvents = 'initial';
1032
+ }, NAVBAR_DISABLE_DURATION);
1033
+ }
1034
+ /**
1035
+ * Allows to translate the navbar without a transition
1036
+ */
1037
+ withoutTransition(callback) {
1038
+ const transition = this.navbar.style.transition;
1039
+ this.navbar.style.transition = 'none';
1040
+ callback();
1041
+ setTimeout(() => {
1042
+ this.navbar.style.transition = transition;
1043
+ });
1044
+ }
1045
+ render() {
1046
+ return (h(Host, { key: '3c740536fd968e22d22a8117766df12800e6eb6e', slot: "post-mainnavigation" }, h("div", { key: '113602ca8b5ee48c290b31b77329b34d85df40bd', onClick: () => this.handleBackButtonClick(), class: "back-button" }, h("slot", { key: '6cd5e18449f1a9340a6c35c0b97385f0a4bf6ede', name: "back-button" })), h("nav", { key: '6fb39c4a929f973468407928b43f877233fa9326', ref: el => (this.navbar = el) }, h("slot", { key: 'dd9957b2dea293bc7153239f817ac76f37db3728' })), h("div", { key: '3942637952cec7095dbbcfa16aea1a3768a52fdb', class: `left-scroll-button${this.canScrollLeft ? '' : ' d-none'}`, "aria-hidden": "true" }, h("button", { key: '381b0aef119a161e6e3ac8f396ef8a214df0c439', type: "button", tabindex: "-1", ref: el => (this.leftScrollButton = el), onMouseDown: () => this.handleScrollButtonClick('left') }, h("post-icon", { key: '632835cf735a1d5487d1e18861622318041b9fb3', "aria-hidden": "true", name: "chevronleft" }))), h("div", { key: '2cb6c7222c5e755ba1fdfc8c9e68d73299efe0de', class: `right-scroll-button${this.canScrollRight ? '' : ' d-none'}`, "aria-hidden": "true" }, h("button", { key: 'd665cde32ea285134522a00689accf3cc40c927c', type: "button", tabindex: "-1", ref: el => (this.rightScrollButton = el), onMouseDown: () => this.handleScrollButtonClick('right') }, h("post-icon", { key: '13530078ad9aa9b48bdfd5bd78c8aa8d6ea910d0', "aria-hidden": "true", name: "chevronright" })))));
1047
+ }
1048
+ static get watchers() { return {
1049
+ "translationAmount": ["onTranslateAmountChanges"]
1050
+ }; }
1051
+ };
1052
+ PostMainnavigation.style = PostMainnavigationStyle0;
1053
+
1054
+ const postMegadropdownCss = "@keyframes slide-in{0%{transform:translateX(100%)}100%{transform:translateX(0%)}}@keyframes slide-out{from{transform:translateX(0%)}to{transform:translateX(100%)}}@keyframes slide-down{from{transform:translateY(-100%)}to{transform:translateY(0%)}}@keyframes slide-up{0%{transform:translateY(0%)}100%{transform:translateY(-100%)}}*,::before,::after{box-sizing:border-box}.megadropdown-container{box-shadow:0 8px 6px rgba(0,0,0,.16);position:absolute;background-color:#fafafa;border:none;z-index:1;width:100%;inset-block-start:100%;inset-inline-start:0;border-radius:0}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.megadropdown-container{border-block-end:1px solid CanvasText}}.megadropdown-container.slide-in{animation:slide-down 350ms forwards}.megadropdown-container.slide-out{animation:slide-up 350ms forwards}@media screen and (max-width: 1023.98px){.megadropdown-container{z-index:4;position:fixed;inset-block-start:var(--header-navigation-current-inset);inset-inline:0;height:calc(min(var(--header-scroll-parent-height, 100dvh),100dvh) - var(--header-height));border-top:unset;overflow-y:auto;overscroll-behavior:contain}.megadropdown-container.slide-in{animation:slide-in 350ms forwards}.megadropdown-container.slide-out{animation:slide-out 350ms forwards}}.megadropdown{padding:31px 40px 40px;background-color:#fafafa}@media screen and (max-width: 1023.98px){.megadropdown{display:flex;flex-direction:column;width:inherit;padding:16px 32px 24px}}@media screen and (max-width: 599.98px){.megadropdown{padding-inline:16px}}.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.98px){.megadropdown .megadropdown-content{grid-template-columns:repeat(auto-fit, minmax(min(35vw, 100%), 1fr))}}@media screen and (max-width: 599.98px){.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;display:none;font-weight:inherit;border-bottom:0;border-top:0}@media screen and (max-width: 1023.98px){.megadropdown h2{display:block;font-size:1.25rem}}@media screen and (max-width: 599.98px){.megadropdown h2{font-size:1.125rem}}.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;display:block;font-weight:900}.megadropdown post-list .list-title h3:not(:has(a)),.megadropdown post-list .list-title h3 a{padding:16px 12px 14px 8px}.megadropdown post-list .list-title h3:not(:has(a)){position:relative}.megadropdown post-list .list-title h3:not(:has(a))::before{content:\"\";background-color:#050400;bottom:0;width:100%;height:2px;position:absolute;left:0}.megadropdown post-list .list-title h3 a{border-radius:0;text-decoration:none;font-size:inherit;display:flex;align-items:center;justify-content:space-between;min-height:53px;width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative;height:unset;font-weight:900}.megadropdown post-list .list-title h3 a::before{content:\"\";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}.megadropdown post-list .list-title h3 a.selected,.megadropdown post-list .list-title h3 a[aria-expanded=true]{background-color:#050400;color:#fff}.megadropdown post-list .list-title h3 a:hover{background-color:#504f4b;color:#fff}.megadropdown post-list .list-title h3 a:hover::before{background-color:#504f4b}.megadropdown post-list .list-title h3 a::before{height:2px}@media screen and (max-width: 1023.98px){.megadropdown post-list .list-title h3{font-size:1rem}.megadropdown post-list .list-title h3:not(:has(a)),.megadropdown post-list .list-title h3 a{padding:14px 12px 12px 8px}}@media screen and (max-width: 599.98px){.megadropdown post-list .list-title h3{font-size:.875rem}}.megadropdown post-list-item>a{padding-block:13px 12px;padding-inline-start:8px;display:flex;text-decoration:none;width:100%;min-width:100%;height:auto;min-height:48px;white-space:normal;word-break:break-word}.megadropdown post-list-item>a:hover{border-block-width:0}@media screen and (min-width: 1024px){.megadropdown post-list-item>a{font-size:1.25rem}}@media screen and (max-width: 1023.98px){.megadropdown post-list-item>a{padding-block:12px 11px}}@media screen and (max-width: 599.98px){.megadropdown post-list-item>a{font-size:.875rem}}.megadropdown .back-button{display:none;margin-bottom:2rem}.megadropdown .back-button .btn{width:auto}@media screen and (max-width: 1023.98px){.megadropdown .back-button{order:-1;display:block}}.megadropdown .close-button{position:absolute;top:1rem;right:1rem}@media screen and (max-width: 1023.98px){.megadropdown .close-button{display:none}}";
1055
+ const PostMegadropdownStyle0 = postMegadropdownCss;
1056
+
1057
+ const PostMegadropdown = class {
1058
+ constructor(hostRef) {
1059
+ registerInstance(this, hostRef);
1060
+ this.postToggleMegadropdown = createEvent(this, "postToggleMegadropdown", 7);
1061
+ this.device = breakpoint.get('name');
1062
+ this.isVisible = false;
1063
+ this.animationClass = null;
1064
+ }
1065
+ firstFocusableEl;
1066
+ lastFocusableEl;
1067
+ get host() { return getElement(this); }
1068
+ /** Tracks the currently active dropdown instance. */
1069
+ static activeDropdown = null;
1070
+ breakpointChange(e) {
1071
+ this.device = e.detail;
1072
+ if (this.device === 'desktop' && this.isVisible) {
1073
+ this.animationClass = null;
1074
+ }
1075
+ }
1076
+ /**
1077
+ * Emits when the dropdown is shown or hidden.
1078
+ * The event payload is an object.
1079
+ * `isVisible` is true when the dropdown gets opened and false when it gets closed
1080
+ * `focusParent` determines whether after the closing of the mega dropdown, the focus should go back to the trigger parent or naturally go to the next focusable element in the page
1081
+ **/
1082
+ postToggleMegadropdown;
1083
+ disconnectedCallback() {
1084
+ this.removeListeners();
1085
+ window.removeEventListener('postBreakpoint:name', this.breakpointChange.bind(this));
1086
+ if (PostMegadropdown.activeDropdown === this) {
1087
+ PostMegadropdown.activeDropdown = null;
1088
+ }
1089
+ }
1090
+ componentWillRender() {
1091
+ this.getFocusableElements();
1092
+ }
1093
+ /**
1094
+ * Toggles the dropdown visibility based on its current state.
1095
+ */
1096
+ async toggle() {
1097
+ if (this.isVisible) {
1098
+ this.hide();
1099
+ }
1100
+ else {
1101
+ await this.show();
1102
+ }
1103
+ }
1104
+ /**
1105
+ * Displays the dropdown.
1106
+ */
1107
+ async show() {
1108
+ if (PostMegadropdown.activeDropdown && PostMegadropdown.activeDropdown !== this) {
1109
+ // Close the previously active dropdown without animation
1110
+ PostMegadropdown.activeDropdown.forceClose();
1111
+ }
1112
+ else {
1113
+ this.animationClass = 'slide-in';
1114
+ }
1115
+ this.isVisible = true;
1116
+ PostMegadropdown.activeDropdown = this;
1117
+ this.postToggleMegadropdown.emit({ isVisible: this.isVisible });
1118
+ if (this.firstFocusableEl &&
1119
+ window.getComputedStyle(this.firstFocusableEl).display !== 'none') {
1120
+ this.firstFocusableEl.focus();
1121
+ }
1122
+ this.addListeners();
1123
+ }
1124
+ /**
1125
+ * Hides the dropdown with an animation.
1126
+ */
1127
+ async hide(focusParent = true, forceClose = false) {
1128
+ this.postToggleMegadropdown.emit({ isVisible: false, focusParent: focusParent });
1129
+ if (forceClose) {
1130
+ this.forceClose();
1131
+ }
1132
+ else {
1133
+ this.animationClass = 'slide-out';
1134
+ }
1135
+ }
1136
+ /**
1137
+ * Sets focus to the first focusable element within the component.
1138
+ */
1139
+ async focusFirst() {
1140
+ this.firstFocusableEl?.focus();
1141
+ }
1142
+ connectedCallback() {
1143
+ window.addEventListener('postBreakpoint:name', this.breakpointChange.bind(this));
1144
+ }
1145
+ /**
1146
+ * Forces the dropdown to close without animation.
1147
+ */
1148
+ forceClose() {
1149
+ this.isVisible = false;
1150
+ this.animationClass = null;
1151
+ this.postToggleMegadropdown.emit({ isVisible: this.isVisible, focusParent: false });
1152
+ this.removeListeners();
1153
+ }
1154
+ handleAnimationEnd() {
1155
+ if (this.animationClass === 'slide-out') {
1156
+ this.isVisible = false;
1157
+ this.animationClass = null;
1158
+ PostMegadropdown.activeDropdown = null;
1159
+ this.removeListeners();
1160
+ }
1161
+ }
1162
+ handleClickOutside = (event) => {
1163
+ if (this.device !== 'desktop')
1164
+ return;
1165
+ const target = event.target;
1166
+ if (this.host.contains(target)) {
1167
+ return;
1168
+ }
1169
+ if (target instanceof HTMLElement) {
1170
+ const trigger = target.closest('post-megadropdown-trigger');
1171
+ if (trigger) {
1172
+ const targetDropdownId = trigger.getAttribute('for');
1173
+ if (targetDropdownId !== this.host.id) {
1174
+ return;
1175
+ }
1176
+ }
1177
+ }
1178
+ this.hide(false);
1179
+ };
1180
+ addListeners() {
1181
+ this.host.addEventListener('keydown', e => this.keyboardHandler(e));
1182
+ document.addEventListener('keyup', e => this.handleTabOutside(e));
1183
+ document.addEventListener('mousedown', this.handleClickOutside);
1184
+ }
1185
+ removeListeners() {
1186
+ this.host.removeEventListener('keydown', e => this.keyboardHandler(e));
1187
+ document.removeEventListener('keyup', e => this.handleTabOutside(e));
1188
+ document.removeEventListener('mousedown', this.handleClickOutside);
1189
+ }
1190
+ getFocusableElements() {
1191
+ const focusableEls = Array.from(this.host.querySelectorAll('post-list-item, h3, .back-button'));
1192
+ const focusableChildren = focusableEls.flatMap(el => Array.from(getFocusableChildren(el)));
1193
+ this.firstFocusableEl = focusableChildren[0];
1194
+ this.lastFocusableEl = focusableChildren[focusableChildren.length - 1];
1195
+ }
1196
+ // Loop through the focusable children
1197
+ keyboardHandler(e) {
1198
+ if (e.key === 'Tab' && this.device !== 'desktop') {
1199
+ if (e.shiftKey && document.activeElement === this.firstFocusableEl) {
1200
+ // If back tab (TAB + Shift) and first element is focused, focus goes to the last element of the megadropdown
1201
+ e.preventDefault();
1202
+ this.lastFocusableEl.focus();
1203
+ }
1204
+ else if (!e.shiftKey && document.activeElement === this.lastFocusableEl) {
1205
+ // If TAB and last element is focused, focus goes back to the first element of the megadropdown
1206
+ e.preventDefault();
1207
+ this.firstFocusableEl.focus();
1208
+ }
1209
+ }
1210
+ }
1211
+ handleTabOutside(e) {
1212
+ if (e.key === 'Tab' && this.device === 'desktop') {
1213
+ if (!this.host.contains(e.target)) {
1214
+ this.hide(false);
1215
+ }
1216
+ }
1217
+ }
1218
+ render() {
1219
+ const containerStyle = this.isVisible ? {} : { display: 'none' };
1220
+ return (h(Host, { key: '823a6bf8bfa10457db0fe6d0693d514d747ad559' }, h("div", { key: '7bf71bd92e5cf548ac66acbb08ee0e39145f5e1e', class: `megadropdown-container ${this.animationClass || ''}`, style: containerStyle, onAnimationEnd: () => this.handleAnimationEnd() }, h("div", { key: '0d37ac5f97521db3003f619465ed771b14291966', class: "megadropdown" }, h("slot", { key: '5b43cc2a8978eb42b5626f62a84c639e9abffb10', name: "megadropdown-title" }), h("div", { key: 'e8e3a768ad28e14597f9671137dc6815baea5666', class: "megadropdown-content" }, h("slot", { key: 'f230793ceb2daca7d79e3098e057acbba5c2d879' })), h("div", { key: 'd008a5f9f25fbd722023c7f966541ebc29e8cc01', onClick: () => this.hide(true), class: "back-button" }, h("slot", { key: 'aec3e3119e5dd90b715f269f677f6b98008d215a', name: "back-button" })), h("div", { key: 'f2c283e08b13cb78b8af1b7779758b2b924f343c', onClick: () => this.hide(true), class: "close-button" }, h("slot", { key: '72a40613d8b0b8c50354f510d66290c661c86f69', name: "close-button" }))))));
1221
+ }
1222
+ };
1223
+ PostMegadropdown.style = PostMegadropdownStyle0;
1224
+
1225
+ const postMegadropdownTriggerCss = "post-megadropdown-trigger{width:100%;position:relative;z-index:3}";
1226
+ const PostMegadropdownTriggerStyle0 = postMegadropdownTriggerCss;
1227
+
1228
+ const PostMegadropdownTrigger = class {
1229
+ constructor(hostRef) {
1230
+ registerInstance(this, hostRef);
1231
+ this.for = undefined;
1232
+ this.ariaExpanded = false;
1233
+ }
1234
+ get host() { return getElement(this); }
1235
+ /**
1236
+ * Reference to the slotted button within the trigger, if present.
1237
+ * Used to manage click and key events for mega dropdown control.
1238
+ */
1239
+ slottedButton = null;
1240
+ /**
1241
+ * Tracks whether this trigger's dropdown was expanded before a state change.
1242
+ * Used to determine if this trigger should handle focus when its dropdown closes.
1243
+ */
1244
+ wasExpanded = false;
1245
+ /**
1246
+ * Watch for changes to the `for` property to validate its type and ensure it is a string.
1247
+ * @param forValue - The new value of the `for` property.
1248
+ */
1249
+ validateControlFor() {
1250
+ checkType(this, 'for', 'string');
1251
+ }
1252
+ get megadropdown() {
1253
+ const ref = document.getElementById(this.for);
1254
+ return ref && ref.localName === 'post-megadropdown'
1255
+ ? ref
1256
+ : null;
1257
+ }
1258
+ handleToggle() {
1259
+ if (this.megadropdown) {
1260
+ this.megadropdown.toggle();
1261
+ }
1262
+ else {
1263
+ console.warn(`No post-megadropdown found with ID: ${this.for}`);
1264
+ }
1265
+ }
1266
+ handleKeyDown = (event) => {
1267
+ if (event.key === 'Enter' || event.key === ' ') {
1268
+ event.preventDefault();
1269
+ this.handleToggle();
1270
+ if (this.megadropdown && !this.ariaExpanded) {
1271
+ setTimeout(() => this.megadropdown.focusFirst(), 100);
1272
+ }
1273
+ }
1274
+ };
1275
+ componentDidLoad() {
1276
+ this.validateControlFor();
1277
+ // Check if the mega dropdown attached to the trigger is expanded or not
1278
+ document.addEventListener('postToggleMegadropdown', (event) => {
1279
+ if (event.target.id === this.for) {
1280
+ this.ariaExpanded = event.detail.isVisible;
1281
+ // Focus on the trigger parent of the dropdown after it's closed if close button had been clicked
1282
+ if (this.wasExpanded && !this.ariaExpanded && event.detail.focusParent) {
1283
+ setTimeout(() => {
1284
+ this.slottedButton?.focus();
1285
+ }, 100);
1286
+ }
1287
+ this.wasExpanded = this.ariaExpanded;
1288
+ if (this.slottedButton) {
1289
+ this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
1290
+ }
1291
+ }
1292
+ });
1293
+ this.slottedButton = this.host.querySelector('button');
1294
+ if (this.slottedButton) {
1295
+ this.slottedButton.setAttribute('aria-haspopup', 'menu');
1296
+ this.slottedButton.addEventListener('click', () => {
1297
+ this.handleToggle();
1298
+ });
1299
+ this.slottedButton.addEventListener('keydown', this.handleKeyDown);
1300
+ }
1301
+ else {
1302
+ console.warn('No button found within post-megadropdown-trigger');
1303
+ }
1304
+ }
1305
+ render() {
1306
+ return (h(Host, { key: 'a879ee7ccf98c76e6cb2b82b3bfbdff39280e2d5', "data-version": version, "tab-index": "-1" }, h("button", { key: '31e506e1bd542050ae731be74b01614e61dd9622' }, h("slot", { key: 'c17394f96e1d54eda841f3d9485d9e5c2457acff' }))));
1307
+ }
1308
+ static get watchers() { return {
1309
+ "for": ["validateControlFor"]
1310
+ }; }
1311
+ };
1312
+ PostMegadropdownTrigger.style = PostMegadropdownTriggerStyle0;
1313
+
1314
+ 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)}.popover-container{display:flex;flex-direction:column}";
1315
+ const PostMenuStyle0 = postMenuCss;
1316
+
1317
+ const PostMenu = class {
1318
+ constructor(hostRef) {
1319
+ registerInstance(this, hostRef);
1320
+ this.toggleMenu = createEvent(this, "toggleMenu", 7);
1321
+ this.placement = 'bottom';
1322
+ this.isVisible = false;
1323
+ }
1324
+ popoverRef;
1325
+ lastFocusedElement = null;
1326
+ KEYCODES = {
1327
+ SPACE: ' ',
1328
+ ENTER: 'Enter',
1329
+ UP: 'ArrowUp',
1330
+ DOWN: 'ArrowDown',
1331
+ TAB: 'Tab',
1332
+ HOME: 'Home',
1333
+ END: 'End',
1334
+ ESCAPE: 'Escape',
1335
+ };
1336
+ get host() { return getElement(this); }
1337
+ /**
1338
+ * Emits when the menu is shown or hidden.
1339
+ * The event payload is a boolean: `true` when the menu was opened, `false` when it was closed.
1340
+ **/
1341
+ toggleMenu;
1342
+ root;
1343
+ connectedCallback() {
1344
+ this.root = getRoot(this.host);
1345
+ this.host.addEventListener('keydown', this.handleKeyDown);
1346
+ this.host.addEventListener('click', this.handleClick);
1347
+ }
1348
+ disconnectedCallback() {
1349
+ this.host.removeEventListener('keydown', this.handleKeyDown);
1350
+ this.host.removeEventListener('click', this.handleClick);
1351
+ }
1352
+ componentDidLoad() {
1353
+ this.popoverRef.addEventListener('postToggle', (event) => {
1354
+ this.isVisible = event.detail;
1355
+ this.toggleMenu.emit(this.isVisible);
1356
+ requestAnimationFrame(() => {
1357
+ if (this.isVisible) {
1358
+ this.lastFocusedElement = this.root.activeElement;
1359
+ const menuItems = this.getSlottedItems();
1360
+ if (menuItems.length > 0) {
1361
+ menuItems[0].focus();
1362
+ }
1363
+ }
1364
+ else if (this.lastFocusedElement) {
1365
+ this.lastFocusedElement.focus();
1366
+ }
1367
+ });
1368
+ });
1369
+ }
1370
+ /**
1371
+ * Toggles the menu visibility based on its current state.
1372
+ */
1373
+ async toggle(target) {
1374
+ if (this.popoverRef) {
1375
+ await this.popoverRef.toggle(target);
1376
+ }
1377
+ else {
1378
+ console.error('toggle: popoverRef is null or undefined');
1379
+ }
1380
+ }
1381
+ /**
1382
+ * Displays the popover menu, focusing the first menu item.
1383
+ *
1384
+ * @param target - The HTML element relative to which the popover menu should be displayed.
1385
+ */
1386
+ async show(target) {
1387
+ if (this.popoverRef) {
1388
+ await this.popoverRef.show(target);
1389
+ }
1390
+ else {
1391
+ console.error('show: popoverRef is null or undefined');
1392
+ }
1393
+ }
1394
+ /**
1395
+ * Hides the popover menu and restores focus to the previously focused element.
1396
+ */
1397
+ async hide() {
1398
+ if (this.popoverRef) {
1399
+ await this.popoverRef.hide();
1400
+ }
1401
+ else {
1402
+ console.error('hide: popoverRef is null or undefined');
1403
+ }
1404
+ }
1405
+ handleKeyDown = (e) => {
1406
+ e.stopPropagation();
1407
+ if (e.key === this.KEYCODES.ESCAPE) {
1408
+ this.toggle(this.host);
1409
+ return;
1410
+ }
1411
+ if (Object.values(this.KEYCODES).includes(e.key)) {
1412
+ this.controlKeyDownHandler(e);
1413
+ }
1414
+ };
1415
+ handleClick = (e) => {
1416
+ const target = e.target;
1417
+ if (['BUTTON', 'A', 'INPUT', 'SELECT', 'TEXTAREA'].includes(target.tagName)) {
1418
+ this.toggle(this.host);
1419
+ }
1420
+ };
1421
+ controlKeyDownHandler(e) {
1422
+ const menuItems = this.getSlottedItems();
1423
+ if (!menuItems.length) {
1424
+ return;
1425
+ }
1426
+ let currentIndex = menuItems.findIndex(el => {
1427
+ // Check if the item is currently focused within its rendered scope (document or shadow root)
1428
+ return el === getRoot(el).activeElement;
1429
+ });
1430
+ switch (e.key) {
1431
+ case this.KEYCODES.UP:
1432
+ e.preventDefault();
1433
+ currentIndex = (currentIndex - 1 + menuItems.length) % menuItems.length;
1434
+ break;
1435
+ case this.KEYCODES.DOWN:
1436
+ e.preventDefault();
1437
+ currentIndex = (currentIndex + 1) % menuItems.length;
1438
+ break;
1439
+ case this.KEYCODES.HOME:
1440
+ currentIndex = 0;
1441
+ break;
1442
+ case this.KEYCODES.END:
1443
+ e.preventDefault();
1444
+ currentIndex = menuItems.length - 1;
1445
+ break;
1446
+ case this.KEYCODES.SPACE:
1447
+ this.toggle(this.host);
1448
+ return;
1449
+ case this.KEYCODES.TAB:
1450
+ this.toggle(this.host);
1451
+ break;
1452
+ }
1453
+ if (menuItems[currentIndex]) {
1454
+ menuItems[currentIndex].focus();
1455
+ }
1456
+ }
1457
+ getSlottedItems() {
1458
+ const slot = this.host.shadowRoot.querySelector('slot');
1459
+ const slottedElements = slot ? slot.assignedElements() : [];
1460
+ return (slottedElements
1461
+ // If the element is a slot, get the assigned elements
1462
+ .flatMap(el => (el instanceof HTMLSlotElement ? el.assignedElements() : el))
1463
+ // Filter out elements that have a 'menuitem' role
1464
+ .filter(el => el.getAttribute('role') === 'menuitem')
1465
+ // For each menu item, get any focusable children (e.g., buttons, links)
1466
+ .flatMap(el => Array.from(getFocusableChildren(el))));
1467
+ }
1468
+ render() {
1469
+ return (h(Host, { key: '3a79b9df5a5d4c121aa9ca36883d6e17cbf2a66e', "data-version": version }, h("post-popovercontainer", { key: '9c8a37a2c70b98ff9a960f467ab951af10c34726', placement: this.placement, ref: e => (this.popoverRef = e) }, h("div", { key: '0cda7fc8df3f201d4b4e0170bb8a94e72e123814', class: "popover-container", part: "popover-container" }, h("slot", { key: 'ac20e448dededb6ea79715c2c29122dccf0d7309' })))));
1470
+ }
1471
+ };
1472
+ PostMenu.style = PostMenuStyle0;
1473
+
1474
+ const postMenuTriggerCss = ":host{display:inline-block}";
1475
+ const PostMenuTriggerStyle0 = postMenuTriggerCss;
1476
+
1477
+ const PostMenuTrigger = class {
1478
+ constructor(hostRef) {
1479
+ registerInstance(this, hostRef);
1480
+ this.for = undefined;
1481
+ this.ariaExpanded = false;
1482
+ }
1483
+ get host() { return getElement(this); }
1484
+ /**
1485
+ * Reference to the slotted button within the trigger, if present.
1486
+ * Used to manage click and key events for menu control.
1487
+ */
1488
+ slottedButton = null;
1489
+ root;
1490
+ /**
1491
+ * Watch for changes to the `for` property to validate its type and ensure it is a string.
1492
+ * @param forValue - The new value of the `for` property.
1493
+ */
1494
+ validateControlFor() {
1495
+ checkType(this, 'for', 'string');
1496
+ }
1497
+ get menu() {
1498
+ const ref = this.root.getElementById(this.for);
1499
+ return ref && ref.localName === 'post-menu' ? ref : null;
1500
+ }
1501
+ handleToggle() {
1502
+ if (this.menu) {
1503
+ this.menu.toggle(this.host);
1504
+ }
1505
+ else {
1506
+ console.warn(`No post-menu found with ID: ${this.for}`);
1507
+ }
1508
+ }
1509
+ handleKeyDown = (e) => {
1510
+ if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
1511
+ e.preventDefault();
1512
+ this.handleToggle();
1513
+ }
1514
+ };
1515
+ connectedCallback() {
1516
+ this.root = getRoot(this.host);
1517
+ }
1518
+ componentDidLoad() {
1519
+ this.validateControlFor();
1520
+ this.slottedButton = this.host.querySelector('button');
1521
+ // Check if the slottedButton is within a web component
1522
+ if (!this.slottedButton) {
1523
+ const webComponent = this.host.querySelector('.menu-trigger-webc');
1524
+ if (webComponent.shadowRoot) {
1525
+ const slottedButton = webComponent.shadowRoot.querySelector('button');
1526
+ if (slottedButton) {
1527
+ this.slottedButton = slottedButton;
1528
+ }
1529
+ }
1530
+ }
1531
+ if (this.slottedButton) {
1532
+ this.slottedButton.setAttribute('aria-haspopup', 'menu');
1533
+ // Listen to the `toggleMenu` event emitted by the `post-menu` component
1534
+ if (this.menu && this.slottedButton) {
1535
+ this.menu.addEventListener('toggleMenu', (event) => {
1536
+ this.ariaExpanded = event.detail;
1537
+ this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
1538
+ });
1539
+ }
1540
+ this.slottedButton.addEventListener('click', () => {
1541
+ this.handleToggle();
1542
+ });
1543
+ this.slottedButton.addEventListener('keydown', this.handleKeyDown);
1544
+ }
1545
+ else {
1546
+ console.warn('No button found within post-menu-trigger');
1547
+ }
1548
+ }
1549
+ render() {
1550
+ return (h(Host, { key: '84316d4a69c4231be636e5ff8971752d5af9bab2', "data-version": version, "tab-index": "-1" }, h("slot", { key: 'd3091adcf7033c4dd25e49fa383ccb9773b2d226' })));
1551
+ }
1552
+ static get watchers() { return {
1553
+ "for": ["validateControlFor"]
1554
+ }; }
1555
+ };
1556
+ PostMenuTrigger.style = PostMenuTriggerStyle0;
1557
+
1558
+ /**
1559
+ * Custom positioning reference element.
1560
+ * @see https://floating-ui.com/docs/virtual-elements
1561
+ */
1562
+
1563
+ const sides = ['top', 'right', 'bottom', 'left'];
1564
+ const alignments = ['start', 'end'];
1565
+ const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
1566
+ const min = Math.min;
1567
+ const max = Math.max;
1568
+ const round = Math.round;
1569
+ const floor = Math.floor;
1570
+ const createCoords = v => ({
1571
+ x: v,
1572
+ y: v
1573
+ });
1574
+ const oppositeSideMap = {
1575
+ left: 'right',
1576
+ right: 'left',
1577
+ bottom: 'top',
1578
+ top: 'bottom'
1579
+ };
1580
+ const oppositeAlignmentMap = {
1581
+ start: 'end',
1582
+ end: 'start'
1583
+ };
1584
+ function clamp(start, value, end) {
1585
+ return max(start, min(value, end));
1586
+ }
1587
+ function evaluate(value, param) {
1588
+ return typeof value === 'function' ? value(param) : value;
1589
+ }
1590
+ function getSide(placement) {
1591
+ return placement.split('-')[0];
1592
+ }
1593
+ function getAlignment(placement) {
1594
+ return placement.split('-')[1];
1595
+ }
1596
+ function getOppositeAxis(axis) {
1597
+ return axis === 'x' ? 'y' : 'x';
1598
+ }
1599
+ function getAxisLength(axis) {
1600
+ return axis === 'y' ? 'height' : 'width';
1601
+ }
1602
+ function getSideAxis(placement) {
1603
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
1604
+ }
1605
+ function getAlignmentAxis(placement) {
1606
+ return getOppositeAxis(getSideAxis(placement));
1607
+ }
1608
+ function getAlignmentSides(placement, rects, rtl) {
1609
+ if (rtl === void 0) {
1610
+ rtl = false;
1611
+ }
1612
+ const alignment = getAlignment(placement);
1613
+ const alignmentAxis = getAlignmentAxis(placement);
1614
+ const length = getAxisLength(alignmentAxis);
1615
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
1616
+ if (rects.reference[length] > rects.floating[length]) {
1617
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
1618
+ }
1619
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
1620
+ }
1621
+ function getExpandedPlacements(placement) {
1622
+ const oppositePlacement = getOppositePlacement(placement);
1623
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
1624
+ }
1625
+ function getOppositeAlignmentPlacement(placement) {
1626
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
1627
+ }
1628
+ function getSideList(side, isStart, rtl) {
1629
+ const lr = ['left', 'right'];
1630
+ const rl = ['right', 'left'];
1631
+ const tb = ['top', 'bottom'];
1632
+ const bt = ['bottom', 'top'];
1633
+ switch (side) {
1634
+ case 'top':
1635
+ case 'bottom':
1636
+ if (rtl) return isStart ? rl : lr;
1637
+ return isStart ? lr : rl;
1638
+ case 'left':
1639
+ case 'right':
1640
+ return isStart ? tb : bt;
1641
+ default:
1642
+ return [];
1643
+ }
1644
+ }
1645
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
1646
+ const alignment = getAlignment(placement);
1647
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
1648
+ if (alignment) {
1649
+ list = list.map(side => side + "-" + alignment);
1650
+ if (flipAlignment) {
1651
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
1652
+ }
1653
+ }
1654
+ return list;
1655
+ }
1656
+ function getOppositePlacement(placement) {
1657
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
1658
+ }
1659
+ function expandPaddingObject(padding) {
1660
+ return {
1661
+ top: 0,
1662
+ right: 0,
1663
+ bottom: 0,
1664
+ left: 0,
1665
+ ...padding
1666
+ };
1667
+ }
1668
+ function getPaddingObject(padding) {
1669
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
1670
+ top: padding,
1671
+ right: padding,
1672
+ bottom: padding,
1673
+ left: padding
1674
+ };
1675
+ }
1676
+ function rectToClientRect(rect) {
1677
+ const {
1678
+ x,
1679
+ y,
1680
+ width,
1681
+ height
1682
+ } = rect;
1683
+ return {
1684
+ width,
1685
+ height,
1686
+ top: y,
1687
+ left: x,
1688
+ right: x + width,
1689
+ bottom: y + height,
1690
+ x,
1691
+ y
1692
+ };
1693
+ }
1694
+
1695
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
1696
+ let {
1697
+ reference,
1698
+ floating
1699
+ } = _ref;
1700
+ const sideAxis = getSideAxis(placement);
1701
+ const alignmentAxis = getAlignmentAxis(placement);
1702
+ const alignLength = getAxisLength(alignmentAxis);
1703
+ const side = getSide(placement);
1704
+ const isVertical = sideAxis === 'y';
1705
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
1706
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
1707
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
1708
+ let coords;
1709
+ switch (side) {
1710
+ case 'top':
1711
+ coords = {
1712
+ x: commonX,
1713
+ y: reference.y - floating.height
1714
+ };
1715
+ break;
1716
+ case 'bottom':
1717
+ coords = {
1718
+ x: commonX,
1719
+ y: reference.y + reference.height
1720
+ };
1721
+ break;
1722
+ case 'right':
1723
+ coords = {
1724
+ x: reference.x + reference.width,
1725
+ y: commonY
1726
+ };
1727
+ break;
1728
+ case 'left':
1729
+ coords = {
1730
+ x: reference.x - floating.width,
1731
+ y: commonY
1732
+ };
1733
+ break;
1734
+ default:
1735
+ coords = {
1736
+ x: reference.x,
1737
+ y: reference.y
1738
+ };
1739
+ }
1740
+ switch (getAlignment(placement)) {
1741
+ case 'start':
1742
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
1743
+ break;
1744
+ case 'end':
1745
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
1746
+ break;
1747
+ }
1748
+ return coords;
1749
+ }
1750
+
1751
+ /**
1752
+ * Computes the `x` and `y` coordinates that will place the floating element
1753
+ * next to a given reference element.
1754
+ *
1755
+ * This export does not have any `platform` interface logic. You will need to
1756
+ * write one for the platform you are using Floating UI with.
1757
+ */
1758
+ const computePosition$1 = async (reference, floating, config) => {
1759
+ const {
1760
+ placement = 'bottom',
1761
+ strategy = 'absolute',
1762
+ middleware = [],
1763
+ platform
1764
+ } = config;
1765
+ const validMiddleware = middleware.filter(Boolean);
1766
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
1767
+ let rects = await platform.getElementRects({
1768
+ reference,
1769
+ floating,
1770
+ strategy
1771
+ });
1772
+ let {
1773
+ x,
1774
+ y
1775
+ } = computeCoordsFromPlacement(rects, placement, rtl);
1776
+ let statefulPlacement = placement;
1777
+ let middlewareData = {};
1778
+ let resetCount = 0;
1779
+ for (let i = 0; i < validMiddleware.length; i++) {
1780
+ const {
1781
+ name,
1782
+ fn
1783
+ } = validMiddleware[i];
1784
+ const {
1785
+ x: nextX,
1786
+ y: nextY,
1787
+ data,
1788
+ reset
1789
+ } = await fn({
1790
+ x,
1791
+ y,
1792
+ initialPlacement: placement,
1793
+ placement: statefulPlacement,
1794
+ strategy,
1795
+ middlewareData,
1796
+ rects,
1797
+ platform,
1798
+ elements: {
1799
+ reference,
1800
+ floating
1801
+ }
1802
+ });
1803
+ x = nextX != null ? nextX : x;
1804
+ y = nextY != null ? nextY : y;
1805
+ middlewareData = {
1806
+ ...middlewareData,
1807
+ [name]: {
1808
+ ...middlewareData[name],
1809
+ ...data
1810
+ }
1811
+ };
1812
+ if (reset && resetCount <= 50) {
1813
+ resetCount++;
1814
+ if (typeof reset === 'object') {
1815
+ if (reset.placement) {
1816
+ statefulPlacement = reset.placement;
1817
+ }
1818
+ if (reset.rects) {
1819
+ rects = reset.rects === true ? await platform.getElementRects({
1820
+ reference,
1821
+ floating,
1822
+ strategy
1823
+ }) : reset.rects;
1824
+ }
1825
+ ({
1826
+ x,
1827
+ y
1828
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
1829
+ }
1830
+ i = -1;
1831
+ }
1832
+ }
1833
+ return {
1834
+ x,
1835
+ y,
1836
+ placement: statefulPlacement,
1837
+ strategy,
1838
+ middlewareData
1839
+ };
1840
+ };
1841
+
1842
+ /**
1843
+ * Resolves with an object of overflow side offsets that determine how much the
1844
+ * element is overflowing a given clipping boundary on each side.
1845
+ * - positive = overflowing the boundary by that number of pixels
1846
+ * - negative = how many pixels left before it will overflow
1847
+ * - 0 = lies flush with the boundary
1848
+ * @see https://floating-ui.com/docs/detectOverflow
1849
+ */
1850
+ async function detectOverflow(state, options) {
1851
+ var _await$platform$isEle;
1852
+ if (options === void 0) {
1853
+ options = {};
1854
+ }
1855
+ const {
1856
+ x,
1857
+ y,
1858
+ platform,
1859
+ rects,
1860
+ elements,
1861
+ strategy
1862
+ } = state;
1863
+ const {
1864
+ boundary = 'clippingAncestors',
1865
+ rootBoundary = 'viewport',
1866
+ elementContext = 'floating',
1867
+ altBoundary = false,
1868
+ padding = 0
1869
+ } = evaluate(options, state);
1870
+ const paddingObject = getPaddingObject(padding);
1871
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
1872
+ const element = elements[altBoundary ? altContext : elementContext];
1873
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
1874
+ element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
1875
+ boundary,
1876
+ rootBoundary,
1877
+ strategy
1878
+ }));
1879
+ const rect = elementContext === 'floating' ? {
1880
+ ...rects.floating,
1881
+ x,
1882
+ y
1883
+ } : rects.reference;
1884
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
1885
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
1886
+ x: 1,
1887
+ y: 1
1888
+ } : {
1889
+ x: 1,
1890
+ y: 1
1891
+ };
1892
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
1893
+ elements,
1894
+ rect,
1895
+ offsetParent,
1896
+ strategy
1897
+ }) : rect);
1898
+ return {
1899
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
1900
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
1901
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
1902
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
1903
+ };
1904
+ }
1905
+
1906
+ /**
1907
+ * Provides data to position an inner element of the floating element so that it
1908
+ * appears centered to the reference element.
1909
+ * @see https://floating-ui.com/docs/arrow
1910
+ */
1911
+ const arrow$1 = options => ({
1912
+ name: 'arrow',
1913
+ options,
1914
+ async fn(state) {
1915
+ const {
1916
+ x,
1917
+ y,
1918
+ placement,
1919
+ rects,
1920
+ platform,
1921
+ elements,
1922
+ middlewareData
1923
+ } = state;
1924
+ // Since `element` is required, we don't Partial<> the type.
1925
+ const {
1926
+ element,
1927
+ padding = 0
1928
+ } = evaluate(options, state) || {};
1929
+ if (element == null) {
1930
+ return {};
1931
+ }
1932
+ const paddingObject = getPaddingObject(padding);
1933
+ const coords = {
1934
+ x,
1935
+ y
1936
+ };
1937
+ const axis = getAlignmentAxis(placement);
1938
+ const length = getAxisLength(axis);
1939
+ const arrowDimensions = await platform.getDimensions(element);
1940
+ const isYAxis = axis === 'y';
1941
+ const minProp = isYAxis ? 'top' : 'left';
1942
+ const maxProp = isYAxis ? 'bottom' : 'right';
1943
+ const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
1944
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
1945
+ const startDiff = coords[axis] - rects.reference[axis];
1946
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
1947
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
1948
+
1949
+ // DOM platform can return `window` as the `offsetParent`.
1950
+ if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
1951
+ clientSize = elements.floating[clientProp] || rects.floating[length];
1952
+ }
1953
+ const centerToReference = endDiff / 2 - startDiff / 2;
1954
+
1955
+ // If the padding is large enough that it causes the arrow to no longer be
1956
+ // centered, modify the padding so that it is centered.
1957
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
1958
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
1959
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
1960
+
1961
+ // Make sure the arrow doesn't overflow the floating element if the center
1962
+ // point is outside the floating element's bounds.
1963
+ const min$1 = minPadding;
1964
+ const max = clientSize - arrowDimensions[length] - maxPadding;
1965
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
1966
+ const offset = clamp(min$1, center, max);
1967
+
1968
+ // If the reference is small enough that the arrow's padding causes it to
1969
+ // to point to nothing for an aligned placement, adjust the offset of the
1970
+ // floating element itself. To ensure `shift()` continues to take action,
1971
+ // a single reset is performed when this is true.
1972
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
1973
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
1974
+ return {
1975
+ [axis]: coords[axis] + alignmentOffset,
1976
+ data: {
1977
+ [axis]: offset,
1978
+ centerOffset: center - offset - alignmentOffset,
1979
+ ...(shouldAddOffset && {
1980
+ alignmentOffset
1981
+ })
1982
+ },
1983
+ reset: shouldAddOffset
1984
+ };
1985
+ }
1986
+ });
1987
+
1988
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
1989
+ const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
1990
+ return allowedPlacementsSortedByAlignment.filter(placement => {
1991
+ if (alignment) {
1992
+ return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
1993
+ }
1994
+ return true;
1995
+ });
1996
+ }
1997
+ /**
1998
+ * Optimizes the visibility of the floating element by choosing the placement
1999
+ * that has the most space available automatically, without needing to specify a
2000
+ * preferred placement. Alternative to `flip`.
2001
+ * @see https://floating-ui.com/docs/autoPlacement
2002
+ */
2003
+ const autoPlacement = function (options) {
2004
+ if (options === void 0) {
2005
+ options = {};
2006
+ }
2007
+ return {
2008
+ name: 'autoPlacement',
2009
+ options,
2010
+ async fn(state) {
2011
+ var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
2012
+ const {
2013
+ rects,
2014
+ middlewareData,
2015
+ placement,
2016
+ platform,
2017
+ elements
2018
+ } = state;
2019
+ const {
2020
+ crossAxis = false,
2021
+ alignment,
2022
+ allowedPlacements = placements,
2023
+ autoAlignment = true,
2024
+ ...detectOverflowOptions
2025
+ } = evaluate(options, state);
2026
+ const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
2027
+ const overflow = await detectOverflow(state, detectOverflowOptions);
2028
+ const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
2029
+ const currentPlacement = placements$1[currentIndex];
2030
+ if (currentPlacement == null) {
2031
+ return {};
2032
+ }
2033
+ const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
2034
+
2035
+ // Make `computeCoords` start from the right place.
2036
+ if (placement !== currentPlacement) {
2037
+ return {
2038
+ reset: {
2039
+ placement: placements$1[0]
2040
+ }
2041
+ };
2042
+ }
2043
+ const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
2044
+ const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
2045
+ placement: currentPlacement,
2046
+ overflows: currentOverflows
2047
+ }];
2048
+ const nextPlacement = placements$1[currentIndex + 1];
2049
+
2050
+ // There are more placements to check.
2051
+ if (nextPlacement) {
2052
+ return {
2053
+ data: {
2054
+ index: currentIndex + 1,
2055
+ overflows: allOverflows
2056
+ },
2057
+ reset: {
2058
+ placement: nextPlacement
2059
+ }
2060
+ };
2061
+ }
2062
+ const placementsSortedByMostSpace = allOverflows.map(d => {
2063
+ const alignment = getAlignment(d.placement);
2064
+ return [d.placement, alignment && crossAxis ?
2065
+ // Check along the mainAxis and main crossAxis side.
2066
+ d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
2067
+ // Check only the mainAxis.
2068
+ d.overflows[0], d.overflows];
2069
+ }).sort((a, b) => a[1] - b[1]);
2070
+ const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
2071
+ // Aligned placements should not check their opposite crossAxis
2072
+ // side.
2073
+ getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
2074
+ const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
2075
+ if (resetPlacement !== placement) {
2076
+ return {
2077
+ data: {
2078
+ index: currentIndex + 1,
2079
+ overflows: allOverflows
2080
+ },
2081
+ reset: {
2082
+ placement: resetPlacement
2083
+ }
2084
+ };
2085
+ }
2086
+ return {};
2087
+ }
2088
+ };
2089
+ };
2090
+
2091
+ /**
2092
+ * Optimizes the visibility of the floating element by flipping the `placement`
2093
+ * in order to keep it in view when the preferred placement(s) will overflow the
2094
+ * clipping boundary. Alternative to `autoPlacement`.
2095
+ * @see https://floating-ui.com/docs/flip
2096
+ */
2097
+ const flip$1 = function (options) {
2098
+ if (options === void 0) {
2099
+ options = {};
2100
+ }
2101
+ return {
2102
+ name: 'flip',
2103
+ options,
2104
+ async fn(state) {
2105
+ var _middlewareData$arrow, _middlewareData$flip;
2106
+ const {
2107
+ placement,
2108
+ middlewareData,
2109
+ rects,
2110
+ initialPlacement,
2111
+ platform,
2112
+ elements
2113
+ } = state;
2114
+ const {
2115
+ mainAxis: checkMainAxis = true,
2116
+ crossAxis: checkCrossAxis = true,
2117
+ fallbackPlacements: specifiedFallbackPlacements,
2118
+ fallbackStrategy = 'bestFit',
2119
+ fallbackAxisSideDirection = 'none',
2120
+ flipAlignment = true,
2121
+ ...detectOverflowOptions
2122
+ } = evaluate(options, state);
2123
+
2124
+ // If a reset by the arrow was caused due to an alignment offset being
2125
+ // added, we should skip any logic now since `flip()` has already done its
2126
+ // work.
2127
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
2128
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
2129
+ return {};
2130
+ }
2131
+ const side = getSide(placement);
2132
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
2133
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
2134
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
2135
+ if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
2136
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
2137
+ }
2138
+ const placements = [initialPlacement, ...fallbackPlacements];
2139
+ const overflow = await detectOverflow(state, detectOverflowOptions);
2140
+ const overflows = [];
2141
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
2142
+ if (checkMainAxis) {
2143
+ overflows.push(overflow[side]);
2144
+ }
2145
+ if (checkCrossAxis) {
2146
+ const sides = getAlignmentSides(placement, rects, rtl);
2147
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
2148
+ }
2149
+ overflowsData = [...overflowsData, {
2150
+ placement,
2151
+ overflows
2152
+ }];
2153
+
2154
+ // One or more sides is overflowing.
2155
+ if (!overflows.every(side => side <= 0)) {
2156
+ var _middlewareData$flip2, _overflowsData$filter;
2157
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
2158
+ const nextPlacement = placements[nextIndex];
2159
+ if (nextPlacement) {
2160
+ // Try next placement and re-run the lifecycle.
2161
+ return {
2162
+ data: {
2163
+ index: nextIndex,
2164
+ overflows: overflowsData
2165
+ },
2166
+ reset: {
2167
+ placement: nextPlacement
2168
+ }
2169
+ };
2170
+ }
2171
+
2172
+ // First, find the candidates that fit on the mainAxis side of overflow,
2173
+ // then find the placement that fits the best on the main crossAxis side.
2174
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
2175
+
2176
+ // Otherwise fallback.
2177
+ if (!resetPlacement) {
2178
+ switch (fallbackStrategy) {
2179
+ case 'bestFit':
2180
+ {
2181
+ var _overflowsData$map$so;
2182
+ const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
2183
+ if (placement) {
2184
+ resetPlacement = placement;
2185
+ }
2186
+ break;
2187
+ }
2188
+ case 'initialPlacement':
2189
+ resetPlacement = initialPlacement;
2190
+ break;
2191
+ }
2192
+ }
2193
+ if (placement !== resetPlacement) {
2194
+ return {
2195
+ reset: {
2196
+ placement: resetPlacement
2197
+ }
2198
+ };
2199
+ }
2200
+ }
2201
+ return {};
2202
+ }
2203
+ };
2204
+ };
2205
+
2206
+ function getSideOffsets(overflow, rect) {
2207
+ return {
2208
+ top: overflow.top - rect.height,
2209
+ right: overflow.right - rect.width,
2210
+ bottom: overflow.bottom - rect.height,
2211
+ left: overflow.left - rect.width
2212
+ };
2213
+ }
2214
+ function isAnySideFullyClipped(overflow) {
2215
+ return sides.some(side => overflow[side] >= 0);
2216
+ }
2217
+ /**
2218
+ * Provides data to hide the floating element in applicable situations, such as
2219
+ * when it is not in the same clipping context as the reference element.
2220
+ * @see https://floating-ui.com/docs/hide
2221
+ */
2222
+ const hide = function (options) {
2223
+ if (options === void 0) {
2224
+ options = {};
2225
+ }
2226
+ return {
2227
+ name: 'hide',
2228
+ options,
2229
+ async fn(state) {
2230
+ const {
2231
+ rects
2232
+ } = state;
2233
+ const {
2234
+ strategy = 'referenceHidden',
2235
+ ...detectOverflowOptions
2236
+ } = evaluate(options, state);
2237
+ switch (strategy) {
2238
+ case 'referenceHidden':
2239
+ {
2240
+ const overflow = await detectOverflow(state, {
2241
+ ...detectOverflowOptions,
2242
+ elementContext: 'reference'
2243
+ });
2244
+ const offsets = getSideOffsets(overflow, rects.reference);
2245
+ return {
2246
+ data: {
2247
+ referenceHiddenOffsets: offsets,
2248
+ referenceHidden: isAnySideFullyClipped(offsets)
2249
+ }
2250
+ };
2251
+ }
2252
+ case 'escaped':
2253
+ {
2254
+ const overflow = await detectOverflow(state, {
2255
+ ...detectOverflowOptions,
2256
+ altBoundary: true
2257
+ });
2258
+ const offsets = getSideOffsets(overflow, rects.floating);
2259
+ return {
2260
+ data: {
2261
+ escapedOffsets: offsets,
2262
+ escaped: isAnySideFullyClipped(offsets)
2263
+ }
2264
+ };
2265
+ }
2266
+ default:
2267
+ {
2268
+ return {};
2269
+ }
2270
+ }
2271
+ }
2272
+ };
2273
+ };
2274
+
2275
+ function getBoundingRect(rects) {
2276
+ const minX = min(...rects.map(rect => rect.left));
2277
+ const minY = min(...rects.map(rect => rect.top));
2278
+ const maxX = max(...rects.map(rect => rect.right));
2279
+ const maxY = max(...rects.map(rect => rect.bottom));
2280
+ return {
2281
+ x: minX,
2282
+ y: minY,
2283
+ width: maxX - minX,
2284
+ height: maxY - minY
2285
+ };
2286
+ }
2287
+ function getRectsByLine(rects) {
2288
+ const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
2289
+ const groups = [];
2290
+ let prevRect = null;
2291
+ for (let i = 0; i < sortedRects.length; i++) {
2292
+ const rect = sortedRects[i];
2293
+ if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
2294
+ groups.push([rect]);
2295
+ } else {
2296
+ groups[groups.length - 1].push(rect);
2297
+ }
2298
+ prevRect = rect;
2299
+ }
2300
+ return groups.map(rect => rectToClientRect(getBoundingRect(rect)));
2301
+ }
2302
+ /**
2303
+ * Provides improved positioning for inline reference elements that can span
2304
+ * over multiple lines, such as hyperlinks or range selections.
2305
+ * @see https://floating-ui.com/docs/inline
2306
+ */
2307
+ const inline$1 = function (options) {
2308
+ if (options === void 0) {
2309
+ options = {};
2310
+ }
2311
+ return {
2312
+ name: 'inline',
2313
+ options,
2314
+ async fn(state) {
2315
+ const {
2316
+ placement,
2317
+ elements,
2318
+ rects,
2319
+ platform,
2320
+ strategy
2321
+ } = state;
2322
+ // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
2323
+ // ClientRect's bounds, despite the event listener being triggered. A
2324
+ // padding of 2 seems to handle this issue.
2325
+ const {
2326
+ padding = 2,
2327
+ x,
2328
+ y
2329
+ } = evaluate(options, state);
2330
+ const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
2331
+ const clientRects = getRectsByLine(nativeClientRects);
2332
+ const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
2333
+ const paddingObject = getPaddingObject(padding);
2334
+ function getBoundingClientRect() {
2335
+ // There are two rects and they are disjoined.
2336
+ if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
2337
+ // Find the first rect in which the point is fully inside.
2338
+ return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
2339
+ }
2340
+
2341
+ // There are 2 or more connected rects.
2342
+ if (clientRects.length >= 2) {
2343
+ if (getSideAxis(placement) === 'y') {
2344
+ const firstRect = clientRects[0];
2345
+ const lastRect = clientRects[clientRects.length - 1];
2346
+ const isTop = getSide(placement) === 'top';
2347
+ const top = firstRect.top;
2348
+ const bottom = lastRect.bottom;
2349
+ const left = isTop ? firstRect.left : lastRect.left;
2350
+ const right = isTop ? firstRect.right : lastRect.right;
2351
+ const width = right - left;
2352
+ const height = bottom - top;
2353
+ return {
2354
+ top,
2355
+ bottom,
2356
+ left,
2357
+ right,
2358
+ width,
2359
+ height,
2360
+ x: left,
2361
+ y: top
2362
+ };
2363
+ }
2364
+ const isLeftSide = getSide(placement) === 'left';
2365
+ const maxRight = max(...clientRects.map(rect => rect.right));
2366
+ const minLeft = min(...clientRects.map(rect => rect.left));
2367
+ const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
2368
+ const top = measureRects[0].top;
2369
+ const bottom = measureRects[measureRects.length - 1].bottom;
2370
+ const left = minLeft;
2371
+ const right = maxRight;
2372
+ const width = right - left;
2373
+ const height = bottom - top;
2374
+ return {
2375
+ top,
2376
+ bottom,
2377
+ left,
2378
+ right,
2379
+ width,
2380
+ height,
2381
+ x: left,
2382
+ y: top
2383
+ };
2384
+ }
2385
+ return fallback;
2386
+ }
2387
+ const resetRects = await platform.getElementRects({
2388
+ reference: {
2389
+ getBoundingClientRect
2390
+ },
2391
+ floating: elements.floating,
2392
+ strategy
2393
+ });
2394
+ if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
2395
+ return {
2396
+ reset: {
2397
+ rects: resetRects
2398
+ }
2399
+ };
2400
+ }
2401
+ return {};
2402
+ }
2403
+ };
2404
+ };
2405
+
2406
+ // For type backwards-compatibility, the `OffsetOptions` type was also
2407
+ // Derivable.
2408
+
2409
+ async function convertValueToCoords(state, options) {
2410
+ const {
2411
+ placement,
2412
+ platform,
2413
+ elements
2414
+ } = state;
2415
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
2416
+ const side = getSide(placement);
2417
+ const alignment = getAlignment(placement);
2418
+ const isVertical = getSideAxis(placement) === 'y';
2419
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
2420
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
2421
+ const rawValue = evaluate(options, state);
2422
+ let {
2423
+ mainAxis,
2424
+ crossAxis,
2425
+ alignmentAxis
2426
+ } = typeof rawValue === 'number' ? {
2427
+ mainAxis: rawValue,
2428
+ crossAxis: 0,
2429
+ alignmentAxis: null
2430
+ } : {
2431
+ mainAxis: 0,
2432
+ crossAxis: 0,
2433
+ alignmentAxis: null,
2434
+ ...rawValue
2435
+ };
2436
+ if (alignment && typeof alignmentAxis === 'number') {
2437
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
2438
+ }
2439
+ return isVertical ? {
2440
+ x: crossAxis * crossAxisMulti,
2441
+ y: mainAxis * mainAxisMulti
2442
+ } : {
2443
+ x: mainAxis * mainAxisMulti,
2444
+ y: crossAxis * crossAxisMulti
2445
+ };
2446
+ }
2447
+
2448
+ /**
2449
+ * Modifies the placement by translating the floating element along the
2450
+ * specified axes.
2451
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
2452
+ * object may be passed.
2453
+ * @see https://floating-ui.com/docs/offset
2454
+ */
2455
+ const offset$1 = function (options) {
2456
+ if (options === void 0) {
2457
+ options = 0;
2458
+ }
2459
+ return {
2460
+ name: 'offset',
2461
+ options,
2462
+ async fn(state) {
2463
+ var _middlewareData$offse, _middlewareData$arrow;
2464
+ const {
2465
+ x,
2466
+ y,
2467
+ placement,
2468
+ middlewareData
2469
+ } = state;
2470
+ const diffCoords = await convertValueToCoords(state, options);
2471
+
2472
+ // If the placement is the same and the arrow caused an alignment offset
2473
+ // then we don't need to change the positioning coordinates.
2474
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
2475
+ return {};
2476
+ }
2477
+ return {
2478
+ x: x + diffCoords.x,
2479
+ y: y + diffCoords.y,
2480
+ data: {
2481
+ ...diffCoords,
2482
+ placement
2483
+ }
2484
+ };
2485
+ }
2486
+ };
2487
+ };
2488
+
2489
+ /**
2490
+ * Optimizes the visibility of the floating element by shifting it in order to
2491
+ * keep it in view when it will overflow the clipping boundary.
2492
+ * @see https://floating-ui.com/docs/shift
2493
+ */
2494
+ const shift$1 = function (options) {
2495
+ if (options === void 0) {
2496
+ options = {};
2497
+ }
2498
+ return {
2499
+ name: 'shift',
2500
+ options,
2501
+ async fn(state) {
2502
+ const {
2503
+ x,
2504
+ y,
2505
+ placement
2506
+ } = state;
2507
+ const {
2508
+ mainAxis: checkMainAxis = true,
2509
+ crossAxis: checkCrossAxis = false,
2510
+ limiter = {
2511
+ fn: _ref => {
2512
+ let {
2513
+ x,
2514
+ y
2515
+ } = _ref;
2516
+ return {
2517
+ x,
2518
+ y
2519
+ };
2520
+ }
2521
+ },
2522
+ ...detectOverflowOptions
2523
+ } = evaluate(options, state);
2524
+ const coords = {
2525
+ x,
2526
+ y
2527
+ };
2528
+ const overflow = await detectOverflow(state, detectOverflowOptions);
2529
+ const crossAxis = getSideAxis(getSide(placement));
2530
+ const mainAxis = getOppositeAxis(crossAxis);
2531
+ let mainAxisCoord = coords[mainAxis];
2532
+ let crossAxisCoord = coords[crossAxis];
2533
+ if (checkMainAxis) {
2534
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
2535
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
2536
+ const min = mainAxisCoord + overflow[minSide];
2537
+ const max = mainAxisCoord - overflow[maxSide];
2538
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
2539
+ }
2540
+ if (checkCrossAxis) {
2541
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
2542
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
2543
+ const min = crossAxisCoord + overflow[minSide];
2544
+ const max = crossAxisCoord - overflow[maxSide];
2545
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
2546
+ }
2547
+ const limitedCoords = limiter.fn({
2548
+ ...state,
2549
+ [mainAxis]: mainAxisCoord,
2550
+ [crossAxis]: crossAxisCoord
2551
+ });
2552
+ return {
2553
+ ...limitedCoords,
2554
+ data: {
2555
+ x: limitedCoords.x - x,
2556
+ y: limitedCoords.y - y
2557
+ }
2558
+ };
2559
+ }
2560
+ };
2561
+ };
2562
+ /**
2563
+ * Built-in `limiter` that will stop `shift()` at a certain point.
2564
+ */
2565
+ const limitShift$1 = function (options) {
2566
+ if (options === void 0) {
2567
+ options = {};
2568
+ }
2569
+ return {
2570
+ options,
2571
+ fn(state) {
2572
+ const {
2573
+ x,
2574
+ y,
2575
+ placement,
2576
+ rects,
2577
+ middlewareData
2578
+ } = state;
2579
+ const {
2580
+ offset = 0,
2581
+ mainAxis: checkMainAxis = true,
2582
+ crossAxis: checkCrossAxis = true
2583
+ } = evaluate(options, state);
2584
+ const coords = {
2585
+ x,
2586
+ y
2587
+ };
2588
+ const crossAxis = getSideAxis(placement);
2589
+ const mainAxis = getOppositeAxis(crossAxis);
2590
+ let mainAxisCoord = coords[mainAxis];
2591
+ let crossAxisCoord = coords[crossAxis];
2592
+ const rawOffset = evaluate(offset, state);
2593
+ const computedOffset = typeof rawOffset === 'number' ? {
2594
+ mainAxis: rawOffset,
2595
+ crossAxis: 0
2596
+ } : {
2597
+ mainAxis: 0,
2598
+ crossAxis: 0,
2599
+ ...rawOffset
2600
+ };
2601
+ if (checkMainAxis) {
2602
+ const len = mainAxis === 'y' ? 'height' : 'width';
2603
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
2604
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
2605
+ if (mainAxisCoord < limitMin) {
2606
+ mainAxisCoord = limitMin;
2607
+ } else if (mainAxisCoord > limitMax) {
2608
+ mainAxisCoord = limitMax;
2609
+ }
2610
+ }
2611
+ if (checkCrossAxis) {
2612
+ var _middlewareData$offse, _middlewareData$offse2;
2613
+ const len = mainAxis === 'y' ? 'width' : 'height';
2614
+ const isOriginSide = ['top', 'left'].includes(getSide(placement));
2615
+ const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
2616
+ const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
2617
+ if (crossAxisCoord < limitMin) {
2618
+ crossAxisCoord = limitMin;
2619
+ } else if (crossAxisCoord > limitMax) {
2620
+ crossAxisCoord = limitMax;
2621
+ }
2622
+ }
2623
+ return {
2624
+ [mainAxis]: mainAxisCoord,
2625
+ [crossAxis]: crossAxisCoord
2626
+ };
2627
+ }
2628
+ };
2629
+ };
2630
+
2631
+ /**
2632
+ * Provides data that allows you to change the size of the floating element —
2633
+ * for instance, prevent it from overflowing the clipping boundary or match the
2634
+ * width of the reference element.
2635
+ * @see https://floating-ui.com/docs/size
2636
+ */
2637
+ const size$1 = function (options) {
2638
+ if (options === void 0) {
2639
+ options = {};
2640
+ }
2641
+ return {
2642
+ name: 'size',
2643
+ options,
2644
+ async fn(state) {
2645
+ const {
2646
+ placement,
2647
+ rects,
2648
+ platform,
2649
+ elements
2650
+ } = state;
2651
+ const {
2652
+ apply = () => {},
2653
+ ...detectOverflowOptions
2654
+ } = evaluate(options, state);
2655
+ const overflow = await detectOverflow(state, detectOverflowOptions);
2656
+ const side = getSide(placement);
2657
+ const alignment = getAlignment(placement);
2658
+ const isYAxis = getSideAxis(placement) === 'y';
2659
+ const {
2660
+ width,
2661
+ height
2662
+ } = rects.floating;
2663
+ let heightSide;
2664
+ let widthSide;
2665
+ if (side === 'top' || side === 'bottom') {
2666
+ heightSide = side;
2667
+ widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
2668
+ } else {
2669
+ widthSide = side;
2670
+ heightSide = alignment === 'end' ? 'top' : 'bottom';
2671
+ }
2672
+ const overflowAvailableHeight = height - overflow[heightSide];
2673
+ const overflowAvailableWidth = width - overflow[widthSide];
2674
+ const noShift = !state.middlewareData.shift;
2675
+ let availableHeight = overflowAvailableHeight;
2676
+ let availableWidth = overflowAvailableWidth;
2677
+ if (isYAxis) {
2678
+ const maximumClippingWidth = width - overflow.left - overflow.right;
2679
+ availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
2680
+ } else {
2681
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
2682
+ availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
2683
+ }
2684
+ if (noShift && !alignment) {
2685
+ const xMin = max(overflow.left, 0);
2686
+ const xMax = max(overflow.right, 0);
2687
+ const yMin = max(overflow.top, 0);
2688
+ const yMax = max(overflow.bottom, 0);
2689
+ if (isYAxis) {
2690
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
2691
+ } else {
2692
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
2693
+ }
2694
+ }
2695
+ await apply({
2696
+ ...state,
2697
+ availableWidth,
2698
+ availableHeight
2699
+ });
2700
+ const nextDimensions = await platform.getDimensions(elements.floating);
2701
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
2702
+ return {
2703
+ reset: {
2704
+ rects: true
2705
+ }
2706
+ };
2707
+ }
2708
+ return {};
2709
+ }
2710
+ };
2711
+ };
2712
+
2713
+ function hasWindow() {
2714
+ return typeof window !== 'undefined';
2715
+ }
2716
+ function getNodeName(node) {
2717
+ if (isNode(node)) {
2718
+ return (node.nodeName || '').toLowerCase();
2719
+ }
2720
+ // Mocked nodes in testing environments may not be instances of Node. By
2721
+ // returning `#document` an infinite loop won't occur.
2722
+ // https://github.com/floating-ui/floating-ui/issues/2317
2723
+ return '#document';
2724
+ }
2725
+ function getWindow(node) {
2726
+ var _node$ownerDocument;
2727
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
2728
+ }
2729
+ function getDocumentElement(node) {
2730
+ var _ref;
2731
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
2732
+ }
2733
+ function isNode(value) {
2734
+ if (!hasWindow()) {
2735
+ return false;
2736
+ }
2737
+ return value instanceof Node || value instanceof getWindow(value).Node;
2738
+ }
2739
+ function isElement(value) {
2740
+ if (!hasWindow()) {
2741
+ return false;
2742
+ }
2743
+ return value instanceof Element || value instanceof getWindow(value).Element;
2744
+ }
2745
+ function isHTMLElement(value) {
2746
+ if (!hasWindow()) {
2747
+ return false;
2748
+ }
2749
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
2750
+ }
2751
+ function isShadowRoot(value) {
2752
+ if (!hasWindow() || typeof ShadowRoot === 'undefined') {
2753
+ return false;
2754
+ }
2755
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
2756
+ }
2757
+ function isOverflowElement(element) {
2758
+ const {
2759
+ overflow,
2760
+ overflowX,
2761
+ overflowY,
2762
+ display
2763
+ } = getComputedStyle$1(element);
2764
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
2765
+ }
2766
+ function isTableElement(element) {
2767
+ return ['table', 'td', 'th'].includes(getNodeName(element));
2768
+ }
2769
+ function isTopLayer(element) {
2770
+ return [':popover-open', ':modal'].some(selector => {
2771
+ try {
2772
+ return element.matches(selector);
2773
+ } catch (e) {
2774
+ return false;
2775
+ }
2776
+ });
2777
+ }
2778
+ function isContainingBlock(elementOrCss) {
2779
+ const webkit = isWebKit();
2780
+ const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
2781
+
2782
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
2783
+ // https://drafts.csswg.org/css-transforms-2/#individual-transforms
2784
+ return ['transform', 'translate', 'scale', 'rotate', 'perspective'].some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
2785
+ }
2786
+ function getContainingBlock(element) {
2787
+ let currentNode = getParentNode(element);
2788
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
2789
+ if (isContainingBlock(currentNode)) {
2790
+ return currentNode;
2791
+ } else if (isTopLayer(currentNode)) {
2792
+ return null;
2793
+ }
2794
+ currentNode = getParentNode(currentNode);
2795
+ }
2796
+ return null;
2797
+ }
2798
+ function isWebKit() {
2799
+ if (typeof CSS === 'undefined' || !CSS.supports) return false;
2800
+ return CSS.supports('-webkit-backdrop-filter', 'none');
2801
+ }
2802
+ function isLastTraversableNode(node) {
2803
+ return ['html', 'body', '#document'].includes(getNodeName(node));
2804
+ }
2805
+ function getComputedStyle$1(element) {
2806
+ return getWindow(element).getComputedStyle(element);
2807
+ }
2808
+ function getNodeScroll(element) {
2809
+ if (isElement(element)) {
2810
+ return {
2811
+ scrollLeft: element.scrollLeft,
2812
+ scrollTop: element.scrollTop
2813
+ };
2814
+ }
2815
+ return {
2816
+ scrollLeft: element.scrollX,
2817
+ scrollTop: element.scrollY
2818
+ };
2819
+ }
2820
+ function getParentNode(node) {
2821
+ if (getNodeName(node) === 'html') {
2822
+ return node;
2823
+ }
2824
+ const result =
2825
+ // Step into the shadow DOM of the parent of a slotted node.
2826
+ node.assignedSlot ||
2827
+ // DOM Element detected.
2828
+ node.parentNode ||
2829
+ // ShadowRoot detected.
2830
+ isShadowRoot(node) && node.host ||
2831
+ // Fallback.
2832
+ getDocumentElement(node);
2833
+ return isShadowRoot(result) ? result.host : result;
2834
+ }
2835
+ function getNearestOverflowAncestor(node) {
2836
+ const parentNode = getParentNode(node);
2837
+ if (isLastTraversableNode(parentNode)) {
2838
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
2839
+ }
2840
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
2841
+ return parentNode;
2842
+ }
2843
+ return getNearestOverflowAncestor(parentNode);
2844
+ }
2845
+ function getOverflowAncestors(node, list, traverseIframes) {
2846
+ var _node$ownerDocument2;
2847
+ if (list === void 0) {
2848
+ list = [];
2849
+ }
2850
+ if (traverseIframes === void 0) {
2851
+ traverseIframes = true;
2852
+ }
2853
+ const scrollableAncestor = getNearestOverflowAncestor(node);
2854
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
2855
+ const win = getWindow(scrollableAncestor);
2856
+ if (isBody) {
2857
+ const frameElement = getFrameElement(win);
2858
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
2859
+ }
2860
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
2861
+ }
2862
+ function getFrameElement(win) {
2863
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
2864
+ }
2865
+
2866
+ function getCssDimensions(element) {
2867
+ const css = getComputedStyle$1(element);
2868
+ // In testing environments, the `width` and `height` properties are empty
2869
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
2870
+ let width = parseFloat(css.width) || 0;
2871
+ let height = parseFloat(css.height) || 0;
2872
+ const hasOffset = isHTMLElement(element);
2873
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
2874
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
2875
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
2876
+ if (shouldFallback) {
2877
+ width = offsetWidth;
2878
+ height = offsetHeight;
2879
+ }
2880
+ return {
2881
+ width,
2882
+ height,
2883
+ $: shouldFallback
2884
+ };
2885
+ }
2886
+
2887
+ function unwrapElement(element) {
2888
+ return !isElement(element) ? element.contextElement : element;
2889
+ }
2890
+
2891
+ function getScale(element) {
2892
+ const domElement = unwrapElement(element);
2893
+ if (!isHTMLElement(domElement)) {
2894
+ return createCoords(1);
2895
+ }
2896
+ const rect = domElement.getBoundingClientRect();
2897
+ const {
2898
+ width,
2899
+ height,
2900
+ $
2901
+ } = getCssDimensions(domElement);
2902
+ let x = ($ ? round(rect.width) : rect.width) / width;
2903
+ let y = ($ ? round(rect.height) : rect.height) / height;
2904
+
2905
+ // 0, NaN, or Infinity should always fallback to 1.
2906
+
2907
+ if (!x || !Number.isFinite(x)) {
2908
+ x = 1;
2909
+ }
2910
+ if (!y || !Number.isFinite(y)) {
2911
+ y = 1;
2912
+ }
2913
+ return {
2914
+ x,
2915
+ y
2916
+ };
2917
+ }
2918
+
2919
+ const noOffsets = /*#__PURE__*/createCoords(0);
2920
+ function getVisualOffsets(element) {
2921
+ const win = getWindow(element);
2922
+ if (!isWebKit() || !win.visualViewport) {
2923
+ return noOffsets;
2924
+ }
2925
+ return {
2926
+ x: win.visualViewport.offsetLeft,
2927
+ y: win.visualViewport.offsetTop
2928
+ };
2929
+ }
2930
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
2931
+ if (isFixed === void 0) {
2932
+ isFixed = false;
2933
+ }
2934
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
2935
+ return false;
2936
+ }
2937
+ return isFixed;
2938
+ }
2939
+
2940
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
2941
+ if (includeScale === void 0) {
2942
+ includeScale = false;
2943
+ }
2944
+ if (isFixedStrategy === void 0) {
2945
+ isFixedStrategy = false;
2946
+ }
2947
+ const clientRect = element.getBoundingClientRect();
2948
+ const domElement = unwrapElement(element);
2949
+ let scale = createCoords(1);
2950
+ if (includeScale) {
2951
+ if (offsetParent) {
2952
+ if (isElement(offsetParent)) {
2953
+ scale = getScale(offsetParent);
2954
+ }
2955
+ } else {
2956
+ scale = getScale(element);
2957
+ }
2958
+ }
2959
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
2960
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
2961
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
2962
+ let width = clientRect.width / scale.x;
2963
+ let height = clientRect.height / scale.y;
2964
+ if (domElement) {
2965
+ const win = getWindow(domElement);
2966
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
2967
+ let currentWin = win;
2968
+ let currentIFrame = getFrameElement(currentWin);
2969
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
2970
+ const iframeScale = getScale(currentIFrame);
2971
+ const iframeRect = currentIFrame.getBoundingClientRect();
2972
+ const css = getComputedStyle$1(currentIFrame);
2973
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
2974
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
2975
+ x *= iframeScale.x;
2976
+ y *= iframeScale.y;
2977
+ width *= iframeScale.x;
2978
+ height *= iframeScale.y;
2979
+ x += left;
2980
+ y += top;
2981
+ currentWin = getWindow(currentIFrame);
2982
+ currentIFrame = getFrameElement(currentWin);
2983
+ }
2984
+ }
2985
+ return rectToClientRect({
2986
+ width,
2987
+ height,
2988
+ x,
2989
+ y
2990
+ });
2991
+ }
2992
+
2993
+ // If <html> has a CSS width greater than the viewport, then this will be
2994
+ // incorrect for RTL.
2995
+ function getWindowScrollBarX(element, rect) {
2996
+ const leftScroll = getNodeScroll(element).scrollLeft;
2997
+ if (!rect) {
2998
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
2999
+ }
3000
+ return rect.left + leftScroll;
3001
+ }
3002
+
3003
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
3004
+ if (ignoreScrollbarX === void 0) {
3005
+ ignoreScrollbarX = false;
3006
+ }
3007
+ const htmlRect = documentElement.getBoundingClientRect();
3008
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
3009
+ // RTL <body> scrollbar.
3010
+ getWindowScrollBarX(documentElement, htmlRect));
3011
+ const y = htmlRect.top + scroll.scrollTop;
3012
+ return {
3013
+ x,
3014
+ y
3015
+ };
3016
+ }
3017
+
3018
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
3019
+ let {
3020
+ elements,
3021
+ rect,
3022
+ offsetParent,
3023
+ strategy
3024
+ } = _ref;
3025
+ const isFixed = strategy === 'fixed';
3026
+ const documentElement = getDocumentElement(offsetParent);
3027
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
3028
+ if (offsetParent === documentElement || topLayer && isFixed) {
3029
+ return rect;
3030
+ }
3031
+ let scroll = {
3032
+ scrollLeft: 0,
3033
+ scrollTop: 0
3034
+ };
3035
+ let scale = createCoords(1);
3036
+ const offsets = createCoords(0);
3037
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
3038
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
3039
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
3040
+ scroll = getNodeScroll(offsetParent);
3041
+ }
3042
+ if (isHTMLElement(offsetParent)) {
3043
+ const offsetRect = getBoundingClientRect(offsetParent);
3044
+ scale = getScale(offsetParent);
3045
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
3046
+ offsets.y = offsetRect.y + offsetParent.clientTop;
3047
+ }
3048
+ }
3049
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
3050
+ return {
3051
+ width: rect.width * scale.x,
3052
+ height: rect.height * scale.y,
3053
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
3054
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
3055
+ };
3056
+ }
3057
+
3058
+ function getClientRects(element) {
3059
+ return Array.from(element.getClientRects());
3060
+ }
3061
+
3062
+ // Gets the entire size of the scrollable document area, even extending outside
3063
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
3064
+ function getDocumentRect(element) {
3065
+ const html = getDocumentElement(element);
3066
+ const scroll = getNodeScroll(element);
3067
+ const body = element.ownerDocument.body;
3068
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
3069
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
3070
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
3071
+ const y = -scroll.scrollTop;
3072
+ if (getComputedStyle$1(body).direction === 'rtl') {
3073
+ x += max(html.clientWidth, body.clientWidth) - width;
3074
+ }
3075
+ return {
3076
+ width,
3077
+ height,
3078
+ x,
3079
+ y
3080
+ };
3081
+ }
3082
+
3083
+ function getViewportRect(element, strategy) {
3084
+ const win = getWindow(element);
3085
+ const html = getDocumentElement(element);
3086
+ const visualViewport = win.visualViewport;
3087
+ let width = html.clientWidth;
3088
+ let height = html.clientHeight;
3089
+ let x = 0;
3090
+ let y = 0;
3091
+ if (visualViewport) {
3092
+ width = visualViewport.width;
3093
+ height = visualViewport.height;
3094
+ const visualViewportBased = isWebKit();
3095
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
3096
+ x = visualViewport.offsetLeft;
3097
+ y = visualViewport.offsetTop;
3098
+ }
3099
+ }
3100
+ return {
3101
+ width,
3102
+ height,
3103
+ x,
3104
+ y
3105
+ };
3106
+ }
3107
+
3108
+ // Returns the inner client rect, subtracting scrollbars if present.
3109
+ function getInnerBoundingClientRect(element, strategy) {
3110
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
3111
+ const top = clientRect.top + element.clientTop;
3112
+ const left = clientRect.left + element.clientLeft;
3113
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
3114
+ const width = element.clientWidth * scale.x;
3115
+ const height = element.clientHeight * scale.y;
3116
+ const x = left * scale.x;
3117
+ const y = top * scale.y;
3118
+ return {
3119
+ width,
3120
+ height,
3121
+ x,
3122
+ y
3123
+ };
3124
+ }
3125
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
3126
+ let rect;
3127
+ if (clippingAncestor === 'viewport') {
3128
+ rect = getViewportRect(element, strategy);
3129
+ } else if (clippingAncestor === 'document') {
3130
+ rect = getDocumentRect(getDocumentElement(element));
3131
+ } else if (isElement(clippingAncestor)) {
3132
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
3133
+ } else {
3134
+ const visualOffsets = getVisualOffsets(element);
3135
+ rect = {
3136
+ x: clippingAncestor.x - visualOffsets.x,
3137
+ y: clippingAncestor.y - visualOffsets.y,
3138
+ width: clippingAncestor.width,
3139
+ height: clippingAncestor.height
3140
+ };
3141
+ }
3142
+ return rectToClientRect(rect);
3143
+ }
3144
+ function hasFixedPositionAncestor(element, stopNode) {
3145
+ const parentNode = getParentNode(element);
3146
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
3147
+ return false;
3148
+ }
3149
+ return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
3150
+ }
3151
+
3152
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
3153
+ // clipping (or hiding) child elements. This returns all clipping ancestors
3154
+ // of the given element up the tree.
3155
+ function getClippingElementAncestors(element, cache) {
3156
+ const cachedResult = cache.get(element);
3157
+ if (cachedResult) {
3158
+ return cachedResult;
3159
+ }
3160
+ let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
3161
+ let currentContainingBlockComputedStyle = null;
3162
+ const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
3163
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
3164
+
3165
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
3166
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
3167
+ const computedStyle = getComputedStyle$1(currentNode);
3168
+ const currentNodeIsContaining = isContainingBlock(currentNode);
3169
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
3170
+ currentContainingBlockComputedStyle = null;
3171
+ }
3172
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
3173
+ if (shouldDropCurrentNode) {
3174
+ // Drop non-containing blocks.
3175
+ result = result.filter(ancestor => ancestor !== currentNode);
3176
+ } else {
3177
+ // Record last containing block for next iteration.
3178
+ currentContainingBlockComputedStyle = computedStyle;
3179
+ }
3180
+ currentNode = getParentNode(currentNode);
3181
+ }
3182
+ cache.set(element, result);
3183
+ return result;
3184
+ }
3185
+
3186
+ // Gets the maximum area that the element is visible in due to any number of
3187
+ // clipping ancestors.
3188
+ function getClippingRect(_ref) {
3189
+ let {
3190
+ element,
3191
+ boundary,
3192
+ rootBoundary,
3193
+ strategy
3194
+ } = _ref;
3195
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
3196
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
3197
+ const firstClippingAncestor = clippingAncestors[0];
3198
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
3199
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
3200
+ accRect.top = max(rect.top, accRect.top);
3201
+ accRect.right = min(rect.right, accRect.right);
3202
+ accRect.bottom = min(rect.bottom, accRect.bottom);
3203
+ accRect.left = max(rect.left, accRect.left);
3204
+ return accRect;
3205
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
3206
+ return {
3207
+ width: clippingRect.right - clippingRect.left,
3208
+ height: clippingRect.bottom - clippingRect.top,
3209
+ x: clippingRect.left,
3210
+ y: clippingRect.top
3211
+ };
3212
+ }
3213
+
3214
+ function getDimensions(element) {
3215
+ const {
3216
+ width,
3217
+ height
3218
+ } = getCssDimensions(element);
3219
+ return {
3220
+ width,
3221
+ height
3222
+ };
3223
+ }
3224
+
3225
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
3226
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
3227
+ const documentElement = getDocumentElement(offsetParent);
3228
+ const isFixed = strategy === 'fixed';
3229
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
3230
+ let scroll = {
3231
+ scrollLeft: 0,
3232
+ scrollTop: 0
3233
+ };
3234
+ const offsets = createCoords(0);
3235
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
3236
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
3237
+ scroll = getNodeScroll(offsetParent);
3238
+ }
3239
+ if (isOffsetParentAnElement) {
3240
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
3241
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
3242
+ offsets.y = offsetRect.y + offsetParent.clientTop;
3243
+ } else if (documentElement) {
3244
+ // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
3245
+ // Firefox with layout.scrollbar.side = 3 in about:config to test this.
3246
+ offsets.x = getWindowScrollBarX(documentElement);
3247
+ }
3248
+ }
3249
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
3250
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
3251
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
3252
+ return {
3253
+ x,
3254
+ y,
3255
+ width: rect.width,
3256
+ height: rect.height
3257
+ };
3258
+ }
3259
+
3260
+ function isStaticPositioned(element) {
3261
+ return getComputedStyle$1(element).position === 'static';
3262
+ }
3263
+
3264
+ function getTrueOffsetParent(element, polyfill) {
3265
+ if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
3266
+ return null;
3267
+ }
3268
+ if (polyfill) {
3269
+ return polyfill(element);
3270
+ }
3271
+ let rawOffsetParent = element.offsetParent;
3272
+
3273
+ // Firefox returns the <html> element as the offsetParent if it's non-static,
3274
+ // while Chrome and Safari return the <body> element. The <body> element must
3275
+ // be used to perform the correct calculations even if the <html> element is
3276
+ // non-static.
3277
+ if (getDocumentElement(element) === rawOffsetParent) {
3278
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
3279
+ }
3280
+ return rawOffsetParent;
3281
+ }
3282
+
3283
+ // Gets the closest ancestor positioned element. Handles some edge cases,
3284
+ // such as table ancestors and cross browser bugs.
3285
+ function getOffsetParent(element, polyfill) {
3286
+ const win = getWindow(element);
3287
+ if (isTopLayer(element)) {
3288
+ return win;
3289
+ }
3290
+ if (!isHTMLElement(element)) {
3291
+ let svgOffsetParent = getParentNode(element);
3292
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
3293
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
3294
+ return svgOffsetParent;
3295
+ }
3296
+ svgOffsetParent = getParentNode(svgOffsetParent);
3297
+ }
3298
+ return win;
3299
+ }
3300
+ let offsetParent = getTrueOffsetParent(element, polyfill);
3301
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
3302
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
3303
+ }
3304
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
3305
+ return win;
3306
+ }
3307
+ return offsetParent || getContainingBlock(element) || win;
3308
+ }
3309
+
3310
+ const getElementRects = async function (data) {
3311
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
3312
+ const getDimensionsFn = this.getDimensions;
3313
+ const floatingDimensions = await getDimensionsFn(data.floating);
3314
+ return {
3315
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
3316
+ floating: {
3317
+ x: 0,
3318
+ y: 0,
3319
+ width: floatingDimensions.width,
3320
+ height: floatingDimensions.height
3321
+ }
3322
+ };
3323
+ };
3324
+
3325
+ function isRTL(element) {
3326
+ return getComputedStyle$1(element).direction === 'rtl';
3327
+ }
3328
+
3329
+ const platform = {
3330
+ convertOffsetParentRelativeRectToViewportRelativeRect,
3331
+ getDocumentElement,
3332
+ getClippingRect,
3333
+ getOffsetParent,
3334
+ getElementRects,
3335
+ getClientRects,
3336
+ getDimensions,
3337
+ getScale,
3338
+ isElement,
3339
+ isRTL
3340
+ };
3341
+
3342
+ function rectsAreEqual(a, b) {
3343
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
3344
+ }
3345
+
3346
+ // https://samthor.au/2021/observing-dom/
3347
+ function observeMove(element, onMove) {
3348
+ let io = null;
3349
+ let timeoutId;
3350
+ const root = getDocumentElement(element);
3351
+ function cleanup() {
3352
+ var _io;
3353
+ clearTimeout(timeoutId);
3354
+ (_io = io) == null || _io.disconnect();
3355
+ io = null;
3356
+ }
3357
+ function refresh(skip, threshold) {
3358
+ if (skip === void 0) {
3359
+ skip = false;
3360
+ }
3361
+ if (threshold === void 0) {
3362
+ threshold = 1;
3363
+ }
3364
+ cleanup();
3365
+ const elementRectForRootMargin = element.getBoundingClientRect();
3366
+ const {
3367
+ left,
3368
+ top,
3369
+ width,
3370
+ height
3371
+ } = elementRectForRootMargin;
3372
+ if (!skip) {
3373
+ onMove();
3374
+ }
3375
+ if (!width || !height) {
3376
+ return;
3377
+ }
3378
+ const insetTop = floor(top);
3379
+ const insetRight = floor(root.clientWidth - (left + width));
3380
+ const insetBottom = floor(root.clientHeight - (top + height));
3381
+ const insetLeft = floor(left);
3382
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
3383
+ const options = {
3384
+ rootMargin,
3385
+ threshold: max(0, min(1, threshold)) || 1
3386
+ };
3387
+ let isFirstUpdate = true;
3388
+ function handleObserve(entries) {
3389
+ const ratio = entries[0].intersectionRatio;
3390
+ if (ratio !== threshold) {
3391
+ if (!isFirstUpdate) {
3392
+ return refresh();
3393
+ }
3394
+ if (!ratio) {
3395
+ // If the reference is clipped, the ratio is 0. Throttle the refresh
3396
+ // to prevent an infinite loop of updates.
3397
+ timeoutId = setTimeout(() => {
3398
+ refresh(false, 1e-7);
3399
+ }, 1000);
3400
+ } else {
3401
+ refresh(false, ratio);
3402
+ }
3403
+ }
3404
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
3405
+ // It's possible that even though the ratio is reported as 1, the
3406
+ // element is not actually fully within the IntersectionObserver's root
3407
+ // area anymore. This can happen under performance constraints. This may
3408
+ // be a bug in the browser's IntersectionObserver implementation. To
3409
+ // work around this, we compare the element's bounding rect now with
3410
+ // what it was at the time we created the IntersectionObserver. If they
3411
+ // are not equal then the element moved, so we refresh.
3412
+ refresh();
3413
+ }
3414
+ isFirstUpdate = false;
3415
+ }
3416
+
3417
+ // Older browsers don't support a `document` as the root and will throw an
3418
+ // error.
3419
+ try {
3420
+ io = new IntersectionObserver(handleObserve, {
3421
+ ...options,
3422
+ // Handle <iframe>s
3423
+ root: root.ownerDocument
3424
+ });
3425
+ } catch (e) {
3426
+ io = new IntersectionObserver(handleObserve, options);
3427
+ }
3428
+ io.observe(element);
3429
+ }
3430
+ refresh(true);
3431
+ return cleanup;
3432
+ }
3433
+
3434
+ /**
3435
+ * Automatically updates the position of the floating element when necessary.
3436
+ * Should only be called when the floating element is mounted on the DOM or
3437
+ * visible on the screen.
3438
+ * @returns cleanup function that should be invoked when the floating element is
3439
+ * removed from the DOM or hidden from the screen.
3440
+ * @see https://floating-ui.com/docs/autoUpdate
3441
+ */
3442
+ function autoUpdate(reference, floating, update, options) {
3443
+ if (options === void 0) {
3444
+ options = {};
3445
+ }
3446
+ const {
3447
+ ancestorScroll = true,
3448
+ ancestorResize = true,
3449
+ elementResize = typeof ResizeObserver === 'function',
3450
+ layoutShift = typeof IntersectionObserver === 'function',
3451
+ animationFrame = false
3452
+ } = options;
3453
+ const referenceEl = unwrapElement(reference);
3454
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
3455
+ ancestors.forEach(ancestor => {
3456
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
3457
+ passive: true
3458
+ });
3459
+ ancestorResize && ancestor.addEventListener('resize', update);
3460
+ });
3461
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
3462
+ let reobserveFrame = -1;
3463
+ let resizeObserver = null;
3464
+ if (elementResize) {
3465
+ resizeObserver = new ResizeObserver(_ref => {
3466
+ let [firstEntry] = _ref;
3467
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
3468
+ // Prevent update loops when using the `size` middleware.
3469
+ // https://github.com/floating-ui/floating-ui/issues/1740
3470
+ resizeObserver.unobserve(floating);
3471
+ cancelAnimationFrame(reobserveFrame);
3472
+ reobserveFrame = requestAnimationFrame(() => {
3473
+ var _resizeObserver;
3474
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
3475
+ });
3476
+ }
3477
+ update();
3478
+ });
3479
+ if (referenceEl && !animationFrame) {
3480
+ resizeObserver.observe(referenceEl);
3481
+ }
3482
+ resizeObserver.observe(floating);
3483
+ }
3484
+ let frameId;
3485
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
3486
+ if (animationFrame) {
3487
+ frameLoop();
3488
+ }
3489
+ function frameLoop() {
3490
+ const nextRefRect = getBoundingClientRect(reference);
3491
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
3492
+ update();
3493
+ }
3494
+ prevRefRect = nextRefRect;
3495
+ frameId = requestAnimationFrame(frameLoop);
3496
+ }
3497
+ update();
3498
+ return () => {
3499
+ var _resizeObserver2;
3500
+ ancestors.forEach(ancestor => {
3501
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
3502
+ ancestorResize && ancestor.removeEventListener('resize', update);
3503
+ });
3504
+ cleanupIo == null || cleanupIo();
3505
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
3506
+ resizeObserver = null;
3507
+ if (animationFrame) {
3508
+ cancelAnimationFrame(frameId);
3509
+ }
3510
+ };
3511
+ }
3512
+
3513
+ /**
3514
+ * Modifies the placement by translating the floating element along the
3515
+ * specified axes.
3516
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
3517
+ * object may be passed.
3518
+ * @see https://floating-ui.com/docs/offset
3519
+ */
3520
+ const offset = offset$1;
3521
+
3522
+ /**
3523
+ * Optimizes the visibility of the floating element by choosing the placement
3524
+ * that has the most space available automatically, without needing to specify a
3525
+ * preferred placement. Alternative to `flip`.
3526
+ * @see https://floating-ui.com/docs/autoPlacement
3527
+ */
3528
+ autoPlacement;
3529
+
3530
+ /**
3531
+ * Optimizes the visibility of the floating element by shifting it in order to
3532
+ * keep it in view when it will overflow the clipping boundary.
3533
+ * @see https://floating-ui.com/docs/shift
3534
+ */
3535
+ const shift = shift$1;
3536
+
3537
+ /**
3538
+ * Optimizes the visibility of the floating element by flipping the `placement`
3539
+ * in order to keep it in view when the preferred placement(s) will overflow the
3540
+ * clipping boundary. Alternative to `autoPlacement`.
3541
+ * @see https://floating-ui.com/docs/flip
3542
+ */
3543
+ const flip = flip$1;
3544
+
3545
+ /**
3546
+ * Provides data that allows you to change the size of the floating element —
3547
+ * for instance, prevent it from overflowing the clipping boundary or match the
3548
+ * width of the reference element.
3549
+ * @see https://floating-ui.com/docs/size
3550
+ */
3551
+ const size = size$1;
3552
+
3553
+ /**
3554
+ * Provides data to hide the floating element in applicable situations, such as
3555
+ * when it is not in the same clipping context as the reference element.
3556
+ * @see https://floating-ui.com/docs/hide
3557
+ */
3558
+ hide;
3559
+
3560
+ /**
3561
+ * Provides data to position an inner element of the floating element so that it
3562
+ * appears centered to the reference element.
3563
+ * @see https://floating-ui.com/docs/arrow
3564
+ */
3565
+ const arrow = arrow$1;
3566
+
3567
+ /**
3568
+ * Provides improved positioning for inline reference elements that can span
3569
+ * over multiple lines, such as hyperlinks or range selections.
3570
+ * @see https://floating-ui.com/docs/inline
3571
+ */
3572
+ const inline = inline$1;
3573
+
3574
+ /**
3575
+ * Built-in `limiter` that will stop `shift()` at a certain point.
3576
+ */
3577
+ const limitShift = limitShift$1;
3578
+
3579
+ /**
3580
+ * Computes the `x` and `y` coordinates that will place the floating element
3581
+ * next to a given reference element.
3582
+ */
3583
+ const computePosition = (reference, floating, options) => {
3584
+ // This caches the expensive `getClippingElementAncestors` function so that
3585
+ // multiple lifecycle resets re-use the same result. It only lives for a
3586
+ // single call. If other functions become expensive, we can add them as well.
3587
+ const cache = new Map();
3588
+ const mergedOptions = {
3589
+ platform,
3590
+ ...options
3591
+ };
3592
+ const platformWithCache = {
3593
+ ...mergedOptions.platform,
3594
+ _c: cache
3595
+ };
3596
+ return computePosition$1(reference, floating, {
3597
+ ...mergedOptions,
3598
+ platform: platformWithCache
3599
+ });
3600
+ };
3601
+
3602
+ (()=>{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=`
3603
+ :where([popover]) {
3604
+ position: fixed;
3605
+ z-index: 2147483647;
3606
+ inset: 0;
3607
+ padding: 0.25em;
3608
+ width: fit-content;
3609
+ height: fit-content;
3610
+ border-width: initial;
3611
+ border-color: initial;
3612
+ border-image: initial;
3613
+ border-style: solid;
3614
+ background-color: canvas;
3615
+ color: canvastext;
3616
+ overflow: auto;
3617
+ margin: auto;
3618
+ }
3619
+
3620
+ :where(dialog[popover][open]) {
3621
+ display: revert;
3622
+ }
3623
+
3624
+ :where([anchor].\\:popover-open) {
3625
+ inset: auto;
3626
+ }
3627
+
3628
+ :where([anchor]:popover-open) {
3629
+ inset: auto;
3630
+ }
3631
+
3632
+ @supports not (background-color: canvas) {
3633
+ :where([popover]) {
3634
+ background-color: white;
3635
+ color: black;
3636
+ }
3637
+ }
3638
+
3639
+ @supports (width: -moz-fit-content) {
3640
+ :where([popover]) {
3641
+ width: -moz-fit-content;
3642
+ height: -moz-fit-content;
3643
+ }
3644
+ }
3645
+
3646
+ @supports not (inset: 0) {
3647
+ :where([popover]) {
3648
+ top: 0;
3649
+ left: 0;
3650
+ right: 0;
3651
+ bottom: 0;
3652
+ }
3653
+ }
3654
+
3655
+ :where([popover]:not(.\\:popover-open)) {
3656
+ display: none;
3657
+ }
3658
+ `,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();})();
3659
+
3660
+ const postPopovercontainerCss = "@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}:where(post-popovercontainer){background-color:rgba(0,0,0,0);border:rgba(0,0,0,0);position:fixed;margin:0;padding:0;overflow:visible}:where(post-popovercontainer)>div{box-shadow:var(--post-device-elevation-300);width:max-content;color:var(--post-current-palette-fg);background-color:var(--post-current-palette-bg);border:2px solid rgba(0,0,0,0);border-radius:4px}: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)[safe-space]::after{content:\"\";position:fixed;inset:0;z-index:-1;pointer-events:auto}:where(post-popovercontainer)[safe-space=triangle]::after{clip-path:polygon(var(--safe-space-cursor-x, 0) var(--safe-space-cursor-y, 0), var(--safe-space-popover-x-start, var(--safe-space-popover-x, 0)) var(--safe-space-popover-y, var(--safe-space-popover-y-start, 0)), var(--safe-space-popover-x-end, var(--safe-space-popover-x, 0)) var(--safe-space-popover-y, var(--safe-space-popover-y-end, 0)))}:where(post-popovercontainer)[safe-space=trapezoid]::after{clip-path:polygon(var(--safe-space-trigger-x-start, var(--safe-space-trigger-x, 0)) var(--safe-space-trigger-y, var(--safe-space-trigger-y-start, 0)), var(--safe-space-trigger-x-end, var(--safe-space-trigger-x, 0)) var(--safe-space-trigger-y, var(--safe-space-trigger-y-end, 0)), var(--safe-space-popover-x-end, var(--safe-space-popover-x, 0)) var(--safe-space-popover-y, var(--safe-space-popover-y-end, 0)), var(--safe-space-popover-x-start, var(--safe-space-popover-x, 0)) var(--safe-space-popover-y, var(--safe-space-popover-y-start, 0)))}:where(post-popovercontainer):not(:has(.arrow))>div{box-shadow:var(--post-device-elevation-300)}:where(post-popovercontainer):has(.arrow)>div{filter:drop-shadow(1px 2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(2px 4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(4px 8px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.top)>div{filter:drop-shadow(0px -2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(0px -4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(0px -8px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.left)>div{filter:drop-shadow(-2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(-4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(-8px 0px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.right)>div{filter:drop-shadow(2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(8px 0px 12px hsla(225, 7%, 11%, 0.15))}: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)}";
3661
+ const PostPopovercontainerStyle0 = postPopovercontainerCss;
3662
+
3663
+ const PostPopovercontainer = class {
3664
+ constructor(hostRef) {
3665
+ registerInstance(this, hostRef);
3666
+ this.postToggle = createEvent(this, "postToggle", 7);
3667
+ this.manualClose = false;
3668
+ this.placement = 'top';
3669
+ this.edgeGap = 8;
3670
+ this.arrow = false;
3671
+ this.safeSpace = undefined;
3672
+ }
3673
+ static STATIC_SIDES = {
3674
+ top: 'bottom',
3675
+ right: 'left',
3676
+ bottom: 'top',
3677
+ left: 'right',
3678
+ };
3679
+ static PROPERTIES_TO_CLEAR = [
3680
+ '--safe-space-popover-x',
3681
+ '--safe-space-popover-y',
3682
+ '--safe-space-popover-x-start',
3683
+ '--safe-space-popover-x-end',
3684
+ '--safe-space-popover-y-start',
3685
+ '--safe-space-popover-y-end',
3686
+ '--safe-space-trigger-x',
3687
+ '--safe-space-trigger-y',
3688
+ '--safe-space-trigger-x-start',
3689
+ '--safe-space-trigger-x-end',
3690
+ '--safe-space-trigger-y-start',
3691
+ '--safe-space-trigger-y-end',
3692
+ ];
3693
+ get host() { return getElement(this); }
3694
+ arrowRef;
3695
+ eventTarget;
3696
+ clearAutoUpdate;
3697
+ toggleTimeoutId;
3698
+ /**
3699
+ * Fires whenever the popover gets shown or hidden, passing the new state in event.details as a boolean
3700
+ */
3701
+ postToggle;
3702
+ /**
3703
+ * Updates cursor position for safe space feature when popover is open.
3704
+ * Sets CSS custom properties for dynamic styling of safe area.
3705
+ * @param event MouseEvent with cursor position
3706
+ */
3707
+ mouseTrackingHandler(event) {
3708
+ this.host.style.setProperty('--safe-space-cursor-x', `${event.clientX}px`);
3709
+ this.host.style.setProperty('--safe-space-cursor-y', `${event.clientY}px`);
3710
+ }
3711
+ componentDidLoad() {
3712
+ this.host.addEventListener('beforetoggle', this.handleToggle.bind(this));
3713
+ }
3714
+ disconnectedCallback() {
3715
+ if (typeof this.clearAutoUpdate === 'function') {
3716
+ this.clearAutoUpdate();
3717
+ }
3718
+ }
3719
+ /**
3720
+ * Programmatically display the tooltip
3721
+ * @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
3722
+ */
3723
+ async show(target) {
3724
+ if (!this.toggleTimeoutId) {
3725
+ this.eventTarget = target;
3726
+ this.calculatePosition();
3727
+ this.host.showPopover();
3728
+ }
3729
+ }
3730
+ /**
3731
+ * Programmatically hide this tooltip
3732
+ */
3733
+ async hide() {
3734
+ if (!this.toggleTimeoutId) {
3735
+ this.eventTarget = null;
3736
+ this.host.hidePopover();
3737
+ }
3738
+ }
3739
+ /**
3740
+ * Toggle tooltip display
3741
+ * @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
3742
+ * @param force Pass true to always show or false to always hide
3743
+ */
3744
+ async toggle(target, force) {
3745
+ // Prevent instant double toggle
3746
+ if (!this.toggleTimeoutId) {
3747
+ this.eventTarget = target;
3748
+ this.calculatePosition();
3749
+ this.host.togglePopover(force);
3750
+ this.toggleTimeoutId = null;
3751
+ }
3752
+ return this.host.matches(':where(:popover-open, .popover-open)');
3753
+ }
3754
+ /**
3755
+ * Start or stop auto updates based on tooltip events.
3756
+ * Tooltips can be closed or opened with other methods than class members,
3757
+ * therefore listening to the toggle event is safer for cleaning up.
3758
+ * @param e ToggleEvent
3759
+ */
3760
+ handleToggle(e) {
3761
+ this.toggleTimeoutId = window.setTimeout(() => (this.toggleTimeoutId = null), 10);
3762
+ const isOpen = e.newState === 'open';
3763
+ if (isOpen) {
3764
+ this.startAutoupdates();
3765
+ if (this.safeSpace)
3766
+ window.addEventListener('mousemove', this.mouseTrackingHandler.bind(this));
3767
+ }
3768
+ else {
3769
+ if (typeof this.clearAutoUpdate === 'function')
3770
+ this.clearAutoUpdate();
3771
+ if (this.safeSpace)
3772
+ window.removeEventListener('mousemove', this.mouseTrackingHandler.bind(this));
3773
+ }
3774
+ this.postToggle.emit(isOpen);
3775
+ }
3776
+ /**
3777
+ * Start listening for DOM updates, scroll events etc. that have
3778
+ * an influence on tooltip positioning
3779
+ */
3780
+ startAutoupdates() {
3781
+ this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.calculatePosition.bind(this));
3782
+ }
3783
+ /**
3784
+ * Retrieves the dynamic height of the header
3785
+ */
3786
+ getHeaderHeight() {
3787
+ const header = document.querySelector('post-header');
3788
+ return header ? parseFloat(getComputedStyle(header).height) : 0;
3789
+ }
3790
+ async calculatePosition() {
3791
+ const { x, y, middlewareData, placement } = await this.computeMainPosition();
3792
+ const currentPlacement = placement.split('-')[0];
3793
+ // Position popover
3794
+ this.host.style.left = `${x}px`;
3795
+ this.host.style.top = `${y}px`;
3796
+ // Position arrow if enabled
3797
+ if (this.arrow && middlewareData.arrow) {
3798
+ const { x: arrowX, y: arrowY } = middlewareData.arrow;
3799
+ const staticSide = PostPopovercontainer.STATIC_SIDES[currentPlacement];
3800
+ if (staticSide) {
3801
+ Object.assign(this.arrowRef.style, {
3802
+ left: arrowX ? `${arrowX}px` : '',
3803
+ top: arrowY ? `${arrowY}px` : '',
3804
+ [staticSide]: '-7px',
3805
+ });
3806
+ }
3807
+ }
3808
+ // Handle safe space if enabled
3809
+ if (this.safeSpace && this.eventTarget) {
3810
+ await this.updateSafeSpaceBoundaries(currentPlacement);
3811
+ }
3812
+ }
3813
+ async computeMainPosition() {
3814
+ const gap = this.edgeGap;
3815
+ const middleware = [
3816
+ flip({
3817
+ padding: this.getHeaderHeight(),
3818
+ }),
3819
+ inline(),
3820
+ shift({
3821
+ padding: gap,
3822
+ limiter: limitShift({
3823
+ offset: 32,
3824
+ }),
3825
+ }),
3826
+ size({
3827
+ apply({ availableWidth, elements }) {
3828
+ Object.assign(elements.floating.style, {
3829
+ maxWidth: `${availableWidth - gap * 2}px`,
3830
+ });
3831
+ },
3832
+ }),
3833
+ offset(this.arrow ? gap + 4 : gap),
3834
+ ];
3835
+ if (this.arrow) {
3836
+ middleware.push(arrow({ element: this.arrowRef, padding: gap }));
3837
+ }
3838
+ return computePosition(this.eventTarget, this.host, {
3839
+ placement: this.placement || 'top',
3840
+ strategy: 'fixed',
3841
+ middleware,
3842
+ });
3843
+ }
3844
+ async updateSafeSpaceBoundaries(currentPlacement) {
3845
+ const targetRect = this.eventTarget.getBoundingClientRect();
3846
+ const popoverRect = this.host.getBoundingClientRect();
3847
+ const isVertical = currentPlacement === 'top' || currentPlacement === 'bottom';
3848
+ // Helper function to get positioning data based on placement
3849
+ const getPositioningData = (placement, popoverRect, targetRect) => {
3850
+ if (placement === 'top' || placement === 'bottom') {
3851
+ return {
3852
+ popover: {
3853
+ y: placement === 'top' ? popoverRect.bottom : popoverRect.top,
3854
+ xStart: popoverRect.left,
3855
+ xEnd: popoverRect.right,
3856
+ },
3857
+ trigger: {
3858
+ y: placement === 'top' ? targetRect.top : targetRect.bottom,
3859
+ xStart: targetRect.left,
3860
+ xEnd: targetRect.right,
3861
+ },
3862
+ };
3863
+ }
3864
+ else {
3865
+ // left or right
3866
+ return {
3867
+ popover: {
3868
+ x: placement === 'left' ? popoverRect.right : popoverRect.left,
3869
+ yStart: popoverRect.top,
3870
+ yEnd: popoverRect.bottom,
3871
+ },
3872
+ trigger: {
3873
+ x: placement === 'left' ? targetRect.left : targetRect.right,
3874
+ yStart: targetRect.top,
3875
+ yEnd: targetRect.bottom,
3876
+ },
3877
+ };
3878
+ }
3879
+ };
3880
+ const posData = getPositioningData(currentPlacement, popoverRect, targetRect);
3881
+ // Clear previous values
3882
+ PostPopovercontainer.PROPERTIES_TO_CLEAR.forEach(prop => {
3883
+ this.host.style.removeProperty(prop);
3884
+ });
3885
+ if (isVertical) {
3886
+ // For top/bottom placement
3887
+ this.host.style.setProperty('--safe-space-popover-y', `${posData.popover.y}px`);
3888
+ this.host.style.setProperty('--safe-space-popover-x-start', `${posData.popover.xStart}px`);
3889
+ this.host.style.setProperty('--safe-space-popover-x-end', `${posData.popover.xEnd}px`);
3890
+ this.host.style.setProperty('--safe-space-trigger-y', `${posData.trigger.y}px`);
3891
+ this.host.style.setProperty('--safe-space-trigger-x-start', `${posData.trigger.xStart}px`);
3892
+ this.host.style.setProperty('--safe-space-trigger-x-end', `${posData.trigger.xEnd}px`);
3893
+ }
3894
+ else {
3895
+ // For left/right placement
3896
+ this.host.style.setProperty('--safe-space-popover-x', `${posData.popover.x}px`);
3897
+ this.host.style.setProperty('--safe-space-popover-y-start', `${posData.popover.yStart}px`);
3898
+ this.host.style.setProperty('--safe-space-popover-y-end', `${posData.popover.yEnd}px`);
3899
+ this.host.style.setProperty('--safe-space-trigger-x', `${posData.trigger.x}px`);
3900
+ this.host.style.setProperty('--safe-space-trigger-y-start', `${posData.trigger.yStart}px`);
3901
+ this.host.style.setProperty('--safe-space-trigger-y-end', `${posData.trigger.yEnd}px`);
3902
+ }
3903
+ }
3904
+ render() {
3905
+ return (h(Host, { key: '4b1d039e821b26d830de798a8103995391d8e01b', "data-version": version, popover: this.manualClose ? 'manual' : 'auto' }, h("div", { key: '30e50db7f861df8339da244b1393372759a0fc13' }, this.arrow && (h("span", { key: 'acd8bae5e39cf6407fdefaaf0e2137d35b4c468d', class: "arrow", ref: el => {
3906
+ this.arrowRef = el;
3907
+ } })), h("slot", { key: 'a4854df31cab7e452c89cf4a8f36249878c6cd0c' }))));
3908
+ }
3909
+ };
3910
+ PostPopovercontainer.style = PostPopovercontainerStyle0;
3911
+
3912
+ 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}";
3913
+ const PostTogglebuttonStyle0 = postTogglebuttonCss;
3914
+
3915
+ const PostTogglebutton = class {
3916
+ constructor(hostRef) {
3917
+ registerInstance(this, hostRef);
3918
+ this.toggled = false;
3919
+ }
3920
+ get host() { return getElement(this); }
3921
+ validateToggled() {
3922
+ checkType(this, 'toggled', 'boolean');
3923
+ }
3924
+ componentWillLoad() {
3925
+ this.validateToggled();
3926
+ // add event listener to not override listener that might be set on the host
3927
+ this.host.addEventListener('click', () => this.handleClick());
3928
+ this.host.addEventListener('keydown', (e) => this.handleKeydown(e));
3929
+ }
3930
+ handleClick = () => {
3931
+ this.toggled = !this.toggled;
3932
+ };
3933
+ handleKeydown = (event) => {
3934
+ // perform a click when enter or spaced are pressed to mimic the button behavior
3935
+ if (event.key === 'Enter' || event.key === ' ') {
3936
+ event.preventDefault(); // prevents the page from scrolling when space is pressed
3937
+ this.host.click();
3938
+ }
3939
+ };
3940
+ render() {
3941
+ return (h(Host, { key: '3a1429a9b67b8cfafae184fe0d060ee3a04974e0', "data-version": version, role: "button", tabindex: "0", "aria-pressed": this.toggled.toString() }, h("slot", { key: '9ab1537574423740fc335fde732c699698acac25' })));
3942
+ }
3943
+ static get watchers() { return {
3944
+ "toggled": ["validateToggled"]
3945
+ }; }
3946
+ };
3947
+ PostTogglebutton.style = PostTogglebuttonStyle0;
3948
+
3949
+ 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 };