zignal-stencil-library 1.0.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 (294) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/app-globals-V2Kpy_OQ.js +8 -0
  3. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
  4. package/dist/cjs/autocomplete-select_18.cjs.entry.js +41433 -0
  5. package/dist/cjs/autocomplete-select_18.cjs.entry.js.map +1 -0
  6. package/dist/cjs/index-C4CtrJXU.js +2199 -0
  7. package/dist/cjs/index-C4CtrJXU.js.map +1 -0
  8. package/dist/cjs/index-tRPYdc8n.js +1927 -0
  9. package/dist/cjs/index-tRPYdc8n.js.map +1 -0
  10. package/dist/cjs/index.cjs.js +7 -0
  11. package/dist/cjs/index.cjs.js.map +1 -0
  12. package/dist/cjs/loader.cjs.js +16 -0
  13. package/dist/cjs/loader.cjs.js.map +1 -0
  14. package/dist/cjs/zignal-stencil-library.cjs.js +28 -0
  15. package/dist/cjs/zignal-stencil-library.cjs.js.map +1 -0
  16. package/dist/collection/api/index.js +132 -0
  17. package/dist/collection/api/index.js.map +1 -0
  18. package/dist/collection/collection-manifest.json +29 -0
  19. package/dist/collection/components/autocomplete-select/autocomplete-select.css +1 -0
  20. package/dist/collection/components/autocomplete-select/autocomplete-select.js +230 -0
  21. package/dist/collection/components/autocomplete-select/autocomplete-select.js.map +1 -0
  22. package/dist/collection/components/channel-box/channel-box.css +1 -0
  23. package/dist/collection/components/channel-box/channel-box.js +93 -0
  24. package/dist/collection/components/channel-box/channel-box.js.map +1 -0
  25. package/dist/collection/components/chat-app/chat-app.css +1 -0
  26. package/dist/collection/components/chat-app/chat-app.js +227 -0
  27. package/dist/collection/components/chat-app/chat-app.js.map +1 -0
  28. package/dist/collection/components/chat-header/chat-header.css +1 -0
  29. package/dist/collection/components/chat-header/chat-header.js +45 -0
  30. package/dist/collection/components/chat-header/chat-header.js.map +1 -0
  31. package/dist/collection/components/chat-input/chat-input.css +1 -0
  32. package/dist/collection/components/chat-input/chat-input.js +118 -0
  33. package/dist/collection/components/chat-input/chat-input.js.map +1 -0
  34. package/dist/collection/components/dialog-editor/dialog-editor.css +1 -0
  35. package/dist/collection/components/dialog-editor/dialog-editor.js +176 -0
  36. package/dist/collection/components/dialog-editor/dialog-editor.js.map +1 -0
  37. package/dist/collection/components/dialog-preview-media/dialog-preview-media.css +1 -0
  38. package/dist/collection/components/dialog-preview-media/dialog-preview-media.js +96 -0
  39. package/dist/collection/components/dialog-preview-media/dialog-preview-media.js.map +1 -0
  40. package/dist/collection/components/dialog-search/dialog-search.css +1 -0
  41. package/dist/collection/components/dialog-search/dialog-search.js +105 -0
  42. package/dist/collection/components/dialog-search/dialog-search.js.map +1 -0
  43. package/dist/collection/components/internal-component/chat-item.js +28 -0
  44. package/dist/collection/components/internal-component/chat-item.js.map +1 -0
  45. package/dist/collection/components/internal-component/icon.js +9 -0
  46. package/dist/collection/components/internal-component/icon.js.map +1 -0
  47. package/dist/collection/components/internal-component/tag-or-status-item.js +9 -0
  48. package/dist/collection/components/internal-component/tag-or-status-item.js.map +1 -0
  49. package/dist/collection/components/internal-component/z-button.js +24 -0
  50. package/dist/collection/components/internal-component/z-button.js.map +1 -0
  51. package/dist/collection/components/internal-component/z-icon-button.js +23 -0
  52. package/dist/collection/components/internal-component/z-icon-button.js.map +1 -0
  53. package/dist/collection/components/internal-component/z-input-area.js +8 -0
  54. package/dist/collection/components/internal-component/z-input-area.js.map +1 -0
  55. package/dist/collection/components/internal-component/z-input.js +8 -0
  56. package/dist/collection/components/internal-component/z-input.js.map +1 -0
  57. package/dist/collection/components/internal-component/z-select-input.js +9 -0
  58. package/dist/collection/components/internal-component/z-select-input.js.map +1 -0
  59. package/dist/collection/components/menu-list/menu-list.css +1 -0
  60. package/dist/collection/components/menu-list/menu-list.js +168 -0
  61. package/dist/collection/components/menu-list/menu-list.js.map +1 -0
  62. package/dist/collection/components/message-box/message-box.css +1 -0
  63. package/dist/collection/components/message-box/message-box.js +179 -0
  64. package/dist/collection/components/message-box/message-box.js.map +1 -0
  65. package/dist/collection/components/message-content/message-content.css +1 -0
  66. package/dist/collection/components/message-content/message-content.js +98 -0
  67. package/dist/collection/components/message-content/message-content.js.map +1 -0
  68. package/dist/collection/components/message-item/message-item.css +1 -0
  69. package/dist/collection/components/message-item/message-item.js +115 -0
  70. package/dist/collection/components/message-item/message-item.js.map +1 -0
  71. package/dist/collection/components/profile-history/profile-history.css +1 -0
  72. package/dist/collection/components/profile-history/profile-history.js +18 -0
  73. package/dist/collection/components/profile-history/profile-history.js.map +1 -0
  74. package/dist/collection/components/profile-info/profile-info.css +1 -0
  75. package/dist/collection/components/profile-info/profile-info.js +255 -0
  76. package/dist/collection/components/profile-info/profile-info.js.map +1 -0
  77. package/dist/collection/components/profile-media/profile-media.css +1 -0
  78. package/dist/collection/components/profile-media/profile-media.js +18 -0
  79. package/dist/collection/components/profile-media/profile-media.js.map +1 -0
  80. package/dist/collection/components/profile-tabs/profile-tabs.css +1 -0
  81. package/dist/collection/components/profile-tabs/profile-tabs.js +43 -0
  82. package/dist/collection/components/profile-tabs/profile-tabs.js.map +1 -0
  83. package/dist/collection/components/search-box/search-box.css +1 -0
  84. package/dist/collection/components/search-box/search-box.js +71 -0
  85. package/dist/collection/components/search-box/search-box.js.map +1 -0
  86. package/dist/collection/components/tag-popper/tag-popper.css +1 -0
  87. package/dist/collection/components/tag-popper/tag-popper.js +124 -0
  88. package/dist/collection/components/tag-popper/tag-popper.js.map +1 -0
  89. package/dist/collection/global/i18n.js +13 -0
  90. package/dist/collection/global/i18n.js.map +1 -0
  91. package/dist/collection/index.js +11 -0
  92. package/dist/collection/index.js.map +1 -0
  93. package/dist/collection/postcss/property-to-variable.js +54 -0
  94. package/dist/collection/store/store.js +25 -0
  95. package/dist/collection/store/store.js.map +1 -0
  96. package/dist/collection/utils/axios.js +11 -0
  97. package/dist/collection/utils/axios.js.map +1 -0
  98. package/dist/collection/utils/constant.js +5 -0
  99. package/dist/collection/utils/constant.js.map +1 -0
  100. package/dist/collection/utils/dayjs.js +175 -0
  101. package/dist/collection/utils/dayjs.js.map +1 -0
  102. package/dist/collection/utils/socket.js +59 -0
  103. package/dist/collection/utils/socket.js.map +1 -0
  104. package/dist/collection/utils/utils.js +8 -0
  105. package/dist/collection/utils/utils.js.map +1 -0
  106. package/dist/components/autocomplete-select.d.ts +11 -0
  107. package/dist/components/autocomplete-select.js +9 -0
  108. package/dist/components/autocomplete-select.js.map +1 -0
  109. package/dist/components/channel-box.d.ts +11 -0
  110. package/dist/components/channel-box.js +9 -0
  111. package/dist/components/channel-box.js.map +1 -0
  112. package/dist/components/chat-app.d.ts +11 -0
  113. package/dist/components/chat-app.js +226 -0
  114. package/dist/components/chat-app.js.map +1 -0
  115. package/dist/components/chat-header.d.ts +11 -0
  116. package/dist/components/chat-header.js +9 -0
  117. package/dist/components/chat-header.js.map +1 -0
  118. package/dist/components/chat-input.d.ts +11 -0
  119. package/dist/components/chat-input.js +9 -0
  120. package/dist/components/chat-input.js.map +1 -0
  121. package/dist/components/dialog-editor.d.ts +11 -0
  122. package/dist/components/dialog-editor.js +9 -0
  123. package/dist/components/dialog-editor.js.map +1 -0
  124. package/dist/components/dialog-preview-media.d.ts +11 -0
  125. package/dist/components/dialog-preview-media.js +9 -0
  126. package/dist/components/dialog-preview-media.js.map +1 -0
  127. package/dist/components/dialog-search.d.ts +11 -0
  128. package/dist/components/dialog-search.js +9 -0
  129. package/dist/components/dialog-search.js.map +1 -0
  130. package/dist/components/index.d.ts +33 -0
  131. package/dist/components/index.js +2199 -0
  132. package/dist/components/index.js.map +1 -0
  133. package/dist/components/menu-list.d.ts +11 -0
  134. package/dist/components/menu-list.js +9 -0
  135. package/dist/components/menu-list.js.map +1 -0
  136. package/dist/components/message-box.d.ts +11 -0
  137. package/dist/components/message-box.js +9 -0
  138. package/dist/components/message-box.js.map +1 -0
  139. package/dist/components/message-content.d.ts +11 -0
  140. package/dist/components/message-content.js +9 -0
  141. package/dist/components/message-content.js.map +1 -0
  142. package/dist/components/message-item.d.ts +11 -0
  143. package/dist/components/message-item.js +9 -0
  144. package/dist/components/message-item.js.map +1 -0
  145. package/dist/components/p-6xqe-pLQ.js +1509 -0
  146. package/dist/components/p-6xqe-pLQ.js.map +1 -0
  147. package/dist/components/p-B8jcXcXq.js +10 -0
  148. package/dist/components/p-B8jcXcXq.js.map +1 -0
  149. package/dist/components/p-BAxNTWPI.js +32 -0
  150. package/dist/components/p-BAxNTWPI.js.map +1 -0
  151. package/dist/components/p-BZ4TvILZ.js +24 -0
  152. package/dist/components/p-BZ4TvILZ.js.map +1 -0
  153. package/dist/components/p-BZ_KFdA7.js +99 -0
  154. package/dist/components/p-BZ_KFdA7.js.map +1 -0
  155. package/dist/components/p-BaEi6GXz.js +27448 -0
  156. package/dist/components/p-BaEi6GXz.js.map +1 -0
  157. package/dist/components/p-BcC6bTqM.js +104 -0
  158. package/dist/components/p-BcC6bTqM.js.map +1 -0
  159. package/dist/components/p-Beycm8NN.js +3027 -0
  160. package/dist/components/p-Beycm8NN.js.map +1 -0
  161. package/dist/components/p-Bf89k6bd.js +3932 -0
  162. package/dist/components/p-Bf89k6bd.js.map +1 -0
  163. package/dist/components/p-BtkLsQfZ.js +17 -0
  164. package/dist/components/p-BtkLsQfZ.js.map +1 -0
  165. package/dist/components/p-C9EokLnL.js +102 -0
  166. package/dist/components/p-C9EokLnL.js.map +1 -0
  167. package/dist/components/p-CHaS9akB.js +33 -0
  168. package/dist/components/p-CHaS9akB.js.map +1 -0
  169. package/dist/components/p-CQZRPVaY.js +1715 -0
  170. package/dist/components/p-CQZRPVaY.js.map +1 -0
  171. package/dist/components/p-CS8eN-II.js +60 -0
  172. package/dist/components/p-CS8eN-II.js.map +1 -0
  173. package/dist/components/p-CUmphmPD.js +48 -0
  174. package/dist/components/p-CUmphmPD.js.map +1 -0
  175. package/dist/components/p-ChdOg2lI.js +90 -0
  176. package/dist/components/p-ChdOg2lI.js.map +1 -0
  177. package/dist/components/p-CkqA8kPB.js +210 -0
  178. package/dist/components/p-CkqA8kPB.js.map +1 -0
  179. package/dist/components/p-CmWIRJ5t.js +91 -0
  180. package/dist/components/p-CmWIRJ5t.js.map +1 -0
  181. package/dist/components/p-CzESq-LE.js +88 -0
  182. package/dist/components/p-CzESq-LE.js.map +1 -0
  183. package/dist/components/p-DD3M-jE2.js +87 -0
  184. package/dist/components/p-DD3M-jE2.js.map +1 -0
  185. package/dist/components/p-DFjLV5Vy.js +71 -0
  186. package/dist/components/p-DFjLV5Vy.js.map +1 -0
  187. package/dist/components/p-DYI8iHdE.js +279 -0
  188. package/dist/components/p-DYI8iHdE.js.map +1 -0
  189. package/dist/components/p-DfRY75vS.js +16 -0
  190. package/dist/components/p-DfRY75vS.js.map +1 -0
  191. package/dist/components/p-DspEZ2pG.js +85 -0
  192. package/dist/components/p-DspEZ2pG.js.map +1 -0
  193. package/dist/components/p-LCZ_Vyoy.js +4084 -0
  194. package/dist/components/p-LCZ_Vyoy.js.map +1 -0
  195. package/dist/components/p-N-wb2wDd.js +236 -0
  196. package/dist/components/p-N-wb2wDd.js.map +1 -0
  197. package/dist/components/p-Urxy5c9-.js +154 -0
  198. package/dist/components/p-Urxy5c9-.js.map +1 -0
  199. package/dist/components/p-nz95LAGz.js +33 -0
  200. package/dist/components/p-nz95LAGz.js.map +1 -0
  201. package/dist/components/profile-history.d.ts +11 -0
  202. package/dist/components/profile-history.js +9 -0
  203. package/dist/components/profile-history.js.map +1 -0
  204. package/dist/components/profile-info.d.ts +11 -0
  205. package/dist/components/profile-info.js +9 -0
  206. package/dist/components/profile-info.js.map +1 -0
  207. package/dist/components/profile-media.d.ts +11 -0
  208. package/dist/components/profile-media.js +9 -0
  209. package/dist/components/profile-media.js.map +1 -0
  210. package/dist/components/profile-tabs.d.ts +11 -0
  211. package/dist/components/profile-tabs.js +9 -0
  212. package/dist/components/profile-tabs.js.map +1 -0
  213. package/dist/components/search-box.d.ts +11 -0
  214. package/dist/components/search-box.js +9 -0
  215. package/dist/components/search-box.js.map +1 -0
  216. package/dist/components/tag-popper.d.ts +11 -0
  217. package/dist/components/tag-popper.js +9 -0
  218. package/dist/components/tag-popper.js.map +1 -0
  219. package/dist/esm/app-globals-DQuL1Twl.js +6 -0
  220. package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
  221. package/dist/esm/autocomplete-select.channel-box.chat-app.chat-header.chat-input.dialog-editor.dialog-preview-media.dialog-search.menu-list.message-box.message-content.message-item.profile-history.profile-info.profile-media.profile-tabs.search-box.tag-popper.entry.js.map +1 -0
  222. package/dist/esm/autocomplete-select_18.entry.js +41414 -0
  223. package/dist/esm/autocomplete-select_18.entry.js.map +1 -0
  224. package/dist/esm/index-C0ey1F02.js +1917 -0
  225. package/dist/esm/index-C0ey1F02.js.map +1 -0
  226. package/dist/esm/index-DasOEma2.js +2197 -0
  227. package/dist/esm/index-DasOEma2.js.map +1 -0
  228. package/dist/esm/index.js +4 -0
  229. package/dist/esm/index.js.map +1 -0
  230. package/dist/esm/loader.js +14 -0
  231. package/dist/esm/loader.js.map +1 -0
  232. package/dist/esm/zignal-stencil-library.js +24 -0
  233. package/dist/esm/zignal-stencil-library.js.map +1 -0
  234. package/dist/index.cjs.js +1 -0
  235. package/dist/index.js +1 -0
  236. package/dist/types/api/index.d.ts +12 -0
  237. package/dist/types/api/index.type.d.ts +98 -0
  238. package/dist/types/components/autocomplete-select/autocomplete-select.d.ts +19 -0
  239. package/dist/types/components/channel-box/channel-box.d.ts +11 -0
  240. package/dist/types/components/chat-app/chat-app.d.ts +25 -0
  241. package/dist/types/components/chat-header/chat-header.d.ts +3 -0
  242. package/dist/types/components/chat-input/chat-input.d.ts +9 -0
  243. package/dist/types/components/dialog-editor/dialog-editor.d.ts +16 -0
  244. package/dist/types/components/dialog-preview-media/dialog-preview-media.d.ts +8 -0
  245. package/dist/types/components/dialog-search/dialog-search.d.ts +18 -0
  246. package/dist/types/components/internal-component/chat-item.d.ts +6 -0
  247. package/dist/types/components/internal-component/icon.d.ts +7 -0
  248. package/dist/types/components/internal-component/tag-or-status-item.d.ts +7 -0
  249. package/dist/types/components/internal-component/z-button.d.ts +15 -0
  250. package/dist/types/components/internal-component/z-icon-button.d.ts +13 -0
  251. package/dist/types/components/internal-component/z-input-area.d.ts +13 -0
  252. package/dist/types/components/internal-component/z-input.d.ts +13 -0
  253. package/dist/types/components/internal-component/z-select-input.d.ts +13 -0
  254. package/dist/types/components/menu-list/menu-list.d.ts +17 -0
  255. package/dist/types/components/message-box/message-box.d.ts +19 -0
  256. package/dist/types/components/message-content/message-content.d.ts +8 -0
  257. package/dist/types/components/message-item/message-item.d.ts +9 -0
  258. package/dist/types/components/profile-history/profile-history.d.ts +3 -0
  259. package/dist/types/components/profile-info/profile-info.d.ts +29 -0
  260. package/dist/types/components/profile-media/profile-media.d.ts +3 -0
  261. package/dist/types/components/profile-tabs/profile-tabs.d.ts +8 -0
  262. package/dist/types/components/search-box/search-box.d.ts +10 -0
  263. package/dist/types/components/tag-popper/tag-popper.d.ts +13 -0
  264. package/dist/types/components.d.ts +498 -0
  265. package/dist/types/global/i18n.d.ts +2 -0
  266. package/dist/types/index.d.ts +11 -0
  267. package/dist/types/stencil-public-runtime.d.ts +1709 -0
  268. package/dist/types/store/store.d.ts +16 -0
  269. package/dist/types/store/store.type.d.ts +132 -0
  270. package/dist/types/utils/axios.d.ts +1 -0
  271. package/dist/types/utils/constant.d.ts +1 -0
  272. package/dist/types/utils/dayjs.d.ts +31 -0
  273. package/dist/types/utils/socket.d.ts +6 -0
  274. package/dist/types/utils/utils.d.ts +2 -0
  275. package/dist/zignal-stencil-library/index.esm.js +2 -0
  276. package/dist/zignal-stencil-library/index.esm.js.map +1 -0
  277. package/dist/zignal-stencil-library/loader.esm.js.map +1 -0
  278. package/dist/zignal-stencil-library/p-C0ey1F02.js +3 -0
  279. package/dist/zignal-stencil-library/p-C0ey1F02.js.map +1 -0
  280. package/dist/zignal-stencil-library/p-DQuL1Twl.js +2 -0
  281. package/dist/zignal-stencil-library/p-DQuL1Twl.js.map +1 -0
  282. package/dist/zignal-stencil-library/p-DasOEma2.js +2 -0
  283. package/dist/zignal-stencil-library/p-DasOEma2.js.map +1 -0
  284. package/dist/zignal-stencil-library/p-ee2ebe92.entry.js +9777 -0
  285. package/dist/zignal-stencil-library/p-ee2ebe92.entry.js.map +1 -0
  286. package/dist/zignal-stencil-library/zignal-stencil-library.css +1 -0
  287. package/dist/zignal-stencil-library/zignal-stencil-library.esm.js +2 -0
  288. package/dist/zignal-stencil-library/zignal-stencil-library.esm.js.map +1 -0
  289. package/loader/cdn.js +1 -0
  290. package/loader/index.cjs.js +1 -0
  291. package/loader/index.d.ts +24 -0
  292. package/loader/index.es2017.js +1 -0
  293. package/loader/index.js +2 -0
  294. package/package.json +73 -0
