@redvars/peacock 3.5.0 → 3.6.0

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 (314) hide show
  1. package/dist/BaseButton-BNFAYn-S.js +219 -0
  2. package/dist/BaseButton-BNFAYn-S.js.map +1 -0
  3. package/dist/BaseHyperlinkMixin-BNuwbiEf.js +65 -0
  4. package/dist/BaseHyperlinkMixin-BNuwbiEf.js.map +1 -0
  5. package/dist/BaseInput-14YmcfK7.js +27 -0
  6. package/dist/BaseInput-14YmcfK7.js.map +1 -0
  7. package/dist/assets/components.css +1 -1
  8. package/dist/assets/components.css.map +1 -1
  9. package/dist/assets/styles.css +1 -1
  10. package/dist/assets/styles.css.map +1 -1
  11. package/dist/banner.js +14 -30
  12. package/dist/banner.js.map +1 -1
  13. package/dist/{button-DMN1dPAg.js → button-colors-Ccys3hvS.js} +5 -468
  14. package/dist/button-colors-Ccys3hvS.js.map +1 -0
  15. package/dist/button-group.js +228 -8
  16. package/dist/button-group.js.map +1 -1
  17. package/dist/button.js +294 -8
  18. package/dist/button.js.map +1 -1
  19. package/dist/calendar-column-view.js +634 -0
  20. package/dist/calendar-column-view.js.map +1 -0
  21. package/dist/calendar-event-BrQ_SEKD.js +199 -0
  22. package/dist/calendar-event-BrQ_SEKD.js.map +1 -0
  23. package/dist/calendar-month-view.js +376 -0
  24. package/dist/calendar-month-view.js.map +1 -0
  25. package/dist/calendar.js +339 -0
  26. package/dist/calendar.js.map +1 -0
  27. package/dist/canvas.js +361 -0
  28. package/dist/canvas.js.map +1 -0
  29. package/dist/card.js +18 -73
  30. package/dist/card.js.map +1 -1
  31. package/dist/cb-compound-expression.js +125 -0
  32. package/dist/cb-compound-expression.js.map +1 -0
  33. package/dist/cb-divider.js +150 -0
  34. package/dist/cb-divider.js.map +1 -0
  35. package/dist/cb-expression.js +75 -0
  36. package/dist/cb-expression.js.map +1 -0
  37. package/dist/cb-predicate.js +137 -0
  38. package/dist/cb-predicate.js.map +1 -0
  39. package/dist/chart-bar.js.map +1 -1
  40. package/dist/chart-doughnut.js +2 -2
  41. package/dist/chart-doughnut.js.map +1 -1
  42. package/dist/chart-pie.js +2 -2
  43. package/dist/chart-pie.js.map +1 -1
  44. package/dist/chart-stacked-bar.js.map +1 -1
  45. package/dist/code-editor.js +2 -1
  46. package/dist/code-editor.js.map +1 -1
  47. package/dist/code-highlighter.js +2 -1
  48. package/dist/code-highlighter.js.map +1 -1
  49. package/dist/condition-builder.js +58 -0
  50. package/dist/condition-builder.js.map +1 -0
  51. package/dist/custom-elements-jsdocs.json +10860 -5567
  52. package/dist/custom-elements.json +16180 -7996
  53. package/dist/dropdown-button.js +216 -0
  54. package/dist/dropdown-button.js.map +1 -0
  55. package/dist/event-manager-D-QCmUgR.js +113 -0
  56. package/dist/event-manager-D-QCmUgR.js.map +1 -0
  57. package/dist/fab.js +421 -9
  58. package/dist/fab.js.map +1 -1
  59. package/dist/flow-designer-dZnLJOQT.js +1656 -0
  60. package/dist/flow-designer-dZnLJOQT.js.map +1 -0
  61. package/dist/flow-designer-node-XMe-jlKg.js +548 -0
  62. package/dist/flow-designer-node-XMe-jlKg.js.map +1 -0
  63. package/dist/flow-designer-node.js +4 -0
  64. package/dist/flow-designer-node.js.map +1 -0
  65. package/dist/flow-designer.js +16 -0
  66. package/dist/flow-designer.js.map +1 -0
  67. package/dist/html-editor.js +358 -0
  68. package/dist/html-editor.js.map +1 -0
  69. package/dist/icon-button-CK1ZuE-2.js +247 -0
  70. package/dist/icon-button-CK1ZuE-2.js.map +1 -0
  71. package/dist/index.js +31 -8
  72. package/dist/index.js.map +1 -1
  73. package/dist/{is-dark-mode-DicqGkCJ.js → is-dark-mode-DOcaw4Yq.js} +2 -27
  74. package/dist/is-dark-mode-DOcaw4Yq.js.map +1 -0
  75. package/dist/modal.js +418 -0
  76. package/dist/modal.js.map +1 -0
  77. package/dist/{select-4pl4XBj7.js → navigation-rail-DyO0oAZU.js} +2000 -2767
  78. package/dist/navigation-rail-DyO0oAZU.js.map +1 -0
  79. package/dist/notification-manager.js +268 -0
  80. package/dist/notification-manager.js.map +1 -0
  81. package/dist/notification.js +3 -2
  82. package/dist/notification.js.map +1 -1
  83. package/dist/peacock-loader.js +102 -14
  84. package/dist/peacock-loader.js.map +1 -1
  85. package/dist/popover-NC7b1lTq.js +1971 -0
  86. package/dist/popover-NC7b1lTq.js.map +1 -0
  87. package/dist/popover-content.js +125 -0
  88. package/dist/popover-content.js.map +1 -0
  89. package/dist/popover.js +4 -0
  90. package/dist/popover.js.map +1 -0
  91. package/dist/search.js +4 -0
  92. package/dist/search.js.map +1 -1
  93. package/dist/split-button.js +388 -0
  94. package/dist/split-button.js.map +1 -0
  95. package/dist/src/__controllers/floating-controller.d.ts +35 -0
  96. package/dist/src/__mixins/BaseButtonMixin.d.ts +20 -0
  97. package/dist/src/__mixins/BaseHyperlinkMixin.d.ts +18 -0
  98. package/dist/src/__mixins/MixinConstructor.d.ts +1 -0
  99. package/dist/src/banner/banner.d.ts +0 -4
  100. package/dist/src/button/BaseButton.d.ts +4 -47
  101. package/dist/src/button/button/button.d.ts +32 -3
  102. package/dist/src/button/button-group/button-group.d.ts +2 -2
  103. package/dist/src/button/icon-button/icon-button.d.ts +33 -8
  104. package/dist/src/calendar/base-event.d.ts +10 -0
  105. package/dist/src/calendar/calendar-column-view.d.ts +41 -0
  106. package/dist/src/calendar/calendar-event.d.ts +7 -0
  107. package/dist/src/calendar/calendar-month-view.d.ts +31 -0
  108. package/dist/src/calendar/calendar.d.ts +65 -0
  109. package/dist/src/calendar/event-manager.d.ts +17 -0
  110. package/dist/src/calendar/index.d.ts +4 -0
  111. package/dist/src/calendar/types.d.ts +13 -0
  112. package/dist/src/calendar/utils.d.ts +31 -0
  113. package/dist/src/canvas/canvas.d.ts +92 -0
  114. package/dist/src/canvas/index.d.ts +2 -0
  115. package/dist/src/card/card.d.ts +4 -15
  116. package/dist/src/condition-builder/cb-compound-expression.d.ts +31 -0
  117. package/dist/src/condition-builder/cb-divider.d.ts +26 -0
  118. package/dist/src/condition-builder/cb-expression.d.ts +31 -0
  119. package/dist/src/condition-builder/cb-predicate.d.ts +30 -0
  120. package/dist/src/condition-builder/condition-builder.d.ts +27 -0
  121. package/dist/src/condition-builder/index.d.ts +5 -0
  122. package/dist/src/dropdown-button/dropdown-button.d.ts +68 -0
  123. package/dist/src/dropdown-button/index.d.ts +1 -0
  124. package/dist/src/fab/fab.d.ts +4 -35
  125. package/dist/src/flow-designer/commands.d.ts +66 -0
  126. package/dist/src/flow-designer/flow-designer-node.d.ts +46 -0
  127. package/dist/src/flow-designer/flow-designer.d.ts +133 -0
  128. package/dist/src/flow-designer/index.d.ts +7 -0
  129. package/dist/src/flow-designer/layout.d.ts +30 -0
  130. package/dist/src/flow-designer/types.d.ts +142 -0
  131. package/dist/src/flow-designer/validation.d.ts +43 -0
  132. package/dist/src/flow-designer/workflow-utils.d.ts +40 -0
  133. package/dist/src/focus-ring/focus-ring.d.ts +11 -5
  134. package/dist/src/html-editor/html-editor.d.ts +56 -0
  135. package/dist/src/html-editor/index.d.ts +2 -0
  136. package/dist/src/index.d.ts +16 -1
  137. package/dist/src/link/link.d.ts +1 -1
  138. package/dist/src/menu/menu/menu.d.ts +5 -7
  139. package/dist/src/menu/menu-item/menu-item.d.ts +14 -13
  140. package/dist/src/modal/index.d.ts +1 -0
  141. package/dist/src/modal/modal.d.ts +63 -0
  142. package/dist/src/navigation-rail/index.d.ts +2 -0
  143. package/dist/src/navigation-rail/navigation-rail-item.d.ts +55 -0
  144. package/dist/src/navigation-rail/navigation-rail.d.ts +71 -0
  145. package/dist/src/notification-manager/index.d.ts +1 -0
  146. package/dist/src/notification-manager/notification-manager.d.ts +44 -0
  147. package/dist/src/popover/index.d.ts +2 -0
  148. package/dist/src/popover/popover-content.d.ts +29 -0
  149. package/dist/src/popover/popover.d.ts +62 -0
  150. package/dist/src/sidebar-menu/index.d.ts +3 -0
  151. package/dist/src/sidebar-menu/sidebar-menu-item.d.ts +58 -0
  152. package/dist/src/sidebar-menu/sidebar-menu.d.ts +38 -0
  153. package/dist/src/sidebar-menu/sidebar-sub-menu.d.ts +35 -0
  154. package/dist/src/split-button/index.d.ts +1 -0
  155. package/dist/src/split-button/split-button.d.ts +72 -0
  156. package/dist/src/toolbar/toolbar.d.ts +10 -10
  157. package/dist/src/tooltip/tooltip.d.ts +5 -15
  158. package/dist/src/url-field/index.d.ts +1 -0
  159. package/dist/src/url-field/url-field.d.ts +48 -0
  160. package/dist/test/flow-designer.test.d.ts +1 -0
  161. package/dist/test/sidebar-menu.test.d.ts +1 -0
  162. package/dist/toolbar.js +10 -10
  163. package/dist/toolbar.js.map +1 -1
  164. package/dist/tsconfig.tsbuildinfo +1 -1
  165. package/package.json +4 -2
  166. package/readme.md +73 -65
  167. package/scss/mixin.scss +16 -0
  168. package/src/__controllers/floating-controller.ts +237 -0
  169. package/src/__mixins/BaseButtonMixin.ts +83 -0
  170. package/src/__mixins/BaseHyperlinkMixin.ts +68 -0
  171. package/src/__mixins/MixinConstructor.ts +1 -0
  172. package/src/{__base_element → __mixins}/README.md +2 -2
  173. package/src/banner/banner.scss +20 -25
  174. package/src/banner/banner.ts +1 -7
  175. package/src/button/BaseButton.ts +11 -100
  176. package/src/button/button/button-sizes.scss +4 -2
  177. package/src/button/button/button.ts +77 -23
  178. package/src/button/button-group/button-group.ts +2 -2
  179. package/src/button/icon-button/icon-button.ts +75 -33
  180. package/src/calendar/base-event.ts +49 -0
  181. package/src/calendar/calendar-column-view.scss +326 -0
  182. package/src/calendar/calendar-column-view.ts +392 -0
  183. package/src/calendar/calendar-event.ts +20 -0
  184. package/src/calendar/calendar-month-view.scss +192 -0
  185. package/src/calendar/calendar-month-view.ts +244 -0
  186. package/src/calendar/calendar.scss +71 -0
  187. package/src/calendar/calendar.ts +298 -0
  188. package/src/calendar/event-manager.ts +117 -0
  189. package/src/calendar/index.ts +4 -0
  190. package/src/calendar/types.ts +14 -0
  191. package/src/calendar/utils.ts +180 -0
  192. package/src/canvas/canvas.scss +60 -0
  193. package/src/canvas/canvas.ts +391 -0
  194. package/src/canvas/index.ts +2 -0
  195. package/src/card/card.ts +11 -71
  196. package/src/chart-bar/chart-bar.ts +9 -14
  197. package/src/chart-bar/chart-stacked-bar.ts +12 -18
  198. package/src/chart-doughnut/chart-doughnut.ts +23 -27
  199. package/src/chart-pie/chart-pie.ts +19 -23
  200. package/src/checkbox/checkbox.scss +17 -34
  201. package/src/checkbox/checkbox.ts +3 -1
  202. package/src/code-highlighter/code-highlighter.scss +1 -0
  203. package/src/code-highlighter/code-highlighter.ts +1 -1
  204. package/src/condition-builder/cb-compound-expression.scss +37 -0
  205. package/src/condition-builder/cb-compound-expression.ts +80 -0
  206. package/src/condition-builder/cb-divider.scss +93 -0
  207. package/src/condition-builder/cb-divider.ts +56 -0
  208. package/src/condition-builder/cb-expression.scss +14 -0
  209. package/src/condition-builder/cb-expression.ts +49 -0
  210. package/src/condition-builder/cb-predicate.scss +35 -0
  211. package/src/condition-builder/cb-predicate.ts +102 -0
  212. package/src/condition-builder/condition-builder.scss +13 -0
  213. package/src/condition-builder/condition-builder.ts +38 -0
  214. package/src/condition-builder/index.ts +5 -0
  215. package/src/date-picker/date-picker.ts +1 -1
  216. package/src/dropdown-button/demo/index.html +110 -0
  217. package/src/dropdown-button/dropdown-button.scss +22 -0
  218. package/src/dropdown-button/dropdown-button.ts +206 -0
  219. package/src/dropdown-button/index.ts +1 -0
  220. package/src/elevation/elevation.scss +5 -5
  221. package/src/fab/fab.ts +29 -100
  222. package/src/flow-designer/DEMO.md +239 -0
  223. package/src/flow-designer/commands.ts +278 -0
  224. package/src/flow-designer/flow-designer-node.ts +172 -0
  225. package/src/flow-designer/flow-designer.scss +457 -0
  226. package/src/flow-designer/flow-designer.ts +611 -0
  227. package/src/flow-designer/index.ts +41 -0
  228. package/src/flow-designer/layout.ts +357 -0
  229. package/src/flow-designer/types.ts +166 -0
  230. package/src/flow-designer/validation.ts +284 -0
  231. package/src/flow-designer/workflow-utils.ts +282 -0
  232. package/src/focus-ring/focus-ring.ts +47 -40
  233. package/src/html-editor/html-editor.scss +146 -0
  234. package/src/html-editor/html-editor.ts +276 -0
  235. package/src/html-editor/index.ts +3 -0
  236. package/src/index.ts +28 -1
  237. package/src/input/input.ts +3 -1
  238. package/src/link/link.ts +2 -2
  239. package/src/menu/menu/menu.scss +2 -2
  240. package/src/menu/menu/menu.ts +91 -101
  241. package/src/menu/menu-item/menu-item.scss +4 -0
  242. package/src/menu/menu-item/menu-item.ts +85 -79
  243. package/src/modal/index.ts +1 -0
  244. package/src/modal/modal.scss +206 -0
  245. package/src/modal/modal.ts +201 -0
  246. package/src/navigation-rail/index.ts +2 -0
  247. package/src/navigation-rail/navigation-rail-item.scss +216 -0
  248. package/src/navigation-rail/navigation-rail-item.ts +223 -0
  249. package/src/navigation-rail/navigation-rail.scss +72 -0
  250. package/src/navigation-rail/navigation-rail.ts +149 -0
  251. package/src/notification/notification.ts +3 -2
  252. package/src/notification-manager/index.ts +1 -0
  253. package/src/notification-manager/notification-manager.scss +113 -0
  254. package/src/notification-manager/notification-manager.ts +199 -0
  255. package/src/number-field/number-field.ts +6 -4
  256. package/src/pagination/pagination.ts +6 -4
  257. package/src/peacock-loader.ts +93 -5
  258. package/src/popover/index.ts +2 -0
  259. package/src/popover/popover-content.scss +69 -0
  260. package/src/popover/popover-content.ts +51 -0
  261. package/src/popover/popover.scss +7 -0
  262. package/src/popover/popover.ts +170 -0
  263. package/src/search/search.ts +4 -0
  264. package/src/sidebar-menu/demo/index.html +68 -0
  265. package/src/sidebar-menu/index.ts +3 -0
  266. package/src/sidebar-menu/sidebar-menu-item.scss +102 -0
  267. package/src/sidebar-menu/sidebar-menu-item.ts +151 -0
  268. package/src/{tree-view/tree-view.scss → sidebar-menu/sidebar-menu.scss} +1 -1
  269. package/src/sidebar-menu/sidebar-menu.ts +182 -0
  270. package/src/sidebar-menu/sidebar-sub-menu.scss +130 -0
  271. package/src/sidebar-menu/sidebar-sub-menu.ts +160 -0
  272. package/src/skeleton/skeleton.scss +18 -24
  273. package/src/snackbar/snackbar.ts +1 -1
  274. package/src/split-button/index.ts +1 -0
  275. package/src/split-button/split-button-colors.scss +56 -0
  276. package/src/split-button/split-button-sizes.scss +28 -0
  277. package/src/split-button/split-button.scss +79 -0
  278. package/src/split-button/split-button.ts +236 -0
  279. package/src/table/table.ts +2 -2
  280. package/src/tabs/tab.ts +4 -3
  281. package/src/text/text.css-component.scss +7 -1
  282. package/src/time-picker/time-picker.ts +1 -1
  283. package/src/toolbar/toolbar.ts +10 -10
  284. package/src/tooltip/tooltip.scss +4 -3
  285. package/src/tooltip/tooltip.ts +64 -98
  286. package/src/url-field/index.ts +1 -0
  287. package/src/url-field/url-field.scss +50 -0
  288. package/src/url-field/url-field.ts +239 -0
  289. package/dist/button-DMN1dPAg.js.map +0 -1
  290. package/dist/button-group-CX9CUUXk.js +0 -435
  291. package/dist/button-group-CX9CUUXk.js.map +0 -1
  292. package/dist/fab-C5Nzxk0E.js +0 -497
  293. package/dist/fab-C5Nzxk0E.js.map +0 -1
  294. package/dist/is-dark-mode-DicqGkCJ.js.map +0 -1
  295. package/dist/select-4pl4XBj7.js.map +0 -1
  296. package/dist/spread-B5cgadZl.js +0 -32
  297. package/dist/spread-B5cgadZl.js.map +0 -1
  298. package/dist/src/__base_element/BaseHyperlink.d.ts +0 -20
  299. package/dist/src/menu/menu/MenuSurfaceController.d.ts +0 -18
  300. package/dist/src/tree-view/index.d.ts +0 -2
  301. package/dist/src/tree-view/tree-node.d.ts +0 -69
  302. package/dist/src/tree-view/tree-view.d.ts +0 -40
  303. package/dist/src/tree-view/wc-tree-view.d.ts +0 -6
  304. package/dist/test/tree-view.test.d.ts +0 -1
  305. package/dist/throttle-C7ZAPqtu.js +0 -24
  306. package/dist/throttle-C7ZAPqtu.js.map +0 -1
  307. package/src/__base_element/BaseHyperlink.ts +0 -42
  308. package/src/menu/menu/MenuSurfaceController.ts +0 -61
  309. package/src/tree-view/demo/index.html +0 -57
  310. package/src/tree-view/index.ts +0 -2
  311. package/src/tree-view/tree-node.scss +0 -101
  312. package/src/tree-view/tree-node.ts +0 -268
  313. package/src/tree-view/tree-view.ts +0 -182
  314. package/src/tree-view/wc-tree-view.ts +0 -9
