@haiilo/catalyst 0.5.6 → 0.5.7

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 (296) hide show
  1. package/dist/catalyst/assets/fonts/AzeretMono-Regular.woff2 +0 -0
  2. package/dist/catalyst/assets/fonts/DMSans-Bold.woff2 +0 -0
  3. package/dist/catalyst/assets/fonts/DMSans-BoldItalic.woff2 +0 -0
  4. package/dist/catalyst/assets/fonts/DMSans-Italic.woff2 +0 -0
  5. package/dist/catalyst/assets/fonts/DMSans-Medium.woff2 +0 -0
  6. package/dist/catalyst/assets/fonts/DMSans-MediumItalic.woff2 +0 -0
  7. package/dist/catalyst/assets/fonts/DMSans-Regular.woff2 +0 -0
  8. package/dist/catalyst/assets/fonts/Lato-Black.woff +0 -0
  9. package/dist/catalyst/assets/fonts/Lato-Black.woff2 +0 -0
  10. package/dist/catalyst/assets/fonts/Lato-BlackItalic.woff +0 -0
  11. package/dist/catalyst/assets/fonts/Lato-BlackItalic.woff2 +0 -0
  12. package/dist/catalyst/assets/fonts/Lato-Bold.woff +0 -0
  13. package/dist/catalyst/assets/fonts/Lato-Bold.woff2 +0 -0
  14. package/dist/catalyst/assets/fonts/Lato-BoldItalic.woff +0 -0
  15. package/dist/catalyst/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  16. package/dist/catalyst/assets/fonts/Lato-Hairline.woff +0 -0
  17. package/dist/catalyst/assets/fonts/Lato-Hairline.woff2 +0 -0
  18. package/dist/catalyst/assets/fonts/Lato-HairlineItalic.woff +0 -0
  19. package/dist/catalyst/assets/fonts/Lato-HairlineItalic.woff2 +0 -0
  20. package/dist/catalyst/assets/fonts/Lato-Heavy.woff +0 -0
  21. package/dist/catalyst/assets/fonts/Lato-Heavy.woff2 +0 -0
  22. package/dist/catalyst/assets/fonts/Lato-HeavyItalic.woff +0 -0
  23. package/dist/catalyst/assets/fonts/Lato-HeavyItalic.woff2 +0 -0
  24. package/dist/catalyst/assets/fonts/Lato-Italic.woff +0 -0
  25. package/dist/catalyst/assets/fonts/Lato-Italic.woff2 +0 -0
  26. package/dist/catalyst/assets/fonts/Lato-Light.woff +0 -0
  27. package/dist/catalyst/assets/fonts/Lato-Light.woff2 +0 -0
  28. package/dist/catalyst/assets/fonts/Lato-LightItalic.woff +0 -0
  29. package/dist/catalyst/assets/fonts/Lato-LightItalic.woff2 +0 -0
  30. package/dist/catalyst/assets/fonts/Lato-Medium.woff +0 -0
  31. package/dist/catalyst/assets/fonts/Lato-Medium.woff2 +0 -0
  32. package/dist/catalyst/assets/fonts/Lato-MediumItalic.woff +0 -0
  33. package/dist/catalyst/assets/fonts/Lato-MediumItalic.woff2 +0 -0
  34. package/dist/catalyst/assets/fonts/Lato-Regular.woff +0 -0
  35. package/dist/catalyst/assets/fonts/Lato-Regular.woff2 +0 -0
  36. package/dist/catalyst/assets/fonts/Lato-Semibold.woff +0 -0
  37. package/dist/catalyst/assets/fonts/Lato-Semibold.woff2 +0 -0
  38. package/dist/catalyst/assets/fonts/Lato-SemiboldItalic.woff +0 -0
  39. package/dist/catalyst/assets/fonts/Lato-SemiboldItalic.woff2 +0 -0
  40. package/dist/catalyst/assets/fonts/Lato-Thin.woff +0 -0
  41. package/dist/catalyst/assets/fonts/Lato-Thin.woff2 +0 -0
  42. package/dist/catalyst/assets/fonts/Lato-ThinItalic.woff +0 -0
  43. package/dist/catalyst/assets/fonts/Lato-ThinItalic.woff2 +0 -0
  44. package/dist/catalyst/catalyst.css +1 -0
  45. package/dist/catalyst/catalyst.esm.js +2 -0
  46. package/dist/catalyst/catalyst.esm.js.map +1 -0
  47. package/dist/catalyst/index.cdn.js +21 -0
  48. package/dist/catalyst/index.esm.js +2 -0
  49. package/dist/catalyst/index.esm.js.map +1 -0
  50. package/dist/catalyst/p-9a3c2375.js +2 -0
  51. package/dist/catalyst/p-9a3c2375.js.map +1 -0
  52. package/dist/catalyst/p-a6b8ebe9.entry.js +10 -0
  53. package/dist/catalyst/p-a6b8ebe9.entry.js.map +1 -0
  54. package/dist/catalyst/p-bfc656ca.js +2 -0
  55. package/dist/catalyst/p-bfc656ca.js.map +1 -0
  56. package/dist/catalyst/p-e82b63e9.js +2 -0
  57. package/dist/catalyst/p-e82b63e9.js.map +1 -0
  58. package/dist/cjs/app-globals-2a30d681.js +256 -0
  59. package/dist/cjs/app-globals-2a30d681.js.map +1 -0
  60. package/dist/cjs/cat-alert_15.cjs.entry.js +4651 -0
  61. package/dist/cjs/cat-alert_15.cjs.entry.js.map +1 -0
  62. package/dist/cjs/cat-icon-registry-b3a95a6b.js +442 -0
  63. package/dist/cjs/cat-icon-registry-b3a95a6b.js.map +1 -0
  64. package/dist/cjs/catalyst.cjs.js +24 -0
  65. package/dist/cjs/catalyst.cjs.js.map +1 -0
  66. package/dist/cjs/index-5d72f0e4.js +1347 -0
  67. package/dist/cjs/index-5d72f0e4.js.map +1 -0
  68. package/dist/cjs/index.cjs.js +12 -0
  69. package/dist/cjs/index.cjs.js.map +1 -0
  70. package/dist/cjs/loader.cjs.js +26 -0
  71. package/dist/cjs/loader.cjs.js.map +1 -0
  72. package/dist/collection/assets/fonts/AzeretMono-Regular.woff2 +0 -0
  73. package/dist/collection/assets/fonts/DMSans-Bold.woff2 +0 -0
  74. package/dist/collection/assets/fonts/DMSans-BoldItalic.woff2 +0 -0
  75. package/dist/collection/assets/fonts/DMSans-Italic.woff2 +0 -0
  76. package/dist/collection/assets/fonts/DMSans-Medium.woff2 +0 -0
  77. package/dist/collection/assets/fonts/DMSans-MediumItalic.woff2 +0 -0
  78. package/dist/collection/assets/fonts/DMSans-Regular.woff2 +0 -0
  79. package/dist/collection/assets/fonts/Lato-Black.woff +0 -0
  80. package/dist/collection/assets/fonts/Lato-Black.woff2 +0 -0
  81. package/dist/collection/assets/fonts/Lato-BlackItalic.woff +0 -0
  82. package/dist/collection/assets/fonts/Lato-BlackItalic.woff2 +0 -0
  83. package/dist/collection/assets/fonts/Lato-Bold.woff +0 -0
  84. package/dist/collection/assets/fonts/Lato-Bold.woff2 +0 -0
  85. package/dist/collection/assets/fonts/Lato-BoldItalic.woff +0 -0
  86. package/dist/collection/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  87. package/dist/collection/assets/fonts/Lato-Hairline.woff +0 -0
  88. package/dist/collection/assets/fonts/Lato-Hairline.woff2 +0 -0
  89. package/dist/collection/assets/fonts/Lato-HairlineItalic.woff +0 -0
  90. package/dist/collection/assets/fonts/Lato-HairlineItalic.woff2 +0 -0
  91. package/dist/collection/assets/fonts/Lato-Heavy.woff +0 -0
  92. package/dist/collection/assets/fonts/Lato-Heavy.woff2 +0 -0
  93. package/dist/collection/assets/fonts/Lato-HeavyItalic.woff +0 -0
  94. package/dist/collection/assets/fonts/Lato-HeavyItalic.woff2 +0 -0
  95. package/dist/collection/assets/fonts/Lato-Italic.woff +0 -0
  96. package/dist/collection/assets/fonts/Lato-Italic.woff2 +0 -0
  97. package/dist/collection/assets/fonts/Lato-Light.woff +0 -0
  98. package/dist/collection/assets/fonts/Lato-Light.woff2 +0 -0
  99. package/dist/collection/assets/fonts/Lato-LightItalic.woff +0 -0
  100. package/dist/collection/assets/fonts/Lato-LightItalic.woff2 +0 -0
  101. package/dist/collection/assets/fonts/Lato-Medium.woff +0 -0
  102. package/dist/collection/assets/fonts/Lato-Medium.woff2 +0 -0
  103. package/dist/collection/assets/fonts/Lato-MediumItalic.woff +0 -0
  104. package/dist/collection/assets/fonts/Lato-MediumItalic.woff2 +0 -0
  105. package/dist/collection/assets/fonts/Lato-Regular.woff +0 -0
  106. package/dist/collection/assets/fonts/Lato-Regular.woff2 +0 -0
  107. package/dist/collection/assets/fonts/Lato-Semibold.woff +0 -0
  108. package/dist/collection/assets/fonts/Lato-Semibold.woff2 +0 -0
  109. package/dist/collection/assets/fonts/Lato-SemiboldItalic.woff +0 -0
  110. package/dist/collection/assets/fonts/Lato-SemiboldItalic.woff2 +0 -0
  111. package/dist/collection/assets/fonts/Lato-Thin.woff +0 -0
  112. package/dist/collection/assets/fonts/Lato-Thin.woff2 +0 -0
  113. package/dist/collection/assets/fonts/Lato-ThinItalic.woff +0 -0
  114. package/dist/collection/assets/fonts/Lato-ThinItalic.woff2 +0 -0
  115. package/dist/collection/collection-manifest.json +27 -0
  116. package/dist/collection/components/cat-alert/cat-alert.css +61 -0
  117. package/dist/collection/components/cat-alert/cat-alert.js +61 -0
  118. package/dist/collection/components/cat-alert/cat-alert.js.map +1 -0
  119. package/dist/collection/components/cat-badge/cat-badge.css +154 -0
  120. package/dist/collection/components/cat-badge/cat-badge.js +143 -0
  121. package/dist/collection/components/cat-badge/cat-badge.js.map +1 -0
  122. package/dist/collection/components/cat-button/cat-button.css +333 -0
  123. package/dist/collection/components/cat-button/cat-button.js +615 -0
  124. package/dist/collection/components/cat-button/cat-button.js.map +1 -0
  125. package/dist/collection/components/cat-card/cat-card.css +24 -0
  126. package/dist/collection/components/cat-card/cat-card.js +20 -0
  127. package/dist/collection/components/cat-card/cat-card.js.map +1 -0
  128. package/dist/collection/components/cat-checkbox/cat-checkbox.css +105 -0
  129. package/dist/collection/components/cat-checkbox/cat-checkbox.js +314 -0
  130. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -0
  131. package/dist/collection/components/cat-i18n/cat-i18n-registry.js +70 -0
  132. package/dist/collection/components/cat-i18n/cat-i18n-registry.js.map +1 -0
  133. package/dist/collection/components/cat-icon/cat-icon-registry.js +55 -0
  134. package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -0
  135. package/dist/collection/components/cat-icon/cat-icon.css +50 -0
  136. package/dist/collection/components/cat-icon/cat-icon.js +91 -0
  137. package/dist/collection/components/cat-icon/cat-icon.js.map +1 -0
  138. package/dist/collection/components/cat-input/cat-input.css +131 -0
  139. package/dist/collection/components/cat-input/cat-input.js +606 -0
  140. package/dist/collection/components/cat-input/cat-input.js.map +1 -0
  141. package/dist/collection/components/cat-menu/cat-menu.css +34 -0
  142. package/dist/collection/components/cat-menu/cat-menu.js +184 -0
  143. package/dist/collection/components/cat-menu/cat-menu.js.map +1 -0
  144. package/dist/collection/components/cat-radio/cat-radio.css +84 -0
  145. package/dist/collection/components/cat-radio/cat-radio.js +283 -0
  146. package/dist/collection/components/cat-radio/cat-radio.js.map +1 -0
  147. package/dist/collection/components/cat-scrollable/cat-scrollable.css +69 -0
  148. package/dist/collection/components/cat-scrollable/cat-scrollable.js +311 -0
  149. package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +1 -0
  150. package/dist/collection/components/cat-skeleton/cat-skeleton.css +177 -0
  151. package/dist/collection/components/cat-skeleton/cat-skeleton.js +131 -0
  152. package/dist/collection/components/cat-skeleton/cat-skeleton.js.map +1 -0
  153. package/dist/collection/components/cat-spinner/cat-spinner.css +63 -0
  154. package/dist/collection/components/cat-spinner/cat-spinner.js +65 -0
  155. package/dist/collection/components/cat-spinner/cat-spinner.js.map +1 -0
  156. package/dist/collection/components/cat-textarea/cat-textarea.css +72 -0
  157. package/dist/collection/components/cat-textarea/cat-textarea.js +393 -0
  158. package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -0
  159. package/dist/collection/components/cat-toggle/cat-toggle.css +93 -0
  160. package/dist/collection/components/cat-toggle/cat-toggle.js +283 -0
  161. package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -0
  162. package/dist/collection/components/cat-tooltip/cat-tooltip.css +41 -0
  163. package/dist/collection/components/cat-tooltip/cat-tooltip.js +254 -0
  164. package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -0
  165. package/dist/collection/index.cdn.js +21 -0
  166. package/dist/collection/index.js +3 -0
  167. package/dist/collection/index.js.map +1 -0
  168. package/dist/collection/init.js +17 -0
  169. package/dist/collection/init.js.map +1 -0
  170. package/dist/collection/utils/breakpoints.js +12 -0
  171. package/dist/collection/utils/breakpoints.js.map +1 -0
  172. package/dist/collection/utils/first-tabbable.js +6 -0
  173. package/dist/collection/utils/first-tabbable.js.map +1 -0
  174. package/dist/collection/utils/is-touch-screen.js +3 -0
  175. package/dist/collection/utils/is-touch-screen.js.map +1 -0
  176. package/dist/collection/utils/media-matcher.js +55 -0
  177. package/dist/collection/utils/media-matcher.js.map +1 -0
  178. package/dist/collection/utils/platform.js +50 -0
  179. package/dist/collection/utils/platform.js.map +1 -0
  180. package/dist/components/cat-alert.d.ts +11 -0
  181. package/dist/components/cat-alert.js +53 -0
  182. package/dist/components/cat-alert.js.map +1 -0
  183. package/dist/components/cat-badge.d.ts +11 -0
  184. package/dist/components/cat-badge.js +68 -0
  185. package/dist/components/cat-badge.js.map +1 -0
  186. package/dist/components/cat-button.d.ts +11 -0
  187. package/dist/components/cat-button.js +8 -0
  188. package/dist/components/cat-button.js.map +1 -0
  189. package/dist/components/cat-button2.js +346 -0
  190. package/dist/components/cat-button2.js.map +1 -0
  191. package/dist/components/cat-card.d.ts +11 -0
  192. package/dist/components/cat-card.js +35 -0
  193. package/dist/components/cat-card.js.map +1 -0
  194. package/dist/components/cat-checkbox.d.ts +11 -0
  195. package/dist/components/cat-checkbox.js +103 -0
  196. package/dist/components/cat-checkbox.js.map +1 -0
  197. package/dist/components/cat-i18n-registry.js +74 -0
  198. package/dist/components/cat-i18n-registry.js.map +1 -0
  199. package/dist/components/cat-icon-registry.js +59 -0
  200. package/dist/components/cat-icon-registry.js.map +1 -0
  201. package/dist/components/cat-icon.d.ts +11 -0
  202. package/dist/components/cat-icon.js +8 -0
  203. package/dist/components/cat-icon.js.map +1 -0
  204. package/dist/components/cat-icon2.js +49 -0
  205. package/dist/components/cat-icon2.js.map +1 -0
  206. package/dist/components/cat-input.d.ts +11 -0
  207. package/dist/components/cat-input.js +172 -0
  208. package/dist/components/cat-input.js.map +1 -0
  209. package/dist/components/cat-menu.d.ts +11 -0
  210. package/dist/components/cat-menu.js +870 -0
  211. package/dist/components/cat-menu.js.map +1 -0
  212. package/dist/components/cat-radio.d.ts +11 -0
  213. package/dist/components/cat-radio.js +93 -0
  214. package/dist/components/cat-radio.js.map +1 -0
  215. package/dist/components/cat-scrollable.d.ts +11 -0
  216. package/dist/components/cat-scrollable.js +1362 -0
  217. package/dist/components/cat-scrollable.js.map +1 -0
  218. package/dist/components/cat-skeleton.d.ts +11 -0
  219. package/dist/components/cat-skeleton.js +78 -0
  220. package/dist/components/cat-skeleton.js.map +1 -0
  221. package/dist/components/cat-spinner.d.ts +11 -0
  222. package/dist/components/cat-spinner.js +8 -0
  223. package/dist/components/cat-spinner.js.map +1 -0
  224. package/dist/components/cat-spinner2.js +41 -0
  225. package/dist/components/cat-spinner2.js.map +1 -0
  226. package/dist/components/cat-textarea.d.ts +11 -0
  227. package/dist/components/cat-textarea.js +119 -0
  228. package/dist/components/cat-textarea.js.map +1 -0
  229. package/dist/components/cat-toggle.d.ts +11 -0
  230. package/dist/components/cat-toggle.js +93 -0
  231. package/dist/components/cat-toggle.js.map +1 -0
  232. package/dist/components/cat-tooltip.d.ts +11 -0
  233. package/dist/components/cat-tooltip.js +154 -0
  234. package/dist/components/cat-tooltip.js.map +1 -0
  235. package/dist/components/first-tabbable.js +1495 -0
  236. package/dist/components/first-tabbable.js.map +1 -0
  237. package/dist/components/index.d.ts +26 -0
  238. package/dist/components/index.js +258 -0
  239. package/dist/components/index.js.map +1 -0
  240. package/dist/components/loglevel.js +315 -0
  241. package/dist/components/loglevel.js.map +1 -0
  242. package/dist/esm/app-globals-77cd8c8e.js +254 -0
  243. package/dist/esm/app-globals-77cd8c8e.js.map +1 -0
  244. package/dist/esm/cat-alert_15.entry.js +4633 -0
  245. package/dist/esm/cat-alert_15.entry.js.map +1 -0
  246. package/dist/esm/cat-icon-registry-a7acd6f7.js +438 -0
  247. package/dist/esm/cat-icon-registry-a7acd6f7.js.map +1 -0
  248. package/dist/esm/catalyst.js +22 -0
  249. package/dist/esm/catalyst.js.map +1 -0
  250. package/dist/esm/index-fd12be19.js +1320 -0
  251. package/dist/esm/index-fd12be19.js.map +1 -0
  252. package/dist/esm/index.js +3 -0
  253. package/dist/esm/index.js.map +1 -0
  254. package/dist/esm/loader.js +22 -0
  255. package/dist/esm/loader.js.map +1 -0
  256. package/dist/esm/polyfills/core-js.js +11 -0
  257. package/dist/esm/polyfills/css-shim.js +1 -0
  258. package/dist/esm/polyfills/dom.js +79 -0
  259. package/dist/esm/polyfills/es5-html-element.js +1 -0
  260. package/dist/esm/polyfills/index.js +34 -0
  261. package/dist/esm/polyfills/system.js +6 -0
  262. package/dist/index.cjs.js +1 -0
  263. package/dist/index.js +1 -0
  264. package/dist/types/components/cat-alert/cat-alert.d.ts +14 -0
  265. package/dist/types/components/cat-badge/cat-badge.d.ts +29 -0
  266. package/dist/types/components/cat-button/cat-button.d.ts +134 -0
  267. package/dist/types/components/cat-card/cat-card.d.ts +7 -0
  268. package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +69 -0
  269. package/dist/types/components/cat-i18n/cat-i18n-registry.d.ts +18 -0
  270. package/dist/types/components/cat-icon/cat-icon-registry.d.ts +15 -0
  271. package/dist/types/components/cat-icon/cat-icon.d.ts +23 -0
  272. package/dist/types/components/cat-input/cat-input.d.ts +130 -0
  273. package/dist/types/components/cat-menu/cat-menu.d.ts +31 -0
  274. package/dist/types/components/cat-radio/cat-radio.d.ts +63 -0
  275. package/dist/types/components/cat-scrollable/cat-scrollable.d.ts +52 -0
  276. package/dist/types/components/cat-skeleton/cat-skeleton.d.ts +28 -0
  277. package/dist/types/components/cat-spinner/cat-spinner.d.ts +15 -0
  278. package/dist/types/components/cat-textarea/cat-textarea.d.ts +85 -0
  279. package/dist/types/components/cat-toggle/cat-toggle.d.ts +64 -0
  280. package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +46 -0
  281. package/dist/types/components.d.ts +1167 -0
  282. package/dist/types/index.d.ts +3 -0
  283. package/dist/types/init.d.ts +1 -0
  284. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  285. package/dist/types/utils/breakpoints.d.ts +7 -0
  286. package/dist/types/utils/first-tabbable.d.ts +4 -0
  287. package/dist/types/utils/is-touch-screen.d.ts +2 -0
  288. package/dist/types/utils/media-matcher.d.ts +13 -0
  289. package/dist/types/utils/platform.d.ts +18 -0
  290. package/loader/cdn.js +3 -0
  291. package/loader/index.cjs.js +3 -0
  292. package/loader/index.d.ts +12 -0
  293. package/loader/index.es2017.js +3 -0
  294. package/loader/index.js +4 -0
  295. package/loader/package.json +10 -0
  296. package/package.json +2 -2