@@ -0,0 +1,1509 @@
1
+ /**
2
+ * Custom positioning reference element.
3
+ * @see https://floating-ui.com/docs/virtual-elements
4
+ */
5
+
6
+ const min = Math.min;
7
+ const max = Math.max;
8
+ const round = Math.round;
9
+ const floor = Math.floor;
10
+ const createCoords = v => ({
11
+ x: v,
12
+ y: v
13
+ });
14
+ const oppositeSideMap = {
15
+ left: 'right',
16
+ right: 'left',
17
+ bottom: 'top',
18
+ top: 'bottom'
19
+ };
20
+ const oppositeAlignmentMap = {
21
+ start: 'end',
22
+ end: 'start'
23
+ };
24
+ function clamp(start, value, end) {
25
+ return max(start, min(value, end));
26
+ }
27
+ function evaluate(value, param) {
28
+ return typeof value === 'function' ? value(param) : value;
29
+ }
30
+ function getSide(placement) {
31
+ return placement.split('-')[0];
32
+ }
33
+ function getAlignment(placement) {
34
+ return placement.split('-')[1];
35
+ }
36
+ function getOppositeAxis(axis) {
37
+ return axis === 'x' ? 'y' : 'x';
38
+ }
39
+ function getAxisLength(axis) {
40
+ return axis === 'y' ? 'height' : 'width';
41
+ }
42
+ const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
43
+ function getSideAxis(placement) {
44
+ return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
45
+ }
46
+ function getAlignmentAxis(placement) {
47
+ return getOppositeAxis(getSideAxis(placement));
48
+ }
49
+ function getAlignmentSides(placement, rects, rtl) {
50
+ if (rtl === void 0) {
51
+ rtl = false;
52
+ }
53
+ const alignment = getAlignment(placement);
54
+ const alignmentAxis = getAlignmentAxis(placement);
55
+ const length = getAxisLength(alignmentAxis);
56
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
57
+ if (rects.reference[length] > rects.floating[length]) {
58
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
59
+ }
60
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
61
+ }
62
+ function getExpandedPlacements(placement) {
63
+ const oppositePlacement = getOppositePlacement(placement);
64
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
65
+ }
66
+ function getOppositeAlignmentPlacement(placement) {
67
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
68
+ }
69
+ const lrPlacement = ['left', 'right'];
70
+ const rlPlacement = ['right', 'left'];
71
+ const tbPlacement = ['top', 'bottom'];
72
+ const btPlacement = ['bottom', 'top'];
73
+ function getSideList(side, isStart, rtl) {
74
+ switch (side) {
75
+ case 'top':
76
+ case 'bottom':
77
+ if (rtl) return isStart ? rlPlacement : lrPlacement;
78
+ return isStart ? lrPlacement : rlPlacement;
79
+ case 'left':
80
+ case 'right':
81
+ return isStart ? tbPlacement : btPlacement;
82
+ default:
83
+ return [];
84
+ }
85
+ }
86
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
87
+ const alignment = getAlignment(placement);
88
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
89
+ if (alignment) {
90
+ list = list.map(side => side + "-" + alignment);
91
+ if (flipAlignment) {
92
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
93
+ }
94
+ }
95
+ return list;
96
+ }
97
+ function getOppositePlacement(placement) {
98
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
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
+ * Computes the `x` and `y` coordinates that will place the floating element
194
+ * next to a given reference element.
195
+ *
196
+ * This export does not have any `platform` interface logic. You will need to
197
+ * write one for the platform you are using Floating UI with.
198
+ */
199
+ const computePosition$1 = async (reference, floating, config) => {
200
+ const {
201
+ placement = 'bottom',
202
+ strategy = 'absolute',
203
+ middleware = [],
204
+ platform
205
+ } = config;
206
+ const validMiddleware = middleware.filter(Boolean);
207
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
208
+ let rects = await platform.getElementRects({
209
+ reference,
210
+ floating,
211
+ strategy
212
+ });
213
+ let {
214
+ x,
215
+ y
216
+ } = computeCoordsFromPlacement(rects, placement, rtl);
217
+ let statefulPlacement = placement;
218
+ let middlewareData = {};
219
+ let resetCount = 0;
220
+ for (let i = 0; i < validMiddleware.length; i++) {
221
+ const {
222
+ name,
223
+ fn
224
+ } = validMiddleware[i];
225
+ const {
226
+ x: nextX,
227
+ y: nextY,
228
+ data,
229
+ reset
230
+ } = await fn({
231
+ x,
232
+ y,
233
+ initialPlacement: placement,
234
+ placement: statefulPlacement,
235
+ strategy,
236
+ middlewareData,
237
+ rects,
238
+ platform,
239
+ elements: {
240
+ reference,
241
+ floating
242
+ }
243
+ });
244
+ x = nextX != null ? nextX : x;
245
+ y = nextY != null ? nextY : y;
246
+ middlewareData = {
247
+ ...middlewareData,
248
+ [name]: {
249
+ ...middlewareData[name],
250
+ ...data
251
+ }
252
+ };
253
+ if (reset && resetCount <= 50) {
254
+ resetCount++;
255
+ if (typeof reset === 'object') {
256
+ if (reset.placement) {
257
+ statefulPlacement = reset.placement;
258
+ }
259
+ if (reset.rects) {
260
+ rects = reset.rects === true ? await platform.getElementRects({
261
+ reference,
262
+ floating,
263
+ strategy
264
+ }) : reset.rects;
265
+ }
266
+ ({
267
+ x,
268
+ y
269
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
270
+ }
271
+ i = -1;
272
+ }
273
+ }
274
+ return {
275
+ x,
276
+ y,
277
+ placement: statefulPlacement,
278
+ strategy,
279
+ middlewareData
280
+ };
281
+ };
282
+
283
+ /**
284
+ * Resolves with an object of overflow side offsets that determine how much the
285
+ * element is overflowing a given clipping boundary on each side.
286
+ * - positive = overflowing the boundary by that number of pixels
287
+ * - negative = how many pixels left before it will overflow
288
+ * - 0 = lies flush with the boundary
289
+ * @see https://floating-ui.com/docs/detectOverflow
290
+ */
291
+ async function detectOverflow(state, options) {
292
+ var _await$platform$isEle;
293
+ if (options === void 0) {
294
+ options = {};
295
+ }
296
+ const {
297
+ x,
298
+ y,
299
+ platform,
300
+ rects,
301
+ elements,
302
+ strategy
303
+ } = state;
304
+ const {
305
+ boundary = 'clippingAncestors',
306
+ rootBoundary = 'viewport',
307
+ elementContext = 'floating',
308
+ altBoundary = false,
309
+ padding = 0
310
+ } = evaluate(options, state);
311
+ const paddingObject = getPaddingObject(padding);
312
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
313
+ const element = elements[altBoundary ? altContext : elementContext];
314
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
315
+ 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))),
316
+ boundary,
317
+ rootBoundary,
318
+ strategy
319
+ }));
320
+ const rect = elementContext === 'floating' ? {
321
+ x,
322
+ y,
323
+ width: rects.floating.width,
324
+ height: rects.floating.height
325
+ } : rects.reference;
326
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
327
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
328
+ x: 1,
329
+ y: 1
330
+ } : {
331
+ x: 1,
332
+ y: 1
333
+ };
334
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
335
+ elements,
336
+ rect,
337
+ offsetParent,
338
+ strategy
339
+ }) : rect);
340
+ return {
341
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
342
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
343
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
344
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
345
+ };
346
+ }
347
+
348
+ /**
349
+ * Optimizes the visibility of the floating element by flipping the `placement`
350
+ * in order to keep it in view when the preferred placement(s) will overflow the
351
+ * clipping boundary. Alternative to `autoPlacement`.
352
+ * @see https://floating-ui.com/docs/flip
353
+ */
354
+ const flip$1 = function (options) {
355
+ if (options === void 0) {
356
+ options = {};
357
+ }
358
+ return {
359
+ name: 'flip',
360
+ options,
361
+ async fn(state) {
362
+ var _middlewareData$arrow, _middlewareData$flip;
363
+ const {
364
+ placement,
365
+ middlewareData,
366
+ rects,
367
+ initialPlacement,
368
+ platform,
369
+ elements
370
+ } = state;
371
+ const {
372
+ mainAxis: checkMainAxis = true,
373
+ crossAxis: checkCrossAxis = true,
374
+ fallbackPlacements: specifiedFallbackPlacements,
375
+ fallbackStrategy = 'bestFit',
376
+ fallbackAxisSideDirection = 'none',
377
+ flipAlignment = true,
378
+ ...detectOverflowOptions
379
+ } = evaluate(options, state);
380
+
381
+ // If a reset by the arrow was caused due to an alignment offset being
382
+ // added, we should skip any logic now since `flip()` has already done its
383
+ // work.
384
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
385
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
386
+ return {};
387
+ }
388
+ const side = getSide(placement);
389
+ const initialSideAxis = getSideAxis(initialPlacement);
390
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
391
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
392
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
393
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
394
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
395
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
396
+ }
397
+ const placements = [initialPlacement, ...fallbackPlacements];
398
+ const overflow = await detectOverflow(state, detectOverflowOptions);
399
+ const overflows = [];
400
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
401
+ if (checkMainAxis) {
402
+ overflows.push(overflow[side]);
403
+ }
404
+ if (checkCrossAxis) {
405
+ const sides = getAlignmentSides(placement, rects, rtl);
406
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
407
+ }
408
+ overflowsData = [...overflowsData, {
409
+ placement,
410
+ overflows
411
+ }];
412
+
413
+ // One or more sides is overflowing.
414
+ if (!overflows.every(side => side <= 0)) {
415
+ var _middlewareData$flip2, _overflowsData$filter;
416
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
417
+ const nextPlacement = placements[nextIndex];
418
+ if (nextPlacement) {
419
+ const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
420
+ if (!ignoreCrossAxisOverflow ||
421
+ // We leave the current main axis only if every placement on that axis
422
+ // overflows the main axis.
423
+ overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
424
+ // Try next placement and re-run the lifecycle.
425
+ return {
426
+ data: {
427
+ index: nextIndex,
428
+ overflows: overflowsData
429
+ },
430
+ reset: {
431
+ placement: nextPlacement
432
+ }
433
+ };
434
+ }
435
+ }
436
+
437
+ // First, find the candidates that fit on the mainAxis side of overflow,
438
+ // then find the placement that fits the best on the main crossAxis side.
439
+ 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;
440
+
441
+ // Otherwise fallback.
442
+ if (!resetPlacement) {
443
+ switch (fallbackStrategy) {
444
+ case 'bestFit':
445
+ {
446
+ var _overflowsData$filter2;
447
+ const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
448
+ if (hasFallbackAxisSideDirection) {
449
+ const currentSideAxis = getSideAxis(d.placement);
450
+ return currentSideAxis === initialSideAxis ||
451
+ // Create a bias to the `y` side axis due to horizontal
452
+ // reading directions favoring greater width.
453
+ currentSideAxis === 'y';
454
+ }
455
+ return true;
456
+ }).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];
457
+ if (placement) {
458
+ resetPlacement = placement;
459
+ }
460
+ break;
461
+ }
462
+ case 'initialPlacement':
463
+ resetPlacement = initialPlacement;
464
+ break;
465
+ }
466
+ }
467
+ if (placement !== resetPlacement) {
468
+ return {
469
+ reset: {
470
+ placement: resetPlacement
471
+ }
472
+ };
473
+ }
474
+ }
475
+ return {};
476
+ }
477
+ };
478
+ };
479
+
480
+ const originSides = /*#__PURE__*/new Set(['left', 'top']);
481
+
482
+ // For type backwards-compatibility, the `OffsetOptions` type was also
483
+ // Derivable.
484
+
485
+ async function convertValueToCoords(state, options) {
486
+ const {
487
+ placement,
488
+ platform,
489
+ elements
490
+ } = state;
491
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
492
+ const side = getSide(placement);
493
+ const alignment = getAlignment(placement);
494
+ const isVertical = getSideAxis(placement) === 'y';
495
+ const mainAxisMulti = originSides.has(side) ? -1 : 1;
496
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
497
+ const rawValue = evaluate(options, state);
498
+
499
+ // eslint-disable-next-line prefer-const
500
+ let {
501
+ mainAxis,
502
+ crossAxis,
503
+ alignmentAxis
504
+ } = typeof rawValue === 'number' ? {
505
+ mainAxis: rawValue,
506
+ crossAxis: 0,
507
+ alignmentAxis: null
508
+ } : {
509
+ mainAxis: rawValue.mainAxis || 0,
510
+ crossAxis: rawValue.crossAxis || 0,
511
+ alignmentAxis: rawValue.alignmentAxis
512
+ };
513
+ if (alignment && typeof alignmentAxis === 'number') {
514
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
515
+ }
516
+ return isVertical ? {
517
+ x: crossAxis * crossAxisMulti,
518
+ y: mainAxis * mainAxisMulti
519
+ } : {
520
+ x: mainAxis * mainAxisMulti,
521
+ y: crossAxis * crossAxisMulti
522
+ };
523
+ }
524
+
525
+ /**
526
+ * Modifies the placement by translating the floating element along the
527
+ * specified axes.
528
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
529
+ * object may be passed.
530
+ * @see https://floating-ui.com/docs/offset
531
+ */
532
+ const offset$1 = function (options) {
533
+ if (options === void 0) {
534
+ options = 0;
535
+ }
536
+ return {
537
+ name: 'offset',
538
+ options,
539
+ async fn(state) {
540
+ var _middlewareData$offse, _middlewareData$arrow;
541
+ const {
542
+ x,
543
+ y,
544
+ placement,
545
+ middlewareData
546
+ } = state;
547
+ const diffCoords = await convertValueToCoords(state, options);
548
+
549
+ // If the placement is the same and the arrow caused an alignment offset
550
+ // then we don't need to change the positioning coordinates.
551
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
552
+ return {};
553
+ }
554
+ return {
555
+ x: x + diffCoords.x,
556
+ y: y + diffCoords.y,
557
+ data: {
558
+ ...diffCoords,
559
+ placement
560
+ }
561
+ };
562
+ }
563
+ };
564
+ };
565
+
566
+ /**
567
+ * Optimizes the visibility of the floating element by shifting it in order to
568
+ * keep it in view when it will overflow the clipping boundary.
569
+ * @see https://floating-ui.com/docs/shift
570
+ */
571
+ const shift$1 = function (options) {
572
+ if (options === void 0) {
573
+ options = {};
574
+ }
575
+ return {
576
+ name: 'shift',
577
+ options,
578
+ async fn(state) {
579
+ const {
580
+ x,
581
+ y,
582
+ placement
583
+ } = state;
584
+ const {
585
+ mainAxis: checkMainAxis = true,
586
+ crossAxis: checkCrossAxis = false,
587
+ limiter = {
588
+ fn: _ref => {
589
+ let {
590
+ x,
591
+ y
592
+ } = _ref;
593
+ return {
594
+ x,
595
+ y
596
+ };
597
+ }
598
+ },
599
+ ...detectOverflowOptions
600
+ } = evaluate(options, state);
601
+ const coords = {
602
+ x,
603
+ y
604
+ };
605
+ const overflow = await detectOverflow(state, detectOverflowOptions);
606
+ const crossAxis = getSideAxis(getSide(placement));
607
+ const mainAxis = getOppositeAxis(crossAxis);
608
+ let mainAxisCoord = coords[mainAxis];
609
+ let crossAxisCoord = coords[crossAxis];
610
+ if (checkMainAxis) {
611
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
612
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
613
+ const min = mainAxisCoord + overflow[minSide];
614
+ const max = mainAxisCoord - overflow[maxSide];
615
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
616
+ }
617
+ if (checkCrossAxis) {
618
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
619
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
620
+ const min = crossAxisCoord + overflow[minSide];
621
+ const max = crossAxisCoord - overflow[maxSide];
622
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
623
+ }
624
+ const limitedCoords = limiter.fn({
625
+ ...state,
626
+ [mainAxis]: mainAxisCoord,
627
+ [crossAxis]: crossAxisCoord
628
+ });
629
+ return {
630
+ ...limitedCoords,
631
+ data: {
632
+ x: limitedCoords.x - x,
633
+ y: limitedCoords.y - y,
634
+ enabled: {
635
+ [mainAxis]: checkMainAxis,
636
+ [crossAxis]: checkCrossAxis
637
+ }
638
+ }
639
+ };
640
+ }
641
+ };
642
+ };
643
+
644
+ function hasWindow() {
645
+ return typeof window !== 'undefined';
646
+ }
647
+ function getNodeName(node) {
648
+ if (isNode(node)) {
649
+ return (node.nodeName || '').toLowerCase();
650
+ }
651
+ // Mocked nodes in testing environments may not be instances of Node. By
652
+ // returning `#document` an infinite loop won't occur.
653
+ // https://github.com/floating-ui/floating-ui/issues/2317
654
+ return '#document';
655
+ }
656
+ function getWindow(node) {
657
+ var _node$ownerDocument;
658
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
659
+ }
660
+ function getDocumentElement(node) {
661
+ var _ref;
662
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
663
+ }
664
+ function isNode(value) {
665
+ if (!hasWindow()) {
666
+ return false;
667
+ }
668
+ return value instanceof Node || value instanceof getWindow(value).Node;
669
+ }
670
+ function isElement(value) {
671
+ if (!hasWindow()) {
672
+ return false;
673
+ }
674
+ return value instanceof Element || value instanceof getWindow(value).Element;
675
+ }
676
+ function isHTMLElement(value) {
677
+ if (!hasWindow()) {
678
+ return false;
679
+ }
680
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
681
+ }
682
+ function isShadowRoot(value) {
683
+ if (!hasWindow() || typeof ShadowRoot === 'undefined') {
684
+ return false;
685
+ }
686
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
687
+ }
688
+ const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
689
+ function isOverflowElement(element) {
690
+ const {
691
+ overflow,
692
+ overflowX,
693
+ overflowY,
694
+ display
695
+ } = getComputedStyle(element);
696
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
697
+ }
698
+ const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
699
+ function isTableElement(element) {
700
+ return tableElements.has(getNodeName(element));
701
+ }
702
+ const topLayerSelectors = [':popover-open', ':modal'];
703
+ function isTopLayer(element) {
704
+ return topLayerSelectors.some(selector => {
705
+ try {
706
+ return element.matches(selector);
707
+ } catch (_e) {
708
+ return false;
709
+ }
710
+ });
711
+ }
712
+ const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
713
+ const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
714
+ const containValues = ['paint', 'layout', 'strict', 'content'];
715
+ function isContainingBlock(elementOrCss) {
716
+ const webkit = isWebKit();
717
+ const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
718
+
719
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
720
+ // https://drafts.csswg.org/css-transforms-2/#individual-transforms
721
+ return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
722
+ }
723
+ function getContainingBlock(element) {
724
+ let currentNode = getParentNode(element);
725
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
726
+ if (isContainingBlock(currentNode)) {
727
+ return currentNode;
728
+ } else if (isTopLayer(currentNode)) {
729
+ return null;
730
+ }
731
+ currentNode = getParentNode(currentNode);
732
+ }
733
+ return null;
734
+ }
735
+ function isWebKit() {
736
+ if (typeof CSS === 'undefined' || !CSS.supports) return false;
737
+ return CSS.supports('-webkit-backdrop-filter', 'none');
738
+ }
739
+ const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
740
+ function isLastTraversableNode(node) {
741
+ return lastTraversableNodeNames.has(getNodeName(node));
742
+ }
743
+ function getComputedStyle(element) {
744
+ return getWindow(element).getComputedStyle(element);
745
+ }
746
+ function getNodeScroll(element) {
747
+ if (isElement(element)) {
748
+ return {
749
+ scrollLeft: element.scrollLeft,
750
+ scrollTop: element.scrollTop
751
+ };
752
+ }
753
+ return {
754
+ scrollLeft: element.scrollX,
755
+ scrollTop: element.scrollY
756
+ };
757
+ }
758
+ function getParentNode(node) {
759
+ if (getNodeName(node) === 'html') {
760
+ return node;
761
+ }
762
+ const result =
763
+ // Step into the shadow DOM of the parent of a slotted node.
764
+ node.assignedSlot ||
765
+ // DOM Element detected.
766
+ node.parentNode ||
767
+ // ShadowRoot detected.
768
+ isShadowRoot(node) && node.host ||
769
+ // Fallback.
770
+ getDocumentElement(node);
771
+ return isShadowRoot(result) ? result.host : result;
772
+ }
773
+ function getNearestOverflowAncestor(node) {
774
+ const parentNode = getParentNode(node);
775
+ if (isLastTraversableNode(parentNode)) {
776
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
777
+ }
778
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
779
+ return parentNode;
780
+ }
781
+ return getNearestOverflowAncestor(parentNode);
782
+ }
783
+ function getOverflowAncestors(node, list, traverseIframes) {
784
+ var _node$ownerDocument2;
785
+ if (list === void 0) {
786
+ list = [];
787
+ }
788
+ if (traverseIframes === void 0) {
789
+ traverseIframes = true;
790
+ }
791
+ const scrollableAncestor = getNearestOverflowAncestor(node);
792
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
793
+ const win = getWindow(scrollableAncestor);
794
+ if (isBody) {
795
+ const frameElement = getFrameElement(win);
796
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
797
+ }
798
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
799
+ }
800
+ function getFrameElement(win) {
801
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
802
+ }
803
+
804
+ function getCssDimensions(element) {
805
+ const css = getComputedStyle(element);
806
+ // In testing environments, the `width` and `height` properties are empty
807
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
808
+ let width = parseFloat(css.width) || 0;
809
+ let height = parseFloat(css.height) || 0;
810
+ const hasOffset = isHTMLElement(element);
811
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
812
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
813
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
814
+ if (shouldFallback) {
815
+ width = offsetWidth;
816
+ height = offsetHeight;
817
+ }
818
+ return {
819
+ width,
820
+ height,
821
+ $: shouldFallback
822
+ };
823
+ }
824
+
825
+ function unwrapElement(element) {
826
+ return !isElement(element) ? element.contextElement : element;
827
+ }
828
+
829
+ function getScale(element) {
830
+ const domElement = unwrapElement(element);
831
+ if (!isHTMLElement(domElement)) {
832
+ return createCoords(1);
833
+ }
834
+ const rect = domElement.getBoundingClientRect();
835
+ const {
836
+ width,
837
+ height,
838
+ $
839
+ } = getCssDimensions(domElement);
840
+ let x = ($ ? round(rect.width) : rect.width) / width;
841
+ let y = ($ ? round(rect.height) : rect.height) / height;
842
+
843
+ // 0, NaN, or Infinity should always fallback to 1.
844
+
845
+ if (!x || !Number.isFinite(x)) {
846
+ x = 1;
847
+ }
848
+ if (!y || !Number.isFinite(y)) {
849
+ y = 1;
850
+ }
851
+ return {
852
+ x,
853
+ y
854
+ };
855
+ }
856
+
857
+ const noOffsets = /*#__PURE__*/createCoords(0);
858
+ function getVisualOffsets(element) {
859
+ const win = getWindow(element);
860
+ if (!isWebKit() || !win.visualViewport) {
861
+ return noOffsets;
862
+ }
863
+ return {
864
+ x: win.visualViewport.offsetLeft,
865
+ y: win.visualViewport.offsetTop
866
+ };
867
+ }
868
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
869
+ if (isFixed === void 0) {
870
+ isFixed = false;
871
+ }
872
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
873
+ return false;
874
+ }
875
+ return isFixed;
876
+ }
877
+
878
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
879
+ if (includeScale === void 0) {
880
+ includeScale = false;
881
+ }
882
+ if (isFixedStrategy === void 0) {
883
+ isFixedStrategy = false;
884
+ }
885
+ const clientRect = element.getBoundingClientRect();
886
+ const domElement = unwrapElement(element);
887
+ let scale = createCoords(1);
888
+ if (includeScale) {
889
+ if (offsetParent) {
890
+ if (isElement(offsetParent)) {
891
+ scale = getScale(offsetParent);
892
+ }
893
+ } else {
894
+ scale = getScale(element);
895
+ }
896
+ }
897
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
898
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
899
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
900
+ let width = clientRect.width / scale.x;
901
+ let height = clientRect.height / scale.y;
902
+ if (domElement) {
903
+ const win = getWindow(domElement);
904
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
905
+ let currentWin = win;
906
+ let currentIFrame = getFrameElement(currentWin);
907
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
908
+ const iframeScale = getScale(currentIFrame);
909
+ const iframeRect = currentIFrame.getBoundingClientRect();
910
+ const css = getComputedStyle(currentIFrame);
911
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
912
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
913
+ x *= iframeScale.x;
914
+ y *= iframeScale.y;
915
+ width *= iframeScale.x;
916
+ height *= iframeScale.y;
917
+ x += left;
918
+ y += top;
919
+ currentWin = getWindow(currentIFrame);
920
+ currentIFrame = getFrameElement(currentWin);
921
+ }
922
+ }
923
+ return rectToClientRect({
924
+ width,
925
+ height,
926
+ x,
927
+ y
928
+ });
929
+ }
930
+
931
+ // If <html> has a CSS width greater than the viewport, then this will be
932
+ // incorrect for RTL.
933
+ function getWindowScrollBarX(element, rect) {
934
+ const leftScroll = getNodeScroll(element).scrollLeft;
935
+ if (!rect) {
936
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
937
+ }
938
+ return rect.left + leftScroll;
939
+ }
940
+
941
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
942
+ if (ignoreScrollbarX === void 0) {
943
+ ignoreScrollbarX = false;
944
+ }
945
+ const htmlRect = documentElement.getBoundingClientRect();
946
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
947
+ // RTL <body> scrollbar.
948
+ getWindowScrollBarX(documentElement, htmlRect));
949
+ const y = htmlRect.top + scroll.scrollTop;
950
+ return {
951
+ x,
952
+ y
953
+ };
954
+ }
955
+
956
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
957
+ let {
958
+ elements,
959
+ rect,
960
+ offsetParent,
961
+ strategy
962
+ } = _ref;
963
+ const isFixed = strategy === 'fixed';
964
+ const documentElement = getDocumentElement(offsetParent);
965
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
966
+ if (offsetParent === documentElement || topLayer && isFixed) {
967
+ return rect;
968
+ }
969
+ let scroll = {
970
+ scrollLeft: 0,
971
+ scrollTop: 0
972
+ };
973
+ let scale = createCoords(1);
974
+ const offsets = createCoords(0);
975
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
976
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
977
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
978
+ scroll = getNodeScroll(offsetParent);
979
+ }
980
+ if (isHTMLElement(offsetParent)) {
981
+ const offsetRect = getBoundingClientRect(offsetParent);
982
+ scale = getScale(offsetParent);
983
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
984
+ offsets.y = offsetRect.y + offsetParent.clientTop;
985
+ }
986
+ }
987
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
988
+ return {
989
+ width: rect.width * scale.x,
990
+ height: rect.height * scale.y,
991
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
992
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
993
+ };
994
+ }
995
+
996
+ function getClientRects(element) {
997
+ return Array.from(element.getClientRects());
998
+ }
999
+
1000
+ // Gets the entire size of the scrollable document area, even extending outside
1001
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1002
+ function getDocumentRect(element) {
1003
+ const html = getDocumentElement(element);
1004
+ const scroll = getNodeScroll(element);
1005
+ const body = element.ownerDocument.body;
1006
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1007
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1008
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1009
+ const y = -scroll.scrollTop;
1010
+ if (getComputedStyle(body).direction === 'rtl') {
1011
+ x += max(html.clientWidth, body.clientWidth) - width;
1012
+ }
1013
+ return {
1014
+ width,
1015
+ height,
1016
+ x,
1017
+ y
1018
+ };
1019
+ }
1020
+
1021
+ function getViewportRect(element, strategy) {
1022
+ const win = getWindow(element);
1023
+ const html = getDocumentElement(element);
1024
+ const visualViewport = win.visualViewport;
1025
+ let width = html.clientWidth;
1026
+ let height = html.clientHeight;
1027
+ let x = 0;
1028
+ let y = 0;
1029
+ if (visualViewport) {
1030
+ width = visualViewport.width;
1031
+ height = visualViewport.height;
1032
+ const visualViewportBased = isWebKit();
1033
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1034
+ x = visualViewport.offsetLeft;
1035
+ y = visualViewport.offsetTop;
1036
+ }
1037
+ }
1038
+ return {
1039
+ width,
1040
+ height,
1041
+ x,
1042
+ y
1043
+ };
1044
+ }
1045
+
1046
+ const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
1047
+ // Returns the inner client rect, subtracting scrollbars if present.
1048
+ function getInnerBoundingClientRect(element, strategy) {
1049
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1050
+ const top = clientRect.top + element.clientTop;
1051
+ const left = clientRect.left + element.clientLeft;
1052
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1053
+ const width = element.clientWidth * scale.x;
1054
+ const height = element.clientHeight * scale.y;
1055
+ const x = left * scale.x;
1056
+ const y = top * scale.y;
1057
+ return {
1058
+ width,
1059
+ height,
1060
+ x,
1061
+ y
1062
+ };
1063
+ }
1064
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1065
+ let rect;
1066
+ if (clippingAncestor === 'viewport') {
1067
+ rect = getViewportRect(element, strategy);
1068
+ } else if (clippingAncestor === 'document') {
1069
+ rect = getDocumentRect(getDocumentElement(element));
1070
+ } else if (isElement(clippingAncestor)) {
1071
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1072
+ } else {
1073
+ const visualOffsets = getVisualOffsets(element);
1074
+ rect = {
1075
+ x: clippingAncestor.x - visualOffsets.x,
1076
+ y: clippingAncestor.y - visualOffsets.y,
1077
+ width: clippingAncestor.width,
1078
+ height: clippingAncestor.height
1079
+ };
1080
+ }
1081
+ return rectToClientRect(rect);
1082
+ }
1083
+ function hasFixedPositionAncestor(element, stopNode) {
1084
+ const parentNode = getParentNode(element);
1085
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1086
+ return false;
1087
+ }
1088
+ return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1089
+ }
1090
+
1091
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
1092
+ // clipping (or hiding) child elements. This returns all clipping ancestors
1093
+ // of the given element up the tree.
1094
+ function getClippingElementAncestors(element, cache) {
1095
+ const cachedResult = cache.get(element);
1096
+ if (cachedResult) {
1097
+ return cachedResult;
1098
+ }
1099
+ let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1100
+ let currentContainingBlockComputedStyle = null;
1101
+ const elementIsFixed = getComputedStyle(element).position === 'fixed';
1102
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1103
+
1104
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1105
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1106
+ const computedStyle = getComputedStyle(currentNode);
1107
+ const currentNodeIsContaining = isContainingBlock(currentNode);
1108
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1109
+ currentContainingBlockComputedStyle = null;
1110
+ }
1111
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1112
+ if (shouldDropCurrentNode) {
1113
+ // Drop non-containing blocks.
1114
+ result = result.filter(ancestor => ancestor !== currentNode);
1115
+ } else {
1116
+ // Record last containing block for next iteration.
1117
+ currentContainingBlockComputedStyle = computedStyle;
1118
+ }
1119
+ currentNode = getParentNode(currentNode);
1120
+ }
1121
+ cache.set(element, result);
1122
+ return result;
1123
+ }
1124
+
1125
+ // Gets the maximum area that the element is visible in due to any number of
1126
+ // clipping ancestors.
1127
+ function getClippingRect(_ref) {
1128
+ let {
1129
+ element,
1130
+ boundary,
1131
+ rootBoundary,
1132
+ strategy
1133
+ } = _ref;
1134
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1135
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1136
+ const firstClippingAncestor = clippingAncestors[0];
1137
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1138
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1139
+ accRect.top = max(rect.top, accRect.top);
1140
+ accRect.right = min(rect.right, accRect.right);
1141
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1142
+ accRect.left = max(rect.left, accRect.left);
1143
+ return accRect;
1144
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1145
+ return {
1146
+ width: clippingRect.right - clippingRect.left,
1147
+ height: clippingRect.bottom - clippingRect.top,
1148
+ x: clippingRect.left,
1149
+ y: clippingRect.top
1150
+ };
1151
+ }
1152
+
1153
+ function getDimensions(element) {
1154
+ const {
1155
+ width,
1156
+ height
1157
+ } = getCssDimensions(element);
1158
+ return {
1159
+ width,
1160
+ height
1161
+ };
1162
+ }
1163
+
1164
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1165
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1166
+ const documentElement = getDocumentElement(offsetParent);
1167
+ const isFixed = strategy === 'fixed';
1168
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1169
+ let scroll = {
1170
+ scrollLeft: 0,
1171
+ scrollTop: 0
1172
+ };
1173
+ const offsets = createCoords(0);
1174
+
1175
+ // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
1176
+ // Firefox with layout.scrollbar.side = 3 in about:config to test this.
1177
+ function setLeftRTLScrollbarOffset() {
1178
+ offsets.x = getWindowScrollBarX(documentElement);
1179
+ }
1180
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1181
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1182
+ scroll = getNodeScroll(offsetParent);
1183
+ }
1184
+ if (isOffsetParentAnElement) {
1185
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1186
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1187
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1188
+ } else if (documentElement) {
1189
+ setLeftRTLScrollbarOffset();
1190
+ }
1191
+ }
1192
+ if (isFixed && !isOffsetParentAnElement && documentElement) {
1193
+ setLeftRTLScrollbarOffset();
1194
+ }
1195
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1196
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1197
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1198
+ return {
1199
+ x,
1200
+ y,
1201
+ width: rect.width,
1202
+ height: rect.height
1203
+ };
1204
+ }
1205
+
1206
+ function isStaticPositioned(element) {
1207
+ return getComputedStyle(element).position === 'static';
1208
+ }
1209
+
1210
+ function getTrueOffsetParent(element, polyfill) {
1211
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
1212
+ return null;
1213
+ }
1214
+ if (polyfill) {
1215
+ return polyfill(element);
1216
+ }
1217
+ let rawOffsetParent = element.offsetParent;
1218
+
1219
+ // Firefox returns the <html> element as the offsetParent if it's non-static,
1220
+ // while Chrome and Safari return the <body> element. The <body> element must
1221
+ // be used to perform the correct calculations even if the <html> element is
1222
+ // non-static.
1223
+ if (getDocumentElement(element) === rawOffsetParent) {
1224
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
1225
+ }
1226
+ return rawOffsetParent;
1227
+ }
1228
+
1229
+ // Gets the closest ancestor positioned element. Handles some edge cases,
1230
+ // such as table ancestors and cross browser bugs.
1231
+ function getOffsetParent(element, polyfill) {
1232
+ const win = getWindow(element);
1233
+ if (isTopLayer(element)) {
1234
+ return win;
1235
+ }
1236
+ if (!isHTMLElement(element)) {
1237
+ let svgOffsetParent = getParentNode(element);
1238
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1239
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1240
+ return svgOffsetParent;
1241
+ }
1242
+ svgOffsetParent = getParentNode(svgOffsetParent);
1243
+ }
1244
+ return win;
1245
+ }
1246
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1247
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1248
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1249
+ }
1250
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1251
+ return win;
1252
+ }
1253
+ return offsetParent || getContainingBlock(element) || win;
1254
+ }
1255
+
1256
+ const getElementRects = async function (data) {
1257
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1258
+ const getDimensionsFn = this.getDimensions;
1259
+ const floatingDimensions = await getDimensionsFn(data.floating);
1260
+ return {
1261
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1262
+ floating: {
1263
+ x: 0,
1264
+ y: 0,
1265
+ width: floatingDimensions.width,
1266
+ height: floatingDimensions.height
1267
+ }
1268
+ };
1269
+ };
1270
+
1271
+ function isRTL(element) {
1272
+ return getComputedStyle(element).direction === 'rtl';
1273
+ }
1274
+
1275
+ const platform = {
1276
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1277
+ getDocumentElement,
1278
+ getClippingRect,
1279
+ getOffsetParent,
1280
+ getElementRects,
1281
+ getClientRects,
1282
+ getDimensions,
1283
+ getScale,
1284
+ isElement,
1285
+ isRTL
1286
+ };
1287
+
1288
+ function rectsAreEqual(a, b) {
1289
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
1290
+ }
1291
+
1292
+ // https://samthor.au/2021/observing-dom/
1293
+ function observeMove(element, onMove) {
1294
+ let io = null;
1295
+ let timeoutId;
1296
+ const root = getDocumentElement(element);
1297
+ function cleanup() {
1298
+ var _io;
1299
+ clearTimeout(timeoutId);
1300
+ (_io = io) == null || _io.disconnect();
1301
+ io = null;
1302
+ }
1303
+ function refresh(skip, threshold) {
1304
+ if (skip === void 0) {
1305
+ skip = false;
1306
+ }
1307
+ if (threshold === void 0) {
1308
+ threshold = 1;
1309
+ }
1310
+ cleanup();
1311
+ const elementRectForRootMargin = element.getBoundingClientRect();
1312
+ const {
1313
+ left,
1314
+ top,
1315
+ width,
1316
+ height
1317
+ } = elementRectForRootMargin;
1318
+ if (!skip) {
1319
+ onMove();
1320
+ }
1321
+ if (!width || !height) {
1322
+ return;
1323
+ }
1324
+ const insetTop = floor(top);
1325
+ const insetRight = floor(root.clientWidth - (left + width));
1326
+ const insetBottom = floor(root.clientHeight - (top + height));
1327
+ const insetLeft = floor(left);
1328
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1329
+ const options = {
1330
+ rootMargin,
1331
+ threshold: max(0, min(1, threshold)) || 1
1332
+ };
1333
+ let isFirstUpdate = true;
1334
+ function handleObserve(entries) {
1335
+ const ratio = entries[0].intersectionRatio;
1336
+ if (ratio !== threshold) {
1337
+ if (!isFirstUpdate) {
1338
+ return refresh();
1339
+ }
1340
+ if (!ratio) {
1341
+ // If the reference is clipped, the ratio is 0. Throttle the refresh
1342
+ // to prevent an infinite loop of updates.
1343
+ timeoutId = setTimeout(() => {
1344
+ refresh(false, 1e-7);
1345
+ }, 1000);
1346
+ } else {
1347
+ refresh(false, ratio);
1348
+ }
1349
+ }
1350
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1351
+ // It's possible that even though the ratio is reported as 1, the
1352
+ // element is not actually fully within the IntersectionObserver's root
1353
+ // area anymore. This can happen under performance constraints. This may
1354
+ // be a bug in the browser's IntersectionObserver implementation. To
1355
+ // work around this, we compare the element's bounding rect now with
1356
+ // what it was at the time we created the IntersectionObserver. If they
1357
+ // are not equal then the element moved, so we refresh.
1358
+ refresh();
1359
+ }
1360
+ isFirstUpdate = false;
1361
+ }
1362
+
1363
+ // Older browsers don't support a `document` as the root and will throw an
1364
+ // error.
1365
+ try {
1366
+ io = new IntersectionObserver(handleObserve, {
1367
+ ...options,
1368
+ // Handle <iframe>s
1369
+ root: root.ownerDocument
1370
+ });
1371
+ } catch (_e) {
1372
+ io = new IntersectionObserver(handleObserve, options);
1373
+ }
1374
+ io.observe(element);
1375
+ }
1376
+ refresh(true);
1377
+ return cleanup;
1378
+ }
1379
+
1380
+ /**
1381
+ * Automatically updates the position of the floating element when necessary.
1382
+ * Should only be called when the floating element is mounted on the DOM or
1383
+ * visible on the screen.
1384
+ * @returns cleanup function that should be invoked when the floating element is
1385
+ * removed from the DOM or hidden from the screen.
1386
+ * @see https://floating-ui.com/docs/autoUpdate
1387
+ */
1388
+ function autoUpdate(reference, floating, update, options) {
1389
+ if (options === void 0) {
1390
+ options = {};
1391
+ }
1392
+ const {
1393
+ ancestorScroll = true,
1394
+ ancestorResize = true,
1395
+ elementResize = typeof ResizeObserver === 'function',
1396
+ layoutShift = typeof IntersectionObserver === 'function',
1397
+ animationFrame = false
1398
+ } = options;
1399
+ const referenceEl = unwrapElement(reference);
1400
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
1401
+ ancestors.forEach(ancestor => {
1402
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
1403
+ passive: true
1404
+ });
1405
+ ancestorResize && ancestor.addEventListener('resize', update);
1406
+ });
1407
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1408
+ let reobserveFrame = -1;
1409
+ let resizeObserver = null;
1410
+ if (elementResize) {
1411
+ resizeObserver = new ResizeObserver(_ref => {
1412
+ let [firstEntry] = _ref;
1413
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1414
+ // Prevent update loops when using the `size` middleware.
1415
+ // https://github.com/floating-ui/floating-ui/issues/1740
1416
+ resizeObserver.unobserve(floating);
1417
+ cancelAnimationFrame(reobserveFrame);
1418
+ reobserveFrame = requestAnimationFrame(() => {
1419
+ var _resizeObserver;
1420
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1421
+ });
1422
+ }
1423
+ update();
1424
+ });
1425
+ if (referenceEl && !animationFrame) {
1426
+ resizeObserver.observe(referenceEl);
1427
+ }
1428
+ resizeObserver.observe(floating);
1429
+ }
1430
+ let frameId;
1431
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1432
+ if (animationFrame) {
1433
+ frameLoop();
1434
+ }
1435
+ function frameLoop() {
1436
+ const nextRefRect = getBoundingClientRect(reference);
1437
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
1438
+ update();
1439
+ }
1440
+ prevRefRect = nextRefRect;
1441
+ frameId = requestAnimationFrame(frameLoop);
1442
+ }
1443
+ update();
1444
+ return () => {
1445
+ var _resizeObserver2;
1446
+ ancestors.forEach(ancestor => {
1447
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
1448
+ ancestorResize && ancestor.removeEventListener('resize', update);
1449
+ });
1450
+ cleanupIo == null || cleanupIo();
1451
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
1452
+ resizeObserver = null;
1453
+ if (animationFrame) {
1454
+ cancelAnimationFrame(frameId);
1455
+ }
1456
+ };
1457
+ }
1458
+
1459
+ /**
1460
+ * Modifies the placement by translating the floating element along the
1461
+ * specified axes.
1462
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
1463
+ * object may be passed.
1464
+ * @see https://floating-ui.com/docs/offset
1465
+ */
1466
+ const offset = offset$1;
1467
+
1468
+ /**
1469
+ * Optimizes the visibility of the floating element by shifting it in order to
1470
+ * keep it in view when it will overflow the clipping boundary.
1471
+ * @see https://floating-ui.com/docs/shift
1472
+ */
1473
+ const shift = shift$1;
1474
+
1475
+ /**
1476
+ * Optimizes the visibility of the floating element by flipping the `placement`
1477
+ * in order to keep it in view when the preferred placement(s) will overflow the
1478
+ * clipping boundary. Alternative to `autoPlacement`.
1479
+ * @see https://floating-ui.com/docs/flip
1480
+ */
1481
+ const flip = flip$1;
1482
+
1483
+ /**
1484
+ * Computes the `x` and `y` coordinates that will place the floating element
1485
+ * next to a given reference element.
1486
+ */
1487
+ const computePosition = (reference, floating, options) => {
1488
+ // This caches the expensive `getClippingElementAncestors` function so that
1489
+ // multiple lifecycle resets re-use the same result. It only lives for a
1490
+ // single call. If other functions become expensive, we can add them as well.
1491
+ const cache = new Map();
1492
+ const mergedOptions = {
1493
+ platform,
1494
+ ...options
1495
+ };
1496
+ const platformWithCache = {
1497
+ ...mergedOptions.platform,
1498
+ _c: cache
1499
+ };
1500
+ return computePosition$1(reference, floating, {
1501
+ ...mergedOptions,
1502
+ platform: platformWithCache
1503
+ });
1504
+ };
1505
+
1506
+ export { autoUpdate as a, computePosition as c, flip as f, offset as o, shift as s };
1507
+ //# sourceMappingURL=p-6xqe-pLQ.js.map
1508
+
1509
+ //# sourceMappingURL=p-6xqe-pLQ.js.map