@pnx-mixtape/mxds 0.0.24 → 0.0.26

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 (272) hide show
  1. package/.storybook/decorators.ts +1 -1
  2. package/.storybook/main.ts +9 -1
  3. package/.storybook/preview.ts +1 -0
  4. package/.storybook/theme-demo.css +17 -13
  5. package/.storybook/vitest.setup.ts +17 -0
  6. package/dist/build/accordion.css +76 -86
  7. package/dist/build/accordion.entry.js +46 -72
  8. package/dist/build/base.css +1 -993
  9. package/dist/build/breadcrumb.css +1 -55
  10. package/dist/build/button.css +1 -126
  11. package/dist/build/callout.css +1 -11
  12. package/dist/build/card.css +1 -161
  13. package/dist/build/carousel.css +1 -125
  14. package/dist/build/chunks/Accordion-Dwh42fp7.js +42 -0
  15. package/dist/build/chunks/DropMenu-plGsgySm.js +43 -0
  16. package/dist/build/chunks/Popover-Bws25suh.js +27 -0
  17. package/dist/build/chunks/polyfills-Du4RTZDf.js +511 -0
  18. package/dist/build/chunks/popover-Bd5oQ1Ic.js +407 -0
  19. package/dist/build/chunks/utilities-DepaJdUg.js +242 -0
  20. package/dist/build/constants.css +91 -123
  21. package/dist/build/container-grid.css +1 -186
  22. package/dist/build/content-block.css +1 -36
  23. package/dist/build/dialog.css +1 -108
  24. package/dist/build/dialog.entry.js +45 -85
  25. package/dist/build/drop-menu.css +1 -89
  26. package/dist/build/drop-menu.entry.js +2 -2
  27. package/dist/build/drupal.css +1 -66
  28. package/dist/build/filters.css +1 -117
  29. package/dist/build/filters.entry.js +113 -142
  30. package/dist/build/footer.css +1 -141
  31. package/dist/build/form.css +1 -491
  32. package/dist/build/global-alert.css +1 -60
  33. package/dist/build/global-alert.entry.js +51 -75
  34. package/dist/build/grid.css +1 -195
  35. package/dist/build/header.css +1 -149
  36. package/dist/build/header.entry.js +598 -1180
  37. package/dist/build/hero-banner.css +1 -73
  38. package/dist/build/icon.css +1 -399
  39. package/dist/build/in-page-alert.css +1 -93
  40. package/dist/build/in-page-navigation.css +1 -17
  41. package/dist/build/in-page-navigation.entry.js +67 -103
  42. package/dist/build/link-list.css +1 -45
  43. package/dist/build/list-item.css +1 -29
  44. package/dist/build/masthead.css +1 -53
  45. package/dist/build/navigation.css +1 -356
  46. package/dist/build/navigation.entry.js +79 -222
  47. package/dist/build/page.css +1 -65
  48. package/dist/build/pagination.css +1 -111
  49. package/dist/build/popover.css +1 -119
  50. package/dist/build/popover.entry.js +1 -2
  51. package/dist/build/results-bar.css +1 -21
  52. package/dist/build/section.css +1 -147
  53. package/dist/build/side-navigation.css +1 -85
  54. package/dist/build/sidebar.css +1 -53
  55. package/dist/build/social-links.css +1 -20
  56. package/dist/build/steps.css +1 -118
  57. package/dist/build/sticky.css +1 -47
  58. package/dist/build/sticky.entry.js +48 -59
  59. package/dist/build/tabs.css +1 -108
  60. package/dist/build/tabs.entry.js +130 -209
  61. package/dist/build/tag.css +1 -70
  62. package/dist/build/utilities.css +1 -186
  63. package/dist/build/utility-list.css +1 -43
  64. package/dist/build/utility-list.entry.js +52 -80
  65. package/package.json +40 -52
  66. package/src/Atom/Background/__snapshots__/Background.stories.ts.snap +61 -216
  67. package/src/Atom/Background/_background.css +2 -1
  68. package/src/Atom/Button/Button.stories.tsx +2 -0
  69. package/src/Atom/Button/__snapshots__/Button.stories.ts.snap +77 -97
  70. package/src/Atom/Button/__snapshots__/Button.stories.tsx.snap +3 -15
  71. package/src/Atom/DefinitionList/DefinitionList.stories.tsx +2 -1
  72. package/src/Atom/DefinitionList/__snapshots__/DefinitionList.stories.ts.snap +13 -26
  73. package/src/Atom/DefinitionList/__snapshots__/DefinitionList.stories.tsx.snap +2 -29
  74. package/src/Atom/Heading/Heading.stories.tsx +2 -1
  75. package/src/Atom/Heading/__snapshots__/Heading.stories.ts.snap +9 -13
  76. package/src/Atom/Heading/__snapshots__/Heading.stories.tsx.snap +2 -8
  77. package/src/Atom/Icon/Icon.stories.tsx +2 -1
  78. package/src/Atom/Icon/__snapshots__/Icon.stories.ts.snap +21 -28
  79. package/src/Atom/Icon/__snapshots__/Icon.stories.tsx.snap +4 -15
  80. package/src/Atom/Icon/_icon.css +7 -6
  81. package/src/Atom/Image/__snapshots__/Image.stories.ts.snap +6 -9
  82. package/src/Atom/Link/Link.stories.tsx +2 -1
  83. package/src/Atom/Link/__snapshots__/Link.stories.ts.snap +47 -56
  84. package/src/Atom/Link/__snapshots__/Link.stories.tsx.snap +4 -22
  85. package/src/Atom/Media/Media.stories.ts +1 -1
  86. package/src/Atom/Media/Media.stories.tsx +2 -1
  87. package/src/Atom/Media/__snapshots__/Media.stories.ts.snap +27 -12
  88. package/src/Atom/Media/__snapshots__/Media.stories.tsx.snap +3 -16
  89. package/src/Atom/Spacing/__snapshots__/Spacing.stories.ts.snap +5 -8
  90. package/src/Atom/Table/TableResponsive.stories.ts +0 -1
  91. package/src/Atom/Table/__snapshots__/Table.stories.ts.snap +129 -261
  92. package/src/Atom/Table/__snapshots__/TableResponsive.stories.ts.snap +34 -67
  93. package/src/Atom/Text/Text.stories.tsx +2 -1
  94. package/src/Atom/Text/__snapshots__/Text.stories.ts.snap +32 -46
  95. package/src/Atom/Text/__snapshots__/Text.stories.tsx.snap +2 -6
  96. package/src/Atom/Video/__snapshots__/Video.stories.ts.snap +6 -11
  97. package/src/Atom/_flow.css +16 -1
  98. package/src/Component/Accordion/Accordion.stories.tsx +2 -0
  99. package/src/Component/Accordion/__snapshots__/Accordion.stories.ts.snap +106 -140
  100. package/src/Component/Accordion/__snapshots__/Accordion.stories.tsx.snap +3 -49
  101. package/src/Component/Accordion/__snapshots__/AccordionItem.stories.ts.snap +52 -81
  102. package/src/Component/Breadcrumb/Breadcrumb.stories.tsx +2 -0
  103. package/src/Component/Breadcrumb/__snapshots__/Breadcrumb.stories.ts.snap +29 -33
  104. package/src/Component/Breadcrumb/__snapshots__/Breadcrumb.stories.tsx.snap +3 -62
  105. package/src/Component/Callout/__snapshots__/Callout.stories.ts.snap +9 -11
  106. package/src/Component/Card/Card.stories.tsx +2 -0
  107. package/src/Component/Card/__snapshots__/Card.stories.ts.snap +237 -272
  108. package/src/Component/Card/__snapshots__/Card.stories.tsx.snap +4 -85
  109. package/src/Component/Carousel/Elements/Carousel.ts +10 -7
  110. package/src/Component/Carousel/__snapshots__/Carousel.stories.ts.snap +992 -1187
  111. package/src/Component/ContentBlock/ContentBlock.stories.tsx +2 -0
  112. package/src/Component/ContentBlock/__snapshots__/ContentBlock.stories.ts.snap +161 -155
  113. package/src/Component/ContentBlock/__snapshots__/ContentBlock.stories.tsx.snap +2 -25
  114. package/src/Component/Dialog/Dialog.stories.tsx +2 -0
  115. package/src/Component/Dialog/__snapshots__/Dialog.stories.ts.snap +92 -110
  116. package/src/Component/Dialog/__snapshots__/Dialog.stories.tsx.snap +2 -31
  117. package/src/Component/DropMenu/DropMenu.stories.tsx +2 -0
  118. package/src/Component/DropMenu/DropMenu.tsx +1 -3
  119. package/src/Component/DropMenu/__snapshots__/DropMenu.stories.ts.snap +25 -72
  120. package/src/Component/DropMenu/__snapshots__/DropMenu.stories.tsx.snap +2 -46
  121. package/src/Component/Filters/__snapshots__/FilterItem.stories.ts.snap +80 -121
  122. package/src/Component/Filters/__snapshots__/Filters.stories.ts.snap +323 -424
  123. package/src/Component/GlobalAlert/GlobalAlert.stories.tsx +2 -0
  124. package/src/Component/GlobalAlert/__snapshots__/GlobalAlert.stories.ts.snap +25 -37
  125. package/src/Component/GlobalAlert/__snapshots__/GlobalAlert.stories.tsx.snap +3 -46
  126. package/src/Component/HeroBanner/HeroBanner.stories.tsx +2 -0
  127. package/src/Component/HeroBanner/__snapshots__/HeroBanner.stories.ts.snap +105 -106
  128. package/src/Component/HeroBanner/__snapshots__/HeroBanner.stories.tsx.snap +3 -34
  129. package/src/Component/HeroSearch/HeroSearch.stories.tsx +2 -0
  130. package/src/Component/HeroSearch/__snapshots__/HeroSearch.stories.ts.snap +121 -158
  131. package/src/Component/HeroSearch/__snapshots__/HeroSearch.stories.tsx.snap +3 -34
  132. package/src/Component/InPageAlert/InPageAlert.stories.tsx +2 -0
  133. package/src/Component/InPageAlert/__snapshots__/InPageAlert.stories.ts.snap +87 -70
  134. package/src/Component/InPageAlert/__snapshots__/InPageAlert.stories.tsx.snap +5 -65
  135. package/src/Component/InPageNavigation/InPageNavigation.stories.ts +1 -0
  136. package/src/Component/InPageNavigation/InPageNavigation.stories.tsx +2 -0
  137. package/src/Component/InPageNavigation/__snapshots__/InPageNavigation.stories.ts.snap +88 -208
  138. package/src/Component/InPageNavigation/__snapshots__/InPageNavigation.stories.tsx.snap +2 -148
  139. package/src/Component/InPageNavigation/in-page-navigation.css +5 -0
  140. package/src/Component/LinkList/LinkList.stories.tsx +2 -1
  141. package/src/Component/LinkList/__snapshots__/LinkList.stories.ts.snap +67 -66
  142. package/src/Component/LinkList/__snapshots__/LinkList.stories.tsx.snap +2 -32
  143. package/src/Component/ListItem/ListItem.stories.tsx +2 -1
  144. package/src/Component/ListItem/__snapshots__/ListItem.stories.ts.snap +153 -167
  145. package/src/Component/ListItem/__snapshots__/ListItem.stories.tsx.snap +2 -25
  146. package/src/Component/Navigation/Dropdown.stories.tsx +2 -0
  147. package/src/Component/Navigation/Elements/Navigation.ts +5 -5
  148. package/src/Component/Navigation/Navigation.stories.tsx +2 -0
  149. package/src/Component/Navigation/__snapshots__/Dropdown.stories.tsx.snap +2 -38
  150. package/src/Component/Navigation/__snapshots__/Navigation.stories.ts.snap +204 -279
  151. package/src/Component/Navigation/__snapshots__/Navigation.stories.tsx.snap +3 -59
  152. package/src/Component/Navigation/_navigation.css +2 -2
  153. package/src/Component/Pagination/Pagination.stories.tsx +2 -0
  154. package/src/Component/Pagination/__snapshots__/Pagination.stories.ts.snap +70 -60
  155. package/src/Component/Pagination/__snapshots__/Pagination.stories.tsx.snap +2 -62
  156. package/src/Component/Popover/Elements/Popover.ts +5 -1
  157. package/src/Component/Popover/__snapshots__/Popover.stories.ts.snap +366 -496
  158. package/src/Component/Popover/popover.css +3 -4
  159. package/src/Component/ResultsBar/ResultsBar.stories.tsx +2 -0
  160. package/src/Component/ResultsBar/__snapshots__/ResultsBar.stories.ts.snap +25 -46
  161. package/src/Component/ResultsBar/__snapshots__/ResultsBar.stories.tsx.snap +4 -50
  162. package/src/Component/SideNavigation/__snapshots__/SideNavigation.stories.ts.snap +76 -81
  163. package/src/Component/SocialLinks/__snapshots__/SocialLinks.stories.ts.snap +35 -32
  164. package/src/Component/SocialShare/SocialShare.stories.tsx +2 -1
  165. package/src/Component/SocialShare/__snapshots__/SocialShare.stories.ts.snap +11 -27
  166. package/src/Component/SocialShare/__snapshots__/SocialShare.stories.tsx.snap +4 -22
  167. package/src/Component/SocialShare/social-share.twig +1 -0
  168. package/src/Component/Steps/__snapshots__/StepItem.stories.ts.snap +11 -23
  169. package/src/Component/Steps/__snapshots__/Steps.stories.ts.snap +142 -173
  170. package/src/Component/Sticky/Sticky.stories.tsx +2 -0
  171. package/src/Component/Sticky/__snapshots__/Sticky.stories.ts.snap +6 -12
  172. package/src/Component/Sticky/__snapshots__/Sticky.stories.tsx.snap +2 -10
  173. package/src/Component/Tabs/Tabs.stories.tsx +2 -0
  174. package/src/Component/Tabs/__snapshots__/TabItem.stories.ts.snap +5 -9
  175. package/src/Component/Tabs/__snapshots__/Tabs.stories.ts.snap +37 -210
  176. package/src/Component/Tabs/__snapshots__/Tabs.stories.tsx.snap +2 -116
  177. package/src/Component/Tag/Tag.stories.tsx +2 -0
  178. package/src/Component/Tag/__snapshots__/Tag.stories.ts.snap +37 -61
  179. package/src/Component/Tag/__snapshots__/Tag.stories.tsx.snap +2 -6
  180. package/src/Component/Tag/tags.twig +6 -6
  181. package/src/Component/UtilityList/__snapshots__/UtilityList.stories.ts.snap +122 -245
  182. package/src/Component/UtilityList/utility-list.css +4 -0
  183. package/src/Component/UtilityList/utility-list.twig +2 -1
  184. package/src/Form/Checkbox/FormCheckbox.stories.tsx +2 -2
  185. package/src/Form/Checkbox/__snapshots__/Checkbox.stories.ts.snap +13 -26
  186. package/src/Form/Checkbox/__snapshots__/FormCheckbox.stories.tsx.snap +5 -0
  187. package/src/Form/Description/FormDescription.stories.tsx +2 -1
  188. package/src/Form/Description/__snapshots__/Description.stories.ts.snap +5 -9
  189. package/src/Form/Description/__snapshots__/FormDescription.stories.tsx.snap +2 -9
  190. package/src/Form/Description/__snapshots__/FormStatus.stories.ts.snap +9 -17
  191. package/src/Form/Form/Form.stories.tsx +2 -1
  192. package/src/Form/Form/FormTitle.stories.tsx +2 -1
  193. package/src/Form/Form/__snapshots__/Form.stories.tsx.snap +2 -5
  194. package/src/Form/Form/__snapshots__/FormTitle.stories.tsx.snap +2 -8
  195. package/src/Form/FormItem/FormItem.stories.tsx +8 -5
  196. package/src/Form/FormItem/__snapshots__/FormItem.stories.ts.snap +88 -129
  197. package/src/Form/Label/FormLabel.stories.tsx +2 -1
  198. package/src/Form/Label/__snapshots__/FormLabel.stories.tsx.snap +3 -18
  199. package/src/Form/Label/__snapshots__/Label.stories.ts.snap +13 -25
  200. package/src/Form/Radio/FormRadio.stories.tsx +2 -14
  201. package/src/Form/Radio/__snapshots__/FormRadio.stories.tsx.snap +3 -0
  202. package/src/Form/Radio/__snapshots__/Radio.stories.ts.snap +42 -57
  203. package/src/Form/Search/__snapshots__/Search.stories.ts.snap +11 -26
  204. package/src/Form/Select/FormSelect.stories.tsx +2 -1
  205. package/src/Form/Select/__snapshots__/FormSelect.stories.tsx.snap +2 -22
  206. package/src/Form/Select/__snapshots__/Select.stories.ts.snap +8 -19
  207. package/src/Form/TextInput/FormText.stories.tsx +2 -1
  208. package/src/Form/TextInput/__snapshots__/FormText.stories.tsx.snap +2 -12
  209. package/src/Form/TextInput/__snapshots__/InputDivider.stories.ts.snap +11 -26
  210. package/src/Form/TextInput/__snapshots__/TextInput.stories.ts.snap +11 -25
  211. package/src/Form/Textarea/FormTextarea.stories.tsx +2 -1
  212. package/src/Form/Textarea/__snapshots__/FormTextarea.stories.tsx.snap +2 -11
  213. package/src/Form/Textarea/__snapshots__/Textarea.stories.ts.snap +5 -11
  214. package/src/Layout/Footer/Footer.stories.ts +18 -1
  215. package/src/Layout/Footer/Footer.stories.tsx +2 -0
  216. package/src/Layout/Footer/__snapshots__/Footer.stories.ts.snap +360 -301
  217. package/src/Layout/Footer/__snapshots__/Footer.stories.tsx.snap +3 -62
  218. package/src/Layout/Footer/footer.css +16 -35
  219. package/src/Layout/Footer/footer.twig +6 -6
  220. package/src/Layout/Grid/Grid.stories.tsx +2 -0
  221. package/src/Layout/Grid/__snapshots__/Grid.stories.ts.snap +72 -66
  222. package/src/Layout/Grid/__snapshots__/Grid.stories.tsx.snap +6 -62
  223. package/src/Layout/Grid/__snapshots__/GridItem.stories.ts.snap +9 -13
  224. package/src/Layout/Header/Header.stories.tsx +2 -1
  225. package/src/Layout/Header/__snapshots__/Header.stories.ts.snap +315 -466
  226. package/src/Layout/Header/__snapshots__/Header.stories.tsx.snap +2 -58
  227. package/src/Layout/Masthead/__snapshots__/Masthead.stories.ts.snap +86 -87
  228. package/src/Layout/Page/Page.stories.tsx +2 -0
  229. package/src/Layout/Page/__snapshots__/Page.stories.tsx.snap +2 -81
  230. package/src/Layout/Section/__snapshots__/Background.stories.ts.snap +51 -61
  231. package/src/Layout/Section/__snapshots__/Breakouts.stories.ts.snap +34 -78
  232. package/src/Layout/Section/__snapshots__/Flow.stories.ts.snap +54 -89
  233. package/src/Layout/Section/__snapshots__/Section.stories.ts.snap +89 -99
  234. package/src/Layout/Section/__snapshots__/Section.stories.tsx.snap +4 -34
  235. package/src/Layout/Section/__snapshots__/SectionGrid.stories.tsx.snap +3 -35
  236. package/src/Layout/Section/section.twig +2 -2
  237. package/src/Layout/Sidebar/Sidebar.stories.tsx +1 -1
  238. package/src/Layout/Sidebar/__snapshots__/Sidebar.stories.ts.snap +49 -40
  239. package/src/Layout/Sidebar/__snapshots__/Sidebar.stories.tsx.snap +4 -44
  240. package/src/Layout/Sidebar/sidebar.css +2 -2
  241. package/src/Layout/Sidebar/sidebar.twig +8 -5
  242. package/src/Utility/_layout-utils.css +9 -1
  243. package/src/constants.css +2 -2
  244. package/src/tokens.js +2 -2
  245. package/.storybook/test-runner.ts +0 -77
  246. package/dist/build/accordion.entry.js.map +0 -1
  247. package/dist/build/chunks/Accordion-D1HQ0FDq.js +0 -63
  248. package/dist/build/chunks/Accordion-D1HQ0FDq.js.map +0 -1
  249. package/dist/build/chunks/disclosure-widget-CdjCdx7t.js +0 -129
  250. package/dist/build/chunks/disclosure-widget-CdjCdx7t.js.map +0 -1
  251. package/dist/build/chunks/drop-menu.entry-fzV-_VFl.js +0 -70
  252. package/dist/build/chunks/drop-menu.entry-fzV-_VFl.js.map +0 -1
  253. package/dist/build/chunks/polyfills-DnrsypYs.js +0 -812
  254. package/dist/build/chunks/polyfills-DnrsypYs.js.map +0 -1
  255. package/dist/build/chunks/popover-DzUcnIlX.js +0 -797
  256. package/dist/build/chunks/popover-DzUcnIlX.js.map +0 -1
  257. package/dist/build/chunks/popover.entry-BQvyR0d5.js +0 -38
  258. package/dist/build/chunks/popover.entry-BQvyR0d5.js.map +0 -1
  259. package/dist/build/chunks/utilities-Ci7wwNeg.js +0 -148
  260. package/dist/build/chunks/utilities-Ci7wwNeg.js.map +0 -1
  261. package/dist/build/dialog.entry.js.map +0 -1
  262. package/dist/build/drop-menu.entry.js.map +0 -1
  263. package/dist/build/filters.entry.js.map +0 -1
  264. package/dist/build/global-alert.entry.js.map +0 -1
  265. package/dist/build/header.entry.js.map +0 -1
  266. package/dist/build/in-page-navigation.entry.js.map +0 -1
  267. package/dist/build/navigation.entry.js.map +0 -1
  268. package/dist/build/popover.entry.js.map +0 -1
  269. package/dist/build/sticky.entry.js.map +0 -1
  270. package/dist/build/tabs.entry.js.map +0 -1
  271. package/dist/build/utility-list.entry.js.map +0 -1
  272. package/src/Form/FormItem/__snapshots__/FormItem.stories.tsx.snap +0 -110