@@ -0,0 +1,4651 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-5d72f0e4.js');
6
+ const catIconRegistry = require('./cat-icon-registry-b3a95a6b.js');
7
+
8
+ const catAlertCss = ":host{display:block;margin-bottom:1rem}:host(:focus-visible){outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}:host([hidden]){display:none}.alert{font:inherit;color:rgb(var(--text));background-color:rgba(var(--bg), 0.1);box-shadow:inset 0 0 0 1px rgba(var(--border), 0.2);border-radius:0.25rem;padding:0.75rem 1rem}::slotted(:last-child){margin-bottom:0 !important}.alert-primary{--bg:var(--cat-primary-bg, 32, 127, 138);--text:var(--cat-primary-text, 32, 127, 138);--border:var(--cat-primary-text, 32, 127, 138)}.alert-secondary{--bg:105, 118, 135;--text:0, 0, 0;--border:105, 118, 135}.alert-success{--bg:0, 132, 88;--text:0, 132, 88;--border:0, 132, 88}.alert-warning{--bg:255, 206, 128;--text:159, 97, 0;--border:159, 97, 0}.alert-danger{--bg:217, 52, 13;--text:217, 52, 13;--border:217, 52, 13}";
9
+
10
+ const CatAlert = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ /**
14
+ * The color palette of the alert.
15
+ */
16
+ this.color = 'primary';
17
+ }
18
+ render() {
19
+ return (index.h(index.Host, { tabindex: "0", role: this.role }, index.h("div", { part: "alert", class: {
20
+ alert: true,
21
+ [`alert-${this.color}`]: Boolean(this.color)
22
+ } }, index.h("slot", null))));
23
+ }
24
+ get role() {
25
+ switch (this.color) {
26
+ case 'danger':
27
+ case 'warning':
28
+ return 'alert';
29
+ default:
30
+ return 'status';
31
+ }
32
+ }
33
+ };
34
+ CatAlert.style = catAlertCss;
35
+
36
+ const catBadgeCss = ":host{display:inline-flex;max-width:100%;vertical-align:baseline}:host([hidden]){display:none}.badge{font:inherit;flex:1 1 auto;display:inline-flex;align-items:center;justify-content:center;border-radius:0.125rem;text-decoration:none;width:100%;box-sizing:border-box;line-height:1;white-space:nowrap}.badge slot{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.badge-round{border-radius:10rem}.badge-filled{background-color:rgb(var(--bg));color:rgb(var(--fill));font-weight:600;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:greyscale}.badge-outlined{background-color:white;box-shadow:inset 0 0 0 1px rgba(var(--border), 0.2);color:rgb(var(--text))}.badge-primary{--bg:var(--cat-primary-bg, 32, 127, 138);--fill:var(--cat-primary-fill, 255, 255, 255);--text:var(--cat-primary-text, 32, 127, 138);--border:var(--cat-primary-text, 32, 127, 138)}.badge-secondary{--bg:105, 118, 135;--fill:255, 255, 255;--text:0, 0, 0;--border:105, 118, 135}.badge-success{--bg:0, 132, 88;--fill:255, 255, 255;--text:0, 132, 88;--border:0, 132, 88}.badge-warning{--bg:255, 206, 128;--fill:0, 0, 0;--text:159, 97, 0;--border:159, 97, 0}.badge-danger{--bg:217, 52, 13;--fill:255, 255, 255;--text:217, 52, 13;--border:217, 52, 13}.badge-xs{height:0.75rem;min-width:0.75rem;font-size:0.75rem;padding:0 0.1875rem}.badge-s{height:1rem;min-width:1rem;font-size:0.75rem;padding:0 0.25rem}.badge-m{height:1.25rem;min-width:1.25rem;font-size:0.75rem;padding:0 0.3125rem}.badge-l{height:1.5rem;min-width:1.5rem;font-size:0.875rem;padding:0 0.375rem}.badge-xl{height:1.75rem;min-width:1.75rem;font-size:0.9375rem;padding:0 0.4375rem}.badge-pulse.badge-filled{animation:1.5s ease 0s infinite normal none running pulse}.badge-pulse.badge-outlined{animation:1.5s ease 0s infinite normal none running pulse-outlined}@keyframes pulse{0%{box-shadow:0 0 0 0 rgb(var(--bg))}70%{box-shadow:transparent 0 0 0 0.5rem}100%{box-shadow:transparent 0 0 0 0}}@keyframes pulse-outlined{0%{box-shadow:0 0 0 0 rgb(var(--bg)), inset 0 0 0 1px rgba(var(--border), 0.2)}70%{box-shadow:transparent 0 0 0 0.5rem, inset 0 0 0 1px rgba(var(--border), 0.2)}100%{box-shadow:transparent 0 0 0 0, inset 0 0 0 1px rgba(var(--border), 0.2)}}";
37
+
38
+ const CatBadge = class {
39
+ constructor(hostRef) {
40
+ index.registerInstance(this, hostRef);
41
+ /**
42
+ * The rendering style of the badge.
43
+ */
44
+ this.variant = 'filled';
45
+ /**
46
+ * The color palette of the badge.
47
+ */
48
+ this.color = 'primary';
49
+ /**
50
+ * The size of the badge.
51
+ */
52
+ this.size = 'm';
53
+ /**
54
+ * Use round badge edges.
55
+ */
56
+ this.round = false;
57
+ /**
58
+ * Draw attention to the badge with a subtle animation.
59
+ */
60
+ this.pulse = false;
61
+ }
62
+ render() {
63
+ return (index.h("span", { part: "badge", class: {
64
+ badge: true,
65
+ 'badge-round': this.round,
66
+ 'badge-pulse': this.pulse,
67
+ [`badge-${this.variant}`]: Boolean(this.variant),
68
+ [`badge-${this.color}`]: Boolean(this.color),
69
+ [`badge-${this.size}`]: Boolean(this.size)
70
+ } }, index.h("slot", null)));
71
+ }
72
+ };
73
+ CatBadge.style = catBadgeCss;
74
+
75
+ const _breakpoints = ['xs', 's', 'm', 'l', 'xl'];
76
+ const Breakpoints = {
77
+ xs: '(max-width: 539.98px)',
78
+ s: '(max-width: 767.98px)',
79
+ m: '(max-width: 991.98px)',
80
+ l: '(max-width: 1199.98px)',
81
+ xl: '(max-width: 1399.98px)'
82
+ };
83
+ function isBreakpoint(value) {
84
+ return typeof value === 'string' && _breakpoints.includes(value);
85
+ }
86
+
87
+ // https://github.com/angular/components/blob/master/src/cdk/platform/platform.ts
88
+ // Whether the current platform supports the V8 Break Iterator. The V8 check
89
+ // is necessary to detect all Blink based browsers.
90
+ let hasV8BreakIterator;
91
+ // We need a try/catch around the reference to `Intl`, because accessing it in some cases can
92
+ // cause IE to throw. These cases are tied to particular versions of Windows and can happen if
93
+ // the consumer is providing a polyfilled `Map`. See:
94
+ // https://github.com/Microsoft/ChakraCore/issues/3189
95
+ // https://github.com/angular/components/issues/15687
96
+ try {
97
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
98
+ hasV8BreakIterator = typeof Intl !== 'undefined' && Intl.v8BreakIterator;
99
+ }
100
+ catch (_a) {
101
+ hasV8BreakIterator = false;
102
+ }
103
+ class Platform {
104
+ constructor() {
105
+ /** Whether the current browser is Microsoft Edge. */
106
+ this.EDGE = /(edge)/i.test(navigator.userAgent);
107
+ /** Whether the current rendering engine is Microsoft Trident. */
108
+ this.TRIDENT = /(msie|trident)/i.test(navigator.userAgent);
109
+ // EdgeHTML and Trident mock Blink specific things and need to be excluded from this check.
110
+ /** Whether the current rendering engine is Blink. */
111
+ this.BLINK =
112
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
113
+ !!(window.chrome || hasV8BreakIterator) && typeof CSS !== 'undefined' && !this.EDGE && !this.TRIDENT;
114
+ // Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to
115
+ // ensure that Webkit runs standalone and is not used as another engine's base.
116
+ /** Whether the current rendering engine is WebKit. */
117
+ this.WEBKIT = /AppleWebKit/i.test(navigator.userAgent) && !this.BLINK && !this.EDGE && !this.TRIDENT;
118
+ /** Whether the current platform is Apple iOS. */
119
+ this.IOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !('MSStream' in window);
120
+ // It's difficult to detect the plain Gecko engine, because most of the browsers identify
121
+ // them self as Gecko-like browsers and modify the userAgent's according to that.
122
+ // Since we only cover one explicit Firefox case, we can simply check for Firefox
123
+ // instead of having an unstable check for Gecko.
124
+ /** Whether the current browser is Firefox. */
125
+ this.FIREFOX = /(firefox|minefield)/i.test(navigator.userAgent);
126
+ /** Whether the current platform is Android. */
127
+ // Trident on mobile adds the android platform to the userAgent to trick detections.
128
+ this.ANDROID = /android/i.test(navigator.userAgent) && !this.TRIDENT;
129
+ // Safari browsers will include the Safari keyword in their userAgent. Some browsers may fake
130
+ // this and just place the Safari keyword in the userAgent. To be more safe about Safari every
131
+ // Safari browser should also use Webkit as its layout engine.
132
+ /** Whether the current browser is Safari. */
133
+ this.SAFARI = /safari/i.test(navigator.userAgent) && this.WEBKIT;
134
+ }
135
+ }
136
+
137
+ // https://github.com/angular/components/blob/master/src/cdk/layout/media-matcher.ts
138
+ /** Global registry for all dynamically-created, injected media queries. */
139
+ const mediaQueriesForWebkitCompatibility = new Set();
140
+ /** Style tag that holds all of the dynamically-created media queries. */
141
+ let mediaQueryStyleNode;
142
+ /** A utility for calling matchMedia queries. */
143
+ class MediaMatcher {
144
+ constructor() {
145
+ this._platform = new Platform();
146
+ this._matchMedia = window.matchMedia.bind(window);
147
+ }
148
+ /**
149
+ * Evaluates the given media query and returns the native MediaQueryList from which results
150
+ * can be retrieved.
151
+ * Confirms the layout engine will trigger for the selector query provided and returns the
152
+ * MediaQueryList for the query provided.
153
+ */
154
+ matchMedia(query) {
155
+ if (this._platform.WEBKIT || this._platform.BLINK) {
156
+ createEmptyStyleRule(query);
157
+ }
158
+ return this._matchMedia(query);
159
+ }
160
+ }
161
+ /**
162
+ * Creates an empty stylesheet that is used to work around browser inconsistencies related to
163
+ * `matchMedia`. At the time of writing, it handles the following cases:
164
+ * 1. On WebKit browsers, a media query has to have at least one rule in order for `matchMedia`
165
+ * to fire. We work around it by declaring a dummy stylesheet with a `@media` declaration.
166
+ * 2. In some cases Blink browsers will stop firing the `matchMedia` listener if none of the rules
167
+ * inside the `@media` match existing elements on the page. We work around it by having one rule
168
+ * targeting the `body`. See https://github.com/angular/components/issues/23546.
169
+ */
170
+ function createEmptyStyleRule(query) {
171
+ if (mediaQueriesForWebkitCompatibility.has(query)) {
172
+ return;
173
+ }
174
+ try {
175
+ if (!mediaQueryStyleNode) {
176
+ mediaQueryStyleNode = document.createElement('style');
177
+ mediaQueryStyleNode.setAttribute('type', 'text/css');
178
+ document.head.appendChild(mediaQueryStyleNode);
179
+ }
180
+ if (mediaQueryStyleNode.sheet) {
181
+ mediaQueryStyleNode.sheet.insertRule(`@media ${query} {body{ }}`, 0);
182
+ mediaQueriesForWebkitCompatibility.add(query);
183
+ }
184
+ }
185
+ catch (e) {
186
+ catIconRegistry.loglevel.error(e);
187
+ }
188
+ }
189
+
190
+ const catButtonCss = ":host{display:inline-block;max-width:100%;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}.cat-button{position:relative;font:inherit;display:flex;align-items:center;justify-content:center;border:none;border-radius:0.25rem;text-decoration:none;width:100%;box-sizing:border-box;cursor:pointer;transition:color 0.13s linear, border-color 0.13s linear, background-color 0.13s linear, box-shadow 0.13s linear}.cat-button:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.cat-button-ellipsed .cat-button-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.cat-button-disabled{cursor:not-allowed;opacity:0.65;filter:grayscale(100%)}.cat-button-round{border-radius:10rem}.cat-button-loading{cursor:default}.cat-button-loading cat-spinner{position:absolute}.cat-button-loading>*:not(cat-spinner){visibility:hidden}.cat-button-filled{background-color:rgb(var(--bg));color:rgb(var(--fill));font-weight:600;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:greyscale}.cat-button-outlined{background-color:white;box-shadow:inset 0 0 0 1px rgba(var(--base), 0.2);color:rgb(var(--text))}.cat-button-outlined:hover:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.05)}.cat-button-outlined:active:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-text{background-color:transparent;color:rgb(var(--text));text-decoration:none}.cat-button-text:hover:not(.cat-button-disabled):not(.cat-button-loading){text-decoration:underline}.cat-button-primary{--bg:var(--cat-primary-bg, 32, 127, 138);--fill:var(--cat-primary-fill, 255, 255, 255);--text:var(--cat-primary-text, 32, 127, 138);--base:var(--cat-primary-text, 32, 127, 138)}.cat-button-primary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-hover, 28, 112, 122);--fill:var(--cat-primary-fill-hover, 255, 255, 255);--text:var(--cat-primary-text-hover, 28, 112, 122)}.cat-button-primary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-active, 25, 101, 110);--fill:var(--cat-primary-fill-active, 255, 255, 255);--text:var(--cat-primary-text-active, 25, 101, 110)}.cat-button-secondary{--bg:105, 118, 135;--fill:255, 255, 255;--text:0, 0, 0;--base:105, 118, 135}.cat-button-secondary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:105, 118, 135;--fill:255, 255, 255;--text:0, 0, 0}.cat-button-secondary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:105, 118, 135;--fill:255, 255, 255;--text:0, 0, 0}.cat-button-success{--bg:0, 132, 88;--fill:255, 255, 255;--text:0, 132, 88;--base:0, 132, 88}.cat-button-success:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:0, 117, 78;--fill:255, 255, 255;--text:0, 117, 78}.cat-button-success:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:0, 105, 70;--fill:255, 255, 255;--text:0, 105, 70}.cat-button-warning{--bg:255, 206, 128;--fill:0, 0, 0;--text:159, 97, 0;--base:159, 97, 0}.cat-button-warning:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:255, 214, 148;--fill:0, 0, 0;--text:159, 97, 0}.cat-button-warning:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:255, 222, 168;--fill:0, 0, 0;--text:159, 97, 0}.cat-button-danger{--bg:217, 52, 13;--fill:255, 255, 255;--text:217, 52, 13;--base:217, 52, 13}.cat-button-danger:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:194, 46, 11;--fill:255, 255, 255;--text:194, 46, 11}.cat-button-danger:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:174, 42, 10;--fill:255, 255, 255;--text:174, 42, 10}.cat-button-xs{min-width:1.5rem;padding:0.25rem 0.25rem;font-size:0.875rem;line-height:1rem}.cat-button-xs .cat-button-prefix{margin-right:0.25rem}.cat-button-xs .cat-button-suffix{margin-left:0.25rem}.cat-button-xs.cat-button-icon{width:1.5rem;padding-left:0;padding-right:0}:host-context(nav) .cat-button-xs{padding-left:1rem;padding-right:1rem}.cat-button-s{min-width:2rem;padding:0.375rem 0.5rem;font-size:0.9375rem;line-height:1.25rem}.cat-button-s .cat-button-prefix{margin-right:0.25rem}.cat-button-s .cat-button-suffix{margin-left:0.25rem}.cat-button-s cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-s.cat-button-icon{width:2rem;padding-left:0;padding-right:0}:host-context(nav) .cat-button-s{padding-left:1rem;padding-right:1rem}.cat-button-m{min-width:2.5rem;padding:0.625rem 0.75rem;font-size:0.9375rem;line-height:1.25rem}.cat-button-m .cat-button-prefix{margin-right:0.25rem}.cat-button-m .cat-button-suffix{margin-left:0.25rem}.cat-button-m cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-m.cat-button-icon{width:2.5rem;padding-left:0;padding-right:0}:host-context(nav) .cat-button-m{padding-left:1rem;padding-right:1rem}.cat-button-l{min-width:3rem;padding:0.875rem 1rem;font-size:0.9375rem;line-height:1.25rem}.cat-button-l .cat-button-prefix{margin-right:0.25rem}.cat-button-l .cat-button-suffix{margin-left:0.25rem}.cat-button-l cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-l.cat-button-icon{width:3rem;padding-left:0;padding-right:0}:host-context(nav) .cat-button-l{padding-left:1rem;padding-right:1rem}.cat-button-xl{min-width:3.5rem;padding:1rem 1.25rem;font-size:1.125rem;line-height:1.5rem}.cat-button-xl .cat-button-prefix{margin-right:0.25rem}.cat-button-xl .cat-button-suffix{margin-left:0.25rem}.cat-button-xl.cat-button-icon{width:3.5rem;padding-left:0;padding-right:0}:host-context(nav) .cat-button-xl{padding-left:1rem;padding-right:1rem}.cat-button-active::before{content:\"\";display:block;position:absolute;top:0;left:0;width:0.25rem;height:100%;background:rgb(var(--base))}:host-context(nav){width:100%}:host-context(nav) .cat-button{box-shadow:none;border-radius:0;justify-content:left}:host-context(nav) .cat-button:focus-visible{outline-offset:-2px}:host(.cat-text-left) .cat-button{justify-content:left}:host(.cat-text-right) .cat-button{justify-content:right}";
191
+
192
+ const CatButton = class {
193
+ constructor(hostRef) {
194
+ index.registerInstance(this, hostRef);
195
+ this.catClick = index.createEvent(this, "catClick", 7);
196
+ this.catFocus = index.createEvent(this, "catFocus", 7);
197
+ this.catBlur = index.createEvent(this, "catBlur", 7);
198
+ this._iconOnly = true;
199
+ /**
200
+ * The rendering style of the button.
201
+ */
202
+ this.variant = 'outlined';
203
+ /**
204
+ * The color palette of the button.
205
+ */
206
+ this.color = 'secondary';
207
+ /**
208
+ * Show an active status indicator on the left side of the button.
209
+ */
210
+ this.active = false;
211
+ /**
212
+ * The size of the button.
213
+ */
214
+ this.size = 'm';
215
+ /**
216
+ * Specifies that the button should be disabled. A disabled button is unusable
217
+ * and un-clickable. Corresponds with the native HTML disabled attribute.
218
+ */
219
+ this.disabled = false;
220
+ /**
221
+ * Displays the button in a loading state with a spinner. Just like a disabled
222
+ * button, an inactive button is unusable and un-clickable. However, it
223
+ * retains the current focus state.
224
+ */
225
+ this.loading = false;
226
+ /**
227
+ * Allows the button to submit a form.
228
+ */
229
+ this.submit = false;
230
+ /**
231
+ * Ellipse overflowing button content.
232
+ */
233
+ this.ellipsed = true;
234
+ /**
235
+ * Use round button edges.
236
+ */
237
+ this.round = false;
238
+ /**
239
+ * Hide the actual button content and only display the icon.
240
+ */
241
+ this.iconOnly = false;
242
+ /**
243
+ * Display the icon on the right.
244
+ */
245
+ this.iconRight = false;
246
+ }
247
+ onIconOnlyChanged(value) {
248
+ var _a, _b;
249
+ // teardown
250
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
251
+ (_a = this.mediaQueryList) === null || _a === void 0 ? void 0 : _a.removeEventListener('change', this.mediaQueryListener);
252
+ this.mediaQueryList = undefined;
253
+ this.mediaQueryListener = undefined;
254
+ // setup
255
+ if (isBreakpoint(value)) {
256
+ (_b = this.mediaMatcher) !== null && _b !== void 0 ? _b : (this.mediaMatcher = new MediaMatcher());
257
+ this.mediaQueryList = this.mediaMatcher.matchMedia(Breakpoints[value]);
258
+ this.mediaQueryListener = (event) => (this._iconOnly = event.matches);
259
+ this.mediaQueryList.addEventListener('change', this.mediaQueryListener);
260
+ this._iconOnly = this.mediaQueryList.matches;
261
+ }
262
+ else {
263
+ this._iconOnly = value;
264
+ }
265
+ }
266
+ componentWillLoad() {
267
+ this.onIconOnlyChanged(this.iconOnly);
268
+ }
269
+ componentWillRender() {
270
+ if (this.isIconButton && !this.a11yLabel) {
271
+ catIconRegistry.loglevel.warn('[A11y] Missing ARIA label on icon button', this);
272
+ }
273
+ }
274
+ haltDisabledEvents(event) {
275
+ if (this.disabled || this.loading) {
276
+ event.preventDefault();
277
+ event.stopImmediatePropagation();
278
+ }
279
+ }
280
+ /**
281
+ * Sets focus on the button. Use this method instead of `button.focus()`.
282
+ *
283
+ * @param options An optional object providing options to control aspects of
284
+ * the focusing process.
285
+ */
286
+ async setFocus(options) {
287
+ this.button.focus(options);
288
+ }
289
+ render() {
290
+ var _a;
291
+ if (this.url) {
292
+ return (index.h("a", { ref: el => (this.button = el), href: this.disabled ? undefined : this.url, target: this.urlTarget, "aria-disabled": this.disabled ? 'true' : null, "aria-label": this.a11yLabel, id: this.buttonId, part: "button", class: {
293
+ 'cat-button': true,
294
+ 'cat-button-icon': this.isIconButton,
295
+ 'cat-button-round': this.round,
296
+ 'cat-button-loading': this.loading,
297
+ 'cat-button-disabled': this.disabled,
298
+ 'cat-button-ellipsed': this.ellipsed && !this.isIconButton,
299
+ [`cat-button-${this.variant}`]: Boolean(this.variant),
300
+ [`cat-button-${this.color}`]: Boolean(this.color),
301
+ [`cat-button-${this.size}`]: Boolean(this.size)
302
+ }, onClick: this.onClick.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }, this.content));
303
+ }
304
+ else {
305
+ return (index.h("button", { ref: el => (this.button = el), type: this.submit ? 'submit' : 'button', name: this.name, value: this.value, disabled: this.disabled, "aria-disabled": this.disabled ? 'true' : null, "aria-label": this.a11yLabel, id: this.buttonId, part: "button", class: {
306
+ 'cat-button': true,
307
+ 'cat-button-active': this.active,
308
+ 'cat-button-icon': this.isIconButton,
309
+ 'cat-button-round': (_a = this.round) !== null && _a !== void 0 ? _a : this.isIconButton,
310
+ 'cat-button-loading': this.loading,
311
+ 'cat-button-disabled': this.disabled,
312
+ 'cat-button-ellipsed': this.ellipsed && !this.isIconButton,
313
+ [`cat-button-${this.variant}`]: Boolean(this.variant),
314
+ [`cat-button-${this.color}`]: Boolean(this.color),
315
+ [`cat-button-${this.size}`]: Boolean(this.size)
316
+ }, onClick: this.onClick.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }, this.content));
317
+ }
318
+ }
319
+ get iconSize() {
320
+ switch (this.size) {
321
+ case 'xs':
322
+ return 's';
323
+ default:
324
+ return 'l';
325
+ }
326
+ }
327
+ get spinnerSize() {
328
+ switch (this.size) {
329
+ case 'xs':
330
+ return 'xs';
331
+ default:
332
+ return 'm';
333
+ }
334
+ }
335
+ get isIconButton() {
336
+ return Boolean(this.icon) && this._iconOnly;
337
+ }
338
+ get hasPrefixIcon() {
339
+ return Boolean(this.icon) && !this._iconOnly && !this.iconRight;
340
+ }
341
+ get hasSuffixIcon() {
342
+ return Boolean(this.icon) && !this._iconOnly && this.iconRight;
343
+ }
344
+ get content() {
345
+ return [
346
+ this.hasPrefixIcon ? (index.h("cat-icon", { icon: this.icon, size: this.iconSize, class: "cat-button-prefix", part: "prefix" })) : null,
347
+ this.isIconButton ? (index.h("cat-icon", { icon: this.icon, size: this.iconSize })) : (index.h("span", { class: "cat-button-content", part: "content" }, index.h("slot", null))),
348
+ this.hasSuffixIcon ? (index.h("cat-icon", { icon: this.icon, size: this.iconSize, class: "cat-button-suffix", part: "suffix" })) : null,
349
+ this.loading ? index.h("cat-spinner", { size: this.spinnerSize }) : null
350
+ ];
351
+ }
352
+ onClick(event) {
353
+ this.catClick.emit(event);
354
+ }
355
+ onFocus(event) {
356
+ this.catFocus.emit(event);
357
+ }
358
+ onBlur(event) {
359
+ this.catBlur.emit(event);
360
+ }
361
+ static get watchers() { return {
362
+ "iconOnly": ["onIconOnlyChanged"]
363
+ }; }
364
+ };
365
+ CatButton.style = catButtonCss;
366
+
367
+ const catCardCss = ":host{display:block;margin-bottom:1rem;border-radius:0.5rem;background-color:white;padding:1.5rem}:host([hidden]){display:none}::slotted(nav){margin:-1rem -1.5rem !important}::slotted(:last-child){margin-bottom:0}";
368
+
369
+ const CatCard = class {
370
+ constructor(hostRef) {
371
+ index.registerInstance(this, hostRef);
372
+ }
373
+ render() {
374
+ return (index.h(index.Host, null, index.h("slot", null)));
375
+ }
376
+ };
377
+ CatCard.style = catCardCss;
378
+
379
+ const catCheckboxCss = ":host{display:flex;margin-bottom:1rem}:host([hidden]){display:none}label{flex:0 1 auto;display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;-webkit-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}input{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.box{flex:0 0 auto;display:flex;position:relative;height:1.25rem;width:1.25rem;background-color:white;border:1px solid #d7dbe0;border-radius:0.125rem;transition:background-color 0.13s ease, border-color 0.13s ease}.box svg{fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:16px;stroke-dashoffset:16px;transition:all 0.13s ease;width:70%;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%) scale(0.99)}:checked+.box{background-color:rgb(var(--cat-primary-bg, 32, 127, 138));border-color:rgb(var(--cat-primary-bg, 32, 127, 138));stroke:rgb(var(--cat-primary-fill, 255, 255, 255))}:checked+.box .check{stroke-dashoffset:0}:indeterminate+.box{background-color:rgb(var(--cat-primary-bg, 32, 127, 138));border-color:rgb(var(--cat-primary-bg, 32, 127, 138));stroke:rgb(var(--cat-primary-fill, 255, 255, 255))}:indeterminate+.box .dash{stroke-dashoffset:0}:focus-visible+.box{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.label{flex:1 1 auto}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}";
380
+
381
+ let nextUniqueId$6 = 0;
382
+ const CatCheckbox = class {
383
+ constructor(hostRef) {
384
+ index.registerInstance(this, hostRef);
385
+ this.catChange = index.createEvent(this, "catChange", 7);
386
+ this.catFocus = index.createEvent(this, "catFocus", 7);
387
+ this.catBlur = index.createEvent(this, "catBlur", 7);
388
+ this.id = `cat-checkbox-${nextUniqueId$6++}`;
389
+ /**
390
+ * Checked state of the checkbox
391
+ */
392
+ this.checked = false;
393
+ /**
394
+ * Disabled state of the checkbox
395
+ */
396
+ this.disabled = false;
397
+ /**
398
+ * Indeterminate state of the checkbox
399
+ */
400
+ this.indeterminate = false;
401
+ /**
402
+ * Label of the checkbox which is presented in the UI
403
+ */
404
+ this.label = '';
405
+ /**
406
+ * Visually hide the label, but still show it to assistive technologies like screen readers.
407
+ */
408
+ this.labelHidden = false;
409
+ /**
410
+ * Required state of the checkbox
411
+ */
412
+ this.required = false;
413
+ }
414
+ componentDidLoad() {
415
+ if (this.input && this.indeterminate) {
416
+ this.input.indeterminate = true;
417
+ }
418
+ }
419
+ componentWillRender() {
420
+ if (!this.label) {
421
+ catIconRegistry.loglevel.error('[A11y] Missing ARIA label on checkbox', this);
422
+ }
423
+ }
424
+ /**
425
+ * Sets focus on the checkbox. Use this method instead of `checkbox.focus()`.
426
+ *
427
+ * @param options An optional object providing options to control aspects of
428
+ * the focusing process.
429
+ */
430
+ async setFocus(options) {
431
+ this.input.focus(options);
432
+ }
433
+ render() {
434
+ return (index.h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } }, index.h("input", { ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), index.h("span", { class: "box", "aria-hidden": "true", part: "checkbox" }, index.h("svg", { class: "check", viewBox: "0 0 12 10" }, index.h("polyline", { points: "1.5 6 4.5 9 10.5 1" })), index.h("svg", { class: "dash", viewBox: "0 0 12 10" }, index.h("polyline", { points: "1.5 5 10.5 5" }))), index.h("span", { class: "label", part: "label" }, this.label)));
435
+ }
436
+ onInput(event) {
437
+ this.catChange.emit(event);
438
+ }
439
+ onFocus(event) {
440
+ this.catFocus.emit(event);
441
+ }
442
+ onBlur(event) {
443
+ this.catBlur.emit(event);
444
+ }
445
+ };
446
+ CatCheckbox.style = catCheckboxCss;
447
+
448
+ const catIconCss = ":host{display:inline-flex;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}span{display:inline-flex}svg{fill:currentColor;stroke:none;transform-origin:center center;width:1em;height:1em}.icon-xs svg{font-size:0.75rem}.icon-s svg{font-size:1rem}.icon-m svg{font-size:1.25rem}.icon-l svg{font-size:1.5rem}.icon-xl svg{font-size:1.75rem}";
449
+
450
+ const CatIcon = class {
451
+ constructor(hostRef) {
452
+ index.registerInstance(this, hostRef);
453
+ this.iconRegistry = catIconRegistry.CatIconRegistry.getInstance();
454
+ /**
455
+ * The name of the icon.
456
+ */
457
+ this.icon = '';
458
+ /**
459
+ * The size of the icon.
460
+ */
461
+ this.size = 'm';
462
+ }
463
+ render() {
464
+ return (index.h("span", { innerHTML: this.iconRegistry.getIcon(this.icon), "aria-label": this.a11yLabel, "aria-hidden": this.a11yLabel ? null : 'true', part: "icon", class: {
465
+ icon: true,
466
+ [`icon-${this.size}`]: this.size !== 'inline'
467
+ } }));
468
+ }
469
+ };
470
+ CatIcon.style = catIconCss;
471
+
472
+ const catInputCss = ":host{display:flex;flex-direction:column;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;margin-bottom:1rem}:host([hidden]){display:none}.input-wrapper{display:flex;align-items:stretch;gap:0.75rem;padding:0 0.75rem;height:2.5rem;overflow:hidden;background:white;border-radius:0.25rem;box-shadow:0 0 0 1px #d7dbe0;transition:box-shadow 0.13s linear}.input-wrapper.input-round{border-radius:10rem}.input-wrapper.input-disabled{background:#f8f8fb;cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.input-wrapper:not(.input-disabled):hover{box-shadow:0 0 0 2px #d7dbe0}.input-wrapper:not(.input-disabled):focus-within{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255))}label{align-self:flex-start}label.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.input-optional{margin-left:0.25rem;font-size:0.75rem;line-height:1rem;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.text-prefix,.text-suffix{display:inline-flex;align-items:center;-webkit-user-select:none;-ms-user-select:none;user-select:none;}.text-prefix{border-right:1px solid #d7dbe0;padding-right:0.75rem}.text-suffix{border-left:1px solid #d7dbe0;padding-left:0.75rem}.icon-prefix,.icon-suffix{align-self:center}.input-inner-wrapper{display:flex;position:relative;flex:1 1 auto}input{font:inherit;margin:0;padding:0;width:100%;min-width:0;border:none;outline:none;background:none}.input-disabled input{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}input.has-clearable{padding-right:1.5rem}input::placeholder{color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.clearable{position:absolute;top:calc(50% - 1rem);right:-0.5rem}.input-hint{font-size:0.875rem;line-height:1rem;margin:0}";
473
+
474
+ let nextUniqueId$5 = 0;
475
+ const CatInput = class {
476
+ constructor(hostRef) {
477
+ index.registerInstance(this, hostRef);
478
+ this.catChange = index.createEvent(this, "catChange", 7);
479
+ this.catFocus = index.createEvent(this, "catFocus", 7);
480
+ this.catBlur = index.createEvent(this, "catBlur", 7);
481
+ this.i18n = catIconRegistry.CatI18nRegistry.getInstance();
482
+ this.id = `cat-input-${nextUniqueId$5++}`;
483
+ this.inputValue = '';
484
+ /**
485
+ * Whether the input should show a clear button.
486
+ */
487
+ this.clearable = false;
488
+ /**
489
+ * Whether the input is disabled.
490
+ */
491
+ this.disabled = false;
492
+ /**
493
+ * Display the icon on the right.
494
+ */
495
+ this.iconRight = false;
496
+ /**
497
+ * The label for the input.
498
+ */
499
+ this.label = '';
500
+ /**
501
+ * Visually hide the label, but still show it to assistive technologies like screen readers.
502
+ */
503
+ this.labelHidden = false;
504
+ /**
505
+ * The name of the form control. Submitted with the form as part of a name/value pair.
506
+ */
507
+ this.name = '';
508
+ /**
509
+ * The value is not editable.
510
+ */
511
+ this.readonly = false;
512
+ /**
513
+ * A value is required or must be check for the form to be submittable.
514
+ */
515
+ this.required = false;
516
+ /**
517
+ * Use round input edges.
518
+ */
519
+ this.round = false;
520
+ /**
521
+ * Type of form control.
522
+ */
523
+ this.type = 'text';
524
+ }
525
+ onValueChange(value) {
526
+ this.inputValue = '' + (value !== null && value !== void 0 ? value : '');
527
+ }
528
+ componentWillLoad() {
529
+ this.onValueChange(this.value);
530
+ }
531
+ componentWillRender() {
532
+ if (!this.label) {
533
+ catIconRegistry.loglevel.error('[A11y] Missing ARIA label on input', this);
534
+ }
535
+ }
536
+ /**
537
+ * Sets focus on the input. Use this method instead of `input.focus()`.
538
+ *
539
+ * @param options An optional object providing options to control aspects of
540
+ * the focusing process.
541
+ */
542
+ async setFocus(options) {
543
+ this.input.focus(options);
544
+ }
545
+ /**
546
+ * Clear the input.
547
+ */
548
+ async clear() {
549
+ this.inputValue = '';
550
+ }
551
+ render() {
552
+ return (index.h(index.Host, null, this.label && (index.h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, index.h("span", { part: "label" }, this.label, !this.required && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", this.i18n.getMessage('input.optional'), ")"))))), index.h("div", { class: {
553
+ 'input-wrapper': true,
554
+ 'input-round': this.round,
555
+ 'input-disabled': this.disabled
556
+ }, onClick: () => this.input.focus() }, this.textPrefix && (index.h("span", { class: "text-prefix", part: "prefix" }, this.textPrefix)), this.icon && !this.iconRight && index.h("cat-icon", { icon: this.icon, class: "icon-prefix", size: "l" }), index.h("div", { class: "input-inner-wrapper" }, index.h("input", { ref: el => (this.input = el), id: this.id, class: {
557
+ 'has-clearable': this.clearable && !this.disabled
558
+ }, autocomplete: this.autoComplete, disabled: this.disabled, max: this.max, maxlength: this.maxLength, min: this.max, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, type: this.type, value: this.inputValue, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), this.clearable && !this.disabled && this.inputValue && (index.h("cat-button", { class: "clearable", icon: "cross-circle-outlined", "icon-only": "true", size: "s", variant: "text", "a11y-label": this.i18n.getMessage('input.clear'), onClick: this.clear.bind(this) }))), this.icon && this.iconRight && index.h("cat-icon", { icon: this.icon, class: "icon-suffix", size: "l" }), this.textSuffix && (index.h("span", { class: "text-suffix", part: "suffix" }, this.textSuffix))), this.hint && index.h("p", { class: "input-hint" }, this.hint)));
559
+ }
560
+ onInput(event) {
561
+ this.inputValue = this.input.value;
562
+ this.catChange.emit(event);
563
+ }
564
+ onFocus(event) {
565
+ this.catFocus.emit(event);
566
+ }
567
+ onBlur(event) {
568
+ this.catBlur.emit(event);
569
+ }
570
+ static get watchers() { return {
571
+ "value": ["onValueChange"]
572
+ }; }
573
+ };
574
+ CatInput.style = catInputCss;
575
+
576
+ function getSide(placement) {
577
+ return placement.split('-')[0];
578
+ }
579
+
580
+ function getAlignment(placement) {
581
+ return placement.split('-')[1];
582
+ }
583
+
584
+ function getMainAxisFromPlacement(placement) {
585
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
586
+ }
587
+
588
+ function getLengthFromAxis(axis) {
589
+ return axis === 'y' ? 'height' : 'width';
590
+ }
591
+
592
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
593
+ let {
594
+ reference,
595
+ floating
596
+ } = _ref;
597
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
598
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
599
+ const mainAxis = getMainAxisFromPlacement(placement);
600
+ const length = getLengthFromAxis(mainAxis);
601
+ const commonAlign = reference[length] / 2 - floating[length] / 2;
602
+ const side = getSide(placement);
603
+ const isVertical = mainAxis === 'x';
604
+ let coords;
605
+
606
+ switch (side) {
607
+ case 'top':
608
+ coords = {
609
+ x: commonX,
610
+ y: reference.y - floating.height
611
+ };
612
+ break;
613
+
614
+ case 'bottom':
615
+ coords = {
616
+ x: commonX,
617
+ y: reference.y + reference.height
618
+ };
619
+ break;
620
+
621
+ case 'right':
622
+ coords = {
623
+ x: reference.x + reference.width,
624
+ y: commonY
625
+ };
626
+ break;
627
+
628
+ case 'left':
629
+ coords = {
630
+ x: reference.x - floating.width,
631
+ y: commonY
632
+ };
633
+ break;
634
+
635
+ default:
636
+ coords = {
637
+ x: reference.x,
638
+ y: reference.y
639
+ };
640
+ }
641
+
642
+ switch (getAlignment(placement)) {
643
+ case 'start':
644
+ coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
645
+ break;
646
+
647
+ case 'end':
648
+ coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
649
+ break;
650
+ }
651
+
652
+ return coords;
653
+ }
654
+
655
+ /**
656
+ * Computes the `x` and `y` coordinates that will place the floating element
657
+ * next to a reference element when it is given a certain positioning strategy.
658
+ *
659
+ * This export does not have any `platform` interface logic. You will need to
660
+ * write one for the platform you are using Floating UI with.
661
+ */
662
+
663
+ const computePosition$1 = async (reference, floating, config) => {
664
+ const {
665
+ placement = 'bottom',
666
+ strategy = 'absolute',
667
+ middleware = [],
668
+ platform
669
+ } = config;
670
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
671
+
672
+ let rects = await platform.getElementRects({
673
+ reference,
674
+ floating,
675
+ strategy
676
+ });
677
+ let {
678
+ x,
679
+ y
680
+ } = computeCoordsFromPlacement(rects, placement, rtl);
681
+ let statefulPlacement = placement;
682
+ let middlewareData = {};
683
+
684
+ for (let i = 0; i < middleware.length; i++) {
685
+
686
+ const {
687
+ name,
688
+ fn
689
+ } = middleware[i];
690
+ const {
691
+ x: nextX,
692
+ y: nextY,
693
+ data,
694
+ reset
695
+ } = await fn({
696
+ x,
697
+ y,
698
+ initialPlacement: placement,
699
+ placement: statefulPlacement,
700
+ strategy,
701
+ middlewareData,
702
+ rects,
703
+ platform,
704
+ elements: {
705
+ reference,
706
+ floating
707
+ }
708
+ });
709
+ x = nextX != null ? nextX : x;
710
+ y = nextY != null ? nextY : y;
711
+ middlewareData = { ...middlewareData,
712
+ [name]: { ...middlewareData[name],
713
+ ...data
714
+ }
715
+ };
716
+
717
+ if (reset) {
718
+ if (typeof reset === 'object') {
719
+ if (reset.placement) {
720
+ statefulPlacement = reset.placement;
721
+ }
722
+
723
+ if (reset.rects) {
724
+ rects = reset.rects === true ? await platform.getElementRects({
725
+ reference,
726
+ floating,
727
+ strategy
728
+ }) : reset.rects;
729
+ }
730
+
731
+ ({
732
+ x,
733
+ y
734
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
735
+ }
736
+
737
+ i = -1;
738
+ continue;
739
+ }
740
+ }
741
+
742
+ return {
743
+ x,
744
+ y,
745
+ placement: statefulPlacement,
746
+ strategy,
747
+ middlewareData
748
+ };
749
+ };
750
+
751
+ function expandPaddingObject(padding) {
752
+ return {
753
+ top: 0,
754
+ right: 0,
755
+ bottom: 0,
756
+ left: 0,
757
+ ...padding
758
+ };
759
+ }
760
+
761
+ function getSideObjectFromPadding(padding) {
762
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
763
+ top: padding,
764
+ right: padding,
765
+ bottom: padding,
766
+ left: padding
767
+ };
768
+ }
769
+
770
+ function rectToClientRect(rect) {
771
+ return { ...rect,
772
+ top: rect.y,
773
+ left: rect.x,
774
+ right: rect.x + rect.width,
775
+ bottom: rect.y + rect.height
776
+ };
777
+ }
778
+
779
+ /**
780
+ * Resolves with an object of overflow side offsets that determine how much the
781
+ * element is overflowing a given clipping boundary.
782
+ * - positive = overflowing the boundary by that number of pixels
783
+ * - negative = how many pixels left before it will overflow
784
+ * - 0 = lies flush with the boundary
785
+ * @see https://floating-ui.com/docs/detectOverflow
786
+ */
787
+ async function detectOverflow(middlewareArguments, options) {
788
+ var _await$platform$isEle;
789
+
790
+ if (options === void 0) {
791
+ options = {};
792
+ }
793
+
794
+ const {
795
+ x,
796
+ y,
797
+ platform,
798
+ rects,
799
+ elements,
800
+ strategy
801
+ } = middlewareArguments;
802
+ const {
803
+ boundary = 'clippingAncestors',
804
+ rootBoundary = 'viewport',
805
+ elementContext = 'floating',
806
+ altBoundary = false,
807
+ padding = 0
808
+ } = options;
809
+ const paddingObject = getSideObjectFromPadding(padding);
810
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
811
+ const element = elements[altBoundary ? altContext : elementContext];
812
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
813
+ element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
814
+ boundary,
815
+ rootBoundary,
816
+ strategy
817
+ }));
818
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
819
+ rect: elementContext === 'floating' ? { ...rects.floating,
820
+ x,
821
+ y
822
+ } : rects.reference,
823
+ offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
824
+ strategy
825
+ }) : rects[elementContext]); // positive = overflowing the clipping rect
826
+ // 0 or negative = within the clipping rect
827
+
828
+ return {
829
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
830
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
831
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
832
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
833
+ };
834
+ }
835
+
836
+ const hash$1 = {
837
+ left: 'right',
838
+ right: 'left',
839
+ bottom: 'top',
840
+ top: 'bottom'
841
+ };
842
+ function getOppositePlacement(placement) {
843
+ return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
844
+ }
845
+
846
+ function getAlignmentSides(placement, rects, rtl) {
847
+ if (rtl === void 0) {
848
+ rtl = false;
849
+ }
850
+
851
+ const alignment = getAlignment(placement);
852
+ const mainAxis = getMainAxisFromPlacement(placement);
853
+ const length = getLengthFromAxis(mainAxis);
854
+ let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
855
+
856
+ if (rects.reference[length] > rects.floating[length]) {
857
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
858
+ }
859
+
860
+ return {
861
+ main: mainAlignmentSide,
862
+ cross: getOppositePlacement(mainAlignmentSide)
863
+ };
864
+ }
865
+
866
+ const hash = {
867
+ start: 'end',
868
+ end: 'start'
869
+ };
870
+ function getOppositeAlignmentPlacement(placement) {
871
+ return placement.replace(/start|end/g, matched => hash[matched]);
872
+ }
873
+
874
+ function getExpandedPlacements(placement) {
875
+ const oppositePlacement = getOppositePlacement(placement);
876
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
877
+ }
878
+
879
+ /**
880
+ * Changes the placement of the floating element to one that will fit if the
881
+ * initially specified `placement` does not.
882
+ * @see https://floating-ui.com/docs/flip
883
+ */
884
+ const flip = function (options) {
885
+ if (options === void 0) {
886
+ options = {};
887
+ }
888
+
889
+ return {
890
+ name: 'flip',
891
+ options,
892
+
893
+ async fn(middlewareArguments) {
894
+ var _middlewareData$flip;
895
+
896
+ const {
897
+ placement,
898
+ middlewareData,
899
+ rects,
900
+ initialPlacement,
901
+ platform,
902
+ elements
903
+ } = middlewareArguments;
904
+ const {
905
+ mainAxis: checkMainAxis = true,
906
+ crossAxis: checkCrossAxis = true,
907
+ fallbackPlacements: specifiedFallbackPlacements,
908
+ fallbackStrategy = 'bestFit',
909
+ flipAlignment = true,
910
+ ...detectOverflowOptions
911
+ } = options;
912
+ const side = getSide(placement);
913
+ const isBasePlacement = side === initialPlacement;
914
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
915
+ const placements = [initialPlacement, ...fallbackPlacements];
916
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
917
+ const overflows = [];
918
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
919
+
920
+ if (checkMainAxis) {
921
+ overflows.push(overflow[side]);
922
+ }
923
+
924
+ if (checkCrossAxis) {
925
+ const {
926
+ main,
927
+ cross
928
+ } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
929
+ overflows.push(overflow[main], overflow[cross]);
930
+ }
931
+
932
+ overflowsData = [...overflowsData, {
933
+ placement,
934
+ overflows
935
+ }]; // One or more sides is overflowing
936
+
937
+ if (!overflows.every(side => side <= 0)) {
938
+ var _middlewareData$flip$, _middlewareData$flip2;
939
+
940
+ const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
941
+ const nextPlacement = placements[nextIndex];
942
+
943
+ if (nextPlacement) {
944
+ // Try next placement and re-run the lifecycle
945
+ return {
946
+ data: {
947
+ index: nextIndex,
948
+ overflows: overflowsData
949
+ },
950
+ reset: {
951
+ placement: nextPlacement
952
+ }
953
+ };
954
+ }
955
+
956
+ let resetPlacement = 'bottom';
957
+
958
+ switch (fallbackStrategy) {
959
+ case 'bestFit':
960
+ {
961
+ var _overflowsData$map$so;
962
+
963
+ const placement = (_overflowsData$map$so = overflowsData.map(d => [d, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0].placement;
964
+
965
+ if (placement) {
966
+ resetPlacement = placement;
967
+ }
968
+
969
+ break;
970
+ }
971
+
972
+ case 'initialPlacement':
973
+ resetPlacement = initialPlacement;
974
+ break;
975
+ }
976
+
977
+ if (placement !== resetPlacement) {
978
+ return {
979
+ reset: {
980
+ placement: resetPlacement
981
+ }
982
+ };
983
+ }
984
+ }
985
+
986
+ return {};
987
+ }
988
+
989
+ };
990
+ };
991
+
992
+ function convertValueToCoords(placement, rects, value, rtl) {
993
+ if (rtl === void 0) {
994
+ rtl = false;
995
+ }
996
+
997
+ const side = getSide(placement);
998
+ const alignment = getAlignment(placement);
999
+ const isVertical = getMainAxisFromPlacement(placement) === 'x';
1000
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
1001
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
1002
+ const rawValue = typeof value === 'function' ? value({ ...rects,
1003
+ placement
1004
+ }) : value; // eslint-disable-next-line prefer-const
1005
+
1006
+ let {
1007
+ mainAxis,
1008
+ crossAxis,
1009
+ alignmentAxis
1010
+ } = typeof rawValue === 'number' ? {
1011
+ mainAxis: rawValue,
1012
+ crossAxis: 0,
1013
+ alignmentAxis: null
1014
+ } : {
1015
+ mainAxis: 0,
1016
+ crossAxis: 0,
1017
+ alignmentAxis: null,
1018
+ ...rawValue
1019
+ };
1020
+
1021
+ if (alignment && typeof alignmentAxis === 'number') {
1022
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
1023
+ }
1024
+
1025
+ return isVertical ? {
1026
+ x: crossAxis * crossAxisMulti,
1027
+ y: mainAxis * mainAxisMulti
1028
+ } : {
1029
+ x: mainAxis * mainAxisMulti,
1030
+ y: crossAxis * crossAxisMulti
1031
+ };
1032
+ }
1033
+ /**
1034
+ * Displaces the floating element from its reference element.
1035
+ * @see https://floating-ui.com/docs/offset
1036
+ */
1037
+
1038
+ const offset = function (value) {
1039
+ if (value === void 0) {
1040
+ value = 0;
1041
+ }
1042
+
1043
+ return {
1044
+ name: 'offset',
1045
+ options: value,
1046
+
1047
+ async fn(middlewareArguments) {
1048
+ const {
1049
+ x,
1050
+ y,
1051
+ placement,
1052
+ rects,
1053
+ platform,
1054
+ elements
1055
+ } = middlewareArguments;
1056
+ const diffCoords = convertValueToCoords(placement, rects, value, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
1057
+ return {
1058
+ x: x + diffCoords.x,
1059
+ y: y + diffCoords.y,
1060
+ data: diffCoords
1061
+ };
1062
+ }
1063
+
1064
+ };
1065
+ };
1066
+
1067
+ function isWindow(value) {
1068
+ return (value == null ? void 0 : value.toString()) === '[object Window]';
1069
+ }
1070
+ function getWindow(node) {
1071
+ if (node == null) {
1072
+ return window;
1073
+ }
1074
+
1075
+ if (!isWindow(node)) {
1076
+ const ownerDocument = node.ownerDocument;
1077
+ return ownerDocument ? ownerDocument.defaultView || window : window;
1078
+ }
1079
+
1080
+ return node;
1081
+ }
1082
+
1083
+ function getComputedStyle$1(element) {
1084
+ return getWindow(element).getComputedStyle(element);
1085
+ }
1086
+
1087
+ function getNodeName(node) {
1088
+ return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
1089
+ }
1090
+
1091
+ function isHTMLElement(value) {
1092
+ return value instanceof getWindow(value).HTMLElement;
1093
+ }
1094
+ function isElement(value) {
1095
+ return value instanceof getWindow(value).Element;
1096
+ }
1097
+ function isNode(value) {
1098
+ return value instanceof getWindow(value).Node;
1099
+ }
1100
+ function isShadowRoot(node) {
1101
+ const OwnElement = getWindow(node).ShadowRoot;
1102
+ return node instanceof OwnElement || node instanceof ShadowRoot;
1103
+ }
1104
+ function isOverflowElement(element) {
1105
+ // Firefox wants us to check `-x` and `-y` variations as well
1106
+ const {
1107
+ overflow,
1108
+ overflowX,
1109
+ overflowY
1110
+ } = getComputedStyle$1(element);
1111
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
1112
+ }
1113
+ function isTableElement(element) {
1114
+ return ['table', 'td', 'th'].includes(getNodeName(element));
1115
+ }
1116
+ function isContainingBlock(element) {
1117
+ // TODO: Try and use feature detection here instead
1118
+ const isFirefox = navigator.userAgent.toLowerCase().includes('firefox');
1119
+ const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
1120
+ // create a containing block.
1121
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1122
+
1123
+ return css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
1124
+ }
1125
+ function isLayoutViewport() {
1126
+ // Not Safari
1127
+ return !/^((?!chrome|android).)*safari/i.test(navigator.userAgent); // Feature detection for this fails in various ways
1128
+ // • Always-visible scrollbar or not
1129
+ // • Width of <html>, etc.
1130
+ // const vV = win.visualViewport;
1131
+ // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
1132
+ }
1133
+
1134
+ const min = Math.min;
1135
+ const max = Math.max;
1136
+ const round = Math.round;
1137
+
1138
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
1139
+ if (includeScale === void 0) {
1140
+ includeScale = false;
1141
+ }
1142
+
1143
+ if (isFixedStrategy === void 0) {
1144
+ isFixedStrategy = false;
1145
+ }
1146
+
1147
+ const clientRect = element.getBoundingClientRect();
1148
+ let scaleX = 1;
1149
+ let scaleY = 1;
1150
+
1151
+ if (includeScale && isHTMLElement(element)) {
1152
+ scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
1153
+ scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
1154
+ }
1155
+
1156
+ const win = isElement(element) ? getWindow(element) : window;
1157
+ const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
1158
+ const x = (clientRect.left + (addVisualOffsets ? win.visualViewport.offsetLeft : 0)) / scaleX;
1159
+ const y = (clientRect.top + (addVisualOffsets ? win.visualViewport.offsetTop : 0)) / scaleY;
1160
+ const width = clientRect.width / scaleX;
1161
+ const height = clientRect.height / scaleY;
1162
+ return {
1163
+ width,
1164
+ height,
1165
+ top: y,
1166
+ right: x + width,
1167
+ bottom: y + height,
1168
+ left: x,
1169
+ x,
1170
+ y
1171
+ };
1172
+ }
1173
+
1174
+ function getDocumentElement(node) {
1175
+ return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
1176
+ }
1177
+
1178
+ function getNodeScroll(element) {
1179
+ if (isWindow(element)) {
1180
+ return {
1181
+ scrollLeft: element.pageXOffset,
1182
+ scrollTop: element.pageYOffset
1183
+ };
1184
+ }
1185
+
1186
+ return {
1187
+ scrollLeft: element.scrollLeft,
1188
+ scrollTop: element.scrollTop
1189
+ };
1190
+ }
1191
+
1192
+ function getWindowScrollBarX(element) {
1193
+ // If <html> has a CSS width greater than the viewport, then this will be
1194
+ // incorrect for RTL.
1195
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
1196
+ }
1197
+
1198
+ function isScaled(element) {
1199
+ const rect = getBoundingClientRect(element);
1200
+ return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
1201
+ }
1202
+
1203
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1204
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1205
+ const documentElement = getDocumentElement(offsetParent);
1206
+ const rect = getBoundingClientRect(element, isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
1207
+ let scroll = {
1208
+ scrollLeft: 0,
1209
+ scrollTop: 0
1210
+ };
1211
+ const offsets = {
1212
+ x: 0,
1213
+ y: 0
1214
+ };
1215
+
1216
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1217
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1218
+ scroll = getNodeScroll(offsetParent);
1219
+ }
1220
+
1221
+ if (isHTMLElement(offsetParent)) {
1222
+ const offsetRect = getBoundingClientRect(offsetParent, true);
1223
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1224
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1225
+ } else if (documentElement) {
1226
+ offsets.x = getWindowScrollBarX(documentElement);
1227
+ }
1228
+ }
1229
+
1230
+ return {
1231
+ x: rect.left + scroll.scrollLeft - offsets.x,
1232
+ y: rect.top + scroll.scrollTop - offsets.y,
1233
+ width: rect.width,
1234
+ height: rect.height
1235
+ };
1236
+ }
1237
+
1238
+ function getParentNode(node) {
1239
+ if (getNodeName(node) === 'html') {
1240
+ return node;
1241
+ }
1242
+
1243
+ return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
1244
+ // @ts-ignore
1245
+ node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
1246
+ node.parentNode || ( // DOM Element detected
1247
+ isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
1248
+ getDocumentElement(node) // fallback
1249
+
1250
+ );
1251
+ }
1252
+
1253
+ function getTrueOffsetParent(element) {
1254
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
1255
+ return null;
1256
+ }
1257
+
1258
+ return element.offsetParent;
1259
+ }
1260
+
1261
+ function getContainingBlock(element) {
1262
+ let currentNode = getParentNode(element);
1263
+
1264
+ if (isShadowRoot(currentNode)) {
1265
+ currentNode = currentNode.host;
1266
+ }
1267
+
1268
+ while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
1269
+ if (isContainingBlock(currentNode)) {
1270
+ return currentNode;
1271
+ } else {
1272
+ currentNode = currentNode.parentNode;
1273
+ }
1274
+ }
1275
+
1276
+ return null;
1277
+ } // Gets the closest ancestor positioned element. Handles some edge cases,
1278
+ // such as table ancestors and cross browser bugs.
1279
+
1280
+
1281
+ function getOffsetParent(element) {
1282
+ const window = getWindow(element);
1283
+ let offsetParent = getTrueOffsetParent(element);
1284
+
1285
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
1286
+ offsetParent = getTrueOffsetParent(offsetParent);
1287
+ }
1288
+
1289
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
1290
+ return window;
1291
+ }
1292
+
1293
+ return offsetParent || getContainingBlock(element) || window;
1294
+ }
1295
+
1296
+ function getDimensions(element) {
1297
+ if (isHTMLElement(element)) {
1298
+ return {
1299
+ width: element.offsetWidth,
1300
+ height: element.offsetHeight
1301
+ };
1302
+ }
1303
+
1304
+ const rect = getBoundingClientRect(element);
1305
+ return {
1306
+ width: rect.width,
1307
+ height: rect.height
1308
+ };
1309
+ }
1310
+
1311
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1312
+ let {
1313
+ rect,
1314
+ offsetParent,
1315
+ strategy
1316
+ } = _ref;
1317
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1318
+ const documentElement = getDocumentElement(offsetParent);
1319
+
1320
+ if (offsetParent === documentElement) {
1321
+ return rect;
1322
+ }
1323
+
1324
+ let scroll = {
1325
+ scrollLeft: 0,
1326
+ scrollTop: 0
1327
+ };
1328
+ const offsets = {
1329
+ x: 0,
1330
+ y: 0
1331
+ };
1332
+
1333
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1334
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1335
+ scroll = getNodeScroll(offsetParent);
1336
+ }
1337
+
1338
+ if (isHTMLElement(offsetParent)) {
1339
+ const offsetRect = getBoundingClientRect(offsetParent, true);
1340
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1341
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1342
+ } // This doesn't appear to be need to be negated.
1343
+ // else if (documentElement) {
1344
+ // offsets.x = getWindowScrollBarX(documentElement);
1345
+ // }
1346
+
1347
+ }
1348
+
1349
+ return { ...rect,
1350
+ x: rect.x - scroll.scrollLeft + offsets.x,
1351
+ y: rect.y - scroll.scrollTop + offsets.y
1352
+ };
1353
+ }
1354
+
1355
+ function getViewportRect(element, strategy) {
1356
+ const win = getWindow(element);
1357
+ const html = getDocumentElement(element);
1358
+ const visualViewport = win.visualViewport;
1359
+ let width = html.clientWidth;
1360
+ let height = html.clientHeight;
1361
+ let x = 0;
1362
+ let y = 0;
1363
+
1364
+ if (visualViewport) {
1365
+ width = visualViewport.width;
1366
+ height = visualViewport.height;
1367
+ const layoutViewport = isLayoutViewport();
1368
+
1369
+ if (layoutViewport || !layoutViewport && strategy === 'fixed') {
1370
+ x = visualViewport.offsetLeft;
1371
+ y = visualViewport.offsetTop;
1372
+ }
1373
+ }
1374
+
1375
+ return {
1376
+ width,
1377
+ height,
1378
+ x,
1379
+ y
1380
+ };
1381
+ }
1382
+
1383
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable
1384
+
1385
+ function getDocumentRect(element) {
1386
+ var _element$ownerDocumen;
1387
+
1388
+ const html = getDocumentElement(element);
1389
+ const scroll = getNodeScroll(element);
1390
+ const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
1391
+ const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
1392
+ const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
1393
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1394
+ const y = -scroll.scrollTop;
1395
+
1396
+ if (getComputedStyle$1(body || html).direction === 'rtl') {
1397
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
1398
+ }
1399
+
1400
+ return {
1401
+ width,
1402
+ height,
1403
+ x,
1404
+ y
1405
+ };
1406
+ }
1407
+
1408
+ function getNearestOverflowAncestor(node) {
1409
+ const parentNode = getParentNode(node);
1410
+
1411
+ if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
1412
+ // @ts-ignore assume body is always available
1413
+ return node.ownerDocument.body;
1414
+ }
1415
+
1416
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1417
+ return parentNode;
1418
+ }
1419
+
1420
+ return getNearestOverflowAncestor(parentNode);
1421
+ }
1422
+
1423
+ function getOverflowAncestors(node, list) {
1424
+ var _node$ownerDocument;
1425
+
1426
+ if (list === void 0) {
1427
+ list = [];
1428
+ }
1429
+
1430
+ const scrollableAncestor = getNearestOverflowAncestor(node);
1431
+ const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
1432
+ const win = getWindow(scrollableAncestor);
1433
+ const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
1434
+ const updatedList = list.concat(target);
1435
+ return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
1436
+ updatedList.concat(getOverflowAncestors(getParentNode(target)));
1437
+ }
1438
+
1439
+ function contains(parent, child) {
1440
+ const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
1441
+
1442
+ if (parent.contains(child)) {
1443
+ return true;
1444
+ } // then fallback to custom implementation with Shadow DOM support
1445
+ else if (rootNode && isShadowRoot(rootNode)) {
1446
+ let next = child;
1447
+
1448
+ do {
1449
+ // use `===` replace node.isSameNode()
1450
+ if (next && parent === next) {
1451
+ return true;
1452
+ } // @ts-ignore: need a better way to handle this...
1453
+
1454
+
1455
+ next = next.parentNode || next.host;
1456
+ } while (next);
1457
+ }
1458
+
1459
+ return false;
1460
+ }
1461
+
1462
+ function getInnerBoundingClientRect(element, strategy) {
1463
+ const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
1464
+ const top = clientRect.top + element.clientTop;
1465
+ const left = clientRect.left + element.clientLeft;
1466
+ return {
1467
+ top,
1468
+ left,
1469
+ x: left,
1470
+ y: top,
1471
+ right: left + element.clientWidth,
1472
+ bottom: top + element.clientHeight,
1473
+ width: element.clientWidth,
1474
+ height: element.clientHeight
1475
+ };
1476
+ }
1477
+
1478
+ function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
1479
+ if (clippingParent === 'viewport') {
1480
+ return rectToClientRect(getViewportRect(element, strategy));
1481
+ }
1482
+
1483
+ if (isElement(clippingParent)) {
1484
+ return getInnerBoundingClientRect(clippingParent, strategy);
1485
+ }
1486
+
1487
+ return rectToClientRect(getDocumentRect(getDocumentElement(element)));
1488
+ } // A "clipping ancestor" is an overflowable container with the characteristic of
1489
+ // clipping (or hiding) overflowing elements with a position different from
1490
+ // `initial`
1491
+
1492
+
1493
+ function getClippingAncestors(element) {
1494
+ const clippingAncestors = getOverflowAncestors(element);
1495
+ const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
1496
+ const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
1497
+
1498
+ if (!isElement(clipperElement)) {
1499
+ return [];
1500
+ } // @ts-ignore isElement check ensures we return Array<Element>
1501
+
1502
+
1503
+ return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
1504
+ } // Gets the maximum area that the element is visible in due to any number of
1505
+ // clipping ancestors
1506
+
1507
+
1508
+ function getClippingRect(_ref) {
1509
+ let {
1510
+ element,
1511
+ boundary,
1512
+ rootBoundary,
1513
+ strategy
1514
+ } = _ref;
1515
+ const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
1516
+ const clippingAncestors = [...mainClippingAncestors, rootBoundary];
1517
+ const firstClippingAncestor = clippingAncestors[0];
1518
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1519
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1520
+ accRect.top = max(rect.top, accRect.top);
1521
+ accRect.right = min(rect.right, accRect.right);
1522
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1523
+ accRect.left = max(rect.left, accRect.left);
1524
+ return accRect;
1525
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1526
+ return {
1527
+ width: clippingRect.right - clippingRect.left,
1528
+ height: clippingRect.bottom - clippingRect.top,
1529
+ x: clippingRect.left,
1530
+ y: clippingRect.top
1531
+ };
1532
+ }
1533
+
1534
+ const platform = {
1535
+ getClippingRect,
1536
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1537
+ isElement,
1538
+ getDimensions,
1539
+ getOffsetParent,
1540
+ getDocumentElement,
1541
+ getElementRects: _ref => {
1542
+ let {
1543
+ reference,
1544
+ floating,
1545
+ strategy
1546
+ } = _ref;
1547
+ return {
1548
+ reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
1549
+ floating: { ...getDimensions(floating),
1550
+ x: 0,
1551
+ y: 0
1552
+ }
1553
+ };
1554
+ },
1555
+ getClientRects: element => Array.from(element.getClientRects()),
1556
+ isRTL: element => getComputedStyle$1(element).direction === 'rtl'
1557
+ };
1558
+
1559
+ /**
1560
+ * Automatically updates the position of the floating element when necessary.
1561
+ * @see https://floating-ui.com/docs/autoUpdate
1562
+ */
1563
+ function autoUpdate(reference, floating, update, options) {
1564
+ if (options === void 0) {
1565
+ options = {};
1566
+ }
1567
+
1568
+ const {
1569
+ ancestorScroll: _ancestorScroll = true,
1570
+ ancestorResize: _ancestorResize = true,
1571
+ elementResize: _elementResize = true,
1572
+ animationFrame = false
1573
+ } = options;
1574
+ let cleanedUp = false;
1575
+ const ancestorScroll = _ancestorScroll && !animationFrame;
1576
+ const ancestorResize = _ancestorResize && !animationFrame;
1577
+ const elementResize = _elementResize && !animationFrame;
1578
+ const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : []), ...getOverflowAncestors(floating)] : [];
1579
+ ancestors.forEach(ancestor => {
1580
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
1581
+ passive: true
1582
+ });
1583
+ ancestorResize && ancestor.addEventListener('resize', update);
1584
+ });
1585
+ let observer = null;
1586
+
1587
+ if (elementResize) {
1588
+ observer = new ResizeObserver(update);
1589
+ isElement(reference) && observer.observe(reference);
1590
+ observer.observe(floating);
1591
+ }
1592
+
1593
+ let frameId;
1594
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1595
+
1596
+ if (animationFrame) {
1597
+ frameLoop();
1598
+ }
1599
+
1600
+ function frameLoop() {
1601
+ if (cleanedUp) {
1602
+ return;
1603
+ }
1604
+
1605
+ const nextRefRect = getBoundingClientRect(reference);
1606
+
1607
+ if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
1608
+ update();
1609
+ }
1610
+
1611
+ prevRefRect = nextRefRect;
1612
+ frameId = requestAnimationFrame(frameLoop);
1613
+ }
1614
+
1615
+ return () => {
1616
+ var _observer;
1617
+
1618
+ cleanedUp = true;
1619
+ ancestors.forEach(ancestor => {
1620
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
1621
+ ancestorResize && ancestor.removeEventListener('resize', update);
1622
+ });
1623
+ (_observer = observer) == null ? void 0 : _observer.disconnect();
1624
+ observer = null;
1625
+
1626
+ if (animationFrame) {
1627
+ cancelAnimationFrame(frameId);
1628
+ }
1629
+ };
1630
+ }
1631
+
1632
+ /**
1633
+ * Computes the `x` and `y` coordinates that will place the floating element
1634
+ * next to a reference element when it is given a certain CSS positioning
1635
+ * strategy.
1636
+ */
1637
+
1638
+ const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
1639
+ platform,
1640
+ ...options
1641
+ });
1642
+
1643
+ /*!
1644
+ * tabbable 5.3.1
1645
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
1646
+ */
1647
+ var candidateSelectors = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]:not(slot)', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])', 'details>summary:first-of-type', 'details'];
1648
+ var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');
1649
+ var NoElement = typeof Element === 'undefined';
1650
+ var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
1651
+ var getRootNode = !NoElement && Element.prototype.getRootNode ? function (element) {
1652
+ return element.getRootNode();
1653
+ } : function (element) {
1654
+ return element.ownerDocument;
1655
+ };
1656
+ /**
1657
+ * @param {Element} el container to check in
1658
+ * @param {boolean} includeContainer add container to check
1659
+ * @param {(node: Element) => boolean} filter filter candidates
1660
+ * @returns {Element[]}
1661
+ */
1662
+
1663
+ var getCandidates = function getCandidates(el, includeContainer, filter) {
1664
+ var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
1665
+
1666
+ if (includeContainer && matches.call(el, candidateSelector)) {
1667
+ candidates.unshift(el);
1668
+ }
1669
+
1670
+ candidates = candidates.filter(filter);
1671
+ return candidates;
1672
+ };
1673
+ /**
1674
+ * @callback GetShadowRoot
1675
+ * @param {Element} element to check for shadow root
1676
+ * @returns {ShadowRoot|boolean} ShadowRoot if available or boolean indicating if a shadowRoot is attached but not available.
1677
+ */
1678
+
1679
+ /**
1680
+ * @typedef {Object} CandidatesScope
1681
+ * @property {Element} scope contains inner candidates
1682
+ * @property {Element[]} candidates
1683
+ */
1684
+
1685
+ /**
1686
+ * @typedef {Object} IterativeOptions
1687
+ * @property {GetShadowRoot|boolean} getShadowRoot true if shadow support is enabled; falsy if not;
1688
+ * if a function, implies shadow support is enabled and either returns the shadow root of an element
1689
+ * or a boolean stating if it has an undisclosed shadow root
1690
+ * @property {(node: Element) => boolean} filter filter candidates
1691
+ * @property {boolean} flatten if true then result will flatten any CandidatesScope into the returned list
1692
+ */
1693
+
1694
+ /**
1695
+ * @param {Element[]} elements list of element containers to match candidates from
1696
+ * @param {boolean} includeContainer add container list to check
1697
+ * @param {IterativeOptions} options
1698
+ * @returns {Array.<Element|CandidatesScope>}
1699
+ */
1700
+
1701
+
1702
+ var getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {
1703
+ var candidates = [];
1704
+ var elementsToCheck = Array.from(elements);
1705
+
1706
+ while (elementsToCheck.length) {
1707
+ var element = elementsToCheck.shift();
1708
+
1709
+ if (element.tagName === 'SLOT') {
1710
+ // add shadow dom slot scope (slot itself cannot be focusable)
1711
+ var assigned = element.assignedElements();
1712
+ var content = assigned.length ? assigned : element.children;
1713
+ var nestedCandidates = getCandidatesIteratively(content, true, options);
1714
+
1715
+ if (options.flatten) {
1716
+ candidates.push.apply(candidates, nestedCandidates);
1717
+ } else {
1718
+ candidates.push({
1719
+ scope: element,
1720
+ candidates: nestedCandidates
1721
+ });
1722
+ }
1723
+ } else {
1724
+ // check candidate element
1725
+ var validCandidate = matches.call(element, candidateSelector);
1726
+
1727
+ if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {
1728
+ candidates.push(element);
1729
+ } // iterate over shadow content if possible
1730
+
1731
+
1732
+ var shadowRoot = element.shadowRoot || // check for an undisclosed shadow
1733
+ typeof options.getShadowRoot === 'function' && options.getShadowRoot(element);
1734
+
1735
+ if (shadowRoot) {
1736
+ // add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed
1737
+ // shadow exists, so look at light dom children as fallback BUT create a scope for any
1738
+ // child candidates found because they're likely slotted elements (elements that are
1739
+ // children of the web component element (which has the shadow), in the light dom, but
1740
+ // slotted somewhere _inside_ the undisclosed shadow) -- the scope is created below,
1741
+ // _after_ we return from this recursive call
1742
+ var _nestedCandidates = getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);
1743
+
1744
+ if (options.flatten) {
1745
+ candidates.push.apply(candidates, _nestedCandidates);
1746
+ } else {
1747
+ candidates.push({
1748
+ scope: element,
1749
+ candidates: _nestedCandidates
1750
+ });
1751
+ }
1752
+ } else {
1753
+ // there's not shadow so just dig into the element's (light dom) children
1754
+ // __without__ giving the element special scope treatment
1755
+ elementsToCheck.unshift.apply(elementsToCheck, element.children);
1756
+ }
1757
+ }
1758
+ }
1759
+
1760
+ return candidates;
1761
+ };
1762
+
1763
+ var getTabindex = function getTabindex(node, isScope) {
1764
+ if (node.tabIndex < 0) {
1765
+ // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
1766
+ // `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
1767
+ // yet they are still part of the regular tab order; in FF, they get a default
1768
+ // `tabIndex` of 0; since Chrome still puts those elements in the regular tab
1769
+ // order, consider their tab index to be 0.
1770
+ // Also browsers do not return `tabIndex` correctly for contentEditable nodes;
1771
+ // so if they don't have a tabindex attribute specifically set, assume it's 0.
1772
+ //
1773
+ // isScope is positive for custom element with shadow root or slot that by default
1774
+ // have tabIndex -1, but need to be sorted by document order in order for their
1775
+ // content to be inserted in the correct position
1776
+ if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || node.isContentEditable) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
1777
+ return 0;
1778
+ }
1779
+ }
1780
+
1781
+ return node.tabIndex;
1782
+ };
1783
+
1784
+ var sortOrderedTabbables = function sortOrderedTabbables(a, b) {
1785
+ return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
1786
+ };
1787
+
1788
+ var isInput = function isInput(node) {
1789
+ return node.tagName === 'INPUT';
1790
+ };
1791
+
1792
+ var isHiddenInput = function isHiddenInput(node) {
1793
+ return isInput(node) && node.type === 'hidden';
1794
+ };
1795
+
1796
+ var isDetailsWithSummary = function isDetailsWithSummary(node) {
1797
+ var r = node.tagName === 'DETAILS' && Array.prototype.slice.apply(node.children).some(function (child) {
1798
+ return child.tagName === 'SUMMARY';
1799
+ });
1800
+ return r;
1801
+ };
1802
+
1803
+ var getCheckedRadio = function getCheckedRadio(nodes, form) {
1804
+ for (var i = 0; i < nodes.length; i++) {
1805
+ if (nodes[i].checked && nodes[i].form === form) {
1806
+ return nodes[i];
1807
+ }
1808
+ }
1809
+ };
1810
+
1811
+ var isTabbableRadio = function isTabbableRadio(node) {
1812
+ if (!node.name) {
1813
+ return true;
1814
+ }
1815
+
1816
+ var radioScope = node.form || getRootNode(node);
1817
+
1818
+ var queryRadios = function queryRadios(name) {
1819
+ return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
1820
+ };
1821
+
1822
+ var radioSet;
1823
+
1824
+ if (typeof window !== 'undefined' && typeof window.CSS !== 'undefined' && typeof window.CSS.escape === 'function') {
1825
+ radioSet = queryRadios(window.CSS.escape(node.name));
1826
+ } else {
1827
+ try {
1828
+ radioSet = queryRadios(node.name);
1829
+ } catch (err) {
1830
+ // eslint-disable-next-line no-console
1831
+ 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);
1832
+ return false;
1833
+ }
1834
+ }
1835
+
1836
+ var checked = getCheckedRadio(radioSet, node.form);
1837
+ return !checked || checked === node;
1838
+ };
1839
+
1840
+ var isRadio = function isRadio(node) {
1841
+ return isInput(node) && node.type === 'radio';
1842
+ };
1843
+
1844
+ var isNonTabbableRadio = function isNonTabbableRadio(node) {
1845
+ return isRadio(node) && !isTabbableRadio(node);
1846
+ };
1847
+
1848
+ var isZeroArea = function isZeroArea(node) {
1849
+ var _node$getBoundingClie = node.getBoundingClientRect(),
1850
+ width = _node$getBoundingClie.width,
1851
+ height = _node$getBoundingClie.height;
1852
+
1853
+ return width === 0 && height === 0;
1854
+ };
1855
+
1856
+ var isHidden = function isHidden(node, _ref) {
1857
+ var displayCheck = _ref.displayCheck,
1858
+ getShadowRoot = _ref.getShadowRoot;
1859
+
1860
+ if (getComputedStyle(node).visibility === 'hidden') {
1861
+ return true;
1862
+ }
1863
+
1864
+ var isDirectSummary = matches.call(node, 'details>summary:first-of-type');
1865
+ var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
1866
+
1867
+ if (matches.call(nodeUnderDetails, 'details:not([open]) *')) {
1868
+ return true;
1869
+ }
1870
+
1871
+ if (!displayCheck || displayCheck === 'full') {
1872
+ if (typeof getShadowRoot === 'function') {
1873
+ // figure out if we should consider the node to be in an undisclosed shadow and use the
1874
+ // 'non-zero-area' fallback
1875
+ var originalNode = node;
1876
+
1877
+ while (node) {
1878
+ var parentElement = node.parentElement;
1879
+ var rootNode = getRootNode(node);
1880
+
1881
+ if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true // check if there's an undisclosed shadow
1882
+ ) {
1883
+ // node has an undisclosed shadow which means we can only treat it as a black box, so we
1884
+ // fall back to a non-zero-area test
1885
+ return isZeroArea(node);
1886
+ } else if (node.assignedSlot) {
1887
+ // iterate up slot
1888
+ node = node.assignedSlot;
1889
+ } else if (!parentElement && rootNode !== node.ownerDocument) {
1890
+ // cross shadow boundary
1891
+ node = rootNode.host;
1892
+ } else {
1893
+ // iterate up normal dom
1894
+ node = parentElement;
1895
+ }
1896
+ }
1897
+
1898
+ node = originalNode;
1899
+ } // else, `getShadowRoot` might be true, but all that does is enable shadow DOM support
1900
+ // (i.e. it does not also presume that all nodes might have undisclosed shadows); or
1901
+ // it might be a falsy value, which means shadow DOM support is disabled
1902
+ // didn't find it sitting in an undisclosed shadow (or shadows are disabled) so now we
1903
+ // can just test to see if it would normally be visible or not
1904
+ // this works wherever the node is: if there's at least one client rect, it's
1905
+ // somehow displayed; it also covers the CSS 'display: contents' case where the
1906
+ // node itself is hidden in place of its contents; and there's no need to search
1907
+ // up the hierarchy either
1908
+
1909
+
1910
+ return !node.getClientRects().length;
1911
+ } else if (displayCheck === 'non-zero-area') {
1912
+ return isZeroArea(node);
1913
+ }
1914
+
1915
+ return false;
1916
+ }; // form fields (nested) inside a disabled fieldset are not focusable/tabbable
1917
+ // unless they are in the _first_ <legend> element of the top-most disabled
1918
+ // fieldset
1919
+
1920
+
1921
+ var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
1922
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
1923
+ var parentNode = node.parentElement; // check if `node` is contained in a disabled <fieldset>
1924
+
1925
+ while (parentNode) {
1926
+ if (parentNode.tagName === 'FIELDSET' && parentNode.disabled) {
1927
+ // look for the first <legend> among the children of the disabled <fieldset>
1928
+ for (var i = 0; i < parentNode.children.length; i++) {
1929
+ var child = parentNode.children.item(i); // when the first <legend> (in document order) is found
1930
+
1931
+ if (child.tagName === 'LEGEND') {
1932
+ // if its parent <fieldset> is not nested in another disabled <fieldset>,
1933
+ // return whether `node` is a descendant of its first <legend>
1934
+ return matches.call(parentNode, 'fieldset[disabled] *') ? true : !child.contains(node);
1935
+ }
1936
+ } // the disabled <fieldset> containing `node` has no <legend>
1937
+
1938
+
1939
+ return true;
1940
+ }
1941
+
1942
+ parentNode = parentNode.parentElement;
1943
+ }
1944
+ } // else, node's tabbable/focusable state should not be affected by a fieldset's
1945
+ // enabled/disabled state
1946
+
1947
+
1948
+ return false;
1949
+ };
1950
+
1951
+ var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
1952
+ if (node.disabled || isHiddenInput(node) || isHidden(node, options) || // For a details element with a summary, the summary element gets the focus
1953
+ isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
1954
+ return false;
1955
+ }
1956
+
1957
+ return true;
1958
+ };
1959
+
1960
+ var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {
1961
+ if (isNonTabbableRadio(node) || getTabindex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
1962
+ return false;
1963
+ }
1964
+
1965
+ return true;
1966
+ };
1967
+ /**
1968
+ * @param {Array.<Element|CandidatesScope>} candidates
1969
+ * @returns Element[]
1970
+ */
1971
+
1972
+
1973
+ var sortByOrder = function sortByOrder(candidates) {
1974
+ var regularTabbables = [];
1975
+ var orderedTabbables = [];
1976
+ candidates.forEach(function (item, i) {
1977
+ var isScope = !!item.scope;
1978
+ var element = isScope ? item.scope : item;
1979
+ var candidateTabindex = getTabindex(element, isScope);
1980
+ var elements = isScope ? sortByOrder(item.candidates) : element;
1981
+
1982
+ if (candidateTabindex === 0) {
1983
+ isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
1984
+ } else {
1985
+ orderedTabbables.push({
1986
+ documentOrder: i,
1987
+ tabIndex: candidateTabindex,
1988
+ item: item,
1989
+ isScope: isScope,
1990
+ content: elements
1991
+ });
1992
+ }
1993
+ });
1994
+ return orderedTabbables.sort(sortOrderedTabbables).reduce(function (acc, sortable) {
1995
+ sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);
1996
+ return acc;
1997
+ }, []).concat(regularTabbables);
1998
+ };
1999
+
2000
+ var tabbable = function tabbable(el, options) {
2001
+ options = options || {};
2002
+ var candidates;
2003
+
2004
+ if (options.getShadowRoot) {
2005
+ candidates = getCandidatesIteratively([el], options.includeContainer, {
2006
+ filter: isNodeMatchingSelectorTabbable.bind(null, options),
2007
+ flatten: false,
2008
+ getShadowRoot: options.getShadowRoot
2009
+ });
2010
+ } else {
2011
+ candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
2012
+ }
2013
+
2014
+ return sortByOrder(candidates);
2015
+ };
2016
+
2017
+ var focusable = function focusable(el, options) {
2018
+ options = options || {};
2019
+ var candidates;
2020
+
2021
+ if (options.getShadowRoot) {
2022
+ candidates = getCandidatesIteratively([el], options.includeContainer, {
2023
+ filter: isNodeMatchingSelectorFocusable.bind(null, options),
2024
+ flatten: true,
2025
+ getShadowRoot: options.getShadowRoot
2026
+ });
2027
+ } else {
2028
+ candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
2029
+ }
2030
+
2031
+ return candidates;
2032
+ };
2033
+
2034
+ var isTabbable = function isTabbable(node, options) {
2035
+ options = options || {};
2036
+
2037
+ if (!node) {
2038
+ throw new Error('No node provided');
2039
+ }
2040
+
2041
+ if (matches.call(node, candidateSelector) === false) {
2042
+ return false;
2043
+ }
2044
+
2045
+ return isNodeMatchingSelectorTabbable(options, node);
2046
+ };
2047
+
2048
+ var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe').join(',');
2049
+
2050
+ var isFocusable = function isFocusable(node, options) {
2051
+ options = options || {};
2052
+
2053
+ if (!node) {
2054
+ throw new Error('No node provided');
2055
+ }
2056
+
2057
+ if (matches.call(node, focusableCandidateSelector) === false) {
2058
+ return false;
2059
+ }
2060
+
2061
+ return isNodeMatchingSelectorFocusable(options, node);
2062
+ };
2063
+
2064
+ /*!
2065
+ * focus-trap 6.8.1
2066
+ * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
2067
+ */
2068
+
2069
+ function ownKeys(object, enumerableOnly) {
2070
+ var keys = Object.keys(object);
2071
+
2072
+ if (Object.getOwnPropertySymbols) {
2073
+ var symbols = Object.getOwnPropertySymbols(object);
2074
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
2075
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2076
+ })), keys.push.apply(keys, symbols);
2077
+ }
2078
+
2079
+ return keys;
2080
+ }
2081
+
2082
+ function _objectSpread2(target) {
2083
+ for (var i = 1; i < arguments.length; i++) {
2084
+ var source = null != arguments[i] ? arguments[i] : {};
2085
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
2086
+ _defineProperty(target, key, source[key]);
2087
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
2088
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2089
+ });
2090
+ }
2091
+
2092
+ return target;
2093
+ }
2094
+
2095
+ function _defineProperty(obj, key, value) {
2096
+ if (key in obj) {
2097
+ Object.defineProperty(obj, key, {
2098
+ value: value,
2099
+ enumerable: true,
2100
+ configurable: true,
2101
+ writable: true
2102
+ });
2103
+ } else {
2104
+ obj[key] = value;
2105
+ }
2106
+
2107
+ return obj;
2108
+ }
2109
+
2110
+ var activeFocusTraps = function () {
2111
+ var trapQueue = [];
2112
+ return {
2113
+ activateTrap: function activateTrap(trap) {
2114
+ if (trapQueue.length > 0) {
2115
+ var activeTrap = trapQueue[trapQueue.length - 1];
2116
+
2117
+ if (activeTrap !== trap) {
2118
+ activeTrap.pause();
2119
+ }
2120
+ }
2121
+
2122
+ var trapIndex = trapQueue.indexOf(trap);
2123
+
2124
+ if (trapIndex === -1) {
2125
+ trapQueue.push(trap);
2126
+ } else {
2127
+ // move this existing trap to the front of the queue
2128
+ trapQueue.splice(trapIndex, 1);
2129
+ trapQueue.push(trap);
2130
+ }
2131
+ },
2132
+ deactivateTrap: function deactivateTrap(trap) {
2133
+ var trapIndex = trapQueue.indexOf(trap);
2134
+
2135
+ if (trapIndex !== -1) {
2136
+ trapQueue.splice(trapIndex, 1);
2137
+ }
2138
+
2139
+ if (trapQueue.length > 0) {
2140
+ trapQueue[trapQueue.length - 1].unpause();
2141
+ }
2142
+ }
2143
+ };
2144
+ }();
2145
+
2146
+ var isSelectableInput = function isSelectableInput(node) {
2147
+ return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function';
2148
+ };
2149
+
2150
+ var isEscapeEvent = function isEscapeEvent(e) {
2151
+ return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;
2152
+ };
2153
+
2154
+ var isTabEvent = function isTabEvent(e) {
2155
+ return e.key === 'Tab' || e.keyCode === 9;
2156
+ };
2157
+
2158
+ var delay = function delay(fn) {
2159
+ return setTimeout(fn, 0);
2160
+ }; // Array.find/findIndex() are not supported on IE; this replicates enough
2161
+ // of Array.findIndex() for our needs
2162
+
2163
+
2164
+ var findIndex = function findIndex(arr, fn) {
2165
+ var idx = -1;
2166
+ arr.every(function (value, i) {
2167
+ if (fn(value)) {
2168
+ idx = i;
2169
+ return false; // break
2170
+ }
2171
+
2172
+ return true; // next
2173
+ });
2174
+ return idx;
2175
+ };
2176
+ /**
2177
+ * Get an option's value when it could be a plain value, or a handler that provides
2178
+ * the value.
2179
+ * @param {*} value Option's value to check.
2180
+ * @param {...*} [params] Any parameters to pass to the handler, if `value` is a function.
2181
+ * @returns {*} The `value`, or the handler's returned value.
2182
+ */
2183
+
2184
+
2185
+ var valueOrHandler = function valueOrHandler(value) {
2186
+ for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2187
+ params[_key - 1] = arguments[_key];
2188
+ }
2189
+
2190
+ return typeof value === 'function' ? value.apply(void 0, params) : value;
2191
+ };
2192
+
2193
+ var getActualTarget = function getActualTarget(event) {
2194
+ // NOTE: If the trap is _inside_ a shadow DOM, event.target will always be the
2195
+ // shadow host. However, event.target.composedPath() will be an array of
2196
+ // nodes "clicked" from inner-most (the actual element inside the shadow) to
2197
+ // outer-most (the host HTML document). If we have access to composedPath(),
2198
+ // then use its first element; otherwise, fall back to event.target (and
2199
+ // this only works for an _open_ shadow DOM; otherwise,
2200
+ // composedPath()[0] === event.target always).
2201
+ return event.target.shadowRoot && typeof event.composedPath === 'function' ? event.composedPath()[0] : event.target;
2202
+ };
2203
+
2204
+ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2205
+ // SSR: a live trap shouldn't be created in this type of environment so this
2206
+ // should be safe code to execute if the `document` option isn't specified
2207
+ var doc = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.document) || document;
2208
+
2209
+ var config = _objectSpread2({
2210
+ returnFocusOnDeactivate: true,
2211
+ escapeDeactivates: true,
2212
+ delayInitialFocus: true
2213
+ }, userOptions);
2214
+
2215
+ var state = {
2216
+ // containers given to createFocusTrap()
2217
+ // @type {Array<HTMLElement>}
2218
+ containers: [],
2219
+ // list of objects identifying tabbable nodes in `containers` in the trap
2220
+ // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
2221
+ // is active, but the trap should never get to a state where there isn't at least one group
2222
+ // with at least one tabbable node in it (that would lead to an error condition that would
2223
+ // result in an error being thrown)
2224
+ // @type {Array<{
2225
+ // container: HTMLElement,
2226
+ // tabbableNodes: Array<HTMLElement>, // empty if none
2227
+ // focusableNodes: Array<HTMLElement>, // empty if none
2228
+ // firstTabbableNode: HTMLElement|null,
2229
+ // lastTabbableNode: HTMLElement|null,
2230
+ // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
2231
+ // }>}
2232
+ containerGroups: [],
2233
+ // same order/length as `containers` list
2234
+ // references to objects in `containerGroups`, but only those that actually have
2235
+ // tabbable nodes in them
2236
+ // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
2237
+ // the same length
2238
+ tabbableGroups: [],
2239
+ nodeFocusedBeforeActivation: null,
2240
+ mostRecentlyFocusedNode: null,
2241
+ active: false,
2242
+ paused: false,
2243
+ // timer ID for when delayInitialFocus is true and initial focus in this trap
2244
+ // has been delayed during activation
2245
+ delayInitialFocusTimer: undefined
2246
+ };
2247
+ var trap; // eslint-disable-line prefer-const -- some private functions reference it, and its methods reference private functions, so we must declare here and define later
2248
+
2249
+ /**
2250
+ * Gets a configuration option value.
2251
+ * @param {Object|undefined} configOverrideOptions If true, and option is defined in this set,
2252
+ * value will be taken from this object. Otherwise, value will be taken from base configuration.
2253
+ * @param {string} optionName Name of the option whose value is sought.
2254
+ * @param {string|undefined} [configOptionName] Name of option to use __instead of__ `optionName`
2255
+ * IIF `configOverrideOptions` is not defined. Otherwise, `optionName` is used.
2256
+ */
2257
+
2258
+ var getOption = function getOption(configOverrideOptions, optionName, configOptionName) {
2259
+ return configOverrideOptions && configOverrideOptions[optionName] !== undefined ? configOverrideOptions[optionName] : config[configOptionName || optionName];
2260
+ };
2261
+ /**
2262
+ * Finds the index of the container that contains the element.
2263
+ * @param {HTMLElement} element
2264
+ * @returns {number} Index of the container in either `state.containers` or
2265
+ * `state.containerGroups` (the order/length of these lists are the same); -1
2266
+ * if the element isn't found.
2267
+ */
2268
+
2269
+
2270
+ var findContainerIndex = function findContainerIndex(element) {
2271
+ // NOTE: search `containerGroups` because it's possible a group contains no tabbable
2272
+ // nodes, but still contains focusable nodes (e.g. if they all have `tabindex=-1`)
2273
+ // and we still need to find the element in there
2274
+ return state.containerGroups.findIndex(function (_ref) {
2275
+ var container = _ref.container,
2276
+ tabbableNodes = _ref.tabbableNodes;
2277
+ return container.contains(element) || // fall back to explicit tabbable search which will take into consideration any
2278
+ // web components if the `tabbableOptions.getShadowRoot` option was used for
2279
+ // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
2280
+ // look inside web components even if open)
2281
+ tabbableNodes.find(function (node) {
2282
+ return node === element;
2283
+ });
2284
+ });
2285
+ };
2286
+ /**
2287
+ * Gets the node for the given option, which is expected to be an option that
2288
+ * can be either a DOM node, a string that is a selector to get a node, `false`
2289
+ * (if a node is explicitly NOT given), or a function that returns any of these
2290
+ * values.
2291
+ * @param {string} optionName
2292
+ * @returns {undefined | false | HTMLElement | SVGElement} Returns
2293
+ * `undefined` if the option is not specified; `false` if the option
2294
+ * resolved to `false` (node explicitly not given); otherwise, the resolved
2295
+ * DOM node.
2296
+ * @throws {Error} If the option is set, not `false`, and is not, or does not
2297
+ * resolve to a node.
2298
+ */
2299
+
2300
+
2301
+ var getNodeForOption = function getNodeForOption(optionName) {
2302
+ var optionValue = config[optionName];
2303
+
2304
+ if (typeof optionValue === 'function') {
2305
+ for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2306
+ params[_key2 - 1] = arguments[_key2];
2307
+ }
2308
+
2309
+ optionValue = optionValue.apply(void 0, params);
2310
+ }
2311
+
2312
+ if (!optionValue) {
2313
+ if (optionValue === undefined || optionValue === false) {
2314
+ return optionValue;
2315
+ } // else, empty string (invalid), null (invalid), 0 (invalid)
2316
+
2317
+
2318
+ throw new Error("`".concat(optionName, "` was specified but was not a node, or did not return a node"));
2319
+ }
2320
+
2321
+ var node = optionValue; // could be HTMLElement, SVGElement, or non-empty string at this point
2322
+
2323
+ if (typeof optionValue === 'string') {
2324
+ node = doc.querySelector(optionValue); // resolve to node, or null if fails
2325
+
2326
+ if (!node) {
2327
+ throw new Error("`".concat(optionName, "` as selector refers to no known node"));
2328
+ }
2329
+ }
2330
+
2331
+ return node;
2332
+ };
2333
+
2334
+ var getInitialFocusNode = function getInitialFocusNode() {
2335
+ var node = getNodeForOption('initialFocus'); // false explicitly indicates we want no initialFocus at all
2336
+
2337
+ if (node === false) {
2338
+ return false;
2339
+ }
2340
+
2341
+ if (node === undefined) {
2342
+ // option not specified: use fallback options
2343
+ if (findContainerIndex(doc.activeElement) >= 0) {
2344
+ node = doc.activeElement;
2345
+ } else {
2346
+ var firstTabbableGroup = state.tabbableGroups[0];
2347
+ var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode; // NOTE: `fallbackFocus` option function cannot return `false` (not supported)
2348
+
2349
+ node = firstTabbableNode || getNodeForOption('fallbackFocus');
2350
+ }
2351
+ }
2352
+
2353
+ if (!node) {
2354
+ throw new Error('Your focus-trap needs to have at least one focusable element');
2355
+ }
2356
+
2357
+ return node;
2358
+ };
2359
+
2360
+ var updateTabbableNodes = function updateTabbableNodes() {
2361
+ state.containerGroups = state.containers.map(function (container) {
2362
+ var tabbableNodes = tabbable(container, config.tabbableOptions); // NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes
2363
+ // are a superset of tabbable nodes
2364
+
2365
+ var focusableNodes = focusable(container, config.tabbableOptions);
2366
+ return {
2367
+ container: container,
2368
+ tabbableNodes: tabbableNodes,
2369
+ focusableNodes: focusableNodes,
2370
+ firstTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[0] : null,
2371
+ lastTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : null,
2372
+
2373
+ /**
2374
+ * Finds the __tabbable__ node that follows the given node in the specified direction,
2375
+ * in this container, if any.
2376
+ * @param {HTMLElement} node
2377
+ * @param {boolean} [forward] True if going in forward tab order; false if going
2378
+ * in reverse.
2379
+ * @returns {HTMLElement|undefined} The next tabbable node, if any.
2380
+ */
2381
+ nextTabbableNode: function nextTabbableNode(node) {
2382
+ var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2383
+ // NOTE: If tabindex is positive (in order to manipulate the tab order separate
2384
+ // from the DOM order), this __will not work__ because the list of focusableNodes,
2385
+ // while it contains tabbable nodes, does not sort its nodes in any order other
2386
+ // than DOM order, because it can't: Where would you place focusable (but not
2387
+ // tabbable) nodes in that order? They have no order, because they aren't tabbale...
2388
+ // Support for positive tabindex is already broken and hard to manage (possibly
2389
+ // not supportable, TBD), so this isn't going to make things worse than they
2390
+ // already are, and at least makes things better for the majority of cases where
2391
+ // tabindex is either 0/unset or negative.
2392
+ // FYI, positive tabindex issue: https://github.com/focus-trap/focus-trap/issues/375
2393
+ var nodeIdx = focusableNodes.findIndex(function (n) {
2394
+ return n === node;
2395
+ });
2396
+
2397
+ if (nodeIdx < 0) {
2398
+ return undefined;
2399
+ }
2400
+
2401
+ if (forward) {
2402
+ return focusableNodes.slice(nodeIdx + 1).find(function (n) {
2403
+ return isTabbable(n, config.tabbableOptions);
2404
+ });
2405
+ }
2406
+
2407
+ return focusableNodes.slice(0, nodeIdx).reverse().find(function (n) {
2408
+ return isTabbable(n, config.tabbableOptions);
2409
+ });
2410
+ }
2411
+ };
2412
+ });
2413
+ state.tabbableGroups = state.containerGroups.filter(function (group) {
2414
+ return group.tabbableNodes.length > 0;
2415
+ }); // throw if no groups have tabbable nodes and we don't have a fallback focus node either
2416
+
2417
+ if (state.tabbableGroups.length <= 0 && !getNodeForOption('fallbackFocus') // returning false not supported for this option
2418
+ ) {
2419
+ throw new Error('Your focus-trap must have at least one container with at least one tabbable node in it at all times');
2420
+ }
2421
+ };
2422
+
2423
+ var tryFocus = function tryFocus(node) {
2424
+ if (node === false) {
2425
+ return;
2426
+ }
2427
+
2428
+ if (node === doc.activeElement) {
2429
+ return;
2430
+ }
2431
+
2432
+ if (!node || !node.focus) {
2433
+ tryFocus(getInitialFocusNode());
2434
+ return;
2435
+ }
2436
+
2437
+ node.focus({
2438
+ preventScroll: !!config.preventScroll
2439
+ });
2440
+ state.mostRecentlyFocusedNode = node;
2441
+
2442
+ if (isSelectableInput(node)) {
2443
+ node.select();
2444
+ }
2445
+ };
2446
+
2447
+ var getReturnFocusNode = function getReturnFocusNode(previousActiveElement) {
2448
+ var node = getNodeForOption('setReturnFocus', previousActiveElement);
2449
+ return node ? node : node === false ? false : previousActiveElement;
2450
+ }; // This needs to be done on mousedown and touchstart instead of click
2451
+ // so that it precedes the focus event.
2452
+
2453
+
2454
+ var checkPointerDown = function checkPointerDown(e) {
2455
+ var target = getActualTarget(e);
2456
+
2457
+ if (findContainerIndex(target) >= 0) {
2458
+ // allow the click since it ocurred inside the trap
2459
+ return;
2460
+ }
2461
+
2462
+ if (valueOrHandler(config.clickOutsideDeactivates, e)) {
2463
+ // immediately deactivate the trap
2464
+ trap.deactivate({
2465
+ // if, on deactivation, we should return focus to the node originally-focused
2466
+ // when the trap was activated (or the configured `setReturnFocus` node),
2467
+ // then assume it's also OK to return focus to the outside node that was
2468
+ // just clicked, causing deactivation, as long as that node is focusable;
2469
+ // if it isn't focusable, then return focus to the original node focused
2470
+ // on activation (or the configured `setReturnFocus` node)
2471
+ // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
2472
+ // which will result in the outside click setting focus to the node
2473
+ // that was clicked, whether it's focusable or not; by setting
2474
+ // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
2475
+ // on activation (or the configured `setReturnFocus` node)
2476
+ returnFocus: config.returnFocusOnDeactivate && !isFocusable(target, config.tabbableOptions)
2477
+ });
2478
+ return;
2479
+ } // This is needed for mobile devices.
2480
+ // (If we'll only let `click` events through,
2481
+ // then on mobile they will be blocked anyways if `touchstart` is blocked.)
2482
+
2483
+
2484
+ if (valueOrHandler(config.allowOutsideClick, e)) {
2485
+ // allow the click outside the trap to take place
2486
+ return;
2487
+ } // otherwise, prevent the click
2488
+
2489
+
2490
+ e.preventDefault();
2491
+ }; // In case focus escapes the trap for some strange reason, pull it back in.
2492
+
2493
+
2494
+ var checkFocusIn = function checkFocusIn(e) {
2495
+ var target = getActualTarget(e);
2496
+ var targetContained = findContainerIndex(target) >= 0; // In Firefox when you Tab out of an iframe the Document is briefly focused.
2497
+
2498
+ if (targetContained || target instanceof Document) {
2499
+ if (targetContained) {
2500
+ state.mostRecentlyFocusedNode = target;
2501
+ }
2502
+ } else {
2503
+ // escaped! pull it back in to where it just left
2504
+ e.stopImmediatePropagation();
2505
+ tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
2506
+ }
2507
+ }; // Hijack Tab events on the first and last focusable nodes of the trap,
2508
+ // in order to prevent focus from escaping. If it escapes for even a
2509
+ // moment it can end up scrolling the page and causing confusion so we
2510
+ // kind of need to capture the action at the keydown phase.
2511
+
2512
+
2513
+ var checkTab = function checkTab(e) {
2514
+ var target = getActualTarget(e);
2515
+ updateTabbableNodes();
2516
+ var destinationNode = null;
2517
+
2518
+ if (state.tabbableGroups.length > 0) {
2519
+ // make sure the target is actually contained in a group
2520
+ // NOTE: the target may also be the container itself if it's focusable
2521
+ // with tabIndex='-1' and was given initial focus
2522
+ var containerIndex = findContainerIndex(target);
2523
+ var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : undefined;
2524
+
2525
+ if (containerIndex < 0) {
2526
+ // target not found in any group: quite possible focus has escaped the trap,
2527
+ // so bring it back in to...
2528
+ if (e.shiftKey) {
2529
+ // ...the last node in the last group
2530
+ destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;
2531
+ } else {
2532
+ // ...the first node in the first group
2533
+ destinationNode = state.tabbableGroups[0].firstTabbableNode;
2534
+ }
2535
+ } else if (e.shiftKey) {
2536
+ // REVERSE
2537
+ // is the target the first tabbable node in a group?
2538
+ var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref2) {
2539
+ var firstTabbableNode = _ref2.firstTabbableNode;
2540
+ return target === firstTabbableNode;
2541
+ });
2542
+
2543
+ if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
2544
+ // an exception case where the target is either the container itself, or
2545
+ // a non-tabbable node that was given focus (i.e. tabindex is negative
2546
+ // and user clicked on it or node was programmatically given focus)
2547
+ // and is not followed by any other tabbable node, in which
2548
+ // case, we should handle shift+tab as if focus were on the container's
2549
+ // first tabbable node, and go to the last tabbable node of the LAST group
2550
+ startOfGroupIndex = containerIndex;
2551
+ }
2552
+
2553
+ if (startOfGroupIndex >= 0) {
2554
+ // YES: then shift+tab should go to the last tabbable node in the
2555
+ // previous group (and wrap around to the last tabbable node of
2556
+ // the LAST group if it's the first tabbable node of the FIRST group)
2557
+ var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
2558
+ var destinationGroup = state.tabbableGroups[destinationGroupIndex];
2559
+ destinationNode = destinationGroup.lastTabbableNode;
2560
+ }
2561
+ } else {
2562
+ // FORWARD
2563
+ // is the target the last tabbable node in a group?
2564
+ var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
2565
+ var lastTabbableNode = _ref3.lastTabbableNode;
2566
+ return target === lastTabbableNode;
2567
+ });
2568
+
2569
+ if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
2570
+ // an exception case where the target is the container itself, or
2571
+ // a non-tabbable node that was given focus (i.e. tabindex is negative
2572
+ // and user clicked on it or node was programmatically given focus)
2573
+ // and is not followed by any other tabbable node, in which
2574
+ // case, we should handle tab as if focus were on the container's
2575
+ // last tabbable node, and go to the first tabbable node of the FIRST group
2576
+ lastOfGroupIndex = containerIndex;
2577
+ }
2578
+
2579
+ if (lastOfGroupIndex >= 0) {
2580
+ // YES: then tab should go to the first tabbable node in the next
2581
+ // group (and wrap around to the first tabbable node of the FIRST
2582
+ // group if it's the last tabbable node of the LAST group)
2583
+ var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
2584
+
2585
+ var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
2586
+ destinationNode = _destinationGroup.firstTabbableNode;
2587
+ }
2588
+ }
2589
+ } else {
2590
+ // NOTE: the fallbackFocus option does not support returning false to opt-out
2591
+ destinationNode = getNodeForOption('fallbackFocus');
2592
+ }
2593
+
2594
+ if (destinationNode) {
2595
+ e.preventDefault();
2596
+ tryFocus(destinationNode);
2597
+ } // else, let the browser take care of [shift+]tab and move the focus
2598
+
2599
+ };
2600
+
2601
+ var checkKey = function checkKey(e) {
2602
+ if (isEscapeEvent(e) && valueOrHandler(config.escapeDeactivates, e) !== false) {
2603
+ e.preventDefault();
2604
+ trap.deactivate();
2605
+ return;
2606
+ }
2607
+
2608
+ if (isTabEvent(e)) {
2609
+ checkTab(e);
2610
+ return;
2611
+ }
2612
+ };
2613
+
2614
+ var checkClick = function checkClick(e) {
2615
+ if (valueOrHandler(config.clickOutsideDeactivates, e)) {
2616
+ return;
2617
+ }
2618
+
2619
+ var target = getActualTarget(e);
2620
+
2621
+ if (findContainerIndex(target) >= 0) {
2622
+ return;
2623
+ }
2624
+
2625
+ if (valueOrHandler(config.allowOutsideClick, e)) {
2626
+ return;
2627
+ }
2628
+
2629
+ e.preventDefault();
2630
+ e.stopImmediatePropagation();
2631
+ }; //
2632
+ // EVENT LISTENERS
2633
+ //
2634
+
2635
+
2636
+ var addListeners = function addListeners() {
2637
+ if (!state.active) {
2638
+ return;
2639
+ } // There can be only one listening focus trap at a time
2640
+
2641
+
2642
+ activeFocusTraps.activateTrap(trap); // Delay ensures that the focused element doesn't capture the event
2643
+ // that caused the focus trap activation.
2644
+
2645
+ state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function () {
2646
+ tryFocus(getInitialFocusNode());
2647
+ }) : tryFocus(getInitialFocusNode());
2648
+ doc.addEventListener('focusin', checkFocusIn, true);
2649
+ doc.addEventListener('mousedown', checkPointerDown, {
2650
+ capture: true,
2651
+ passive: false
2652
+ });
2653
+ doc.addEventListener('touchstart', checkPointerDown, {
2654
+ capture: true,
2655
+ passive: false
2656
+ });
2657
+ doc.addEventListener('click', checkClick, {
2658
+ capture: true,
2659
+ passive: false
2660
+ });
2661
+ doc.addEventListener('keydown', checkKey, {
2662
+ capture: true,
2663
+ passive: false
2664
+ });
2665
+ return trap;
2666
+ };
2667
+
2668
+ var removeListeners = function removeListeners() {
2669
+ if (!state.active) {
2670
+ return;
2671
+ }
2672
+
2673
+ doc.removeEventListener('focusin', checkFocusIn, true);
2674
+ doc.removeEventListener('mousedown', checkPointerDown, true);
2675
+ doc.removeEventListener('touchstart', checkPointerDown, true);
2676
+ doc.removeEventListener('click', checkClick, true);
2677
+ doc.removeEventListener('keydown', checkKey, true);
2678
+ return trap;
2679
+ }; //
2680
+ // TRAP DEFINITION
2681
+ //
2682
+
2683
+
2684
+ trap = {
2685
+ activate: function activate(activateOptions) {
2686
+ if (state.active) {
2687
+ return this;
2688
+ }
2689
+
2690
+ var onActivate = getOption(activateOptions, 'onActivate');
2691
+ var onPostActivate = getOption(activateOptions, 'onPostActivate');
2692
+ var checkCanFocusTrap = getOption(activateOptions, 'checkCanFocusTrap');
2693
+
2694
+ if (!checkCanFocusTrap) {
2695
+ updateTabbableNodes();
2696
+ }
2697
+
2698
+ state.active = true;
2699
+ state.paused = false;
2700
+ state.nodeFocusedBeforeActivation = doc.activeElement;
2701
+
2702
+ if (onActivate) {
2703
+ onActivate();
2704
+ }
2705
+
2706
+ var finishActivation = function finishActivation() {
2707
+ if (checkCanFocusTrap) {
2708
+ updateTabbableNodes();
2709
+ }
2710
+
2711
+ addListeners();
2712
+
2713
+ if (onPostActivate) {
2714
+ onPostActivate();
2715
+ }
2716
+ };
2717
+
2718
+ if (checkCanFocusTrap) {
2719
+ checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
2720
+ return this;
2721
+ }
2722
+
2723
+ finishActivation();
2724
+ return this;
2725
+ },
2726
+ deactivate: function deactivate(deactivateOptions) {
2727
+ if (!state.active) {
2728
+ return this;
2729
+ }
2730
+
2731
+ clearTimeout(state.delayInitialFocusTimer); // noop if undefined
2732
+
2733
+ state.delayInitialFocusTimer = undefined;
2734
+ removeListeners();
2735
+ state.active = false;
2736
+ state.paused = false;
2737
+ activeFocusTraps.deactivateTrap(trap);
2738
+ var onDeactivate = getOption(deactivateOptions, 'onDeactivate');
2739
+ var onPostDeactivate = getOption(deactivateOptions, 'onPostDeactivate');
2740
+ var checkCanReturnFocus = getOption(deactivateOptions, 'checkCanReturnFocus');
2741
+
2742
+ if (onDeactivate) {
2743
+ onDeactivate();
2744
+ }
2745
+
2746
+ var returnFocus = getOption(deactivateOptions, 'returnFocus', 'returnFocusOnDeactivate');
2747
+
2748
+ var finishDeactivation = function finishDeactivation() {
2749
+ delay(function () {
2750
+ if (returnFocus) {
2751
+ tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
2752
+ }
2753
+
2754
+ if (onPostDeactivate) {
2755
+ onPostDeactivate();
2756
+ }
2757
+ });
2758
+ };
2759
+
2760
+ if (returnFocus && checkCanReturnFocus) {
2761
+ checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation);
2762
+ return this;
2763
+ }
2764
+
2765
+ finishDeactivation();
2766
+ return this;
2767
+ },
2768
+ pause: function pause() {
2769
+ if (state.paused || !state.active) {
2770
+ return this;
2771
+ }
2772
+
2773
+ state.paused = true;
2774
+ removeListeners();
2775
+ return this;
2776
+ },
2777
+ unpause: function unpause() {
2778
+ if (!state.paused || !state.active) {
2779
+ return this;
2780
+ }
2781
+
2782
+ state.paused = false;
2783
+ updateTabbableNodes();
2784
+ addListeners();
2785
+ return this;
2786
+ },
2787
+ updateContainerElements: function updateContainerElements(containerElements) {
2788
+ var elementsAsArray = [].concat(containerElements).filter(Boolean);
2789
+ state.containers = elementsAsArray.map(function (element) {
2790
+ return typeof element === 'string' ? doc.querySelector(element) : element;
2791
+ });
2792
+
2793
+ if (state.active) {
2794
+ updateTabbableNodes();
2795
+ }
2796
+
2797
+ return this;
2798
+ }
2799
+ }; // initialize container elements
2800
+
2801
+ trap.updateContainerElements(elements);
2802
+ return trap;
2803
+ };
2804
+
2805
+ const firstTabbable = (container) => {
2806
+ return (container ? tabbable(container, { includeContainer: true, getShadowRoot: true }) : []).shift();
2807
+ };
2808
+
2809
+ const catMenuCss = ":host{display:contents}:host([hidden]){display:none}.content{padding-top:0.5rem;padding-bottom:0.5rem;position:absolute;background:white;display:none;overflow:auto;-webkit-overflow-scrolling:touch;min-width:8rem;max-width:16rem;min-height:2rem;max-height:calc(100vh - 48px);box-shadow:0 1px 4px 0 rgba(16, 29, 48, 0.2);border-radius:0.25rem;z-index:100}";
2810
+
2811
+ let nextUniqueId$4 = 0;
2812
+ const CatMenu = class {
2813
+ constructor(hostRef) {
2814
+ index.registerInstance(this, hostRef);
2815
+ this.catOpen = index.createEvent(this, "catOpen", 7);
2816
+ this.catClose = index.createEvent(this, "catClose", 7);
2817
+ this.id = nextUniqueId$4++;
2818
+ /**
2819
+ * The placement of the menu.
2820
+ */
2821
+ this.placement = 'bottom-start';
2822
+ }
2823
+ clickHandler(event) {
2824
+ var _a;
2825
+ // hide menu on button click
2826
+ if (this.content && event.composedPath().includes(this.content)) {
2827
+ (_a = this.trap) === null || _a === void 0 ? void 0 : _a.deactivate();
2828
+ this.hide();
2829
+ }
2830
+ }
2831
+ componentDidLoad() {
2832
+ var _a, _b, _c, _d, _e;
2833
+ this.trigger = firstTabbable(this.triggerSlot);
2834
+ (_a = this.trigger) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-haspopup', 'true');
2835
+ (_b = this.trigger) === null || _b === void 0 ? void 0 : _b.setAttribute('aria-expanded', 'false');
2836
+ (_c = this.trigger) === null || _c === void 0 ? void 0 : _c.setAttribute('aria-controls', this.contentId);
2837
+ (_d = this.content) === null || _d === void 0 ? void 0 : _d.setAttribute('id', this.contentId);
2838
+ if (this.trigger && this.content) {
2839
+ (_e = this.trigger) === null || _e === void 0 ? void 0 : _e.addEventListener('click', () => this.show());
2840
+ autoUpdate(this.trigger, this.content, () => this.update());
2841
+ }
2842
+ this.keyListener = event => {
2843
+ if (this.content && ['ArrowDown', 'ArrowUp'].includes(event.key)) {
2844
+ const targetElements = tabbable(this.content, { includeContainer: false, getShadowRoot: true });
2845
+ const activeElement = firstTabbable(document.activeElement);
2846
+ const activeIdx = activeElement ? targetElements.indexOf(activeElement) : -1;
2847
+ const activeOff = event.key === 'ArrowDown' ? 1 : -1;
2848
+ const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;
2849
+ targetElements[targetIdx].focus();
2850
+ event.preventDefault();
2851
+ }
2852
+ };
2853
+ document.addEventListener('keydown', this.keyListener);
2854
+ }
2855
+ disconnectedCallback() {
2856
+ if (this.keyListener) {
2857
+ document.removeEventListener('keydown', this.keyListener);
2858
+ }
2859
+ }
2860
+ render() {
2861
+ return (index.h(index.Host, null, index.h("slot", { name: "trigger", ref: el => (this.triggerSlot = el) }), index.h("div", { class: "content", ref: el => (this.content = el) }, index.h("slot", { name: "content" }))));
2862
+ }
2863
+ get contentId() {
2864
+ return `cat-menu-${this.id}`;
2865
+ }
2866
+ show() {
2867
+ var _a;
2868
+ if (this.content) {
2869
+ this.content.style.display = 'block';
2870
+ (_a = this.trigger) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-expanded', 'true');
2871
+ this.catOpen.emit();
2872
+ this.trap = this.trap
2873
+ ? this.trap.updateContainerElements(this.content)
2874
+ : createFocusTrap(this.content, {
2875
+ tabbableOptions: {
2876
+ getShadowRoot: true
2877
+ },
2878
+ allowOutsideClick: true,
2879
+ clickOutsideDeactivates: event => !this.content || !event.composedPath().includes(this.content),
2880
+ onPostDeactivate: () => this.hide()
2881
+ });
2882
+ this.trap.activate();
2883
+ }
2884
+ }
2885
+ hide() {
2886
+ var _a;
2887
+ if (this.content) {
2888
+ this.content.style.display = '';
2889
+ (_a = this.trigger) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-expanded', 'false');
2890
+ this.catClose.emit();
2891
+ }
2892
+ }
2893
+ update() {
2894
+ if (this.trigger && this.content) {
2895
+ computePosition(this.trigger, this.content, {
2896
+ placement: this.placement,
2897
+ middleware: [offset(CatMenu.OFFSET), flip()]
2898
+ }).then(({ x, y }) => {
2899
+ if (this.content) {
2900
+ Object.assign(this.content.style, {
2901
+ left: `${x}px`,
2902
+ top: `${y}px`
2903
+ });
2904
+ }
2905
+ });
2906
+ }
2907
+ }
2908
+ };
2909
+ CatMenu.OFFSET = 4;
2910
+ CatMenu.style = catMenuCss;
2911
+
2912
+ const catRadioCss = ":host{display:flex;margin-bottom:1rem}:host([hidden]){display:none}label{display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;cursor:pointer}.radio{display:flex;position:relative}.circle{position:absolute;width:0.75rem;height:0.75rem;background-color:rgb(var(--cat-primary-bg, 32, 127, 138));border-radius:10rem;top:calc(50% - 0.375rem);left:calc(50% - 0.375rem);visibility:hidden}input{margin:0;width:1.25rem;height:1.25rem;appearance:none;background-color:white;border:1px solid #d7dbe0;border-radius:10rem;cursor:inherit}input:checked{border-color:rgb(var(--cat-primary-bg, 32, 127, 138))}input:checked+.circle{visibility:visible}input:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.is-disabled input{background-color:#f8f8fb}.is-disabled input:checked{border-color:#d7dbe0}.is-disabled .circle{background-color:#d7dbe0}";
2913
+
2914
+ let nextUniqueId$3 = 0;
2915
+ const CatRadio = class {
2916
+ constructor(hostRef) {
2917
+ index.registerInstance(this, hostRef);
2918
+ this.catChange = index.createEvent(this, "catChange", 7);
2919
+ this.catFocus = index.createEvent(this, "catFocus", 7);
2920
+ this.catBlur = index.createEvent(this, "catBlur", 7);
2921
+ this.id = `cat-radio-${++nextUniqueId$3}`;
2922
+ /**
2923
+ * Whether this radio is checked.
2924
+ */
2925
+ this.checked = false;
2926
+ /**
2927
+ * Whether this radio is disabled.
2928
+ */
2929
+ this.disabled = false;
2930
+ /**
2931
+ * The label of the radio that is visible.
2932
+ */
2933
+ this.label = '';
2934
+ /**
2935
+ * Visually hide the label, but still show it to assistive technologies like screen readers.
2936
+ */
2937
+ this.labelHidden = false;
2938
+ /**
2939
+ * Whether the radio is required.
2940
+ */
2941
+ this.required = false;
2942
+ }
2943
+ componentWillRender() {
2944
+ if (!this.label) {
2945
+ catIconRegistry.loglevel.error('[A11y] Missing ARIA label on radio', this);
2946
+ }
2947
+ }
2948
+ /**
2949
+ * Sets focus on the radio. Use this method instead of `radio.focus()`.
2950
+ *
2951
+ * @param options An optional object providing options to control aspects of
2952
+ * the focusing process.
2953
+ */
2954
+ async setFocus(options) {
2955
+ this.input.focus(options);
2956
+ }
2957
+ render() {
2958
+ return (index.h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } }, index.h("span", { class: "radio" }, index.h("input", { ref: el => (this.input = el), id: this.id, type: "radio", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onChange.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), index.h("span", { class: "circle" })), index.h("span", { class: "label", part: "label" }, this.label)));
2959
+ }
2960
+ onChange(event) {
2961
+ this.catChange.emit(event);
2962
+ }
2963
+ onFocus(event) {
2964
+ this.catFocus.emit(event);
2965
+ }
2966
+ onBlur(event) {
2967
+ this.catBlur.emit(event);
2968
+ }
2969
+ };
2970
+ CatRadio.style = catRadioCss;
2971
+
2972
+ function isFunction(value) {
2973
+ return typeof value === 'function';
2974
+ }
2975
+
2976
+ function createErrorClass(createImpl) {
2977
+ const _super = (instance) => {
2978
+ Error.call(instance);
2979
+ instance.stack = new Error().stack;
2980
+ };
2981
+ const ctorFunc = createImpl(_super);
2982
+ ctorFunc.prototype = Object.create(Error.prototype);
2983
+ ctorFunc.prototype.constructor = ctorFunc;
2984
+ return ctorFunc;
2985
+ }
2986
+
2987
+ const UnsubscriptionError = createErrorClass((_super) => function UnsubscriptionErrorImpl(errors) {
2988
+ _super(this);
2989
+ this.message = errors
2990
+ ? `${errors.length} errors occurred during unsubscription:
2991
+ ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}`
2992
+ : '';
2993
+ this.name = 'UnsubscriptionError';
2994
+ this.errors = errors;
2995
+ });
2996
+
2997
+ function arrRemove(arr, item) {
2998
+ if (arr) {
2999
+ const index = arr.indexOf(item);
3000
+ 0 <= index && arr.splice(index, 1);
3001
+ }
3002
+ }
3003
+
3004
+ class Subscription {
3005
+ constructor(initialTeardown) {
3006
+ this.initialTeardown = initialTeardown;
3007
+ this.closed = false;
3008
+ this._parentage = null;
3009
+ this._finalizers = null;
3010
+ }
3011
+ unsubscribe() {
3012
+ let errors;
3013
+ if (!this.closed) {
3014
+ this.closed = true;
3015
+ const { _parentage } = this;
3016
+ if (_parentage) {
3017
+ this._parentage = null;
3018
+ if (Array.isArray(_parentage)) {
3019
+ for (const parent of _parentage) {
3020
+ parent.remove(this);
3021
+ }
3022
+ }
3023
+ else {
3024
+ _parentage.remove(this);
3025
+ }
3026
+ }
3027
+ const { initialTeardown: initialFinalizer } = this;
3028
+ if (isFunction(initialFinalizer)) {
3029
+ try {
3030
+ initialFinalizer();
3031
+ }
3032
+ catch (e) {
3033
+ errors = e instanceof UnsubscriptionError ? e.errors : [e];
3034
+ }
3035
+ }
3036
+ const { _finalizers } = this;
3037
+ if (_finalizers) {
3038
+ this._finalizers = null;
3039
+ for (const finalizer of _finalizers) {
3040
+ try {
3041
+ execFinalizer(finalizer);
3042
+ }
3043
+ catch (err) {
3044
+ errors = errors !== null && errors !== void 0 ? errors : [];
3045
+ if (err instanceof UnsubscriptionError) {
3046
+ errors = [...errors, ...err.errors];
3047
+ }
3048
+ else {
3049
+ errors.push(err);
3050
+ }
3051
+ }
3052
+ }
3053
+ }
3054
+ if (errors) {
3055
+ throw new UnsubscriptionError(errors);
3056
+ }
3057
+ }
3058
+ }
3059
+ add(teardown) {
3060
+ var _a;
3061
+ if (teardown && teardown !== this) {
3062
+ if (this.closed) {
3063
+ execFinalizer(teardown);
3064
+ }
3065
+ else {
3066
+ if (teardown instanceof Subscription) {
3067
+ if (teardown.closed || teardown._hasParent(this)) {
3068
+ return;
3069
+ }
3070
+ teardown._addParent(this);
3071
+ }
3072
+ (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
3073
+ }
3074
+ }
3075
+ }
3076
+ _hasParent(parent) {
3077
+ const { _parentage } = this;
3078
+ return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
3079
+ }
3080
+ _addParent(parent) {
3081
+ const { _parentage } = this;
3082
+ this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
3083
+ }
3084
+ _removeParent(parent) {
3085
+ const { _parentage } = this;
3086
+ if (_parentage === parent) {
3087
+ this._parentage = null;
3088
+ }
3089
+ else if (Array.isArray(_parentage)) {
3090
+ arrRemove(_parentage, parent);
3091
+ }
3092
+ }
3093
+ remove(teardown) {
3094
+ const { _finalizers } = this;
3095
+ _finalizers && arrRemove(_finalizers, teardown);
3096
+ if (teardown instanceof Subscription) {
3097
+ teardown._removeParent(this);
3098
+ }
3099
+ }
3100
+ }
3101
+ Subscription.EMPTY = (() => {
3102
+ const empty = new Subscription();
3103
+ empty.closed = true;
3104
+ return empty;
3105
+ })();
3106
+ const EMPTY_SUBSCRIPTION = Subscription.EMPTY;
3107
+ function isSubscription(value) {
3108
+ return (value instanceof Subscription ||
3109
+ (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
3110
+ }
3111
+ function execFinalizer(finalizer) {
3112
+ if (isFunction(finalizer)) {
3113
+ finalizer();
3114
+ }
3115
+ else {
3116
+ finalizer.unsubscribe();
3117
+ }
3118
+ }
3119
+
3120
+ const config = {
3121
+ onUnhandledError: null,
3122
+ onStoppedNotification: null,
3123
+ Promise: undefined,
3124
+ useDeprecatedSynchronousErrorHandling: false,
3125
+ useDeprecatedNextContext: false,
3126
+ };
3127
+
3128
+ const timeoutProvider = {
3129
+ setTimeout(handler, timeout, ...args) {
3130
+ const { delegate } = timeoutProvider;
3131
+ if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
3132
+ return delegate.setTimeout(handler, timeout, ...args);
3133
+ }
3134
+ return setTimeout(handler, timeout, ...args);
3135
+ },
3136
+ clearTimeout(handle) {
3137
+ const { delegate } = timeoutProvider;
3138
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
3139
+ },
3140
+ delegate: undefined,
3141
+ };
3142
+
3143
+ function reportUnhandledError(err) {
3144
+ timeoutProvider.setTimeout(() => {
3145
+ const { onUnhandledError } = config;
3146
+ if (onUnhandledError) {
3147
+ onUnhandledError(err);
3148
+ }
3149
+ else {
3150
+ throw err;
3151
+ }
3152
+ });
3153
+ }
3154
+
3155
+ function noop() { }
3156
+
3157
+ const COMPLETE_NOTIFICATION = (() => createNotification('C', undefined, undefined))();
3158
+ function errorNotification(error) {
3159
+ return createNotification('E', undefined, error);
3160
+ }
3161
+ function nextNotification(value) {
3162
+ return createNotification('N', value, undefined);
3163
+ }
3164
+ function createNotification(kind, value, error) {
3165
+ return {
3166
+ kind,
3167
+ value,
3168
+ error,
3169
+ };
3170
+ }
3171
+
3172
+ function errorContext(cb) {
3173
+ {
3174
+ cb();
3175
+ }
3176
+ }
3177
+
3178
+ class Subscriber extends Subscription {
3179
+ constructor(destination) {
3180
+ super();
3181
+ this.isStopped = false;
3182
+ if (destination) {
3183
+ this.destination = destination;
3184
+ if (isSubscription(destination)) {
3185
+ destination.add(this);
3186
+ }
3187
+ }
3188
+ else {
3189
+ this.destination = EMPTY_OBSERVER;
3190
+ }
3191
+ }
3192
+ static create(next, error, complete) {
3193
+ return new SafeSubscriber(next, error, complete);
3194
+ }
3195
+ next(value) {
3196
+ if (this.isStopped) {
3197
+ handleStoppedNotification(nextNotification(value), this);
3198
+ }
3199
+ else {
3200
+ this._next(value);
3201
+ }
3202
+ }
3203
+ error(err) {
3204
+ if (this.isStopped) {
3205
+ handleStoppedNotification(errorNotification(err), this);
3206
+ }
3207
+ else {
3208
+ this.isStopped = true;
3209
+ this._error(err);
3210
+ }
3211
+ }
3212
+ complete() {
3213
+ if (this.isStopped) {
3214
+ handleStoppedNotification(COMPLETE_NOTIFICATION, this);
3215
+ }
3216
+ else {
3217
+ this.isStopped = true;
3218
+ this._complete();
3219
+ }
3220
+ }
3221
+ unsubscribe() {
3222
+ if (!this.closed) {
3223
+ this.isStopped = true;
3224
+ super.unsubscribe();
3225
+ this.destination = null;
3226
+ }
3227
+ }
3228
+ _next(value) {
3229
+ this.destination.next(value);
3230
+ }
3231
+ _error(err) {
3232
+ try {
3233
+ this.destination.error(err);
3234
+ }
3235
+ finally {
3236
+ this.unsubscribe();
3237
+ }
3238
+ }
3239
+ _complete() {
3240
+ try {
3241
+ this.destination.complete();
3242
+ }
3243
+ finally {
3244
+ this.unsubscribe();
3245
+ }
3246
+ }
3247
+ }
3248
+ const _bind = Function.prototype.bind;
3249
+ function bind(fn, thisArg) {
3250
+ return _bind.call(fn, thisArg);
3251
+ }
3252
+ class ConsumerObserver {
3253
+ constructor(partialObserver) {
3254
+ this.partialObserver = partialObserver;
3255
+ }
3256
+ next(value) {
3257
+ const { partialObserver } = this;
3258
+ if (partialObserver.next) {
3259
+ try {
3260
+ partialObserver.next(value);
3261
+ }
3262
+ catch (error) {
3263
+ handleUnhandledError(error);
3264
+ }
3265
+ }
3266
+ }
3267
+ error(err) {
3268
+ const { partialObserver } = this;
3269
+ if (partialObserver.error) {
3270
+ try {
3271
+ partialObserver.error(err);
3272
+ }
3273
+ catch (error) {
3274
+ handleUnhandledError(error);
3275
+ }
3276
+ }
3277
+ else {
3278
+ handleUnhandledError(err);
3279
+ }
3280
+ }
3281
+ complete() {
3282
+ const { partialObserver } = this;
3283
+ if (partialObserver.complete) {
3284
+ try {
3285
+ partialObserver.complete();
3286
+ }
3287
+ catch (error) {
3288
+ handleUnhandledError(error);
3289
+ }
3290
+ }
3291
+ }
3292
+ }
3293
+ class SafeSubscriber extends Subscriber {
3294
+ constructor(observerOrNext, error, complete) {
3295
+ super();
3296
+ let partialObserver;
3297
+ if (isFunction(observerOrNext) || !observerOrNext) {
3298
+ partialObserver = {
3299
+ next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined,
3300
+ error: error !== null && error !== void 0 ? error : undefined,
3301
+ complete: complete !== null && complete !== void 0 ? complete : undefined,
3302
+ };
3303
+ }
3304
+ else {
3305
+ let context;
3306
+ if (this && config.useDeprecatedNextContext) {
3307
+ context = Object.create(observerOrNext);
3308
+ context.unsubscribe = () => this.unsubscribe();
3309
+ partialObserver = {
3310
+ next: observerOrNext.next && bind(observerOrNext.next, context),
3311
+ error: observerOrNext.error && bind(observerOrNext.error, context),
3312
+ complete: observerOrNext.complete && bind(observerOrNext.complete, context),
3313
+ };
3314
+ }
3315
+ else {
3316
+ partialObserver = observerOrNext;
3317
+ }
3318
+ }
3319
+ this.destination = new ConsumerObserver(partialObserver);
3320
+ }
3321
+ }
3322
+ function handleUnhandledError(error) {
3323
+ {
3324
+ reportUnhandledError(error);
3325
+ }
3326
+ }
3327
+ function defaultErrorHandler(err) {
3328
+ throw err;
3329
+ }
3330
+ function handleStoppedNotification(notification, subscriber) {
3331
+ const { onStoppedNotification } = config;
3332
+ onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber));
3333
+ }
3334
+ const EMPTY_OBSERVER = {
3335
+ closed: true,
3336
+ next: noop,
3337
+ error: defaultErrorHandler,
3338
+ complete: noop,
3339
+ };
3340
+
3341
+ const observable = (() => (typeof Symbol === 'function' && Symbol.observable) || '@@observable')();
3342
+
3343
+ function identity(x) {
3344
+ return x;
3345
+ }
3346
+
3347
+ function pipeFromArray(fns) {
3348
+ if (fns.length === 0) {
3349
+ return identity;
3350
+ }
3351
+ if (fns.length === 1) {
3352
+ return fns[0];
3353
+ }
3354
+ return function piped(input) {
3355
+ return fns.reduce((prev, fn) => fn(prev), input);
3356
+ };
3357
+ }
3358
+
3359
+ class Observable {
3360
+ constructor(subscribe) {
3361
+ if (subscribe) {
3362
+ this._subscribe = subscribe;
3363
+ }
3364
+ }
3365
+ lift(operator) {
3366
+ const observable = new Observable();
3367
+ observable.source = this;
3368
+ observable.operator = operator;
3369
+ return observable;
3370
+ }
3371
+ subscribe(observerOrNext, error, complete) {
3372
+ const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
3373
+ errorContext(() => {
3374
+ const { operator, source } = this;
3375
+ subscriber.add(operator
3376
+ ?
3377
+ operator.call(subscriber, source)
3378
+ : source
3379
+ ?
3380
+ this._subscribe(subscriber)
3381
+ :
3382
+ this._trySubscribe(subscriber));
3383
+ });
3384
+ return subscriber;
3385
+ }
3386
+ _trySubscribe(sink) {
3387
+ try {
3388
+ return this._subscribe(sink);
3389
+ }
3390
+ catch (err) {
3391
+ sink.error(err);
3392
+ }
3393
+ }
3394
+ forEach(next, promiseCtor) {
3395
+ promiseCtor = getPromiseCtor(promiseCtor);
3396
+ return new promiseCtor((resolve, reject) => {
3397
+ const subscriber = new SafeSubscriber({
3398
+ next: (value) => {
3399
+ try {
3400
+ next(value);
3401
+ }
3402
+ catch (err) {
3403
+ reject(err);
3404
+ subscriber.unsubscribe();
3405
+ }
3406
+ },
3407
+ error: reject,
3408
+ complete: resolve,
3409
+ });
3410
+ this.subscribe(subscriber);
3411
+ });
3412
+ }
3413
+ _subscribe(subscriber) {
3414
+ var _a;
3415
+ return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
3416
+ }
3417
+ [observable]() {
3418
+ return this;
3419
+ }
3420
+ pipe(...operations) {
3421
+ return pipeFromArray(operations)(this);
3422
+ }
3423
+ toPromise(promiseCtor) {
3424
+ promiseCtor = getPromiseCtor(promiseCtor);
3425
+ return new promiseCtor((resolve, reject) => {
3426
+ let value;
3427
+ this.subscribe((x) => (value = x), (err) => reject(err), () => resolve(value));
3428
+ });
3429
+ }
3430
+ }
3431
+ Observable.create = (subscribe) => {
3432
+ return new Observable(subscribe);
3433
+ };
3434
+ function getPromiseCtor(promiseCtor) {
3435
+ var _a;
3436
+ return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
3437
+ }
3438
+ function isObserver(value) {
3439
+ return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
3440
+ }
3441
+ function isSubscriber(value) {
3442
+ return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
3443
+ }
3444
+
3445
+ function hasLift(source) {
3446
+ return isFunction(source === null || source === void 0 ? void 0 : source.lift);
3447
+ }
3448
+ function operate(init) {
3449
+ return (source) => {
3450
+ if (hasLift(source)) {
3451
+ return source.lift(function (liftedSource) {
3452
+ try {
3453
+ return init(liftedSource, this);
3454
+ }
3455
+ catch (err) {
3456
+ this.error(err);
3457
+ }
3458
+ });
3459
+ }
3460
+ throw new TypeError('Unable to lift unknown Observable type');
3461
+ };
3462
+ }
3463
+
3464
+ function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
3465
+ return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
3466
+ }
3467
+ class OperatorSubscriber extends Subscriber {
3468
+ constructor(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
3469
+ super(destination);
3470
+ this.onFinalize = onFinalize;
3471
+ this.shouldUnsubscribe = shouldUnsubscribe;
3472
+ this._next = onNext
3473
+ ? function (value) {
3474
+ try {
3475
+ onNext(value);
3476
+ }
3477
+ catch (err) {
3478
+ destination.error(err);
3479
+ }
3480
+ }
3481
+ : super._next;
3482
+ this._error = onError
3483
+ ? function (err) {
3484
+ try {
3485
+ onError(err);
3486
+ }
3487
+ catch (err) {
3488
+ destination.error(err);
3489
+ }
3490
+ finally {
3491
+ this.unsubscribe();
3492
+ }
3493
+ }
3494
+ : super._error;
3495
+ this._complete = onComplete
3496
+ ? function () {
3497
+ try {
3498
+ onComplete();
3499
+ }
3500
+ catch (err) {
3501
+ destination.error(err);
3502
+ }
3503
+ finally {
3504
+ this.unsubscribe();
3505
+ }
3506
+ }
3507
+ : super._complete;
3508
+ }
3509
+ unsubscribe() {
3510
+ var _a;
3511
+ if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
3512
+ const { closed } = this;
3513
+ super.unsubscribe();
3514
+ !closed && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
3515
+ }
3516
+ }
3517
+ }
3518
+
3519
+ const ObjectUnsubscribedError = createErrorClass((_super) => function ObjectUnsubscribedErrorImpl() {
3520
+ _super(this);
3521
+ this.name = 'ObjectUnsubscribedError';
3522
+ this.message = 'object unsubscribed';
3523
+ });
3524
+
3525
+ class Subject extends Observable {
3526
+ constructor() {
3527
+ super();
3528
+ this.closed = false;
3529
+ this.currentObservers = null;
3530
+ this.observers = [];
3531
+ this.isStopped = false;
3532
+ this.hasError = false;
3533
+ this.thrownError = null;
3534
+ }
3535
+ lift(operator) {
3536
+ const subject = new AnonymousSubject(this, this);
3537
+ subject.operator = operator;
3538
+ return subject;
3539
+ }
3540
+ _throwIfClosed() {
3541
+ if (this.closed) {
3542
+ throw new ObjectUnsubscribedError();
3543
+ }
3544
+ }
3545
+ next(value) {
3546
+ errorContext(() => {
3547
+ this._throwIfClosed();
3548
+ if (!this.isStopped) {
3549
+ if (!this.currentObservers) {
3550
+ this.currentObservers = Array.from(this.observers);
3551
+ }
3552
+ for (const observer of this.currentObservers) {
3553
+ observer.next(value);
3554
+ }
3555
+ }
3556
+ });
3557
+ }
3558
+ error(err) {
3559
+ errorContext(() => {
3560
+ this._throwIfClosed();
3561
+ if (!this.isStopped) {
3562
+ this.hasError = this.isStopped = true;
3563
+ this.thrownError = err;
3564
+ const { observers } = this;
3565
+ while (observers.length) {
3566
+ observers.shift().error(err);
3567
+ }
3568
+ }
3569
+ });
3570
+ }
3571
+ complete() {
3572
+ errorContext(() => {
3573
+ this._throwIfClosed();
3574
+ if (!this.isStopped) {
3575
+ this.isStopped = true;
3576
+ const { observers } = this;
3577
+ while (observers.length) {
3578
+ observers.shift().complete();
3579
+ }
3580
+ }
3581
+ });
3582
+ }
3583
+ unsubscribe() {
3584
+ this.isStopped = this.closed = true;
3585
+ this.observers = this.currentObservers = null;
3586
+ }
3587
+ get observed() {
3588
+ var _a;
3589
+ return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
3590
+ }
3591
+ _trySubscribe(subscriber) {
3592
+ this._throwIfClosed();
3593
+ return super._trySubscribe(subscriber);
3594
+ }
3595
+ _subscribe(subscriber) {
3596
+ this._throwIfClosed();
3597
+ this._checkFinalizedStatuses(subscriber);
3598
+ return this._innerSubscribe(subscriber);
3599
+ }
3600
+ _innerSubscribe(subscriber) {
3601
+ const { hasError, isStopped, observers } = this;
3602
+ if (hasError || isStopped) {
3603
+ return EMPTY_SUBSCRIPTION;
3604
+ }
3605
+ this.currentObservers = null;
3606
+ observers.push(subscriber);
3607
+ return new Subscription(() => {
3608
+ this.currentObservers = null;
3609
+ arrRemove(observers, subscriber);
3610
+ });
3611
+ }
3612
+ _checkFinalizedStatuses(subscriber) {
3613
+ const { hasError, thrownError, isStopped } = this;
3614
+ if (hasError) {
3615
+ subscriber.error(thrownError);
3616
+ }
3617
+ else if (isStopped) {
3618
+ subscriber.complete();
3619
+ }
3620
+ }
3621
+ asObservable() {
3622
+ const observable = new Observable();
3623
+ observable.source = this;
3624
+ return observable;
3625
+ }
3626
+ }
3627
+ Subject.create = (destination, source) => {
3628
+ return new AnonymousSubject(destination, source);
3629
+ };
3630
+ class AnonymousSubject extends Subject {
3631
+ constructor(destination, source) {
3632
+ super();
3633
+ this.destination = destination;
3634
+ this.source = source;
3635
+ }
3636
+ next(value) {
3637
+ var _a, _b;
3638
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
3639
+ }
3640
+ error(err) {
3641
+ var _a, _b;
3642
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
3643
+ }
3644
+ complete() {
3645
+ var _a, _b;
3646
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
3647
+ }
3648
+ _subscribe(subscriber) {
3649
+ var _a, _b;
3650
+ return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
3651
+ }
3652
+ }
3653
+
3654
+ const EMPTY = new Observable((subscriber) => subscriber.complete());
3655
+
3656
+ function isScheduler(value) {
3657
+ return value && isFunction(value.schedule);
3658
+ }
3659
+
3660
+ function last(arr) {
3661
+ return arr[arr.length - 1];
3662
+ }
3663
+ function popScheduler(args) {
3664
+ return isScheduler(last(args)) ? args.pop() : undefined;
3665
+ }
3666
+ function popNumber(args, defaultValue) {
3667
+ return typeof last(args) === 'number' ? args.pop() : defaultValue;
3668
+ }
3669
+
3670
+ /******************************************************************************
3671
+ Copyright (c) Microsoft Corporation.
3672
+
3673
+ Permission to use, copy, modify, and/or distribute this software for any
3674
+ purpose with or without fee is hereby granted.
3675
+
3676
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
3677
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
3678
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
3679
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
3680
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
3681
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
3682
+ PERFORMANCE OF THIS SOFTWARE.
3683
+ ***************************************************************************** */
3684
+
3685
+ function __awaiter(thisArg, _arguments, P, generator) {
3686
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3687
+ return new (P || (P = Promise))(function (resolve, reject) {
3688
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
3689
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
3690
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
3691
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
3692
+ });
3693
+ }
3694
+
3695
+ function __values(o) {
3696
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3697
+ if (m) return m.call(o);
3698
+ if (o && typeof o.length === "number") return {
3699
+ next: function () {
3700
+ if (o && i >= o.length) o = void 0;
3701
+ return { value: o && o[i++], done: !o };
3702
+ }
3703
+ };
3704
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
3705
+ }
3706
+
3707
+ function __await(v) {
3708
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
3709
+ }
3710
+
3711
+ function __asyncGenerator(thisArg, _arguments, generator) {
3712
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
3713
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
3714
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
3715
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
3716
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
3717
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
3718
+ function fulfill(value) { resume("next", value); }
3719
+ function reject(value) { resume("throw", value); }
3720
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
3721
+ }
3722
+
3723
+ function __asyncValues(o) {
3724
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
3725
+ var m = o[Symbol.asyncIterator], i;
3726
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
3727
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
3728
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
3729
+ }
3730
+
3731
+ const isArrayLike = ((x) => x && typeof x.length === 'number' && typeof x !== 'function');
3732
+
3733
+ function isPromise(value) {
3734
+ return isFunction(value === null || value === void 0 ? void 0 : value.then);
3735
+ }
3736
+
3737
+ function isInteropObservable(input) {
3738
+ return isFunction(input[observable]);
3739
+ }
3740
+
3741
+ function isAsyncIterable(obj) {
3742
+ return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
3743
+ }
3744
+
3745
+ function createInvalidObservableTypeError(input) {
3746
+ return new TypeError(`You provided ${input !== null && typeof input === 'object' ? 'an invalid object' : `'${input}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`);
3747
+ }
3748
+
3749
+ function getSymbolIterator() {
3750
+ if (typeof Symbol !== 'function' || !Symbol.iterator) {
3751
+ return '@@iterator';
3752
+ }
3753
+ return Symbol.iterator;
3754
+ }
3755
+ const iterator = getSymbolIterator();
3756
+
3757
+ function isIterable(input) {
3758
+ return isFunction(input === null || input === void 0 ? void 0 : input[iterator]);
3759
+ }
3760
+
3761
+ function readableStreamLikeToAsyncGenerator(readableStream) {
3762
+ return __asyncGenerator(this, arguments, function* readableStreamLikeToAsyncGenerator_1() {
3763
+ const reader = readableStream.getReader();
3764
+ try {
3765
+ while (true) {
3766
+ const { value, done } = yield __await(reader.read());
3767
+ if (done) {
3768
+ return yield __await(void 0);
3769
+ }
3770
+ yield yield __await(value);
3771
+ }
3772
+ }
3773
+ finally {
3774
+ reader.releaseLock();
3775
+ }
3776
+ });
3777
+ }
3778
+ function isReadableStreamLike(obj) {
3779
+ return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
3780
+ }
3781
+
3782
+ function innerFrom(input) {
3783
+ if (input instanceof Observable) {
3784
+ return input;
3785
+ }
3786
+ if (input != null) {
3787
+ if (isInteropObservable(input)) {
3788
+ return fromInteropObservable(input);
3789
+ }
3790
+ if (isArrayLike(input)) {
3791
+ return fromArrayLike(input);
3792
+ }
3793
+ if (isPromise(input)) {
3794
+ return fromPromise(input);
3795
+ }
3796
+ if (isAsyncIterable(input)) {
3797
+ return fromAsyncIterable(input);
3798
+ }
3799
+ if (isIterable(input)) {
3800
+ return fromIterable(input);
3801
+ }
3802
+ if (isReadableStreamLike(input)) {
3803
+ return fromReadableStreamLike(input);
3804
+ }
3805
+ }
3806
+ throw createInvalidObservableTypeError(input);
3807
+ }
3808
+ function fromInteropObservable(obj) {
3809
+ return new Observable((subscriber) => {
3810
+ const obs = obj[observable]();
3811
+ if (isFunction(obs.subscribe)) {
3812
+ return obs.subscribe(subscriber);
3813
+ }
3814
+ throw new TypeError('Provided object does not correctly implement Symbol.observable');
3815
+ });
3816
+ }
3817
+ function fromArrayLike(array) {
3818
+ return new Observable((subscriber) => {
3819
+ for (let i = 0; i < array.length && !subscriber.closed; i++) {
3820
+ subscriber.next(array[i]);
3821
+ }
3822
+ subscriber.complete();
3823
+ });
3824
+ }
3825
+ function fromPromise(promise) {
3826
+ return new Observable((subscriber) => {
3827
+ promise
3828
+ .then((value) => {
3829
+ if (!subscriber.closed) {
3830
+ subscriber.next(value);
3831
+ subscriber.complete();
3832
+ }
3833
+ }, (err) => subscriber.error(err))
3834
+ .then(null, reportUnhandledError);
3835
+ });
3836
+ }
3837
+ function fromIterable(iterable) {
3838
+ return new Observable((subscriber) => {
3839
+ for (const value of iterable) {
3840
+ subscriber.next(value);
3841
+ if (subscriber.closed) {
3842
+ return;
3843
+ }
3844
+ }
3845
+ subscriber.complete();
3846
+ });
3847
+ }
3848
+ function fromAsyncIterable(asyncIterable) {
3849
+ return new Observable((subscriber) => {
3850
+ process(asyncIterable, subscriber).catch((err) => subscriber.error(err));
3851
+ });
3852
+ }
3853
+ function fromReadableStreamLike(readableStream) {
3854
+ return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
3855
+ }
3856
+ function process(asyncIterable, subscriber) {
3857
+ var asyncIterable_1, asyncIterable_1_1;
3858
+ var e_1, _a;
3859
+ return __awaiter(this, void 0, void 0, function* () {
3860
+ try {
3861
+ for (asyncIterable_1 = __asyncValues(asyncIterable); asyncIterable_1_1 = yield asyncIterable_1.next(), !asyncIterable_1_1.done;) {
3862
+ const value = asyncIterable_1_1.value;
3863
+ subscriber.next(value);
3864
+ if (subscriber.closed) {
3865
+ return;
3866
+ }
3867
+ }
3868
+ }
3869
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3870
+ finally {
3871
+ try {
3872
+ if (asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return)) yield _a.call(asyncIterable_1);
3873
+ }
3874
+ finally { if (e_1) throw e_1.error; }
3875
+ }
3876
+ subscriber.complete();
3877
+ });
3878
+ }
3879
+
3880
+ function executeSchedule(parentSubscription, scheduler, work, delay = 0, repeat = false) {
3881
+ const scheduleSubscription = scheduler.schedule(function () {
3882
+ work();
3883
+ if (repeat) {
3884
+ parentSubscription.add(this.schedule(null, delay));
3885
+ }
3886
+ else {
3887
+ this.unsubscribe();
3888
+ }
3889
+ }, delay);
3890
+ parentSubscription.add(scheduleSubscription);
3891
+ if (!repeat) {
3892
+ return scheduleSubscription;
3893
+ }
3894
+ }
3895
+
3896
+ function observeOn(scheduler, delay = 0) {
3897
+ return operate((source, subscriber) => {
3898
+ source.subscribe(createOperatorSubscriber(subscriber, (value) => executeSchedule(subscriber, scheduler, () => subscriber.next(value), delay), () => executeSchedule(subscriber, scheduler, () => subscriber.complete(), delay), (err) => executeSchedule(subscriber, scheduler, () => subscriber.error(err), delay)));
3899
+ });
3900
+ }
3901
+
3902
+ function subscribeOn(scheduler, delay = 0) {
3903
+ return operate((source, subscriber) => {
3904
+ subscriber.add(scheduler.schedule(() => source.subscribe(subscriber), delay));
3905
+ });
3906
+ }
3907
+
3908
+ function scheduleObservable(input, scheduler) {
3909
+ return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
3910
+ }
3911
+
3912
+ function schedulePromise(input, scheduler) {
3913
+ return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
3914
+ }
3915
+
3916
+ function scheduleArray(input, scheduler) {
3917
+ return new Observable((subscriber) => {
3918
+ let i = 0;
3919
+ return scheduler.schedule(function () {
3920
+ if (i === input.length) {
3921
+ subscriber.complete();
3922
+ }
3923
+ else {
3924
+ subscriber.next(input[i++]);
3925
+ if (!subscriber.closed) {
3926
+ this.schedule();
3927
+ }
3928
+ }
3929
+ });
3930
+ });
3931
+ }
3932
+
3933
+ function scheduleIterable(input, scheduler) {
3934
+ return new Observable((subscriber) => {
3935
+ let iterator$1;
3936
+ executeSchedule(subscriber, scheduler, () => {
3937
+ iterator$1 = input[iterator]();
3938
+ executeSchedule(subscriber, scheduler, () => {
3939
+ let value;
3940
+ let done;
3941
+ try {
3942
+ ({ value, done } = iterator$1.next());
3943
+ }
3944
+ catch (err) {
3945
+ subscriber.error(err);
3946
+ return;
3947
+ }
3948
+ if (done) {
3949
+ subscriber.complete();
3950
+ }
3951
+ else {
3952
+ subscriber.next(value);
3953
+ }
3954
+ }, 0, true);
3955
+ });
3956
+ return () => isFunction(iterator$1 === null || iterator$1 === void 0 ? void 0 : iterator$1.return) && iterator$1.return();
3957
+ });
3958
+ }
3959
+
3960
+ function scheduleAsyncIterable(input, scheduler) {
3961
+ if (!input) {
3962
+ throw new Error('Iterable cannot be null');
3963
+ }
3964
+ return new Observable((subscriber) => {
3965
+ executeSchedule(subscriber, scheduler, () => {
3966
+ const iterator = input[Symbol.asyncIterator]();
3967
+ executeSchedule(subscriber, scheduler, () => {
3968
+ iterator.next().then((result) => {
3969
+ if (result.done) {
3970
+ subscriber.complete();
3971
+ }
3972
+ else {
3973
+ subscriber.next(result.value);
3974
+ }
3975
+ });
3976
+ }, 0, true);
3977
+ });
3978
+ });
3979
+ }
3980
+
3981
+ function scheduleReadableStreamLike(input, scheduler) {
3982
+ return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);
3983
+ }
3984
+
3985
+ function scheduled(input, scheduler) {
3986
+ if (input != null) {
3987
+ if (isInteropObservable(input)) {
3988
+ return scheduleObservable(input, scheduler);
3989
+ }
3990
+ if (isArrayLike(input)) {
3991
+ return scheduleArray(input, scheduler);
3992
+ }
3993
+ if (isPromise(input)) {
3994
+ return schedulePromise(input, scheduler);
3995
+ }
3996
+ if (isAsyncIterable(input)) {
3997
+ return scheduleAsyncIterable(input, scheduler);
3998
+ }
3999
+ if (isIterable(input)) {
4000
+ return scheduleIterable(input, scheduler);
4001
+ }
4002
+ if (isReadableStreamLike(input)) {
4003
+ return scheduleReadableStreamLike(input, scheduler);
4004
+ }
4005
+ }
4006
+ throw createInvalidObservableTypeError(input);
4007
+ }
4008
+
4009
+ function from(input, scheduler) {
4010
+ return scheduler ? scheduled(input, scheduler) : innerFrom(input);
4011
+ }
4012
+
4013
+ function map(project, thisArg) {
4014
+ return operate((source, subscriber) => {
4015
+ let index = 0;
4016
+ source.subscribe(createOperatorSubscriber(subscriber, (value) => {
4017
+ subscriber.next(project.call(thisArg, value, index++));
4018
+ }));
4019
+ });
4020
+ }
4021
+
4022
+ const { isArray } = Array;
4023
+ function callOrApply(fn, args) {
4024
+ return isArray(args) ? fn(...args) : fn(args);
4025
+ }
4026
+ function mapOneOrManyArgs(fn) {
4027
+ return map(args => callOrApply(fn, args));
4028
+ }
4029
+
4030
+ function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
4031
+ const buffer = [];
4032
+ let active = 0;
4033
+ let index = 0;
4034
+ let isComplete = false;
4035
+ const checkComplete = () => {
4036
+ if (isComplete && !buffer.length && !active) {
4037
+ subscriber.complete();
4038
+ }
4039
+ };
4040
+ const outerNext = (value) => (active < concurrent ? doInnerSub(value) : buffer.push(value));
4041
+ const doInnerSub = (value) => {
4042
+ expand && subscriber.next(value);
4043
+ active++;
4044
+ let innerComplete = false;
4045
+ innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, (innerValue) => {
4046
+ onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);
4047
+ if (expand) {
4048
+ outerNext(innerValue);
4049
+ }
4050
+ else {
4051
+ subscriber.next(innerValue);
4052
+ }
4053
+ }, () => {
4054
+ innerComplete = true;
4055
+ }, undefined, () => {
4056
+ if (innerComplete) {
4057
+ try {
4058
+ active--;
4059
+ while (buffer.length && active < concurrent) {
4060
+ const bufferedValue = buffer.shift();
4061
+ if (innerSubScheduler) {
4062
+ executeSchedule(subscriber, innerSubScheduler, () => doInnerSub(bufferedValue));
4063
+ }
4064
+ else {
4065
+ doInnerSub(bufferedValue);
4066
+ }
4067
+ }
4068
+ checkComplete();
4069
+ }
4070
+ catch (err) {
4071
+ subscriber.error(err);
4072
+ }
4073
+ }
4074
+ }));
4075
+ };
4076
+ source.subscribe(createOperatorSubscriber(subscriber, outerNext, () => {
4077
+ isComplete = true;
4078
+ checkComplete();
4079
+ }));
4080
+ return () => {
4081
+ additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
4082
+ };
4083
+ }
4084
+
4085
+ function mergeMap(project, resultSelector, concurrent = Infinity) {
4086
+ if (isFunction(resultSelector)) {
4087
+ return mergeMap((a, i) => map((b, ii) => resultSelector(a, b, i, ii))(innerFrom(project(a, i))), concurrent);
4088
+ }
4089
+ else if (typeof resultSelector === 'number') {
4090
+ concurrent = resultSelector;
4091
+ }
4092
+ return operate((source, subscriber) => mergeInternals(source, subscriber, project, concurrent));
4093
+ }
4094
+
4095
+ function mergeAll(concurrent = Infinity) {
4096
+ return mergeMap(identity, concurrent);
4097
+ }
4098
+
4099
+ const nodeEventEmitterMethods = ['addListener', 'removeListener'];
4100
+ const eventTargetMethods = ['addEventListener', 'removeEventListener'];
4101
+ const jqueryMethods = ['on', 'off'];
4102
+ function fromEvent(target, eventName, options, resultSelector) {
4103
+ if (isFunction(options)) {
4104
+ resultSelector = options;
4105
+ options = undefined;
4106
+ }
4107
+ if (resultSelector) {
4108
+ return fromEvent(target, eventName, options).pipe(mapOneOrManyArgs(resultSelector));
4109
+ }
4110
+ const [add, remove] = isEventTarget(target)
4111
+ ? eventTargetMethods.map((methodName) => (handler) => target[methodName](eventName, handler, options))
4112
+ :
4113
+ isNodeStyleEventEmitter(target)
4114
+ ? nodeEventEmitterMethods.map(toCommonHandlerRegistry(target, eventName))
4115
+ : isJQueryStyleEventEmitter(target)
4116
+ ? jqueryMethods.map(toCommonHandlerRegistry(target, eventName))
4117
+ : [];
4118
+ if (!add) {
4119
+ if (isArrayLike(target)) {
4120
+ return mergeMap((subTarget) => fromEvent(subTarget, eventName, options))(innerFrom(target));
4121
+ }
4122
+ }
4123
+ if (!add) {
4124
+ throw new TypeError('Invalid event target');
4125
+ }
4126
+ return new Observable((subscriber) => {
4127
+ const handler = (...args) => subscriber.next(1 < args.length ? args : args[0]);
4128
+ add(handler);
4129
+ return () => remove(handler);
4130
+ });
4131
+ }
4132
+ function toCommonHandlerRegistry(target, eventName) {
4133
+ return (methodName) => (handler) => target[methodName](eventName, handler);
4134
+ }
4135
+ function isNodeStyleEventEmitter(target) {
4136
+ return isFunction(target.addListener) && isFunction(target.removeListener);
4137
+ }
4138
+ function isJQueryStyleEventEmitter(target) {
4139
+ return isFunction(target.on) && isFunction(target.off);
4140
+ }
4141
+ function isEventTarget(target) {
4142
+ return isFunction(target.addEventListener) && isFunction(target.removeEventListener);
4143
+ }
4144
+
4145
+ function merge(...args) {
4146
+ const scheduler = popScheduler(args);
4147
+ const concurrent = popNumber(args, Infinity);
4148
+ const sources = args;
4149
+ return !sources.length
4150
+ ?
4151
+ EMPTY
4152
+ : sources.length === 1
4153
+ ?
4154
+ innerFrom(sources[0])
4155
+ :
4156
+ mergeAll(concurrent)(from(sources, scheduler));
4157
+ }
4158
+
4159
+ function filter(predicate, thisArg) {
4160
+ return operate((source, subscriber) => {
4161
+ let index = 0;
4162
+ source.subscribe(createOperatorSubscriber(subscriber, (value) => predicate.call(thisArg, value, index++) && subscriber.next(value)));
4163
+ });
4164
+ }
4165
+
4166
+ function distinctUntilChanged(comparator, keySelector = identity) {
4167
+ comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;
4168
+ return operate((source, subscriber) => {
4169
+ let previousKey;
4170
+ let first = true;
4171
+ source.subscribe(createOperatorSubscriber(subscriber, (value) => {
4172
+ const currentKey = keySelector(value);
4173
+ if (first || !comparator(previousKey, currentKey)) {
4174
+ first = false;
4175
+ previousKey = currentKey;
4176
+ subscriber.next(value);
4177
+ }
4178
+ }));
4179
+ });
4180
+ }
4181
+ function defaultCompare(a, b) {
4182
+ return a === b;
4183
+ }
4184
+
4185
+ function takeUntil(notifier) {
4186
+ return operate((source, subscriber) => {
4187
+ innerFrom(notifier).subscribe(createOperatorSubscriber(subscriber, () => subscriber.complete(), noop));
4188
+ !subscriber.closed && source.subscribe(subscriber);
4189
+ });
4190
+ }
4191
+
4192
+ const catScrollableCss = ":host{overflow:hidden;position:relative;display:flex}:host([hidden]){display:none}.shadow-bottom,.shadow-right,.shadow-left,.shadow-top{position:absolute;transition:box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1)}.shadow-top{z-index:2;width:100%;top:0}.shadow-left{z-index:4;height:100%;left:0}.shadow-right{z-index:4;height:100%;right:0}.shadow-bottom{z-index:2;width:100%;bottom:0}.scrollable-wrapper{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none}.scrollable-wrapper.cat-scrollable-top .shadow-top,.scrollable-wrapper.cat-scrollable-bottom .shadow-bottom,.scrollable-wrapper.cat-scrollable-left .shadow-left,.scrollable-wrapper.cat-scrollable-right .shadow-right{box-shadow:0 0 4px 1px rgba(16, 29, 48, 0.2)}.scrollable-content{overflow:hidden;white-space:nowrap}.scrollable-content.scroll-x{overflow-x:auto}.scrollable-content.scroll-y{overflow-y:auto}.scrollable-content.no-overscroll{overscroll-behavior:contain}";
4193
+
4194
+ const CatScrollable = class {
4195
+ constructor(hostRef) {
4196
+ index.registerInstance(this, hostRef);
4197
+ this.scrolledTop = index.createEvent(this, "scrolledTop", 7);
4198
+ this.scrolledLeft = index.createEvent(this, "scrolledLeft", 7);
4199
+ this.scrolledRight = index.createEvent(this, "scrolledRight", 7);
4200
+ this.scrolledBottom = index.createEvent(this, "scrolledBottom", 7);
4201
+ this.init = new Subject();
4202
+ this.destroyed = new Subject();
4203
+ /** Flags to enable/disable scroll shadowX. */
4204
+ this.shadowX = true;
4205
+ /** Flags to enable/disable scroll shadowY. */
4206
+ this.shadowY = true;
4207
+ /** Flags to enable/disable overflowX. */
4208
+ this.overflowX = true;
4209
+ /** Flags to enable/disable overflowY. */
4210
+ this.overflowY = true;
4211
+ /** Flag to enable/disable overscroll behavior. */
4212
+ this.overscroll = true;
4213
+ /**
4214
+ * Flag to fire an initial event after content initialization.
4215
+ */
4216
+ this.scrolledInit = true;
4217
+ /**
4218
+ * Buffer to be used to calculate the scroll distance.
4219
+ */
4220
+ this.scrolledBuffer = 0;
4221
+ }
4222
+ componentDidRender() {
4223
+ if (this.scrollElement) {
4224
+ this.scrolled = fromEvent(this.scrollElement, 'scroll').pipe(takeUntil(this.destroyed));
4225
+ }
4226
+ this.attachEmitter('left', this.scrolledLeft, this.scrolledBuffer);
4227
+ this.attachEmitter('right', this.scrolledRight, this.scrolledBuffer);
4228
+ this.attachEmitter('bottom', this.scrolledBottom, this.scrolledBuffer);
4229
+ this.attachEmitter('top', this.scrolledTop, this.scrolledBuffer);
4230
+ merge(this.init, this.scrolled)
4231
+ .pipe(map(() => ({
4232
+ top: this.getScrollOffset('top') > 0,
4233
+ left: this.getScrollOffset('left') > 0,
4234
+ right: this.getScrollOffset('right') > 0,
4235
+ bottom: this.getScrollOffset('bottom') > 0
4236
+ })), distinctUntilChanged(), takeUntil(this.destroyed))
4237
+ .subscribe(({ top, left, right, bottom }) => {
4238
+ this.toggleClass('cat-scrollable-top', top);
4239
+ this.toggleClass('cat-scrollable-left', left);
4240
+ this.toggleClass('cat-scrollable-right', right);
4241
+ this.toggleClass('cat-scrollable-bottom', bottom);
4242
+ });
4243
+ }
4244
+ componentDidLoad() {
4245
+ if (this.scrolledInit) {
4246
+ this.init.next();
4247
+ }
4248
+ }
4249
+ disconnectedCallback() {
4250
+ this.init.complete();
4251
+ this.destroyed.next();
4252
+ this.destroyed.complete();
4253
+ }
4254
+ render() {
4255
+ return [
4256
+ index.h("div", { class: "scrollable-wrapper", ref: el => (this.scrollWrapperElement = el) }, this.shadowY && index.h("div", { class: "shadow-top" }), this.shadowX && index.h("div", { class: "shadow-left" }), this.shadowX && index.h("div", { class: "shadow-right" }), this.shadowY && index.h("div", { class: "shadow-bottom" })),
4257
+ index.h("div", { ref: el => (this.scrollElement = el), class: {
4258
+ 'scrollable-content': true,
4259
+ 'scroll-x': this.overflowX,
4260
+ 'scroll-y': this.overflowY,
4261
+ 'no-overscroll': !this.overscroll
4262
+ } }, index.h("slot", null))
4263
+ ];
4264
+ }
4265
+ attachEmitter(from, emitter, buffer) {
4266
+ merge(this.init, this.scrolled)
4267
+ .pipe(map(() => this.getScrollOffset(from)))
4268
+ .pipe(map(offset => offset <= buffer))
4269
+ .pipe(distinctUntilChanged())
4270
+ .pipe(filter(isLower => isLower))
4271
+ .pipe(takeUntil(this.destroyed))
4272
+ .subscribe(() => emitter.emit());
4273
+ }
4274
+ getScrollOffset(from) {
4275
+ if (this.scrollElement) {
4276
+ switch (from) {
4277
+ case 'top':
4278
+ return this.scrollElement.scrollTop;
4279
+ case 'left':
4280
+ return this.scrollElement.scrollLeft;
4281
+ case 'right':
4282
+ return this.scrollElement.scrollWidth - this.scrollElement.clientWidth - this.scrollElement.scrollLeft;
4283
+ case 'bottom':
4284
+ return this.scrollElement.scrollHeight - this.scrollElement.clientHeight - this.scrollElement.scrollTop;
4285
+ default:
4286
+ return 0;
4287
+ }
4288
+ }
4289
+ return 0;
4290
+ }
4291
+ toggleClass(name, value) {
4292
+ var _a, _b;
4293
+ if (value) {
4294
+ (_a = this.scrollWrapperElement) === null || _a === void 0 ? void 0 : _a.classList.add(name);
4295
+ }
4296
+ else {
4297
+ (_b = this.scrollWrapperElement) === null || _b === void 0 ? void 0 : _b.classList.remove(name);
4298
+ }
4299
+ }
4300
+ };
4301
+ CatScrollable.style = catScrollableCss;
4302
+
4303
+ const catSkeletonCss = ":host{display:flex;flex-direction:column;position:relative;--background:#ebecf0;--highlight:#d7dbe0;--speed:2s}:host([variant=square]),:host([variant=circle]){display:inline-flex}:host([hidden]){display:none}:host([variant=head]){margin-bottom:0.5rem}:host([variant=body]){margin-bottom:1rem}.skeleton{display:block;border-radius:0.25rem;background:var(--background)}.skeleton-circle{border-radius:10rem}.skeleton-xs.skeleton-rectangle{width:var(--width, 100%);height:var(--height, 1.5rem)}.skeleton-xs.skeleton-square,.skeleton-xs.skeleton-circle{width:var(--width, 1.5rem);height:var(--height, 1.5rem)}.skeleton-xs.skeleton-head,.skeleton-xs.skeleton-body{width:var(--width, var(--line-width, 100%))}.skeleton-xs.skeleton-head{height:calc(0.9375rem - 4px);margin:calc((1.25rem - 0.9375rem + 4px) * 0.5) 0}.skeleton-xs.skeleton-body{height:calc(0.75rem - 4px);margin:calc((1rem - 0.75rem + 4px) * 0.5) 0}.skeleton-s.skeleton-rectangle{width:var(--width, 100%);height:var(--height, 2rem)}.skeleton-s.skeleton-square,.skeleton-s.skeleton-circle{width:var(--width, 2rem);height:var(--height, 2rem)}.skeleton-s.skeleton-head,.skeleton-s.skeleton-body{width:var(--width, var(--line-width, 100%))}.skeleton-s.skeleton-head{height:calc(1.125rem - 4px);margin:calc((1.5rem - 1.125rem + 4px) * 0.5) 0}.skeleton-s.skeleton-body{height:calc(0.875rem - 4px);margin:calc((1rem - 0.875rem + 4px) * 0.5) 0}.skeleton-m.skeleton-rectangle{width:var(--width, 100%);height:var(--height, 2.5rem)}.skeleton-m.skeleton-square,.skeleton-m.skeleton-circle{width:var(--width, 2.5rem);height:var(--height, 2.5rem)}.skeleton-m.skeleton-head,.skeleton-m.skeleton-body{width:var(--width, var(--line-width, 100%))}.skeleton-m.skeleton-head{height:calc(1.25rem - 4px);margin:calc((1.5rem - 1.25rem + 4px) * 0.5) 0}.skeleton-m.skeleton-body{height:calc(0.9375rem - 4px);margin:calc((1.25rem - 0.9375rem + 4px) * 0.5) 0}.skeleton-l.skeleton-rectangle{width:var(--width, 100%);height:var(--height, 3rem)}.skeleton-l.skeleton-square,.skeleton-l.skeleton-circle{width:var(--width, 3rem);height:var(--height, 3rem)}.skeleton-l.skeleton-head,.skeleton-l.skeleton-body{width:var(--width, var(--line-width, 100%))}.skeleton-l.skeleton-head{height:calc(1.5rem - 4px);margin:calc((1.75rem - 1.5rem + 4px) * 0.5) 0}.skeleton-l.skeleton-body{height:calc(1.125rem - 4px);margin:calc((1.5rem - 1.125rem + 4px) * 0.5) 0}.skeleton-xl.skeleton-rectangle{width:var(--width, 100%);height:var(--height, 3.5rem)}.skeleton-xl.skeleton-square,.skeleton-xl.skeleton-circle{width:var(--width, 3.5rem);height:var(--height, 3.5rem)}.skeleton-xl.skeleton-head,.skeleton-xl.skeleton-body{width:var(--width, var(--line-width, 100%))}.skeleton-xl.skeleton-head{height:calc(1.75rem - 4px);margin:calc((2rem - 1.75rem + 4px) * 0.5) 0}.skeleton-xl.skeleton-body{height:calc(1.25rem - 4px);margin:calc((1.5rem - 1.25rem + 4px) * 0.5) 0}.skeleton-sheen{background:linear-gradient(90deg, var(--background) 33%, var(--highlight) 50%, var(--background) 66%) var(--background);background-size:300% 100%;animation:sheen var(--speed) ease-in-out infinite}.skeleton-pulse{position:relative;overflow:hidden}.skeleton-pulse::before{content:\"\";display:block;position:absolute;width:100%;height:100%;background-color:var(--highlight);animation:var(--speed) ease-in-out 0.5s infinite normal none running pulse;opacity:0}@keyframes sheen{0%{background-position:right}}@keyframes pulse{50%{opacity:1}}";
4304
+
4305
+ const CatSkeleton = class {
4306
+ constructor(hostRef) {
4307
+ index.registerInstance(this, hostRef);
4308
+ /**
4309
+ * The animation style of the skeleton.
4310
+ */
4311
+ this.effect = 'sheen';
4312
+ /**
4313
+ * The rendering style of the skeleton.
4314
+ */
4315
+ this.variant = 'rectangle';
4316
+ /**
4317
+ * The size of the skeleton. If the variant is set to "head", the size values
4318
+ * "xs" to "xl" translate to the head levels `h1` to `h5`.
4319
+ */
4320
+ this.size = 'm';
4321
+ }
4322
+ render() {
4323
+ return (index.h(index.Host, null, Array.from(Array(this.count)).map(() => (index.h("div", { style: this.style, class: {
4324
+ skeleton: true,
4325
+ [`skeleton-${this.effect}`]: Boolean(this.effect),
4326
+ [`skeleton-${this.variant}`]: Boolean(this.variant),
4327
+ [`skeleton-${this.size}`]: Boolean(this.size)
4328
+ } })))));
4329
+ }
4330
+ get count() {
4331
+ switch (this.variant) {
4332
+ case 'head':
4333
+ return Math.max(1, this.lines || 1);
4334
+ case 'body':
4335
+ return Math.max(1, this.lines || 3);
4336
+ default:
4337
+ return 1;
4338
+ }
4339
+ }
4340
+ get style() {
4341
+ return this.variant === 'head' || this.variant === 'body'
4342
+ ? {
4343
+ '--line-width': `${this.random(50, 100)}%`
4344
+ }
4345
+ : undefined;
4346
+ }
4347
+ random(min, max) {
4348
+ return Math.floor(Math.random() * (max - min + 1) + min);
4349
+ }
4350
+ };
4351
+ CatSkeleton.style = catSkeletonCss;
4352
+
4353
+ const catSpinnerCss = ":host{display:inline-flex;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host[hidden]{display:none}span{display:inline-flex}svg{fill:none;stroke:currentColor;stroke-dasharray:135px;stroke-dashoffset:95px;stroke-linecap:round;stroke-width:5px;transform-origin:center center;animation:spin 0.75s cubic-bezier(0.4, 0.15, 0.6, 0.85) infinite;width:1em;height:1em}.spinner-xs svg{font-size:0.75rem}.spinner-s svg{font-size:1rem}.spinner-m svg{font-size:1.25rem}.spinner-l svg{font-size:1.5rem}.spinner-xl svg{font-size:1.75rem}@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}";
4354
+
4355
+ const CatSpinner = class {
4356
+ constructor(hostRef) {
4357
+ index.registerInstance(this, hostRef);
4358
+ /**
4359
+ * The size of the spinner.
4360
+ */
4361
+ this.size = 'm';
4362
+ }
4363
+ render() {
4364
+ return (index.h("span", { "aria-label": this.a11yLabel, "aria-hidden": this.a11yLabel ? null : 'true', class: {
4365
+ [`spinner-${this.size}`]: this.size !== 'inline'
4366
+ } }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 48 48" }, index.h("circle", { cx: "24", cy: "24", r: "21.5" }))));
4367
+ }
4368
+ };
4369
+ CatSpinner.style = catSpinnerCss;
4370
+
4371
+ var e,t,n="function"==typeof Map?new Map:(e=[],t=[],{has:function(t){return e.indexOf(t)>-1},get:function(n){return t[e.indexOf(n)]},set:function(n,o){-1===e.indexOf(n)&&(e.push(n),t.push(o));},delete:function(n){var o=e.indexOf(n);o>-1&&(e.splice(o,1),t.splice(o,1));}}),o=function(e){return new Event(e,{bubbles:!0})};try{new Event("test");}catch(e){o=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t};}function r(e){var t=n.get(e);t&&t.destroy();}function i(e){var t=n.get(e);t&&t.update();}var l=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((l=function(e){return e}).destroy=function(e){return e},l.update=function(e){return e}):((l=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return function(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!n.has(e)){var t,r=null,i=null,l=null,d=function(){e.clientWidth!==i&&c();},a=function(t){window.removeEventListener("resize",d,!1),e.removeEventListener("input",c,!1),e.removeEventListener("keyup",c,!1),e.removeEventListener("autosize:destroy",a,!1),e.removeEventListener("autosize:update",c,!1),Object.keys(t).forEach(function(n){e.style[n]=t[n];}),n.delete(e);}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",a,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",c,!1),window.addEventListener("resize",d,!1),e.addEventListener("input",c,!1),e.addEventListener("autosize:update",c,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",n.set(e,{destroy:a,update:c}),"vertical"===(t=window.getComputedStyle(e,null)).resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),r="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(r)&&(r=0),c();}function u(t){var n=e.style.width;e.style.width="0px",e.style.width=n,e.style.overflowY=t;}function s(){if(0!==e.scrollHeight){var t=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}(e),n=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+r+"px",i=e.clientWidth,t.forEach(function(e){e.node.scrollTop=e.scrollTop;}),n&&(document.documentElement.scrollTop=n);}}function c(){s();var t=Math.round(parseFloat(e.style.height)),n=window.getComputedStyle(e,null),r="content-box"===n.boxSizing?Math.round(parseFloat(n.height)):e.offsetHeight;if(r<t?"hidden"===n.overflowY&&(u("scroll"),s(),r="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==n.overflowY&&(u("hidden"),s(),r="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight),l!==r){l=r;var i=o("autosize:resized");try{e.dispatchEvent(i);}catch(e){}}}}(e)}),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],r),e},l.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],i),e});var d=l;
4372
+
4373
+ const catTextareaCss = ":host{display:flex;flex-direction:column;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;margin-bottom:1rem}:host([hidden]){display:none}label{align-self:flex-start}label.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.input-optional{margin-left:0.25rem;font-size:0.75rem;line-height:1rem;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}textarea{margin:0;padding:0.625rem 0.75rem;min-height:2.5rem;font:inherit;background:white;border-radius:0.25rem;border:none;box-shadow:0 0 0 1px #d7dbe0;transition:box-shadow 0.13s linear}textarea:disabled{background:#f8f8fb;cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135));resize:none}textarea:hover:not(:disabled){box-shadow:0 0 0 2px #d7dbe0}textarea:focus{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255))}textarea::placeholder{color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.input-hint{font-size:0.875rem;line-height:1rem;margin:0}";
4374
+
4375
+ let nextUniqueId$2 = 0;
4376
+ const CatTextarea = class {
4377
+ constructor(hostRef) {
4378
+ index.registerInstance(this, hostRef);
4379
+ this.catChange = index.createEvent(this, "catChange", 7);
4380
+ this.catFocus = index.createEvent(this, "catFocus", 7);
4381
+ this.catBlur = index.createEvent(this, "catBlur", 7);
4382
+ this.id = `cat-textarea-${nextUniqueId$2++}`;
4383
+ /**
4384
+ * Whether the textarea is disabled.
4385
+ */
4386
+ this.disabled = false;
4387
+ /**
4388
+ * The label for the textarea.
4389
+ */
4390
+ this.label = '';
4391
+ /**
4392
+ * Visually hide the label, but still show it to assistive technologies like screen readers.
4393
+ */
4394
+ this.labelHidden = false;
4395
+ /**
4396
+ * The name of the form control. Submitted with the form as part of a name/value pair.
4397
+ */
4398
+ this.name = '';
4399
+ /**
4400
+ * The value is not editable.
4401
+ */
4402
+ this.readonly = false;
4403
+ /**
4404
+ * A value is required or must be check for the form to be submittable.
4405
+ */
4406
+ this.required = false;
4407
+ /**
4408
+ * Specifies the initial number of lines in the textarea.
4409
+ */
4410
+ this.rows = 3;
4411
+ }
4412
+ componentWillRender() {
4413
+ if (!this.label) {
4414
+ catIconRegistry.loglevel.error('[A11y] Missing ARIA label on textarea', this);
4415
+ }
4416
+ }
4417
+ componentDidLoad() {
4418
+ d(this.textarea);
4419
+ }
4420
+ /**
4421
+ * Sets focus on the textarea. Use this method instead of `textarea.focus()`.
4422
+ *
4423
+ * @param options An optional object providing options to control aspects of
4424
+ * the focusing process.
4425
+ */
4426
+ async setFocus(options) {
4427
+ this.textarea.focus(options);
4428
+ }
4429
+ // /**
4430
+ // * Clear the input.
4431
+ // */
4432
+ // @Method()
4433
+ // async clear(): Promise<void> {
4434
+ // this.inputValue = '';
4435
+ // }
4436
+ render() {
4437
+ return (index.h(index.Host, null, this.label && (index.h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, index.h("span", { part: "label" }, this.label, !this.required && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(Optional)"))))), index.h("textarea", { ref: el => (this.textarea = el), id: this.id, disabled: this.disabled, maxlength: this.maxLength, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, rows: this.rows, value: this.value, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), this.hint && index.h("p", { class: "input-hint" }, this.hint)));
4438
+ }
4439
+ onInput(event) {
4440
+ // this.inputValue = πthis.input.value;
4441
+ this.catChange.emit(event);
4442
+ }
4443
+ onFocus(event) {
4444
+ this.catFocus.emit(event);
4445
+ }
4446
+ onBlur(event) {
4447
+ this.catBlur.emit(event);
4448
+ }
4449
+ };
4450
+ CatTextarea.style = catTextareaCss;
4451
+
4452
+ const catToggleCss = ":host{display:flex;margin-bottom:1rem}:host([hidden]){display:none}label{flex:0 1 auto;display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;-webkit-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}input{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.toggle{flex:0 0 auto;display:flex;align-items:center;justify-content:center;position:relative;width:2rem;height:1.25rem;border-radius:10rem;background-color:#d7dbe0;transition:background-color 0.13s ease}:checked+.toggle{background-color:rgb(var(--cat-primary-bg, 32, 127, 138))}:focus-visible+.toggle{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.toggle::after{content:\"\";position:absolute;width:1rem;height:1rem;background:#fff;border-radius:10rem;transform:translateX(calc(2px - 0.5rem));transition:transform 0.13s linear;box-shadow:0 1px 4px 0 rgba(16, 29, 48, 0.2)}:checked+.toggle::after{transform:translateX(calc(-2px + 0.5rem))}.label{flex:1 1 auto}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}";
4453
+
4454
+ let nextUniqueId$1 = 0;
4455
+ const CatToggle = class {
4456
+ constructor(hostRef) {
4457
+ index.registerInstance(this, hostRef);
4458
+ this.catChange = index.createEvent(this, "catChange", 7);
4459
+ this.catFocus = index.createEvent(this, "catFocus", 7);
4460
+ this.catBlur = index.createEvent(this, "catBlur", 7);
4461
+ this.id = `cat-toggle-${nextUniqueId$1++}`;
4462
+ /**
4463
+ * Checked state of the toggle.
4464
+ */
4465
+ this.checked = false;
4466
+ /**
4467
+ * Disabled state of the toggle.
4468
+ */
4469
+ this.disabled = false;
4470
+ /**
4471
+ * The label of the toggle that is visible.
4472
+ */
4473
+ this.label = '';
4474
+ /**
4475
+ * Visually hide the label, but still show it to assistive technologies like screen readers.
4476
+ */
4477
+ this.labelHidden = false;
4478
+ /**
4479
+ * Required state of the toggle
4480
+ */
4481
+ this.required = false;
4482
+ }
4483
+ componentWillRender() {
4484
+ if (!this.label) {
4485
+ catIconRegistry.loglevel.error('[A11y] Missing ARIA label on toggle', this);
4486
+ }
4487
+ }
4488
+ /**
4489
+ * Sets focus on the toggle. Use this method instead of `toggle.focus()`.
4490
+ *
4491
+ * @param options An optional object providing options to control aspects of
4492
+ * the focusing process.
4493
+ */
4494
+ async setFocus(options) {
4495
+ this.input.focus(options);
4496
+ }
4497
+ render() {
4498
+ return (index.h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } }, index.h("input", { ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, class: "form-check-input", role: "switch", onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), index.h("span", { class: "toggle", part: "toggle" }), index.h("span", { class: "label", part: "label" }, this.label)));
4499
+ }
4500
+ onInput(event) {
4501
+ this.catChange.emit(event);
4502
+ }
4503
+ onFocus(event) {
4504
+ this.catFocus.emit(event);
4505
+ }
4506
+ onBlur(event) {
4507
+ this.catBlur.emit(event);
4508
+ }
4509
+ };
4510
+ CatToggle.style = catToggleCss;
4511
+
4512
+ const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
4513
+
4514
+ const catTooltipCss = ":host{display:contents}:host([hidden]){display:none}.tooltip{position:absolute;font-size:0.875rem;line-height:1rem;font-weight:500;padding:0.75rem;background-color:white;border-radius:0.25rem;color:black;transition:opacity 0.25s linear, visibility 0.25s linear;visibility:hidden;opacity:0;box-shadow:rgba(0, 0, 0, 0.08) 0 1px 8px 0;border:1px solid #ebecf0;z-index:200;max-width:16rem}.tooltip-show{opacity:1;visibility:visible}.tooltip-trigger{display:inline-block}.tooltip-trigger:focus{outline:none}";
4515
+
4516
+ let nextUniqueId = 0;
4517
+ const CatTooltip = class {
4518
+ constructor(hostRef) {
4519
+ index.registerInstance(this, hostRef);
4520
+ this.id = `cat-tooltip-${nextUniqueId++}`;
4521
+ /**
4522
+ * The content of the tooltip.
4523
+ */
4524
+ this.content = '';
4525
+ /**
4526
+ * Specifies that the tooltip should be disabled. A disabled tooltip is unusable,
4527
+ * and invisible. Corresponds with the native HTML disabled attribute.
4528
+ */
4529
+ this.disabled = false;
4530
+ /**
4531
+ * The placement of the tooltip.
4532
+ */
4533
+ this.placement = 'top';
4534
+ /**
4535
+ * The delay time for showing tooltip in ms.
4536
+ */
4537
+ this.showDelay = 500;
4538
+ /**
4539
+ * The delay time for hiding tooltip in ms.
4540
+ */
4541
+ this.hideDelay = 0;
4542
+ /**
4543
+ * The duration of tap to show the tooltip.
4544
+ */
4545
+ this.longTouchDuration = 1000;
4546
+ }
4547
+ handleKeyDown({ key }) {
4548
+ key === 'Escape' && this.hideListener();
4549
+ }
4550
+ componentDidLoad() {
4551
+ var _a, _b, _c, _d, _e, _f, _g;
4552
+ this.trigger = firstTabbable(this.triggerElement) || this.triggerElement;
4553
+ if (!this.isTabbable) {
4554
+ (_a = this.trigger) === null || _a === void 0 ? void 0 : _a.setAttribute('tabindex', '0');
4555
+ }
4556
+ if (this.trigger && this.tooltip) {
4557
+ autoUpdate(this.trigger, this.tooltip, () => this.update());
4558
+ }
4559
+ if (isTouchDevice) {
4560
+ (_b = this.trigger) === null || _b === void 0 ? void 0 : _b.addEventListener('touchstart', this.touchStartListener.bind(this));
4561
+ (_c = this.trigger) === null || _c === void 0 ? void 0 : _c.addEventListener('touchend', this.touchEndListener.bind(this));
4562
+ }
4563
+ else {
4564
+ (_d = this.trigger) === null || _d === void 0 ? void 0 : _d.addEventListener('focusin', this.showListener.bind(this));
4565
+ (_e = this.trigger) === null || _e === void 0 ? void 0 : _e.addEventListener('focusout', this.hideListener.bind(this));
4566
+ (_f = this.trigger) === null || _f === void 0 ? void 0 : _f.addEventListener('mouseenter', this.showListener.bind(this));
4567
+ (_g = this.trigger) === null || _g === void 0 ? void 0 : _g.addEventListener('mouseleave', this.hideListener.bind(this));
4568
+ }
4569
+ }
4570
+ disconnectedCallback() {
4571
+ var _a, _b, _c, _d, _e, _f;
4572
+ if (isTouchDevice) {
4573
+ (_a = this.trigger) === null || _a === void 0 ? void 0 : _a.removeEventListener('touchstart', this.touchStartListener.bind(this));
4574
+ (_b = this.trigger) === null || _b === void 0 ? void 0 : _b.removeEventListener('touchend', this.touchEndListener.bind(this));
4575
+ }
4576
+ else {
4577
+ (_c = this.trigger) === null || _c === void 0 ? void 0 : _c.removeEventListener('mouseenter', this.showListener.bind(this));
4578
+ (_d = this.trigger) === null || _d === void 0 ? void 0 : _d.removeEventListener('mouseleave', this.hideListener.bind(this));
4579
+ (_e = this.trigger) === null || _e === void 0 ? void 0 : _e.removeEventListener('focusin', this.showListener.bind(this));
4580
+ (_f = this.trigger) === null || _f === void 0 ? void 0 : _f.removeEventListener('focusout', this.hideListener.bind(this));
4581
+ }
4582
+ }
4583
+ render() {
4584
+ return (index.h(index.Host, null, index.h("div", { ref: el => (this.triggerElement = el), "aria-describedby": this.id, class: "tooltip-trigger" }, index.h("slot", null)), this.content && !this.disabled && (index.h("div", { ref: el => (this.tooltip = el), id: this.id, class: "tooltip" }, this.content))));
4585
+ }
4586
+ get isTabbable() {
4587
+ return firstTabbable(this.trigger);
4588
+ }
4589
+ update() {
4590
+ if (this.trigger && this.tooltip) {
4591
+ computePosition(this.trigger, this.tooltip, {
4592
+ placement: this.placement,
4593
+ middleware: [offset(CatTooltip.OFFSET), flip()]
4594
+ }).then(({ x, y }) => {
4595
+ if (this.tooltip) {
4596
+ Object.assign(this.tooltip.style, {
4597
+ left: `${Math.max(0, x)}px`,
4598
+ top: `${y}px`
4599
+ });
4600
+ }
4601
+ });
4602
+ }
4603
+ }
4604
+ showListener() {
4605
+ window.clearTimeout(this.hideTimeout);
4606
+ this.showTimeout = window.setTimeout(() => {
4607
+ var _a, _b;
4608
+ (_a = this.trigger) === null || _a === void 0 ? void 0 : _a.focus();
4609
+ (_b = this.tooltip) === null || _b === void 0 ? void 0 : _b.classList.add('tooltip-show');
4610
+ }, this.showDelay);
4611
+ }
4612
+ hideListener() {
4613
+ window.clearTimeout(this.showTimeout);
4614
+ this.hideTimeout = window.setTimeout(() => {
4615
+ var _a, _b;
4616
+ (_a = this.trigger) === null || _a === void 0 ? void 0 : _a.blur();
4617
+ (_b = this.tooltip) === null || _b === void 0 ? void 0 : _b.classList.remove('tooltip-show');
4618
+ }, this.hideDelay);
4619
+ }
4620
+ touchStartListener() {
4621
+ this.touchTimeout = window.setTimeout(() => {
4622
+ var _a;
4623
+ (_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.add('tooltip-show');
4624
+ }, this.longTouchDuration);
4625
+ }
4626
+ touchEndListener() {
4627
+ var _a;
4628
+ window.clearTimeout(this.touchTimeout);
4629
+ (_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.remove('tooltip-show');
4630
+ }
4631
+ };
4632
+ CatTooltip.OFFSET = 4;
4633
+ CatTooltip.style = catTooltipCss;
4634
+
4635
+ exports.cat_alert = CatAlert;
4636
+ exports.cat_badge = CatBadge;
4637
+ exports.cat_button = CatButton;
4638
+ exports.cat_card = CatCard;
4639
+ exports.cat_checkbox = CatCheckbox;
4640
+ exports.cat_icon = CatIcon;
4641
+ exports.cat_input = CatInput;
4642
+ exports.cat_menu = CatMenu;
4643
+ exports.cat_radio = CatRadio;
4644
+ exports.cat_scrollable = CatScrollable;
4645
+ exports.cat_skeleton = CatSkeleton;
4646
+ exports.cat_spinner = CatSpinner;
4647
+ exports.cat_textarea = CatTextarea;
4648
+ exports.cat_toggle = CatToggle;
4649
+ exports.cat_tooltip = CatTooltip;
4650
+
4651
+ //# sourceMappingURL=cat-alert_15.cjs.entry.js.map