@@ -0,0 +1,1971 @@
1
+ import { a as i, _ as __decorate, I as IndividualComponent, i as i$1, b } from './IndividualComponent-DUINtMGK.js';
2
+ import { n } from './property-1psGvXOq.js';
3
+
4
+ /**
5
+ * Custom positioning reference element.
6
+ * @see https://floating-ui.com/docs/virtual-elements
7
+ */
8
+
9
+ const min = Math.min;
10
+ const max = Math.max;
11
+ const round = Math.round;
12
+ const floor = Math.floor;
13
+ const createCoords = v => ({
14
+ x: v,
15
+ y: v
16
+ });
17
+ const oppositeSideMap = {
18
+ left: 'right',
19
+ right: 'left',
20
+ bottom: 'top',
21
+ top: 'bottom'
22
+ };
23
+ function clamp(start, value, end) {
24
+ return max(start, min(value, end));
25
+ }
26
+ function evaluate(value, param) {
27
+ return typeof value === 'function' ? value(param) : value;
28
+ }
29
+ function getSide(placement) {
30
+ return placement.split('-')[0];
31
+ }
32
+ function getAlignment(placement) {
33
+ return placement.split('-')[1];
34
+ }
35
+ function getOppositeAxis(axis) {
36
+ return axis === 'x' ? 'y' : 'x';
37
+ }
38
+ function getAxisLength(axis) {
39
+ return axis === 'y' ? 'height' : 'width';
40
+ }
41
+ function getSideAxis(placement) {
42
+ const firstChar = placement[0];
43
+ return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
44
+ }
45
+ function getAlignmentAxis(placement) {
46
+ return getOppositeAxis(getSideAxis(placement));
47
+ }
48
+ function getAlignmentSides(placement, rects, rtl) {
49
+ if (rtl === void 0) {
50
+ rtl = false;
51
+ }
52
+ const alignment = getAlignment(placement);
53
+ const alignmentAxis = getAlignmentAxis(placement);
54
+ const length = getAxisLength(alignmentAxis);
55
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
56
+ if (rects.reference[length] > rects.floating[length]) {
57
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
58
+ }
59
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
60
+ }
61
+ function getExpandedPlacements(placement) {
62
+ const oppositePlacement = getOppositePlacement(placement);
63
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
64
+ }
65
+ function getOppositeAlignmentPlacement(placement) {
66
+ return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
67
+ }
68
+ const lrPlacement = ['left', 'right'];
69
+ const rlPlacement = ['right', 'left'];
70
+ const tbPlacement = ['top', 'bottom'];
71
+ const btPlacement = ['bottom', 'top'];
72
+ function getSideList(side, isStart, rtl) {
73
+ switch (side) {
74
+ case 'top':
75
+ case 'bottom':
76
+ if (rtl) return isStart ? rlPlacement : lrPlacement;
77
+ return isStart ? lrPlacement : rlPlacement;
78
+ case 'left':
79
+ case 'right':
80
+ return isStart ? tbPlacement : btPlacement;
81
+ default:
82
+ return [];
83
+ }
84
+ }
85
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
86
+ const alignment = getAlignment(placement);
87
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
88
+ if (alignment) {
89
+ list = list.map(side => side + "-" + alignment);
90
+ if (flipAlignment) {
91
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
92
+ }
93
+ }
94
+ return list;
95
+ }
96
+ function getOppositePlacement(placement) {
97
+ const side = getSide(placement);
98
+ return oppositeSideMap[side] + placement.slice(side.length);
99
+ }
100
+ function expandPaddingObject(padding) {
101
+ return {
102
+ top: 0,
103
+ right: 0,
104
+ bottom: 0,
105
+ left: 0,
106
+ ...padding
107
+ };
108
+ }
109
+ function getPaddingObject(padding) {
110
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
111
+ top: padding,
112
+ right: padding,
113
+ bottom: padding,
114
+ left: padding
115
+ };
116
+ }
117
+ function rectToClientRect(rect) {
118
+ const {
119
+ x,
120
+ y,
121
+ width,
122
+ height
123
+ } = rect;
124
+ return {
125
+ width,
126
+ height,
127
+ top: y,
128
+ left: x,
129
+ right: x + width,
130
+ bottom: y + height,
131
+ x,
132
+ y
133
+ };
134
+ }
135
+
136
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
137
+ let {
138
+ reference,
139
+ floating
140
+ } = _ref;
141
+ const sideAxis = getSideAxis(placement);
142
+ const alignmentAxis = getAlignmentAxis(placement);
143
+ const alignLength = getAxisLength(alignmentAxis);
144
+ const side = getSide(placement);
145
+ const isVertical = sideAxis === 'y';
146
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
147
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
148
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
149
+ let coords;
150
+ switch (side) {
151
+ case 'top':
152
+ coords = {
153
+ x: commonX,
154
+ y: reference.y - floating.height
155
+ };
156
+ break;
157
+ case 'bottom':
158
+ coords = {
159
+ x: commonX,
160
+ y: reference.y + reference.height
161
+ };
162
+ break;
163
+ case 'right':
164
+ coords = {
165
+ x: reference.x + reference.width,
166
+ y: commonY
167
+ };
168
+ break;
169
+ case 'left':
170
+ coords = {
171
+ x: reference.x - floating.width,
172
+ y: commonY
173
+ };
174
+ break;
175
+ default:
176
+ coords = {
177
+ x: reference.x,
178
+ y: reference.y
179
+ };
180
+ }
181
+ switch (getAlignment(placement)) {
182
+ case 'start':
183
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
184
+ break;
185
+ case 'end':
186
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
187
+ break;
188
+ }
189
+ return coords;
190
+ }
191
+
192
+ /**
193
+ * Resolves with an object of overflow side offsets that determine how much the
194
+ * element is overflowing a given clipping boundary on each side.
195
+ * - positive = overflowing the boundary by that number of pixels
196
+ * - negative = how many pixels left before it will overflow
197
+ * - 0 = lies flush with the boundary
198
+ * @see https://floating-ui.com/docs/detectOverflow
199
+ */
200
+ async function detectOverflow(state, options) {
201
+ var _await$platform$isEle;
202
+ if (options === void 0) {
203
+ options = {};
204
+ }
205
+ const {
206
+ x,
207
+ y,
208
+ platform,
209
+ rects,
210
+ elements,
211
+ strategy
212
+ } = state;
213
+ const {
214
+ boundary = 'clippingAncestors',
215
+ rootBoundary = 'viewport',
216
+ elementContext = 'floating',
217
+ altBoundary = false,
218
+ padding = 0
219
+ } = evaluate(options, state);
220
+ const paddingObject = getPaddingObject(padding);
221
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
222
+ const element = elements[altBoundary ? altContext : elementContext];
223
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
224
+ 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))),
225
+ boundary,
226
+ rootBoundary,
227
+ strategy
228
+ }));
229
+ const rect = elementContext === 'floating' ? {
230
+ x,
231
+ y,
232
+ width: rects.floating.width,
233
+ height: rects.floating.height
234
+ } : rects.reference;
235
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
236
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
237
+ x: 1,
238
+ y: 1
239
+ } : {
240
+ x: 1,
241
+ y: 1
242
+ };
243
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
244
+ elements,
245
+ rect,
246
+ offsetParent,
247
+ strategy
248
+ }) : rect);
249
+ return {
250
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
251
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
252
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
253
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
254
+ };
255
+ }
256
+
257
+ // Maximum number of resets that can occur before bailing to avoid infinite reset loops.
258
+ const MAX_RESET_COUNT = 50;
259
+
260
+ /**
261
+ * Computes the `x` and `y` coordinates that will place the floating element
262
+ * next to a given reference element.
263
+ *
264
+ * This export does not have any `platform` interface logic. You will need to
265
+ * write one for the platform you are using Floating UI with.
266
+ */
267
+ const computePosition$1 = async (reference, floating, config) => {
268
+ const {
269
+ placement = 'bottom',
270
+ strategy = 'absolute',
271
+ middleware = [],
272
+ platform
273
+ } = config;
274
+ const platformWithDetectOverflow = platform.detectOverflow ? platform : {
275
+ ...platform,
276
+ detectOverflow
277
+ };
278
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
279
+ let rects = await platform.getElementRects({
280
+ reference,
281
+ floating,
282
+ strategy
283
+ });
284
+ let {
285
+ x,
286
+ y
287
+ } = computeCoordsFromPlacement(rects, placement, rtl);
288
+ let statefulPlacement = placement;
289
+ let resetCount = 0;
290
+ const middlewareData = {};
291
+ for (let i = 0; i < middleware.length; i++) {
292
+ const currentMiddleware = middleware[i];
293
+ if (!currentMiddleware) {
294
+ continue;
295
+ }
296
+ const {
297
+ name,
298
+ fn
299
+ } = currentMiddleware;
300
+ const {
301
+ x: nextX,
302
+ y: nextY,
303
+ data,
304
+ reset
305
+ } = await fn({
306
+ x,
307
+ y,
308
+ initialPlacement: placement,
309
+ placement: statefulPlacement,
310
+ strategy,
311
+ middlewareData,
312
+ rects,
313
+ platform: platformWithDetectOverflow,
314
+ elements: {
315
+ reference,
316
+ floating
317
+ }
318
+ });
319
+ x = nextX != null ? nextX : x;
320
+ y = nextY != null ? nextY : y;
321
+ middlewareData[name] = {
322
+ ...middlewareData[name],
323
+ ...data
324
+ };
325
+ if (reset && resetCount < MAX_RESET_COUNT) {
326
+ resetCount++;
327
+ if (typeof reset === 'object') {
328
+ if (reset.placement) {
329
+ statefulPlacement = reset.placement;
330
+ }
331
+ if (reset.rects) {
332
+ rects = reset.rects === true ? await platform.getElementRects({
333
+ reference,
334
+ floating,
335
+ strategy
336
+ }) : reset.rects;
337
+ }
338
+ ({
339
+ x,
340
+ y
341
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
342
+ }
343
+ i = -1;
344
+ }
345
+ }
346
+ return {
347
+ x,
348
+ y,
349
+ placement: statefulPlacement,
350
+ strategy,
351
+ middlewareData
352
+ };
353
+ };
354
+
355
+ /**
356
+ * Provides data to position an inner element of the floating element so that it
357
+ * appears centered to the reference element.
358
+ * @see https://floating-ui.com/docs/arrow
359
+ */
360
+ const arrow$1 = options => ({
361
+ name: 'arrow',
362
+ options,
363
+ async fn(state) {
364
+ const {
365
+ x,
366
+ y,
367
+ placement,
368
+ rects,
369
+ platform,
370
+ elements,
371
+ middlewareData
372
+ } = state;
373
+ // Since `element` is required, we don't Partial<> the type.
374
+ const {
375
+ element,
376
+ padding = 0
377
+ } = evaluate(options, state) || {};
378
+ if (element == null) {
379
+ return {};
380
+ }
381
+ const paddingObject = getPaddingObject(padding);
382
+ const coords = {
383
+ x,
384
+ y
385
+ };
386
+ const axis = getAlignmentAxis(placement);
387
+ const length = getAxisLength(axis);
388
+ const arrowDimensions = await platform.getDimensions(element);
389
+ const isYAxis = axis === 'y';
390
+ const minProp = isYAxis ? 'top' : 'left';
391
+ const maxProp = isYAxis ? 'bottom' : 'right';
392
+ const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
393
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
394
+ const startDiff = coords[axis] - rects.reference[axis];
395
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
396
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
397
+
398
+ // DOM platform can return `window` as the `offsetParent`.
399
+ if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
400
+ clientSize = elements.floating[clientProp] || rects.floating[length];
401
+ }
402
+ const centerToReference = endDiff / 2 - startDiff / 2;
403
+
404
+ // If the padding is large enough that it causes the arrow to no longer be
405
+ // centered, modify the padding so that it is centered.
406
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
407
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
408
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
409
+
410
+ // Make sure the arrow doesn't overflow the floating element if the center
411
+ // point is outside the floating element's bounds.
412
+ const min$1 = minPadding;
413
+ const max = clientSize - arrowDimensions[length] - maxPadding;
414
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
415
+ const offset = clamp(min$1, center, max);
416
+
417
+ // If the reference is small enough that the arrow's padding causes it to
418
+ // to point to nothing for an aligned placement, adjust the offset of the
419
+ // floating element itself. To ensure `shift()` continues to take action,
420
+ // a single reset is performed when this is true.
421
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
422
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
423
+ return {
424
+ [axis]: coords[axis] + alignmentOffset,
425
+ data: {
426
+ [axis]: offset,
427
+ centerOffset: center - offset - alignmentOffset,
428
+ ...(shouldAddOffset && {
429
+ alignmentOffset
430
+ })
431
+ },
432
+ reset: shouldAddOffset
433
+ };
434
+ }
435
+ });
436
+
437
+ /**
438
+ * Optimizes the visibility of the floating element by flipping the `placement`
439
+ * in order to keep it in view when the preferred placement(s) will overflow the
440
+ * clipping boundary. Alternative to `autoPlacement`.
441
+ * @see https://floating-ui.com/docs/flip
442
+ */
443
+ const flip$1 = function (options) {
444
+ if (options === void 0) {
445
+ options = {};
446
+ }
447
+ return {
448
+ name: 'flip',
449
+ options,
450
+ async fn(state) {
451
+ var _middlewareData$arrow, _middlewareData$flip;
452
+ const {
453
+ placement,
454
+ middlewareData,
455
+ rects,
456
+ initialPlacement,
457
+ platform,
458
+ elements
459
+ } = state;
460
+ const {
461
+ mainAxis: checkMainAxis = true,
462
+ crossAxis: checkCrossAxis = true,
463
+ fallbackPlacements: specifiedFallbackPlacements,
464
+ fallbackStrategy = 'bestFit',
465
+ fallbackAxisSideDirection = 'none',
466
+ flipAlignment = true,
467
+ ...detectOverflowOptions
468
+ } = evaluate(options, state);
469
+
470
+ // If a reset by the arrow was caused due to an alignment offset being
471
+ // added, we should skip any logic now since `flip()` has already done its
472
+ // work.
473
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
474
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
475
+ return {};
476
+ }
477
+ const side = getSide(placement);
478
+ const initialSideAxis = getSideAxis(initialPlacement);
479
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
480
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
481
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
482
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
483
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
484
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
485
+ }
486
+ const placements = [initialPlacement, ...fallbackPlacements];
487
+ const overflow = await platform.detectOverflow(state, detectOverflowOptions);
488
+ const overflows = [];
489
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
490
+ if (checkMainAxis) {
491
+ overflows.push(overflow[side]);
492
+ }
493
+ if (checkCrossAxis) {
494
+ const sides = getAlignmentSides(placement, rects, rtl);
495
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
496
+ }
497
+ overflowsData = [...overflowsData, {
498
+ placement,
499
+ overflows
500
+ }];
501
+
502
+ // One or more sides is overflowing.
503
+ if (!overflows.every(side => side <= 0)) {
504
+ var _middlewareData$flip2, _overflowsData$filter;
505
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
506
+ const nextPlacement = placements[nextIndex];
507
+ if (nextPlacement) {
508
+ const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
509
+ if (!ignoreCrossAxisOverflow ||
510
+ // We leave the current main axis only if every placement on that axis
511
+ // overflows the main axis.
512
+ overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
513
+ // Try next placement and re-run the lifecycle.
514
+ return {
515
+ data: {
516
+ index: nextIndex,
517
+ overflows: overflowsData
518
+ },
519
+ reset: {
520
+ placement: nextPlacement
521
+ }
522
+ };
523
+ }
524
+ }
525
+
526
+ // First, find the candidates that fit on the mainAxis side of overflow,
527
+ // then find the placement that fits the best on the main crossAxis side.
528
+ 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;
529
+
530
+ // Otherwise fallback.
531
+ if (!resetPlacement) {
532
+ switch (fallbackStrategy) {
533
+ case 'bestFit':
534
+ {
535
+ var _overflowsData$filter2;
536
+ const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
537
+ if (hasFallbackAxisSideDirection) {
538
+ const currentSideAxis = getSideAxis(d.placement);
539
+ return currentSideAxis === initialSideAxis ||
540
+ // Create a bias to the `y` side axis due to horizontal
541
+ // reading directions favoring greater width.
542
+ currentSideAxis === 'y';
543
+ }
544
+ return true;
545
+ }).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$filter2[0];
546
+ if (placement) {
547
+ resetPlacement = placement;
548
+ }
549
+ break;
550
+ }
551
+ case 'initialPlacement':
552
+ resetPlacement = initialPlacement;
553
+ break;
554
+ }
555
+ }
556
+ if (placement !== resetPlacement) {
557
+ return {
558
+ reset: {
559
+ placement: resetPlacement
560
+ }
561
+ };
562
+ }
563
+ }
564
+ return {};
565
+ }
566
+ };
567
+ };
568
+
569
+ const originSides = /*#__PURE__*/new Set(['left', 'top']);
570
+
571
+ // For type backwards-compatibility, the `OffsetOptions` type was also
572
+ // Derivable.
573
+
574
+ async function convertValueToCoords(state, options) {
575
+ const {
576
+ placement,
577
+ platform,
578
+ elements
579
+ } = state;
580
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
581
+ const side = getSide(placement);
582
+ const alignment = getAlignment(placement);
583
+ const isVertical = getSideAxis(placement) === 'y';
584
+ const mainAxisMulti = originSides.has(side) ? -1 : 1;
585
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
586
+ const rawValue = evaluate(options, state);
587
+
588
+ // eslint-disable-next-line prefer-const
589
+ let {
590
+ mainAxis,
591
+ crossAxis,
592
+ alignmentAxis
593
+ } = typeof rawValue === 'number' ? {
594
+ mainAxis: rawValue,
595
+ crossAxis: 0,
596
+ alignmentAxis: null
597
+ } : {
598
+ mainAxis: rawValue.mainAxis || 0,
599
+ crossAxis: rawValue.crossAxis || 0,
600
+ alignmentAxis: rawValue.alignmentAxis
601
+ };
602
+ if (alignment && typeof alignmentAxis === 'number') {
603
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
604
+ }
605
+ return isVertical ? {
606
+ x: crossAxis * crossAxisMulti,
607
+ y: mainAxis * mainAxisMulti
608
+ } : {
609
+ x: mainAxis * mainAxisMulti,
610
+ y: crossAxis * crossAxisMulti
611
+ };
612
+ }
613
+
614
+ /**
615
+ * Modifies the placement by translating the floating element along the
616
+ * specified axes.
617
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
618
+ * object may be passed.
619
+ * @see https://floating-ui.com/docs/offset
620
+ */
621
+ const offset$1 = function (options) {
622
+ if (options === void 0) {
623
+ options = 0;
624
+ }
625
+ return {
626
+ name: 'offset',
627
+ options,
628
+ async fn(state) {
629
+ var _middlewareData$offse, _middlewareData$arrow;
630
+ const {
631
+ x,
632
+ y,
633
+ placement,
634
+ middlewareData
635
+ } = state;
636
+ const diffCoords = await convertValueToCoords(state, options);
637
+
638
+ // If the placement is the same and the arrow caused an alignment offset
639
+ // then we don't need to change the positioning coordinates.
640
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
641
+ return {};
642
+ }
643
+ return {
644
+ x: x + diffCoords.x,
645
+ y: y + diffCoords.y,
646
+ data: {
647
+ ...diffCoords,
648
+ placement
649
+ }
650
+ };
651
+ }
652
+ };
653
+ };
654
+
655
+ /**
656
+ * Optimizes the visibility of the floating element by shifting it in order to
657
+ * keep it in view when it will overflow the clipping boundary.
658
+ * @see https://floating-ui.com/docs/shift
659
+ */
660
+ const shift$1 = function (options) {
661
+ if (options === void 0) {
662
+ options = {};
663
+ }
664
+ return {
665
+ name: 'shift',
666
+ options,
667
+ async fn(state) {
668
+ const {
669
+ x,
670
+ y,
671
+ placement,
672
+ platform
673
+ } = state;
674
+ const {
675
+ mainAxis: checkMainAxis = true,
676
+ crossAxis: checkCrossAxis = false,
677
+ limiter = {
678
+ fn: _ref => {
679
+ let {
680
+ x,
681
+ y
682
+ } = _ref;
683
+ return {
684
+ x,
685
+ y
686
+ };
687
+ }
688
+ },
689
+ ...detectOverflowOptions
690
+ } = evaluate(options, state);
691
+ const coords = {
692
+ x,
693
+ y
694
+ };
695
+ const overflow = await platform.detectOverflow(state, detectOverflowOptions);
696
+ const crossAxis = getSideAxis(getSide(placement));
697
+ const mainAxis = getOppositeAxis(crossAxis);
698
+ let mainAxisCoord = coords[mainAxis];
699
+ let crossAxisCoord = coords[crossAxis];
700
+ if (checkMainAxis) {
701
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
702
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
703
+ const min = mainAxisCoord + overflow[minSide];
704
+ const max = mainAxisCoord - overflow[maxSide];
705
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
706
+ }
707
+ if (checkCrossAxis) {
708
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
709
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
710
+ const min = crossAxisCoord + overflow[minSide];
711
+ const max = crossAxisCoord - overflow[maxSide];
712
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
713
+ }
714
+ const limitedCoords = limiter.fn({
715
+ ...state,
716
+ [mainAxis]: mainAxisCoord,
717
+ [crossAxis]: crossAxisCoord
718
+ });
719
+ return {
720
+ ...limitedCoords,
721
+ data: {
722
+ x: limitedCoords.x - x,
723
+ y: limitedCoords.y - y,
724
+ enabled: {
725
+ [mainAxis]: checkMainAxis,
726
+ [crossAxis]: checkCrossAxis
727
+ }
728
+ }
729
+ };
730
+ }
731
+ };
732
+ };
733
+
734
+ function hasWindow() {
735
+ return typeof window !== 'undefined';
736
+ }
737
+ function getNodeName(node) {
738
+ if (isNode(node)) {
739
+ return (node.nodeName || '').toLowerCase();
740
+ }
741
+ // Mocked nodes in testing environments may not be instances of Node. By
742
+ // returning `#document` an infinite loop won't occur.
743
+ // https://github.com/floating-ui/floating-ui/issues/2317
744
+ return '#document';
745
+ }
746
+ function getWindow(node) {
747
+ var _node$ownerDocument;
748
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
749
+ }
750
+ function getDocumentElement(node) {
751
+ var _ref;
752
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
753
+ }
754
+ function isNode(value) {
755
+ if (!hasWindow()) {
756
+ return false;
757
+ }
758
+ return value instanceof Node || value instanceof getWindow(value).Node;
759
+ }
760
+ function isElement(value) {
761
+ if (!hasWindow()) {
762
+ return false;
763
+ }
764
+ return value instanceof Element || value instanceof getWindow(value).Element;
765
+ }
766
+ function isHTMLElement(value) {
767
+ if (!hasWindow()) {
768
+ return false;
769
+ }
770
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
771
+ }
772
+ function isShadowRoot(value) {
773
+ if (!hasWindow() || typeof ShadowRoot === 'undefined') {
774
+ return false;
775
+ }
776
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
777
+ }
778
+ function isOverflowElement(element) {
779
+ const {
780
+ overflow,
781
+ overflowX,
782
+ overflowY,
783
+ display
784
+ } = getComputedStyle$1(element);
785
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
786
+ }
787
+ function isTableElement(element) {
788
+ return /^(table|td|th)$/.test(getNodeName(element));
789
+ }
790
+ function isTopLayer(element) {
791
+ try {
792
+ if (element.matches(':popover-open')) {
793
+ return true;
794
+ }
795
+ } catch (_e) {
796
+ // no-op
797
+ }
798
+ try {
799
+ return element.matches(':modal');
800
+ } catch (_e) {
801
+ return false;
802
+ }
803
+ }
804
+ const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
805
+ const containRe = /paint|layout|strict|content/;
806
+ const isNotNone = value => !!value && value !== 'none';
807
+ let isWebKitValue;
808
+ function isContainingBlock(elementOrCss) {
809
+ const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
810
+
811
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
812
+ // https://drafts.csswg.org/css-transforms-2/#individual-transforms
813
+ return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
814
+ }
815
+ function getContainingBlock(element) {
816
+ let currentNode = getParentNode(element);
817
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
818
+ if (isContainingBlock(currentNode)) {
819
+ return currentNode;
820
+ } else if (isTopLayer(currentNode)) {
821
+ return null;
822
+ }
823
+ currentNode = getParentNode(currentNode);
824
+ }
825
+ return null;
826
+ }
827
+ function isWebKit() {
828
+ if (isWebKitValue == null) {
829
+ isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
830
+ }
831
+ return isWebKitValue;
832
+ }
833
+ function isLastTraversableNode(node) {
834
+ return /^(html|body|#document)$/.test(getNodeName(node));
835
+ }
836
+ function getComputedStyle$1(element) {
837
+ return getWindow(element).getComputedStyle(element);
838
+ }
839
+ function getNodeScroll(element) {
840
+ if (isElement(element)) {
841
+ return {
842
+ scrollLeft: element.scrollLeft,
843
+ scrollTop: element.scrollTop
844
+ };
845
+ }
846
+ return {
847
+ scrollLeft: element.scrollX,
848
+ scrollTop: element.scrollY
849
+ };
850
+ }
851
+ function getParentNode(node) {
852
+ if (getNodeName(node) === 'html') {
853
+ return node;
854
+ }
855
+ const result =
856
+ // Step into the shadow DOM of the parent of a slotted node.
857
+ node.assignedSlot ||
858
+ // DOM Element detected.
859
+ node.parentNode ||
860
+ // ShadowRoot detected.
861
+ isShadowRoot(node) && node.host ||
862
+ // Fallback.
863
+ getDocumentElement(node);
864
+ return isShadowRoot(result) ? result.host : result;
865
+ }
866
+ function getNearestOverflowAncestor(node) {
867
+ const parentNode = getParentNode(node);
868
+ if (isLastTraversableNode(parentNode)) {
869
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
870
+ }
871
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
872
+ return parentNode;
873
+ }
874
+ return getNearestOverflowAncestor(parentNode);
875
+ }
876
+ function getOverflowAncestors(node, list, traverseIframes) {
877
+ var _node$ownerDocument2;
878
+ if (list === void 0) {
879
+ list = [];
880
+ }
881
+ if (traverseIframes === void 0) {
882
+ traverseIframes = true;
883
+ }
884
+ const scrollableAncestor = getNearestOverflowAncestor(node);
885
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
886
+ const win = getWindow(scrollableAncestor);
887
+ if (isBody) {
888
+ const frameElement = getFrameElement(win);
889
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
890
+ } else {
891
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
892
+ }
893
+ }
894
+ function getFrameElement(win) {
895
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
896
+ }
897
+
898
+ function getCssDimensions(element) {
899
+ const css = getComputedStyle$1(element);
900
+ // In testing environments, the `width` and `height` properties are empty
901
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
902
+ let width = parseFloat(css.width) || 0;
903
+ let height = parseFloat(css.height) || 0;
904
+ const hasOffset = isHTMLElement(element);
905
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
906
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
907
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
908
+ if (shouldFallback) {
909
+ width = offsetWidth;
910
+ height = offsetHeight;
911
+ }
912
+ return {
913
+ width,
914
+ height,
915
+ $: shouldFallback
916
+ };
917
+ }
918
+
919
+ function unwrapElement(element) {
920
+ return !isElement(element) ? element.contextElement : element;
921
+ }
922
+
923
+ function getScale(element) {
924
+ const domElement = unwrapElement(element);
925
+ if (!isHTMLElement(domElement)) {
926
+ return createCoords(1);
927
+ }
928
+ const rect = domElement.getBoundingClientRect();
929
+ const {
930
+ width,
931
+ height,
932
+ $
933
+ } = getCssDimensions(domElement);
934
+ let x = ($ ? round(rect.width) : rect.width) / width;
935
+ let y = ($ ? round(rect.height) : rect.height) / height;
936
+
937
+ // 0, NaN, or Infinity should always fallback to 1.
938
+
939
+ if (!x || !Number.isFinite(x)) {
940
+ x = 1;
941
+ }
942
+ if (!y || !Number.isFinite(y)) {
943
+ y = 1;
944
+ }
945
+ return {
946
+ x,
947
+ y
948
+ };
949
+ }
950
+
951
+ const noOffsets = /*#__PURE__*/createCoords(0);
952
+ function getVisualOffsets(element) {
953
+ const win = getWindow(element);
954
+ if (!isWebKit() || !win.visualViewport) {
955
+ return noOffsets;
956
+ }
957
+ return {
958
+ x: win.visualViewport.offsetLeft,
959
+ y: win.visualViewport.offsetTop
960
+ };
961
+ }
962
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
963
+ if (isFixed === void 0) {
964
+ isFixed = false;
965
+ }
966
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
967
+ return false;
968
+ }
969
+ return isFixed;
970
+ }
971
+
972
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
973
+ if (includeScale === void 0) {
974
+ includeScale = false;
975
+ }
976
+ if (isFixedStrategy === void 0) {
977
+ isFixedStrategy = false;
978
+ }
979
+ const clientRect = element.getBoundingClientRect();
980
+ const domElement = unwrapElement(element);
981
+ let scale = createCoords(1);
982
+ if (includeScale) {
983
+ if (offsetParent) {
984
+ if (isElement(offsetParent)) {
985
+ scale = getScale(offsetParent);
986
+ }
987
+ } else {
988
+ scale = getScale(element);
989
+ }
990
+ }
991
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
992
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
993
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
994
+ let width = clientRect.width / scale.x;
995
+ let height = clientRect.height / scale.y;
996
+ if (domElement) {
997
+ const win = getWindow(domElement);
998
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
999
+ let currentWin = win;
1000
+ let currentIFrame = getFrameElement(currentWin);
1001
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1002
+ const iframeScale = getScale(currentIFrame);
1003
+ const iframeRect = currentIFrame.getBoundingClientRect();
1004
+ const css = getComputedStyle$1(currentIFrame);
1005
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1006
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1007
+ x *= iframeScale.x;
1008
+ y *= iframeScale.y;
1009
+ width *= iframeScale.x;
1010
+ height *= iframeScale.y;
1011
+ x += left;
1012
+ y += top;
1013
+ currentWin = getWindow(currentIFrame);
1014
+ currentIFrame = getFrameElement(currentWin);
1015
+ }
1016
+ }
1017
+ return rectToClientRect({
1018
+ width,
1019
+ height,
1020
+ x,
1021
+ y
1022
+ });
1023
+ }
1024
+
1025
+ // If <html> has a CSS width greater than the viewport, then this will be
1026
+ // incorrect for RTL.
1027
+ function getWindowScrollBarX(element, rect) {
1028
+ const leftScroll = getNodeScroll(element).scrollLeft;
1029
+ if (!rect) {
1030
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1031
+ }
1032
+ return rect.left + leftScroll;
1033
+ }
1034
+
1035
+ function getHTMLOffset(documentElement, scroll) {
1036
+ const htmlRect = documentElement.getBoundingClientRect();
1037
+ const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
1038
+ const y = htmlRect.top + scroll.scrollTop;
1039
+ return {
1040
+ x,
1041
+ y
1042
+ };
1043
+ }
1044
+
1045
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1046
+ let {
1047
+ elements,
1048
+ rect,
1049
+ offsetParent,
1050
+ strategy
1051
+ } = _ref;
1052
+ const isFixed = strategy === 'fixed';
1053
+ const documentElement = getDocumentElement(offsetParent);
1054
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
1055
+ if (offsetParent === documentElement || topLayer && isFixed) {
1056
+ return rect;
1057
+ }
1058
+ let scroll = {
1059
+ scrollLeft: 0,
1060
+ scrollTop: 0
1061
+ };
1062
+ let scale = createCoords(1);
1063
+ const offsets = createCoords(0);
1064
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1065
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1066
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1067
+ scroll = getNodeScroll(offsetParent);
1068
+ }
1069
+ if (isOffsetParentAnElement) {
1070
+ const offsetRect = getBoundingClientRect(offsetParent);
1071
+ scale = getScale(offsetParent);
1072
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1073
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1074
+ }
1075
+ }
1076
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1077
+ return {
1078
+ width: rect.width * scale.x,
1079
+ height: rect.height * scale.y,
1080
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1081
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1082
+ };
1083
+ }
1084
+
1085
+ function getClientRects(element) {
1086
+ return Array.from(element.getClientRects());
1087
+ }
1088
+
1089
+ // Gets the entire size of the scrollable document area, even extending outside
1090
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1091
+ function getDocumentRect(element) {
1092
+ const html = getDocumentElement(element);
1093
+ const scroll = getNodeScroll(element);
1094
+ const body = element.ownerDocument.body;
1095
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1096
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1097
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1098
+ const y = -scroll.scrollTop;
1099
+ if (getComputedStyle$1(body).direction === 'rtl') {
1100
+ x += max(html.clientWidth, body.clientWidth) - width;
1101
+ }
1102
+ return {
1103
+ width,
1104
+ height,
1105
+ x,
1106
+ y
1107
+ };
1108
+ }
1109
+
1110
+ // Safety check: ensure the scrollbar space is reasonable in case this
1111
+ // calculation is affected by unusual styles.
1112
+ // Most scrollbars leave 15-18px of space.
1113
+ const SCROLLBAR_MAX = 25;
1114
+ function getViewportRect(element, strategy) {
1115
+ const win = getWindow(element);
1116
+ const html = getDocumentElement(element);
1117
+ const visualViewport = win.visualViewport;
1118
+ let width = html.clientWidth;
1119
+ let height = html.clientHeight;
1120
+ let x = 0;
1121
+ let y = 0;
1122
+ if (visualViewport) {
1123
+ width = visualViewport.width;
1124
+ height = visualViewport.height;
1125
+ const visualViewportBased = isWebKit();
1126
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1127
+ x = visualViewport.offsetLeft;
1128
+ y = visualViewport.offsetTop;
1129
+ }
1130
+ }
1131
+ const windowScrollbarX = getWindowScrollBarX(html);
1132
+ // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
1133
+ // visual width of the <html> but this is not considered in the size
1134
+ // of `html.clientWidth`.
1135
+ if (windowScrollbarX <= 0) {
1136
+ const doc = html.ownerDocument;
1137
+ const body = doc.body;
1138
+ const bodyStyles = getComputedStyle(body);
1139
+ const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
1140
+ const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
1141
+ if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
1142
+ width -= clippingStableScrollbarWidth;
1143
+ }
1144
+ } else if (windowScrollbarX <= SCROLLBAR_MAX) {
1145
+ // If the <body> scrollbar is on the left, the width needs to be extended
1146
+ // by the scrollbar amount so there isn't extra space on the right.
1147
+ width += windowScrollbarX;
1148
+ }
1149
+ return {
1150
+ width,
1151
+ height,
1152
+ x,
1153
+ y
1154
+ };
1155
+ }
1156
+
1157
+ // Returns the inner client rect, subtracting scrollbars if present.
1158
+ function getInnerBoundingClientRect(element, strategy) {
1159
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1160
+ const top = clientRect.top + element.clientTop;
1161
+ const left = clientRect.left + element.clientLeft;
1162
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1163
+ const width = element.clientWidth * scale.x;
1164
+ const height = element.clientHeight * scale.y;
1165
+ const x = left * scale.x;
1166
+ const y = top * scale.y;
1167
+ return {
1168
+ width,
1169
+ height,
1170
+ x,
1171
+ y
1172
+ };
1173
+ }
1174
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1175
+ let rect;
1176
+ if (clippingAncestor === 'viewport') {
1177
+ rect = getViewportRect(element, strategy);
1178
+ } else if (clippingAncestor === 'document') {
1179
+ rect = getDocumentRect(getDocumentElement(element));
1180
+ } else if (isElement(clippingAncestor)) {
1181
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1182
+ } else {
1183
+ const visualOffsets = getVisualOffsets(element);
1184
+ rect = {
1185
+ x: clippingAncestor.x - visualOffsets.x,
1186
+ y: clippingAncestor.y - visualOffsets.y,
1187
+ width: clippingAncestor.width,
1188
+ height: clippingAncestor.height
1189
+ };
1190
+ }
1191
+ return rectToClientRect(rect);
1192
+ }
1193
+ function hasFixedPositionAncestor(element, stopNode) {
1194
+ const parentNode = getParentNode(element);
1195
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1196
+ return false;
1197
+ }
1198
+ return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1199
+ }
1200
+
1201
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
1202
+ // clipping (or hiding) child elements. This returns all clipping ancestors
1203
+ // of the given element up the tree.
1204
+ function getClippingElementAncestors(element, cache) {
1205
+ const cachedResult = cache.get(element);
1206
+ if (cachedResult) {
1207
+ return cachedResult;
1208
+ }
1209
+ let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1210
+ let currentContainingBlockComputedStyle = null;
1211
+ const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
1212
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1213
+
1214
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1215
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1216
+ const computedStyle = getComputedStyle$1(currentNode);
1217
+ const currentNodeIsContaining = isContainingBlock(currentNode);
1218
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1219
+ currentContainingBlockComputedStyle = null;
1220
+ }
1221
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1222
+ if (shouldDropCurrentNode) {
1223
+ // Drop non-containing blocks.
1224
+ result = result.filter(ancestor => ancestor !== currentNode);
1225
+ } else {
1226
+ // Record last containing block for next iteration.
1227
+ currentContainingBlockComputedStyle = computedStyle;
1228
+ }
1229
+ currentNode = getParentNode(currentNode);
1230
+ }
1231
+ cache.set(element, result);
1232
+ return result;
1233
+ }
1234
+
1235
+ // Gets the maximum area that the element is visible in due to any number of
1236
+ // clipping ancestors.
1237
+ function getClippingRect(_ref) {
1238
+ let {
1239
+ element,
1240
+ boundary,
1241
+ rootBoundary,
1242
+ strategy
1243
+ } = _ref;
1244
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1245
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1246
+ const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
1247
+ let top = firstRect.top;
1248
+ let right = firstRect.right;
1249
+ let bottom = firstRect.bottom;
1250
+ let left = firstRect.left;
1251
+ for (let i = 1; i < clippingAncestors.length; i++) {
1252
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
1253
+ top = max(rect.top, top);
1254
+ right = min(rect.right, right);
1255
+ bottom = min(rect.bottom, bottom);
1256
+ left = max(rect.left, left);
1257
+ }
1258
+ return {
1259
+ width: right - left,
1260
+ height: bottom - top,
1261
+ x: left,
1262
+ y: top
1263
+ };
1264
+ }
1265
+
1266
+ function getDimensions(element) {
1267
+ const {
1268
+ width,
1269
+ height
1270
+ } = getCssDimensions(element);
1271
+ return {
1272
+ width,
1273
+ height
1274
+ };
1275
+ }
1276
+
1277
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1278
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1279
+ const documentElement = getDocumentElement(offsetParent);
1280
+ const isFixed = strategy === 'fixed';
1281
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1282
+ let scroll = {
1283
+ scrollLeft: 0,
1284
+ scrollTop: 0
1285
+ };
1286
+ const offsets = createCoords(0);
1287
+
1288
+ // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
1289
+ // Firefox with layout.scrollbar.side = 3 in about:config to test this.
1290
+ function setLeftRTLScrollbarOffset() {
1291
+ offsets.x = getWindowScrollBarX(documentElement);
1292
+ }
1293
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1294
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1295
+ scroll = getNodeScroll(offsetParent);
1296
+ }
1297
+ if (isOffsetParentAnElement) {
1298
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1299
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1300
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1301
+ } else if (documentElement) {
1302
+ setLeftRTLScrollbarOffset();
1303
+ }
1304
+ }
1305
+ if (isFixed && !isOffsetParentAnElement && documentElement) {
1306
+ setLeftRTLScrollbarOffset();
1307
+ }
1308
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1309
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1310
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1311
+ return {
1312
+ x,
1313
+ y,
1314
+ width: rect.width,
1315
+ height: rect.height
1316
+ };
1317
+ }
1318
+
1319
+ function isStaticPositioned(element) {
1320
+ return getComputedStyle$1(element).position === 'static';
1321
+ }
1322
+
1323
+ function getTrueOffsetParent(element, polyfill) {
1324
+ if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
1325
+ return null;
1326
+ }
1327
+ if (polyfill) {
1328
+ return polyfill(element);
1329
+ }
1330
+ let rawOffsetParent = element.offsetParent;
1331
+
1332
+ // Firefox returns the <html> element as the offsetParent if it's non-static,
1333
+ // while Chrome and Safari return the <body> element. The <body> element must
1334
+ // be used to perform the correct calculations even if the <html> element is
1335
+ // non-static.
1336
+ if (getDocumentElement(element) === rawOffsetParent) {
1337
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
1338
+ }
1339
+ return rawOffsetParent;
1340
+ }
1341
+
1342
+ // Gets the closest ancestor positioned element. Handles some edge cases,
1343
+ // such as table ancestors and cross browser bugs.
1344
+ function getOffsetParent(element, polyfill) {
1345
+ const win = getWindow(element);
1346
+ if (isTopLayer(element)) {
1347
+ return win;
1348
+ }
1349
+ if (!isHTMLElement(element)) {
1350
+ let svgOffsetParent = getParentNode(element);
1351
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1352
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1353
+ return svgOffsetParent;
1354
+ }
1355
+ svgOffsetParent = getParentNode(svgOffsetParent);
1356
+ }
1357
+ return win;
1358
+ }
1359
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1360
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1361
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1362
+ }
1363
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1364
+ return win;
1365
+ }
1366
+ return offsetParent || getContainingBlock(element) || win;
1367
+ }
1368
+
1369
+ const getElementRects = async function (data) {
1370
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1371
+ const getDimensionsFn = this.getDimensions;
1372
+ const floatingDimensions = await getDimensionsFn(data.floating);
1373
+ return {
1374
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1375
+ floating: {
1376
+ x: 0,
1377
+ y: 0,
1378
+ width: floatingDimensions.width,
1379
+ height: floatingDimensions.height
1380
+ }
1381
+ };
1382
+ };
1383
+
1384
+ function isRTL(element) {
1385
+ return getComputedStyle$1(element).direction === 'rtl';
1386
+ }
1387
+
1388
+ const platform = {
1389
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1390
+ getDocumentElement,
1391
+ getClippingRect,
1392
+ getOffsetParent,
1393
+ getElementRects,
1394
+ getClientRects,
1395
+ getDimensions,
1396
+ getScale,
1397
+ isElement,
1398
+ isRTL
1399
+ };
1400
+
1401
+ function rectsAreEqual(a, b) {
1402
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
1403
+ }
1404
+
1405
+ // https://samthor.au/2021/observing-dom/
1406
+ function observeMove(element, onMove) {
1407
+ let io = null;
1408
+ let timeoutId;
1409
+ const root = getDocumentElement(element);
1410
+ function cleanup() {
1411
+ var _io;
1412
+ clearTimeout(timeoutId);
1413
+ (_io = io) == null || _io.disconnect();
1414
+ io = null;
1415
+ }
1416
+ function refresh(skip, threshold) {
1417
+ if (skip === void 0) {
1418
+ skip = false;
1419
+ }
1420
+ if (threshold === void 0) {
1421
+ threshold = 1;
1422
+ }
1423
+ cleanup();
1424
+ const elementRectForRootMargin = element.getBoundingClientRect();
1425
+ const {
1426
+ left,
1427
+ top,
1428
+ width,
1429
+ height
1430
+ } = elementRectForRootMargin;
1431
+ if (!skip) {
1432
+ onMove();
1433
+ }
1434
+ if (!width || !height) {
1435
+ return;
1436
+ }
1437
+ const insetTop = floor(top);
1438
+ const insetRight = floor(root.clientWidth - (left + width));
1439
+ const insetBottom = floor(root.clientHeight - (top + height));
1440
+ const insetLeft = floor(left);
1441
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1442
+ const options = {
1443
+ rootMargin,
1444
+ threshold: max(0, min(1, threshold)) || 1
1445
+ };
1446
+ let isFirstUpdate = true;
1447
+ function handleObserve(entries) {
1448
+ const ratio = entries[0].intersectionRatio;
1449
+ if (ratio !== threshold) {
1450
+ if (!isFirstUpdate) {
1451
+ return refresh();
1452
+ }
1453
+ if (!ratio) {
1454
+ // If the reference is clipped, the ratio is 0. Throttle the refresh
1455
+ // to prevent an infinite loop of updates.
1456
+ timeoutId = setTimeout(() => {
1457
+ refresh(false, 1e-7);
1458
+ }, 1000);
1459
+ } else {
1460
+ refresh(false, ratio);
1461
+ }
1462
+ }
1463
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1464
+ // It's possible that even though the ratio is reported as 1, the
1465
+ // element is not actually fully within the IntersectionObserver's root
1466
+ // area anymore. This can happen under performance constraints. This may
1467
+ // be a bug in the browser's IntersectionObserver implementation. To
1468
+ // work around this, we compare the element's bounding rect now with
1469
+ // what it was at the time we created the IntersectionObserver. If they
1470
+ // are not equal then the element moved, so we refresh.
1471
+ refresh();
1472
+ }
1473
+ isFirstUpdate = false;
1474
+ }
1475
+
1476
+ // Older browsers don't support a `document` as the root and will throw an
1477
+ // error.
1478
+ try {
1479
+ io = new IntersectionObserver(handleObserve, {
1480
+ ...options,
1481
+ // Handle <iframe>s
1482
+ root: root.ownerDocument
1483
+ });
1484
+ } catch (_e) {
1485
+ io = new IntersectionObserver(handleObserve, options);
1486
+ }
1487
+ io.observe(element);
1488
+ }
1489
+ refresh(true);
1490
+ return cleanup;
1491
+ }
1492
+
1493
+ /**
1494
+ * Automatically updates the position of the floating element when necessary.
1495
+ * Should only be called when the floating element is mounted on the DOM or
1496
+ * visible on the screen.
1497
+ * @returns cleanup function that should be invoked when the floating element is
1498
+ * removed from the DOM or hidden from the screen.
1499
+ * @see https://floating-ui.com/docs/autoUpdate
1500
+ */
1501
+ function autoUpdate(reference, floating, update, options) {
1502
+ if (options === void 0) {
1503
+ options = {};
1504
+ }
1505
+ const {
1506
+ ancestorScroll = true,
1507
+ ancestorResize = true,
1508
+ elementResize = typeof ResizeObserver === 'function',
1509
+ layoutShift = typeof IntersectionObserver === 'function',
1510
+ animationFrame = false
1511
+ } = options;
1512
+ const referenceEl = unwrapElement(reference);
1513
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
1514
+ ancestors.forEach(ancestor => {
1515
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
1516
+ passive: true
1517
+ });
1518
+ ancestorResize && ancestor.addEventListener('resize', update);
1519
+ });
1520
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1521
+ let reobserveFrame = -1;
1522
+ let resizeObserver = null;
1523
+ if (elementResize) {
1524
+ resizeObserver = new ResizeObserver(_ref => {
1525
+ let [firstEntry] = _ref;
1526
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
1527
+ // Prevent update loops when using the `size` middleware.
1528
+ // https://github.com/floating-ui/floating-ui/issues/1740
1529
+ resizeObserver.unobserve(floating);
1530
+ cancelAnimationFrame(reobserveFrame);
1531
+ reobserveFrame = requestAnimationFrame(() => {
1532
+ var _resizeObserver;
1533
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1534
+ });
1535
+ }
1536
+ update();
1537
+ });
1538
+ if (referenceEl && !animationFrame) {
1539
+ resizeObserver.observe(referenceEl);
1540
+ }
1541
+ if (floating) {
1542
+ resizeObserver.observe(floating);
1543
+ }
1544
+ }
1545
+ let frameId;
1546
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1547
+ if (animationFrame) {
1548
+ frameLoop();
1549
+ }
1550
+ function frameLoop() {
1551
+ const nextRefRect = getBoundingClientRect(reference);
1552
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
1553
+ update();
1554
+ }
1555
+ prevRefRect = nextRefRect;
1556
+ frameId = requestAnimationFrame(frameLoop);
1557
+ }
1558
+ update();
1559
+ return () => {
1560
+ var _resizeObserver2;
1561
+ ancestors.forEach(ancestor => {
1562
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
1563
+ ancestorResize && ancestor.removeEventListener('resize', update);
1564
+ });
1565
+ cleanupIo == null || cleanupIo();
1566
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
1567
+ resizeObserver = null;
1568
+ if (animationFrame) {
1569
+ cancelAnimationFrame(frameId);
1570
+ }
1571
+ };
1572
+ }
1573
+
1574
+ /**
1575
+ * Modifies the placement by translating the floating element along the
1576
+ * specified axes.
1577
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
1578
+ * object may be passed.
1579
+ * @see https://floating-ui.com/docs/offset
1580
+ */
1581
+ const offset = offset$1;
1582
+
1583
+ /**
1584
+ * Optimizes the visibility of the floating element by shifting it in order to
1585
+ * keep it in view when it will overflow the clipping boundary.
1586
+ * @see https://floating-ui.com/docs/shift
1587
+ */
1588
+ const shift = shift$1;
1589
+
1590
+ /**
1591
+ * Optimizes the visibility of the floating element by flipping the `placement`
1592
+ * in order to keep it in view when the preferred placement(s) will overflow the
1593
+ * clipping boundary. Alternative to `autoPlacement`.
1594
+ * @see https://floating-ui.com/docs/flip
1595
+ */
1596
+ const flip = flip$1;
1597
+
1598
+ /**
1599
+ * Provides data to position an inner element of the floating element so that it
1600
+ * appears centered to the reference element.
1601
+ * @see https://floating-ui.com/docs/arrow
1602
+ */
1603
+ const arrow = arrow$1;
1604
+
1605
+ /**
1606
+ * Computes the `x` and `y` coordinates that will place the floating element
1607
+ * next to a given reference element.
1608
+ */
1609
+ const computePosition = (reference, floating, options) => {
1610
+ // This caches the expensive `getClippingElementAncestors` function so that
1611
+ // multiple lifecycle resets re-use the same result. It only lives for a
1612
+ // single call. If other functions become expensive, we can add them as well.
1613
+ const cache = new Map();
1614
+ const mergedOptions = {
1615
+ platform,
1616
+ ...options
1617
+ };
1618
+ const platformWithCache = {
1619
+ ...mergedOptions.platform,
1620
+ _c: cache
1621
+ };
1622
+ return computePosition$1(reference, floating, {
1623
+ ...mergedOptions,
1624
+ platform: platformWithCache
1625
+ });
1626
+ };
1627
+
1628
+ class FloatingController {
1629
+ constructor(host, options = {}) {
1630
+ this.reference = null;
1631
+ this.floating = null;
1632
+ this.arrowElement = null;
1633
+ this.cleanup = null;
1634
+ this.isHostConnected = false;
1635
+ this.isOpen = false;
1636
+ this.toggle = () => (this.isOpen ? this.close() : this.open());
1637
+ this.handleContextMenu = (e) => {
1638
+ e.preventDefault();
1639
+ this.open();
1640
+ };
1641
+ this.handleFocusOut = (e) => {
1642
+ if (!this.reference || this.reference.contains(e.relatedTarget))
1643
+ return;
1644
+ this.close();
1645
+ };
1646
+ this.handleOutsideClick = (e) => {
1647
+ if (this.isOpen &&
1648
+ this.reference &&
1649
+ this.floating &&
1650
+ !this.reference.contains(e.target) &&
1651
+ !this.floating.contains(e.target)) {
1652
+ this.close();
1653
+ }
1654
+ };
1655
+ this.open = () => {
1656
+ if (this.isOpen)
1657
+ return;
1658
+ this.isOpen = true;
1659
+ this.options.onOpenChange(this.isOpen);
1660
+ this.host.requestUpdate();
1661
+ this.updatePosition();
1662
+ };
1663
+ this.close = () => {
1664
+ if (!this.isOpen)
1665
+ return;
1666
+ this.isOpen = false;
1667
+ this.options.onOpenChange(this.isOpen);
1668
+ this.cleanup?.();
1669
+ this.cleanup = null;
1670
+ this.host.requestUpdate();
1671
+ };
1672
+ this.options = {
1673
+ placement: options.placement || 'bottom',
1674
+ strategy: options.strategy || 'absolute',
1675
+ offset: options.offset ?? 8,
1676
+ trigger: options.trigger || 'hover',
1677
+ closeOnClickOutside: options.closeOnClickOutside ?? true,
1678
+ onOpenChange: options.onOpenChange ?? (() => undefined),
1679
+ };
1680
+ this.host = host;
1681
+ this.host.addController(this);
1682
+ }
1683
+ hostConnected() {
1684
+ this.isHostConnected = true;
1685
+ if (this.options.closeOnClickOutside) {
1686
+ document.addEventListener('mousedown', this.handleOutsideClick);
1687
+ }
1688
+ }
1689
+ hostDisconnected() {
1690
+ this.isHostConnected = false;
1691
+ this.cleanup?.();
1692
+ this.removeEventListeners();
1693
+ document.removeEventListener('mousedown', this.handleOutsideClick);
1694
+ }
1695
+ setElements(reference, floating, arrowElement) {
1696
+ this.cleanup?.();
1697
+ this.cleanup = null;
1698
+ this.removeEventListeners();
1699
+ this.reference = reference;
1700
+ this.floating = floating;
1701
+ this.arrowElement = arrowElement || null;
1702
+ this.setupEventListeners();
1703
+ if (this.isOpen) {
1704
+ this.updatePosition();
1705
+ }
1706
+ }
1707
+ setOptions(options) {
1708
+ const previousTrigger = this.options.trigger;
1709
+ const previousCloseOnClickOutside = this.options.closeOnClickOutside;
1710
+ this.options = {
1711
+ ...this.options,
1712
+ ...options,
1713
+ onOpenChange: options.onOpenChange ?? this.options.onOpenChange,
1714
+ };
1715
+ if (this.reference && previousTrigger !== this.options.trigger) {
1716
+ this.removeEventListeners();
1717
+ this.setupEventListeners();
1718
+ }
1719
+ if (this.isHostConnected && previousCloseOnClickOutside !== this.options.closeOnClickOutside) {
1720
+ document.removeEventListener('mousedown', this.handleOutsideClick);
1721
+ if (this.options.closeOnClickOutside) {
1722
+ document.addEventListener('mousedown', this.handleOutsideClick);
1723
+ }
1724
+ }
1725
+ if (this.isOpen) {
1726
+ this.updatePosition();
1727
+ }
1728
+ }
1729
+ setupEventListeners() {
1730
+ if (!this.reference)
1731
+ return;
1732
+ if (this.options.trigger === 'hover' || this.options.trigger === 'hover-focus') {
1733
+ this.reference.addEventListener('mouseenter', this.open);
1734
+ this.reference.addEventListener('mouseleave', this.close);
1735
+ }
1736
+ if (this.options.trigger === 'click') {
1737
+ this.reference.addEventListener('click', this.toggle);
1738
+ }
1739
+ if (this.options.trigger === 'context-menu') {
1740
+ this.reference.addEventListener('contextmenu', this.handleContextMenu);
1741
+ }
1742
+ if (this.options.trigger === 'focus' || this.options.trigger === 'hover-focus') {
1743
+ this.reference.addEventListener('focusin', this.open);
1744
+ this.reference.addEventListener('focusout', this.handleFocusOut);
1745
+ }
1746
+ }
1747
+ removeEventListeners() {
1748
+ if (!this.reference)
1749
+ return;
1750
+ this.reference.removeEventListener('mouseenter', this.open);
1751
+ this.reference.removeEventListener('mouseleave', this.close);
1752
+ this.reference.removeEventListener('click', this.toggle);
1753
+ this.reference.removeEventListener('contextmenu', this.handleContextMenu);
1754
+ this.reference.removeEventListener('focusin', this.open);
1755
+ this.reference.removeEventListener('focusout', this.handleFocusOut);
1756
+ }
1757
+ updatePosition() {
1758
+ if (!this.reference || !this.floating)
1759
+ return;
1760
+ this.cleanup = autoUpdate(this.reference, this.floating, () => {
1761
+ if (!this.reference || !this.floating)
1762
+ return;
1763
+ const middleware = [
1764
+ offset(this.options.offset),
1765
+ flip(),
1766
+ shift({ padding: 5 }),
1767
+ ];
1768
+ if (this.arrowElement) {
1769
+ middleware.push(arrow({ element: this.arrowElement }));
1770
+ }
1771
+ computePosition(this.reference, this.floating, {
1772
+ placement: this.options.placement,
1773
+ strategy: this.options.strategy,
1774
+ middleware,
1775
+ }).then(({ x, y, placement, middlewareData }) => {
1776
+ if (!this.floating)
1777
+ return;
1778
+ Object.assign(this.floating.style, {
1779
+ left: `${x}px`,
1780
+ top: `${y}px`,
1781
+ position: this.options.strategy,
1782
+ });
1783
+ if (this.arrowElement && middlewareData.arrow) {
1784
+ const { x: ax, y: ay } = middlewareData.arrow;
1785
+ const staticSide = {
1786
+ top: 'bottom',
1787
+ right: 'left',
1788
+ bottom: 'top',
1789
+ left: 'right',
1790
+ }[placement.split('-')[0]];
1791
+ Object.assign(this.arrowElement.style, {
1792
+ left: ax != null ? `${ax}px` : '',
1793
+ top: ay != null ? `${ay}px` : '',
1794
+ right: '',
1795
+ bottom: '',
1796
+ [staticSide]: '-4px',
1797
+ });
1798
+ }
1799
+ });
1800
+ });
1801
+ }
1802
+ }
1803
+
1804
+ var css_248z = i`* {
1805
+ box-sizing: border-box;
1806
+ }
1807
+
1808
+ .screen-reader-only {
1809
+ display: none !important;
1810
+ }
1811
+
1812
+ :host {
1813
+ display: inline-block;
1814
+ }`;
1815
+
1816
+ /**
1817
+ * @label Popover
1818
+ * @tag wc-popover
1819
+ * @rawTag popover
1820
+ * @summary Displays additional information in a floating panel anchored to a trigger element.
1821
+ * @overview
1822
+ * <p>The Popover component wraps a trigger element and a <code>wc-popover-content</code> child. It uses
1823
+ * floating-ui to compute position, keeping the panel visible inside the viewport even on scroll.</p>
1824
+ * @tags display
1825
+ *
1826
+ * @fires {CustomEvent} wc-popover--open - Fired when the popover opens.
1827
+ * @fires {CustomEvent} wc-popover--close - Fired when the popover closes.
1828
+ *
1829
+ * @example
1830
+ * ```html
1831
+ * <wc-popover trigger="click">
1832
+ * <wc-button>Open popover</wc-button>
1833
+ * <wc-popover-content>
1834
+ * <p>Popover body text goes here.</p>
1835
+ * </wc-popover-content>
1836
+ * </wc-popover>
1837
+ * ```
1838
+ */
1839
+ let Popover = class Popover extends i$1 {
1840
+ constructor() {
1841
+ super(...arguments);
1842
+ /**
1843
+ * Determines how the popover is triggered.
1844
+ * Possible values are `"click"`, `"hover"`, `"manual"`.
1845
+ */
1846
+ this.trigger = 'click';
1847
+ /**
1848
+ * Preferred placement of the popover relative to the trigger element.
1849
+ * Accepts any floating-ui `Placement` string such as `"bottom"`, `"top-start"`, `"right"`, etc.
1850
+ */
1851
+ this.placement = 'bottom';
1852
+ /**
1853
+ * Whether the popover is open.
1854
+ */
1855
+ this.open = false;
1856
+ /**
1857
+ * Distance in pixels between the trigger element and the popover panel.
1858
+ */
1859
+ this.offset = 8;
1860
+ this._floating = null;
1861
+ this._contentEl = null;
1862
+ this._triggerEl = null;
1863
+ }
1864
+ _setupFloating() {
1865
+ // Tear down any existing controller
1866
+ if (this._floating) {
1867
+ this._floating = null;
1868
+ }
1869
+ // Resolve the content element
1870
+ this._contentEl = this.querySelector('wc-popover-content');
1871
+ // Resolve the trigger element: first light-DOM child that is NOT wc-popover-content
1872
+ this._triggerEl =
1873
+ Array.from(this.children).find((c) => c.tagName.toLowerCase() !== 'wc-popover-content') ?? null;
1874
+ if (!this._triggerEl || !this._contentEl)
1875
+ return;
1876
+ const triggerMode = this.trigger === 'manual'
1877
+ ? 'manual'
1878
+ : this.trigger;
1879
+ this._floating = new FloatingController(this, {
1880
+ placement: this.placement,
1881
+ strategy: 'fixed',
1882
+ offset: this.offset,
1883
+ trigger: triggerMode,
1884
+ closeOnClickOutside: true,
1885
+ onOpenChange: (isOpen) => {
1886
+ this.open = isOpen;
1887
+ if (this._contentEl) {
1888
+ this._contentEl.open = isOpen;
1889
+ }
1890
+ this.dispatchEvent(new CustomEvent(isOpen ? 'wc-popover--open' : 'wc-popover--close', {
1891
+ bubbles: true,
1892
+ composed: true,
1893
+ }));
1894
+ },
1895
+ });
1896
+ this._floating.setElements(this._triggerEl, this._contentEl);
1897
+ if (this.open) {
1898
+ this._floating.open();
1899
+ this._contentEl.open = true;
1900
+ }
1901
+ }
1902
+ connectedCallback() {
1903
+ super.connectedCallback();
1904
+ }
1905
+ firstUpdated() {
1906
+ this._setupFloating();
1907
+ }
1908
+ updated(changedProps) {
1909
+ if (changedProps.has('trigger') ||
1910
+ changedProps.has('placement') ||
1911
+ changedProps.has('offset')) {
1912
+ this._setupFloating();
1913
+ }
1914
+ if (changedProps.has('open') && this._floating) {
1915
+ if (this.open && !this._floating.isOpen) {
1916
+ this._floating.open();
1917
+ if (this._contentEl)
1918
+ this._contentEl.open = true;
1919
+ }
1920
+ else if (!this.open && this._floating.isOpen) {
1921
+ this._floating.close();
1922
+ if (this._contentEl)
1923
+ this._contentEl.open = false;
1924
+ }
1925
+ }
1926
+ }
1927
+ /**
1928
+ * Programmatically opens the popover.
1929
+ */
1930
+ show() {
1931
+ if (this._floating && !this._floating.isOpen) {
1932
+ this._floating.open();
1933
+ }
1934
+ else if (!this._floating) {
1935
+ this.open = true;
1936
+ }
1937
+ }
1938
+ /**
1939
+ * Programmatically closes the popover.
1940
+ */
1941
+ hide() {
1942
+ if (this._floating && this._floating.isOpen) {
1943
+ this._floating.close();
1944
+ }
1945
+ else if (!this._floating) {
1946
+ this.open = false;
1947
+ }
1948
+ }
1949
+ render() {
1950
+ return b `<slot></slot>`;
1951
+ }
1952
+ };
1953
+ Popover.styles = [css_248z];
1954
+ __decorate([
1955
+ n({ reflect: true })
1956
+ ], Popover.prototype, "trigger", void 0);
1957
+ __decorate([
1958
+ n({ reflect: true })
1959
+ ], Popover.prototype, "placement", void 0);
1960
+ __decorate([
1961
+ n({ type: Boolean, reflect: true })
1962
+ ], Popover.prototype, "open", void 0);
1963
+ __decorate([
1964
+ n({ type: Number })
1965
+ ], Popover.prototype, "offset", void 0);
1966
+ Popover = __decorate([
1967
+ IndividualComponent
1968
+ ], Popover);
1969
+
1970
+ export { FloatingController as F, Popover as P };
1971
+ //# sourceMappingURL=popover-NC7b1lTq.js.map