@jumpgroup/jump-design-system 0.3.59 → 0.3.64

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 (232) hide show
  1. package/dist/cjs/chunk.H33C3MRM-31110702.js +365 -0
  2. package/dist/cjs/chunk.H33C3MRM-31110702.js.map +1 -0
  3. package/dist/cjs/chunk.WLV3FVBR-bfad29d7.js +238 -0
  4. package/dist/cjs/chunk.WLV3FVBR-bfad29d7.js.map +1 -0
  5. package/dist/cjs/{class-map-b27ebf69.js → class-map-010ed95d.js} +3 -3
  6. package/dist/cjs/{class-map-b27ebf69.js.map → class-map-010ed95d.js.map} +1 -1
  7. package/dist/cjs/{chunk.H33C3MRM-2c09acb5.js → directive-helpers-b6926fa1.js} +2 -360
  8. package/dist/cjs/directive-helpers-b6926fa1.js.map +1 -0
  9. package/dist/cjs/if-defined-da1385f1.js +432 -0
  10. package/dist/cjs/if-defined-da1385f1.js.map +1 -0
  11. package/dist/cjs/{index-e91b2b41.js → index-864e40de.js} +5 -2
  12. package/dist/cjs/index-864e40de.js.map +1 -0
  13. package/dist/cjs/jump-accordion-group.cjs.entry.js +1 -1
  14. package/dist/cjs/jump-accordion.cjs.entry.js +32 -255
  15. package/dist/cjs/jump-accordion.cjs.entry.js.map +1 -1
  16. package/dist/cjs/jump-badge.cjs.entry.js +1 -1
  17. package/dist/cjs/jump-button_2.cjs.entry.js +3 -2
  18. package/dist/cjs/jump-button_2.cjs.entry.js.map +1 -1
  19. package/dist/cjs/jump-card-ecommerce-option.cjs.entry.js +1 -1
  20. package/dist/cjs/jump-card-ecommerce.cjs.entry.js +1 -1
  21. package/dist/cjs/jump-card.cjs.entry.js +1 -1
  22. package/dist/cjs/jump-design-system.cjs.js +2 -2
  23. package/dist/cjs/jump-filter-checkbox.cjs.entry.js +46 -470
  24. package/dist/cjs/jump-filter-checkbox.cjs.entry.js.map +1 -1
  25. package/dist/cjs/jump-filter-select.cjs.entry.js +4229 -0
  26. package/dist/cjs/jump-filter-select.cjs.entry.js.map +1 -0
  27. package/dist/cjs/jump-filter-switch.cjs.entry.js +440 -0
  28. package/dist/cjs/jump-filter-switch.cjs.entry.js.map +1 -0
  29. package/dist/cjs/jump-filter.cjs.entry.js +1 -1
  30. package/dist/cjs/jump-filtergroup.cjs.entry.js +4 -4
  31. package/dist/cjs/jump-navbar.cjs.entry.js +6 -6
  32. package/dist/cjs/jump-pagination-table.cjs.entry.js +4 -4
  33. package/dist/cjs/jump-pagination.cjs.entry.js +4 -4
  34. package/dist/cjs/jump-quantity.cjs.entry.js +9 -13
  35. package/dist/cjs/jump-quantity.cjs.entry.js.map +1 -1
  36. package/dist/cjs/jump-search-bar-dropdown-item.cjs.entry.js +2 -2
  37. package/dist/cjs/jump-search-bar-mobile.cjs.entry.js +5 -5
  38. package/dist/cjs/jump-search-bar.cjs.entry.js +1 -1
  39. package/dist/cjs/jump-tab-item.cjs.entry.js +3 -3
  40. package/dist/cjs/jump-tab-panel.cjs.entry.js +2 -2
  41. package/dist/cjs/jump-tab.cjs.entry.js +2 -2
  42. package/dist/cjs/live-a9a3fb36.js +14 -0
  43. package/dist/cjs/live-a9a3fb36.js.map +1 -0
  44. package/dist/cjs/loader.cjs.js +2 -2
  45. package/dist/collection/collection-manifest.json +2 -0
  46. package/dist/collection/components/jump-filter-checkbox/jump-filter-checkbox.stories.js +0 -5
  47. package/dist/collection/components/jump-filter-checkbox/jump-filter-checkbox.stories.js.map +1 -1
  48. package/dist/collection/components/jump-filter-select/jump-filter-select.css +578 -0
  49. package/dist/collection/components/jump-filter-select/jump-filter-select.js +373 -0
  50. package/dist/collection/components/jump-filter-select/jump-filter-select.js.map +1 -0
  51. package/dist/collection/components/jump-filter-select/jump-filter-select.stories.js +211 -0
  52. package/dist/collection/components/jump-filter-switch/jump-filter-switch.css +536 -0
  53. package/dist/collection/components/jump-filter-switch/jump-filter-switch.js +175 -0
  54. package/dist/collection/components/jump-filter-switch/jump-filter-switch.js.map +1 -0
  55. package/dist/collection/components/jump-filter-switch/jump-filter-switch.stories.js +68 -0
  56. package/dist/collection/components/jump-filter-switch/jump-filter-switch.stories.js.map +1 -0
  57. package/dist/collection/components/jump-filtergroup/jump-filtergroup.js +3 -3
  58. package/dist/collection/components/jump-navbar/jump-navbar.js +5 -5
  59. package/dist/collection/components/jump-pagination/jump-pagination.js +3 -3
  60. package/dist/collection/components/jump-pagination-table/jump-pagination-table.js +3 -3
  61. package/dist/collection/components/jump-quantity/jump-quantity.js +8 -17
  62. package/dist/collection/components/jump-quantity/jump-quantity.js.map +1 -1
  63. package/dist/collection/components/jump-search-bar-dropdown-item/jump-search-bar-dropdown-item.js +1 -1
  64. package/dist/collection/components/jump-search-bar-mobile/jump-search-bar-mobile.js +4 -4
  65. package/dist/collection/components/jump-tab/jump-tab.js +1 -1
  66. package/dist/collection/components/jump-tab-item/jump-tab-item.js +2 -2
  67. package/dist/collection/components/jump-tab-panel/jump-tab-panel.js +1 -1
  68. package/dist/components/chunk.H33C3MRM.js +3 -170
  69. package/dist/components/chunk.H33C3MRM.js.map +1 -1
  70. package/dist/components/chunk.WLV3FVBR.js +230 -0
  71. package/dist/components/chunk.WLV3FVBR.js.map +1 -0
  72. package/dist/components/class-map.js +1 -1
  73. package/dist/{esm/chunk.H33C3MRM-632f8755.js → components/directive-helpers.js} +2 -359
  74. package/dist/components/directive-helpers.js.map +1 -0
  75. package/dist/components/if-defined.js +426 -0
  76. package/dist/components/if-defined.js.map +1 -0
  77. package/dist/components/jump-accordion.js +3 -226
  78. package/dist/components/jump-accordion.js.map +1 -1
  79. package/dist/components/jump-filter-checkbox.js +8 -432
  80. package/dist/components/jump-filter-checkbox.js.map +1 -1
  81. package/dist/components/jump-filter-select.d.ts +11 -0
  82. package/dist/components/jump-filter-select.js +4257 -0
  83. package/dist/components/jump-filter-select.js.map +1 -0
  84. package/dist/components/jump-filter-switch.d.ts +11 -0
  85. package/dist/components/jump-filter-switch.js +460 -0
  86. package/dist/components/jump-filter-switch.js.map +1 -0
  87. package/dist/components/jump-filtergroup.js +3 -3
  88. package/dist/components/jump-icon2.js +1 -0
  89. package/dist/components/jump-icon2.js.map +1 -1
  90. package/dist/components/jump-navbar.js +5 -5
  91. package/dist/components/jump-pagination-table.js +3 -3
  92. package/dist/components/jump-pagination.js +3 -3
  93. package/dist/components/jump-quantity.js +8 -13
  94. package/dist/components/jump-quantity.js.map +1 -1
  95. package/dist/components/jump-search-bar-dropdown-item.js +1 -1
  96. package/dist/components/jump-search-bar-mobile.js +4 -4
  97. package/dist/components/jump-tab-item.js +2 -2
  98. package/dist/components/jump-tab-panel.js +1 -1
  99. package/dist/components/jump-tab.js +1 -1
  100. package/dist/components/live.js +12 -0
  101. package/dist/components/live.js.map +1 -0
  102. package/dist/esm/chunk.H33C3MRM-7dcbd943.js +362 -0
  103. package/dist/esm/chunk.H33C3MRM-7dcbd943.js.map +1 -0
  104. package/dist/esm/chunk.WLV3FVBR-ded9a646.js +230 -0
  105. package/dist/esm/chunk.WLV3FVBR-ded9a646.js.map +1 -0
  106. package/dist/esm/{class-map-3150cdfe.js → class-map-a2676e27.js} +2 -2
  107. package/dist/esm/{class-map-3150cdfe.js.map → class-map-a2676e27.js.map} +1 -1
  108. package/dist/esm/directive-helpers-d80c2187.js +172 -0
  109. package/dist/esm/directive-helpers-d80c2187.js.map +1 -0
  110. package/dist/esm/if-defined-85ab7b97.js +426 -0
  111. package/dist/esm/if-defined-85ab7b97.js.map +1 -0
  112. package/dist/esm/{index-9a1da0f0.js → index-7eb565cd.js} +5 -2
  113. package/dist/esm/index-7eb565cd.js.map +1 -0
  114. package/dist/esm/jump-accordion-group.entry.js +1 -1
  115. package/dist/esm/jump-accordion.entry.js +5 -228
  116. package/dist/esm/jump-accordion.entry.js.map +1 -1
  117. package/dist/esm/jump-badge.entry.js +1 -1
  118. package/dist/esm/jump-button_2.entry.js +3 -2
  119. package/dist/esm/jump-button_2.entry.js.map +1 -1
  120. package/dist/esm/jump-card-ecommerce-option.entry.js +1 -1
  121. package/dist/esm/jump-card-ecommerce.entry.js +1 -1
  122. package/dist/esm/jump-card.entry.js +1 -1
  123. package/dist/esm/jump-design-system.js +3 -3
  124. package/dist/esm/jump-filter-checkbox.entry.js +9 -433
  125. package/dist/esm/jump-filter-checkbox.entry.js.map +1 -1
  126. package/dist/esm/jump-filter-select.entry.js +4225 -0
  127. package/dist/esm/jump-filter-select.entry.js.map +1 -0
  128. package/dist/esm/jump-filter-switch.entry.js +436 -0
  129. package/dist/esm/jump-filter-switch.entry.js.map +1 -0
  130. package/dist/esm/jump-filter.entry.js +1 -1
  131. package/dist/esm/jump-filtergroup.entry.js +4 -4
  132. package/dist/esm/jump-navbar.entry.js +6 -6
  133. package/dist/esm/jump-pagination-table.entry.js +4 -4
  134. package/dist/esm/jump-pagination.entry.js +4 -4
  135. package/dist/esm/jump-quantity.entry.js +9 -13
  136. package/dist/esm/jump-quantity.entry.js.map +1 -1
  137. package/dist/esm/jump-search-bar-dropdown-item.entry.js +2 -2
  138. package/dist/esm/jump-search-bar-mobile.entry.js +5 -5
  139. package/dist/esm/jump-search-bar.entry.js +1 -1
  140. package/dist/esm/jump-tab-item.entry.js +3 -3
  141. package/dist/esm/jump-tab-panel.entry.js +2 -2
  142. package/dist/esm/jump-tab.entry.js +2 -2
  143. package/dist/esm/live-253d6806.js +12 -0
  144. package/dist/esm/live-253d6806.js.map +1 -0
  145. package/dist/esm/loader.js +3 -3
  146. package/dist/jump-design-system/jump-design-system.esm.js +1 -1
  147. package/dist/jump-design-system/jump-design-system.esm.js.map +1 -1
  148. package/dist/jump-design-system/p-0cbcc5b3.entry.js +2 -0
  149. package/dist/jump-design-system/p-172a50cb.entry.js +2 -0
  150. package/dist/jump-design-system/p-172a50cb.entry.js.map +1 -0
  151. package/dist/jump-design-system/p-1b31e36f.js +17 -0
  152. package/dist/jump-design-system/p-1b31e36f.js.map +1 -0
  153. package/dist/jump-design-system/{p-2e2bd8a9.entry.js → p-201c09dd.entry.js} +2 -2
  154. package/dist/jump-design-system/p-35633b03.entry.js +848 -0
  155. package/dist/jump-design-system/p-35633b03.entry.js.map +1 -0
  156. package/dist/jump-design-system/p-39b82674.entry.js +2 -0
  157. package/dist/jump-design-system/{p-feb825e0.entry.js → p-3b4127b0.entry.js} +2 -2
  158. package/dist/jump-design-system/{p-6b1ab8c3.entry.js → p-3e31b638.entry.js} +2 -2
  159. package/dist/jump-design-system/p-53bf2958.entry.js +213 -0
  160. package/dist/jump-design-system/p-53bf2958.entry.js.map +1 -0
  161. package/dist/jump-design-system/p-67339850.js +63 -0
  162. package/dist/jump-design-system/p-67339850.js.map +1 -0
  163. package/dist/jump-design-system/{p-f7c323d2.entry.js → p-7dd5052b.entry.js} +2 -2
  164. package/dist/jump-design-system/p-8d1d2af9.entry.js +117 -0
  165. package/dist/jump-design-system/p-8d1d2af9.entry.js.map +1 -0
  166. package/dist/jump-design-system/p-8e0419b1.entry.js +2 -0
  167. package/dist/jump-design-system/{p-6dc529fc.entry.js → p-90c51b48.entry.js} +2 -2
  168. package/dist/jump-design-system/p-926c7bf0.entry.js +2 -0
  169. package/dist/jump-design-system/p-94229ed5.js +7 -0
  170. package/dist/jump-design-system/p-94229ed5.js.map +1 -0
  171. package/dist/jump-design-system/{p-02e863db.entry.js → p-94790673.entry.js} +2 -2
  172. package/dist/jump-design-system/{p-466e0ade.entry.js → p-947d7f9a.entry.js} +2 -2
  173. package/dist/jump-design-system/p-95a1bbc5.js +51 -0
  174. package/dist/jump-design-system/p-95a1bbc5.js.map +1 -0
  175. package/dist/jump-design-system/p-98ef4924.entry.js +2 -0
  176. package/dist/jump-design-system/{p-3f6d50d5.entry.js.map → p-98ef4924.entry.js.map} +1 -1
  177. package/dist/jump-design-system/{p-198cfe62.js → p-9d21c18a.js} +2 -2
  178. package/dist/jump-design-system/p-a05d9480.entry.js +178 -0
  179. package/dist/jump-design-system/p-a05d9480.entry.js.map +1 -0
  180. package/dist/jump-design-system/{p-a9b78af2.entry.js → p-ad550de6.entry.js} +2 -2
  181. package/dist/jump-design-system/{p-1aa5fb8a.entry.js → p-d3b62e9b.entry.js} +2 -2
  182. package/dist/jump-design-system/{p-bdafe87d.entry.js → p-d8bfd21c.entry.js} +2 -2
  183. package/dist/jump-design-system/{p-a1c25113.entry.js → p-d94fabc1.entry.js} +2 -2
  184. package/dist/jump-design-system/p-e516e812.js +3 -0
  185. package/dist/jump-design-system/p-e516e812.js.map +1 -0
  186. package/dist/jump-design-system/p-f2d287d6.js +2 -0
  187. package/dist/jump-design-system/p-f2d287d6.js.map +1 -0
  188. package/dist/jump-design-system/{p-07633158.entry.js → p-ff8d70ab.entry.js} +2 -2
  189. package/dist/jump-design-system-elements.json +66 -0
  190. package/dist/types/components/jump-filter-checkbox/jump-filter-checkbox.stories.d.ts +0 -5
  191. package/dist/types/components/jump-filter-select/jump-filter-select.d.ts +76 -0
  192. package/dist/types/components/jump-filter-switch/jump-filter-switch.d.ts +35 -0
  193. package/dist/types/components/jump-filter-switch/jump-filter-switch.stories.d.ts +24 -0
  194. package/dist/types/components/jump-quantity/jump-quantity.d.ts +0 -1
  195. package/dist/types/components.d.ts +206 -0
  196. package/package.json +1 -1
  197. package/dist/cjs/chunk.H33C3MRM-2c09acb5.js.map +0 -1
  198. package/dist/cjs/index-e91b2b41.js.map +0 -1
  199. package/dist/esm/chunk.H33C3MRM-632f8755.js.map +0 -1
  200. package/dist/esm/index-9a1da0f0.js.map +0 -1
  201. package/dist/jump-design-system/p-21aa0095.js +0 -3
  202. package/dist/jump-design-system/p-21aa0095.js.map +0 -1
  203. package/dist/jump-design-system/p-2e7c10a5.entry.js +0 -2
  204. package/dist/jump-design-system/p-2e7c10a5.entry.js.map +0 -1
  205. package/dist/jump-design-system/p-3f6d50d5.entry.js +0 -2
  206. package/dist/jump-design-system/p-6e7c80a3.entry.js +0 -244
  207. package/dist/jump-design-system/p-6e7c80a3.entry.js.map +0 -1
  208. package/dist/jump-design-system/p-842fff70.entry.js +0 -117
  209. package/dist/jump-design-system/p-842fff70.entry.js.map +0 -1
  210. package/dist/jump-design-system/p-8f581228.entry.js +0 -2
  211. package/dist/jump-design-system/p-a826c477.entry.js +0 -2
  212. package/dist/jump-design-system/p-b03c5b24.entry.js +0 -2
  213. package/dist/jump-design-system/p-c77d216c.entry.js +0 -2
  214. package/dist/jump-design-system/p-d33f4f1d.js +0 -66
  215. package/dist/jump-design-system/p-d33f4f1d.js.map +0 -1
  216. /package/dist/jump-design-system/{p-b03c5b24.entry.js.map → p-0cbcc5b3.entry.js.map} +0 -0
  217. /package/dist/jump-design-system/{p-2e2bd8a9.entry.js.map → p-201c09dd.entry.js.map} +0 -0
  218. /package/dist/jump-design-system/{p-8f581228.entry.js.map → p-39b82674.entry.js.map} +0 -0
  219. /package/dist/jump-design-system/{p-feb825e0.entry.js.map → p-3b4127b0.entry.js.map} +0 -0
  220. /package/dist/jump-design-system/{p-6b1ab8c3.entry.js.map → p-3e31b638.entry.js.map} +0 -0
  221. /package/dist/jump-design-system/{p-f7c323d2.entry.js.map → p-7dd5052b.entry.js.map} +0 -0
  222. /package/dist/jump-design-system/{p-c77d216c.entry.js.map → p-8e0419b1.entry.js.map} +0 -0
  223. /package/dist/jump-design-system/{p-6dc529fc.entry.js.map → p-90c51b48.entry.js.map} +0 -0
  224. /package/dist/jump-design-system/{p-a826c477.entry.js.map → p-926c7bf0.entry.js.map} +0 -0
  225. /package/dist/jump-design-system/{p-02e863db.entry.js.map → p-94790673.entry.js.map} +0 -0
  226. /package/dist/jump-design-system/{p-466e0ade.entry.js.map → p-947d7f9a.entry.js.map} +0 -0
  227. /package/dist/jump-design-system/{p-198cfe62.js.map → p-9d21c18a.js.map} +0 -0
  228. /package/dist/jump-design-system/{p-a9b78af2.entry.js.map → p-ad550de6.entry.js.map} +0 -0
  229. /package/dist/jump-design-system/{p-1aa5fb8a.entry.js.map → p-d3b62e9b.entry.js.map} +0 -0
  230. /package/dist/jump-design-system/{p-bdafe87d.entry.js.map → p-d8bfd21c.entry.js.map} +0 -0
  231. /package/dist/jump-design-system/{p-a1c25113.entry.js.map → p-d94fabc1.entry.js.map} +0 -0
  232. /package/dist/jump-design-system/{p-07633158.entry.js.map → p-ff8d70ab.entry.js.map} +0 -0