@@ -1,1194 +1,612 @@
1
- import { D as DisclosureWidget } from "./chunks/disclosure-widget-CdjCdx7t.js";
2
- import "./chunks/utilities-Ci7wwNeg.js";
3
- var candidateSelectors = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"];
4
- var candidateSelector = /* @__PURE__ */ candidateSelectors.join(",");
5
- var NoElement = typeof Element === "undefined";
6
- var matches = NoElement ? function() {
7
- } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
8
- var getRootNode = !NoElement && Element.prototype.getRootNode ? function(element) {
9
- var _element$getRootNode;
10
- return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element);
11
- } : function(element) {
12
- return element === null || element === void 0 ? void 0 : element.ownerDocument;
13
- };
14
- var _isInert = function isInert(node, lookUp) {
15
- var _node$getAttribute;
16
- if (lookUp === void 0) {
17
- lookUp = true;
18
- }
19
- var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, "inert");
20
- var inert = inertAtt === "" || inertAtt === "true";
21
- var result = inert || lookUp && node && _isInert(node.parentNode);
22
- return result;
23
- };
24
- var isContentEditable = function isContentEditable2(node) {
25
- var _node$getAttribute2;
26
- var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, "contenteditable");
27
- return attValue === "" || attValue === "true";
28
- };
29
- var getCandidates = function getCandidates2(el, includeContainer, filter) {
30
- if (_isInert(el)) {
31
- return [];
32
- }
33
- var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
34
- if (includeContainer && matches.call(el, candidateSelector)) {
35
- candidates.unshift(el);
36
- }
37
- candidates = candidates.filter(filter);
38
- return candidates;
39
- };
40
- var _getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {
41
- var candidates = [];
42
- var elementsToCheck = Array.from(elements);
43
- while (elementsToCheck.length) {
44
- var element = elementsToCheck.shift();
45
- if (_isInert(element, false)) {
46
- continue;
47
- }
48
- if (element.tagName === "SLOT") {
49
- var assigned = element.assignedElements();
50
- var content = assigned.length ? assigned : element.children;
51
- var nestedCandidates = _getCandidatesIteratively(content, true, options);
52
- if (options.flatten) {
53
- candidates.push.apply(candidates, nestedCandidates);
54
- } else {
55
- candidates.push({
56
- scopeParent: element,
57
- candidates: nestedCandidates
58
- });
59
- }
60
- } else {
61
- var validCandidate = matches.call(element, candidateSelector);
62
- if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {
63
- candidates.push(element);
64
- }
65
- var shadowRoot = element.shadowRoot || // check for an undisclosed shadow
66
- typeof options.getShadowRoot === "function" && options.getShadowRoot(element);
67
- var validShadowRoot = !_isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));
68
- if (shadowRoot && validShadowRoot) {
69
- var _nestedCandidates = _getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);
70
- if (options.flatten) {
71
- candidates.push.apply(candidates, _nestedCandidates);
72
- } else {
73
- candidates.push({
74
- scopeParent: element,
75
- candidates: _nestedCandidates
76
- });
77
- }
78
- } else {
79
- elementsToCheck.unshift.apply(elementsToCheck, element.children);
80
- }
81
- }
82
- }
83
- return candidates;
84
- };
85
- var hasTabIndex = function hasTabIndex2(node) {
86
- return !isNaN(parseInt(node.getAttribute("tabindex"), 10));
87
- };
88
- var getTabIndex = function getTabIndex2(node) {
89
- if (!node) {
90
- throw new Error("No node provided");
91
- }
92
- if (node.tabIndex < 0) {
93
- if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) {
94
- return 0;
95
- }
96
- }
97
- return node.tabIndex;
98
- };
99
- var getSortOrderTabIndex = function getSortOrderTabIndex2(node, isScope) {
100
- var tabIndex = getTabIndex(node);
101
- if (tabIndex < 0 && isScope && !hasTabIndex(node)) {
102
- return 0;
103
- }
104
- return tabIndex;
105
- };
106
- var sortOrderedTabbables = function sortOrderedTabbables2(a, b) {
107
- return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
108
- };
109
- var isInput = function isInput2(node) {
110
- return node.tagName === "INPUT";
111
- };
112
- var isHiddenInput = function isHiddenInput2(node) {
113
- return isInput(node) && node.type === "hidden";
114
- };
115
- var isDetailsWithSummary = function isDetailsWithSummary2(node) {
116
- var r = node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) {
117
- return child.tagName === "SUMMARY";
118
- });
119
- return r;
120
- };
121
- var getCheckedRadio = function getCheckedRadio2(nodes, form) {
122
- for (var i = 0; i < nodes.length; i++) {
123
- if (nodes[i].checked && nodes[i].form === form) {
124
- return nodes[i];
125
- }
126
- }
127
- };
128
- var isTabbableRadio = function isTabbableRadio2(node) {
129
- if (!node.name) {
130
- return true;
131
- }
132
- var radioScope = node.form || getRootNode(node);
133
- var queryRadios = function queryRadios2(name) {
134
- return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
135
- };
136
- var radioSet;
137
- if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") {
138
- radioSet = queryRadios(window.CSS.escape(node.name));
139
- } else {
140
- try {
141
- radioSet = queryRadios(node.name);
142
- } catch (err) {
143
- console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", err.message);
144
- return false;
145
- }
146
- }
147
- var checked = getCheckedRadio(radioSet, node.form);
148
- return !checked || checked === node;
149
- };
150
- var isRadio = function isRadio2(node) {
151
- return isInput(node) && node.type === "radio";
152
- };
153
- var isNonTabbableRadio = function isNonTabbableRadio2(node) {
154
- return isRadio(node) && !isTabbableRadio(node);
155
- };
156
- var isNodeAttached = function isNodeAttached2(node) {
157
- var _nodeRoot;
158
- var nodeRoot = node && getRootNode(node);
159
- var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host;
160
- var attached = false;
161
- if (nodeRoot && nodeRoot !== node) {
162
- var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument;
163
- attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node));
164
- while (!attached && nodeRootHost) {
165
- var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD;
166
- nodeRoot = getRootNode(nodeRootHost);
167
- nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host;
168
- attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost));
169
- }
170
- }
171
- return attached;
172
- };
173
- var isZeroArea = function isZeroArea2(node) {
174
- var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height;
175
- return width === 0 && height === 0;
176
- };
177
- var isHidden = function isHidden2(node, _ref) {
178
- var displayCheck = _ref.displayCheck, getShadowRoot = _ref.getShadowRoot;
179
- if (displayCheck === "full-native") {
180
- if ("checkVisibility" in node) {
181
- var visible = node.checkVisibility({
182
- // Checking opacity might be desirable for some use cases, but natively,
183
- // opacity zero elements _are_ focusable and tabbable.
184
- checkOpacity: false,
185
- opacityProperty: false,
186
- contentVisibilityAuto: true,
187
- visibilityProperty: true,
188
- // This is an alias for `visibilityProperty`. Contemporary browsers
189
- // support both. However, this alias has wider browser support (Chrome
190
- // >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so
191
- // we include it anyway.
192
- checkVisibilityCSS: true
193
- });
194
- return !visible;
195
- }
196
- }
197
- if (getComputedStyle(node).visibility === "hidden") {
198
- return true;
199
- }
200
- var isDirectSummary = matches.call(node, "details>summary:first-of-type");
201
- var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
202
- if (matches.call(nodeUnderDetails, "details:not([open]) *")) {
203
- return true;
204
- }
205
- if (!displayCheck || displayCheck === "full" || // full-native can run this branch when it falls through in case
206
- // Element#checkVisibility is unsupported
207
- displayCheck === "full-native" || displayCheck === "legacy-full") {
208
- if (typeof getShadowRoot === "function") {
209
- var originalNode = node;
210
- while (node) {
211
- var parentElement = node.parentElement;
212
- var rootNode = getRootNode(node);
213
- if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true) {
214
- return isZeroArea(node);
215
- } else if (node.assignedSlot) {
216
- node = node.assignedSlot;
217
- } else if (!parentElement && rootNode !== node.ownerDocument) {
218
- node = rootNode.host;
219
- } else {
220
- node = parentElement;
221
- }
222
- }
223
- node = originalNode;
224
- }
225
- if (isNodeAttached(node)) {
226
- return !node.getClientRects().length;
227
- }
228
- if (displayCheck !== "legacy-full") {
229
- return true;
230
- }
231
- } else if (displayCheck === "non-zero-area") {
232
- return isZeroArea(node);
233
- }
234
- return false;
235
- };
236
- var isDisabledFromFieldset = function isDisabledFromFieldset2(node) {
237
- if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
238
- var parentNode = node.parentElement;
239
- while (parentNode) {
240
- if (parentNode.tagName === "FIELDSET" && parentNode.disabled) {
241
- for (var i = 0; i < parentNode.children.length; i++) {
242
- var child = parentNode.children.item(i);
243
- if (child.tagName === "LEGEND") {
244
- return matches.call(parentNode, "fieldset[disabled] *") ? true : !child.contains(node);
245
- }
246
- }
247
- return true;
248
- }
249
- parentNode = parentNode.parentElement;
250
- }
251
- }
252
- return false;
253
- };
254
- var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) {
255
- if (node.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
256
- // because we're limited in the type of selectors we can use in JSDom (see related
257
- // note related to `candidateSelectors`)
258
- _isInert(node) || isHiddenInput(node) || isHidden(node, options) || // For a details element with a summary, the summary element gets the focus
259
- isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
260
- return false;
261
- }
262
- return true;
263
- };
264
- var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) {
265
- if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
266
- return false;
267
- }
268
- return true;
269
- };
270
- var isShadowRootTabbable = function isShadowRootTabbable2(shadowHostNode) {
271
- var tabIndex = parseInt(shadowHostNode.getAttribute("tabindex"), 10);
272
- if (isNaN(tabIndex) || tabIndex >= 0) {
273
- return true;
274
- }
275
- return false;
276
- };
277
- var _sortByOrder = function sortByOrder(candidates) {
278
- var regularTabbables = [];
279
- var orderedTabbables = [];
280
- candidates.forEach(function(item, i) {
281
- var isScope = !!item.scopeParent;
282
- var element = isScope ? item.scopeParent : item;
283
- var candidateTabindex = getSortOrderTabIndex(element, isScope);
284
- var elements = isScope ? _sortByOrder(item.candidates) : element;
285
- if (candidateTabindex === 0) {
286
- isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
287
- } else {
288
- orderedTabbables.push({
289
- documentOrder: i,
290
- tabIndex: candidateTabindex,
291
- item,
292
- isScope,
293
- content: elements
294
- });
295
- }
296
- });
297
- return orderedTabbables.sort(sortOrderedTabbables).reduce(function(acc, sortable) {
298
- sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);
299
- return acc;
300
- }, []).concat(regularTabbables);
301
- };
302
- var tabbable = function tabbable2(container, options) {
303
- options = options || {};
304
- var candidates;
305
- if (options.getShadowRoot) {
306
- candidates = _getCandidatesIteratively([container], options.includeContainer, {
307
- filter: isNodeMatchingSelectorTabbable.bind(null, options),
308
- flatten: false,
309
- getShadowRoot: options.getShadowRoot,
310
- shadowRootFilter: isShadowRootTabbable
311
- });
312
- } else {
313
- candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
314
- }
315
- return _sortByOrder(candidates);
316
- };
317
- var focusable = function focusable2(container, options) {
318
- options = options || {};
319
- var candidates;
320
- if (options.getShadowRoot) {
321
- candidates = _getCandidatesIteratively([container], options.includeContainer, {
322
- filter: isNodeMatchingSelectorFocusable.bind(null, options),
323
- flatten: true,
324
- getShadowRoot: options.getShadowRoot
325
- });
326
- } else {
327
- candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
328
- }
329
- return candidates;
330
- };
331
- var isTabbable = function isTabbable2(node, options) {
332
- options = options || {};
333
- if (!node) {
334
- throw new Error("No node provided");
335
- }
336
- if (matches.call(node, candidateSelector) === false) {
337
- return false;
338
- }
339
- return isNodeMatchingSelectorTabbable(options, node);
340
- };
341
- var focusableCandidateSelector = /* @__PURE__ */ candidateSelectors.concat("iframe").join(",");
342
- var isFocusable = function isFocusable2(node, options) {
343
- options = options || {};
344
- if (!node) {
345
- throw new Error("No node provided");
346
- }
347
- if (matches.call(node, focusableCandidateSelector) === false) {
348
- return false;
349
- }
350
- return isNodeMatchingSelectorFocusable(options, node);
351
- };
352
- function _arrayLikeToArray(r, a) {
353
- (null == a || a > r.length) && (a = r.length);
354
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
355
- return n;
1
+ import { o as DisclosureWidget } from "./chunks/utilities-DepaJdUg.js";
2
+ var candidateSelectors = [
3
+ "input:not([inert])",
4
+ "select:not([inert])",
5
+ "textarea:not([inert])",
6
+ "a[href]:not([inert])",
7
+ "button:not([inert])",
8
+ "[tabindex]:not(slot):not([inert])",
9
+ "audio[controls]:not([inert])",
10
+ "video[controls]:not([inert])",
11
+ "[contenteditable]:not([contenteditable=\"false\"]):not([inert])",
12
+ "details>summary:first-of-type:not([inert])",
13
+ "details:not([inert])"
14
+ ], candidateSelector = /* @__PURE__ */ candidateSelectors.join(","), NoElement = typeof Element > "u", matches = NoElement ? function() {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, getRootNode = !NoElement && Element.prototype.getRootNode ? function(e) {
15
+ return e?.getRootNode?.call(e);
16
+ } : function(e) {
17
+ return e?.ownerDocument;
18
+ }, _isInert = function(e, O) {
19
+ O === void 0 && (O = !0);
20
+ var k = e?.getAttribute?.call(e, "inert");
21
+ return k === "" || k === "true" || O && e && _isInert(e.parentNode);
22
+ }, isContentEditable = function(e) {
23
+ var O = e?.getAttribute?.call(e, "contenteditable");
24
+ return O === "" || O === "true";
25
+ }, getCandidates = function(e, O, A) {
26
+ if (_isInert(e)) return [];
27
+ var M = Array.prototype.slice.apply(e.querySelectorAll(candidateSelector));
28
+ return O && matches.call(e, candidateSelector) && M.unshift(e), M = M.filter(A), M;
29
+ }, _getCandidatesIteratively = function(e, O, A) {
30
+ for (var M = [], P = Array.from(e); P.length;) {
31
+ var F = P.shift();
32
+ if (!_isInert(F, !1)) if (F.tagName === "SLOT") {
33
+ var L = F.assignedElements(), R = _getCandidatesIteratively(L.length ? L : F.children, !0, A);
34
+ A.flatten ? M.push.apply(M, R) : M.push({
35
+ scopeParent: F,
36
+ candidates: R
37
+ });
38
+ } else {
39
+ matches.call(F, candidateSelector) && A.filter(F) && (O || !e.includes(F)) && M.push(F);
40
+ var z = F.shadowRoot || typeof A.getShadowRoot == "function" && A.getShadowRoot(F), B = !_isInert(z, !1) && (!A.shadowRootFilter || A.shadowRootFilter(F));
41
+ if (z && B) {
42
+ var V = _getCandidatesIteratively(z === !0 ? F.children : z.children, !0, A);
43
+ A.flatten ? M.push.apply(M, V) : M.push({
44
+ scopeParent: F,
45
+ candidates: V
46
+ });
47
+ } else P.unshift.apply(P, F.children);
48
+ }
49
+ }
50
+ return M;
51
+ }, hasTabIndex = function(e) {
52
+ return !isNaN(parseInt(e.getAttribute("tabindex"), 10));
53
+ }, getTabIndex = function(e) {
54
+ if (!e) throw Error("No node provided");
55
+ return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || isContentEditable(e)) && !hasTabIndex(e) ? 0 : e.tabIndex;
56
+ }, getSortOrderTabIndex = function(e, O) {
57
+ var k = getTabIndex(e);
58
+ return k < 0 && O && !hasTabIndex(e) ? 0 : k;
59
+ }, sortOrderedTabbables = function(e, O) {
60
+ return e.tabIndex === O.tabIndex ? e.documentOrder - O.documentOrder : e.tabIndex - O.tabIndex;
61
+ }, isInput = function(e) {
62
+ return e.tagName === "INPUT";
63
+ }, isHiddenInput = function(e) {
64
+ return isInput(e) && e.type === "hidden";
65
+ }, isDetailsWithSummary = function(e) {
66
+ return e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(e) {
67
+ return e.tagName === "SUMMARY";
68
+ });
69
+ }, getCheckedRadio = function(e, O) {
70
+ for (var k = 0; k < e.length; k++) if (e[k].checked && e[k].form === O) return e[k];
71
+ }, isTabbableRadio = function(e) {
72
+ if (!e.name) return !0;
73
+ var O = e.form || getRootNode(e), k = function(e) {
74
+ return O.querySelectorAll("input[type=\"radio\"][name=\"" + e + "\"]");
75
+ }, A;
76
+ if (typeof window < "u" && window.CSS !== void 0 && typeof window.CSS.escape == "function") A = k(window.CSS.escape(e.name));
77
+ else try {
78
+ A = k(e.name);
79
+ } catch (e) {
80
+ return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", e.message), !1;
81
+ }
82
+ var j = getCheckedRadio(A, e.form);
83
+ return !j || j === e;
84
+ }, isRadio = function(e) {
85
+ return isInput(e) && e.type === "radio";
86
+ }, isNonTabbableRadio = function(e) {
87
+ return isRadio(e) && !isTabbableRadio(e);
88
+ }, isNodeAttached = function(e) {
89
+ var O = e && getRootNode(e), k = O?.host, A = !1;
90
+ if (O && O !== e) {
91
+ var j, N, P;
92
+ for (A = !!((j = k) != null && (N = j.ownerDocument) != null && N.contains(k) || e != null && (P = e.ownerDocument) != null && P.contains(e)); !A && k;) {
93
+ var F, I;
94
+ O = getRootNode(k), k = O?.host, A = !!((F = k) != null && (I = F.ownerDocument) != null && I.contains(k));
95
+ }
96
+ }
97
+ return A;
98
+ }, isZeroArea = function(e) {
99
+ var O = e.getBoundingClientRect(), k = O.width, A = O.height;
100
+ return k === 0 && A === 0;
101
+ }, isHidden = function(e, O) {
102
+ var k = O.displayCheck, A = O.getShadowRoot;
103
+ if (k === "full-native" && "checkVisibility" in e) return !e.checkVisibility({
104
+ checkOpacity: !1,
105
+ opacityProperty: !1,
106
+ contentVisibilityAuto: !0,
107
+ visibilityProperty: !0,
108
+ checkVisibilityCSS: !0
109
+ });
110
+ if (getComputedStyle(e).visibility === "hidden") return !0;
111
+ var N = matches.call(e, "details>summary:first-of-type") ? e.parentElement : e;
112
+ if (matches.call(N, "details:not([open]) *")) return !0;
113
+ if (!k || k === "full" || k === "full-native" || k === "legacy-full") {
114
+ if (typeof A == "function") {
115
+ for (var P = e; e;) {
116
+ var F = e.parentElement, I = getRootNode(e);
117
+ if (F && !F.shadowRoot && A(F) === !0) return isZeroArea(e);
118
+ e = e.assignedSlot ? e.assignedSlot : !F && I !== e.ownerDocument ? I.host : F;
119
+ }
120
+ e = P;
121
+ }
122
+ if (isNodeAttached(e)) return !e.getClientRects().length;
123
+ if (k !== "legacy-full") return !0;
124
+ } else if (k === "non-zero-area") return isZeroArea(e);
125
+ return !1;
126
+ }, isDisabledFromFieldset = function(e) {
127
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName)) for (var O = e.parentElement; O;) {
128
+ if (O.tagName === "FIELDSET" && O.disabled) {
129
+ for (var k = 0; k < O.children.length; k++) {
130
+ var A = O.children.item(k);
131
+ if (A.tagName === "LEGEND") return matches.call(O, "fieldset[disabled] *") ? !0 : !A.contains(e);
132
+ }
133
+ return !0;
134
+ }
135
+ O = O.parentElement;
136
+ }
137
+ return !1;
138
+ }, isNodeMatchingSelectorFocusable = function(e, O) {
139
+ return !(O.disabled || _isInert(O) || isHiddenInput(O) || isHidden(O, e) || isDetailsWithSummary(O) || isDisabledFromFieldset(O));
140
+ }, isNodeMatchingSelectorTabbable = function(e, O) {
141
+ return !(isNonTabbableRadio(O) || getTabIndex(O) < 0 || !isNodeMatchingSelectorFocusable(e, O));
142
+ }, isShadowRootTabbable = function(e) {
143
+ var O = parseInt(e.getAttribute("tabindex"), 10);
144
+ return !!(isNaN(O) || O >= 0);
145
+ }, _sortByOrder = function(e) {
146
+ var O = [], k = [];
147
+ return e.forEach(function(e, A) {
148
+ var j = !!e.scopeParent, M = j ? e.scopeParent : e, N = getSortOrderTabIndex(M, j), P = j ? _sortByOrder(e.candidates) : M;
149
+ N === 0 ? j ? O.push.apply(O, P) : O.push(M) : k.push({
150
+ documentOrder: A,
151
+ tabIndex: N,
152
+ item: e,
153
+ isScope: j,
154
+ content: P
155
+ });
156
+ }), k.sort(sortOrderedTabbables).reduce(function(e, O) {
157
+ return O.isScope ? e.push.apply(e, O.content) : e.push(O.content), e;
158
+ }, []).concat(O);
159
+ }, tabbable = function(e, O) {
160
+ return O ||= {}, _sortByOrder(O.getShadowRoot ? _getCandidatesIteratively([e], O.includeContainer, {
161
+ filter: isNodeMatchingSelectorTabbable.bind(null, O),
162
+ flatten: !1,
163
+ getShadowRoot: O.getShadowRoot,
164
+ shadowRootFilter: isShadowRootTabbable
165
+ }) : getCandidates(e, O.includeContainer, isNodeMatchingSelectorTabbable.bind(null, O)));
166
+ }, focusable = function(e, O) {
167
+ return O ||= {}, O.getShadowRoot ? _getCandidatesIteratively([e], O.includeContainer, {
168
+ filter: isNodeMatchingSelectorFocusable.bind(null, O),
169
+ flatten: !0,
170
+ getShadowRoot: O.getShadowRoot
171
+ }) : getCandidates(e, O.includeContainer, isNodeMatchingSelectorFocusable.bind(null, O));
172
+ }, isTabbable = function(e, O) {
173
+ if (O ||= {}, !e) throw Error("No node provided");
174
+ return matches.call(e, candidateSelector) === !1 ? !1 : isNodeMatchingSelectorTabbable(O, e);
175
+ }, focusableCandidateSelector = /* @__PURE__ */ candidateSelectors.concat("iframe").join(","), isFocusable = function(e, O) {
176
+ if (O ||= {}, !e) throw Error("No node provided");
177
+ return matches.call(e, focusableCandidateSelector) === !1 ? !1 : isNodeMatchingSelectorFocusable(O, e);
178
+ };
179
+ function _arrayLikeToArray(e, O) {
180
+ (O == null || O > e.length) && (O = e.length);
181
+ for (var k = 0, A = Array(O); k < O; k++) A[k] = e[k];
182
+ return A;
356
183
  }