@@ -0,0 +1,4257 @@
1
+ import { proxyCustomElement, HTMLElement as HTMLElement$1, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { i, x, c as component_styles_default, _ as __decorateClass, S as ShoelaceElement, r, n as n$1, a as __spreadProps, b as __spreadValues, T, d as w, w as watch } from './directive-helpers.js';
3
+ import { S as SlIcon } from './chunk.H33C3MRM.js';
4
+ import { e as e$2, a as e$3, i as i$1, t, b as e$4 } from './class-map.js';
5
+ import { o as o$2, f as form_control_styles_default, F as FormControlController, H as HasSlotController, d as defaultValue } from './if-defined.js';
6
+ import { L as LocalizeController, s as setDefaultAnimation, a as stopAnimations, g as getAnimation, b as animateTo, w as waitForEvent } from './chunk.WLV3FVBR.js';
7
+
8
+ // src/components/tag/tag.styles.ts
9
+ var tag_styles_default = i`
10
+ :host {
11
+ display: inline-block;
12
+ }
13
+
14
+ .tag {
15
+ display: flex;
16
+ align-items: center;
17
+ border: solid 1px;
18
+ line-height: 1;
19
+ white-space: nowrap;
20
+ user-select: none;
21
+ -webkit-user-select: none;
22
+ }
23
+
24
+ .tag__remove::part(base) {
25
+ color: inherit;
26
+ padding: 0;
27
+ }
28
+
29
+ /*
30
+ * Variant modifiers
31
+ */
32
+
33
+ .tag--primary {
34
+ background-color: var(--sl-color-primary-50);
35
+ border-color: var(--sl-color-primary-200);
36
+ color: var(--sl-color-primary-800);
37
+ }
38
+
39
+ .tag--primary:active > sl-icon-button {
40
+ color: var(--sl-color-primary-600);
41
+ }
42
+
43
+ .tag--success {
44
+ background-color: var(--sl-color-success-50);
45
+ border-color: var(--sl-color-success-200);
46
+ color: var(--sl-color-success-800);
47
+ }
48
+
49
+ .tag--success:active > sl-icon-button {
50
+ color: var(--sl-color-success-600);
51
+ }
52
+
53
+ .tag--neutral {
54
+ background-color: var(--sl-color-neutral-50);
55
+ border-color: var(--sl-color-neutral-200);
56
+ color: var(--sl-color-neutral-800);
57
+ }
58
+
59
+ .tag--neutral:active > sl-icon-button {
60
+ color: var(--sl-color-neutral-600);
61
+ }
62
+
63
+ .tag--warning {
64
+ background-color: var(--sl-color-warning-50);
65
+ border-color: var(--sl-color-warning-200);
66
+ color: var(--sl-color-warning-800);
67
+ }
68
+
69
+ .tag--warning:active > sl-icon-button {
70
+ color: var(--sl-color-warning-600);
71
+ }
72
+
73
+ .tag--danger {
74
+ background-color: var(--sl-color-danger-50);
75
+ border-color: var(--sl-color-danger-200);
76
+ color: var(--sl-color-danger-800);
77
+ }
78
+
79
+ .tag--danger:active > sl-icon-button {
80
+ color: var(--sl-color-danger-600);
81
+ }
82
+
83
+ /*
84
+ * Size modifiers
85
+ */
86
+
87
+ .tag--small {
88
+ font-size: var(--sl-button-font-size-small);
89
+ height: calc(var(--sl-input-height-small) * 0.8);
90
+ line-height: calc(var(--sl-input-height-small) - var(--sl-input-border-width) * 2);
91
+ border-radius: var(--sl-input-border-radius-small);
92
+ padding: 0 var(--sl-spacing-x-small);
93
+ }
94
+
95
+ .tag--medium {
96
+ font-size: var(--sl-button-font-size-medium);
97
+ height: calc(var(--sl-input-height-medium) * 0.8);
98
+ line-height: calc(var(--sl-input-height-medium) - var(--sl-input-border-width) * 2);
99
+ border-radius: var(--sl-input-border-radius-medium);
100
+ padding: 0 var(--sl-spacing-small);
101
+ }
102
+
103
+ .tag--large {
104
+ font-size: var(--sl-button-font-size-large);
105
+ height: calc(var(--sl-input-height-large) * 0.8);
106
+ line-height: calc(var(--sl-input-height-large) - var(--sl-input-border-width) * 2);
107
+ border-radius: var(--sl-input-border-radius-large);
108
+ padding: 0 var(--sl-spacing-medium);
109
+ }
110
+
111
+ .tag__remove {
112
+ margin-inline-start: var(--sl-spacing-x-small);
113
+ }
114
+
115
+ /*
116
+ * Pill modifier
117
+ */
118
+
119
+ .tag--pill {
120
+ border-radius: var(--sl-border-radius-pill);
121
+ }
122
+ `;
123
+
124
+ // src/components/icon-button/icon-button.styles.ts
125
+ var icon_button_styles_default = i`
126
+ :host {
127
+ display: inline-block;
128
+ color: var(--sl-color-neutral-600);
129
+ }
130
+
131
+ .icon-button {
132
+ flex: 0 0 auto;
133
+ display: flex;
134
+ align-items: center;
135
+ background: none;
136
+ border: none;
137
+ border-radius: var(--sl-border-radius-medium);
138
+ font-size: inherit;
139
+ color: inherit;
140
+ padding: var(--sl-spacing-x-small);
141
+ cursor: pointer;
142
+ transition: var(--sl-transition-x-fast) color;
143
+ -webkit-appearance: none;
144
+ }
145
+
146
+ .icon-button:hover:not(.icon-button--disabled),
147
+ .icon-button:focus-visible:not(.icon-button--disabled) {
148
+ color: var(--sl-color-primary-600);
149
+ }
150
+
151
+ .icon-button:active:not(.icon-button--disabled) {
152
+ color: var(--sl-color-primary-700);
153
+ }
154
+
155
+ .icon-button:focus {
156
+ outline: none;
157
+ }
158
+
159
+ .icon-button--disabled {
160
+ opacity: 0.5;
161
+ cursor: not-allowed;
162
+ }
163
+
164
+ .icon-button:focus-visible {
165
+ outline: var(--sl-focus-ring);
166
+ outline-offset: var(--sl-focus-ring-offset);
167
+ }
168
+
169
+ .icon-button__icon {
170
+ pointer-events: none;
171
+ }
172
+ `;
173
+
174
+ /**
175
+ * @license
176
+ * Copyright 2020 Google LLC
177
+ * SPDX-License-Identifier: BSD-3-Clause
178
+ */
179
+ const e$1=Symbol.for(""),o$1=t=>{if(t?.r===e$1)return t?._$litStatic$},s=(t,...r)=>({_$litStatic$:r.reduce(((r,e,o)=>r+(t=>{if(void 0!==t._$litStatic$)return t._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${t}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(e)+t[o+1]),t[0]),r:e$1}),a=new Map,l=t=>(r,...e)=>{const i=e.length;let s,l;const n=[],u=[];let c,$=0,f=!1;for(;$<i;){for(c=r[$];$<i&&void 0!==(l=e[$],s=o$1(l));)c+=s+r[++$],f=!0;$!==i&&u.push(l),n.push(c),$++;}if($===i&&n.push(r[i]),f){const t=n.join("$$lit$$");void 0===(r=a.get(t))&&(n.raw=n,a.set(t,r=n)),e=u;}return t(r,...e)},n=l(x);
180
+
181
+ var SlIconButton = class extends ShoelaceElement {
182
+ constructor() {
183
+ super(...arguments);
184
+ this.hasFocus = false;
185
+ this.label = "";
186
+ this.disabled = false;
187
+ }
188
+ handleBlur() {
189
+ this.hasFocus = false;
190
+ this.emit("sl-blur");
191
+ }
192
+ handleFocus() {
193
+ this.hasFocus = true;
194
+ this.emit("sl-focus");
195
+ }
196
+ handleClick(event) {
197
+ if (this.disabled) {
198
+ event.preventDefault();
199
+ event.stopPropagation();
200
+ }
201
+ }
202
+ /** Simulates a click on the icon button. */
203
+ click() {
204
+ this.button.click();
205
+ }
206
+ /** Sets focus on the icon button. */
207
+ focus(options) {
208
+ this.button.focus(options);
209
+ }
210
+ /** Removes focus from the icon button. */
211
+ blur() {
212
+ this.button.blur();
213
+ }
214
+ render() {
215
+ const isLink = this.href ? true : false;
216
+ const tag = isLink ? s`a` : s`button`;
217
+ return n`
218
+ <${tag}
219
+ part="base"
220
+ class=${e$2({
221
+ "icon-button": true,
222
+ "icon-button--disabled": !isLink && this.disabled,
223
+ "icon-button--focused": this.hasFocus
224
+ })}
225
+ ?disabled=${o$2(isLink ? void 0 : this.disabled)}
226
+ type=${o$2(isLink ? void 0 : "button")}
227
+ href=${o$2(isLink ? this.href : void 0)}
228
+ target=${o$2(isLink ? this.target : void 0)}
229
+ download=${o$2(isLink ? this.download : void 0)}
230
+ rel=${o$2(isLink && this.target ? "noreferrer noopener" : void 0)}
231
+ role=${o$2(isLink ? void 0 : "button")}
232
+ aria-disabled=${this.disabled ? "true" : "false"}
233
+ aria-label="${this.label}"
234
+ tabindex=${this.disabled ? "-1" : "0"}
235
+ @blur=${this.handleBlur}
236
+ @focus=${this.handleFocus}
237
+ @click=${this.handleClick}
238
+ >
239
+ <sl-icon
240
+ class="icon-button__icon"
241
+ name=${o$2(this.name)}
242
+ library=${o$2(this.library)}
243
+ src=${o$2(this.src)}
244
+ aria-hidden="true"
245
+ ></sl-icon>
246
+ </${tag}>
247
+ `;
248
+ }
249
+ };
250
+ SlIconButton.styles = [component_styles_default, icon_button_styles_default];
251
+ SlIconButton.dependencies = { "sl-icon": SlIcon };
252
+ __decorateClass([
253
+ e$3(".icon-button")
254
+ ], SlIconButton.prototype, "button", 2);
255
+ __decorateClass([
256
+ r()
257
+ ], SlIconButton.prototype, "hasFocus", 2);
258
+ __decorateClass([
259
+ n$1()
260
+ ], SlIconButton.prototype, "name", 2);
261
+ __decorateClass([
262
+ n$1()
263
+ ], SlIconButton.prototype, "library", 2);
264
+ __decorateClass([
265
+ n$1()
266
+ ], SlIconButton.prototype, "src", 2);
267
+ __decorateClass([
268
+ n$1()
269
+ ], SlIconButton.prototype, "href", 2);
270
+ __decorateClass([
271
+ n$1()
272
+ ], SlIconButton.prototype, "target", 2);
273
+ __decorateClass([
274
+ n$1()
275
+ ], SlIconButton.prototype, "download", 2);
276
+ __decorateClass([
277
+ n$1()
278
+ ], SlIconButton.prototype, "label", 2);
279
+ __decorateClass([
280
+ n$1({ type: Boolean, reflect: true })
281
+ ], SlIconButton.prototype, "disabled", 2);
282
+
283
+ var SlTag = class extends ShoelaceElement {
284
+ constructor() {
285
+ super(...arguments);
286
+ this.localize = new LocalizeController(this);
287
+ this.variant = "neutral";
288
+ this.size = "medium";
289
+ this.pill = false;
290
+ this.removable = false;
291
+ }
292
+ handleRemoveClick() {
293
+ this.emit("sl-remove");
294
+ }
295
+ render() {
296
+ return x`
297
+ <span
298
+ part="base"
299
+ class=${e$2({
300
+ tag: true,
301
+ // Types
302
+ "tag--primary": this.variant === "primary",
303
+ "tag--success": this.variant === "success",
304
+ "tag--neutral": this.variant === "neutral",
305
+ "tag--warning": this.variant === "warning",
306
+ "tag--danger": this.variant === "danger",
307
+ "tag--text": this.variant === "text",
308
+ // Sizes
309
+ "tag--small": this.size === "small",
310
+ "tag--medium": this.size === "medium",
311
+ "tag--large": this.size === "large",
312
+ // Modifiers
313
+ "tag--pill": this.pill,
314
+ "tag--removable": this.removable
315
+ })}
316
+ >
317
+ <slot part="content" class="tag__content"></slot>
318
+
319
+ ${this.removable ? x`
320
+ <sl-icon-button
321
+ part="remove-button"
322
+ exportparts="base:remove-button__base"
323
+ name="x-lg"
324
+ library="system"
325
+ label=${this.localize.term("remove")}
326
+ class="tag__remove"
327
+ @click=${this.handleRemoveClick}
328
+ tabindex="-1"
329
+ ></sl-icon-button>
330
+ ` : ""}
331
+ </span>
332
+ `;
333
+ }
334
+ };
335
+ SlTag.styles = [component_styles_default, tag_styles_default];
336
+ SlTag.dependencies = { "sl-icon-button": SlIconButton };
337
+ __decorateClass([
338
+ n$1({ reflect: true })
339
+ ], SlTag.prototype, "variant", 2);
340
+ __decorateClass([
341
+ n$1({ reflect: true })
342
+ ], SlTag.prototype, "size", 2);
343
+ __decorateClass([
344
+ n$1({ type: Boolean, reflect: true })
345
+ ], SlTag.prototype, "pill", 2);
346
+ __decorateClass([
347
+ n$1({ type: Boolean })
348
+ ], SlTag.prototype, "removable", 2);
349
+
350
+ // src/components/select/select.styles.ts
351
+ var select_styles_default = i`
352
+ :host {
353
+ display: block;
354
+ }
355
+
356
+ /** The popup */
357
+ .select {
358
+ flex: 1 1 auto;
359
+ display: inline-flex;
360
+ width: 100%;
361
+ position: relative;
362
+ vertical-align: middle;
363
+ }
364
+
365
+ .select::part(popup) {
366
+ z-index: var(--sl-z-index-dropdown);
367
+ }
368
+
369
+ .select[data-current-placement^='top']::part(popup) {
370
+ transform-origin: bottom;
371
+ }
372
+
373
+ .select[data-current-placement^='bottom']::part(popup) {
374
+ transform-origin: top;
375
+ }
376
+
377
+ /* Combobox */
378
+ .select__combobox {
379
+ flex: 1;
380
+ display: flex;
381
+ width: 100%;
382
+ min-width: 0;
383
+ position: relative;
384
+ align-items: center;
385
+ justify-content: start;
386
+ font-family: var(--sl-input-font-family);
387
+ font-weight: var(--sl-input-font-weight);
388
+ letter-spacing: var(--sl-input-letter-spacing);
389
+ vertical-align: middle;
390
+ overflow: hidden;
391
+ cursor: pointer;
392
+ transition:
393
+ var(--sl-transition-fast) color,
394
+ var(--sl-transition-fast) border,
395
+ var(--sl-transition-fast) box-shadow,
396
+ var(--sl-transition-fast) background-color;
397
+ }
398
+
399
+ .select__display-input {
400
+ position: relative;
401
+ width: 100%;
402
+ font: inherit;
403
+ border: none;
404
+ background: none;
405
+ color: var(--sl-input-color);
406
+ cursor: inherit;
407
+ overflow: hidden;
408
+ padding: 0;
409
+ margin: 0;
410
+ -webkit-appearance: none;
411
+ }
412
+
413
+ .select__display-input::placeholder {
414
+ color: var(--sl-input-placeholder-color);
415
+ }
416
+
417
+ .select:not(.select--disabled):hover .select__display-input {
418
+ color: var(--sl-input-color-hover);
419
+ }
420
+
421
+ .select__display-input:focus {
422
+ outline: none;
423
+ }
424
+
425
+ /* Visually hide the display input when multiple is enabled */
426
+ .select--multiple:not(.select--placeholder-visible) .select__display-input {
427
+ position: absolute;
428
+ z-index: -1;
429
+ top: 0;
430
+ left: 0;
431
+ width: 100%;
432
+ height: 100%;
433
+ opacity: 0;
434
+ }
435
+
436
+ .select__value-input {
437
+ position: absolute;
438
+ top: 0;
439
+ left: 0;
440
+ width: 100%;
441
+ height: 100%;
442
+ padding: 0;
443
+ margin: 0;
444
+ opacity: 0;
445
+ z-index: -1;
446
+ }
447
+
448
+ .select__tags {
449
+ display: flex;
450
+ flex: 1;
451
+ align-items: center;
452
+ flex-wrap: wrap;
453
+ margin-inline-start: var(--sl-spacing-2x-small);
454
+ }
455
+
456
+ .select__tags::slotted(sl-tag) {
457
+ cursor: pointer !important;
458
+ }
459
+
460
+ .select--disabled .select__tags,
461
+ .select--disabled .select__tags::slotted(sl-tag) {
462
+ cursor: not-allowed !important;
463
+ }
464
+
465
+ /* Standard selects */
466
+ .select--standard .select__combobox {
467
+ background-color: var(--sl-input-background-color);
468
+ border: solid var(--sl-input-border-width) var(--sl-input-border-color);
469
+ }
470
+
471
+ .select--standard.select--disabled .select__combobox {
472
+ background-color: var(--sl-input-background-color-disabled);
473
+ border-color: var(--sl-input-border-color-disabled);
474
+ color: var(--sl-input-color-disabled);
475
+ opacity: 0.5;
476
+ cursor: not-allowed;
477
+ outline: none;
478
+ }
479
+
480
+ .select--standard:not(.select--disabled).select--open .select__combobox,
481
+ .select--standard:not(.select--disabled).select--focused .select__combobox {
482
+ background-color: var(--sl-input-background-color-focus);
483
+ border-color: var(--sl-input-border-color-focus);
484
+ box-shadow: 0 0 0 var(--sl-focus-ring-width) var(--sl-input-focus-ring-color);
485
+ }
486
+
487
+ /* Filled selects */
488
+ .select--filled .select__combobox {
489
+ border: none;
490
+ background-color: var(--sl-input-filled-background-color);
491
+ color: var(--sl-input-color);
492
+ }
493
+
494
+ .select--filled:hover:not(.select--disabled) .select__combobox {
495
+ background-color: var(--sl-input-filled-background-color-hover);
496
+ }
497
+
498
+ .select--filled.select--disabled .select__combobox {
499
+ background-color: var(--sl-input-filled-background-color-disabled);
500
+ opacity: 0.5;
501
+ cursor: not-allowed;
502
+ }
503
+
504
+ .select--filled:not(.select--disabled).select--open .select__combobox,
505
+ .select--filled:not(.select--disabled).select--focused .select__combobox {
506
+ background-color: var(--sl-input-filled-background-color-focus);
507
+ outline: var(--sl-focus-ring);
508
+ }
509
+
510
+ /* Sizes */
511
+ .select--small .select__combobox {
512
+ border-radius: var(--sl-input-border-radius-small);
513
+ font-size: var(--sl-input-font-size-small);
514
+ min-height: var(--sl-input-height-small);
515
+ padding-block: 0;
516
+ padding-inline: var(--sl-input-spacing-small);
517
+ }
518
+
519
+ .select--small .select__clear {
520
+ margin-inline-start: var(--sl-input-spacing-small);
521
+ }
522
+
523
+ .select--small .select__prefix::slotted(*) {
524
+ margin-inline-end: var(--sl-input-spacing-small);
525
+ }
526
+
527
+ .select--small.select--multiple:not(.select--placeholder-visible) .select__combobox {
528
+ padding-block: 2px;
529
+ padding-inline-start: 0;
530
+ }
531
+
532
+ .select--small .select__tags {
533
+ gap: 2px;
534
+ }
535
+
536
+ .select--medium .select__combobox {
537
+ border-radius: var(--sl-input-border-radius-medium);
538
+ font-size: var(--sl-input-font-size-medium);
539
+ min-height: var(--sl-input-height-medium);
540
+ padding-block: 0;
541
+ padding-inline: var(--sl-input-spacing-medium);
542
+ }
543
+
544
+ .select--medium .select__clear {
545
+ margin-inline-start: var(--sl-input-spacing-medium);
546
+ }
547
+
548
+ .select--medium .select__prefix::slotted(*) {
549
+ margin-inline-end: var(--sl-input-spacing-medium);
550
+ }
551
+
552
+ .select--medium.select--multiple:not(.select--placeholder-visible) .select__combobox {
553
+ padding-inline-start: 0;
554
+ padding-block: 3px;
555
+ }
556
+
557
+ .select--medium .select__tags {
558
+ gap: 3px;
559
+ }
560
+
561
+ .select--large .select__combobox {
562
+ border-radius: var(--sl-input-border-radius-large);
563
+ font-size: var(--sl-input-font-size-large);
564
+ min-height: var(--sl-input-height-large);
565
+ padding-block: 0;
566
+ padding-inline: var(--sl-input-spacing-large);
567
+ }
568
+
569
+ .select--large .select__clear {
570
+ margin-inline-start: var(--sl-input-spacing-large);
571
+ }
572
+
573
+ .select--large .select__prefix::slotted(*) {
574
+ margin-inline-end: var(--sl-input-spacing-large);
575
+ }
576
+
577
+ .select--large.select--multiple:not(.select--placeholder-visible) .select__combobox {
578
+ padding-inline-start: 0;
579
+ padding-block: 4px;
580
+ }
581
+
582
+ .select--large .select__tags {
583
+ gap: 4px;
584
+ }
585
+
586
+ /* Pills */
587
+ .select--pill.select--small .select__combobox {
588
+ border-radius: var(--sl-input-height-small);
589
+ }
590
+
591
+ .select--pill.select--medium .select__combobox {
592
+ border-radius: var(--sl-input-height-medium);
593
+ }
594
+
595
+ .select--pill.select--large .select__combobox {
596
+ border-radius: var(--sl-input-height-large);
597
+ }
598
+
599
+ /* Prefix */
600
+ .select__prefix {
601
+ flex: 0;
602
+ display: inline-flex;
603
+ align-items: center;
604
+ color: var(--sl-input-placeholder-color);
605
+ }
606
+
607
+ /* Clear button */
608
+ .select__clear {
609
+ display: inline-flex;
610
+ align-items: center;
611
+ justify-content: center;
612
+ font-size: inherit;
613
+ color: var(--sl-input-icon-color);
614
+ border: none;
615
+ background: none;
616
+ padding: 0;
617
+ transition: var(--sl-transition-fast) color;
618
+ cursor: pointer;
619
+ }
620
+
621
+ .select__clear:hover {
622
+ color: var(--sl-input-icon-color-hover);
623
+ }
624
+
625
+ .select__clear:focus {
626
+ outline: none;
627
+ }
628
+
629
+ /* Expand icon */
630
+ .select__expand-icon {
631
+ flex: 0 0 auto;
632
+ display: flex;
633
+ align-items: center;
634
+ transition: var(--sl-transition-medium) rotate ease;
635
+ rotate: 0;
636
+ margin-inline-start: var(--sl-spacing-small);
637
+ }
638
+
639
+ .select--open .select__expand-icon {
640
+ rotate: -180deg;
641
+ }
642
+
643
+ /* Listbox */
644
+ .select__listbox {
645
+ display: block;
646
+ position: relative;
647
+ font-family: var(--sl-font-sans);
648
+ font-size: var(--sl-font-size-medium);
649
+ font-weight: var(--sl-font-weight-normal);
650
+ box-shadow: var(--sl-shadow-large);
651
+ background: var(--sl-panel-background-color);
652
+ border: solid var(--sl-panel-border-width) var(--sl-panel-border-color);
653
+ border-radius: var(--sl-border-radius-medium);
654
+ padding-block: var(--sl-spacing-x-small);
655
+ padding-inline: 0;
656
+ overflow: auto;
657
+ overscroll-behavior: none;
658
+
659
+ /* Make sure it adheres to the popup's auto size */
660
+ max-width: var(--auto-size-available-width);
661
+ max-height: var(--auto-size-available-height);
662
+ }
663
+
664
+ .select__listbox ::slotted(sl-divider) {
665
+ --spacing: var(--sl-spacing-x-small);
666
+ }
667
+
668
+ .select__listbox ::slotted(small) {
669
+ font-size: var(--sl-font-size-small);
670
+ font-weight: var(--sl-font-weight-semibold);
671
+ color: var(--sl-color-neutral-500);
672
+ padding-block: var(--sl-spacing-x-small);
673
+ padding-inline: var(--sl-spacing-x-large);
674
+ }
675
+ `;
676
+
677
+ // src/internal/offset.ts
678
+ function getOffset(element, parent) {
679
+ return {
680
+ top: Math.round(element.getBoundingClientRect().top - parent.getBoundingClientRect().top),
681
+ left: Math.round(element.getBoundingClientRect().left - parent.getBoundingClientRect().left)
682
+ };
683
+ }
684
+ function scrollIntoView(element, container, direction = "vertical", behavior = "smooth") {
685
+ const offset = getOffset(element, container);
686
+ const offsetTop = offset.top + container.scrollTop;
687
+ const offsetLeft = offset.left + container.scrollLeft;
688
+ const minX = container.scrollLeft;
689
+ const maxX = container.scrollLeft + container.offsetWidth;
690
+ const minY = container.scrollTop;
691
+ const maxY = container.scrollTop + container.offsetHeight;
692
+ if (direction === "horizontal" || direction === "both") {
693
+ if (offsetLeft < minX) {
694
+ container.scrollTo({ left: offsetLeft, behavior });
695
+ } else if (offsetLeft + element.clientWidth > maxX) {
696
+ container.scrollTo({ left: offsetLeft - container.offsetWidth + element.clientWidth, behavior });
697
+ }
698
+ }
699
+ if (direction === "vertical" || direction === "both") {
700
+ if (offsetTop < minY) {
701
+ container.scrollTo({ top: offsetTop, behavior });
702
+ } else if (offsetTop + element.clientHeight > maxY) {
703
+ container.scrollTo({ top: offsetTop - container.offsetHeight + element.clientHeight, behavior });
704
+ }
705
+ }
706
+ }
707
+
708
+ // src/components/popup/popup.styles.ts
709
+ var popup_styles_default = i`
710
+ :host {
711
+ --arrow-color: var(--sl-color-neutral-1000);
712
+ --arrow-size: 6px;
713
+
714
+ /*
715
+ * These properties are computed to account for the arrow's dimensions after being rotated 45º. The constant
716
+ * 0.7071 is derived from sin(45), which is the diagonal size of the arrow's container after rotating.
717
+ */
718
+ --arrow-size-diagonal: calc(var(--arrow-size) * 0.7071);
719
+ --arrow-padding-offset: calc(var(--arrow-size-diagonal) - var(--arrow-size));
720
+
721
+ display: contents;
722
+ }
723
+
724
+ .popup {
725
+ position: absolute;
726
+ isolation: isolate;
727
+ max-width: var(--auto-size-available-width, none);
728
+ max-height: var(--auto-size-available-height, none);
729
+ }
730
+
731
+ .popup--fixed {
732
+ position: fixed;
733
+ }
734
+
735
+ .popup:not(.popup--active) {
736
+ display: none;
737
+ }
738
+
739
+ .popup__arrow {
740
+ position: absolute;
741
+ width: calc(var(--arrow-size-diagonal) * 2);
742
+ height: calc(var(--arrow-size-diagonal) * 2);
743
+ rotate: 45deg;
744
+ background: var(--arrow-color);
745
+ z-index: -1;
746
+ }
747
+
748
+ /* Hover bridge */
749
+ .popup-hover-bridge:not(.popup-hover-bridge--visible) {
750
+ display: none;
751
+ }
752
+
753
+ .popup-hover-bridge {
754
+ position: fixed;
755
+ z-index: calc(var(--sl-z-index-dropdown) - 1);
756
+ top: 0;
757
+ right: 0;
758
+ bottom: 0;
759
+ left: 0;
760
+ clip-path: polygon(
761
+ var(--hover-bridge-top-left-x, 0) var(--hover-bridge-top-left-y, 0),
762
+ var(--hover-bridge-top-right-x, 0) var(--hover-bridge-top-right-y, 0),
763
+ var(--hover-bridge-bottom-right-x, 0) var(--hover-bridge-bottom-right-y, 0),
764
+ var(--hover-bridge-bottom-left-x, 0) var(--hover-bridge-bottom-left-y, 0)
765
+ );
766
+ }
767
+ `;
768
+
769
+ /**
770
+ * Custom positioning reference element.
771
+ * @see https://floating-ui.com/docs/virtual-elements
772
+ */
773
+
774
+ const sides = ['top', 'right', 'bottom', 'left'];
775
+ const alignments = ['start', 'end'];
776
+ const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
777
+ const min = Math.min;
778
+ const max = Math.max;
779
+ const round = Math.round;
780
+ const floor = Math.floor;
781
+ const createCoords = v => ({
782
+ x: v,
783
+ y: v
784
+ });
785
+ const oppositeSideMap = {
786
+ left: 'right',
787
+ right: 'left',
788
+ bottom: 'top',
789
+ top: 'bottom'
790
+ };
791
+ const oppositeAlignmentMap = {
792
+ start: 'end',
793
+ end: 'start'
794
+ };
795
+ function clamp(start, value, end) {
796
+ return max(start, min(value, end));
797
+ }
798
+ function evaluate(value, param) {
799
+ return typeof value === 'function' ? value(param) : value;
800
+ }
801
+ function getSide(placement) {
802
+ return placement.split('-')[0];
803
+ }
804
+ function getAlignment(placement) {
805
+ return placement.split('-')[1];
806
+ }
807
+ function getOppositeAxis(axis) {
808
+ return axis === 'x' ? 'y' : 'x';
809
+ }
810
+ function getAxisLength(axis) {
811
+ return axis === 'y' ? 'height' : 'width';
812
+ }
813
+ function getSideAxis(placement) {
814
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
815
+ }
816
+ function getAlignmentAxis(placement) {
817
+ return getOppositeAxis(getSideAxis(placement));
818
+ }
819
+ function getAlignmentSides(placement, rects, rtl) {
820
+ if (rtl === void 0) {
821
+ rtl = false;
822
+ }
823
+ const alignment = getAlignment(placement);
824
+ const alignmentAxis = getAlignmentAxis(placement);
825
+ const length = getAxisLength(alignmentAxis);
826
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
827
+ if (rects.reference[length] > rects.floating[length]) {
828
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
829
+ }
830
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
831
+ }
832
+ function getExpandedPlacements(placement) {
833
+ const oppositePlacement = getOppositePlacement(placement);
834
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
835
+ }
836
+ function getOppositeAlignmentPlacement(placement) {
837
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
838
+ }
839
+ function getSideList(side, isStart, rtl) {
840
+ const lr = ['left', 'right'];
841
+ const rl = ['right', 'left'];
842
+ const tb = ['top', 'bottom'];
843
+ const bt = ['bottom', 'top'];
844
+ switch (side) {
845
+ case 'top':
846
+ case 'bottom':
847
+ if (rtl) return isStart ? rl : lr;
848
+ return isStart ? lr : rl;
849
+ case 'left':
850
+ case 'right':
851
+ return isStart ? tb : bt;
852
+ default:
853
+ return [];
854
+ }
855
+ }
856
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
857
+ const alignment = getAlignment(placement);
858
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
859
+ if (alignment) {
860
+ list = list.map(side => side + "-" + alignment);
861
+ if (flipAlignment) {
862
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
863
+ }
864
+ }
865
+ return list;
866
+ }
867
+ function getOppositePlacement(placement) {
868
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
869
+ }
870
+ function expandPaddingObject(padding) {
871
+ return {
872
+ top: 0,
873
+ right: 0,
874
+ bottom: 0,
875
+ left: 0,
876
+ ...padding
877
+ };
878
+ }
879
+ function getPaddingObject(padding) {
880
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
881
+ top: padding,
882
+ right: padding,
883
+ bottom: padding,
884
+ left: padding
885
+ };
886
+ }
887
+ function rectToClientRect(rect) {
888
+ const {
889
+ x,
890
+ y,
891
+ width,
892
+ height
893
+ } = rect;
894
+ return {
895
+ width,
896
+ height,
897
+ top: y,
898
+ left: x,
899
+ right: x + width,
900
+ bottom: y + height,
901
+ x,
902
+ y
903
+ };
904
+ }
905
+
906
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
907
+ let {
908
+ reference,
909
+ floating
910
+ } = _ref;
911
+ const sideAxis = getSideAxis(placement);
912
+ const alignmentAxis = getAlignmentAxis(placement);
913
+ const alignLength = getAxisLength(alignmentAxis);
914
+ const side = getSide(placement);
915
+ const isVertical = sideAxis === 'y';
916
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
917
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
918
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
919
+ let coords;
920
+ switch (side) {
921
+ case 'top':
922
+ coords = {
923
+ x: commonX,
924
+ y: reference.y - floating.height
925
+ };
926
+ break;
927
+ case 'bottom':
928
+ coords = {
929
+ x: commonX,
930
+ y: reference.y + reference.height
931
+ };
932
+ break;
933
+ case 'right':
934
+ coords = {
935
+ x: reference.x + reference.width,
936
+ y: commonY
937
+ };
938
+ break;
939
+ case 'left':
940
+ coords = {
941
+ x: reference.x - floating.width,
942
+ y: commonY
943
+ };
944
+ break;
945
+ default:
946
+ coords = {
947
+ x: reference.x,
948
+ y: reference.y
949
+ };
950
+ }
951
+ switch (getAlignment(placement)) {
952
+ case 'start':
953
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
954
+ break;
955
+ case 'end':
956
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
957
+ break;
958
+ }
959
+ return coords;
960
+ }
961
+
962
+ /**
963
+ * Computes the `x` and `y` coordinates that will place the floating element
964
+ * next to a given reference element.
965
+ *
966
+ * This export does not have any `platform` interface logic. You will need to
967
+ * write one for the platform you are using Floating UI with.
968
+ */
969
+ const computePosition$1 = async (reference, floating, config) => {
970
+ const {
971
+ placement = 'bottom',
972
+ strategy = 'absolute',
973
+ middleware = [],
974
+ platform
975
+ } = config;
976
+ const validMiddleware = middleware.filter(Boolean);
977
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
978
+ let rects = await platform.getElementRects({
979
+ reference,
980
+ floating,
981
+ strategy
982
+ });
983
+ let {
984
+ x,
985
+ y
986
+ } = computeCoordsFromPlacement(rects, placement, rtl);
987
+ let statefulPlacement = placement;
988
+ let middlewareData = {};
989
+ let resetCount = 0;
990
+ for (let i = 0; i < validMiddleware.length; i++) {
991
+ const {
992
+ name,
993
+ fn
994
+ } = validMiddleware[i];
995
+ const {
996
+ x: nextX,
997
+ y: nextY,
998
+ data,
999
+ reset
1000
+ } = await fn({
1001
+ x,
1002
+ y,
1003
+ initialPlacement: placement,
1004
+ placement: statefulPlacement,
1005
+ strategy,
1006
+ middlewareData,
1007
+ rects,
1008
+ platform,
1009
+ elements: {
1010
+ reference,
1011
+ floating
1012
+ }
1013
+ });
1014
+ x = nextX != null ? nextX : x;
1015
+ y = nextY != null ? nextY : y;
1016
+ middlewareData = {
1017
+ ...middlewareData,
1018
+ [name]: {
1019
+ ...middlewareData[name],
1020
+ ...data
1021
+ }
1022
+ };
1023
+ if (reset && resetCount <= 50) {
1024
+ resetCount++;
1025
+ if (typeof reset === 'object') {
1026
+ if (reset.placement) {
1027
+ statefulPlacement = reset.placement;
1028
+ }
1029
+ if (reset.rects) {
1030
+ rects = reset.rects === true ? await platform.getElementRects({
1031
+ reference,
1032
+ floating,
1033
+ strategy
1034
+ }) : reset.rects;
1035
+ }
1036
+ ({
1037
+ x,
1038
+ y
1039
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
1040
+ }
1041
+ i = -1;
1042
+ }
1043
+ }
1044
+ return {
1045
+ x,
1046
+ y,
1047
+ placement: statefulPlacement,
1048
+ strategy,
1049
+ middlewareData
1050
+ };
1051
+ };
1052
+
1053
+ /**
1054
+ * Resolves with an object of overflow side offsets that determine how much the
1055
+ * element is overflowing a given clipping boundary on each side.
1056
+ * - positive = overflowing the boundary by that number of pixels
1057
+ * - negative = how many pixels left before it will overflow
1058
+ * - 0 = lies flush with the boundary
1059
+ * @see https://floating-ui.com/docs/detectOverflow
1060
+ */
1061
+ async function detectOverflow(state, options) {
1062
+ var _await$platform$isEle;
1063
+ if (options === void 0) {
1064
+ options = {};
1065
+ }
1066
+ const {
1067
+ x,
1068
+ y,
1069
+ platform,
1070
+ rects,
1071
+ elements,
1072
+ strategy
1073
+ } = state;
1074
+ const {
1075
+ boundary = 'clippingAncestors',
1076
+ rootBoundary = 'viewport',
1077
+ elementContext = 'floating',
1078
+ altBoundary = false,
1079
+ padding = 0
1080
+ } = evaluate(options, state);
1081
+ const paddingObject = getPaddingObject(padding);
1082
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
1083
+ const element = elements[altBoundary ? altContext : elementContext];
1084
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
1085
+ 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))),
1086
+ boundary,
1087
+ rootBoundary,
1088
+ strategy
1089
+ }));
1090
+ const rect = elementContext === 'floating' ? {
1091
+ x,
1092
+ y,
1093
+ width: rects.floating.width,
1094
+ height: rects.floating.height
1095
+ } : rects.reference;
1096
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
1097
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
1098
+ x: 1,
1099
+ y: 1
1100
+ } : {
1101
+ x: 1,
1102
+ y: 1
1103
+ };
1104
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
1105
+ elements,
1106
+ rect,
1107
+ offsetParent,
1108
+ strategy
1109
+ }) : rect);
1110
+ return {
1111
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
1112
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
1113
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
1114
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
1115
+ };
1116
+ }
1117
+
1118
+ /**
1119
+ * Provides data to position an inner element of the floating element so that it
1120
+ * appears centered to the reference element.
1121
+ * @see https://floating-ui.com/docs/arrow
1122
+ */
1123
+ const arrow$1 = options => ({
1124
+ name: 'arrow',
1125
+ options,
1126
+ async fn(state) {
1127
+ const {
1128
+ x,
1129
+ y,
1130
+ placement,
1131
+ rects,
1132
+ platform,
1133
+ elements,
1134
+ middlewareData
1135
+ } = state;
1136
+ // Since `element` is required, we don't Partial<> the type.
1137
+ const {
1138
+ element,
1139
+ padding = 0
1140
+ } = evaluate(options, state) || {};
1141
+ if (element == null) {
1142
+ return {};
1143
+ }
1144
+ const paddingObject = getPaddingObject(padding);
1145
+ const coords = {
1146
+ x,
1147
+ y
1148
+ };
1149
+ const axis = getAlignmentAxis(placement);
1150
+ const length = getAxisLength(axis);
1151
+ const arrowDimensions = await platform.getDimensions(element);
1152
+ const isYAxis = axis === 'y';
1153
+ const minProp = isYAxis ? 'top' : 'left';
1154
+ const maxProp = isYAxis ? 'bottom' : 'right';
1155
+ const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
1156
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
1157
+ const startDiff = coords[axis] - rects.reference[axis];
1158
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
1159
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
1160
+
1161
+ // DOM platform can return `window` as the `offsetParent`.
1162
+ if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
1163
+ clientSize = elements.floating[clientProp] || rects.floating[length];
1164
+ }
1165
+ const centerToReference = endDiff / 2 - startDiff / 2;
1166
+
1167
+ // If the padding is large enough that it causes the arrow to no longer be
1168
+ // centered, modify the padding so that it is centered.
1169
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
1170
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
1171
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
1172
+
1173
+ // Make sure the arrow doesn't overflow the floating element if the center
1174
+ // point is outside the floating element's bounds.
1175
+ const min$1 = minPadding;
1176
+ const max = clientSize - arrowDimensions[length] - maxPadding;
1177
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
1178
+ const offset = clamp(min$1, center, max);
1179
+
1180
+ // If the reference is small enough that the arrow's padding causes it to
1181
+ // to point to nothing for an aligned placement, adjust the offset of the
1182
+ // floating element itself. To ensure `shift()` continues to take action,
1183
+ // a single reset is performed when this is true.
1184
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
1185
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
1186
+ return {
1187
+ [axis]: coords[axis] + alignmentOffset,
1188
+ data: {
1189
+ [axis]: offset,
1190
+ centerOffset: center - offset - alignmentOffset,
1191
+ ...(shouldAddOffset && {
1192
+ alignmentOffset
1193
+ })
1194
+ },
1195
+ reset: shouldAddOffset
1196
+ };
1197
+ }
1198
+ });
1199
+
1200
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
1201
+ const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
1202
+ return allowedPlacementsSortedByAlignment.filter(placement => {
1203
+ if (alignment) {
1204
+ return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
1205
+ }
1206
+ return true;
1207
+ });
1208
+ }
1209
+ /**
1210
+ * Optimizes the visibility of the floating element by choosing the placement
1211
+ * that has the most space available automatically, without needing to specify a
1212
+ * preferred placement. Alternative to `flip`.
1213
+ * @see https://floating-ui.com/docs/autoPlacement
1214
+ */
1215
+ const autoPlacement = function (options) {
1216
+ if (options === void 0) {
1217
+ options = {};
1218
+ }
1219
+ return {
1220
+ name: 'autoPlacement',
1221
+ options,
1222
+ async fn(state) {
1223
+ var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
1224
+ const {
1225
+ rects,
1226
+ middlewareData,
1227
+ placement,
1228
+ platform,
1229
+ elements
1230
+ } = state;
1231
+ const {
1232
+ crossAxis = false,
1233
+ alignment,
1234
+ allowedPlacements = placements,
1235
+ autoAlignment = true,
1236
+ ...detectOverflowOptions
1237
+ } = evaluate(options, state);
1238
+ const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
1239
+ const overflow = await detectOverflow(state, detectOverflowOptions);
1240
+ const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
1241
+ const currentPlacement = placements$1[currentIndex];
1242
+ if (currentPlacement == null) {
1243
+ return {};
1244
+ }
1245
+ const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
1246
+
1247
+ // Make `computeCoords` start from the right place.
1248
+ if (placement !== currentPlacement) {
1249
+ return {
1250
+ reset: {
1251
+ placement: placements$1[0]
1252
+ }
1253
+ };
1254
+ }
1255
+ const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
1256
+ const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
1257
+ placement: currentPlacement,
1258
+ overflows: currentOverflows
1259
+ }];
1260
+ const nextPlacement = placements$1[currentIndex + 1];
1261
+
1262
+ // There are more placements to check.
1263
+ if (nextPlacement) {
1264
+ return {
1265
+ data: {
1266
+ index: currentIndex + 1,
1267
+ overflows: allOverflows
1268
+ },
1269
+ reset: {
1270
+ placement: nextPlacement
1271
+ }
1272
+ };
1273
+ }
1274
+ const placementsSortedByMostSpace = allOverflows.map(d => {
1275
+ const alignment = getAlignment(d.placement);
1276
+ return [d.placement, alignment && crossAxis ?
1277
+ // Check along the mainAxis and main crossAxis side.
1278
+ d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
1279
+ // Check only the mainAxis.
1280
+ d.overflows[0], d.overflows];
1281
+ }).sort((a, b) => a[1] - b[1]);
1282
+ const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
1283
+ // Aligned placements should not check their opposite crossAxis
1284
+ // side.
1285
+ getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
1286
+ const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
1287
+ if (resetPlacement !== placement) {
1288
+ return {
1289
+ data: {
1290
+ index: currentIndex + 1,
1291
+ overflows: allOverflows
1292
+ },
1293
+ reset: {
1294
+ placement: resetPlacement
1295
+ }
1296
+ };
1297
+ }
1298
+ return {};
1299
+ }
1300
+ };
1301
+ };
1302
+
1303
+ /**
1304
+ * Optimizes the visibility of the floating element by flipping the `placement`
1305
+ * in order to keep it in view when the preferred placement(s) will overflow the
1306
+ * clipping boundary. Alternative to `autoPlacement`.
1307
+ * @see https://floating-ui.com/docs/flip
1308
+ */
1309
+ const flip$1 = function (options) {
1310
+ if (options === void 0) {
1311
+ options = {};
1312
+ }
1313
+ return {
1314
+ name: 'flip',
1315
+ options,
1316
+ async fn(state) {
1317
+ var _middlewareData$arrow, _middlewareData$flip;
1318
+ const {
1319
+ placement,
1320
+ middlewareData,
1321
+ rects,
1322
+ initialPlacement,
1323
+ platform,
1324
+ elements
1325
+ } = state;
1326
+ const {
1327
+ mainAxis: checkMainAxis = true,
1328
+ crossAxis: checkCrossAxis = true,
1329
+ fallbackPlacements: specifiedFallbackPlacements,
1330
+ fallbackStrategy = 'bestFit',
1331
+ fallbackAxisSideDirection = 'none',
1332
+ flipAlignment = true,
1333
+ ...detectOverflowOptions
1334
+ } = evaluate(options, state);
1335
+
1336
+ // If a reset by the arrow was caused due to an alignment offset being
1337
+ // added, we should skip any logic now since `flip()` has already done its
1338
+ // work.
1339
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
1340
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1341
+ return {};
1342
+ }
1343
+ const side = getSide(placement);
1344
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
1345
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
1346
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
1347
+ if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
1348
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
1349
+ }
1350
+ const placements = [initialPlacement, ...fallbackPlacements];
1351
+ const overflow = await detectOverflow(state, detectOverflowOptions);
1352
+ const overflows = [];
1353
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
1354
+ if (checkMainAxis) {
1355
+ overflows.push(overflow[side]);
1356
+ }
1357
+ if (checkCrossAxis) {
1358
+ const sides = getAlignmentSides(placement, rects, rtl);
1359
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
1360
+ }
1361
+ overflowsData = [...overflowsData, {
1362
+ placement,
1363
+ overflows
1364
+ }];
1365
+
1366
+ // One or more sides is overflowing.
1367
+ if (!overflows.every(side => side <= 0)) {
1368
+ var _middlewareData$flip2, _overflowsData$filter;
1369
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
1370
+ const nextPlacement = placements[nextIndex];
1371
+ if (nextPlacement) {
1372
+ // Try next placement and re-run the lifecycle.
1373
+ return {
1374
+ data: {
1375
+ index: nextIndex,
1376
+ overflows: overflowsData
1377
+ },
1378
+ reset: {
1379
+ placement: nextPlacement
1380
+ }
1381
+ };
1382
+ }
1383
+
1384
+ // First, find the candidates that fit on the mainAxis side of overflow,
1385
+ // then find the placement that fits the best on the main crossAxis side.
1386
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
1387
+
1388
+ // Otherwise fallback.
1389
+ if (!resetPlacement) {
1390
+ switch (fallbackStrategy) {
1391
+ case 'bestFit':
1392
+ {
1393
+ var _overflowsData$map$so;
1394
+ const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
1395
+ if (placement) {
1396
+ resetPlacement = placement;
1397
+ }
1398
+ break;
1399
+ }
1400
+ case 'initialPlacement':
1401
+ resetPlacement = initialPlacement;
1402
+ break;
1403
+ }
1404
+ }
1405
+ if (placement !== resetPlacement) {
1406
+ return {
1407
+ reset: {
1408
+ placement: resetPlacement
1409
+ }
1410
+ };
1411
+ }
1412
+ }
1413
+ return {};
1414
+ }
1415
+ };
1416
+ };
1417
+
1418
+ function getSideOffsets(overflow, rect) {
1419
+ return {
1420
+ top: overflow.top - rect.height,
1421
+ right: overflow.right - rect.width,
1422
+ bottom: overflow.bottom - rect.height,
1423
+ left: overflow.left - rect.width
1424
+ };
1425
+ }
1426
+ function isAnySideFullyClipped(overflow) {
1427
+ return sides.some(side => overflow[side] >= 0);
1428
+ }
1429
+ /**
1430
+ * Provides data to hide the floating element in applicable situations, such as
1431
+ * when it is not in the same clipping context as the reference element.
1432
+ * @see https://floating-ui.com/docs/hide
1433
+ */
1434
+ const hide = function (options) {
1435
+ if (options === void 0) {
1436
+ options = {};
1437
+ }
1438
+ return {
1439
+ name: 'hide',
1440
+ options,
1441
+ async fn(state) {
1442
+ const {
1443
+ rects
1444
+ } = state;
1445
+ const {
1446
+ strategy = 'referenceHidden',
1447
+ ...detectOverflowOptions
1448
+ } = evaluate(options, state);
1449
+ switch (strategy) {
1450
+ case 'referenceHidden':
1451
+ {
1452
+ const overflow = await detectOverflow(state, {
1453
+ ...detectOverflowOptions,
1454
+ elementContext: 'reference'
1455
+ });
1456
+ const offsets = getSideOffsets(overflow, rects.reference);
1457
+ return {
1458
+ data: {
1459
+ referenceHiddenOffsets: offsets,
1460
+ referenceHidden: isAnySideFullyClipped(offsets)
1461
+ }
1462
+ };
1463
+ }
1464
+ case 'escaped':
1465
+ {
1466
+ const overflow = await detectOverflow(state, {
1467
+ ...detectOverflowOptions,
1468
+ altBoundary: true
1469
+ });
1470
+ const offsets = getSideOffsets(overflow, rects.floating);
1471
+ return {
1472
+ data: {
1473
+ escapedOffsets: offsets,
1474
+ escaped: isAnySideFullyClipped(offsets)
1475
+ }
1476
+ };
1477
+ }
1478
+ default:
1479
+ {
1480
+ return {};
1481
+ }
1482
+ }
1483
+ }
1484
+ };
1485
+ };
1486
+
1487
+ function getBoundingRect(rects) {
1488
+ const minX = min(...rects.map(rect => rect.left));
1489
+ const minY = min(...rects.map(rect => rect.top));
1490
+ const maxX = max(...rects.map(rect => rect.right));
1491
+ const maxY = max(...rects.map(rect => rect.bottom));
1492
+ return {
1493
+ x: minX,
1494
+ y: minY,
1495
+ width: maxX - minX,
1496
+ height: maxY - minY
1497
+ };
1498
+ }
1499
+ function getRectsByLine(rects) {
1500
+ const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
1501
+ const groups = [];
1502
+ let prevRect = null;
1503
+ for (let i = 0; i < sortedRects.length; i++) {
1504
+ const rect = sortedRects[i];
1505
+ if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
1506
+ groups.push([rect]);
1507
+ } else {
1508
+ groups[groups.length - 1].push(rect);
1509
+ }
1510
+ prevRect = rect;
1511
+ }
1512
+ return groups.map(rect => rectToClientRect(getBoundingRect(rect)));
1513
+ }
1514
+ /**
1515
+ * Provides improved positioning for inline reference elements that can span
1516
+ * over multiple lines, such as hyperlinks or range selections.
1517
+ * @see https://floating-ui.com/docs/inline
1518
+ */
1519
+ const inline = function (options) {
1520
+ if (options === void 0) {
1521
+ options = {};
1522
+ }
1523
+ return {
1524
+ name: 'inline',
1525
+ options,
1526
+ async fn(state) {
1527
+ const {
1528
+ placement,
1529
+ elements,
1530
+ rects,
1531
+ platform,
1532
+ strategy
1533
+ } = state;
1534
+ // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
1535
+ // ClientRect's bounds, despite the event listener being triggered. A
1536
+ // padding of 2 seems to handle this issue.
1537
+ const {
1538
+ padding = 2,
1539
+ x,
1540
+ y
1541
+ } = evaluate(options, state);
1542
+ const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
1543
+ const clientRects = getRectsByLine(nativeClientRects);
1544
+ const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
1545
+ const paddingObject = getPaddingObject(padding);
1546
+ function getBoundingClientRect() {
1547
+ // There are two rects and they are disjoined.
1548
+ if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
1549
+ // Find the first rect in which the point is fully inside.
1550
+ return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
1551
+ }
1552
+
1553
+ // There are 2 or more connected rects.
1554
+ if (clientRects.length >= 2) {
1555
+ if (getSideAxis(placement) === 'y') {
1556
+ const firstRect = clientRects[0];
1557
+ const lastRect = clientRects[clientRects.length - 1];
1558
+ const isTop = getSide(placement) === 'top';
1559
+ const top = firstRect.top;
1560
+ const bottom = lastRect.bottom;
1561
+ const left = isTop ? firstRect.left : lastRect.left;
1562
+ const right = isTop ? firstRect.right : lastRect.right;
1563
+ const width = right - left;
1564
+ const height = bottom - top;
1565
+ return {
1566
+ top,
1567
+ bottom,
1568
+ left,
1569
+ right,
1570
+ width,
1571
+ height,
1572
+ x: left,
1573
+ y: top
1574
+ };
1575
+ }
1576
+ const isLeftSide = getSide(placement) === 'left';
1577
+ const maxRight = max(...clientRects.map(rect => rect.right));
1578
+ const minLeft = min(...clientRects.map(rect => rect.left));
1579
+ const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
1580
+ const top = measureRects[0].top;
1581
+ const bottom = measureRects[measureRects.length - 1].bottom;
1582
+ const left = minLeft;
1583
+ const right = maxRight;
1584
+ const width = right - left;
1585
+ const height = bottom - top;
1586
+ return {
1587
+ top,
1588
+ bottom,
1589
+ left,
1590
+ right,
1591
+ width,
1592
+ height,
1593
+ x: left,
1594
+ y: top
1595
+ };
1596
+ }
1597
+ return fallback;
1598
+ }
1599
+ const resetRects = await platform.getElementRects({
1600
+ reference: {
1601
+ getBoundingClientRect
1602
+ },
1603
+ floating: elements.floating,
1604
+ strategy
1605
+ });
1606
+ if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
1607
+ return {
1608
+ reset: {
1609
+ rects: resetRects
1610
+ }
1611
+ };
1612
+ }
1613
+ return {};
1614
+ }
1615
+ };
1616
+ };
1617
+
1618
+ // For type backwards-compatibility, the `OffsetOptions` type was also
1619
+ // Derivable.
1620
+
1621
+ async function convertValueToCoords(state, options) {
1622
+ const {
1623
+ placement,
1624
+ platform,
1625
+ elements
1626
+ } = state;
1627
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
1628
+ const side = getSide(placement);
1629
+ const alignment = getAlignment(placement);
1630
+ const isVertical = getSideAxis(placement) === 'y';
1631
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
1632
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
1633
+ const rawValue = evaluate(options, state);
1634
+
1635
+ // eslint-disable-next-line prefer-const
1636
+ let {
1637
+ mainAxis,
1638
+ crossAxis,
1639
+ alignmentAxis
1640
+ } = typeof rawValue === 'number' ? {
1641
+ mainAxis: rawValue,
1642
+ crossAxis: 0,
1643
+ alignmentAxis: null
1644
+ } : {
1645
+ mainAxis: 0,
1646
+ crossAxis: 0,
1647
+ alignmentAxis: null,
1648
+ ...rawValue
1649
+ };
1650
+ if (alignment && typeof alignmentAxis === 'number') {
1651
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
1652
+ }
1653
+ return isVertical ? {
1654
+ x: crossAxis * crossAxisMulti,
1655
+ y: mainAxis * mainAxisMulti
1656
+ } : {
1657
+ x: mainAxis * mainAxisMulti,
1658
+ y: crossAxis * crossAxisMulti
1659
+ };
1660
+ }
1661
+
1662
+ /**
1663
+ * Modifies the placement by translating the floating element along the
1664
+ * specified axes.
1665
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
1666
+ * object may be passed.
1667
+ * @see https://floating-ui.com/docs/offset
1668
+ */
1669
+ const offset$1 = function (options) {
1670
+ if (options === void 0) {
1671
+ options = 0;
1672
+ }
1673
+ return {
1674
+ name: 'offset',
1675
+ options,
1676
+ async fn(state) {
1677
+ var _middlewareData$offse, _middlewareData$arrow;
1678
+ const {
1679
+ x,
1680
+ y,
1681
+ placement,
1682
+ middlewareData
1683
+ } = state;
1684
+ const diffCoords = await convertValueToCoords(state, options);
1685
+
1686
+ // If the placement is the same and the arrow caused an alignment offset
1687
+ // then we don't need to change the positioning coordinates.
1688
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1689
+ return {};
1690
+ }
1691
+ return {
1692
+ x: x + diffCoords.x,
1693
+ y: y + diffCoords.y,
1694
+ data: {
1695
+ ...diffCoords,
1696
+ placement
1697
+ }
1698
+ };
1699
+ }
1700
+ };
1701
+ };
1702
+
1703
+ /**
1704
+ * Optimizes the visibility of the floating element by shifting it in order to
1705
+ * keep it in view when it will overflow the clipping boundary.
1706
+ * @see https://floating-ui.com/docs/shift
1707
+ */
1708
+ const shift$1 = function (options) {
1709
+ if (options === void 0) {
1710
+ options = {};
1711
+ }
1712
+ return {
1713
+ name: 'shift',
1714
+ options,
1715
+ async fn(state) {
1716
+ const {
1717
+ x,
1718
+ y,
1719
+ placement
1720
+ } = state;
1721
+ const {
1722
+ mainAxis: checkMainAxis = true,
1723
+ crossAxis: checkCrossAxis = false,
1724
+ limiter = {
1725
+ fn: _ref => {
1726
+ let {
1727
+ x,
1728
+ y
1729
+ } = _ref;
1730
+ return {
1731
+ x,
1732
+ y
1733
+ };
1734
+ }
1735
+ },
1736
+ ...detectOverflowOptions
1737
+ } = evaluate(options, state);
1738
+ const coords = {
1739
+ x,
1740
+ y
1741
+ };
1742
+ const overflow = await detectOverflow(state, detectOverflowOptions);
1743
+ const crossAxis = getSideAxis(getSide(placement));
1744
+ const mainAxis = getOppositeAxis(crossAxis);
1745
+ let mainAxisCoord = coords[mainAxis];
1746
+ let crossAxisCoord = coords[crossAxis];
1747
+ if (checkMainAxis) {
1748
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
1749
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
1750
+ const min = mainAxisCoord + overflow[minSide];
1751
+ const max = mainAxisCoord - overflow[maxSide];
1752
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
1753
+ }
1754
+ if (checkCrossAxis) {
1755
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
1756
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
1757
+ const min = crossAxisCoord + overflow[minSide];
1758
+ const max = crossAxisCoord - overflow[maxSide];
1759
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
1760
+ }
1761
+ const limitedCoords = limiter.fn({
1762
+ ...state,
1763
+ [mainAxis]: mainAxisCoord,
1764
+ [crossAxis]: crossAxisCoord
1765
+ });
1766
+ return {
1767
+ ...limitedCoords,
1768
+ data: {
1769
+ x: limitedCoords.x - x,
1770
+ y: limitedCoords.y - y
1771
+ }
1772
+ };
1773
+ }
1774
+ };
1775
+ };
1776
+ /**
1777
+ * Built-in `limiter` that will stop `shift()` at a certain point.
1778
+ */
1779
+ const limitShift = function (options) {
1780
+ if (options === void 0) {
1781
+ options = {};
1782
+ }
1783
+ return {
1784
+ options,
1785
+ fn(state) {
1786
+ const {
1787
+ x,
1788
+ y,
1789
+ placement,
1790
+ rects,
1791
+ middlewareData
1792
+ } = state;
1793
+ const {
1794
+ offset = 0,
1795
+ mainAxis: checkMainAxis = true,
1796
+ crossAxis: checkCrossAxis = true
1797
+ } = evaluate(options, state);
1798
+ const coords = {
1799
+ x,
1800
+ y
1801
+ };
1802
+ const crossAxis = getSideAxis(placement);
1803
+ const mainAxis = getOppositeAxis(crossAxis);
1804
+ let mainAxisCoord = coords[mainAxis];
1805
+ let crossAxisCoord = coords[crossAxis];
1806
+ const rawOffset = evaluate(offset, state);
1807
+ const computedOffset = typeof rawOffset === 'number' ? {
1808
+ mainAxis: rawOffset,
1809
+ crossAxis: 0
1810
+ } : {
1811
+ mainAxis: 0,
1812
+ crossAxis: 0,
1813
+ ...rawOffset
1814
+ };
1815
+ if (checkMainAxis) {
1816
+ const len = mainAxis === 'y' ? 'height' : 'width';
1817
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
1818
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
1819
+ if (mainAxisCoord < limitMin) {
1820
+ mainAxisCoord = limitMin;
1821
+ } else if (mainAxisCoord > limitMax) {
1822
+ mainAxisCoord = limitMax;
1823
+ }
1824
+ }
1825
+ if (checkCrossAxis) {
1826
+ var _middlewareData$offse, _middlewareData$offse2;
1827
+ const len = mainAxis === 'y' ? 'width' : 'height';
1828
+ const isOriginSide = ['top', 'left'].includes(getSide(placement));
1829
+ const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
1830
+ const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
1831
+ if (crossAxisCoord < limitMin) {
1832
+ crossAxisCoord = limitMin;
1833
+ } else if (crossAxisCoord > limitMax) {
1834
+ crossAxisCoord = limitMax;
1835
+ }
1836
+ }
1837
+ return {
1838
+ [mainAxis]: mainAxisCoord,
1839
+ [crossAxis]: crossAxisCoord
1840
+ };
1841
+ }
1842
+ };
1843
+ };
1844
+
1845
+ /**
1846
+ * Provides data that allows you to change the size of the floating element —
1847
+ * for instance, prevent it from overflowing the clipping boundary or match the
1848
+ * width of the reference element.
1849
+ * @see https://floating-ui.com/docs/size
1850
+ */
1851
+ const size$1 = function (options) {
1852
+ if (options === void 0) {
1853
+ options = {};
1854
+ }
1855
+ return {
1856
+ name: 'size',
1857
+ options,
1858
+ async fn(state) {
1859
+ const {
1860
+ placement,
1861
+ rects,
1862
+ platform,
1863
+ elements
1864
+ } = state;
1865
+ const {
1866
+ apply = () => {},
1867
+ ...detectOverflowOptions
1868
+ } = evaluate(options, state);
1869
+ const overflow = await detectOverflow(state, detectOverflowOptions);
1870
+ const side = getSide(placement);
1871
+ const alignment = getAlignment(placement);
1872
+ const isYAxis = getSideAxis(placement) === 'y';
1873
+ const {
1874
+ width,
1875
+ height
1876
+ } = rects.floating;
1877
+ let heightSide;
1878
+ let widthSide;
1879
+ if (side === 'top' || side === 'bottom') {
1880
+ heightSide = side;
1881
+ widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
1882
+ } else {
1883
+ widthSide = side;
1884
+ heightSide = alignment === 'end' ? 'top' : 'bottom';
1885
+ }
1886
+ const overflowAvailableHeight = height - overflow[heightSide];
1887
+ const overflowAvailableWidth = width - overflow[widthSide];
1888
+ const noShift = !state.middlewareData.shift;
1889
+ let availableHeight = overflowAvailableHeight;
1890
+ let availableWidth = overflowAvailableWidth;
1891
+ if (isYAxis) {
1892
+ const maximumClippingWidth = width - overflow.left - overflow.right;
1893
+ availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
1894
+ } else {
1895
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
1896
+ availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
1897
+ }
1898
+ if (noShift && !alignment) {
1899
+ const xMin = max(overflow.left, 0);
1900
+ const xMax = max(overflow.right, 0);
1901
+ const yMin = max(overflow.top, 0);
1902
+ const yMax = max(overflow.bottom, 0);
1903
+ if (isYAxis) {
1904
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
1905
+ } else {
1906
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
1907
+ }
1908
+ }
1909
+ await apply({
1910
+ ...state,
1911
+ availableWidth,
1912
+ availableHeight
1913
+ });
1914
+ const nextDimensions = await platform.getDimensions(elements.floating);
1915
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
1916
+ return {
1917
+ reset: {
1918
+ rects: true
1919
+ }
1920
+ };
1921
+ }
1922
+ return {};
1923
+ }
1924
+ };
1925
+ };
1926
+
1927
+ function getNodeName(node) {
1928
+ if (isNode(node)) {
1929
+ return (node.nodeName || '').toLowerCase();
1930
+ }
1931
+ // Mocked nodes in testing environments may not be instances of Node. By
1932
+ // returning `#document` an infinite loop won't occur.
1933
+ // https://github.com/floating-ui/floating-ui/issues/2317
1934
+ return '#document';
1935
+ }
1936
+ function getWindow(node) {
1937
+ var _node$ownerDocument;
1938
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1939
+ }
1940
+ function getDocumentElement(node) {
1941
+ var _ref;
1942
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1943
+ }
1944
+ function isNode(value) {
1945
+ return value instanceof Node || value instanceof getWindow(value).Node;
1946
+ }
1947
+ function isElement(value) {
1948
+ return value instanceof Element || value instanceof getWindow(value).Element;
1949
+ }
1950
+ function isHTMLElement(value) {
1951
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1952
+ }
1953
+ function isShadowRoot(value) {
1954
+ // Browsers without `ShadowRoot` support.
1955
+ if (typeof ShadowRoot === 'undefined') {
1956
+ return false;
1957
+ }
1958
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1959
+ }
1960
+ function isOverflowElement(element) {
1961
+ const {
1962
+ overflow,
1963
+ overflowX,
1964
+ overflowY,
1965
+ display
1966
+ } = getComputedStyle$1(element);
1967
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
1968
+ }
1969
+ function isTableElement(element) {
1970
+ return ['table', 'td', 'th'].includes(getNodeName(element));
1971
+ }
1972
+ function isContainingBlock(element) {
1973
+ const webkit = isWebKit();
1974
+ const css = getComputedStyle$1(element);
1975
+
1976
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1977
+ return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
1978
+ }
1979
+ function getContainingBlock(element) {
1980
+ let currentNode = getParentNode(element);
1981
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1982
+ if (isContainingBlock(currentNode)) {
1983
+ return currentNode;
1984
+ }
1985
+ currentNode = getParentNode(currentNode);
1986
+ }
1987
+ return null;
1988
+ }
1989
+ function isWebKit() {
1990
+ if (typeof CSS === 'undefined' || !CSS.supports) return false;
1991
+ return CSS.supports('-webkit-backdrop-filter', 'none');
1992
+ }
1993
+ function isLastTraversableNode(node) {
1994
+ return ['html', 'body', '#document'].includes(getNodeName(node));
1995
+ }
1996
+ function getComputedStyle$1(element) {
1997
+ return getWindow(element).getComputedStyle(element);
1998
+ }
1999
+ function getNodeScroll(element) {
2000
+ if (isElement(element)) {
2001
+ return {
2002
+ scrollLeft: element.scrollLeft,
2003
+ scrollTop: element.scrollTop
2004
+ };
2005
+ }
2006
+ return {
2007
+ scrollLeft: element.pageXOffset,
2008
+ scrollTop: element.pageYOffset
2009
+ };
2010
+ }
2011
+ function getParentNode(node) {
2012
+ if (getNodeName(node) === 'html') {
2013
+ return node;
2014
+ }
2015
+ const result =
2016
+ // Step into the shadow DOM of the parent of a slotted node.
2017
+ node.assignedSlot ||
2018
+ // DOM Element detected.
2019
+ node.parentNode ||
2020
+ // ShadowRoot detected.
2021
+ isShadowRoot(node) && node.host ||
2022
+ // Fallback.
2023
+ getDocumentElement(node);
2024
+ return isShadowRoot(result) ? result.host : result;
2025
+ }
2026
+ function getNearestOverflowAncestor(node) {
2027
+ const parentNode = getParentNode(node);
2028
+ if (isLastTraversableNode(parentNode)) {
2029
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
2030
+ }
2031
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
2032
+ return parentNode;
2033
+ }
2034
+ return getNearestOverflowAncestor(parentNode);
2035
+ }
2036
+ function getOverflowAncestors(node, list, traverseIframes) {
2037
+ var _node$ownerDocument2;
2038
+ if (list === void 0) {
2039
+ list = [];
2040
+ }
2041
+ if (traverseIframes === void 0) {
2042
+ traverseIframes = true;
2043
+ }
2044
+ const scrollableAncestor = getNearestOverflowAncestor(node);
2045
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
2046
+ const win = getWindow(scrollableAncestor);
2047
+ if (isBody) {
2048
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
2049
+ }
2050
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
2051
+ }
2052
+
2053
+ function getCssDimensions(element) {
2054
+ const css = getComputedStyle$1(element);
2055
+ // In testing environments, the `width` and `height` properties are empty
2056
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
2057
+ let width = parseFloat(css.width) || 0;
2058
+ let height = parseFloat(css.height) || 0;
2059
+ const hasOffset = isHTMLElement(element);
2060
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
2061
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
2062
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
2063
+ if (shouldFallback) {
2064
+ width = offsetWidth;
2065
+ height = offsetHeight;
2066
+ }
2067
+ return {
2068
+ width,
2069
+ height,
2070
+ $: shouldFallback
2071
+ };
2072
+ }
2073
+
2074
+ function unwrapElement(element) {
2075
+ return !isElement(element) ? element.contextElement : element;
2076
+ }
2077
+
2078
+ function getScale(element) {
2079
+ const domElement = unwrapElement(element);
2080
+ if (!isHTMLElement(domElement)) {
2081
+ return createCoords(1);
2082
+ }
2083
+ const rect = domElement.getBoundingClientRect();
2084
+ const {
2085
+ width,
2086
+ height,
2087
+ $
2088
+ } = getCssDimensions(domElement);
2089
+ let x = ($ ? round(rect.width) : rect.width) / width;
2090
+ let y = ($ ? round(rect.height) : rect.height) / height;
2091
+
2092
+ // 0, NaN, or Infinity should always fallback to 1.
2093
+
2094
+ if (!x || !Number.isFinite(x)) {
2095
+ x = 1;
2096
+ }
2097
+ if (!y || !Number.isFinite(y)) {
2098
+ y = 1;
2099
+ }
2100
+ return {
2101
+ x,
2102
+ y
2103
+ };
2104
+ }
2105
+
2106
+ const noOffsets = /*#__PURE__*/createCoords(0);
2107
+ function getVisualOffsets(element) {
2108
+ const win = getWindow(element);
2109
+ if (!isWebKit() || !win.visualViewport) {
2110
+ return noOffsets;
2111
+ }
2112
+ return {
2113
+ x: win.visualViewport.offsetLeft,
2114
+ y: win.visualViewport.offsetTop
2115
+ };
2116
+ }
2117
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
2118
+ if (isFixed === void 0) {
2119
+ isFixed = false;
2120
+ }
2121
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
2122
+ return false;
2123
+ }
2124
+ return isFixed;
2125
+ }
2126
+
2127
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
2128
+ if (includeScale === void 0) {
2129
+ includeScale = false;
2130
+ }
2131
+ if (isFixedStrategy === void 0) {
2132
+ isFixedStrategy = false;
2133
+ }
2134
+ const clientRect = element.getBoundingClientRect();
2135
+ const domElement = unwrapElement(element);
2136
+ let scale = createCoords(1);
2137
+ if (includeScale) {
2138
+ if (offsetParent) {
2139
+ if (isElement(offsetParent)) {
2140
+ scale = getScale(offsetParent);
2141
+ }
2142
+ } else {
2143
+ scale = getScale(element);
2144
+ }
2145
+ }
2146
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
2147
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
2148
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
2149
+ let width = clientRect.width / scale.x;
2150
+ let height = clientRect.height / scale.y;
2151
+ if (domElement) {
2152
+ const win = getWindow(domElement);
2153
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
2154
+ let currentWin = win;
2155
+ let currentIFrame = currentWin.frameElement;
2156
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
2157
+ const iframeScale = getScale(currentIFrame);
2158
+ const iframeRect = currentIFrame.getBoundingClientRect();
2159
+ const css = getComputedStyle$1(currentIFrame);
2160
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
2161
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
2162
+ x *= iframeScale.x;
2163
+ y *= iframeScale.y;
2164
+ width *= iframeScale.x;
2165
+ height *= iframeScale.y;
2166
+ x += left;
2167
+ y += top;
2168
+ currentWin = getWindow(currentIFrame);
2169
+ currentIFrame = currentWin.frameElement;
2170
+ }
2171
+ }
2172
+ return rectToClientRect({
2173
+ width,
2174
+ height,
2175
+ x,
2176
+ y
2177
+ });
2178
+ }
2179
+
2180
+ const topLayerSelectors = [':popover-open', ':modal'];
2181
+ function isTopLayer(element) {
2182
+ return topLayerSelectors.some(selector => {
2183
+ try {
2184
+ return element.matches(selector);
2185
+ } catch (e) {
2186
+ return false;
2187
+ }
2188
+ });
2189
+ }
2190
+
2191
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
2192
+ let {
2193
+ elements,
2194
+ rect,
2195
+ offsetParent,
2196
+ strategy
2197
+ } = _ref;
2198
+ const isFixed = strategy === 'fixed';
2199
+ const documentElement = getDocumentElement(offsetParent);
2200
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
2201
+ if (offsetParent === documentElement || topLayer && isFixed) {
2202
+ return rect;
2203
+ }
2204
+ let scroll = {
2205
+ scrollLeft: 0,
2206
+ scrollTop: 0
2207
+ };
2208
+ let scale = createCoords(1);
2209
+ const offsets = createCoords(0);
2210
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
2211
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
2212
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2213
+ scroll = getNodeScroll(offsetParent);
2214
+ }
2215
+ if (isHTMLElement(offsetParent)) {
2216
+ const offsetRect = getBoundingClientRect(offsetParent);
2217
+ scale = getScale(offsetParent);
2218
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
2219
+ offsets.y = offsetRect.y + offsetParent.clientTop;
2220
+ }
2221
+ }
2222
+ return {
2223
+ width: rect.width * scale.x,
2224
+ height: rect.height * scale.y,
2225
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
2226
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
2227
+ };
2228
+ }
2229
+
2230
+ function getClientRects(element) {
2231
+ return Array.from(element.getClientRects());
2232
+ }
2233
+
2234
+ function getWindowScrollBarX(element) {
2235
+ // If <html> has a CSS width greater than the viewport, then this will be
2236
+ // incorrect for RTL.
2237
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
2238
+ }
2239
+
2240
+ // Gets the entire size of the scrollable document area, even extending outside
2241
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
2242
+ function getDocumentRect(element) {
2243
+ const html = getDocumentElement(element);
2244
+ const scroll = getNodeScroll(element);
2245
+ const body = element.ownerDocument.body;
2246
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
2247
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
2248
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
2249
+ const y = -scroll.scrollTop;
2250
+ if (getComputedStyle$1(body).direction === 'rtl') {
2251
+ x += max(html.clientWidth, body.clientWidth) - width;
2252
+ }
2253
+ return {
2254
+ width,
2255
+ height,
2256
+ x,
2257
+ y
2258
+ };
2259
+ }
2260
+
2261
+ function getViewportRect(element, strategy) {
2262
+ const win = getWindow(element);
2263
+ const html = getDocumentElement(element);
2264
+ const visualViewport = win.visualViewport;
2265
+ let width = html.clientWidth;
2266
+ let height = html.clientHeight;
2267
+ let x = 0;
2268
+ let y = 0;
2269
+ if (visualViewport) {
2270
+ width = visualViewport.width;
2271
+ height = visualViewport.height;
2272
+ const visualViewportBased = isWebKit();
2273
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
2274
+ x = visualViewport.offsetLeft;
2275
+ y = visualViewport.offsetTop;
2276
+ }
2277
+ }
2278
+ return {
2279
+ width,
2280
+ height,
2281
+ x,
2282
+ y
2283
+ };
2284
+ }
2285
+
2286
+ // Returns the inner client rect, subtracting scrollbars if present.
2287
+ function getInnerBoundingClientRect(element, strategy) {
2288
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
2289
+ const top = clientRect.top + element.clientTop;
2290
+ const left = clientRect.left + element.clientLeft;
2291
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
2292
+ const width = element.clientWidth * scale.x;
2293
+ const height = element.clientHeight * scale.y;
2294
+ const x = left * scale.x;
2295
+ const y = top * scale.y;
2296
+ return {
2297
+ width,
2298
+ height,
2299
+ x,
2300
+ y
2301
+ };
2302
+ }
2303
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
2304
+ let rect;
2305
+ if (clippingAncestor === 'viewport') {
2306
+ rect = getViewportRect(element, strategy);
2307
+ } else if (clippingAncestor === 'document') {
2308
+ rect = getDocumentRect(getDocumentElement(element));
2309
+ } else if (isElement(clippingAncestor)) {
2310
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
2311
+ } else {
2312
+ const visualOffsets = getVisualOffsets(element);
2313
+ rect = {
2314
+ ...clippingAncestor,
2315
+ x: clippingAncestor.x - visualOffsets.x,
2316
+ y: clippingAncestor.y - visualOffsets.y
2317
+ };
2318
+ }
2319
+ return rectToClientRect(rect);
2320
+ }
2321
+ function hasFixedPositionAncestor(element, stopNode) {
2322
+ const parentNode = getParentNode(element);
2323
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
2324
+ return false;
2325
+ }
2326
+ return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
2327
+ }
2328
+
2329
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
2330
+ // clipping (or hiding) child elements. This returns all clipping ancestors
2331
+ // of the given element up the tree.
2332
+ function getClippingElementAncestors(element, cache) {
2333
+ const cachedResult = cache.get(element);
2334
+ if (cachedResult) {
2335
+ return cachedResult;
2336
+ }
2337
+ let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
2338
+ let currentContainingBlockComputedStyle = null;
2339
+ const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
2340
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
2341
+
2342
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
2343
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
2344
+ const computedStyle = getComputedStyle$1(currentNode);
2345
+ const currentNodeIsContaining = isContainingBlock(currentNode);
2346
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
2347
+ currentContainingBlockComputedStyle = null;
2348
+ }
2349
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
2350
+ if (shouldDropCurrentNode) {
2351
+ // Drop non-containing blocks.
2352
+ result = result.filter(ancestor => ancestor !== currentNode);
2353
+ } else {
2354
+ // Record last containing block for next iteration.
2355
+ currentContainingBlockComputedStyle = computedStyle;
2356
+ }
2357
+ currentNode = getParentNode(currentNode);
2358
+ }
2359
+ cache.set(element, result);
2360
+ return result;
2361
+ }
2362
+
2363
+ // Gets the maximum area that the element is visible in due to any number of
2364
+ // clipping ancestors.
2365
+ function getClippingRect(_ref) {
2366
+ let {
2367
+ element,
2368
+ boundary,
2369
+ rootBoundary,
2370
+ strategy
2371
+ } = _ref;
2372
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
2373
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
2374
+ const firstClippingAncestor = clippingAncestors[0];
2375
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
2376
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
2377
+ accRect.top = max(rect.top, accRect.top);
2378
+ accRect.right = min(rect.right, accRect.right);
2379
+ accRect.bottom = min(rect.bottom, accRect.bottom);
2380
+ accRect.left = max(rect.left, accRect.left);
2381
+ return accRect;
2382
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
2383
+ return {
2384
+ width: clippingRect.right - clippingRect.left,
2385
+ height: clippingRect.bottom - clippingRect.top,
2386
+ x: clippingRect.left,
2387
+ y: clippingRect.top
2388
+ };
2389
+ }
2390
+
2391
+ function getDimensions(element) {
2392
+ const {
2393
+ width,
2394
+ height
2395
+ } = getCssDimensions(element);
2396
+ return {
2397
+ width,
2398
+ height
2399
+ };
2400
+ }
2401
+
2402
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
2403
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
2404
+ const documentElement = getDocumentElement(offsetParent);
2405
+ const isFixed = strategy === 'fixed';
2406
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
2407
+ let scroll = {
2408
+ scrollLeft: 0,
2409
+ scrollTop: 0
2410
+ };
2411
+ const offsets = createCoords(0);
2412
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
2413
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2414
+ scroll = getNodeScroll(offsetParent);
2415
+ }
2416
+ if (isOffsetParentAnElement) {
2417
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
2418
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
2419
+ offsets.y = offsetRect.y + offsetParent.clientTop;
2420
+ } else if (documentElement) {
2421
+ offsets.x = getWindowScrollBarX(documentElement);
2422
+ }
2423
+ }
2424
+ const x = rect.left + scroll.scrollLeft - offsets.x;
2425
+ const y = rect.top + scroll.scrollTop - offsets.y;
2426
+ return {
2427
+ x,
2428
+ y,
2429
+ width: rect.width,
2430
+ height: rect.height
2431
+ };
2432
+ }
2433
+
2434
+ function isStaticPositioned(element) {
2435
+ return getComputedStyle$1(element).position === 'static';
2436
+ }
2437
+
2438
+ function getTrueOffsetParent(element, polyfill) {
2439
+ if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
2440
+ return null;
2441
+ }
2442
+ if (polyfill) {
2443
+ return polyfill(element);
2444
+ }
2445
+ return element.offsetParent;
2446
+ }
2447
+
2448
+ // Gets the closest ancestor positioned element. Handles some edge cases,
2449
+ // such as table ancestors and cross browser bugs.
2450
+ function getOffsetParent(element, polyfill) {
2451
+ const win = getWindow(element);
2452
+ if (isTopLayer(element)) {
2453
+ return win;
2454
+ }
2455
+ if (!isHTMLElement(element)) {
2456
+ let svgOffsetParent = getParentNode(element);
2457
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
2458
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
2459
+ return svgOffsetParent;
2460
+ }
2461
+ svgOffsetParent = getParentNode(svgOffsetParent);
2462
+ }
2463
+ return win;
2464
+ }
2465
+ let offsetParent = getTrueOffsetParent(element, polyfill);
2466
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
2467
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
2468
+ }
2469
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
2470
+ return win;
2471
+ }
2472
+ return offsetParent || getContainingBlock(element) || win;
2473
+ }
2474
+
2475
+ const getElementRects = async function (data) {
2476
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
2477
+ const getDimensionsFn = this.getDimensions;
2478
+ const floatingDimensions = await getDimensionsFn(data.floating);
2479
+ return {
2480
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
2481
+ floating: {
2482
+ x: 0,
2483
+ y: 0,
2484
+ width: floatingDimensions.width,
2485
+ height: floatingDimensions.height
2486
+ }
2487
+ };
2488
+ };
2489
+
2490
+ function isRTL(element) {
2491
+ return getComputedStyle$1(element).direction === 'rtl';
2492
+ }
2493
+
2494
+ const platform = {
2495
+ convertOffsetParentRelativeRectToViewportRelativeRect,
2496
+ getDocumentElement,
2497
+ getClippingRect,
2498
+ getOffsetParent,
2499
+ getElementRects,
2500
+ getClientRects,
2501
+ getDimensions,
2502
+ getScale,
2503
+ isElement,
2504
+ isRTL
2505
+ };
2506
+
2507
+ // https://samthor.au/2021/observing-dom/
2508
+ function observeMove(element, onMove) {
2509
+ let io = null;
2510
+ let timeoutId;
2511
+ const root = getDocumentElement(element);
2512
+ function cleanup() {
2513
+ var _io;
2514
+ clearTimeout(timeoutId);
2515
+ (_io = io) == null || _io.disconnect();
2516
+ io = null;
2517
+ }
2518
+ function refresh(skip, threshold) {
2519
+ if (skip === void 0) {
2520
+ skip = false;
2521
+ }
2522
+ if (threshold === void 0) {
2523
+ threshold = 1;
2524
+ }
2525
+ cleanup();
2526
+ const {
2527
+ left,
2528
+ top,
2529
+ width,
2530
+ height
2531
+ } = element.getBoundingClientRect();
2532
+ if (!skip) {
2533
+ onMove();
2534
+ }
2535
+ if (!width || !height) {
2536
+ return;
2537
+ }
2538
+ const insetTop = floor(top);
2539
+ const insetRight = floor(root.clientWidth - (left + width));
2540
+ const insetBottom = floor(root.clientHeight - (top + height));
2541
+ const insetLeft = floor(left);
2542
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
2543
+ const options = {
2544
+ rootMargin,
2545
+ threshold: max(0, min(1, threshold)) || 1
2546
+ };
2547
+ let isFirstUpdate = true;
2548
+ function handleObserve(entries) {
2549
+ const ratio = entries[0].intersectionRatio;
2550
+ if (ratio !== threshold) {
2551
+ if (!isFirstUpdate) {
2552
+ return refresh();
2553
+ }
2554
+ if (!ratio) {
2555
+ // If the reference is clipped, the ratio is 0. Throttle the refresh
2556
+ // to prevent an infinite loop of updates.
2557
+ timeoutId = setTimeout(() => {
2558
+ refresh(false, 1e-7);
2559
+ }, 1000);
2560
+ } else {
2561
+ refresh(false, ratio);
2562
+ }
2563
+ }
2564
+ isFirstUpdate = false;
2565
+ }
2566
+
2567
+ // Older browsers don't support a `document` as the root and will throw an
2568
+ // error.
2569
+ try {
2570
+ io = new IntersectionObserver(handleObserve, {
2571
+ ...options,
2572
+ // Handle <iframe>s
2573
+ root: root.ownerDocument
2574
+ });
2575
+ } catch (e) {
2576
+ io = new IntersectionObserver(handleObserve, options);
2577
+ }
2578
+ io.observe(element);
2579
+ }
2580
+ refresh(true);
2581
+ return cleanup;
2582
+ }
2583
+
2584
+ /**
2585
+ * Automatically updates the position of the floating element when necessary.
2586
+ * Should only be called when the floating element is mounted on the DOM or
2587
+ * visible on the screen.
2588
+ * @returns cleanup function that should be invoked when the floating element is
2589
+ * removed from the DOM or hidden from the screen.
2590
+ * @see https://floating-ui.com/docs/autoUpdate
2591
+ */
2592
+ function autoUpdate(reference, floating, update, options) {
2593
+ if (options === void 0) {
2594
+ options = {};
2595
+ }
2596
+ const {
2597
+ ancestorScroll = true,
2598
+ ancestorResize = true,
2599
+ elementResize = typeof ResizeObserver === 'function',
2600
+ layoutShift = typeof IntersectionObserver === 'function',
2601
+ animationFrame = false
2602
+ } = options;
2603
+ const referenceEl = unwrapElement(reference);
2604
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
2605
+ ancestors.forEach(ancestor => {
2606
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
2607
+ passive: true
2608
+ });
2609
+ ancestorResize && ancestor.addEventListener('resize', update);
2610
+ });
2611
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
2612
+ let reobserveFrame = -1;
2613
+ let resizeObserver = null;
2614
+ if (elementResize) {
2615
+ resizeObserver = new ResizeObserver(_ref => {
2616
+ let [firstEntry] = _ref;
2617
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
2618
+ // Prevent update loops when using the `size` middleware.
2619
+ // https://github.com/floating-ui/floating-ui/issues/1740
2620
+ resizeObserver.unobserve(floating);
2621
+ cancelAnimationFrame(reobserveFrame);
2622
+ reobserveFrame = requestAnimationFrame(() => {
2623
+ var _resizeObserver;
2624
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
2625
+ });
2626
+ }
2627
+ update();
2628
+ });
2629
+ if (referenceEl && !animationFrame) {
2630
+ resizeObserver.observe(referenceEl);
2631
+ }
2632
+ resizeObserver.observe(floating);
2633
+ }
2634
+ let frameId;
2635
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
2636
+ if (animationFrame) {
2637
+ frameLoop();
2638
+ }
2639
+ function frameLoop() {
2640
+ const nextRefRect = getBoundingClientRect(reference);
2641
+ if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
2642
+ update();
2643
+ }
2644
+ prevRefRect = nextRefRect;
2645
+ frameId = requestAnimationFrame(frameLoop);
2646
+ }
2647
+ update();
2648
+ return () => {
2649
+ var _resizeObserver2;
2650
+ ancestors.forEach(ancestor => {
2651
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
2652
+ ancestorResize && ancestor.removeEventListener('resize', update);
2653
+ });
2654
+ cleanupIo == null || cleanupIo();
2655
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
2656
+ resizeObserver = null;
2657
+ if (animationFrame) {
2658
+ cancelAnimationFrame(frameId);
2659
+ }
2660
+ };
2661
+ }
2662
+
2663
+ /**
2664
+ * Modifies the placement by translating the floating element along the
2665
+ * specified axes.
2666
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
2667
+ * object may be passed.
2668
+ * @see https://floating-ui.com/docs/offset
2669
+ */
2670
+ const offset = offset$1;
2671
+
2672
+ /**
2673
+ * Optimizes the visibility of the floating element by choosing the placement
2674
+ * that has the most space available automatically, without needing to specify a
2675
+ * preferred placement. Alternative to `flip`.
2676
+ * @see https://floating-ui.com/docs/autoPlacement
2677
+ */
2678
+ autoPlacement;
2679
+
2680
+ /**
2681
+ * Optimizes the visibility of the floating element by shifting it in order to
2682
+ * keep it in view when it will overflow the clipping boundary.
2683
+ * @see https://floating-ui.com/docs/shift
2684
+ */
2685
+ const shift = shift$1;
2686
+
2687
+ /**
2688
+ * Optimizes the visibility of the floating element by flipping the `placement`
2689
+ * in order to keep it in view when the preferred placement(s) will overflow the
2690
+ * clipping boundary. Alternative to `autoPlacement`.
2691
+ * @see https://floating-ui.com/docs/flip
2692
+ */
2693
+ const flip = flip$1;
2694
+
2695
+ /**
2696
+ * Provides data that allows you to change the size of the floating element —
2697
+ * for instance, prevent it from overflowing the clipping boundary or match the
2698
+ * width of the reference element.
2699
+ * @see https://floating-ui.com/docs/size
2700
+ */
2701
+ const size = size$1;
2702
+
2703
+ /**
2704
+ * Provides data to hide the floating element in applicable situations, such as
2705
+ * when it is not in the same clipping context as the reference element.
2706
+ * @see https://floating-ui.com/docs/hide
2707
+ */
2708
+ hide;
2709
+
2710
+ /**
2711
+ * Provides data to position an inner element of the floating element so that it
2712
+ * appears centered to the reference element.
2713
+ * @see https://floating-ui.com/docs/arrow
2714
+ */
2715
+ const arrow = arrow$1;
2716
+
2717
+ /**
2718
+ * Provides improved positioning for inline reference elements that can span
2719
+ * over multiple lines, such as hyperlinks or range selections.
2720
+ * @see https://floating-ui.com/docs/inline
2721
+ */
2722
+ inline;
2723
+
2724
+ /**
2725
+ * Built-in `limiter` that will stop `shift()` at a certain point.
2726
+ */
2727
+ limitShift;
2728
+
2729
+ /**
2730
+ * Computes the `x` and `y` coordinates that will place the floating element
2731
+ * next to a given reference element.
2732
+ */
2733
+ const computePosition = (reference, floating, options) => {
2734
+ // This caches the expensive `getClippingElementAncestors` function so that
2735
+ // multiple lifecycle resets re-use the same result. It only lives for a
2736
+ // single call. If other functions become expensive, we can add them as well.
2737
+ const cache = new Map();
2738
+ const mergedOptions = {
2739
+ platform,
2740
+ ...options
2741
+ };
2742
+ const platformWithCache = {
2743
+ ...mergedOptions.platform,
2744
+ _c: cache
2745
+ };
2746
+ return computePosition$1(reference, floating, {
2747
+ ...mergedOptions,
2748
+ platform: platformWithCache
2749
+ });
2750
+ };
2751
+
2752
+ /* eslint-disable @typescript-eslint/ban-types */
2753
+ function offsetParent(element) {
2754
+ return offsetParentPolyfill(element);
2755
+ }
2756
+ function flatTreeParent(element) {
2757
+ if (element.assignedSlot) {
2758
+ return element.assignedSlot;
2759
+ }
2760
+ if (element.parentNode instanceof ShadowRoot) {
2761
+ return element.parentNode.host;
2762
+ }
2763
+ return element.parentNode;
2764
+ }
2765
+ function offsetParentPolyfill(element) {
2766
+ // Do an initial walk to check for display:none ancestors.
2767
+ for (let ancestor = element; ancestor; ancestor = flatTreeParent(ancestor)) {
2768
+ if (!(ancestor instanceof Element)) {
2769
+ continue;
2770
+ }
2771
+ if (getComputedStyle(ancestor).display === 'none') {
2772
+ return null;
2773
+ }
2774
+ }
2775
+ for (let ancestor = flatTreeParent(element); ancestor; ancestor = flatTreeParent(ancestor)) {
2776
+ if (!(ancestor instanceof Element)) {
2777
+ continue;
2778
+ }
2779
+ const style = getComputedStyle(ancestor);
2780
+ // Display:contents nodes aren't in the layout tree so they should be skipped.
2781
+ if (style.display === 'contents') {
2782
+ continue;
2783
+ }
2784
+ if (style.position !== 'static' || style.filter !== 'none') {
2785
+ return ancestor;
2786
+ }
2787
+ if (ancestor.tagName === 'BODY') {
2788
+ return ancestor;
2789
+ }
2790
+ }
2791
+ return null;
2792
+ }
2793
+
2794
+ function isVirtualElement(e) {
2795
+ return e !== null && typeof e === "object" && "getBoundingClientRect" in e && ("contextElement" in e ? e instanceof Element : true);
2796
+ }
2797
+ var SlPopup = class extends ShoelaceElement {
2798
+ constructor() {
2799
+ super(...arguments);
2800
+ this.active = false;
2801
+ this.placement = "top";
2802
+ this.strategy = "absolute";
2803
+ this.distance = 0;
2804
+ this.skidding = 0;
2805
+ this.arrow = false;
2806
+ this.arrowPlacement = "anchor";
2807
+ this.arrowPadding = 10;
2808
+ this.flip = false;
2809
+ this.flipFallbackPlacements = "";
2810
+ this.flipFallbackStrategy = "best-fit";
2811
+ this.flipPadding = 0;
2812
+ this.shift = false;
2813
+ this.shiftPadding = 0;
2814
+ this.autoSizePadding = 0;
2815
+ this.hoverBridge = false;
2816
+ this.updateHoverBridge = () => {
2817
+ if (this.hoverBridge && this.anchorEl) {
2818
+ const anchorRect = this.anchorEl.getBoundingClientRect();
2819
+ const popupRect = this.popup.getBoundingClientRect();
2820
+ const isVertical = this.placement.includes("top") || this.placement.includes("bottom");
2821
+ let topLeftX = 0;
2822
+ let topLeftY = 0;
2823
+ let topRightX = 0;
2824
+ let topRightY = 0;
2825
+ let bottomLeftX = 0;
2826
+ let bottomLeftY = 0;
2827
+ let bottomRightX = 0;
2828
+ let bottomRightY = 0;
2829
+ if (isVertical) {
2830
+ if (anchorRect.top < popupRect.top) {
2831
+ topLeftX = anchorRect.left;
2832
+ topLeftY = anchorRect.bottom;
2833
+ topRightX = anchorRect.right;
2834
+ topRightY = anchorRect.bottom;
2835
+ bottomLeftX = popupRect.left;
2836
+ bottomLeftY = popupRect.top;
2837
+ bottomRightX = popupRect.right;
2838
+ bottomRightY = popupRect.top;
2839
+ } else {
2840
+ topLeftX = popupRect.left;
2841
+ topLeftY = popupRect.bottom;
2842
+ topRightX = popupRect.right;
2843
+ topRightY = popupRect.bottom;
2844
+ bottomLeftX = anchorRect.left;
2845
+ bottomLeftY = anchorRect.top;
2846
+ bottomRightX = anchorRect.right;
2847
+ bottomRightY = anchorRect.top;
2848
+ }
2849
+ } else {
2850
+ if (anchorRect.left < popupRect.left) {
2851
+ topLeftX = anchorRect.right;
2852
+ topLeftY = anchorRect.top;
2853
+ topRightX = popupRect.left;
2854
+ topRightY = popupRect.top;
2855
+ bottomLeftX = anchorRect.right;
2856
+ bottomLeftY = anchorRect.bottom;
2857
+ bottomRightX = popupRect.left;
2858
+ bottomRightY = popupRect.bottom;
2859
+ } else {
2860
+ topLeftX = popupRect.right;
2861
+ topLeftY = popupRect.top;
2862
+ topRightX = anchorRect.left;
2863
+ topRightY = anchorRect.top;
2864
+ bottomLeftX = popupRect.right;
2865
+ bottomLeftY = popupRect.bottom;
2866
+ bottomRightX = anchorRect.left;
2867
+ bottomRightY = anchorRect.bottom;
2868
+ }
2869
+ }
2870
+ this.style.setProperty("--hover-bridge-top-left-x", `${topLeftX}px`);
2871
+ this.style.setProperty("--hover-bridge-top-left-y", `${topLeftY}px`);
2872
+ this.style.setProperty("--hover-bridge-top-right-x", `${topRightX}px`);
2873
+ this.style.setProperty("--hover-bridge-top-right-y", `${topRightY}px`);
2874
+ this.style.setProperty("--hover-bridge-bottom-left-x", `${bottomLeftX}px`);
2875
+ this.style.setProperty("--hover-bridge-bottom-left-y", `${bottomLeftY}px`);
2876
+ this.style.setProperty("--hover-bridge-bottom-right-x", `${bottomRightX}px`);
2877
+ this.style.setProperty("--hover-bridge-bottom-right-y", `${bottomRightY}px`);
2878
+ }
2879
+ };
2880
+ }
2881
+ async connectedCallback() {
2882
+ super.connectedCallback();
2883
+ await this.updateComplete;
2884
+ this.start();
2885
+ }
2886
+ disconnectedCallback() {
2887
+ super.disconnectedCallback();
2888
+ this.stop();
2889
+ }
2890
+ async updated(changedProps) {
2891
+ super.updated(changedProps);
2892
+ if (changedProps.has("active")) {
2893
+ if (this.active) {
2894
+ this.start();
2895
+ } else {
2896
+ this.stop();
2897
+ }
2898
+ }
2899
+ if (changedProps.has("anchor")) {
2900
+ this.handleAnchorChange();
2901
+ }
2902
+ if (this.active) {
2903
+ await this.updateComplete;
2904
+ this.reposition();
2905
+ }
2906
+ }
2907
+ async handleAnchorChange() {
2908
+ await this.stop();
2909
+ if (this.anchor && typeof this.anchor === "string") {
2910
+ const root = this.getRootNode();
2911
+ this.anchorEl = root.getElementById(this.anchor);
2912
+ } else if (this.anchor instanceof Element || isVirtualElement(this.anchor)) {
2913
+ this.anchorEl = this.anchor;
2914
+ } else {
2915
+ this.anchorEl = this.querySelector('[slot="anchor"]');
2916
+ }
2917
+ if (this.anchorEl instanceof HTMLSlotElement) {
2918
+ this.anchorEl = this.anchorEl.assignedElements({ flatten: true })[0];
2919
+ }
2920
+ if (this.anchorEl) {
2921
+ this.start();
2922
+ }
2923
+ }
2924
+ start() {
2925
+ if (!this.anchorEl) {
2926
+ return;
2927
+ }
2928
+ this.cleanup = autoUpdate(this.anchorEl, this.popup, () => {
2929
+ this.reposition();
2930
+ });
2931
+ }
2932
+ async stop() {
2933
+ return new Promise((resolve) => {
2934
+ if (this.cleanup) {
2935
+ this.cleanup();
2936
+ this.cleanup = void 0;
2937
+ this.removeAttribute("data-current-placement");
2938
+ this.style.removeProperty("--auto-size-available-width");
2939
+ this.style.removeProperty("--auto-size-available-height");
2940
+ requestAnimationFrame(() => resolve());
2941
+ } else {
2942
+ resolve();
2943
+ }
2944
+ });
2945
+ }
2946
+ /** Forces the popup to recalculate and reposition itself. */
2947
+ reposition() {
2948
+ if (!this.active || !this.anchorEl) {
2949
+ return;
2950
+ }
2951
+ const middleware = [
2952
+ // The offset middleware goes first
2953
+ offset({ mainAxis: this.distance, crossAxis: this.skidding })
2954
+ ];
2955
+ if (this.sync) {
2956
+ middleware.push(
2957
+ size({
2958
+ apply: ({ rects }) => {
2959
+ const syncWidth = this.sync === "width" || this.sync === "both";
2960
+ const syncHeight = this.sync === "height" || this.sync === "both";
2961
+ this.popup.style.width = syncWidth ? `${rects.reference.width}px` : "";
2962
+ this.popup.style.height = syncHeight ? `${rects.reference.height}px` : "";
2963
+ }
2964
+ })
2965
+ );
2966
+ } else {
2967
+ this.popup.style.width = "";
2968
+ this.popup.style.height = "";
2969
+ }
2970
+ if (this.flip) {
2971
+ middleware.push(
2972
+ flip({
2973
+ boundary: this.flipBoundary,
2974
+ // @ts-expect-error - We're converting a string attribute to an array here
2975
+ fallbackPlacements: this.flipFallbackPlacements,
2976
+ fallbackStrategy: this.flipFallbackStrategy === "best-fit" ? "bestFit" : "initialPlacement",
2977
+ padding: this.flipPadding
2978
+ })
2979
+ );
2980
+ }
2981
+ if (this.shift) {
2982
+ middleware.push(
2983
+ shift({
2984
+ boundary: this.shiftBoundary,
2985
+ padding: this.shiftPadding
2986
+ })
2987
+ );
2988
+ }
2989
+ if (this.autoSize) {
2990
+ middleware.push(
2991
+ size({
2992
+ boundary: this.autoSizeBoundary,
2993
+ padding: this.autoSizePadding,
2994
+ apply: ({ availableWidth, availableHeight }) => {
2995
+ if (this.autoSize === "vertical" || this.autoSize === "both") {
2996
+ this.style.setProperty("--auto-size-available-height", `${availableHeight}px`);
2997
+ } else {
2998
+ this.style.removeProperty("--auto-size-available-height");
2999
+ }
3000
+ if (this.autoSize === "horizontal" || this.autoSize === "both") {
3001
+ this.style.setProperty("--auto-size-available-width", `${availableWidth}px`);
3002
+ } else {
3003
+ this.style.removeProperty("--auto-size-available-width");
3004
+ }
3005
+ }
3006
+ })
3007
+ );
3008
+ } else {
3009
+ this.style.removeProperty("--auto-size-available-width");
3010
+ this.style.removeProperty("--auto-size-available-height");
3011
+ }
3012
+ if (this.arrow) {
3013
+ middleware.push(
3014
+ arrow({
3015
+ element: this.arrowEl,
3016
+ padding: this.arrowPadding
3017
+ })
3018
+ );
3019
+ }
3020
+ const getOffsetParent = this.strategy === "absolute" ? (element) => platform.getOffsetParent(element, offsetParent) : platform.getOffsetParent;
3021
+ computePosition(this.anchorEl, this.popup, {
3022
+ placement: this.placement,
3023
+ middleware,
3024
+ strategy: this.strategy,
3025
+ platform: __spreadProps(__spreadValues({}, platform), {
3026
+ getOffsetParent
3027
+ })
3028
+ }).then(({ x, y, middlewareData, placement }) => {
3029
+ const isRtl = getComputedStyle(this).direction === "rtl";
3030
+ const staticSide = { top: "bottom", right: "left", bottom: "top", left: "right" }[placement.split("-")[0]];
3031
+ this.setAttribute("data-current-placement", placement);
3032
+ Object.assign(this.popup.style, {
3033
+ left: `${x}px`,
3034
+ top: `${y}px`
3035
+ });
3036
+ if (this.arrow) {
3037
+ const arrowX = middlewareData.arrow.x;
3038
+ const arrowY = middlewareData.arrow.y;
3039
+ let top = "";
3040
+ let right = "";
3041
+ let bottom = "";
3042
+ let left = "";
3043
+ if (this.arrowPlacement === "start") {
3044
+ const value = typeof arrowX === "number" ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : "";
3045
+ top = typeof arrowY === "number" ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : "";
3046
+ right = isRtl ? value : "";
3047
+ left = isRtl ? "" : value;
3048
+ } else if (this.arrowPlacement === "end") {
3049
+ const value = typeof arrowX === "number" ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : "";
3050
+ right = isRtl ? "" : value;
3051
+ left = isRtl ? value : "";
3052
+ bottom = typeof arrowY === "number" ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : "";
3053
+ } else if (this.arrowPlacement === "center") {
3054
+ left = typeof arrowX === "number" ? `calc(50% - var(--arrow-size-diagonal))` : "";
3055
+ top = typeof arrowY === "number" ? `calc(50% - var(--arrow-size-diagonal))` : "";
3056
+ } else {
3057
+ left = typeof arrowX === "number" ? `${arrowX}px` : "";
3058
+ top = typeof arrowY === "number" ? `${arrowY}px` : "";
3059
+ }
3060
+ Object.assign(this.arrowEl.style, {
3061
+ top,
3062
+ right,
3063
+ bottom,
3064
+ left,
3065
+ [staticSide]: "calc(var(--arrow-size-diagonal) * -1)"
3066
+ });
3067
+ }
3068
+ });
3069
+ requestAnimationFrame(() => this.updateHoverBridge());
3070
+ this.emit("sl-reposition");
3071
+ }
3072
+ render() {
3073
+ return x`
3074
+ <slot name="anchor" @slotchange=${this.handleAnchorChange}></slot>
3075
+
3076
+ <span
3077
+ part="hover-bridge"
3078
+ class=${e$2({
3079
+ "popup-hover-bridge": true,
3080
+ "popup-hover-bridge--visible": this.hoverBridge && this.active
3081
+ })}
3082
+ ></span>
3083
+
3084
+ <div
3085
+ part="popup"
3086
+ class=${e$2({
3087
+ popup: true,
3088
+ "popup--active": this.active,
3089
+ "popup--fixed": this.strategy === "fixed",
3090
+ "popup--has-arrow": this.arrow
3091
+ })}
3092
+ >
3093
+ <slot></slot>
3094
+ ${this.arrow ? x`<div part="arrow" class="popup__arrow" role="presentation"></div>` : ""}
3095
+ </div>
3096
+ `;
3097
+ }
3098
+ };
3099
+ SlPopup.styles = [component_styles_default, popup_styles_default];
3100
+ __decorateClass([
3101
+ e$3(".popup")
3102
+ ], SlPopup.prototype, "popup", 2);
3103
+ __decorateClass([
3104
+ e$3(".popup__arrow")
3105
+ ], SlPopup.prototype, "arrowEl", 2);
3106
+ __decorateClass([
3107
+ n$1()
3108
+ ], SlPopup.prototype, "anchor", 2);
3109
+ __decorateClass([
3110
+ n$1({ type: Boolean, reflect: true })
3111
+ ], SlPopup.prototype, "active", 2);
3112
+ __decorateClass([
3113
+ n$1({ reflect: true })
3114
+ ], SlPopup.prototype, "placement", 2);
3115
+ __decorateClass([
3116
+ n$1({ reflect: true })
3117
+ ], SlPopup.prototype, "strategy", 2);
3118
+ __decorateClass([
3119
+ n$1({ type: Number })
3120
+ ], SlPopup.prototype, "distance", 2);
3121
+ __decorateClass([
3122
+ n$1({ type: Number })
3123
+ ], SlPopup.prototype, "skidding", 2);
3124
+ __decorateClass([
3125
+ n$1({ type: Boolean })
3126
+ ], SlPopup.prototype, "arrow", 2);
3127
+ __decorateClass([
3128
+ n$1({ attribute: "arrow-placement" })
3129
+ ], SlPopup.prototype, "arrowPlacement", 2);
3130
+ __decorateClass([
3131
+ n$1({ attribute: "arrow-padding", type: Number })
3132
+ ], SlPopup.prototype, "arrowPadding", 2);
3133
+ __decorateClass([
3134
+ n$1({ type: Boolean })
3135
+ ], SlPopup.prototype, "flip", 2);
3136
+ __decorateClass([
3137
+ n$1({
3138
+ attribute: "flip-fallback-placements",
3139
+ converter: {
3140
+ fromAttribute: (value) => {
3141
+ return value.split(" ").map((p) => p.trim()).filter((p) => p !== "");
3142
+ },
3143
+ toAttribute: (value) => {
3144
+ return value.join(" ");
3145
+ }
3146
+ }
3147
+ })
3148
+ ], SlPopup.prototype, "flipFallbackPlacements", 2);
3149
+ __decorateClass([
3150
+ n$1({ attribute: "flip-fallback-strategy" })
3151
+ ], SlPopup.prototype, "flipFallbackStrategy", 2);
3152
+ __decorateClass([
3153
+ n$1({ type: Object })
3154
+ ], SlPopup.prototype, "flipBoundary", 2);
3155
+ __decorateClass([
3156
+ n$1({ attribute: "flip-padding", type: Number })
3157
+ ], SlPopup.prototype, "flipPadding", 2);
3158
+ __decorateClass([
3159
+ n$1({ type: Boolean })
3160
+ ], SlPopup.prototype, "shift", 2);
3161
+ __decorateClass([
3162
+ n$1({ type: Object })
3163
+ ], SlPopup.prototype, "shiftBoundary", 2);
3164
+ __decorateClass([
3165
+ n$1({ attribute: "shift-padding", type: Number })
3166
+ ], SlPopup.prototype, "shiftPadding", 2);
3167
+ __decorateClass([
3168
+ n$1({ attribute: "auto-size" })
3169
+ ], SlPopup.prototype, "autoSize", 2);
3170
+ __decorateClass([
3171
+ n$1()
3172
+ ], SlPopup.prototype, "sync", 2);
3173
+ __decorateClass([
3174
+ n$1({ type: Object })
3175
+ ], SlPopup.prototype, "autoSizeBoundary", 2);
3176
+ __decorateClass([
3177
+ n$1({ attribute: "auto-size-padding", type: Number })
3178
+ ], SlPopup.prototype, "autoSizePadding", 2);
3179
+ __decorateClass([
3180
+ n$1({ attribute: "hover-bridge", type: Boolean })
3181
+ ], SlPopup.prototype, "hoverBridge", 2);
3182
+
3183
+ /**
3184
+ * @license
3185
+ * Copyright 2017 Google LLC
3186
+ * SPDX-License-Identifier: BSD-3-Clause
3187
+ */class e extends i$1{constructor(i){if(super(i),this.it=T,i.type!==t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===T||null==r)return this._t=void 0,this.it=r;if(r===w)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e.directiveName="unsafeHTML",e.resultType=1;const o=e$4(e);
3188
+
3189
+ var SlSelect = class extends ShoelaceElement {
3190
+ constructor() {
3191
+ super(...arguments);
3192
+ this.formControlController = new FormControlController(this, {
3193
+ assumeInteractionOn: ["sl-blur", "sl-input"]
3194
+ });
3195
+ this.hasSlotController = new HasSlotController(this, "help-text", "label");
3196
+ this.localize = new LocalizeController(this);
3197
+ this.typeToSelectString = "";
3198
+ this.hasFocus = false;
3199
+ this.displayLabel = "";
3200
+ this.selectedOptions = [];
3201
+ this.name = "";
3202
+ this.value = "";
3203
+ this.defaultValue = "";
3204
+ this.size = "medium";
3205
+ this.placeholder = "";
3206
+ this.multiple = false;
3207
+ this.maxOptionsVisible = 3;
3208
+ this.disabled = false;
3209
+ this.clearable = false;
3210
+ this.open = false;
3211
+ this.hoist = false;
3212
+ this.filled = false;
3213
+ this.pill = false;
3214
+ this.label = "";
3215
+ this.placement = "bottom";
3216
+ this.helpText = "";
3217
+ this.form = "";
3218
+ this.required = false;
3219
+ this.getTag = (option) => {
3220
+ return x`
3221
+ <sl-tag
3222
+ part="tag"
3223
+ exportparts="
3224
+ base:tag__base,
3225
+ content:tag__content,
3226
+ remove-button:tag__remove-button,
3227
+ remove-button__base:tag__remove-button__base
3228
+ "
3229
+ ?pill=${this.pill}
3230
+ size=${this.size}
3231
+ removable
3232
+ @sl-remove=${(event) => this.handleTagRemove(event, option)}
3233
+ >
3234
+ ${option.getTextLabel()}
3235
+ </sl-tag>
3236
+ `;
3237
+ };
3238
+ this.handleDocumentFocusIn = (event) => {
3239
+ const path = event.composedPath();
3240
+ if (this && !path.includes(this)) {
3241
+ this.hide();
3242
+ }
3243
+ };
3244
+ this.handleDocumentKeyDown = (event) => {
3245
+ const target = event.target;
3246
+ const isClearButton = target.closest(".select__clear") !== null;
3247
+ const isIconButton = target.closest("sl-icon-button") !== null;
3248
+ if (isClearButton || isIconButton) {
3249
+ return;
3250
+ }
3251
+ if (event.key === "Escape" && this.open && !this.closeWatcher) {
3252
+ event.preventDefault();
3253
+ event.stopPropagation();
3254
+ this.hide();
3255
+ this.displayInput.focus({ preventScroll: true });
3256
+ }
3257
+ if (event.key === "Enter" || event.key === " " && this.typeToSelectString === "") {
3258
+ event.preventDefault();
3259
+ event.stopImmediatePropagation();
3260
+ if (!this.open) {
3261
+ this.show();
3262
+ return;
3263
+ }
3264
+ if (this.currentOption && !this.currentOption.disabled) {
3265
+ if (this.multiple) {
3266
+ this.toggleOptionSelection(this.currentOption);
3267
+ } else {
3268
+ this.setSelectedOptions(this.currentOption);
3269
+ }
3270
+ this.updateComplete.then(() => {
3271
+ this.emit("sl-input");
3272
+ this.emit("sl-change");
3273
+ });
3274
+ if (!this.multiple) {
3275
+ this.hide();
3276
+ this.displayInput.focus({ preventScroll: true });
3277
+ }
3278
+ }
3279
+ return;
3280
+ }
3281
+ if (["ArrowUp", "ArrowDown", "Home", "End"].includes(event.key)) {
3282
+ const allOptions = this.getAllOptions();
3283
+ const currentIndex = allOptions.indexOf(this.currentOption);
3284
+ let newIndex = Math.max(0, currentIndex);
3285
+ event.preventDefault();
3286
+ if (!this.open) {
3287
+ this.show();
3288
+ if (this.currentOption) {
3289
+ return;
3290
+ }
3291
+ }
3292
+ if (event.key === "ArrowDown") {
3293
+ newIndex = currentIndex + 1;
3294
+ if (newIndex > allOptions.length - 1)
3295
+ newIndex = 0;
3296
+ } else if (event.key === "ArrowUp") {
3297
+ newIndex = currentIndex - 1;
3298
+ if (newIndex < 0)
3299
+ newIndex = allOptions.length - 1;
3300
+ } else if (event.key === "Home") {
3301
+ newIndex = 0;
3302
+ } else if (event.key === "End") {
3303
+ newIndex = allOptions.length - 1;
3304
+ }
3305
+ this.setCurrentOption(allOptions[newIndex]);
3306
+ }
3307
+ if (event.key.length === 1 || event.key === "Backspace") {
3308
+ const allOptions = this.getAllOptions();
3309
+ if (event.metaKey || event.ctrlKey || event.altKey) {
3310
+ return;
3311
+ }
3312
+ if (!this.open) {
3313
+ if (event.key === "Backspace") {
3314
+ return;
3315
+ }
3316
+ this.show();
3317
+ }
3318
+ event.stopPropagation();
3319
+ event.preventDefault();
3320
+ clearTimeout(this.typeToSelectTimeout);
3321
+ this.typeToSelectTimeout = window.setTimeout(() => this.typeToSelectString = "", 1e3);
3322
+ if (event.key === "Backspace") {
3323
+ this.typeToSelectString = this.typeToSelectString.slice(0, -1);
3324
+ } else {
3325
+ this.typeToSelectString += event.key.toLowerCase();
3326
+ }
3327
+ for (const option of allOptions) {
3328
+ const label = option.getTextLabel().toLowerCase();
3329
+ if (label.startsWith(this.typeToSelectString)) {
3330
+ this.setCurrentOption(option);
3331
+ break;
3332
+ }
3333
+ }
3334
+ }
3335
+ };
3336
+ this.handleDocumentMouseDown = (event) => {
3337
+ const path = event.composedPath();
3338
+ if (this && !path.includes(this)) {
3339
+ this.hide();
3340
+ }
3341
+ };
3342
+ }
3343
+ /** Gets the validity state object */
3344
+ get validity() {
3345
+ return this.valueInput.validity;
3346
+ }
3347
+ /** Gets the validation message */
3348
+ get validationMessage() {
3349
+ return this.valueInput.validationMessage;
3350
+ }
3351
+ connectedCallback() {
3352
+ super.connectedCallback();
3353
+ this.open = false;
3354
+ }
3355
+ addOpenListeners() {
3356
+ var _a;
3357
+ document.addEventListener("focusin", this.handleDocumentFocusIn);
3358
+ document.addEventListener("keydown", this.handleDocumentKeyDown);
3359
+ document.addEventListener("mousedown", this.handleDocumentMouseDown);
3360
+ if (this.getRootNode() !== document) {
3361
+ this.getRootNode().addEventListener("focusin", this.handleDocumentFocusIn);
3362
+ }
3363
+ if ("CloseWatcher" in window) {
3364
+ (_a = this.closeWatcher) == null ? void 0 : _a.destroy();
3365
+ this.closeWatcher = new CloseWatcher();
3366
+ this.closeWatcher.onclose = () => {
3367
+ if (this.open) {
3368
+ this.hide();
3369
+ this.displayInput.focus({ preventScroll: true });
3370
+ }
3371
+ };
3372
+ }
3373
+ }
3374
+ removeOpenListeners() {
3375
+ var _a;
3376
+ document.removeEventListener("focusin", this.handleDocumentFocusIn);
3377
+ document.removeEventListener("keydown", this.handleDocumentKeyDown);
3378
+ document.removeEventListener("mousedown", this.handleDocumentMouseDown);
3379
+ if (this.getRootNode() !== document) {
3380
+ this.getRootNode().removeEventListener("focusin", this.handleDocumentFocusIn);
3381
+ }
3382
+ (_a = this.closeWatcher) == null ? void 0 : _a.destroy();
3383
+ }
3384
+ handleFocus() {
3385
+ this.hasFocus = true;
3386
+ this.displayInput.setSelectionRange(0, 0);
3387
+ this.emit("sl-focus");
3388
+ }
3389
+ handleBlur() {
3390
+ this.hasFocus = false;
3391
+ this.emit("sl-blur");
3392
+ }
3393
+ handleLabelClick() {
3394
+ this.displayInput.focus();
3395
+ }
3396
+ handleComboboxMouseDown(event) {
3397
+ const path = event.composedPath();
3398
+ const isIconButton = path.some((el) => el instanceof Element && el.tagName.toLowerCase() === "sl-icon-button");
3399
+ if (this.disabled || isIconButton) {
3400
+ return;
3401
+ }
3402
+ event.preventDefault();
3403
+ this.displayInput.focus({ preventScroll: true });
3404
+ this.open = !this.open;
3405
+ }
3406
+ handleComboboxKeyDown(event) {
3407
+ if (event.key === "Tab") {
3408
+ return;
3409
+ }
3410
+ event.stopPropagation();
3411
+ this.handleDocumentKeyDown(event);
3412
+ }
3413
+ handleClearClick(event) {
3414
+ event.stopPropagation();
3415
+ if (this.value !== "") {
3416
+ this.setSelectedOptions([]);
3417
+ this.displayInput.focus({ preventScroll: true });
3418
+ this.updateComplete.then(() => {
3419
+ this.emit("sl-clear");
3420
+ this.emit("sl-input");
3421
+ this.emit("sl-change");
3422
+ });
3423
+ }
3424
+ }
3425
+ handleClearMouseDown(event) {
3426
+ event.stopPropagation();
3427
+ event.preventDefault();
3428
+ }
3429
+ handleOptionClick(event) {
3430
+ const target = event.target;
3431
+ const option = target.closest("sl-option");
3432
+ const oldValue = this.value;
3433
+ if (option && !option.disabled) {
3434
+ if (this.multiple) {
3435
+ this.toggleOptionSelection(option);
3436
+ } else {
3437
+ this.setSelectedOptions(option);
3438
+ }
3439
+ this.updateComplete.then(() => this.displayInput.focus({ preventScroll: true }));
3440
+ if (this.value !== oldValue) {
3441
+ this.updateComplete.then(() => {
3442
+ this.emit("sl-input");
3443
+ this.emit("sl-change");
3444
+ });
3445
+ }
3446
+ if (!this.multiple) {
3447
+ this.hide();
3448
+ this.displayInput.focus({ preventScroll: true });
3449
+ }
3450
+ }
3451
+ }
3452
+ handleDefaultSlotChange() {
3453
+ const allOptions = this.getAllOptions();
3454
+ const value = Array.isArray(this.value) ? this.value : [this.value];
3455
+ const values = [];
3456
+ if (customElements.get("sl-option")) {
3457
+ allOptions.forEach((option) => values.push(option.value));
3458
+ this.setSelectedOptions(allOptions.filter((el) => value.includes(el.value)));
3459
+ } else {
3460
+ customElements.whenDefined("sl-option").then(() => this.handleDefaultSlotChange());
3461
+ }
3462
+ }
3463
+ handleTagRemove(event, option) {
3464
+ event.stopPropagation();
3465
+ if (!this.disabled) {
3466
+ this.toggleOptionSelection(option, false);
3467
+ this.updateComplete.then(() => {
3468
+ this.emit("sl-input");
3469
+ this.emit("sl-change");
3470
+ });
3471
+ }
3472
+ }
3473
+ // Gets an array of all <sl-option> elements
3474
+ getAllOptions() {
3475
+ return [...this.querySelectorAll("sl-option")];
3476
+ }
3477
+ // Gets the first <sl-option> element
3478
+ getFirstOption() {
3479
+ return this.querySelector("sl-option");
3480
+ }
3481
+ // Sets the current option, which is the option the user is currently interacting with (e.g. via keyboard). Only one
3482
+ // option may be "current" at a time.
3483
+ setCurrentOption(option) {
3484
+ const allOptions = this.getAllOptions();
3485
+ allOptions.forEach((el) => {
3486
+ el.current = false;
3487
+ el.tabIndex = -1;
3488
+ });
3489
+ if (option) {
3490
+ this.currentOption = option;
3491
+ option.current = true;
3492
+ option.tabIndex = 0;
3493
+ option.focus();
3494
+ }
3495
+ }
3496
+ // Sets the selected option(s)
3497
+ setSelectedOptions(option) {
3498
+ const allOptions = this.getAllOptions();
3499
+ const newSelectedOptions = Array.isArray(option) ? option : [option];
3500
+ allOptions.forEach((el) => el.selected = false);
3501
+ if (newSelectedOptions.length) {
3502
+ newSelectedOptions.forEach((el) => el.selected = true);
3503
+ }
3504
+ this.selectionChanged();
3505
+ }
3506
+ // Toggles an option's selected state
3507
+ toggleOptionSelection(option, force) {
3508
+ if (force === true || force === false) {
3509
+ option.selected = force;
3510
+ } else {
3511
+ option.selected = !option.selected;
3512
+ }
3513
+ this.selectionChanged();
3514
+ }
3515
+ // This method must be called whenever the selection changes. It will update the selected options cache, the current
3516
+ // value, and the display value
3517
+ selectionChanged() {
3518
+ var _a, _b, _c, _d;
3519
+ this.selectedOptions = this.getAllOptions().filter((el) => el.selected);
3520
+ if (this.multiple) {
3521
+ this.value = this.selectedOptions.map((el) => el.value);
3522
+ if (this.placeholder && this.value.length === 0) {
3523
+ this.displayLabel = "";
3524
+ } else {
3525
+ this.displayLabel = this.localize.term("numOptionsSelected", this.selectedOptions.length);
3526
+ }
3527
+ } else {
3528
+ this.value = (_b = (_a = this.selectedOptions[0]) == null ? void 0 : _a.value) != null ? _b : "";
3529
+ this.displayLabel = (_d = (_c = this.selectedOptions[0]) == null ? void 0 : _c.getTextLabel()) != null ? _d : "";
3530
+ }
3531
+ this.updateComplete.then(() => {
3532
+ this.formControlController.updateValidity();
3533
+ });
3534
+ }
3535
+ get tags() {
3536
+ return this.selectedOptions.map((option, index) => {
3537
+ if (index < this.maxOptionsVisible || this.maxOptionsVisible <= 0) {
3538
+ const tag = this.getTag(option, index);
3539
+ return x`<div @sl-remove=${(e) => this.handleTagRemove(e, option)}>
3540
+ ${typeof tag === "string" ? o(tag) : tag}
3541
+ </div>`;
3542
+ } else if (index === this.maxOptionsVisible) {
3543
+ return x`<sl-tag size=${this.size}>+${this.selectedOptions.length - index}</sl-tag>`;
3544
+ }
3545
+ return x``;
3546
+ });
3547
+ }
3548
+ handleInvalid(event) {
3549
+ this.formControlController.setValidity(false);
3550
+ this.formControlController.emitInvalidEvent(event);
3551
+ }
3552
+ handleDisabledChange() {
3553
+ if (this.disabled) {
3554
+ this.open = false;
3555
+ this.handleOpenChange();
3556
+ }
3557
+ }
3558
+ handleValueChange() {
3559
+ const allOptions = this.getAllOptions();
3560
+ const value = Array.isArray(this.value) ? this.value : [this.value];
3561
+ this.setSelectedOptions(allOptions.filter((el) => value.includes(el.value)));
3562
+ }
3563
+ async handleOpenChange() {
3564
+ if (this.open && !this.disabled) {
3565
+ this.setCurrentOption(this.selectedOptions[0] || this.getFirstOption());
3566
+ this.emit("sl-show");
3567
+ this.addOpenListeners();
3568
+ await stopAnimations(this);
3569
+ this.listbox.hidden = false;
3570
+ this.popup.active = true;
3571
+ requestAnimationFrame(() => {
3572
+ this.setCurrentOption(this.currentOption);
3573
+ });
3574
+ const { keyframes, options } = getAnimation(this, "select.show", { dir: this.localize.dir() });
3575
+ await animateTo(this.popup.popup, keyframes, options);
3576
+ if (this.currentOption) {
3577
+ scrollIntoView(this.currentOption, this.listbox, "vertical", "auto");
3578
+ }
3579
+ this.emit("sl-after-show");
3580
+ } else {
3581
+ this.emit("sl-hide");
3582
+ this.removeOpenListeners();
3583
+ await stopAnimations(this);
3584
+ const { keyframes, options } = getAnimation(this, "select.hide", { dir: this.localize.dir() });
3585
+ await animateTo(this.popup.popup, keyframes, options);
3586
+ this.listbox.hidden = true;
3587
+ this.popup.active = false;
3588
+ this.emit("sl-after-hide");
3589
+ }
3590
+ }
3591
+ /** Shows the listbox. */
3592
+ async show() {
3593
+ if (this.open || this.disabled) {
3594
+ this.open = false;
3595
+ return void 0;
3596
+ }
3597
+ this.open = true;
3598
+ return waitForEvent(this, "sl-after-show");
3599
+ }
3600
+ /** Hides the listbox. */
3601
+ async hide() {
3602
+ if (!this.open || this.disabled) {
3603
+ this.open = false;
3604
+ return void 0;
3605
+ }
3606
+ this.open = false;
3607
+ return waitForEvent(this, "sl-after-hide");
3608
+ }
3609
+ /** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */
3610
+ checkValidity() {
3611
+ return this.valueInput.checkValidity();
3612
+ }
3613
+ /** Gets the associated form, if one exists. */
3614
+ getForm() {
3615
+ return this.formControlController.getForm();
3616
+ }
3617
+ /** Checks for validity and shows the browser's validation message if the control is invalid. */
3618
+ reportValidity() {
3619
+ return this.valueInput.reportValidity();
3620
+ }
3621
+ /** Sets a custom validation message. Pass an empty string to restore validity. */
3622
+ setCustomValidity(message) {
3623
+ this.valueInput.setCustomValidity(message);
3624
+ this.formControlController.updateValidity();
3625
+ }
3626
+ /** Sets focus on the control. */
3627
+ focus(options) {
3628
+ this.displayInput.focus(options);
3629
+ }
3630
+ /** Removes focus from the control. */
3631
+ blur() {
3632
+ this.displayInput.blur();
3633
+ }
3634
+ render() {
3635
+ const hasLabelSlot = this.hasSlotController.test("label");
3636
+ const hasHelpTextSlot = this.hasSlotController.test("help-text");
3637
+ const hasLabel = this.label ? true : !!hasLabelSlot;
3638
+ const hasHelpText = this.helpText ? true : !!hasHelpTextSlot;
3639
+ const hasClearIcon = this.clearable && !this.disabled && this.value.length > 0;
3640
+ const isPlaceholderVisible = this.placeholder && this.value.length === 0;
3641
+ return x`
3642
+ <div
3643
+ part="form-control"
3644
+ class=${e$2({
3645
+ "form-control": true,
3646
+ "form-control--small": this.size === "small",
3647
+ "form-control--medium": this.size === "medium",
3648
+ "form-control--large": this.size === "large",
3649
+ "form-control--has-label": hasLabel,
3650
+ "form-control--has-help-text": hasHelpText
3651
+ })}
3652
+ >
3653
+ <label
3654
+ id="label"
3655
+ part="form-control-label"
3656
+ class="form-control__label"
3657
+ aria-hidden=${hasLabel ? "false" : "true"}
3658
+ @click=${this.handleLabelClick}
3659
+ >
3660
+ <slot name="label">${this.label}</slot>
3661
+ </label>
3662
+
3663
+ <div part="form-control-input" class="form-control-input">
3664
+ <sl-popup
3665
+ class=${e$2({
3666
+ select: true,
3667
+ "select--standard": true,
3668
+ "select--filled": this.filled,
3669
+ "select--pill": this.pill,
3670
+ "select--open": this.open,
3671
+ "select--disabled": this.disabled,
3672
+ "select--multiple": this.multiple,
3673
+ "select--focused": this.hasFocus,
3674
+ "select--placeholder-visible": isPlaceholderVisible,
3675
+ "select--top": this.placement === "top",
3676
+ "select--bottom": this.placement === "bottom",
3677
+ "select--small": this.size === "small",
3678
+ "select--medium": this.size === "medium",
3679
+ "select--large": this.size === "large"
3680
+ })}
3681
+ placement=${this.placement}
3682
+ strategy=${this.hoist ? "fixed" : "absolute"}
3683
+ flip
3684
+ shift
3685
+ sync="width"
3686
+ auto-size="vertical"
3687
+ auto-size-padding="10"
3688
+ >
3689
+ <div
3690
+ part="combobox"
3691
+ class="select__combobox"
3692
+ slot="anchor"
3693
+ @keydown=${this.handleComboboxKeyDown}
3694
+ @mousedown=${this.handleComboboxMouseDown}
3695
+ >
3696
+ <slot part="prefix" name="prefix" class="select__prefix"></slot>
3697
+
3698
+ <input
3699
+ part="display-input"
3700
+ class="select__display-input"
3701
+ type="text"
3702
+ placeholder=${this.placeholder}
3703
+ .disabled=${this.disabled}
3704
+ .value=${this.displayLabel}
3705
+ autocomplete="off"
3706
+ spellcheck="false"
3707
+ autocapitalize="off"
3708
+ readonly
3709
+ aria-controls="listbox"
3710
+ aria-expanded=${this.open ? "true" : "false"}
3711
+ aria-haspopup="listbox"
3712
+ aria-labelledby="label"
3713
+ aria-disabled=${this.disabled ? "true" : "false"}
3714
+ aria-describedby="help-text"
3715
+ role="combobox"
3716
+ tabindex="0"
3717
+ @focus=${this.handleFocus}
3718
+ @blur=${this.handleBlur}
3719
+ />
3720
+
3721
+ ${this.multiple ? x`<div part="tags" class="select__tags">${this.tags}</div>` : ""}
3722
+
3723
+ <input
3724
+ class="select__value-input"
3725
+ type="text"
3726
+ ?disabled=${this.disabled}
3727
+ ?required=${this.required}
3728
+ .value=${Array.isArray(this.value) ? this.value.join(", ") : this.value}
3729
+ tabindex="-1"
3730
+ aria-hidden="true"
3731
+ @focus=${() => this.focus()}
3732
+ @invalid=${this.handleInvalid}
3733
+ />
3734
+
3735
+ ${hasClearIcon ? x`
3736
+ <button
3737
+ part="clear-button"
3738
+ class="select__clear"
3739
+ type="button"
3740
+ aria-label=${this.localize.term("clearEntry")}
3741
+ @mousedown=${this.handleClearMouseDown}
3742
+ @click=${this.handleClearClick}
3743
+ tabindex="-1"
3744
+ >
3745
+ <slot name="clear-icon">
3746
+ <sl-icon name="x-circle-fill" library="system"></sl-icon>
3747
+ </slot>
3748
+ </button>
3749
+ ` : ""}
3750
+
3751
+ <slot name="expand-icon" part="expand-icon" class="select__expand-icon">
3752
+ <sl-icon library="system" name="chevron-down"></sl-icon>
3753
+ </slot>
3754
+ </div>
3755
+
3756
+ <div
3757
+ id="listbox"
3758
+ role="listbox"
3759
+ aria-expanded=${this.open ? "true" : "false"}
3760
+ aria-multiselectable=${this.multiple ? "true" : "false"}
3761
+ aria-labelledby="label"
3762
+ part="listbox"
3763
+ class="select__listbox"
3764
+ tabindex="-1"
3765
+ @mouseup=${this.handleOptionClick}
3766
+ @slotchange=${this.handleDefaultSlotChange}
3767
+ >
3768
+ <slot></slot>
3769
+ </div>
3770
+ </sl-popup>
3771
+ </div>
3772
+
3773
+ <div
3774
+ part="form-control-help-text"
3775
+ id="help-text"
3776
+ class="form-control__help-text"
3777
+ aria-hidden=${hasHelpText ? "false" : "true"}
3778
+ >
3779
+ <slot name="help-text">${this.helpText}</slot>
3780
+ </div>
3781
+ </div>
3782
+ `;
3783
+ }
3784
+ };
3785
+ SlSelect.styles = [component_styles_default, form_control_styles_default, select_styles_default];
3786
+ SlSelect.dependencies = {
3787
+ "sl-icon": SlIcon,
3788
+ "sl-popup": SlPopup,
3789
+ "sl-tag": SlTag
3790
+ };
3791
+ __decorateClass([
3792
+ e$3(".select")
3793
+ ], SlSelect.prototype, "popup", 2);
3794
+ __decorateClass([
3795
+ e$3(".select__combobox")
3796
+ ], SlSelect.prototype, "combobox", 2);
3797
+ __decorateClass([
3798
+ e$3(".select__display-input")
3799
+ ], SlSelect.prototype, "displayInput", 2);
3800
+ __decorateClass([
3801
+ e$3(".select__value-input")
3802
+ ], SlSelect.prototype, "valueInput", 2);
3803
+ __decorateClass([
3804
+ e$3(".select__listbox")
3805
+ ], SlSelect.prototype, "listbox", 2);
3806
+ __decorateClass([
3807
+ r()
3808
+ ], SlSelect.prototype, "hasFocus", 2);
3809
+ __decorateClass([
3810
+ r()
3811
+ ], SlSelect.prototype, "displayLabel", 2);
3812
+ __decorateClass([
3813
+ r()
3814
+ ], SlSelect.prototype, "currentOption", 2);
3815
+ __decorateClass([
3816
+ r()
3817
+ ], SlSelect.prototype, "selectedOptions", 2);
3818
+ __decorateClass([
3819
+ n$1()
3820
+ ], SlSelect.prototype, "name", 2);
3821
+ __decorateClass([
3822
+ n$1({
3823
+ converter: {
3824
+ fromAttribute: (value) => value.split(" "),
3825
+ toAttribute: (value) => value.join(" ")
3826
+ }
3827
+ })
3828
+ ], SlSelect.prototype, "value", 2);
3829
+ __decorateClass([
3830
+ defaultValue()
3831
+ ], SlSelect.prototype, "defaultValue", 2);
3832
+ __decorateClass([
3833
+ n$1({ reflect: true })
3834
+ ], SlSelect.prototype, "size", 2);
3835
+ __decorateClass([
3836
+ n$1()
3837
+ ], SlSelect.prototype, "placeholder", 2);
3838
+ __decorateClass([
3839
+ n$1({ type: Boolean, reflect: true })
3840
+ ], SlSelect.prototype, "multiple", 2);
3841
+ __decorateClass([
3842
+ n$1({ attribute: "max-options-visible", type: Number })
3843
+ ], SlSelect.prototype, "maxOptionsVisible", 2);
3844
+ __decorateClass([
3845
+ n$1({ type: Boolean, reflect: true })
3846
+ ], SlSelect.prototype, "disabled", 2);
3847
+ __decorateClass([
3848
+ n$1({ type: Boolean })
3849
+ ], SlSelect.prototype, "clearable", 2);
3850
+ __decorateClass([
3851
+ n$1({ type: Boolean, reflect: true })
3852
+ ], SlSelect.prototype, "open", 2);
3853
+ __decorateClass([
3854
+ n$1({ type: Boolean })
3855
+ ], SlSelect.prototype, "hoist", 2);
3856
+ __decorateClass([
3857
+ n$1({ type: Boolean, reflect: true })
3858
+ ], SlSelect.prototype, "filled", 2);
3859
+ __decorateClass([
3860
+ n$1({ type: Boolean, reflect: true })
3861
+ ], SlSelect.prototype, "pill", 2);
3862
+ __decorateClass([
3863
+ n$1()
3864
+ ], SlSelect.prototype, "label", 2);
3865
+ __decorateClass([
3866
+ n$1({ reflect: true })
3867
+ ], SlSelect.prototype, "placement", 2);
3868
+ __decorateClass([
3869
+ n$1({ attribute: "help-text" })
3870
+ ], SlSelect.prototype, "helpText", 2);
3871
+ __decorateClass([
3872
+ n$1({ reflect: true })
3873
+ ], SlSelect.prototype, "form", 2);
3874
+ __decorateClass([
3875
+ n$1({ type: Boolean, reflect: true })
3876
+ ], SlSelect.prototype, "required", 2);
3877
+ __decorateClass([
3878
+ n$1()
3879
+ ], SlSelect.prototype, "getTag", 2);
3880
+ __decorateClass([
3881
+ watch("disabled", { waitUntilFirstUpdate: true })
3882
+ ], SlSelect.prototype, "handleDisabledChange", 1);
3883
+ __decorateClass([
3884
+ watch("value", { waitUntilFirstUpdate: true })
3885
+ ], SlSelect.prototype, "handleValueChange", 1);
3886
+ __decorateClass([
3887
+ watch("open", { waitUntilFirstUpdate: true })
3888
+ ], SlSelect.prototype, "handleOpenChange", 1);
3889
+ setDefaultAnimation("select.show", {
3890
+ keyframes: [
3891
+ { opacity: 0, scale: 0.9 },
3892
+ { opacity: 1, scale: 1 }
3893
+ ],
3894
+ options: { duration: 100, easing: "ease" }
3895
+ });
3896
+ setDefaultAnimation("select.hide", {
3897
+ keyframes: [
3898
+ { opacity: 1, scale: 1 },
3899
+ { opacity: 0, scale: 0.9 }
3900
+ ],
3901
+ options: { duration: 100, easing: "ease" }
3902
+ });
3903
+
3904
+ SlSelect.define("sl-select");
3905
+
3906
+ // src/components/option/option.styles.ts
3907
+ var option_styles_default = i`
3908
+ :host {
3909
+ display: block;
3910
+ user-select: none;
3911
+ -webkit-user-select: none;
3912
+ }
3913
+
3914
+ :host(:focus) {
3915
+ outline: none;
3916
+ }
3917
+
3918
+ .option {
3919
+ position: relative;
3920
+ display: flex;
3921
+ align-items: center;
3922
+ font-family: var(--sl-font-sans);
3923
+ font-size: var(--sl-font-size-medium);
3924
+ font-weight: var(--sl-font-weight-normal);
3925
+ line-height: var(--sl-line-height-normal);
3926
+ letter-spacing: var(--sl-letter-spacing-normal);
3927
+ color: var(--sl-color-neutral-700);
3928
+ padding: var(--sl-spacing-x-small) var(--sl-spacing-medium) var(--sl-spacing-x-small) var(--sl-spacing-x-small);
3929
+ transition: var(--sl-transition-fast) fill;
3930
+ cursor: pointer;
3931
+ }
3932
+
3933
+ .option--hover:not(.option--current):not(.option--disabled) {
3934
+ background-color: var(--sl-color-neutral-100);
3935
+ color: var(--sl-color-neutral-1000);
3936
+ }
3937
+
3938
+ .option--current,
3939
+ .option--current.option--disabled {
3940
+ background-color: var(--sl-color-primary-600);
3941
+ color: var(--sl-color-neutral-0);
3942
+ opacity: 1;
3943
+ }
3944
+
3945
+ .option--disabled {
3946
+ outline: none;
3947
+ opacity: 0.5;
3948
+ cursor: not-allowed;
3949
+ }
3950
+
3951
+ .option__label {
3952
+ flex: 1 1 auto;
3953
+ display: inline-block;
3954
+ line-height: var(--sl-line-height-dense);
3955
+ }
3956
+
3957
+ .option .option__check {
3958
+ flex: 0 0 auto;
3959
+ display: flex;
3960
+ align-items: center;
3961
+ justify-content: center;
3962
+ visibility: hidden;
3963
+ padding-inline-end: var(--sl-spacing-2x-small);
3964
+ }
3965
+
3966
+ .option--selected .option__check {
3967
+ visibility: visible;
3968
+ }
3969
+
3970
+ .option__prefix,
3971
+ .option__suffix {
3972
+ flex: 0 0 auto;
3973
+ display: flex;
3974
+ align-items: center;
3975
+ }
3976
+
3977
+ .option__prefix::slotted(*) {
3978
+ margin-inline-end: var(--sl-spacing-x-small);
3979
+ }
3980
+
3981
+ .option__suffix::slotted(*) {
3982
+ margin-inline-start: var(--sl-spacing-x-small);
3983
+ }
3984
+
3985
+ @media (forced-colors: active) {
3986
+ :host(:hover:not([aria-disabled='true'])) .option {
3987
+ outline: dashed 1px SelectedItem;
3988
+ outline-offset: -1px;
3989
+ }
3990
+ }
3991
+ `;
3992
+
3993
+ var SlOption = class extends ShoelaceElement {
3994
+ constructor() {
3995
+ super(...arguments);
3996
+ // @ts-expect-error - Controller is currently unused
3997
+ this.localize = new LocalizeController(this);
3998
+ this.current = false;
3999
+ this.selected = false;
4000
+ this.hasHover = false;
4001
+ this.value = "";
4002
+ this.disabled = false;
4003
+ }
4004
+ connectedCallback() {
4005
+ super.connectedCallback();
4006
+ this.setAttribute("role", "option");
4007
+ this.setAttribute("aria-selected", "false");
4008
+ }
4009
+ handleDefaultSlotChange() {
4010
+ const textLabel = this.getTextLabel();
4011
+ if (typeof this.cachedTextLabel === "undefined") {
4012
+ this.cachedTextLabel = textLabel;
4013
+ return;
4014
+ }
4015
+ if (textLabel !== this.cachedTextLabel) {
4016
+ this.cachedTextLabel = textLabel;
4017
+ this.emit("slotchange", { bubbles: true, composed: false, cancelable: false });
4018
+ }
4019
+ }
4020
+ handleMouseEnter() {
4021
+ this.hasHover = true;
4022
+ }
4023
+ handleMouseLeave() {
4024
+ this.hasHover = false;
4025
+ }
4026
+ handleDisabledChange() {
4027
+ this.setAttribute("aria-disabled", this.disabled ? "true" : "false");
4028
+ }
4029
+ handleSelectedChange() {
4030
+ this.setAttribute("aria-selected", this.selected ? "true" : "false");
4031
+ }
4032
+ handleValueChange() {
4033
+ if (typeof this.value !== "string") {
4034
+ this.value = String(this.value);
4035
+ }
4036
+ if (this.value.includes(" ")) {
4037
+ console.error(`Option values cannot include a space. All spaces have been replaced with underscores.`, this);
4038
+ this.value = this.value.replace(/ /g, "_");
4039
+ }
4040
+ }
4041
+ /** Returns a plain text label based on the option's content. */
4042
+ getTextLabel() {
4043
+ const nodes = this.childNodes;
4044
+ let label = "";
4045
+ [...nodes].forEach((node) => {
4046
+ if (node.nodeType === Node.ELEMENT_NODE) {
4047
+ if (!node.hasAttribute("slot")) {
4048
+ label += node.textContent;
4049
+ }
4050
+ }
4051
+ if (node.nodeType === Node.TEXT_NODE) {
4052
+ label += node.textContent;
4053
+ }
4054
+ });
4055
+ return label.trim();
4056
+ }
4057
+ render() {
4058
+ return x`
4059
+ <div
4060
+ part="base"
4061
+ class=${e$2({
4062
+ option: true,
4063
+ "option--current": this.current,
4064
+ "option--disabled": this.disabled,
4065
+ "option--selected": this.selected,
4066
+ "option--hover": this.hasHover
4067
+ })}
4068
+ @mouseenter=${this.handleMouseEnter}
4069
+ @mouseleave=${this.handleMouseLeave}
4070
+ >
4071
+ <sl-icon part="checked-icon" class="option__check" name="check" library="system" aria-hidden="true"></sl-icon>
4072
+ <slot part="prefix" name="prefix" class="option__prefix"></slot>
4073
+ <slot part="label" class="option__label" @slotchange=${this.handleDefaultSlotChange}></slot>
4074
+ <slot part="suffix" name="suffix" class="option__suffix"></slot>
4075
+ </div>
4076
+ `;
4077
+ }
4078
+ };
4079
+ SlOption.styles = [component_styles_default, option_styles_default];
4080
+ SlOption.dependencies = { "sl-icon": SlIcon };
4081
+ __decorateClass([
4082
+ e$3(".option__label")
4083
+ ], SlOption.prototype, "defaultSlot", 2);
4084
+ __decorateClass([
4085
+ r()
4086
+ ], SlOption.prototype, "current", 2);
4087
+ __decorateClass([
4088
+ r()
4089
+ ], SlOption.prototype, "selected", 2);
4090
+ __decorateClass([
4091
+ r()
4092
+ ], SlOption.prototype, "hasHover", 2);
4093
+ __decorateClass([
4094
+ n$1({ reflect: true })
4095
+ ], SlOption.prototype, "value", 2);
4096
+ __decorateClass([
4097
+ n$1({ type: Boolean, reflect: true })
4098
+ ], SlOption.prototype, "disabled", 2);
4099
+ __decorateClass([
4100
+ watch("disabled")
4101
+ ], SlOption.prototype, "handleDisabledChange", 1);
4102
+ __decorateClass([
4103
+ watch("selected")
4104
+ ], SlOption.prototype, "handleSelectedChange", 1);
4105
+ __decorateClass([
4106
+ watch("value")
4107
+ ], SlOption.prototype, "handleValueChange", 1);
4108
+
4109
+ SlOption.define("sl-option");
4110
+
4111
+ const jumpFilterSelectCss = ":root,:host,.sl-theme-light{color-scheme:light;--sl-color-gray-50:hsl(0 0% 97.5%);--sl-color-gray-100:hsl(240 4.8% 95.9%);--sl-color-gray-200:hsl(240 5.9% 90%);--sl-color-gray-300:hsl(240 4.9% 83.9%);--sl-color-gray-400:hsl(240 5% 64.9%);--sl-color-gray-500:hsl(240 3.8% 46.1%);--sl-color-gray-600:hsl(240 5.2% 33.9%);--sl-color-gray-700:hsl(240 5.3% 26.1%);--sl-color-gray-800:hsl(240 3.7% 15.9%);--sl-color-gray-900:hsl(240 5.9% 10%);--sl-color-gray-950:hsl(240 7.3% 8%);--sl-color-red-50:hsl(0 85.7% 97.3%);--sl-color-red-100:hsl(0 93.3% 94.1%);--sl-color-red-200:hsl(0 96.3% 89.4%);--sl-color-red-300:hsl(0 93.5% 81.8%);--sl-color-red-400:hsl(0 90.6% 70.8%);--sl-color-red-500:hsl(0 84.2% 60.2%);--sl-color-red-600:hsl(0 72.2% 50.6%);--sl-color-red-700:hsl(0 73.7% 41.8%);--sl-color-red-800:hsl(0 70% 35.3%);--sl-color-red-900:hsl(0 62.8% 30.6%);--sl-color-red-950:hsl(0 60% 19.6%);--sl-color-orange-50:hsl(33.3 100% 96.5%);--sl-color-orange-100:hsl(34.3 100% 91.8%);--sl-color-orange-200:hsl(32.1 97.7% 83.1%);--sl-color-orange-300:hsl(30.7 97.2% 72.4%);--sl-color-orange-400:hsl(27 96% 61%);--sl-color-orange-500:hsl(24.6 95% 53.1%);--sl-color-orange-600:hsl(20.5 90.2% 48.2%);--sl-color-orange-700:hsl(17.5 88.3% 40.4%);--sl-color-orange-800:hsl(15 79.1% 33.7%);--sl-color-orange-900:hsl(15.3 74.6% 27.8%);--sl-color-orange-950:hsl(15.2 69.1% 19%);--sl-color-amber-50:hsl(48 100% 96.1%);--sl-color-amber-100:hsl(48 96.5% 88.8%);--sl-color-amber-200:hsl(48 96.6% 76.7%);--sl-color-amber-300:hsl(45.9 96.7% 64.5%);--sl-color-amber-400:hsl(43.3 96.4% 56.3%);--sl-color-amber-500:hsl(37.7 92.1% 50.2%);--sl-color-amber-600:hsl(32.1 94.6% 43.7%);--sl-color-amber-700:hsl(26 90.5% 37.1%);--sl-color-amber-800:hsl(22.7 82.5% 31.4%);--sl-color-amber-900:hsl(21.7 77.8% 26.5%);--sl-color-amber-950:hsl(22.9 74.1% 16.7%);--sl-color-yellow-50:hsl(54.5 91.7% 95.3%);--sl-color-yellow-100:hsl(54.9 96.7% 88%);--sl-color-yellow-200:hsl(52.8 98.3% 76.9%);--sl-color-yellow-300:hsl(50.4 97.8% 63.5%);--sl-color-yellow-400:hsl(47.9 95.8% 53.1%);--sl-color-yellow-500:hsl(45.4 93.4% 47.5%);--sl-color-yellow-600:hsl(40.6 96.1% 40.4%);--sl-color-yellow-700:hsl(35.5 91.7% 32.9%);--sl-color-yellow-800:hsl(31.8 81% 28.8%);--sl-color-yellow-900:hsl(28.4 72.5% 25.7%);--sl-color-yellow-950:hsl(33.1 69% 13.9%);--sl-color-lime-50:hsl(78.3 92% 95.1%);--sl-color-lime-100:hsl(79.6 89.1% 89.2%);--sl-color-lime-200:hsl(80.9 88.5% 79.6%);--sl-color-lime-300:hsl(82 84.5% 67.1%);--sl-color-lime-400:hsl(82.7 78% 55.5%);--sl-color-lime-500:hsl(83.7 80.5% 44.3%);--sl-color-lime-600:hsl(84.8 85.2% 34.5%);--sl-color-lime-700:hsl(85.9 78.4% 27.3%);--sl-color-lime-800:hsl(86.3 69% 22.7%);--sl-color-lime-900:hsl(87.6 61.2% 20.2%);--sl-color-lime-950:hsl(86.5 60.6% 13.9%);--sl-color-green-50:hsl(138.5 76.5% 96.7%);--sl-color-green-100:hsl(140.6 84.2% 92.5%);--sl-color-green-200:hsl(141 78.9% 85.1%);--sl-color-green-300:hsl(141.7 76.6% 73.1%);--sl-color-green-400:hsl(141.9 69.2% 58%);--sl-color-green-500:hsl(142.1 70.6% 45.3%);--sl-color-green-600:hsl(142.1 76.2% 36.3%);--sl-color-green-700:hsl(142.4 71.8% 29.2%);--sl-color-green-800:hsl(142.8 64.2% 24.1%);--sl-color-green-900:hsl(143.8 61.2% 20.2%);--sl-color-green-950:hsl(144.3 60.7% 12%);--sl-color-emerald-50:hsl(151.8 81% 95.9%);--sl-color-emerald-100:hsl(149.3 80.4% 90%);--sl-color-emerald-200:hsl(152.4 76% 80.4%);--sl-color-emerald-300:hsl(156.2 71.6% 66.9%);--sl-color-emerald-400:hsl(158.1 64.4% 51.6%);--sl-color-emerald-500:hsl(160.1 84.1% 39.4%);--sl-color-emerald-600:hsl(161.4 93.5% 30.4%);--sl-color-emerald-700:hsl(162.9 93.5% 24.3%);--sl-color-emerald-800:hsl(163.1 88.1% 19.8%);--sl-color-emerald-900:hsl(164.2 85.7% 16.5%);--sl-color-emerald-950:hsl(164.3 87.5% 9.4%);--sl-color-teal-50:hsl(166.2 76.5% 96.7%);--sl-color-teal-100:hsl(167.2 85.5% 89.2%);--sl-color-teal-200:hsl(168.4 83.8% 78.2%);--sl-color-teal-300:hsl(170.6 76.9% 64.3%);--sl-color-teal-400:hsl(172.5 66% 50.4%);--sl-color-teal-500:hsl(173.4 80.4% 40%);--sl-color-teal-600:hsl(174.7 83.9% 31.6%);--sl-color-teal-700:hsl(175.3 77.4% 26.1%);--sl-color-teal-800:hsl(176.1 69.4% 21.8%);--sl-color-teal-900:hsl(175.9 60.8% 19%);--sl-color-teal-950:hsl(176.5 58.6% 11.4%);--sl-color-cyan-50:hsl(183.2 100% 96.3%);--sl-color-cyan-100:hsl(185.1 95.9% 90.4%);--sl-color-cyan-200:hsl(186.2 93.5% 81.8%);--sl-color-cyan-300:hsl(187 92.4% 69%);--sl-color-cyan-400:hsl(187.9 85.7% 53.3%);--sl-color-cyan-500:hsl(188.7 94.5% 42.7%);--sl-color-cyan-600:hsl(191.6 91.4% 36.5%);--sl-color-cyan-700:hsl(192.9 82.3% 31%);--sl-color-cyan-800:hsl(194.4 69.6% 27.1%);--sl-color-cyan-900:hsl(196.4 63.6% 23.7%);--sl-color-cyan-950:hsl(196.8 61% 16.1%);--sl-color-sky-50:hsl(204 100% 97.1%);--sl-color-sky-100:hsl(204 93.8% 93.7%);--sl-color-sky-200:hsl(200.6 94.4% 86.1%);--sl-color-sky-300:hsl(199.4 95.5% 73.9%);--sl-color-sky-400:hsl(198.4 93.2% 59.6%);--sl-color-sky-500:hsl(198.6 88.7% 48.4%);--sl-color-sky-600:hsl(200.4 98% 39.4%);--sl-color-sky-700:hsl(201.3 96.3% 32.2%);--sl-color-sky-800:hsl(201 90% 27.5%);--sl-color-sky-900:hsl(202 80.3% 23.9%);--sl-color-sky-950:hsl(202.3 73.8% 16.5%);--sl-color-blue-50:hsl(213.8 100% 96.9%);--sl-color-blue-100:hsl(214.3 94.6% 92.7%);--sl-color-blue-200:hsl(213.3 96.9% 87.3%);--sl-color-blue-300:hsl(211.7 96.4% 78.4%);--sl-color-blue-400:hsl(213.1 93.9% 67.8%);--sl-color-blue-500:hsl(217.2 91.2% 59.8%);--sl-color-blue-600:hsl(221.2 83.2% 53.3%);--sl-color-blue-700:hsl(224.3 76.3% 48%);--sl-color-blue-800:hsl(225.9 70.7% 40.2%);--sl-color-blue-900:hsl(224.4 64.3% 32.9%);--sl-color-blue-950:hsl(226.2 55.3% 18.4%);--sl-color-indigo-50:hsl(225.9 100% 96.7%);--sl-color-indigo-100:hsl(226.5 100% 93.9%);--sl-color-indigo-200:hsl(228 96.5% 88.8%);--sl-color-indigo-300:hsl(229.7 93.5% 81.8%);--sl-color-indigo-400:hsl(234.5 89.5% 73.9%);--sl-color-indigo-500:hsl(238.7 83.5% 66.7%);--sl-color-indigo-600:hsl(243.4 75.4% 58.6%);--sl-color-indigo-700:hsl(244.5 57.9% 50.6%);--sl-color-indigo-800:hsl(243.7 54.5% 41.4%);--sl-color-indigo-900:hsl(242.2 47.4% 34.3%);--sl-color-indigo-950:hsl(243.5 43.6% 22.9%);--sl-color-violet-50:hsl(250 100% 97.6%);--sl-color-violet-100:hsl(251.4 91.3% 95.5%);--sl-color-violet-200:hsl(250.5 95.2% 91.8%);--sl-color-violet-300:hsl(252.5 94.7% 85.1%);--sl-color-violet-400:hsl(255.1 91.7% 76.3%);--sl-color-violet-500:hsl(258.3 89.5% 66.3%);--sl-color-violet-600:hsl(262.1 83.3% 57.8%);--sl-color-violet-700:hsl(263.4 70% 50.4%);--sl-color-violet-800:hsl(263.4 69.3% 42.2%);--sl-color-violet-900:hsl(263.5 67.4% 34.9%);--sl-color-violet-950:hsl(265.1 61.5% 21.4%);--sl-color-purple-50:hsl(270 100% 98%);--sl-color-purple-100:hsl(268.7 100% 95.5%);--sl-color-purple-200:hsl(268.6 100% 91.8%);--sl-color-purple-300:hsl(269.2 97.4% 85.1%);--sl-color-purple-400:hsl(270 95.2% 75.3%);--sl-color-purple-500:hsl(270.7 91% 65.1%);--sl-color-purple-600:hsl(271.5 81.3% 55.9%);--sl-color-purple-700:hsl(272.1 71.7% 47.1%);--sl-color-purple-800:hsl(272.9 67.2% 39.4%);--sl-color-purple-900:hsl(273.6 65.6% 32%);--sl-color-purple-950:hsl(276 59.5% 16.5%);--sl-color-fuchsia-50:hsl(289.1 100% 97.8%);--sl-color-fuchsia-100:hsl(287 100% 95.5%);--sl-color-fuchsia-200:hsl(288.3 95.8% 90.6%);--sl-color-fuchsia-300:hsl(291.1 93.1% 82.9%);--sl-color-fuchsia-400:hsl(292 91.4% 72.5%);--sl-color-fuchsia-500:hsl(292.2 84.1% 60.6%);--sl-color-fuchsia-600:hsl(293.4 69.5% 48.8%);--sl-color-fuchsia-700:hsl(294.7 72.4% 39.8%);--sl-color-fuchsia-800:hsl(295.4 70.2% 32.9%);--sl-color-fuchsia-900:hsl(296.7 63.6% 28%);--sl-color-fuchsia-950:hsl(297.1 56.8% 14.5%);--sl-color-pink-50:hsl(327.3 73.3% 97.1%);--sl-color-pink-100:hsl(325.7 77.8% 94.7%);--sl-color-pink-200:hsl(325.9 84.6% 89.8%);--sl-color-pink-300:hsl(327.4 87.1% 81.8%);--sl-color-pink-400:hsl(328.6 85.5% 70.2%);--sl-color-pink-500:hsl(330.4 81.2% 60.4%);--sl-color-pink-600:hsl(333.3 71.4% 50.6%);--sl-color-pink-700:hsl(335.1 77.6% 42%);--sl-color-pink-800:hsl(335.8 74.4% 35.3%);--sl-color-pink-900:hsl(335.9 69% 30.4%);--sl-color-pink-950:hsl(336.2 65.4% 15.9%);--sl-color-rose-50:hsl(355.7 100% 97.3%);--sl-color-rose-100:hsl(355.6 100% 94.7%);--sl-color-rose-200:hsl(352.7 96.1% 90%);--sl-color-rose-300:hsl(352.6 95.7% 81.8%);--sl-color-rose-400:hsl(351.3 94.5% 71.4%);--sl-color-rose-500:hsl(349.7 89.2% 60.2%);--sl-color-rose-600:hsl(346.8 77.2% 49.8%);--sl-color-rose-700:hsl(345.3 82.7% 40.8%);--sl-color-rose-800:hsl(343.4 79.7% 34.7%);--sl-color-rose-900:hsl(341.5 75.5% 30.4%);--sl-color-rose-950:hsl(341.3 70.1% 17.1%);--sl-color-primary-50:var(--sl-color-sky-50);--sl-color-primary-100:var(--sl-color-sky-100);--sl-color-primary-200:var(--sl-color-sky-200);--sl-color-primary-300:var(--sl-color-sky-300);--sl-color-primary-400:var(--sl-color-sky-400);--sl-color-primary-500:var(--sl-color-sky-500);--sl-color-primary-600:var(--sl-color-sky-600);--sl-color-primary-700:var(--sl-color-sky-700);--sl-color-primary-800:var(--sl-color-sky-800);--sl-color-primary-900:var(--sl-color-sky-900);--sl-color-primary-950:var(--sl-color-sky-950);--sl-color-success-50:var(--sl-color-green-50);--sl-color-success-100:var(--sl-color-green-100);--sl-color-success-200:var(--sl-color-green-200);--sl-color-success-300:var(--sl-color-green-300);--sl-color-success-400:var(--sl-color-green-400);--sl-color-success-500:var(--sl-color-green-500);--sl-color-success-600:var(--sl-color-green-600);--sl-color-success-700:var(--sl-color-green-700);--sl-color-success-800:var(--sl-color-green-800);--sl-color-success-900:var(--sl-color-green-900);--sl-color-success-950:var(--sl-color-green-950);--sl-color-warning-50:var(--sl-color-amber-50);--sl-color-warning-100:var(--sl-color-amber-100);--sl-color-warning-200:var(--sl-color-amber-200);--sl-color-warning-300:var(--sl-color-amber-300);--sl-color-warning-400:var(--sl-color-amber-400);--sl-color-warning-500:var(--sl-color-amber-500);--sl-color-warning-600:var(--sl-color-amber-600);--sl-color-warning-700:var(--sl-color-amber-700);--sl-color-warning-800:var(--sl-color-amber-800);--sl-color-warning-900:var(--sl-color-amber-900);--sl-color-warning-950:var(--sl-color-amber-950);--sl-color-danger-50:var(--sl-color-red-50);--sl-color-danger-100:var(--sl-color-red-100);--sl-color-danger-200:var(--sl-color-red-200);--sl-color-danger-300:var(--sl-color-red-300);--sl-color-danger-400:var(--sl-color-red-400);--sl-color-danger-500:var(--sl-color-red-500);--sl-color-danger-600:var(--sl-color-red-600);--sl-color-danger-700:var(--sl-color-red-700);--sl-color-danger-800:var(--sl-color-red-800);--sl-color-danger-900:var(--sl-color-red-900);--sl-color-danger-950:var(--sl-color-red-950);--sl-color-neutral-50:var(--sl-color-gray-50);--sl-color-neutral-100:var(--sl-color-gray-100);--sl-color-neutral-200:var(--sl-color-gray-200);--sl-color-neutral-300:var(--sl-color-gray-300);--sl-color-neutral-400:var(--sl-color-gray-400);--sl-color-neutral-500:var(--sl-color-gray-500);--sl-color-neutral-600:var(--sl-color-gray-600);--sl-color-neutral-700:var(--sl-color-gray-700);--sl-color-neutral-800:var(--sl-color-gray-800);--sl-color-neutral-900:var(--sl-color-gray-900);--sl-color-neutral-950:var(--sl-color-gray-950);--sl-color-neutral-0:hsl(0, 0%, 100%);--sl-color-neutral-1000:hsl(0, 0%, 0%);--sl-border-radius-small:0.1875rem;--sl-border-radius-medium:0.25rem;--sl-border-radius-large:0.5rem;--sl-border-radius-x-large:1rem;--sl-border-radius-circle:50%;--sl-border-radius-pill:9999px;--sl-shadow-x-small:0 1px 2px hsl(240 3.8% 46.1% / 6%);--sl-shadow-small:0 1px 2px hsl(240 3.8% 46.1% / 12%);--sl-shadow-medium:0 2px 4px hsl(240 3.8% 46.1% / 12%);--sl-shadow-large:0 2px 8px hsl(240 3.8% 46.1% / 12%);--sl-shadow-x-large:0 4px 16px hsl(240 3.8% 46.1% / 12%);--sl-spacing-3x-small:0.125rem;--sl-spacing-2x-small:0.25rem;--sl-spacing-x-small:0.5rem;--sl-spacing-small:0.75rem;--sl-spacing-medium:1rem;--sl-spacing-large:1.25rem;--sl-spacing-x-large:1.75rem;--sl-spacing-2x-large:2.25rem;--sl-spacing-3x-large:3rem;--sl-spacing-4x-large:4.5rem;--sl-transition-x-slow:1000ms;--sl-transition-slow:500ms;--sl-transition-medium:250ms;--sl-transition-fast:150ms;--sl-transition-x-fast:50ms;--sl-font-mono:SFMono-Regular, Consolas, \"Liberation Mono\", Menlo, monospace;--sl-font-sans:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto,\n Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\",\n \"Segoe UI Symbol\";--sl-font-serif:Georgia, \"Times New Roman\", serif;--sl-font-size-2x-small:0.625rem;--sl-font-size-x-small:0.75rem;--sl-font-size-small:0.875rem;--sl-font-size-medium:1rem;--sl-font-size-large:1.25rem;--sl-font-size-x-large:1.5rem;--sl-font-size-2x-large:2.25rem;--sl-font-size-3x-large:3rem;--sl-font-size-4x-large:4.5rem;--sl-font-weight-light:300;--sl-font-weight-normal:400;--sl-font-weight-semibold:500;--sl-font-weight-bold:700;--sl-letter-spacing-denser:-0.03em;--sl-letter-spacing-dense:-0.015em;--sl-letter-spacing-normal:normal;--sl-letter-spacing-loose:0.075em;--sl-letter-spacing-looser:0.15em;--sl-line-height-denser:1;--sl-line-height-dense:1.4;--sl-line-height-normal:1.8;--sl-line-height-loose:2.2;--sl-line-height-looser:2.6;--sl-focus-ring-color:var(--sl-color-primary-600);--sl-focus-ring-style:solid;--sl-focus-ring-width:3px;--sl-focus-ring:var(--sl-focus-ring-style) var(--sl-focus-ring-width)\n var(--sl-focus-ring-color);--sl-focus-ring-offset:1px;--sl-button-font-size-small:var(--sl-font-size-x-small);--sl-button-font-size-medium:var(--sl-font-size-small);--sl-button-font-size-large:var(--sl-font-size-medium);--sl-input-height-small:1.875rem;--sl-input-height-medium:2.5rem;--sl-input-height-large:3.125rem;--sl-input-background-color:var(--sl-color-neutral-0);--sl-input-background-color-hover:var(--sl-input-background-color);--sl-input-background-color-focus:var(--sl-input-background-color);--sl-input-background-color-disabled:var(--sl-color-neutral-100);--sl-input-border-color:var(--sl-color-neutral-300);--sl-input-border-color-hover:var(--sl-color-neutral-400);--sl-input-border-color-focus:var(--sl-color-primary-500);--sl-input-border-color-disabled:var(--sl-color-neutral-300);--sl-input-border-width:1px;--sl-input-required-content:\"*\";--sl-input-required-content-offset:-2px;--sl-input-required-content-color:var(--sl-input-label-color);--sl-input-border-radius-small:var(--sl-border-radius-medium);--sl-input-border-radius-medium:var(--sl-border-radius-medium);--sl-input-border-radius-large:var(--sl-border-radius-medium);--sl-input-font-family:var(--sl-font-sans);--sl-input-font-weight:var(--sl-font-weight-normal);--sl-input-font-size-small:var(--sl-font-size-small);--sl-input-font-size-medium:var(--sl-font-size-medium);--sl-input-font-size-large:var(--sl-font-size-large);--sl-input-letter-spacing:var(--sl-letter-spacing-normal);--sl-input-color:var(--sl-color-neutral-700);--sl-input-color-hover:var(--sl-color-neutral-700);--sl-input-color-focus:var(--sl-color-neutral-700);--sl-input-color-disabled:var(--sl-color-neutral-900);--sl-input-icon-color:var(--sl-color-neutral-500);--sl-input-icon-color-hover:var(--sl-color-neutral-600);--sl-input-icon-color-focus:var(--sl-color-neutral-600);--sl-input-placeholder-color:var(--sl-color-neutral-500);--sl-input-placeholder-color-disabled:var(--sl-color-neutral-600);--sl-input-spacing-small:var(--sl-spacing-small);--sl-input-spacing-medium:var(--sl-spacing-medium);--sl-input-spacing-large:var(--sl-spacing-large);--sl-input-focus-ring-color:hsl(198.6 88.7% 48.4% / 40%);--sl-input-focus-ring-offset:0;--sl-input-filled-background-color:var(--sl-color-neutral-100);--sl-input-filled-background-color-hover:var(--sl-color-neutral-100);--sl-input-filled-background-color-focus:var(--sl-color-neutral-100);--sl-input-filled-background-color-disabled:var(--sl-color-neutral-100);--sl-input-filled-color:var(--sl-color-neutral-800);--sl-input-filled-color-hover:var(--sl-color-neutral-800);--sl-input-filled-color-focus:var(--sl-color-neutral-700);--sl-input-filled-color-disabled:var(--sl-color-neutral-800);--sl-input-label-font-size-small:var(--sl-font-size-small);--sl-input-label-font-size-medium:var(--sl-font-size-medium);--sl-input-label-font-size-large:var(--sl-font-size-large);--sl-input-label-color:inherit;--sl-input-help-text-font-size-small:var(--sl-font-size-x-small);--sl-input-help-text-font-size-medium:var(--sl-font-size-small);--sl-input-help-text-font-size-large:var(--sl-font-size-medium);--sl-input-help-text-color:var(--sl-color-neutral-500);--sl-toggle-size-small:0.875rem;--sl-toggle-size-medium:1.125rem;--sl-toggle-size-large:1.375rem;--sl-overlay-background-color:hsl(240 3.8% 46.1% / 33%);--sl-panel-background-color:var(--sl-color-neutral-0);--sl-panel-border-color:var(--sl-color-neutral-200);--sl-panel-border-width:1px;--sl-tooltip-border-radius:var(--sl-border-radius-medium);--sl-tooltip-background-color:var(--sl-color-neutral-800);--sl-tooltip-color:var(--sl-color-neutral-0);--sl-tooltip-font-family:var(--sl-font-sans);--sl-tooltip-font-weight:var(--sl-font-weight-normal);--sl-tooltip-font-size:var(--sl-font-size-small);--sl-tooltip-line-height:var(--sl-line-height-dense);--sl-tooltip-padding:var(--sl-spacing-2x-small) var(--sl-spacing-x-small);--sl-tooltip-arrow-size:6px;--sl-z-index-drawer:700;--sl-z-index-dialog:800;--sl-z-index-dropdown:900;--sl-z-index-toast:950;--sl-z-index-tooltip:1000}@supports (scrollbar-gutter: stable){.sl-scroll-lock{scrollbar-gutter:stable !important;overflow:hidden !important}}@supports not (scrollbar-gutter: stable){.sl-scroll-lock body{padding-right:var(--sl-scroll-lock-size) !important;overflow:hidden !important}}.sl-toast-stack{position:fixed;top:0;inset-inline-end:0;z-index:var(--sl-z-index-toast);width:28rem;max-width:100%;max-height:100%;overflow:auto}.sl-toast-stack sl-alert{margin:var(--sl-spacing-medium)}.sl-toast-stack sl-alert::part(base){box-shadow:var(--sl-shadow-large)}:host{--jump-select-border-radius:4px;--jump-select-border-color:var(--neutral-grey-disabled, #cbcbcb);--jump-select-border-color-hover:var(--secondary-standard, #5e79ba);--jump-select-border-color-focus:var(--secondary-standard, #5e79ba);--jump-select-background:var(--neutral-white, #ffffff);--jump-select-color:var(--neutral-black, #000000);--jump-select-font-family:var(--ff-primary, \"Inter\", sans-serif);--jump-select-font-size:16px;--jump-select-font-weight:normal;--jump-select-height:40px;--jump-select-padding:0 10px;--jump-select-disabled-opacity:0.5;--jump-select-placeholder-color:var(--neutral-grey-disabled, #cbcbcb);--jump-select-label-margin:0 0 8px 0;--jump-select-label-color:var(--neutral-black, #000000);--jump-select-label-font-size:14px;--jump-select-label-font-weight:500;--jump-select-option-selected-background:var(--secondary-standard, #5e79ba);--jump-select-option-selected-color:var(--neutral-white, #ffffff);--jump-select-dropdown-box-shadow:0 2px 5px rgba(0, 0, 0, 0.1);display:flex;flex-direction:column;width:100%;}:host .select-label{font-family:var(--jump-select-font-family);font-size:var(--jump-select-label-font-size);font-weight:var(--jump-select-label-font-weight);color:var(--jump-select-label-color);margin:var(--jump-select-label-margin)}:host sl-select::part(form-control){display:block;width:100%}:host sl-select::part(base){width:100%;font-family:var(--jump-select-font-family);font-size:var(--jump-select-font-size);font-weight:var(--jump-select-font-weight)}:host sl-select::part(control){height:var(--jump-select-height);border-radius:var(--jump-select-border-radius);border-color:var(--jump-select-border-color);background-color:var(--jump-select-background);color:var(--jump-select-color);padding:var(--jump-select-padding)}:host sl-select::part(control):hover{border-color:var(--jump-select-border-color-hover)}:host sl-select::part(control):focus-within{border-color:var(--jump-select-border-color-focus);box-shadow:0 0 0 2px rgba(94, 121, 186, 0.25)}:host sl-select::part(display-input){height:var(--jump-select-height);line-height:var(--jump-select-height);color:var(--jump-select-color)}:host sl-select::part(placeholder){color:var(--jump-select-placeholder-color)}:host sl-select::part(dropdown){box-shadow:var(--jump-select-dropdown-box-shadow);border-radius:var(--jump-select-border-radius);z-index:100}:host sl-select::part(listbox){font-family:var(--jump-select-font-family);font-size:var(--jump-select-font-size)}:host sl-select::part(tags){margin-top:0}:host sl-select::part(tag){background-color:var(--secondary-standard, #5e79ba);color:var(--neutral-white, #ffffff)}:host sl-select[disabled]::part(control){opacity:var(--jump-select-disabled-opacity);cursor:not-allowed}:host sl-option::part(checked-icon){color:var(--jump-select-option-selected-color)}:host sl-option[selected]::part(base){background-color:var(--jump-select-option-selected-background);color:var(--jump-select-option-selected-color)}";
4112
+ const JumpFilterSelectStyle0 = jumpFilterSelectCss;
4113
+
4114
+ const JumpFilterSelect$1 = /*@__PURE__*/ proxyCustomElement(class JumpFilterSelect extends HTMLElement$1 {
4115
+ constructor() {
4116
+ super();
4117
+ this.__registerHost();
4118
+ this.__attachShadow();
4119
+ this.selectionChange = createEvent(this, "jump-select-change", 7);
4120
+ this.value = undefined;
4121
+ this.placeholder = 'Seleziona un\'opzione';
4122
+ this.label = undefined;
4123
+ this.options = [];
4124
+ this.disabled = false;
4125
+ this.multiple = false;
4126
+ this.required = false;
4127
+ this.loading = false;
4128
+ this.open = false;
4129
+ this.hasSlottedOptions = false;
4130
+ }
4131
+ /**
4132
+ * Controlla se ci sono opzioni definite come slot
4133
+ */
4134
+ componentWillRender() {
4135
+ // Verifica se ci sono elementi sl-option definiti come figli
4136
+ const slotNodes = this.hostElement.childNodes;
4137
+ this.hasSlottedOptions = Array.from(slotNodes).some(node => node.nodeName && node.nodeName.toLowerCase() === 'sl-option');
4138
+ }
4139
+ /**
4140
+ * Converte le opzioni da string o array a array di oggetti
4141
+ */
4142
+ getOptionsArray() {
4143
+ if (typeof this.options === 'string') {
4144
+ try {
4145
+ return JSON.parse(this.options);
4146
+ }
4147
+ catch (e) {
4148
+ console.error('Errore nel parsing delle opzioni:', e);
4149
+ return [];
4150
+ }
4151
+ }
4152
+ return this.options;
4153
+ }
4154
+ componentDidLoad() {
4155
+ this.listenSLChange();
4156
+ }
4157
+ /**
4158
+ * Ascolta gli eventi di cambio selezione dal select Shoelace
4159
+ */
4160
+ listenSLChange() {
4161
+ if (this.host) {
4162
+ this.host.addEventListener('sl-change', (event) => {
4163
+ if (this.disabled) {
4164
+ return;
4165
+ }
4166
+ this.value = event.target.value;
4167
+ const optionsArray = this.getOptionsArray();
4168
+ const selectedOption = optionsArray.find(option => option.value === this.value);
4169
+ const eventData = {
4170
+ value: this.value,
4171
+ selectedOption
4172
+ };
4173
+ this.selectionChange.emit(eventData);
4174
+ });
4175
+ }
4176
+ }
4177
+ /**
4178
+ * Metodo pubblico per ottenere il valore selezionato
4179
+ * @returns Il valore attualmente selezionato
4180
+ */
4181
+ async getSelectedValue() {
4182
+ return this.value;
4183
+ }
4184
+ /**
4185
+ * Metodo pubblico per ottenere l'opzione selezionata
4186
+ * @returns L'opzione attualmente selezionata come oggetto {value, label}
4187
+ */
4188
+ async getSelectedOption() {
4189
+ const optionsArray = this.getOptionsArray();
4190
+ return optionsArray.find(option => option.value === this.value);
4191
+ }
4192
+ /**
4193
+ * Metodo pubblico per impostare programmaticamente il valore selezionato
4194
+ * @param newValue - Il nuovo valore da selezionare
4195
+ * @param emitEvent - Se emettere l'evento di cambio (default: true)
4196
+ * @returns Il nuovo valore impostato
4197
+ */
4198
+ async setValue(newValue, emitEvent = true) {
4199
+ this.value = newValue;
4200
+ // Aggiorna anche il valore dell'elemento sl-select interno
4201
+ if (this.el) {
4202
+ this.el.value = newValue;
4203
+ }
4204
+ // Emetti l'evento di cambio se richiesto
4205
+ if (emitEvent) {
4206
+ const optionsArray = this.getOptionsArray();
4207
+ const selectedOption = optionsArray.find(option => option.value === this.value);
4208
+ const eventData = {
4209
+ value: this.value,
4210
+ selectedOption,
4211
+ programmatic: true // Flag per indicare che il cambio è avvenuto programmaticamente
4212
+ };
4213
+ this.selectionChange.emit(eventData);
4214
+ }
4215
+ return this.value;
4216
+ }
4217
+ render() {
4218
+ const optionsArray = this.getOptionsArray();
4219
+ return (h(Host, { key: '3aeb8a1b3c8757bfecd0b5642ddfa87e61f92849', ref: (host) => (this.host = host) }, this.label && (h("div", { key: '504faaf84a96fd84add35cdaaa34e617391d4c82', class: "select-label" }, this.label)), h("sl-select", { key: '9a707596aa5a2c87c0276ecca51588c02d22edb0', value: this.value, placeholder: this.placeholder, disabled: this.disabled, multiple: this.multiple, required: this.required, loading: this.loading, ref: (el) => (this.el = el) }, !this.hasSlottedOptions && optionsArray.map(option => (h("sl-option", { value: option.value }, option.label))), h("slot", { key: 'b4592e359a2aaea92a87ab7240ddb6d2557697c3' }))));
4220
+ }
4221
+ get hostElement() { return this; }
4222
+ static get style() { return JumpFilterSelectStyle0; }
4223
+ }, [1, "jump-filter-select", {
4224
+ "value": [1537],
4225
+ "placeholder": [1],
4226
+ "label": [1],
4227
+ "options": [1],
4228
+ "disabled": [516],
4229
+ "multiple": [4],
4230
+ "required": [4],
4231
+ "loading": [4],
4232
+ "open": [32],
4233
+ "hasSlottedOptions": [32],
4234
+ "getSelectedValue": [64],
4235
+ "getSelectedOption": [64],
4236
+ "setValue": [64]
4237
+ }]);
4238
+ function defineCustomElement$1() {
4239
+ if (typeof customElements === "undefined") {
4240
+ return;
4241
+ }
4242
+ const components = ["jump-filter-select"];
4243
+ components.forEach(tagName => { switch (tagName) {
4244
+ case "jump-filter-select":
4245
+ if (!customElements.get(tagName)) {
4246
+ customElements.define(tagName, JumpFilterSelect$1);
4247
+ }
4248
+ break;
4249
+ } });
4250
+ }
4251
+
4252
+ const JumpFilterSelect = JumpFilterSelect$1;
4253
+ const defineCustomElement = defineCustomElement$1;
4254
+
4255
+ export { JumpFilterSelect, defineCustomElement };
4256
+
4257
+ //# sourceMappingURL=jump-filter-select.js.map