357
- function _arrayWithoutHoles(r) {
358
- if (Array.isArray(r)) return _arrayLikeToArray(r);
184
+ function _arrayWithoutHoles(e) {
185
+ if (Array.isArray(e)) return _arrayLikeToArray(e);
359
186
  }
360
- function _defineProperty(e, r, t) {
361
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
362
- value: t,
363
- enumerable: true,
364
- configurable: true,
365
- writable: true
366
- }) : e[r] = t, e;
187
+ function _defineProperty(e, O, k) {
188
+ return (O = _toPropertyKey(O)) in e ? Object.defineProperty(e, O, {
189
+ value: k,
190
+ enumerable: !0,
191
+ configurable: !0,
192
+ writable: !0
193
+ }) : e[O] = k, e;
367
194
  }
368
- function _iterableToArray(r) {
369
- if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
195
+ function _iterableToArray(e) {
196
+ if (typeof Symbol < "u" && e[Symbol.iterator] != null || e["@@iterator"] != null) return Array.from(e);
370
197
  }
371
198
  function _nonIterableSpread() {
372
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
199
+ throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
373
200
  }
374
- function ownKeys(e, r) {
375
- var t = Object.keys(e);
376
- if (Object.getOwnPropertySymbols) {
377
- var o = Object.getOwnPropertySymbols(e);
378
- r && (o = o.filter(function(r2) {
379
- return Object.getOwnPropertyDescriptor(e, r2).enumerable;
380
- })), t.push.apply(t, o);
381
- }
382
- return t;
201
+ function ownKeys(e, O) {
202
+ var k = Object.keys(e);
203
+ if (Object.getOwnPropertySymbols) {
204
+ var A = Object.getOwnPropertySymbols(e);
205
+ O && (A = A.filter(function(O) {
206
+ return Object.getOwnPropertyDescriptor(e, O).enumerable;
207
+ })), k.push.apply(k, A);
208
+ }
209
+ return k;
383
210
  }
384
211
  function _objectSpread2(e) {
385
- for (var r = 1; r < arguments.length; r++) {
386
- var t = null != arguments[r] ? arguments[r] : {};
387
- r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
388
- _defineProperty(e, r2, t[r2]);
389
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
390
- Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
391
- });
392
- }
393
- return e;
212
+ for (var O = 1; O < arguments.length; O++) {
213
+ var k = arguments[O] == null ? {} : arguments[O];
214
+ O % 2 ? ownKeys(Object(k), !0).forEach(function(O) {
215
+ _defineProperty(e, O, k[O]);
216
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(k)) : ownKeys(Object(k)).forEach(function(O) {
217
+ Object.defineProperty(e, O, Object.getOwnPropertyDescriptor(k, O));
218
+ });
219
+ }
220
+ return e;
394
221
  }
395
- function _toConsumableArray(r) {
396
- return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
222
+ function _toConsumableArray(e) {
223
+ return _arrayWithoutHoles(e) || _iterableToArray(e) || _unsupportedIterableToArray(e) || _nonIterableSpread();
397
224
  }
398
- function _toPrimitive(t, r) {
399
- if ("object" != typeof t || !t) return t;
400
- var e = t[Symbol.toPrimitive];
401
- if (void 0 !== e) {
402
- var i = e.call(t, r);
403
- if ("object" != typeof i) return i;
404
- throw new TypeError("@@toPrimitive must return a primitive value.");
405
- }
406
- return ("string" === r ? String : Number)(t);
225
+ function _toPrimitive(e, O) {
226
+ if (typeof e != "object" || !e) return e;
227
+ var k = e[Symbol.toPrimitive];
228
+ if (k !== void 0) {
229
+ var A = k.call(e, O);
230
+ if (typeof A != "object") return A;
231
+ throw TypeError("@@toPrimitive must return a primitive value.");
232
+ }
233
+ return (O === "string" ? String : Number)(e);
407
234
  }
408
- function _toPropertyKey(t) {
409
- var i = _toPrimitive(t, "string");
410
- return "symbol" == typeof i ? i : i + "";
235
+ function _toPropertyKey(e) {
236
+ var O = _toPrimitive(e, "string");
237
+ return typeof O == "symbol" ? O : O + "";
411
238
  }
412
- function _unsupportedIterableToArray(r, a) {
413
- if (r) {
414
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
415
- var t = {}.toString.call(r).slice(8, -1);
416
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
417
- }
239
+ function _unsupportedIterableToArray(e, O) {
240
+ if (e) {
241
+ if (typeof e == "string") return _arrayLikeToArray(e, O);
242
+ var k = {}.toString.call(e).slice(8, -1);
243
+ return k === "Object" && e.constructor && (k = e.constructor.name), k === "Map" || k === "Set" ? Array.from(e) : k === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(k) ? _arrayLikeToArray(e, O) : void 0;
244
+ }
418
245
  }
419
246
  var activeFocusTraps = {
420
- activateTrap: function activateTrap(trapStack, trap) {
421
- if (trapStack.length > 0) {
422
- var activeTrap = trapStack[trapStack.length - 1];
423
- if (activeTrap !== trap) {
424
- activeTrap._setPausedState(true);
425
- }
426
- }
427
- var trapIndex = trapStack.indexOf(trap);
428
- if (trapIndex === -1) {
429
- trapStack.push(trap);
430
- } else {
431
- trapStack.splice(trapIndex, 1);
432
- trapStack.push(trap);
433
- }
434
- },
435
- deactivateTrap: function deactivateTrap(trapStack, trap) {
436
- var trapIndex = trapStack.indexOf(trap);
437
- if (trapIndex !== -1) {
438
- trapStack.splice(trapIndex, 1);
439
- }
440
- if (trapStack.length > 0 && !trapStack[trapStack.length - 1]._isManuallyPaused()) {
441
- trapStack[trapStack.length - 1]._setPausedState(false);
442
- }
443
- }
444
- };
445
- var isSelectableInput = function isSelectableInput2(node) {
446
- return node.tagName && node.tagName.toLowerCase() === "input" && typeof node.select === "function";
447
- };
448
- var isEscapeEvent = function isEscapeEvent2(e) {
449
- return (e === null || e === void 0 ? void 0 : e.key) === "Escape" || (e === null || e === void 0 ? void 0 : e.key) === "Esc" || (e === null || e === void 0 ? void 0 : e.keyCode) === 27;
450
- };
451
- var isTabEvent = function isTabEvent2(e) {
452
- return (e === null || e === void 0 ? void 0 : e.key) === "Tab" || (e === null || e === void 0 ? void 0 : e.keyCode) === 9;
453
- };
454
- var isKeyForward = function isKeyForward2(e) {
455
- return isTabEvent(e) && !e.shiftKey;
456
- };
457
- var isKeyBackward = function isKeyBackward2(e) {
458
- return isTabEvent(e) && e.shiftKey;
459
- };
460
- var delay = function delay2(fn) {
461
- return setTimeout(fn, 0);
462
- };
463
- var valueOrHandler = function valueOrHandler2(value) {
464
- for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
465
- params[_key - 1] = arguments[_key];
466
- }
467
- return typeof value === "function" ? value.apply(void 0, params) : value;
468
- };
469
- var getActualTarget = function getActualTarget2(event) {
470
- return event.target.shadowRoot && typeof event.composedPath === "function" ? event.composedPath()[0] : event.target;
471
- };
472
- var internalTrapStack = [];
473
- var createFocusTrap = function createFocusTrap2(elements, userOptions) {
474
- var doc = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.document) || document;
475
- var trapStack = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.trapStack) || internalTrapStack;
476
- var config = _objectSpread2({
477
- returnFocusOnDeactivate: true,
478
- escapeDeactivates: true,
479
- delayInitialFocus: true,
480
- isKeyForward,
481
- isKeyBackward
482
- }, userOptions);
483
- var state = {
484
- // containers given to createFocusTrap()
485
- // @type {Array<HTMLElement>}
486
- containers: [],
487
- // list of objects identifying tabbable nodes in `containers` in the trap
488
- // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
489
- // is active, but the trap should never get to a state where there isn't at least one group
490
- // with at least one tabbable node in it (that would lead to an error condition that would
491
- // result in an error being thrown)
492
- // @type {Array<{
493
- // container: HTMLElement,
494
- // tabbableNodes: Array<HTMLElement>, // empty if none
495
- // focusableNodes: Array<HTMLElement>, // empty if none
496
- // posTabIndexesFound: boolean,
497
- // firstTabbableNode: HTMLElement|undefined,
498
- // lastTabbableNode: HTMLElement|undefined,
499
- // firstDomTabbableNode: HTMLElement|undefined,
500
- // lastDomTabbableNode: HTMLElement|undefined,
501
- // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
502
- // }>}
503
- containerGroups: [],
504
- // same order/length as `containers` list
505
- // references to objects in `containerGroups`, but only those that actually have
506
- // tabbable nodes in them
507
- // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
508
- // the same length
509
- tabbableGroups: [],
510
- nodeFocusedBeforeActivation: null,
511
- mostRecentlyFocusedNode: null,
512
- active: false,
513
- paused: false,
514
- manuallyPaused: false,
515
- // timer ID for when delayInitialFocus is true and initial focus in this trap
516
- // has been delayed during activation
517
- delayInitialFocusTimer: void 0,
518
- // the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
519
- recentNavEvent: void 0
520
- };
521
- var trap;
522
- var getOption = function getOption2(configOverrideOptions, optionName, configOptionName) {
523
- return configOverrideOptions && configOverrideOptions[optionName] !== void 0 ? configOverrideOptions[optionName] : config[configOptionName || optionName];
524
- };
525
- var findContainerIndex = function findContainerIndex2(element, event) {
526
- var composedPath = typeof (event === null || event === void 0 ? void 0 : event.composedPath) === "function" ? event.composedPath() : void 0;
527
- return state.containerGroups.findIndex(function(_ref) {
528
- var container = _ref.container, tabbableNodes = _ref.tabbableNodes;
529
- return container.contains(element) || // fall back to explicit tabbable search which will take into consideration any
530
- // web components if the `tabbableOptions.getShadowRoot` option was used for
531
- // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
532
- // look inside web components even if open)
533
- (composedPath === null || composedPath === void 0 ? void 0 : composedPath.includes(container)) || tabbableNodes.find(function(node) {
534
- return node === element;
535
- });
536
- });
537
- };
538
- var getNodeForOption = function getNodeForOption2(optionName) {
539
- var _ref2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref2$hasFallback = _ref2.hasFallback, hasFallback = _ref2$hasFallback === void 0 ? false : _ref2$hasFallback, _ref2$params = _ref2.params, params = _ref2$params === void 0 ? [] : _ref2$params;
540
- var optionValue = config[optionName];
541
- if (typeof optionValue === "function") {
542
- optionValue = optionValue.apply(void 0, _toConsumableArray(params));
543
- }
544
- if (optionValue === true) {
545
- optionValue = void 0;
546
- }
547
- if (!optionValue) {
548
- if (optionValue === void 0 || optionValue === false) {
549
- return optionValue;
550
- }
551
- throw new Error("`".concat(optionName, "` was specified but was not a node, or did not return a node"));
552
- }
553
- var node = optionValue;
554
- if (typeof optionValue === "string") {
555
- try {
556
- node = doc.querySelector(optionValue);
557
- } catch (err) {
558
- throw new Error("`".concat(optionName, '` appears to be an invalid selector; error="').concat(err.message, '"'));
559
- }
560
- if (!node) {
561
- if (!hasFallback) {
562
- throw new Error("`".concat(optionName, "` as selector refers to no known node"));
563
- }
564
- }
565
- }
566
- return node;
567
- };
568
- var getInitialFocusNode = function getInitialFocusNode2() {
569
- var node = getNodeForOption("initialFocus", {
570
- hasFallback: true
571
- });
572
- if (node === false) {
573
- return false;
574
- }
575
- if (node === void 0 || node && !isFocusable(node, config.tabbableOptions)) {
576
- if (findContainerIndex(doc.activeElement) >= 0) {
577
- node = doc.activeElement;
578
- } else {
579
- var firstTabbableGroup = state.tabbableGroups[0];
580
- var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode;
581
- node = firstTabbableNode || getNodeForOption("fallbackFocus");
582
- }
583
- } else if (node === null) {
584
- node = getNodeForOption("fallbackFocus");
585
- }
586
- if (!node) {
587
- throw new Error("Your focus-trap needs to have at least one focusable element");
588
- }
589
- return node;
590
- };
591
- var updateTabbableNodes = function updateTabbableNodes2() {
592
- state.containerGroups = state.containers.map(function(container) {
593
- var tabbableNodes = tabbable(container, config.tabbableOptions);
594
- var focusableNodes = focusable(container, config.tabbableOptions);
595
- var firstTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[0] : void 0;
596
- var lastTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : void 0;
597
- var firstDomTabbableNode = focusableNodes.find(function(node) {
598
- return isTabbable(node);
599
- });
600
- var lastDomTabbableNode = focusableNodes.slice().reverse().find(function(node) {
601
- return isTabbable(node);
602
- });
603
- var posTabIndexesFound = !!tabbableNodes.find(function(node) {
604
- return getTabIndex(node) > 0;
605
- });
606
- return {
607
- container,
608
- tabbableNodes,
609
- focusableNodes,
610
- /** True if at least one node with positive `tabindex` was found in this container. */
611
- posTabIndexesFound,
612
- /** First tabbable node in container, __tabindex__ order; `undefined` if none. */
613
- firstTabbableNode,
614
- /** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
615
- lastTabbableNode,
616
- // NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
617
- // would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
618
- // because that API doesn't work with Shadow DOM as well as it should (@see
619
- // https://github.com/whatwg/dom/issues/320) and since this first/last is only needed, so far,
620
- // to address an edge case related to positive tabindex support, this seems like a much easier,
621
- // "close enough most of the time" alternative for positive tabindexes which should generally
622
- // be avoided anyway...
623
- /** First tabbable node in container, __DOM__ order; `undefined` if none. */
624
- firstDomTabbableNode,
625
- /** Last tabbable node in container, __DOM__ order; `undefined` if none. */
626
- lastDomTabbableNode,
627
- /**
628
- * Finds the __tabbable__ node that follows the given node in the specified direction,
629
- * in this container, if any.
630
- * @param {HTMLElement} node
631
- * @param {boolean} [forward] True if going in forward tab order; false if going
632
- * in reverse.
633
- * @returns {HTMLElement|undefined} The next tabbable node, if any.
634
- */
635
- nextTabbableNode: function nextTabbableNode(node) {
636
- var forward = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
637
- var nodeIdx = tabbableNodes.indexOf(node);
638
- if (nodeIdx < 0) {
639
- if (forward) {
640
- return focusableNodes.slice(focusableNodes.indexOf(node) + 1).find(function(el) {
641
- return isTabbable(el);
642
- });
643
- }
644
- return focusableNodes.slice(0, focusableNodes.indexOf(node)).reverse().find(function(el) {
645
- return isTabbable(el);
646
- });
647
- }
648
- return tabbableNodes[nodeIdx + (forward ? 1 : -1)];
649
- }
650
- };
651
- });
652
- state.tabbableGroups = state.containerGroups.filter(function(group) {
653
- return group.tabbableNodes.length > 0;
654
- });
655
- if (state.tabbableGroups.length <= 0 && !getNodeForOption("fallbackFocus")) {
656
- throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
657
- }
658
- if (state.containerGroups.find(function(g) {
659
- return g.posTabIndexesFound;
660
- }) && state.containerGroups.length > 1) {
661
- throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.");
662
- }
663
- };
664
- var _getActiveElement = function getActiveElement(el) {
665
- var activeElement = el.activeElement;
666
- if (!activeElement) {
667
- return;
668
- }
669
- if (activeElement.shadowRoot && activeElement.shadowRoot.activeElement !== null) {
670
- return _getActiveElement(activeElement.shadowRoot);
671
- }
672
- return activeElement;
673
- };
674
- var _tryFocus = function tryFocus(node) {
675
- if (node === false) {
676
- return;
677
- }
678
- if (node === _getActiveElement(document)) {
679
- return;
680
- }
681
- if (!node || !node.focus) {
682
- _tryFocus(getInitialFocusNode());
683
- return;
684
- }
685
- node.focus({
686
- preventScroll: !!config.preventScroll
687
- });
688
- state.mostRecentlyFocusedNode = node;
689
- if (isSelectableInput(node)) {
690
- node.select();
691
- }
692
- };
693
- var getReturnFocusNode = function getReturnFocusNode2(previousActiveElement) {
694
- var node = getNodeForOption("setReturnFocus", {
695
- params: [previousActiveElement]
696
- });
697
- return node ? node : node === false ? false : previousActiveElement;
698
- };
699
- var findNextNavNode = function findNextNavNode2(_ref3) {
700
- var target = _ref3.target, event = _ref3.event, _ref3$isBackward = _ref3.isBackward, isBackward = _ref3$isBackward === void 0 ? false : _ref3$isBackward;
701
- target = target || getActualTarget(event);
702
- updateTabbableNodes();
703
- var destinationNode = null;
704
- if (state.tabbableGroups.length > 0) {
705
- var containerIndex = findContainerIndex(target, event);
706
- var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : void 0;
707
- if (containerIndex < 0) {
708
- if (isBackward) {
709
- destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;
710
- } else {
711
- destinationNode = state.tabbableGroups[0].firstTabbableNode;
712
- }
713
- } else if (isBackward) {
714
- var startOfGroupIndex = state.tabbableGroups.findIndex(function(_ref4) {
715
- var firstTabbableNode = _ref4.firstTabbableNode;
716
- return target === firstTabbableNode;
717
- });
718
- if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
719
- startOfGroupIndex = containerIndex;
720
- }
721
- if (startOfGroupIndex >= 0) {
722
- var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
723
- var destinationGroup = state.tabbableGroups[destinationGroupIndex];
724
- destinationNode = getTabIndex(target) >= 0 ? destinationGroup.lastTabbableNode : destinationGroup.lastDomTabbableNode;
725
- } else if (!isTabEvent(event)) {
726
- destinationNode = containerGroup.nextTabbableNode(target, false);
727
- }
728
- } else {
729
- var lastOfGroupIndex = state.tabbableGroups.findIndex(function(_ref5) {
730
- var lastTabbableNode = _ref5.lastTabbableNode;
731
- return target === lastTabbableNode;
732
- });
733
- if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
734
- lastOfGroupIndex = containerIndex;
735
- }
736
- if (lastOfGroupIndex >= 0) {
737
- var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
738
- var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
739
- destinationNode = getTabIndex(target) >= 0 ? _destinationGroup.firstTabbableNode : _destinationGroup.firstDomTabbableNode;
740
- } else if (!isTabEvent(event)) {
741
- destinationNode = containerGroup.nextTabbableNode(target);
742
- }
743
- }
744
- } else {
745
- destinationNode = getNodeForOption("fallbackFocus");
746
- }
747
- return destinationNode;
748
- };
749
- var checkPointerDown = function checkPointerDown2(e) {
750
- var target = getActualTarget(e);
751
- if (findContainerIndex(target, e) >= 0) {
752
- return;
753
- }
754
- if (valueOrHandler(config.clickOutsideDeactivates, e)) {
755
- trap.deactivate({
756
- // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
757
- // which will result in the outside click setting focus to the node
758
- // that was clicked (and if not focusable, to "nothing"); by setting
759
- // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
760
- // on activation (or the configured `setReturnFocus` node), whether the
761
- // outside click was on a focusable node or not
762
- returnFocus: config.returnFocusOnDeactivate
763
- });
764
- return;
765
- }
766
- if (valueOrHandler(config.allowOutsideClick, e)) {
767
- return;
768
- }
769
- e.preventDefault();
770
- };
771
- var checkFocusIn = function checkFocusIn2(event) {
772
- var target = getActualTarget(event);
773
- var targetContained = findContainerIndex(target, event) >= 0;
774
- if (targetContained || target instanceof Document) {
775
- if (targetContained) {
776
- state.mostRecentlyFocusedNode = target;
777
- }
778
- } else {
779
- event.stopImmediatePropagation();
780
- var nextNode;
781
- var navAcrossContainers = true;
782
- if (state.mostRecentlyFocusedNode) {
783
- if (getTabIndex(state.mostRecentlyFocusedNode) > 0) {
784
- var mruContainerIdx = findContainerIndex(state.mostRecentlyFocusedNode);
785
- var tabbableNodes = state.containerGroups[mruContainerIdx].tabbableNodes;
786
- if (tabbableNodes.length > 0) {
787
- var mruTabIdx = tabbableNodes.findIndex(function(node) {
788
- return node === state.mostRecentlyFocusedNode;
789
- });
790
- if (mruTabIdx >= 0) {
791
- if (config.isKeyForward(state.recentNavEvent)) {
792
- if (mruTabIdx + 1 < tabbableNodes.length) {
793
- nextNode = tabbableNodes[mruTabIdx + 1];
794
- navAcrossContainers = false;
795
- }
796
- } else {
797
- if (mruTabIdx - 1 >= 0) {
798
- nextNode = tabbableNodes[mruTabIdx - 1];
799
- navAcrossContainers = false;
800
- }
801
- }
802
- }
803
- }
804
- } else {
805
- if (!state.containerGroups.some(function(g) {
806
- return g.tabbableNodes.some(function(n) {
807
- return getTabIndex(n) > 0;
808
- });
809
- })) {
810
- navAcrossContainers = false;
811
- }
812
- }
813
- } else {
814
- navAcrossContainers = false;
815
- }
816
- if (navAcrossContainers) {
817
- nextNode = findNextNavNode({
818
- // move FROM the MRU node, not event-related node (which will be the node that is
819
- // outside the trap causing the focus escape we're trying to fix)
820
- target: state.mostRecentlyFocusedNode,
821
- isBackward: config.isKeyBackward(state.recentNavEvent)
822
- });
823
- }
824
- if (nextNode) {
825
- _tryFocus(nextNode);
826
- } else {
827
- _tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
828
- }
829
- }
830
- state.recentNavEvent = void 0;
831
- };
832
- var checkKeyNav = function checkKeyNav2(event) {
833
- var isBackward = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
834
- state.recentNavEvent = event;
835
- var destinationNode = findNextNavNode({
836
- event,
837
- isBackward
838
- });
839
- if (destinationNode) {
840
- if (isTabEvent(event)) {
841
- event.preventDefault();
842
- }
843
- _tryFocus(destinationNode);
844
- }
845
- };
846
- var checkTabKey = function checkTabKey2(event) {
847
- if (config.isKeyForward(event) || config.isKeyBackward(event)) {
848
- checkKeyNav(event, config.isKeyBackward(event));
849
- }
850
- };
851
- var checkEscapeKey = function checkEscapeKey2(event) {
852
- if (isEscapeEvent(event) && valueOrHandler(config.escapeDeactivates, event) !== false) {
853
- event.preventDefault();
854
- trap.deactivate();
855
- }
856
- };
857
- var checkClick = function checkClick2(e) {
858
- var target = getActualTarget(e);
859
- if (findContainerIndex(target, e) >= 0) {
860
- return;
861
- }
862
- if (valueOrHandler(config.clickOutsideDeactivates, e)) {
863
- return;
864
- }
865
- if (valueOrHandler(config.allowOutsideClick, e)) {
866
- return;
867
- }
868
- e.preventDefault();
869
- e.stopImmediatePropagation();
870
- };
871
- var addListeners = function addListeners2() {
872
- if (!state.active) {
873
- return;
874
- }
875
- activeFocusTraps.activateTrap(trapStack, trap);
876
- state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function() {
877
- _tryFocus(getInitialFocusNode());
878
- }) : _tryFocus(getInitialFocusNode());
879
- doc.addEventListener("focusin", checkFocusIn, true);
880
- doc.addEventListener("mousedown", checkPointerDown, {
881
- capture: true,
882
- passive: false
883
- });
884
- doc.addEventListener("touchstart", checkPointerDown, {
885
- capture: true,
886
- passive: false
887
- });
888
- doc.addEventListener("click", checkClick, {
889
- capture: true,
890
- passive: false
891
- });
892
- doc.addEventListener("keydown", checkTabKey, {
893
- capture: true,
894
- passive: false
895
- });
896
- doc.addEventListener("keydown", checkEscapeKey);
897
- return trap;
898
- };
899
- var removeListeners = function removeListeners2() {
900
- if (!state.active) {
901
- return;
902
- }
903
- doc.removeEventListener("focusin", checkFocusIn, true);
904
- doc.removeEventListener("mousedown", checkPointerDown, true);
905
- doc.removeEventListener("touchstart", checkPointerDown, true);
906
- doc.removeEventListener("click", checkClick, true);
907
- doc.removeEventListener("keydown", checkTabKey, true);
908
- doc.removeEventListener("keydown", checkEscapeKey);
909
- return trap;
910
- };
911
- var checkDomRemoval = function checkDomRemoval2(mutations) {
912
- var isFocusedNodeRemoved = mutations.some(function(mutation) {
913
- var removedNodes = Array.from(mutation.removedNodes);
914
- return removedNodes.some(function(node) {
915
- return node === state.mostRecentlyFocusedNode;
916
- });
917
- });
918
- if (isFocusedNodeRemoved) {
919
- _tryFocus(getInitialFocusNode());
920
- }
921
- };
922
- var mutationObserver = typeof window !== "undefined" && "MutationObserver" in window ? new MutationObserver(checkDomRemoval) : void 0;
923
- var updateObservedNodes = function updateObservedNodes2() {
924
- if (!mutationObserver) {
925
- return;
926
- }
927
- mutationObserver.disconnect();
928
- if (state.active && !state.paused) {
929
- state.containers.map(function(container) {
930
- mutationObserver.observe(container, {
931
- subtree: true,
932
- childList: true
933
- });
934
- });
935
- }
936
- };
937
- trap = {
938
- get active() {
939
- return state.active;
940
- },
941
- get paused() {
942
- return state.paused;
943
- },
944
- activate: function activate(activateOptions) {
945
- if (state.active) {
946
- return this;
947
- }
948
- var onActivate = getOption(activateOptions, "onActivate");
949
- var onPostActivate = getOption(activateOptions, "onPostActivate");
950
- var checkCanFocusTrap = getOption(activateOptions, "checkCanFocusTrap");
951
- if (!checkCanFocusTrap) {
952
- updateTabbableNodes();
953
- }
954
- state.active = true;
955
- state.paused = false;
956
- state.nodeFocusedBeforeActivation = _getActiveElement(doc);
957
- onActivate === null || onActivate === void 0 || onActivate();
958
- var finishActivation = function finishActivation2() {
959
- if (checkCanFocusTrap) {
960
- updateTabbableNodes();
961
- }
962
- addListeners();
963
- updateObservedNodes();
964
- onPostActivate === null || onPostActivate === void 0 || onPostActivate();
965
- };
966
- if (checkCanFocusTrap) {
967
- checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
968
- return this;
969
- }
970
- finishActivation();
971
- return this;
972
- },
973
- deactivate: function deactivate(deactivateOptions) {
974
- if (!state.active) {
975
- return this;
976
- }
977
- var options = _objectSpread2({
978
- onDeactivate: config.onDeactivate,
979
- onPostDeactivate: config.onPostDeactivate,
980
- checkCanReturnFocus: config.checkCanReturnFocus
981
- }, deactivateOptions);
982
- clearTimeout(state.delayInitialFocusTimer);
983
- state.delayInitialFocusTimer = void 0;
984
- removeListeners();
985
- state.active = false;
986
- state.paused = false;
987
- updateObservedNodes();
988
- activeFocusTraps.deactivateTrap(trapStack, trap);
989
- var onDeactivate = getOption(options, "onDeactivate");
990
- var onPostDeactivate = getOption(options, "onPostDeactivate");
991
- var checkCanReturnFocus = getOption(options, "checkCanReturnFocus");
992
- var returnFocus = getOption(options, "returnFocus", "returnFocusOnDeactivate");
993
- onDeactivate === null || onDeactivate === void 0 || onDeactivate();
994
- var finishDeactivation = function finishDeactivation2() {
995
- delay(function() {
996
- if (returnFocus) {
997
- _tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
998
- }
999
- onPostDeactivate === null || onPostDeactivate === void 0 || onPostDeactivate();
1000
- });
1001
- };
1002
- if (returnFocus && checkCanReturnFocus) {
1003
- checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation);
1004
- return this;
1005
- }
1006
- finishDeactivation();
1007
- return this;
1008
- },
1009
- pause: function pause(pauseOptions) {
1010
- if (!state.active) {
1011
- return this;
1012
- }
1013
- state.manuallyPaused = true;
1014
- return this._setPausedState(true, pauseOptions);
1015
- },
1016
- unpause: function unpause(unpauseOptions) {
1017
- if (!state.active) {
1018
- return this;
1019
- }
1020
- state.manuallyPaused = false;
1021
- if (trapStack[trapStack.length - 1] !== this) {
1022
- return this;
1023
- }
1024
- return this._setPausedState(false, unpauseOptions);
1025
- },
1026
- updateContainerElements: function updateContainerElements(containerElements) {
1027
- var elementsAsArray = [].concat(containerElements).filter(Boolean);
1028
- state.containers = elementsAsArray.map(function(element) {
1029
- return typeof element === "string" ? doc.querySelector(element) : element;
1030
- });
1031
- if (state.active) {
1032
- updateTabbableNodes();
1033
- }
1034
- updateObservedNodes();
1035
- return this;
1036
- }
1037
- };
1038
- Object.defineProperties(trap, {
1039
- _isManuallyPaused: {
1040
- value: function value() {
1041
- return state.manuallyPaused;
1042
- }
1043
- },
1044
- _setPausedState: {
1045
- value: function value(paused, options) {
1046
- if (state.paused === paused) {
1047
- return this;
1048
- }
1049
- state.paused = paused;
1050
- if (paused) {
1051
- var onPause = getOption(options, "onPause");
1052
- var onPostPause = getOption(options, "onPostPause");
1053
- onPause === null || onPause === void 0 || onPause();
1054
- removeListeners();
1055
- updateObservedNodes();
1056
- onPostPause === null || onPostPause === void 0 || onPostPause();
1057
- } else {
1058
- var onUnpause = getOption(options, "onUnpause");
1059
- var onPostUnpause = getOption(options, "onPostUnpause");
1060
- onUnpause === null || onUnpause === void 0 || onUnpause();
1061
- updateTabbableNodes();
1062
- addListeners();
1063
- updateObservedNodes();
1064
- onPostUnpause === null || onPostUnpause === void 0 || onPostUnpause();
1065
- }
1066
- return this;
1067
- }
1068
- }
1069
- });
1070
- trap.updateContainerElements(elements);
1071
- return trap;
1072
- };
1073
- class GlobalToggle extends HTMLElement {
1074
- internals_;
1075
- controller;
1076
- widget;
1077
- focusTrap;
1078
- controls;
1079
- mq;
1080
- triggerText;
1081
- isOpen = false;
1082
- closeIconClass = "mx-icon--close";
1083
- menuIconClass = "mx-icon--menu";
1084
- searchIconClass = "mx-icon--search";
1085
- backgroundClass = "mx-background--primary";
1086
- scrollLockClass = "body--scroll-lock";
1087
- isSearch;
1088
- hideOther = true;
1089
- otherTrigger;
1090
- constructor() {
1091
- super();
1092
- this.internals_ = this.attachInternals();
1093
- this.controller = new AbortController();
1094
- this.mq = this.getAttribute("mq") || "(max-width: 720px)";
1095
- }
1096
- connectedCallback() {
1097
- if (!this.trigger || !this.target) return;
1098
- this.target?.setAttribute("role", "region");
1099
- const hideOther = this.trigger.getAttribute("hideOther");
1100
- if (hideOther === "false") this.hideOther = false;
1101
- this.isSearch = this.controls.includes("search");
1102
- this.otherTrigger = document.querySelector(
1103
- this.isSearch ? `.${this.menuIconClass}` : `.${this.searchIconClass}`
1104
- );
1105
- this.widget = new DisclosureWidget(this.trigger, this.target);
1106
- this.widget.init();
1107
- this.focusTrap = createFocusTrap(this.target, {
1108
- escapeDeactivates: false,
1109
- setReturnFocus: this.trigger,
1110
- allowOutsideClick: true,
1111
- onActivate: () => document.body.classList.add(this.scrollLockClass),
1112
- onDeactivate: () => document.body.classList.remove(this.scrollLockClass),
1113
- checkCanFocusTrap: ([trapContainer]) => new Promise((resolve) => {
1114
- const interval = setInterval(() => {
1115
- if (getComputedStyle(trapContainer).visibility !== "hidden") {
1116
- resolve();
1117
- clearInterval(interval);
1118
- }
1119
- }, 5);
1120
- })
1121
- });
1122
- const { signal } = this.controller;
1123
- this.handleBreakpoint(this.breakpoint);
1124
- this.breakpoint.addEventListener("change", this.handleBreakpoint, {
1125
- signal
1126
- });
1127
- document.addEventListener("keydown", this.handleKeyDown, { signal });
1128
- }
1129
- disconnectedCallback() {
1130
- this.widget.detach();
1131
- this.controller.abort();
1132
- }
1133
- handleBreakpoint = ({ matches: matches2 }) => {
1134
- if (!this.trigger) return;
1135
- const { signal } = this.controller;
1136
- if (matches2) {
1137
- this.widget.attach();
1138
- this.target.setAttribute("inert", "");
1139
- this.trigger.addEventListener("disclosure-toggle", this.handleDisclosure, { signal });
1140
- } else {
1141
- this.widget.detach();
1142
- this.target.removeAttribute("inert");
1143
- this.target.classList.remove(this.scrollLockClass);
1144
- this.trigger.removeEventListener("disclosure-toggle", this.handleDisclosure);
1145
- this.focusTrap.deactivate();
1146
- }
1147
- };
1148
- handleDisclosure = ({ detail }) => {
1149
- const { isOpen } = detail;
1150
- const origText = !isOpen ? "Close" : "Open";
1151
- const replaceText = !isOpen ? "Open" : "Close";
1152
- this.trigger.textContent = this.triggerText.replace(origText, replaceText);
1153
- isOpen ? this.focusTrap.activate() : this.focusTrap.deactivate();
1154
- if (isOpen && this.hideOther && this.otherTrigger) {
1155
- if (this.otherTrigger.getAttribute("aria-expanded") === "true") {
1156
- this.otherTrigger.click();
1157
- }
1158
- }
1159
- this.trigger.classList.toggle(this.isSearch ? this.searchIconClass : this.menuIconClass);
1160
- this.trigger.classList.toggle(this.closeIconClass);
1161
- this.target.classList.toggle(this.backgroundClass);
1162
- this.trigger.removeAttribute("no-focus");
1163
- this.isOpen = isOpen;
1164
- };
1165
- handleKeyDown = (event) => {
1166
- if (this.isOpen && event.key === "Escape") this.widget.handleToggle();
1167
- };
1168
- get trigger() {
1169
- const trigger = this.querySelector(":scope > button");
1170
- const controls = trigger.getAttribute("aria-controls");
1171
- if (!trigger || !controls) {
1172
- throw new Error(
1173
- `${this.localName} must contain a <button aria-controls="element-to-trigger"> element.`
1174
- );
1175
- }
1176
- trigger.removeAttribute("disabled");
1177
- this.controls = controls;
1178
- this.triggerText = trigger.textContent;
1179
- return trigger;
1180
- }
1181
- get target() {
1182
- const target = document.querySelector(`div[id="${this.controls}"]`);
1183
- if (!target) {
1184
- throw new Error(`${this.localName} must contain a target <div id="${this.controls}">.`);
1185
- }
1186
- target.classList.remove("global-nav-up-only");
1187
- return target;
1188
- }
1189
- get breakpoint() {
1190
- return window.matchMedia(this.mq);
1191
- }
1192
- }
1193
- if (!customElements.get("mx-global-toggle")) customElements.define("mx-global-toggle", GlobalToggle);
1194
- //# sourceMappingURL=header.entry.js.map
247
+ activateTrap: function(e, O) {
248
+ if (e.length > 0) {
249
+ var k = e[e.length - 1];
250
+ k !== O && k._setPausedState(!0);
251
+ }
252
+ var A = e.indexOf(O);
253
+ A === -1 || e.splice(A, 1), e.push(O);
254
+ },
255
+ deactivateTrap: function(e, O) {
256
+ var k = e.indexOf(O);
257
+ k !== -1 && e.splice(k, 1), e.length > 0 && !e[e.length - 1]._isManuallyPaused() && e[e.length - 1]._setPausedState(!1);
258
+ }
259
+ }, isSelectableInput = function(e) {
260
+ return e.tagName && e.tagName.toLowerCase() === "input" && typeof e.select == "function";
261
+ }, isEscapeEvent = function(e) {
262
+ return e?.key === "Escape" || e?.key === "Esc" || e?.keyCode === 27;
263
+ }, isTabEvent = function(e) {
264
+ return e?.key === "Tab" || e?.keyCode === 9;
265
+ }, isKeyForward = function(e) {
266
+ return isTabEvent(e) && !e.shiftKey;
267
+ }, isKeyBackward = function(e) {
268
+ return isTabEvent(e) && e.shiftKey;
269
+ }, delay = function(e) {
270
+ return setTimeout(e, 0);
271
+ }, valueOrHandler = function(e) {
272
+ var O = [...arguments].slice(1);
273
+ return typeof e == "function" ? e.apply(void 0, O) : e;
274
+ }, getActualTarget = function(e) {
275
+ return e.target.shadowRoot && typeof e.composedPath == "function" ? e.composedPath()[0] : e.target;
276
+ }, internalTrapStack = [], createFocusTrap = function(e, O) {
277
+ var k = O?.document || document, A = O?.trapStack || internalTrapStack, j = _objectSpread2({
278
+ returnFocusOnDeactivate: !0,
279
+ escapeDeactivates: !0,
280
+ delayInitialFocus: !0,
281
+ isKeyForward,
282
+ isKeyBackward
283
+ }, O), M = {
284
+ containers: [],
285
+ containerGroups: [],
286
+ tabbableGroups: [],
287
+ nodeFocusedBeforeActivation: null,
288
+ mostRecentlyFocusedNode: null,
289
+ active: !1,
290
+ paused: !1,
291
+ manuallyPaused: !1,
292
+ delayInitialFocusTimer: void 0,
293
+ recentNavEvent: void 0
294
+ }, N, P = function(e, O, k) {
295
+ return e && e[O] !== void 0 ? e[O] : j[k || O];
296
+ }, F = function(e, O) {
297
+ var k = typeof O?.composedPath == "function" ? O.composedPath() : void 0;
298
+ return M.containerGroups.findIndex(function(O) {
299
+ var A = O.container, j = O.tabbableNodes;
300
+ return A.contains(e) || k?.includes(A) || j.find(function(O) {
301
+ return O === e;
302
+ });
303
+ });
304
+ }, I = function(e) {
305
+ var O = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, A = O.hasFallback, M = A === void 0 ? !1 : A, N = O.params, P = N === void 0 ? [] : N, F = j[e];
306
+ if (typeof F == "function" && (F = F.apply(void 0, _toConsumableArray(P))), F === !0 && (F = void 0), !F) {
307
+ if (F === void 0 || F === !1) return F;
308
+ throw Error(`\`${e}\` was specified but was not a node, or did not return a node`);
309
+ }
310
+ var I = F;
311
+ if (typeof F == "string") {
312
+ try {
313
+ I = k.querySelector(F);
314
+ } catch (O) {
315
+ throw Error(`\`${e}\` appears to be an invalid selector; error="${O.message}"`);
316
+ }
317
+ if (!I && !M) throw Error(`\`${e}\` as selector refers to no known node`);
318
+ }
319
+ return I;
320
+ }, L = function() {
321
+ var e = I("initialFocus", { hasFallback: !0 });
322
+ if (e === !1) return !1;
323
+ if (e === void 0 || e && !isFocusable(e, j.tabbableOptions)) if (F(k.activeElement) >= 0) e = k.activeElement;
324
+ else {
325
+ var O = M.tabbableGroups[0];
326
+ e = O && O.firstTabbableNode || I("fallbackFocus");
327
+ }
328
+ else e === null && (e = I("fallbackFocus"));
329
+ if (!e) throw Error("Your focus-trap needs to have at least one focusable element");
330
+ return e;
331
+ }, z = function() {
332
+ if (M.containerGroups = M.containers.map(function(e) {
333
+ var O = tabbable(e, j.tabbableOptions), k = focusable(e, j.tabbableOptions), A = O.length > 0 ? O[0] : void 0, M = O.length > 0 ? O[O.length - 1] : void 0, N = k.find(function(e) {
334
+ return isTabbable(e);
335
+ }), P = k.slice().reverse().find(function(e) {
336
+ return isTabbable(e);
337
+ });
338
+ return {
339
+ container: e,
340
+ tabbableNodes: O,
341
+ focusableNodes: k,
342
+ posTabIndexesFound: !!O.find(function(e) {
343
+ return getTabIndex(e) > 0;
344
+ }),
345
+ firstTabbableNode: A,
346
+ lastTabbableNode: M,
347
+ firstDomTabbableNode: N,
348
+ lastDomTabbableNode: P,
349
+ nextTabbableNode: function(e) {
350
+ var A = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, j = O.indexOf(e);
351
+ return j < 0 ? A ? k.slice(k.indexOf(e) + 1).find(function(e) {
352
+ return isTabbable(e);
353
+ }) : k.slice(0, k.indexOf(e)).reverse().find(function(e) {
354
+ return isTabbable(e);
355
+ }) : O[j + (A ? 1 : -1)];
356
+ }
357
+ };
358
+ }), M.tabbableGroups = M.containerGroups.filter(function(e) {
359
+ return e.tabbableNodes.length > 0;
360
+ }), M.tabbableGroups.length <= 0 && !I("fallbackFocus")) throw Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
361
+ if (M.containerGroups.find(function(e) {
362
+ return e.posTabIndexesFound;
363
+ }) && M.containerGroups.length > 1) throw Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.");
364
+ }, B = function(e) {
365
+ var O = e.activeElement;
366
+ if (O) return O.shadowRoot && O.shadowRoot.activeElement !== null ? B(O.shadowRoot) : O;
367
+ }, V = function(e) {
368
+ if (e !== !1 && e !== B(document)) {
369
+ if (!e || !e.focus) {
370
+ V(L());
371
+ return;
372
+ }
373
+ e.focus({ preventScroll: !!j.preventScroll }), M.mostRecentlyFocusedNode = e, isSelectableInput(e) && e.select();
374
+ }
375
+ }, H = function(e) {
376
+ var O = I("setReturnFocus", { params: [e] });
377
+ return O || (O === !1 ? !1 : e);
378
+ }, U = function(e) {
379
+ var O = e.target, k = e.event, A = e.isBackward, N = A === void 0 ? !1 : A;
380
+ O ||= getActualTarget(k), z();
381
+ var P = null;
382
+ if (M.tabbableGroups.length > 0) {
383
+ var L = F(O, k), B = L >= 0 ? M.containerGroups[L] : void 0;
384
+ if (L < 0) P = N ? M.tabbableGroups[M.tabbableGroups.length - 1].lastTabbableNode : M.tabbableGroups[0].firstTabbableNode;
385
+ else if (N) {
386
+ var V = M.tabbableGroups.findIndex(function(e) {
387
+ var k = e.firstTabbableNode;
388
+ return O === k;
389
+ });
390
+ if (V < 0 && (B.container === O || isFocusable(O, j.tabbableOptions) && !isTabbable(O, j.tabbableOptions) && !B.nextTabbableNode(O, !1)) && (V = L), V >= 0) {
391
+ var H = V === 0 ? M.tabbableGroups.length - 1 : V - 1, U = M.tabbableGroups[H];
392
+ P = getTabIndex(O) >= 0 ? U.lastTabbableNode : U.lastDomTabbableNode;
393
+ } else isTabEvent(k) || (P = B.nextTabbableNode(O, !1));
394
+ } else {
395
+ var W = M.tabbableGroups.findIndex(function(e) {
396
+ var k = e.lastTabbableNode;
397
+ return O === k;
398
+ });
399
+ if (W < 0 && (B.container === O || isFocusable(O, j.tabbableOptions) && !isTabbable(O, j.tabbableOptions) && !B.nextTabbableNode(O)) && (W = L), W >= 0) {
400
+ var G = W === M.tabbableGroups.length - 1 ? 0 : W + 1, K = M.tabbableGroups[G];
401
+ P = getTabIndex(O) >= 0 ? K.firstTabbableNode : K.firstDomTabbableNode;
402
+ } else isTabEvent(k) || (P = B.nextTabbableNode(O));
403
+ }
404
+ } else P = I("fallbackFocus");
405
+ return P;
406
+ }, W = function(e) {
407
+ if (!(F(getActualTarget(e), e) >= 0)) {
408
+ if (valueOrHandler(j.clickOutsideDeactivates, e)) {
409
+ N.deactivate({ returnFocus: j.returnFocusOnDeactivate });
410
+ return;
411
+ }
412
+ valueOrHandler(j.allowOutsideClick, e) || e.preventDefault();
413
+ }
414
+ }, G = function(e) {
415
+ var O = getActualTarget(e), k = F(O, e) >= 0;
416
+ if (k || O instanceof Document) k && (M.mostRecentlyFocusedNode = O);
417
+ else {
418
+ e.stopImmediatePropagation();
419
+ var A, N = !0;
420
+ if (M.mostRecentlyFocusedNode) if (getTabIndex(M.mostRecentlyFocusedNode) > 0) {
421
+ var P = F(M.mostRecentlyFocusedNode), I = M.containerGroups[P].tabbableNodes;
422
+ if (I.length > 0) {
423
+ var z = I.findIndex(function(e) {
424
+ return e === M.mostRecentlyFocusedNode;
425
+ });
426
+ z >= 0 && (j.isKeyForward(M.recentNavEvent) ? z + 1 < I.length && (A = I[z + 1], N = !1) : z - 1 >= 0 && (A = I[z - 1], N = !1));
427
+ }
428
+ } else M.containerGroups.some(function(e) {
429
+ return e.tabbableNodes.some(function(e) {
430
+ return getTabIndex(e) > 0;
431
+ });
432
+ }) || (N = !1);
433
+ else N = !1;
434
+ N && (A = U({
435
+ target: M.mostRecentlyFocusedNode,
436
+ isBackward: j.isKeyBackward(M.recentNavEvent)
437
+ })), V(A || M.mostRecentlyFocusedNode || L());
438
+ }
439
+ M.recentNavEvent = void 0;
440
+ }, K = function(e) {
441
+ var O = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
442
+ M.recentNavEvent = e;
443
+ var k = U({
444
+ event: e,
445
+ isBackward: O
446
+ });
447
+ k && (isTabEvent(e) && e.preventDefault(), V(k));
448
+ }, q = function(e) {
449
+ (j.isKeyForward(e) || j.isKeyBackward(e)) && K(e, j.isKeyBackward(e));
450
+ }, J = function(e) {
451
+ isEscapeEvent(e) && valueOrHandler(j.escapeDeactivates, e) !== !1 && (e.preventDefault(), N.deactivate());
452
+ }, Y = function(e) {
453
+ F(getActualTarget(e), e) >= 0 || valueOrHandler(j.clickOutsideDeactivates, e) || valueOrHandler(j.allowOutsideClick, e) || (e.preventDefault(), e.stopImmediatePropagation());
454
+ }, X = function() {
455
+ if (M.active) return activeFocusTraps.activateTrap(A, N), M.delayInitialFocusTimer = j.delayInitialFocus ? delay(function() {
456
+ V(L());
457
+ }) : V(L()), k.addEventListener("focusin", G, !0), k.addEventListener("mousedown", W, {
458
+ capture: !0,
459
+ passive: !1
460
+ }), k.addEventListener("touchstart", W, {
461
+ capture: !0,
462
+ passive: !1
463
+ }), k.addEventListener("click", Y, {
464
+ capture: !0,
465
+ passive: !1
466
+ }), k.addEventListener("keydown", q, {
467
+ capture: !0,
468
+ passive: !1
469
+ }), k.addEventListener("keydown", J), N;
470
+ }, Z = function() {
471
+ if (M.active) return k.removeEventListener("focusin", G, !0), k.removeEventListener("mousedown", W, !0), k.removeEventListener("touchstart", W, !0), k.removeEventListener("click", Y, !0), k.removeEventListener("keydown", q, !0), k.removeEventListener("keydown", J), N;
472
+ }, Q = typeof window < "u" && "MutationObserver" in window ? new MutationObserver(function(e) {
473
+ e.some(function(e) {
474
+ return Array.from(e.removedNodes).some(function(e) {
475
+ return e === M.mostRecentlyFocusedNode;
476
+ });
477
+ }) && V(L());
478
+ }) : void 0, $ = function() {
479
+ Q && (Q.disconnect(), M.active && !M.paused && M.containers.map(function(e) {
480
+ Q.observe(e, {
481
+ subtree: !0,
482
+ childList: !0
483
+ });
484
+ }));
485
+ };
486
+ return N = {
487
+ get active() {
488
+ return M.active;
489
+ },
490
+ get paused() {
491
+ return M.paused;
492
+ },
493
+ activate: function(e) {
494
+ if (M.active) return this;
495
+ var O = P(e, "onActivate"), A = P(e, "onPostActivate"), j = P(e, "checkCanFocusTrap");
496
+ j || z(), M.active = !0, M.paused = !1, M.nodeFocusedBeforeActivation = B(k), O?.();
497
+ var N = function() {
498
+ j && z(), X(), $(), A?.();
499
+ };
500
+ return j ? (j(M.containers.concat()).then(N, N), this) : (N(), this);
501
+ },
502
+ deactivate: function(e) {
503
+ if (!M.active) return this;
504
+ var O = _objectSpread2({
505
+ onDeactivate: j.onDeactivate,
506
+ onPostDeactivate: j.onPostDeactivate,
507
+ checkCanReturnFocus: j.checkCanReturnFocus
508
+ }, e);
509
+ clearTimeout(M.delayInitialFocusTimer), M.delayInitialFocusTimer = void 0, Z(), M.active = !1, M.paused = !1, $(), activeFocusTraps.deactivateTrap(A, N);
510
+ var k = P(O, "onDeactivate"), F = P(O, "onPostDeactivate"), I = P(O, "checkCanReturnFocus"), L = P(O, "returnFocus", "returnFocusOnDeactivate");
511
+ k?.();
512
+ var R = function() {
513
+ delay(function() {
514
+ L && V(H(M.nodeFocusedBeforeActivation)), F?.();
515
+ });
516
+ };
517
+ return L && I ? (I(H(M.nodeFocusedBeforeActivation)).then(R, R), this) : (R(), this);
518
+ },
519
+ pause: function(e) {
520
+ return M.active ? (M.manuallyPaused = !0, this._setPausedState(!0, e)) : this;
521
+ },
522
+ unpause: function(e) {
523
+ return !M.active || (M.manuallyPaused = !1, A[A.length - 1] !== this) ? this : this._setPausedState(!1, e);
524
+ },
525
+ updateContainerElements: function(e) {
526
+ return M.containers = [].concat(e).filter(Boolean).map(function(e) {
527
+ return typeof e == "string" ? k.querySelector(e) : e;
528
+ }), M.active && z(), $(), this;
529
+ }
530
+ }, Object.defineProperties(N, {
531
+ _isManuallyPaused: { value: function() {
532
+ return M.manuallyPaused;
533
+ } },
534
+ _setPausedState: { value: function(e, O) {
535
+ if (M.paused === e) return this;
536
+ if (M.paused = e, e) {
537
+ var k = P(O, "onPause"), A = P(O, "onPostPause");
538
+ k?.(), Z(), $(), A?.();
539
+ } else {
540
+ var j = P(O, "onUnpause"), N = P(O, "onPostUnpause");
541
+ j?.(), z(), X(), $(), N?.();
542
+ }
543
+ return this;
544
+ } }
545
+ }), N.updateContainerElements(e), N;
546
+ }, GlobalToggle = class extends HTMLElement {
547
+ internals_;
548
+ controller;
549
+ widget;
550
+ focusTrap;
551
+ controls;
552
+ mq;
553
+ triggerText;
554
+ isOpen = !1;
555
+ closeIconClass = "mx-icon--close";
556
+ menuIconClass = "mx-icon--menu";
557
+ searchIconClass = "mx-icon--search";
558
+ backgroundClass = "mx-background--primary";
559
+ scrollLockClass = "body--scroll-lock";
560
+ isSearch;
561
+ hideOther = !0;
562
+ otherTrigger;
563
+ constructor() {
564
+ super(), this.internals_ = this.attachInternals(), this.controller = new AbortController(), this.mq = this.getAttribute("mq") || "(max-width: 720px)";
565
+ }
566
+ connectedCallback() {
567
+ if (!this.trigger || !this.target) return;
568
+ this.target?.setAttribute("role", "region"), this.trigger.getAttribute("hideOther") === "false" && (this.hideOther = !1), this.isSearch = this.controls.includes("search"), this.otherTrigger = document.querySelector(this.isSearch ? `.${this.menuIconClass}` : `.${this.searchIconClass}`), this.widget = new DisclosureWidget(this.trigger, this.target), this.widget.init(), this.focusTrap = createFocusTrap(this.target, {
569
+ escapeDeactivates: !1,
570
+ setReturnFocus: this.trigger,
571
+ allowOutsideClick: !0,
572
+ onActivate: () => document.body.classList.add(this.scrollLockClass),
573
+ onDeactivate: () => document.body.classList.remove(this.scrollLockClass),
574
+ checkCanFocusTrap: ([e]) => new Promise((O) => {
575
+ let k = setInterval(() => {
576
+ getComputedStyle(e).visibility !== "hidden" && (O(), clearInterval(k));
577
+ }, 5);
578
+ })
579
+ });
580
+ let { signal: O } = this.controller;
581
+ this.handleBreakpoint(this.breakpoint), this.breakpoint.addEventListener("change", this.handleBreakpoint, { signal: O }), document.addEventListener("keydown", this.handleKeyDown, { signal: O });
582
+ }
583
+ disconnectedCallback() {
584
+ this.widget.detach(), this.controller.abort();
585
+ }
586
+ handleBreakpoint = ({ matches: e }) => {
587
+ if (!this.trigger) return;
588
+ let { signal: O } = this.controller;
589
+ e ? (this.widget.attach(), this.target.setAttribute("inert", ""), this.trigger.addEventListener("disclosure-toggle", this.handleDisclosure, { signal: O })) : (this.widget.detach(), this.target.removeAttribute("inert"), this.target.classList.remove(this.scrollLockClass), this.trigger.removeEventListener("disclosure-toggle", this.handleDisclosure), this.focusTrap.deactivate());
590
+ };
591
+ handleDisclosure = ({ detail: e }) => {
592
+ let { isOpen: O } = e, k = O ? "Open" : "Close", A = O ? "Close" : "Open";
593
+ this.trigger.textContent = this.triggerText.replace(k, A), O ? this.focusTrap.activate() : this.focusTrap.deactivate(), O && this.hideOther && this.otherTrigger && this.otherTrigger.getAttribute("aria-expanded") === "true" && this.otherTrigger.click(), this.trigger.classList.toggle(this.isSearch ? this.searchIconClass : this.menuIconClass), this.trigger.classList.toggle(this.closeIconClass), this.target.classList.toggle(this.backgroundClass), this.trigger.removeAttribute("no-focus"), this.isOpen = O;
594
+ };
595
+ handleKeyDown = (e) => {
596
+ this.isOpen && e.key === "Escape" && this.widget.handleToggle();
597
+ };
598
+ get trigger() {
599
+ let e = this.querySelector(":scope > button"), O = e.getAttribute("aria-controls");
600
+ if (!e || !O) throw Error(`${this.localName} must contain a <button aria-controls="element-to-trigger"> element.`);
601
+ return e.removeAttribute("disabled"), this.controls = O, this.triggerText = e.textContent, e;
602
+ }
603
+ get target() {
604
+ let e = document.querySelector(`div[id="${this.controls}"]`);
605
+ if (!e) throw Error(`${this.localName} must contain a target <div id="${this.controls}">.`);
606
+ return e.classList.remove("global-nav-up-only"), e;
607
+ }
608
+ get breakpoint() {
609
+ return window.matchMedia(this.mq);
610
+ }
611
+ };
612
+ customElements.get("mx-global-toggle") || customElements.define("mx-global-toggle", GlobalToggle);