@hiai-gg/docsmint 2.2.3 → 2.2.5

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 (259) hide show
  1. package/README.md +10 -8
  2. package/dist/backend/index.js +60080 -40793
  3. package/dist/frontend/CategoryDialog-CtBDBrmR.js +603 -0
  4. package/dist/frontend/ConfirmDialog-B7rUgX7M.js +219 -0
  5. package/dist/frontend/CreateSnapshotDialog-bUKdc0Zb.js +219 -0
  6. package/dist/frontend/DatePicker-CKTDDpVx.js +291 -0
  7. package/dist/frontend/DeleteDialog-D28HGxN7.js +175 -0
  8. package/dist/frontend/FolderNode-CVd22MJS.js +291 -0
  9. package/dist/frontend/FolderTreeSelector-DObSptCD.js +102 -0
  10. package/dist/frontend/HiAiEditor--V0-gKwv.js +3266 -0
  11. package/dist/frontend/HiaiDocsExtensionProvider-B1bCAtpa.js +13 -0
  12. package/dist/frontend/{Icon-CiHcxcpv.js → Icon-DNapb_KY.js} +3 -2
  13. package/dist/frontend/SettingsDialog-CN-PrNpM.js +979 -0
  14. package/dist/frontend/ShareDialog-UO_6vvoT.js +272 -0
  15. package/dist/frontend/Sidebar-CAxrqTAQ.js +2169 -0
  16. package/dist/frontend/TagCreateDialog-BdWu4bPX.js +268 -0
  17. package/dist/frontend/{action_cancel-BdsWzQKU.js → action_cancel-DxbRD-bG.js} +1 -1
  18. package/dist/frontend/{action_close-CVhfLPRQ.js → action_close-Ct6lVumm.js} +1 -1
  19. package/dist/frontend/{action_create-ByaroO1_.js → action_create-DKOlnVyX.js} +1 -1
  20. package/dist/frontend/{action_delete-SRloglWY.js → action_delete-DRb7fBnB.js} +1 -1
  21. package/dist/frontend/{action_go_to-DO1bicF-.js → action_go_to-D0fF5t1d.js} +1 -1
  22. package/dist/frontend/{action_loading-iQ0KsN6i.js → action_loading-YGvDyzYG.js} +1 -1
  23. package/dist/frontend/{action_save-DeqrZQwV.js → action_save-BHYTeFmm.js} +1 -1
  24. package/dist/frontend/api/categories.js +1 -1
  25. package/dist/frontend/api/settings.js +1 -1
  26. package/dist/frontend/api/tags.js +1 -1
  27. package/dist/frontend/app-shell.js +177 -176
  28. package/dist/frontend/{auth-client-Dx7d9Tzo.js → auth-client-DahfoSYo.js} +297 -277
  29. package/dist/frontend/{bundle-mjs-clTO1WW-.js → bundle-mjs-654jE5XN.js} +397 -300
  30. package/dist/frontend/{camera-DsdOPOcD.js → camera-C6JuKKhr.js} +9 -8
  31. package/dist/frontend/{categories-CusvHb5Y.js → categories-CUfKlgrs.js} +1 -1
  32. package/dist/frontend/{categories_update_error-Cn8DBBHv.js → categories_update_error-BrLD-j9s.js} +1 -1
  33. package/dist/frontend/check-B_e1XqT2.js +25 -0
  34. package/dist/frontend/chevron-down-BsnN2mp2.js +25 -0
  35. package/dist/frontend/circle-check-CJH5zxd9.js +29 -0
  36. package/dist/frontend/clock-CU0gCiiM.js +29 -0
  37. package/dist/frontend/collaboration.js +113 -113
  38. package/dist/frontend/components/category-dialog.js +1 -1
  39. package/dist/frontend/components/create-snapshot-dialog.js +1 -1
  40. package/dist/frontend/components/delete-dialog.js +1 -1
  41. package/dist/frontend/components/editor/compact-editor.js +5 -4
  42. package/dist/frontend/components/editor/document-editor.js +1 -1
  43. package/dist/frontend/components/editor/document-title.js +3 -2
  44. package/dist/frontend/components/editor/docx-serializer.js +8359 -12358
  45. package/dist/frontend/components/editor/extensions.js +1 -1
  46. package/dist/frontend/components/editor/markdown-toggle.js +33 -32
  47. package/dist/frontend/components/editor/markdown.js +1 -1
  48. package/dist/frontend/components/folder-node.js +1 -1
  49. package/dist/frontend/components/folder-tree-selector.js +1 -1
  50. package/dist/frontend/components/save-as-dialog.js +168 -167
  51. package/dist/frontend/components/settings.js +1 -1
  52. package/dist/frontend/components/share-dialog.js +1 -1
  53. package/dist/frontend/components/sidebar.js +1 -1
  54. package/dist/frontend/components/tag-create-dialog.js +1 -1
  55. package/dist/frontend/components/version-history.js +252 -251
  56. package/dist/frontend/{copy-Bag46YaR.js → copy-DYNRCHgk.js} +9 -8
  57. package/dist/frontend/dashboard.js +1301 -1300
  58. package/dist/frontend/db-yN0Vve_2.js +4296 -0
  59. package/dist/frontend/{dialog-C0Bpok1d.js → dialog-Dqp04jso.js} +11 -10
  60. package/dist/frontend/dist-4xBCgXNT.js +40 -0
  61. package/dist/frontend/{dist-DjId3RKL.js → dist-BaAULhmK.js} +3 -9
  62. package/dist/frontend/dist-C1oIyJLI.js +302 -0
  63. package/dist/frontend/dndzone-CWg1kmdZ.js +1483 -0
  64. package/dist/frontend/{doc_title_label-BOuZzvqv.js → doc_title_label-BPlghiRM.js} +1 -1
  65. package/dist/frontend/{doc_title_placeholder-ZxpdWWEn.js → doc_title_placeholder-D-LfSoC5.js} +1 -1
  66. package/dist/frontend/dropdown-menu-HePwCxoQ.js +1429 -0
  67. package/dist/frontend/{editorExtensions-DbiFj4tn.js → editorExtensions-QKIFSqEG.js} +9 -9
  68. package/dist/frontend/{editor_markdown_placeholder-BztIY9Ci.js → editor_markdown_placeholder-BXRPm7JG.js} +1 -1
  69. package/dist/frontend/{ellipsis-vertical-Oymsv1R4.js → ellipsis-vertical-CR25MyeP.js} +9 -8
  70. package/dist/frontend/{error_dismiss-C651ZdWI.js → error_dismiss-Ckia7GQe.js} +1 -1
  71. package/dist/frontend/{error_generic-BlWqOE-a.js → error_generic-gyQMdET_.js} +1 -1
  72. package/dist/frontend/extension.js +1 -1
  73. package/dist/frontend/{folder-BpmB_sAy.js → folder-BpA690ie.js} +4 -3
  74. package/dist/frontend/{folders_rename-Cxbg5GIw.js → folders_rename-BHa_gSXw.js} +1 -1
  75. package/dist/frontend/frontend.css +1 -1
  76. package/dist/frontend/i18n.js +29 -29
  77. package/dist/frontend/{identity-B7HeOzDJ.js → identity-ndFYB8Nt.js} +1 -1
  78. package/dist/frontend/{input-CbeB9220.js → input-Cv3qF4J3.js} +9 -8
  79. package/dist/frontend/label-DXjefKfF.js +30 -0
  80. package/dist/frontend/{lib-CITdCbKa.js → lib-DJthN0w9.js} +7108 -5196
  81. package/dist/frontend/loader-circle-CvWX1HHL.js +25 -0
  82. package/dist/frontend/{markdown-6E9TWC6V.js → markdown-CksQVQ6a.js} +2 -2
  83. package/dist/frontend/offline/identity.js +1 -1
  84. package/dist/frontend/popper-layer-force-mount-DS--Cvfo.js +3493 -0
  85. package/dist/frontend/rolldown-runtime-DKYsOz5J.js +19 -0
  86. package/dist/frontend/{rotate-ccw-DAUX7np7.js → rotate-ccw-Box7QP5X.js} +9 -8
  87. package/dist/frontend/{runtime-CGUiMzK6.js → runtime-CJv8UGYl.js} +1 -4
  88. package/dist/frontend/{schemas-YXxhj5o8.js → schemas-BYbeR0Ky.js} +11 -11
  89. package/dist/frontend/{scroll_to_top_aria-lJc2RSx_.js → scroll_to_top_aria-CP7_oyCo.js} +1 -1
  90. package/dist/frontend/search.js +650 -649
  91. package/dist/frontend/{search_title-BETwQYJq.js → search_title-C2aOzN_J.js} +1 -1
  92. package/dist/frontend/select-value-DAMTi0zc.js +1473 -0
  93. package/dist/frontend/{settings-DyePuqjp.js → settings-DTsCVJEi.js} +1 -1
  94. package/dist/frontend/{share-context-C2xyVP9M.js → share-context-CtRMIIhL.js} +15 -14
  95. package/dist/frontend/{share_copied-BuAnmpbz.js → share_copied-BHb_9sOo.js} +1 -1
  96. package/dist/frontend/{share_toggle_password-LEYUeHWr.js → share_toggle_password-DjCMq4Eq.js} +1 -1
  97. package/dist/frontend/shared-document.js +49 -48
  98. package/dist/frontend/{sidebar_uncategorized-C5PGOflV.js → sidebar_uncategorized-BJSB_sc9.js} +1 -1
  99. package/dist/frontend/{sort_relevance-DpCVLby_.js → sort_relevance-CXuNTq6L.js} +1 -1
  100. package/dist/frontend/{tag-Wdfe0rKU.js → tag-BPOFgBQw.js} +4 -3
  101. package/dist/frontend/tag-store.svelte-DyqQNx7H.js +28 -0
  102. package/dist/frontend/{tags-DlDVothf.js → tags-DwilrkrM.js} +1 -1
  103. package/dist/frontend/{tags_load_error-BINNpPPV.js → tags_load_error-BOyuQEGc.js} +1 -1
  104. package/dist/frontend/{tags_new-Dw0Uy43-.js → tags_new-CGF3Hi1j.js} +1 -1
  105. package/dist/frontend/textarea-DDdgNvnf.js +23 -0
  106. package/dist/frontend/theme.js +1 -1
  107. package/dist/frontend/{theme.svelte-BiXvrqwh.js → theme.svelte-Dx01qWc3.js} +2 -2
  108. package/dist/frontend/{theme_system-YIfa_2Xt.js → theme_system-Bt9ItDgj.js} +1 -1
  109. package/dist/frontend/utils/dndzone.js +1 -1
  110. package/dist/frontend/{utils-CnAmIMwr.js → utils-BQMesoNf.js} +1 -1
  111. package/dist/frontend/utils-BavN35Bw.js +6 -0
  112. package/dist/frontend/utils.js +1 -1
  113. package/dist/frontend/{version_create_snapshot-D8xjbuCq.js → version_create_snapshot-BvoOuUeh.js} +1 -1
  114. package/dist/frontend/{version_restored_from-DYFFSuQj.js → version_restored_from-BIEEKFbx.js} +1 -1
  115. package/dist/frontend/{version_snapshot_label_placeholder-BhKq1NQ7.js → version_snapshot_label_placeholder-h9r2_0u3.js} +1 -1
  116. package/dist/frontend/{weekday_we-BxbzNVWR.js → weekday_we-DsuVW6rh.js} +1 -1
  117. package/dist/frontend/x-hIpDH7DU.js +25 -0
  118. package/dist/frontend/{yjs-BbwnvxgY.js → yjs--VgxqIlB.js} +607 -628
  119. package/dist/frontend-ssr/api/categories.js +1 -1
  120. package/dist/frontend-ssr/api/settings.js +1 -1
  121. package/dist/frontend-ssr/api/tags.js +1 -1
  122. package/dist/frontend-ssr/app-shell.js +11 -11
  123. package/dist/frontend-ssr/assets/{CategoryDialog-2CCX508O.js → CategoryDialog-DRItbO_9.js} +13 -13
  124. package/dist/frontend-ssr/assets/{ConfirmDialog-Cc6lcY1N.js → ConfirmDialog-B0NXRrel.js} +8 -8
  125. package/dist/frontend-ssr/assets/{CreateSnapshotDialog-BB8fXF9W.js → CreateSnapshotDialog-nj8PjuON.js} +7 -7
  126. package/dist/frontend-ssr/assets/{DatePicker-CfzKzipR.js → DatePicker-CdUKLPtP.js} +8 -8
  127. package/dist/frontend-ssr/assets/{DeleteDialog-DRU4UgOW.js → DeleteDialog-B83NoxAg.js} +3 -3
  128. package/dist/frontend-ssr/assets/{FolderNode-CyOrLJ2Y.js → FolderNode-CSeC3051.js} +10 -10
  129. package/dist/frontend-ssr/assets/{FolderTreeSelector-D0reTdFS.js → FolderTreeSelector-Dh-ViJPU.js} +4 -4
  130. package/dist/frontend-ssr/assets/{HiAiEditor-BQGlGd3z.js → HiAiEditor-DB2PjHm9.js} +41 -41
  131. package/dist/frontend-ssr/assets/{Icon-CrIRbT5O.js → Icon-CBEeswQ2.js} +4 -4
  132. package/dist/frontend-ssr/assets/{SettingsDialog-BpHY3IMb.js → SettingsDialog-kc3O9PXG.js} +21 -21
  133. package/dist/frontend-ssr/assets/{ShareDialog-CY40nWZJ.js → ShareDialog-Dmrj55QP.js} +4 -4
  134. package/dist/frontend-ssr/assets/{Sidebar-dTp4DyW4.js → Sidebar-CDQcIuyv.js} +45 -45
  135. package/dist/frontend-ssr/assets/{TagCreateDialog-C2tpdEuj.js → TagCreateDialog-CP-yYfpQ.js} +11 -11
  136. package/dist/frontend-ssr/assets/{action_cancel-CsBbxW0m.js → action_cancel-B8i5P3wt.js} +1 -1
  137. package/dist/frontend-ssr/assets/{action_close-lFKBqBwg.js → action_close-DPgIB-cY.js} +1 -1
  138. package/dist/frontend-ssr/assets/{action_create-BV4ZOcQW.js → action_create-DAlNPFeN.js} +1 -1
  139. package/dist/frontend-ssr/assets/{action_delete-CNmRhKQP.js → action_delete-C6lsQCtY.js} +1 -1
  140. package/dist/frontend-ssr/assets/{action_go_to-tN5I26xM.js → action_go_to-C6tegi-k.js} +1 -1
  141. package/dist/frontend-ssr/assets/{action_save-YCfMiKb4.js → action_save-BQCej1sh.js} +1 -1
  142. package/dist/frontend-ssr/assets/{auth-client-BnnnJDAb.js → auth-client-CwXGsJIQ.js} +44 -38
  143. package/dist/frontend-ssr/assets/{camera-OYNSMvMd.js → camera-kjjsHmQu.js} +2 -2
  144. package/dist/frontend-ssr/assets/{categories_update_error-Bfx5vtvt.js → categories_update_error-Kq8q_FJp.js} +1 -1
  145. package/dist/frontend-ssr/assets/{chevron-down-DB6YsSbQ.js → chevron-down-DPc-Owbl.js} +2 -2
  146. package/dist/frontend-ssr/assets/{chevron-right-DOt2uY6b.js → chevron-right-C-jY4mqk.js} +2 -2
  147. package/dist/frontend-ssr/assets/{circle-check-DQhTm9YR.js → circle-check-CnueRXrc.js} +2 -2
  148. package/dist/frontend-ssr/assets/{clock-B08dVWtf.js → clock-CoRtIDhT.js} +2 -2
  149. package/dist/frontend-ssr/assets/{copy-2jsznHar.js → copy-CDNZIGVg.js} +2 -2
  150. package/dist/frontend-ssr/assets/{db-BEKLU5Fc.js → db-NhMsSg1f.js} +1 -1
  151. package/dist/frontend-ssr/assets/{dialog-C6U-DqLr.js → dialog-B09MN2S-.js} +9 -9
  152. package/dist/frontend-ssr/assets/{dist-DqXTz_zE.js → dist-D4MAfF0i.js} +13 -13
  153. package/dist/frontend-ssr/assets/{dist-ip9bPdma.js → dist-cDG_u5EF.js} +8 -8
  154. package/dist/frontend-ssr/assets/{dndzone-C7KnICM0.js → dndzone-DyM8UtoT.js} +378 -216
  155. package/dist/frontend-ssr/assets/{doc_title_label-CE_l-Gum.js → doc_title_label-BqCuH3eY.js} +1 -1
  156. package/dist/frontend-ssr/assets/{doc_title_placeholder-7_i7PtG6.js → doc_title_placeholder-C3tGSpRB.js} +1 -1
  157. package/dist/frontend-ssr/assets/dropdown-menu-C9H45F9X.js +1721 -0
  158. package/dist/frontend-ssr/assets/{editor_markdown_placeholder-CAeLJjFT.js → editor_markdown_placeholder-Cxa5uq87.js} +1 -1
  159. package/dist/frontend-ssr/assets/{editor_toolbar_undo-CVCfQIS1.js → editor_toolbar_undo-D-gLz88j.js} +1 -1
  160. package/dist/frontend-ssr/assets/{ellipsis-vertical-IFHt2NM1.js → ellipsis-vertical-oBvMj3Jm.js} +2 -2
  161. package/dist/frontend-ssr/assets/{error_generic-BB80i0Vk.js → error_generic-BSoVZ_4p.js} +1 -1
  162. package/dist/frontend-ssr/assets/{folder-CXa1_bm5.js → folder-Ptjeaody.js} +2 -2
  163. package/dist/frontend-ssr/assets/{folders_rename-ydbfwQlj.js → folders_rename-DBtQcf2R.js} +1 -1
  164. package/dist/frontend-ssr/assets/{identity-DTz1SQwC.js → identity-CigCqYEA.js} +1 -1
  165. package/dist/frontend-ssr/assets/{input-Bxw9sFF0.js → input-Cc45dG_S.js} +2 -2
  166. package/dist/frontend-ssr/assets/{label-CMWedjs6.js → label-C1_J2397.js} +2 -2
  167. package/dist/frontend-ssr/assets/{loader-circle-zbKj9Qb-.js → loader-circle-CK3McH5n.js} +2 -2
  168. package/dist/frontend-ssr/assets/{markdown-BmIhDQp7.js → markdown-WQsa_gay.js} +1 -1
  169. package/dist/frontend-ssr/assets/{popper-layer-force-mount-CSHZsG2E.js → popper-layer-force-mount-CGKwdZaZ.js} +1448 -2402
  170. package/dist/frontend-ssr/assets/{rotate-ccw-B7SaTFWf.js → rotate-ccw-B1lCxJ5d.js} +2 -2
  171. package/dist/frontend-ssr/assets/{runtime-BX6-jTn_.js → runtime-CoxALrm1.js} +2 -28
  172. package/dist/frontend-ssr/assets/{scroll_to_top_aria-CAYSiGHO.js → scroll_to_top_aria-CmLwsPln.js} +1 -1
  173. package/dist/frontend-ssr/assets/{search_title-C7NVXXq3.js → search_title-CZIl0wkq.js} +1 -1
  174. package/dist/frontend-ssr/assets/{search_toggle_filters-Bq_YVD8s.js → search_toggle_filters-BG-CRM9G.js} +1 -1
  175. package/dist/frontend-ssr/assets/{select-value-TgslfiUB.js → select-value-BeUHHkLq.js} +157 -66
  176. package/dist/frontend-ssr/assets/{settings-B1MA_FjO.js → settings-BqyemuQv.js} +1 -1
  177. package/dist/frontend-ssr/assets/{share-context-RVh8AExX.js → share-context-BM1sUnlP.js} +15 -15
  178. package/dist/frontend-ssr/assets/{share_copied-CrwEwkb3.js → share_copied-BVGtm9Ud.js} +1 -1
  179. package/dist/frontend-ssr/assets/{share_toggle_password-Co56z0Ha.js → share_toggle_password-z0gwy0TG.js} +1 -1
  180. package/dist/frontend-ssr/assets/{sidebar_uncategorized-COWdmZ3d.js → sidebar_uncategorized-rpbsgLVr.js} +1 -1
  181. package/dist/frontend-ssr/assets/{tag-BGhtDKpP.js → tag-D_ZqINN3.js} +3 -3
  182. package/dist/frontend-ssr/assets/{tags_load_error-DW4FbHvr.js → tags_load_error-DvhlyMMY.js} +1 -1
  183. package/dist/frontend-ssr/assets/{tags_new-Dr3ByMPZ.js → tags_new-DStxzBII.js} +1 -1
  184. package/dist/frontend-ssr/assets/{textarea-Bz5Tz4rw.js → textarea-S9uzw6je.js} +2 -2
  185. package/dist/frontend-ssr/assets/{theme.svelte-CdHah46l.js → theme.svelte-CqAzqvik.js} +2 -2
  186. package/dist/frontend-ssr/assets/{theme_system-E97FASeq.js → theme_system-DjbsL0RQ.js} +1 -1
  187. package/dist/frontend-ssr/assets/{utils-DF6CmRDX.js → utils-DF93j6z-.js} +1 -1
  188. package/dist/frontend-ssr/assets/{version_create_snapshot-DeeYB7bb.js → version_create_snapshot-SwYsTZ56.js} +1 -1
  189. package/dist/frontend-ssr/assets/{version_restored_from-CTt2LM4A.js → version_restored_from-pYBnudye.js} +1 -1
  190. package/dist/frontend-ssr/assets/{version_snapshot_label_placeholder-BbGD9YuN.js → version_snapshot_label_placeholder-DtDnHip8.js} +1 -1
  191. package/dist/frontend-ssr/assets/{weekday_we-BzGQ-iFc.js → weekday_we-CV1TMROW.js} +1 -1
  192. package/dist/frontend-ssr/components/category-dialog.js +1 -1
  193. package/dist/frontend-ssr/components/create-snapshot-dialog.js +1 -1
  194. package/dist/frontend-ssr/components/delete-dialog.js +1 -1
  195. package/dist/frontend-ssr/components/editor/compact-editor.js +1 -1
  196. package/dist/frontend-ssr/components/editor/document-editor.js +1 -1
  197. package/dist/frontend-ssr/components/editor/document-title.js +2 -2
  198. package/dist/frontend-ssr/components/editor/extensions.js +1 -1
  199. package/dist/frontend-ssr/components/editor/markdown-toggle.js +3 -3
  200. package/dist/frontend-ssr/components/editor/markdown.js +1 -1
  201. package/dist/frontend-ssr/components/folder-node.js +1 -1
  202. package/dist/frontend-ssr/components/folder-tree-selector.js +1 -1
  203. package/dist/frontend-ssr/components/save-as-dialog.js +10 -10
  204. package/dist/frontend-ssr/components/settings.js +1 -1
  205. package/dist/frontend-ssr/components/share-dialog.js +1 -1
  206. package/dist/frontend-ssr/components/sidebar.js +1 -1
  207. package/dist/frontend-ssr/components/tag-create-dialog.js +1 -1
  208. package/dist/frontend-ssr/components/version-history.js +17 -17
  209. package/dist/frontend-ssr/dashboard.js +61 -158
  210. package/dist/frontend-ssr/extension.js +1 -1
  211. package/dist/frontend-ssr/i18n.js +31 -31
  212. package/dist/frontend-ssr/offline/identity.js +1 -1
  213. package/dist/frontend-ssr/search.js +13 -13
  214. package/dist/frontend-ssr/shared-document.js +1 -1
  215. package/dist/frontend-ssr/theme.js +1 -1
  216. package/dist/frontend-ssr/utils/dndzone.js +1 -1
  217. package/dist/lifecycle-runtime.js +17768 -11203
  218. package/dist/mcp-cli.js +1 -1
  219. package/dist/mcp-server.js +1 -1
  220. package/package.json +13 -13
  221. package/packages/cli/src/index.ts +1 -1
  222. package/server.json +2 -2
  223. package/dist/frontend/CategoryDialog-CVJi5PJu.js +0 -602
  224. package/dist/frontend/ConfirmDialog-0JwB8mKN.js +0 -218
  225. package/dist/frontend/CreateSnapshotDialog-BLrtuYs5.js +0 -218
  226. package/dist/frontend/DatePicker-BwSb8TRv.js +0 -326
  227. package/dist/frontend/DeleteDialog-s7Dr6bXg.js +0 -174
  228. package/dist/frontend/FolderNode-Ds0LDfK3.js +0 -290
  229. package/dist/frontend/FolderTreeSelector-BR3lYmPU.js +0 -101
  230. package/dist/frontend/HiAiEditor-BHz46Iqd.js +0 -3078
  231. package/dist/frontend/HiaiDocsExtensionProvider-A2nGddUR.js +0 -12
  232. package/dist/frontend/SettingsDialog-BvS74JZu.js +0 -978
  233. package/dist/frontend/ShareDialog-Bo50h_Oe.js +0 -271
  234. package/dist/frontend/Sidebar-DerKtpWB.js +0 -2168
  235. package/dist/frontend/TagCreateDialog-DhKfsfv3.js +0 -267
  236. package/dist/frontend/check-DiMZRkKS.js +0 -24
  237. package/dist/frontend/chevron-down-CxFrMFDJ.js +0 -24
  238. package/dist/frontend/circle-check-B4F_qgPx.js +0 -28
  239. package/dist/frontend/clock-dcpueRk-.js +0 -28
  240. package/dist/frontend/db-B1ZV452J.js +0 -3792
  241. package/dist/frontend/dist-BlcV_BOY.js +0 -39
  242. package/dist/frontend/dist-Dl9qg10h.js +0 -301
  243. package/dist/frontend/dndzone-B9jA0yIS.js +0 -1372
  244. package/dist/frontend/dropdown-menu-B3nk2aM-.js +0 -482
  245. package/dist/frontend/label-CfBWf3gI.js +0 -29
  246. package/dist/frontend/loader-circle-skKwfRCB.js +0 -24
  247. package/dist/frontend/popper-layer-force-mount-BG0eyrCk.js +0 -4255
  248. package/dist/frontend/rolldown-runtime-CwxnZyOB.js +0 -22
  249. package/dist/frontend/select-value-BY5Hw6Rl.js +0 -1412
  250. package/dist/frontend/tag-store.svelte-C9VYWqLQ.js +0 -28
  251. package/dist/frontend/textarea-D6emvAwM.js +0 -22
  252. package/dist/frontend/utils-DH0uqK40.js +0 -6
  253. package/dist/frontend/x-CBUgPygC.js +0 -24
  254. package/dist/frontend-ssr/assets/dropdown-menu-BS5fcN9l.js +0 -446
  255. package/dist/frontend-ssr/assets/{HiaiDocsExtensionProvider-D6cGL-9s.js → HiaiDocsExtensionProvider-BdfQP817.js} +1 -1
  256. package/dist/frontend-ssr/assets/{categories-bBPviKjl.js → categories-CMmudpEk.js} +1 -1
  257. package/dist/frontend-ssr/assets/{editorExtensions-2O7O2Nhv.js → editorExtensions-DOPTTKUS.js} +2 -2
  258. package/dist/frontend-ssr/assets/{tag-store.svelte-CUUgAaDD.js → tag-store.svelte-Djpf1W0n.js} +1 -1
  259. package/dist/frontend-ssr/assets/{tags-C7u-LBsl.js → tags-GQOEtqET.js} +1 -1
@@ -4,7 +4,7 @@ import { clsx } from "clsx";
4
4
  import { on } from "svelte/events";
5
5
  import { SvelteMap, createSubscriber } from "svelte/reactivity";
6
6
  import { createAttachmentKey } from "svelte/attachments";
7
- // ../node_modules/.bun/svelte-toolbelt@0.10.6+049bff67fe79e627/node_modules/svelte-toolbelt/dist/utils/is.js
7
+ // ../node_modules/.bun/svelte-toolbelt@0.10.7+294fabd43ca01d33/node_modules/svelte-toolbelt/dist/utils/is.js
8
8
  function isFunction$1(value) {
9
9
  return typeof value === "function";
10
10
  }
@@ -27,7 +27,7 @@ function isClassValue(value) {
27
27
  }
28
28
  return false;
29
29
  }
30
- // ../node_modules/.bun/svelte-toolbelt@0.10.6+049bff67fe79e627/node_modules/svelte-toolbelt/dist/box/box-extras.svelte.js
30
+ // ../node_modules/.bun/svelte-toolbelt@0.10.7+294fabd43ca01d33/node_modules/svelte-toolbelt/dist/box/box-extras.svelte.js
31
31
  var BoxSymbol = Symbol("box");
32
32
  var isWritableSymbol = Symbol("is-writable");
33
33
  function boxWith(getter, setter) {
@@ -128,27 +128,7 @@ function simpleBox(initialValue) {
128
128
  }
129
129
  };
130
130
  }
131
- // ../node_modules/.bun/svelte-toolbelt@0.10.6+049bff67fe79e627/node_modules/svelte-toolbelt/dist/box/box.svelte.js
132
- function box(initialValue) {
133
- let current = initialValue;
134
- return {
135
- [BoxSymbol]: true,
136
- [isWritableSymbol]: true,
137
- get current() {
138
- return current;
139
- },
140
- set current(v) {
141
- current = v;
142
- }
143
- };
144
- }
145
- box.from = boxFrom;
146
- box.with = boxWith;
147
- box.flatten = boxFlatten;
148
- box.readonly = toReadonlyBox;
149
- box.isBox = isBox;
150
- box.isWritableBox = isWritableBox;
151
- // ../node_modules/.bun/svelte-toolbelt@0.10.6+049bff67fe79e627/node_modules/svelte-toolbelt/dist/utils/compose-handlers.js
131
+ // ../node_modules/.bun/svelte-toolbelt@0.10.7+294fabd43ca01d33/node_modules/svelte-toolbelt/dist/utils/compose-handlers.js
152
132
  /**
153
133
  * Composes event handlers into a single function that can be called with an event.
154
134
  * If the previous handler cancels the event using `event.preventDefault()`, the handlers
@@ -392,7 +372,7 @@ function StyleToObject(style, iterator) {
392
372
  });
393
373
  return styleObject;
394
374
  }
395
- // ../node_modules/.bun/svelte-toolbelt@0.10.6+049bff67fe79e627/node_modules/svelte-toolbelt/dist/utils/strings.js
375
+ // ../node_modules/.bun/svelte-toolbelt@0.10.7+294fabd43ca01d33/node_modules/svelte-toolbelt/dist/utils/strings.js
396
376
  var NUMBER_CHAR_RE = /\d/;
397
377
  var STR_SPLITTERS = [
398
378
  "-",
@@ -453,25 +433,77 @@ function upperFirst(str) {
453
433
  function lowerFirst(str) {
454
434
  return str ? str[0].toLowerCase() + str.slice(1) : "";
455
435
  }
456
- // ../node_modules/.bun/svelte-toolbelt@0.10.6+049bff67fe79e627/node_modules/svelte-toolbelt/dist/utils/css-to-style-obj.js
436
+ // ../node_modules/.bun/svelte-toolbelt@0.10.7+294fabd43ca01d33/node_modules/svelte-toolbelt/dist/utils/css-to-style-obj.js
437
+ var CACHE_LIMIT = 1e3;
438
+ var styleKeyCache = /* @__PURE__ */ new Map();
439
+ function toStyleKey(name) {
440
+ let key = styleKeyCache.get(name);
441
+ if (key !== void 0) return key;
442
+ if (name.startsWith("-moz-") || name.startsWith("-webkit-") || name.startsWith("-ms-") || name.startsWith("-o-")) key = pascalCase(name);
443
+ else if (name.startsWith("--")) key = name;
444
+ else key = camelCase(name);
445
+ if (styleKeyCache.size >= CACHE_LIMIT) styleKeyCache.clear();
446
+ styleKeyCache.set(name, key);
447
+ return key;
448
+ }
449
+ var NEEDS_FULL_PARSER = /["'\\{}]|\/\*/;
450
+ var SIMPLE_PROPERTY = /^[-\w]+$/;
451
+ /**
452
+ * Splits simple inline styles (`a: b; c: d(e, f)`) into a flat `[name, value, ...]` list.
453
+ * Returns `null` for anything where the result could differ from `style-to-object`, so the caller
454
+ * can fall back to it.
455
+ */
456
+ function scanSimpleStyle(css) {
457
+ if (NEEDS_FULL_PARSER.test(css)) return null;
458
+ const out = [];
459
+ let depth = 0;
460
+ let start = 0;
461
+ let colon = -1;
462
+ for (let i = 0; i <= css.length; i++) {
463
+ const c = i < css.length ? css.charCodeAt(i) : 59;
464
+ if (c === 40) depth++;
465
+ else if (c === 41) {
466
+ if (--depth < 0) return null;
467
+ } else if (c === 58) {
468
+ if (colon < 0) colon = i;
469
+ } else if (c === 59) {
470
+ if (depth !== 0) return null;
471
+ const segment = css.slice(start, i);
472
+ if (colon < 0) {
473
+ if (segment.trim() || out.length === 0) return null;
474
+ } else {
475
+ const name = css.slice(start, colon).trim();
476
+ const value = css.slice(colon + 1, i).trim();
477
+ if (!SIMPLE_PROPERTY.test(name) || !value) return null;
478
+ out.push(name, value);
479
+ }
480
+ start = i + 1;
481
+ colon = -1;
482
+ }
483
+ }
484
+ return out;
485
+ }
486
+ /**
487
+ * Parses an inline style string into `target`, using the same keys as `cssToStyleObj`.
488
+ * Later declarations overwrite earlier ones, keeping the first one's position.
489
+ */
490
+ function parseStyleInto(target, css) {
491
+ const pairs = scanSimpleStyle(css);
492
+ if (pairs) {
493
+ for (let i = 0; i < pairs.length; i += 2) target[toStyleKey(pairs[i])] = pairs[i + 1];
494
+ return;
495
+ }
496
+ StyleToObject(css, (name, value) => {
497
+ target[toStyleKey(name)] = value;
498
+ });
499
+ }
457
500
  function cssToStyleObj(css) {
458
501
  if (!css) return {};
459
502
  const styleObj = {};
460
- function iterator(name, value) {
461
- if (name.startsWith("-moz-") || name.startsWith("-webkit-") || name.startsWith("-ms-") || name.startsWith("-o-")) {
462
- styleObj[pascalCase(name)] = value;
463
- return;
464
- }
465
- if (name.startsWith("--")) {
466
- styleObj[name] = value;
467
- return;
468
- }
469
- styleObj[camelCase(name)] = value;
470
- }
471
- StyleToObject(css, iterator);
503
+ parseStyleInto(styleObj, css);
472
504
  return styleObj;
473
505
  }
474
- // ../node_modules/.bun/svelte-toolbelt@0.10.6+049bff67fe79e627/node_modules/svelte-toolbelt/dist/utils/execute-callbacks.js
506
+ // ../node_modules/.bun/svelte-toolbelt@0.10.7+294fabd43ca01d33/node_modules/svelte-toolbelt/dist/utils/execute-callbacks.js
475
507
  /**
476
508
  * Executes an array of callback functions with the same arguments.
477
509
  * @template T The types of the arguments that the callback functions take.
@@ -483,7 +515,7 @@ function executeCallbacks(...callbacks) {
483
515
  for (const callback of callbacks) if (typeof callback === "function") callback(...args);
484
516
  };
485
517
  }
486
- // ../node_modules/.bun/svelte-toolbelt@0.10.6+049bff67fe79e627/node_modules/svelte-toolbelt/dist/utils/style-to-css.js
518
+ // ../node_modules/.bun/svelte-toolbelt@0.10.7+294fabd43ca01d33/node_modules/svelte-toolbelt/dist/utils/style-to-css.js
487
519
  function createParser(matcher, replacer) {
488
520
  const regex = RegExp(matcher, "g");
489
521
  return (str) => {
@@ -492,12 +524,28 @@ function createParser(matcher, replacer) {
492
524
  return str.replace(regex, replacer);
493
525
  };
494
526
  }
495
- var camelToKebab = createParser(/[A-Z]/, (match) => `-${match.toLowerCase()}`);
527
+ var camelToKebabUncached = createParser(/[A-Z]/, (match) => `-${match.toLowerCase()}`);
528
+ var kebabCache = /* @__PURE__ */ new Map();
529
+ function camelToKebab(property) {
530
+ let kebab = kebabCache.get(property);
531
+ if (kebab === void 0) {
532
+ kebab = camelToKebabUncached(property);
533
+ if (kebabCache.size >= 1e3) kebabCache.clear();
534
+ kebabCache.set(property, kebab);
535
+ }
536
+ return kebab;
537
+ }
496
538
  function styleToCSS(styleObj) {
497
539
  if (!styleObj || typeof styleObj !== "object" || Array.isArray(styleObj)) throw new TypeError(`expected an argument of type object, but got ${typeof styleObj}`);
498
- return Object.keys(styleObj).map((property) => `${camelToKebab(property)}: ${styleObj[property]};`).join("\n");
540
+ let css = "";
541
+ for (const property of Object.keys(styleObj)) {
542
+ const value = styleObj[property];
543
+ if (value === void 0 || value === null || value === "") continue;
544
+ css += `${css ? "\n" : ""}${camelToKebab(property)}: ${value};`;
545
+ }
546
+ return css;
499
547
  }
500
- // ../node_modules/.bun/svelte-toolbelt@0.10.6+049bff67fe79e627/node_modules/svelte-toolbelt/dist/utils/style.js
548
+ // ../node_modules/.bun/svelte-toolbelt@0.10.7+294fabd43ca01d33/node_modules/svelte-toolbelt/dist/utils/style.js
501
549
  function styleToString(style = {}) {
502
550
  return styleToCSS(style).replace("\n", " ");
503
551
  }
@@ -606,7 +654,7 @@ var EVENT_LIST_SET = /* @__PURE__ */ new Set([
606
654
  "onwebkittransitionend",
607
655
  "onwheel"
608
656
  ]);
609
- // ../node_modules/.bun/svelte-toolbelt@0.10.6+049bff67fe79e627/node_modules/svelte-toolbelt/dist/utils/merge-props.js
657
+ // ../node_modules/.bun/svelte-toolbelt@0.10.7+294fabd43ca01d33/node_modules/svelte-toolbelt/dist/utils/merge-props.js
610
658
  /**
611
659
  * Modified from https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/utils/src/mergeProps.ts (see NOTICE.txt for source)
612
660
  */
@@ -632,7 +680,7 @@ function mergeProps(...args) {
632
680
  const b = props[key];
633
681
  const aIsFunction = typeof a === "function";
634
682
  const bIsFunction = typeof b === "function";
635
- if (aIsFunction && typeof bIsFunction && isEventHandler(key)) result[key] = composeHandlers(a, b);
683
+ if (aIsFunction && bIsFunction && isEventHandler(key)) result[key] = composeHandlers(a, b);
636
684
  else if (aIsFunction && bIsFunction) result[key] = executeCallbacks(a, b);
637
685
  else if (key === "class") {
638
686
  const aIsClassValue = isClassValue(a);
@@ -689,9 +737,9 @@ function mergeProps(...args) {
689
737
  }
690
738
  return result;
691
739
  }
692
- // ../node_modules/.bun/runed@0.35.1+049bff67fe79e627/node_modules/runed/dist/internal/configurable-globals.js
740
+ // ../node_modules/.bun/runed@0.35.1+294fabd43ca01d33/node_modules/runed/dist/internal/configurable-globals.js
693
741
  var defaultWindow = void 0;
694
- // ../node_modules/.bun/runed@0.35.1+049bff67fe79e627/node_modules/runed/dist/internal/utils/dom.js
742
+ // ../node_modules/.bun/runed@0.35.1+294fabd43ca01d33/node_modules/runed/dist/internal/utils/dom.js
695
743
  /**
696
744
  * Handles getting the active element in a document or shadow root.
697
745
  * If the active element is within a shadow root, it will traverse the shadow root
@@ -710,7 +758,7 @@ function getActiveElement$1(document) {
710
758
  }
711
759
  return activeElement;
712
760
  }
713
- // ../node_modules/.bun/runed@0.35.1+049bff67fe79e627/node_modules/runed/dist/utilities/active-element/active-element.svelte.js
761
+ // ../node_modules/.bun/runed@0.35.1+294fabd43ca01d33/node_modules/runed/dist/utilities/active-element/active-element.svelte.js
714
762
  var ActiveElement = class {
715
763
  #document;
716
764
  #subscribe;
@@ -734,11 +782,11 @@ var ActiveElement = class {
734
782
  }
735
783
  };
736
784
  new ActiveElement();
737
- // ../node_modules/.bun/runed@0.35.1+049bff67fe79e627/node_modules/runed/dist/internal/utils/is.js
785
+ // ../node_modules/.bun/runed@0.35.1+294fabd43ca01d33/node_modules/runed/dist/internal/utils/is.js
738
786
  function isFunction(value) {
739
787
  return typeof value === "function";
740
788
  }
741
- // ../node_modules/.bun/runed@0.35.1+049bff67fe79e627/node_modules/runed/dist/utilities/context/context.js
789
+ // ../node_modules/.bun/runed@0.35.1+294fabd43ca01d33/node_modules/runed/dist/utilities/context/context.js
742
790
  var Context = class {
743
791
  #name;
744
792
  #key;
@@ -799,7 +847,7 @@ var Context = class {
799
847
  return setContext(this.#key, context);
800
848
  }
801
849
  };
802
- // ../node_modules/.bun/runed@0.35.1+049bff67fe79e627/node_modules/runed/dist/utilities/watch/watch.svelte.js
850
+ // ../node_modules/.bun/runed@0.35.1+294fabd43ca01d33/node_modules/runed/dist/utilities/watch/watch.svelte.js
803
851
  function runWatcher(sources, flush, effect, options = {}) {
804
852
  const { lazy = false } = options;
805
853
  }
@@ -813,12 +861,12 @@ watch.pre = watchPre;
813
861
  function watchOnce(source, effect) {}
814
862
  function watchOncePre(source, effect) {}
815
863
  watchOnce.pre = watchOncePre;
816
- // ../node_modules/.bun/runed@0.35.1+049bff67fe79e627/node_modules/runed/dist/internal/utils/get.js
864
+ // ../node_modules/.bun/runed@0.35.1+294fabd43ca01d33/node_modules/runed/dist/internal/utils/get.js
817
865
  function get$1(value) {
818
866
  if (isFunction(value)) return value();
819
867
  return value;
820
868
  }
821
- // ../node_modules/.bun/runed@0.35.1+049bff67fe79e627/node_modules/runed/dist/utilities/element-size/element-size.svelte.js
869
+ // ../node_modules/.bun/runed@0.35.1+294fabd43ca01d33/node_modules/runed/dist/utilities/element-size/element-size.svelte.js
822
870
  var ElementSize = class {
823
871
  #size = {
824
872
  width: 0,
@@ -900,7 +948,7 @@ var ElementSize = class {
900
948
  return this.#height();
901
949
  }
902
950
  };
903
- // ../node_modules/.bun/runed@0.35.1+049bff67fe79e627/node_modules/runed/dist/utilities/previous/previous.svelte.js
951
+ // ../node_modules/.bun/runed@0.35.1+294fabd43ca01d33/node_modules/runed/dist/utilities/previous/previous.svelte.js
904
952
  var Previous = class {
905
953
  #previousCallback = () => void 0;
906
954
  #previous = $.derived(() => this.#previousCallback());
@@ -919,7 +967,7 @@ var Previous = class {
919
967
  return this.#previous();
920
968
  }
921
969
  };
922
- // ../node_modules/.bun/runed@0.35.1+049bff67fe79e627/node_modules/runed/dist/utilities/resource/resource.svelte.js
970
+ // ../node_modules/.bun/runed@0.35.1+294fabd43ca01d33/node_modules/runed/dist/utilities/resource/resource.svelte.js
923
971
  function debounce$1(fn, delay) {
924
972
  let timeoutId;
925
973
  let lastResolve = null;
@@ -1030,20 +1078,13 @@ function resourcePre(source, fetcher, options) {
1030
1078
  });
1031
1079
  }
1032
1080
  resource.pre = resourcePre;
1033
- // ../node_modules/.bun/svelte-toolbelt@0.10.6+049bff67fe79e627/node_modules/svelte-toolbelt/dist/utils/on-destroy-effect.svelte.js
1081
+ // ../node_modules/.bun/svelte-toolbelt@0.10.7+294fabd43ca01d33/node_modules/svelte-toolbelt/dist/utils/on-destroy-effect.svelte.js
1034
1082
  function onDestroyEffect(fn) {}
1035
- // ../node_modules/.bun/svelte-toolbelt@0.10.6+049bff67fe79e627/node_modules/svelte-toolbelt/dist/utils/after-sleep.js
1036
- /**
1037
- * A utility function that executes a callback after a specified number of milliseconds.
1038
- */
1039
- function afterSleep(ms, cb) {
1040
- return setTimeout(cb, ms);
1041
- }
1042
- // ../node_modules/.bun/svelte-toolbelt@0.10.6+049bff67fe79e627/node_modules/svelte-toolbelt/dist/utils/after-tick.js
1083
+ // ../node_modules/.bun/svelte-toolbelt@0.10.7+294fabd43ca01d33/node_modules/svelte-toolbelt/dist/utils/after-tick.js
1043
1084
  function afterTick(fn) {
1044
1085
  tick().then(fn);
1045
1086
  }
1046
- // ../node_modules/.bun/svelte-toolbelt@0.10.6+049bff67fe79e627/node_modules/svelte-toolbelt/dist/utils/dom.js
1087
+ // ../node_modules/.bun/svelte-toolbelt@0.10.7+294fabd43ca01d33/node_modules/svelte-toolbelt/dist/utils/dom.js
1047
1088
  var ELEMENT_NODE = 1;
1048
1089
  var DOCUMENT_NODE = 9;
1049
1090
  var DOCUMENT_FRAGMENT_NODE = 11;
@@ -1097,7 +1138,7 @@ function getActiveElement(rootNode) {
1097
1138
  }
1098
1139
  return activeElement;
1099
1140
  }
1100
- // ../node_modules/.bun/svelte-toolbelt@0.10.6+049bff67fe79e627/node_modules/svelte-toolbelt/dist/utils/dom-context.svelte.js
1141
+ // ../node_modules/.bun/svelte-toolbelt@0.10.7+294fabd43ca01d33/node_modules/svelte-toolbelt/dist/utils/dom-context.svelte.js
1101
1142
  var DOMContext = class {
1102
1143
  element;
1103
1144
  #root = $.derived(() => {
@@ -1144,7 +1185,7 @@ var DOMContext = class {
1144
1185
  return this.getWindow().clearTimeout(timeoutId);
1145
1186
  };
1146
1187
  };
1147
- // ../node_modules/.bun/svelte-toolbelt@0.10.6+049bff67fe79e627/node_modules/svelte-toolbelt/dist/utils/attach-ref.js
1188
+ // ../node_modules/.bun/svelte-toolbelt@0.10.7+294fabd43ca01d33/node_modules/svelte-toolbelt/dist/utils/attach-ref.js
1148
1189
  /**
1149
1190
  * Creates a Svelte Attachment that attaches a DOM element to a ref.
1150
1191
  * The ref can be either a WritableBox or a callback function.
@@ -1186,7 +1227,7 @@ function attachRef(ref, onChange) {
1186
1227
  };
1187
1228
  } };
1188
1229
  }
1189
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/attrs.js
1230
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/attrs.js
1190
1231
  function boolToStr(condition) {
1191
1232
  return condition ? "true" : "false";
1192
1233
  }
@@ -1244,57 +1285,7 @@ var META = "Meta";
1244
1285
  var PAGE_DOWN = "PageDown";
1245
1286
  var PAGE_UP = "PageUp";
1246
1287
  var SHIFT = "Shift";
1247
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/locale.js
1248
- /**
1249
- * Detects the text direction in the element.
1250
- * @returns {Direction} The text direction ('ltr' for left-to-right or 'rtl' for right-to-left).
1251
- */
1252
- function getElemDirection(elem) {
1253
- return window.getComputedStyle(elem).getPropertyValue("direction");
1254
- }
1255
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/get-directional-keys.js
1256
- var FIRST_KEYS$1 = [
1257
- ARROW_DOWN,
1258
- PAGE_UP,
1259
- HOME
1260
- ];
1261
- var LAST_KEYS$1 = [
1262
- ARROW_UP,
1263
- PAGE_DOWN,
1264
- "End"
1265
- ];
1266
- [...FIRST_KEYS$1, ...LAST_KEYS$1];
1267
- /**
1268
- * A utility function that returns the next key based on the direction and orientation.
1269
- */
1270
- function getNextKey(dir = "ltr", orientation = "horizontal") {
1271
- return {
1272
- horizontal: dir === "rtl" ? ARROW_LEFT : ARROW_RIGHT,
1273
- vertical: ARROW_DOWN
1274
- }[orientation];
1275
- }
1276
- /**
1277
- * A utility function that returns the previous key based on the direction and orientation.
1278
- */
1279
- function getPrevKey(dir = "ltr", orientation = "horizontal") {
1280
- return {
1281
- horizontal: dir === "rtl" ? ARROW_RIGHT : ARROW_LEFT,
1282
- vertical: ARROW_UP
1283
- }[orientation];
1284
- }
1285
- /**
1286
- * A utility function that returns the next and previous keys based on the direction
1287
- * and orientation.
1288
- */
1289
- function getDirectionalKeys(dir = "ltr", orientation = "horizontal") {
1290
- if (!["ltr", "rtl"].includes(dir)) dir = "ltr";
1291
- if (!["horizontal", "vertical"].includes(orientation)) orientation = "horizontal";
1292
- return {
1293
- nextKey: getNextKey(dir, orientation),
1294
- prevKey: getPrevKey(dir, orientation)
1295
- };
1296
- }
1297
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/is.js
1288
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/is.js
1298
1289
  var isBrowser = typeof document !== "undefined";
1299
1290
  var isIOS = getIsIOS();
1300
1291
  function getIsIOS() {
@@ -1309,6 +1300,14 @@ function isElement$1(element) {
1309
1300
  function isElementOrSVGElement(element) {
1310
1301
  return element instanceof Element || element instanceof SVGElement;
1311
1302
  }
1303
+ /**
1304
+ * Whether the element is natively disabled, including via an ancestor `<fieldset disabled>`.
1305
+ * Browsers still dispatch pointer events to disabled form controls, so handlers that
1306
+ * open/toggle on `pointerdown`/`pointerup` need to check this.
1307
+ */
1308
+ function isDisabledElement(node) {
1309
+ return node?.matches(":disabled") ?? false;
1310
+ }
1312
1311
  function isNotNull(value) {
1313
1312
  return value !== null;
1314
1313
  }
@@ -1319,74 +1318,7 @@ function isNotNull(value) {
1319
1318
  function isSelectableInput(element) {
1320
1319
  return element instanceof HTMLInputElement && "select" in element;
1321
1320
  }
1322
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/roving-focus-group.js
1323
- var RovingFocusGroup = class {
1324
- #opts;
1325
- #currentTabStopId = box(null);
1326
- constructor(opts) {
1327
- this.#opts = opts;
1328
- }
1329
- getCandidateNodes() {
1330
- return [];
1331
- }
1332
- focusFirstCandidate() {
1333
- const items = this.getCandidateNodes();
1334
- if (!items.length) return;
1335
- items[0]?.focus();
1336
- }
1337
- handleKeydown(node, e, both = false) {
1338
- const rootNode = this.#opts.rootNode.current;
1339
- if (!rootNode || !node) return;
1340
- const items = this.getCandidateNodes();
1341
- if (!items.length) return;
1342
- const currentIndex = items.indexOf(node);
1343
- const { nextKey, prevKey } = getDirectionalKeys(getElemDirection(rootNode), this.#opts.orientation.current);
1344
- const loop = this.#opts.loop.current;
1345
- const keyToIndex = {
1346
- [nextKey]: currentIndex + 1,
1347
- [prevKey]: currentIndex - 1,
1348
- [HOME]: 0,
1349
- ["End"]: items.length - 1
1350
- };
1351
- if (both) {
1352
- const altNextKey = nextKey === "ArrowDown" ? ARROW_RIGHT : ARROW_DOWN;
1353
- const altPrevKey = prevKey === "ArrowUp" ? ARROW_LEFT : ARROW_UP;
1354
- keyToIndex[altNextKey] = currentIndex + 1;
1355
- keyToIndex[altPrevKey] = currentIndex - 1;
1356
- }
1357
- let itemIndex = keyToIndex[e.key];
1358
- if (itemIndex === void 0) return;
1359
- e.preventDefault();
1360
- if (itemIndex < 0 && loop) itemIndex = items.length - 1;
1361
- else if (itemIndex === items.length && loop) itemIndex = 0;
1362
- const itemToFocus = items[itemIndex];
1363
- if (!itemToFocus) return;
1364
- itemToFocus.focus();
1365
- this.#currentTabStopId.current = itemToFocus.id;
1366
- this.#opts.onCandidateFocus?.(itemToFocus);
1367
- return itemToFocus;
1368
- }
1369
- getTabIndex(node) {
1370
- const items = this.getCandidateNodes();
1371
- const anyActive = this.#currentTabStopId.current !== null;
1372
- if (node && !anyActive && items[0] === node) {
1373
- this.#currentTabStopId.current = node.id;
1374
- return 0;
1375
- } else if (node?.id === this.#currentTabStopId.current) return 0;
1376
- return -1;
1377
- }
1378
- setCurrentTabStopId(id) {
1379
- this.#currentTabStopId.current = id;
1380
- }
1381
- focusCurrentTabStop() {
1382
- const currentTabStopId = this.#currentTabStopId.current;
1383
- if (!currentTabStopId) return;
1384
- const currentTabStop = this.#opts.rootNode.current?.querySelector(`#${currentTabStopId}`);
1385
- if (!currentTabStop || !isHTMLElement$1(currentTabStop)) return;
1386
- currentTabStop.focus();
1387
- }
1388
- };
1389
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/animations-complete.js
1321
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/animations-complete.js
1390
1322
  var AnimationsComplete = class {
1391
1323
  #opts;
1392
1324
  #currentFrame = null;
@@ -1406,12 +1338,6 @@ var AnimationsComplete = class {
1406
1338
  }
1407
1339
  run(fn) {
1408
1340
  this.#cleanup();
1409
- const node = this.#opts.ref.current;
1410
- if (!node) return;
1411
- if (typeof node.getAnimations !== "function") {
1412
- this.#executeCallback(fn);
1413
- return;
1414
- }
1415
1341
  const runId = this.#runId;
1416
1342
  const executeIfCurrent = () => {
1417
1343
  if (runId !== this.#runId) return;
@@ -1419,6 +1345,12 @@ var AnimationsComplete = class {
1419
1345
  };
1420
1346
  const waitForAnimations = () => {
1421
1347
  if (runId !== this.#runId) return;
1348
+ const node = this.#opts.ref.current;
1349
+ if (!node) return;
1350
+ if (typeof node.getAnimations !== "function") {
1351
+ this.#executeCallback(fn);
1352
+ return;
1353
+ }
1422
1354
  const animations = node.getAnimations();
1423
1355
  if (animations.length === 0) {
1424
1356
  executeIfCurrent();
@@ -1448,6 +1380,8 @@ var AnimationsComplete = class {
1448
1380
  this.#currentFrame = window.requestAnimationFrame(() => {
1449
1381
  this.#currentFrame = null;
1450
1382
  const startingStyleAttr = "data-starting-style";
1383
+ const node = this.#opts.ref.current;
1384
+ if (!node) return;
1451
1385
  if (!node.hasAttribute(startingStyleAttr)) {
1452
1386
  requestWaitForAnimations();
1453
1387
  return;
@@ -1466,14 +1400,16 @@ var AnimationsComplete = class {
1466
1400
  });
1467
1401
  }
1468
1402
  #executeCallback(fn) {
1403
+ const runId = this.#runId;
1469
1404
  const execute = () => {
1405
+ if (runId !== this.#runId) return;
1470
1406
  fn();
1471
1407
  };
1472
- if (this.#opts.afterTick) afterTick(execute);
1408
+ if (this.#opts.afterTick.current) afterTick(execute);
1473
1409
  else execute();
1474
1410
  }
1475
1411
  };
1476
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/presence-manager.svelte.js
1412
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/presence-manager.svelte.js
1477
1413
  var PresenceManager = class {
1478
1414
  #opts;
1479
1415
  #enabled;
@@ -1493,7 +1429,7 @@ var PresenceManager = class {
1493
1429
  watch(() => this.#opts.open.current, (isOpen) => {
1494
1430
  if (!this.#hasMounted) {
1495
1431
  this.#hasMounted = true;
1496
- return;
1432
+ if (isOpen === this.#shouldRender) return;
1497
1433
  }
1498
1434
  this.#clearTransitionFrame();
1499
1435
  if (!isOpen && this.#opts.shouldSkipExitAnimation?.()) {
@@ -1535,17 +1471,115 @@ var PresenceManager = class {
1535
1471
  this.#transitionFrame = null;
1536
1472
  }
1537
1473
  };
1538
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/noop.js
1474
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/noop.js
1539
1475
  /**
1540
1476
  * A no operation function (does nothing)
1541
1477
  */
1542
1478
  function noop() {}
1543
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/create-id.js
1479
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/create-id.js
1544
1480
  function createId(prefixOrUid, uid) {
1545
1481
  if (uid === void 0) return `bits-${prefixOrUid}`;
1546
1482
  return `bits-${prefixOrUid}-${uid}`;
1547
1483
  }
1548
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/events.js
1484
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/config/bits-config.js
1485
+ var BitsConfigContext = new Context("BitsConfig");
1486
+ /**
1487
+ * Gets the current Bits UI configuration state from the context.
1488
+ *
1489
+ * Returns a default configuration (where all values are `undefined`) if no configuration is found.
1490
+ */
1491
+ function getBitsConfig() {
1492
+ const fallback = new BitsConfigState(null, {});
1493
+ return BitsConfigContext.getOr(fallback).opts;
1494
+ }
1495
+ /**
1496
+ * Configuration state that inherits from parent configurations.
1497
+ *
1498
+ * @example
1499
+ * Config resolution:
1500
+ * ```
1501
+ * Level 1: { defaultPortalTo: "#some-element", theme: "dark" }
1502
+ * Level 2: { spacing: "large" } // inherits defaultPortalTo="#some-element", theme="dark"
1503
+ * Level 3: { theme: "light" } // inherits defaultPortalTo="#some-element", spacing="large", overrides theme="light"
1504
+ * ```
1505
+ */
1506
+ var BitsConfigState = class {
1507
+ opts;
1508
+ constructor(parent, opts) {
1509
+ const resolveConfigOption = createConfigResolver(parent, opts);
1510
+ this.opts = {
1511
+ dir: resolveConfigOption((config) => config.dir),
1512
+ defaultPortalTo: resolveConfigOption((config) => config.defaultPortalTo),
1513
+ defaultLocale: resolveConfigOption((config) => config.defaultLocale)
1514
+ };
1515
+ }
1516
+ };
1517
+ /**
1518
+ * Returns a config resolver that resolves a given config option's value.
1519
+ *
1520
+ * The resolver creates reactive boxes that resolve config option values using this priority:
1521
+ * 1. Current level's value (if defined)
1522
+ * 2. Parent level's value (if defined and current is undefined)
1523
+ * 3. `undefined` (if no value is found in either parent or child)
1524
+ *
1525
+ * @param parent - Parent configuration state (null if this is root level)
1526
+ * @param currentOpts - Current level's configuration options
1527
+ *
1528
+ * @example
1529
+ * ```typescript
1530
+ * // Given this hierarchy:
1531
+ * // Root: { defaultPortalTo: "#some-element" }
1532
+ * // Child: { someOtherProp: "value" } // no defaultPortalTo specified
1533
+ *
1534
+ * const resolveConfigOption = createConfigResolver(parent, opts);
1535
+ * const portalTo = resolveConfigOption(config => config.defaultPortalTo);
1536
+ *
1537
+ * // portalTo.current === "#some-element" (inherited from parent)
1538
+ * // even when child didn't specify `defaultPortalTo`
1539
+ * ```
1540
+ */
1541
+ function createConfigResolver(parent, currentOpts) {
1542
+ return (getter) => {
1543
+ return boxWith(() => {
1544
+ const value = getter(currentOpts)?.current;
1545
+ if (value !== void 0) return value;
1546
+ if (parent === null) return void 0;
1547
+ return getter(parent.opts)?.current;
1548
+ });
1549
+ };
1550
+ }
1551
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/config/prop-resolvers.js
1552
+ /**
1553
+ * Creates a generic prop resolver that follows a standard priority chain:
1554
+ * 1. The getter's prop value (if defined)
1555
+ * 2. The config default value (if no getter prop value is defined)
1556
+ * 3. The fallback value (if no config value found)
1557
+ */
1558
+ function createPropResolver(configOption, fallback) {
1559
+ return (getProp) => {
1560
+ const config = getBitsConfig();
1561
+ return boxWith(() => {
1562
+ const propValue = getProp();
1563
+ if (propValue !== void 0) return propValue;
1564
+ const option = configOption(config).current;
1565
+ if (option !== void 0) return option;
1566
+ return fallback;
1567
+ });
1568
+ };
1569
+ }
1570
+ /**
1571
+ * Resolves a portal's `to` value using the prop, the config default, or a fallback.
1572
+ *
1573
+ * Default value: `"body"`
1574
+ */
1575
+ var resolvePortalToProp = createPropResolver((config) => config.defaultPortalTo, "body");
1576
+ /**
1577
+ * Resolves a reading direction using the prop, the config default, or a fallback.
1578
+ *
1579
+ * Default value: `"ltr"`
1580
+ */
1581
+ var resolveDirProp = createPropResolver((config) => config.dir, "ltr");
1582
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/events.js
1549
1583
  /**
1550
1584
  * Creates a typed event dispatcher and listener pair for custom events
1551
1585
  * @template T - The type of data that will be passed in the event detail
@@ -1580,31 +1614,57 @@ var CustomEventDispatcher = class {
1580
1614
  return on(element, this.eventName, handler, options);
1581
1615
  }
1582
1616
  };
1583
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/debounce.js
1617
+ var capturedEventPaths = /* @__PURE__ */ new WeakMap();
1618
+ function captureEventPath(event, path = event.composedPath()) {
1619
+ capturedEventPaths.set(event, path);
1620
+ }
1621
+ function getEventPath(event) {
1622
+ return capturedEventPaths.get(event) ?? event.composedPath();
1623
+ }
1624
+ function isEventTargetWithin(event, node) {
1625
+ if (!node) return false;
1626
+ return isElementOrSVGElement(event.target) && node.contains(event.target) || getEventPath(event).includes(node);
1627
+ }
1628
+ function getEventTargetClosest(event, selector) {
1629
+ for (const target of getEventPath(event)) if (isElementOrSVGElement(target) && target.matches(selector)) return target;
1630
+ return isElementOrSVGElement(event.target) ? event.target.closest(selector) : null;
1631
+ }
1632
+ function copyEventPath(from, to) {
1633
+ captureEventPath(to, getEventPath(from));
1634
+ }
1635
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/debounce.js
1584
1636
  function debounce(fn, wait = 500) {
1585
1637
  let timeout = null;
1638
+ let pendingArgs = null;
1586
1639
  const debounced = (...args) => {
1587
- if (timeout !== null) clearTimeout(timeout);
1588
- timeout = setTimeout(() => {
1589
- fn(...args);
1590
- }, wait);
1640
+ debounced.destroy();
1641
+ pendingArgs = args;
1642
+ timeout = setTimeout(debounced.flush, wait);
1643
+ };
1644
+ /** Runs the pending call now, if there is one. */
1645
+ debounced.flush = () => {
1646
+ if (pendingArgs === null) return;
1647
+ const args = pendingArgs;
1648
+ debounced.destroy();
1649
+ fn(...args);
1591
1650
  };
1592
1651
  debounced.destroy = () => {
1593
1652
  if (timeout !== null) {
1594
1653
  clearTimeout(timeout);
1595
1654
  timeout = null;
1596
1655
  }
1656
+ pendingArgs = null;
1597
1657
  };
1598
1658
  return debounced;
1599
1659
  }
1600
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/elements.js
1660
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/elements.js
1601
1661
  function isOrContainsTarget(node, target) {
1602
1662
  return node === target || node.contains(target);
1603
1663
  }
1604
1664
  function getOwnerDocument(el) {
1605
1665
  return el?.ownerDocument ?? document;
1606
1666
  }
1607
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/dom.js
1667
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/dom.js
1608
1668
  /**
1609
1669
  * Determines if the click event truly occurred outside the content node.
1610
1670
  * This was added to handle password managers and other elements that may be injected
@@ -1615,1952 +1675,690 @@ function isClickTrulyOutside(event, contentNode) {
1615
1675
  const rect = contentNode.getBoundingClientRect();
1616
1676
  return clientX < rect.left || clientX > rect.right || clientY < rect.top || clientY > rect.bottom;
1617
1677
  }
1618
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/menu/utils.js
1619
- var SELECTION_KEYS = [ENTER, " "];
1620
- var FIRST_KEYS = [
1621
- ARROW_DOWN,
1622
- PAGE_UP,
1623
- HOME
1624
- ];
1625
- var LAST_KEYS = [
1626
- ARROW_UP,
1627
- PAGE_DOWN,
1628
- "End"
1629
- ];
1630
- var FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
1631
- [...SELECTION_KEYS], [...SELECTION_KEYS];
1632
- function isMouseEvent(event) {
1633
- return event.pointerType === "mouse";
1634
- }
1635
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/focus.js
1636
- /**
1637
- * A utility function that focuses an element.
1638
- */
1639
- function focus(element, { select = false } = {}) {
1640
- if (!element || !element.focus) return;
1641
- const doc = getDocument(element);
1642
- if (doc.activeElement === element) return;
1643
- const previouslyFocusedElement = doc.activeElement;
1644
- element.focus({ preventScroll: true });
1645
- if (element !== previouslyFocusedElement && isSelectableInput(element) && select) element.select();
1646
- }
1647
- /**
1648
- * Attempts to focus the first element in a list of candidates.
1649
- * Stops when focus is successful.
1650
- */
1651
- function focusFirst(candidates, { select = false } = {}, getActiveElement) {
1652
- const previouslyFocusedElement = getActiveElement();
1653
- for (const candidate of candidates) {
1654
- focus(candidate, { select });
1655
- if (getActiveElement() !== previouslyFocusedElement) return true;
1656
- }
1657
- }
1658
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/is-using-keyboard/is-using-keyboard.svelte.js
1659
- var isUsingKeyboard = false;
1660
- var IsUsingKeyboard = class {
1661
- static _refs = 0;
1662
- static _cleanup;
1663
- constructor() {}
1664
- get current() {
1665
- return isUsingKeyboard;
1678
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/menu/context-menu-attributes.js
1679
+ var CONTEXT_MENU_TRIGGER_ATTR = "data-context-menu-trigger";
1680
+ var CONTEXT_MENU_CONTENT_ATTR = "data-context-menu-content";
1681
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/dismissible-layer/use-dismissable-layer.svelte.js
1682
+ globalThis.bitsDismissableLayers ??= /* @__PURE__ */ new Map();
1683
+ var DismissibleLayerState = class DismissibleLayerState {
1684
+ static create(opts) {
1685
+ return new DismissibleLayerState(opts);
1666
1686
  }
1667
- set current(value) {
1668
- isUsingKeyboard = value;
1687
+ opts;
1688
+ #interactOutsideSnapshot = noop;
1689
+ #isValidEventSnapshot = () => false;
1690
+ #nodeSnapshot = null;
1691
+ #behaviorType = simpleBox("close");
1692
+ #interceptedEvents = { pointerdown: false };
1693
+ #isResponsibleLayer = false;
1694
+ #capturedPointerDown = null;
1695
+ #isFocusInsideDOMTree = false;
1696
+ #documentObj = void 0;
1697
+ #onFocusOutsideSnapshot = noop;
1698
+ #unsubClickListener = noop;
1699
+ /**
1700
+ * Set once the layer is torn down. Deferred work scheduled before teardown can
1701
+ * still run afterwards, so every such callback must short-circuit on this
1702
+ * before using `this.#nodeSnapshot`. A class field rather than a constructor
1703
+ * local so the class-field handlers below can see it too.
1704
+ */
1705
+ #destroyed = false;
1706
+ constructor(opts) {
1707
+ this.opts = opts;
1708
+ let unsubEvents = noop;
1709
+ let registeredNode = null;
1710
+ const cleanup = () => {
1711
+ registeredNode = null;
1712
+ this.#resetState();
1713
+ globalThis.bitsDismissableLayers.delete(this);
1714
+ this.#handleInteractOutside.destroy();
1715
+ this.#unsubClickListener();
1716
+ unsubEvents();
1717
+ };
1718
+ watch([() => this.opts.enabled.current, () => this.opts.ref.current], ([enabled, node]) => {
1719
+ const nextNode = enabled ? node : null;
1720
+ if (registeredNode === nextNode) return;
1721
+ cleanup();
1722
+ if (!nextNode) return;
1723
+ registeredNode = nextNode;
1724
+ this.#documentObj = getOwnerDocument(nextNode);
1725
+ globalThis.bitsDismissableLayers.set(this, this.#behaviorType);
1726
+ unsubEvents = this.#addEventListeners();
1727
+ });
1669
1728
  }
1670
- };
1671
- // ../node_modules/.bun/tabbable@6.4.0/node_modules/tabbable/dist/index.esm.js
1672
- /*!
1673
- * tabbable 6.4.0
1674
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
1675
- */
1676
- var candidateSelectors = [
1677
- "input:not([inert]):not([inert] *)",
1678
- "select:not([inert]):not([inert] *)",
1679
- "textarea:not([inert]):not([inert] *)",
1680
- "a[href]:not([inert]):not([inert] *)",
1681
- "button:not([inert]):not([inert] *)",
1682
- "[tabindex]:not(slot):not([inert]):not([inert] *)",
1683
- "audio[controls]:not([inert]):not([inert] *)",
1684
- "video[controls]:not([inert]):not([inert] *)",
1685
- "[contenteditable]:not([contenteditable=\"false\"]):not([inert]):not([inert] *)",
1686
- "details>summary:first-of-type:not([inert]):not([inert] *)",
1687
- "details:not([inert]):not([inert] *)"
1688
- ];
1689
- var candidateSelector = /* #__PURE__ */ candidateSelectors.join(",");
1690
- var NoElement = typeof Element === "undefined";
1691
- var matches = NoElement ? function() {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
1692
- var getRootNode = !NoElement && Element.prototype.getRootNode ? function(element) {
1693
- var _element$getRootNode;
1694
- return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element);
1695
- } : function(element) {
1696
- return element === null || element === void 0 ? void 0 : element.ownerDocument;
1697
- };
1698
- /**
1699
- * Determines if a node is inert or in an inert ancestor.
1700
- * @param {Node} [node]
1701
- * @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to
1702
- * see if any of them are inert. If false, only `node` itself is considered.
1703
- * @returns {boolean} True if inert itself or by way of being in an inert ancestor.
1704
- * False if `node` is falsy.
1705
- */
1706
- var _isInert = function isInert(node, lookUp) {
1707
- var _node$getAttribute;
1708
- if (lookUp === void 0) lookUp = true;
1709
- var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, "inert");
1710
- return inertAtt === "" || inertAtt === "true" || lookUp && node && (typeof node.closest === "function" ? node.closest("[inert]") : _isInert(node.parentNode));
1711
- };
1712
- /**
1713
- * Determines if a node's content is editable.
1714
- * @param {Element} [node]
1715
- * @returns True if it's content-editable; false if it's not or `node` is falsy.
1716
- */
1717
- var isContentEditable = function isContentEditable(node) {
1718
- var _node$getAttribute2;
1719
- var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, "contenteditable");
1720
- return attValue === "" || attValue === "true";
1721
- };
1722
- /**
1723
- * @param {Element} el container to check in
1724
- * @param {boolean} includeContainer add container to check
1725
- * @param {(node: Element) => boolean} filter filter candidates
1726
- * @returns {Element[]}
1727
- */
1728
- var getCandidates = function getCandidates(el, includeContainer, filter) {
1729
- if (_isInert(el)) return [];
1730
- var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
1731
- if (includeContainer && matches.call(el, candidateSelector)) candidates.unshift(el);
1732
- candidates = candidates.filter(filter);
1733
- return candidates;
1734
- };
1735
- /**
1736
- * @callback GetShadowRoot
1737
- * @param {Element} element to check for shadow root
1738
- * @returns {ShadowRoot|boolean} ShadowRoot if available or boolean indicating if a shadowRoot is attached but not available.
1739
- */
1740
- /**
1741
- * @callback ShadowRootFilter
1742
- * @param {Element} shadowHostNode the element which contains shadow content
1743
- * @returns {boolean} true if a shadow root could potentially contain valid candidates.
1744
- */
1745
- /**
1746
- * @typedef {Object} CandidateScope
1747
- * @property {Element} scopeParent contains inner candidates
1748
- * @property {Element[]} candidates list of candidates found in the scope parent
1749
- */
1750
- /**
1751
- * @typedef {Object} IterativeOptions
1752
- * @property {GetShadowRoot|boolean} getShadowRoot true if shadow support is enabled; falsy if not;
1753
- * if a function, implies shadow support is enabled and either returns the shadow root of an element
1754
- * or a boolean stating if it has an undisclosed shadow root
1755
- * @property {(node: Element) => boolean} filter filter candidates
1756
- * @property {boolean} flatten if true then result will flatten any CandidateScope into the returned list
1757
- * @property {ShadowRootFilter} shadowRootFilter filter shadow roots;
1758
- */
1759
- /**
1760
- * @param {Element[]} elements list of element containers to match candidates from
1761
- * @param {boolean} includeContainer add container list to check
1762
- * @param {IterativeOptions} options
1763
- * @returns {Array.<Element|CandidateScope>}
1764
- */
1765
- var _getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {
1766
- var candidates = [];
1767
- var elementsToCheck = Array.from(elements);
1768
- while (elementsToCheck.length) {
1769
- var element = elementsToCheck.shift();
1770
- if (_isInert(element, false)) continue;
1771
- if (element.tagName === "SLOT") {
1772
- var assigned = element.assignedElements();
1773
- var nestedCandidates = _getCandidatesIteratively(assigned.length ? assigned : element.children, true, options);
1774
- if (options.flatten) candidates.push.apply(candidates, nestedCandidates);
1775
- else candidates.push({
1776
- scopeParent: element,
1777
- candidates: nestedCandidates
1729
+ #handleFocus = (event) => {
1730
+ if (event.defaultPrevented) return;
1731
+ if (this.#destroyed || !this.#nodeSnapshot) return;
1732
+ afterTick(() => {
1733
+ if (this.#destroyed) return;
1734
+ if (!this.#nodeSnapshot || this.#isTargetWithinLayer(event.target)) return;
1735
+ if (event.target && !this.#isFocusInsideDOMTree) this.#onFocusOutsideSnapshot?.(event);
1736
+ });
1737
+ };
1738
+ #addEventListeners() {
1739
+ const document = this.#documentObj;
1740
+ const onPointerDownCapture = (event) => {
1741
+ untrack(() => {
1742
+ this.#handleInteractOutside.flush();
1743
+ this.#markInterceptedEvent(event);
1744
+ this.#markResponsibleLayer(event);
1778
1745
  });
1779
- } else {
1780
- if (matches.call(element, candidateSelector) && options.filter(element) && (includeContainer || !elements.includes(element))) candidates.push(element);
1781
- var shadowRoot = element.shadowRoot || typeof options.getShadowRoot === "function" && options.getShadowRoot(element);
1782
- var validShadowRoot = !_isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));
1783
- if (shadowRoot && validShadowRoot) {
1784
- var _nestedCandidates = _getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);
1785
- if (options.flatten) candidates.push.apply(candidates, _nestedCandidates);
1786
- else candidates.push({
1787
- scopeParent: element,
1788
- candidates: _nestedCandidates
1789
- });
1790
- } else elementsToCheck.unshift.apply(elementsToCheck, element.children);
1791
- }
1792
- }
1793
- return candidates;
1794
- };
1795
- /**
1796
- * @private
1797
- * Determines if the node has an explicitly specified `tabindex` attribute.
1798
- * @param {HTMLElement} node
1799
- * @returns {boolean} True if so; false if not.
1800
- */
1801
- var hasTabIndex = function hasTabIndex(node) {
1802
- return !isNaN(parseInt(node.getAttribute("tabindex"), 10));
1803
- };
1804
- /**
1805
- * Determine the tab index of a given node.
1806
- * @param {HTMLElement} node
1807
- * @returns {number} Tab order (negative, 0, or positive number).
1808
- * @throws {Error} If `node` is falsy.
1809
- */
1810
- var getTabIndex = function getTabIndex(node) {
1811
- if (!node) throw new Error("No node provided");
1812
- if (node.tabIndex < 0) {
1813
- if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) return 0;
1746
+ };
1747
+ const onPointerDown = (event) => {
1748
+ if (event.cancelBubble || event !== this.#capturedPointerDown) return;
1749
+ this.#markNonInterceptedEvent(event);
1750
+ if (event.pointerType === "touch") {
1751
+ this.#handleInteractOutside.destroy();
1752
+ this.#interactOutside(event);
1753
+ } else this.#handleInteractOutside(event);
1754
+ };
1755
+ document.addEventListener("pointerdown", onPointerDownCapture, true);
1756
+ document.addEventListener("pointerdown", onPointerDown);
1757
+ return executeCallbacks(() => document.removeEventListener("pointerdown", onPointerDownCapture, true), () => document.removeEventListener("pointerdown", onPointerDown), on(document, "focusin", this.#handleFocus));
1814
1758
  }
1815
- return node.tabIndex;
1816
- };
1817
- /**
1818
- * Determine the tab index of a given node __for sort order purposes__.
1819
- * @param {HTMLElement} node
1820
- * @param {boolean} [isScope] True for a custom element with shadow root or slot that, by default,
1821
- * has tabIndex -1, but needs to be sorted by document order in order for its content to be
1822
- * inserted into the correct sort position.
1823
- * @returns {number} Tab order (negative, 0, or positive number).
1824
- */
1825
- var getSortOrderTabIndex = function getSortOrderTabIndex(node, isScope) {
1826
- var tabIndex = getTabIndex(node);
1827
- if (tabIndex < 0 && isScope && !hasTabIndex(node)) return 0;
1828
- return tabIndex;
1829
- };
1830
- var sortOrderedTabbables = function sortOrderedTabbables(a, b) {
1831
- return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
1832
- };
1833
- var isInput = function isInput(node) {
1834
- return node.tagName === "INPUT";
1835
- };
1836
- var isHiddenInput = function isHiddenInput(node) {
1837
- return isInput(node) && node.type === "hidden";
1838
- };
1839
- var isDetailsWithSummary = function isDetailsWithSummary(node) {
1840
- return node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) {
1841
- return child.tagName === "SUMMARY";
1842
- });
1843
- };
1844
- var getCheckedRadio = function getCheckedRadio(nodes, form) {
1845
- for (var i = 0; i < nodes.length; i++) if (nodes[i].checked && nodes[i].form === form) return nodes[i];
1846
- };
1847
- var isTabbableRadio = function isTabbableRadio(node) {
1848
- if (!node.name) return true;
1849
- var radioScope = node.form || getRootNode(node);
1850
- var queryRadios = function queryRadios(name) {
1851
- return radioScope.querySelectorAll("input[type=\"radio\"][name=\"" + name + "\"]");
1759
+ #handleDismiss = (e) => {
1760
+ let event = e;
1761
+ if (event.defaultPrevented) event = createWrappedEvent(e);
1762
+ this.#interactOutsideSnapshot(e);
1852
1763
  };
1853
- var radioSet;
1854
- if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") radioSet = queryRadios(window.CSS.escape(node.name));
1855
- else try {
1856
- radioSet = queryRadios(node.name);
1857
- } catch (err) {
1858
- console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", err.message);
1859
- return false;
1860
- }
1861
- var checked = getCheckedRadio(radioSet, node.form);
1862
- return !checked || checked === node;
1863
- };
1864
- var isRadio = function isRadio(node) {
1865
- return isInput(node) && node.type === "radio";
1866
- };
1867
- var isNonTabbableRadio = function isNonTabbableRadio(node) {
1868
- return isRadio(node) && !isTabbableRadio(node);
1869
- };
1870
- var isNodeAttached = function isNodeAttached(node) {
1871
- var _nodeRoot;
1872
- var nodeRoot = node && getRootNode(node);
1873
- var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host;
1874
- var attached = false;
1875
- if (nodeRoot && nodeRoot !== node) {
1876
- var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument;
1877
- attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node));
1878
- while (!attached && nodeRootHost) {
1879
- var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD;
1880
- nodeRoot = getRootNode(nodeRootHost);
1881
- nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host;
1882
- attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost));
1764
+ #interactOutside = (e) => {
1765
+ if (!this.#nodeSnapshot) {
1766
+ this.#unsubClickListener();
1767
+ return;
1768
+ }
1769
+ const isEventValid = this.#isValidEventSnapshot(e, this.#nodeSnapshot) || isValidEvent(e, this.#nodeSnapshot);
1770
+ if (!this.#isResponsibleLayer || this.#isAnyEventIntercepted() || !isEventValid) {
1771
+ this.#unsubClickListener();
1772
+ return;
1773
+ }
1774
+ let event = e;
1775
+ if (event.defaultPrevented) event = createWrappedEvent(event);
1776
+ if (this.#behaviorType.current !== "close" && this.#behaviorType.current !== "defer-otherwise-close") {
1777
+ this.#unsubClickListener();
1778
+ return;
1883
1779
  }
1780
+ if (e.pointerType === "touch") {
1781
+ this.#unsubClickListener();
1782
+ let backup = null;
1783
+ let unsubClick = noop;
1784
+ const dismiss = (event) => {
1785
+ unsubClick();
1786
+ this.#handleDismiss(event);
1787
+ };
1788
+ unsubClick = executeCallbacks(on(this.#documentObj, "click", dismiss, { once: true }), on(this.#documentObj, "click", (event) => {
1789
+ captureEventPath(event);
1790
+ backup = setTimeout(() => dismiss(event), 0);
1791
+ }, {
1792
+ once: true,
1793
+ capture: true
1794
+ }), () => {
1795
+ if (backup !== null) clearTimeout(backup);
1796
+ backup = null;
1797
+ });
1798
+ this.#unsubClickListener = unsubClick;
1799
+ } else this.#interactOutsideSnapshot(event);
1800
+ };
1801
+ #handleInteractOutside = debounce(this.#interactOutside, 10);
1802
+ #markInterceptedEvent = (e) => {
1803
+ this.#interceptedEvents[e.type] = true;
1804
+ };
1805
+ #markNonInterceptedEvent = (e) => {
1806
+ this.#interceptedEvents[e.type] = false;
1807
+ };
1808
+ #markResponsibleLayer = (event) => {
1809
+ this.#capturedPointerDown = event;
1810
+ captureEventPath(event);
1811
+ if (!this.#nodeSnapshot) return;
1812
+ this.#isResponsibleLayer = isResponsibleLayer(this);
1813
+ };
1814
+ #isTargetWithinLayer = (target) => {
1815
+ if (!this.#nodeSnapshot) return false;
1816
+ return isOrContainsTarget(this.#nodeSnapshot, target);
1817
+ };
1818
+ /**
1819
+ * Resets the per-interaction state. Must stay synchronous.
1820
+ *
1821
+ * This was a `debounce(..., 20)` from when it was also wired to a capture-phase
1822
+ * interaction-end listener and had to land after the 10ms `#handleInteractOutside`
1823
+ * debounce. That listener is gone, but the debounce stayed on the `cleanup()` path —
1824
+ * and because `watch` runs `cleanup()` once per open (`ref` goes null -> node), every
1825
+ * layer scheduled a reset 20ms into its own lifetime. An outside `pointerdown` landing
1826
+ * 10-20ms after that cleanup would have its `#isResponsibleLayer` flag cleared by the
1827
+ * stale reset in the gap before the debounced `#handleInteractOutside` ran, which then
1828
+ * bailed and left the layer open. `cleanup()` destroys `#handleInteractOutside` anyway,
1829
+ * so nothing is left in flight that needs to observe the pre-reset state.
1830
+ */
1831
+ #resetState = () => {
1832
+ for (const eventType in this.#interceptedEvents) this.#interceptedEvents[eventType] = false;
1833
+ this.#isResponsibleLayer = false;
1834
+ this.#capturedPointerDown = null;
1835
+ };
1836
+ #isAnyEventIntercepted() {
1837
+ return Object.values(this.#interceptedEvents).some(Boolean);
1884
1838
  }
1885
- return attached;
1886
- };
1887
- var isZeroArea = function isZeroArea(node) {
1888
- var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height;
1889
- return width === 0 && height === 0;
1839
+ #onfocuscapture = () => {
1840
+ this.#isFocusInsideDOMTree = true;
1841
+ };
1842
+ #onblurcapture = () => {
1843
+ this.#isFocusInsideDOMTree = false;
1844
+ };
1845
+ props = {
1846
+ onfocuscapture: this.#onfocuscapture,
1847
+ onblurcapture: this.#onblurcapture
1848
+ };
1890
1849
  };
1891
- var isHidden = function isHidden(node, _ref) {
1892
- var displayCheck = _ref.displayCheck, getShadowRoot = _ref.getShadowRoot;
1893
- if (displayCheck === "full-native") {
1894
- if ("checkVisibility" in node) return !node.checkVisibility({
1895
- checkOpacity: false,
1896
- opacityProperty: false,
1897
- contentVisibilityAuto: true,
1898
- visibilityProperty: true,
1899
- checkVisibilityCSS: true
1850
+ function getTopMostDismissableLayer(layersArr = [...globalThis.bitsDismissableLayers]) {
1851
+ return layersArr.findLast(([_, { current: behaviorType }]) => behaviorType === "close" || behaviorType === "ignore");
1852
+ }
1853
+ function isResponsibleLayer(layer) {
1854
+ const layersArr = [...globalThis.bitsDismissableLayers];
1855
+ /**
1856
+ * We first check if we can find a top layer with `close` or `ignore`.
1857
+ * If that top layer was found and is the provided layer, then that layer is
1858
+ * responsible for the outside interaction. Otherwise, we know that all layers defer so
1859
+ * the first layer is the responsible one.
1860
+ */
1861
+ const topMostLayer = getTopMostDismissableLayer(layersArr);
1862
+ if (topMostLayer) return topMostLayer[0] === layer;
1863
+ const [firstLayer] = layersArr[0];
1864
+ return firstLayer === layer;
1865
+ }
1866
+ function isValidEvent(e, node) {
1867
+ const target = e.target;
1868
+ if (!isElementOrSVGElement(target)) return false;
1869
+ const targetIsContextMenuTrigger = Boolean(getEventTargetClosest(e, `[${CONTEXT_MENU_TRIGGER_ATTR}]`));
1870
+ const nodeIsContextMenu = Boolean(node.closest(`[${CONTEXT_MENU_CONTENT_ATTR}]`));
1871
+ if ("button" in e && e.button > 0 && !targetIsContextMenuTrigger) return false;
1872
+ if ("button" in e && e.button === 0 && targetIsContextMenuTrigger && nodeIsContextMenu) return true;
1873
+ if (targetIsContextMenuTrigger && nodeIsContextMenu) return false;
1874
+ return getOwnerDocument(target).documentElement.contains(target) && !isEventTargetWithin(e, node) && isClickTrulyOutside(e, node);
1875
+ }
1876
+ function createWrappedEvent(e) {
1877
+ const capturedCurrentTarget = e.currentTarget;
1878
+ const capturedTarget = e.target;
1879
+ let newEvent;
1880
+ if (e instanceof PointerEvent) newEvent = new PointerEvent(e.type, e);
1881
+ else newEvent = new PointerEvent("pointerdown", e);
1882
+ let isPrevented = false;
1883
+ const wrappedEvent = new Proxy(newEvent, { get: (target, prop) => {
1884
+ if (prop === "currentTarget") return capturedCurrentTarget;
1885
+ if (prop === "target") return capturedTarget;
1886
+ if (prop === "preventDefault") return () => {
1887
+ isPrevented = true;
1888
+ if (typeof target.preventDefault === "function") target.preventDefault();
1889
+ };
1890
+ if (prop === "defaultPrevented") return isPrevented;
1891
+ if (prop in target) {
1892
+ const value = target[prop];
1893
+ return typeof value === "function" ? value.bind(target) : value;
1894
+ }
1895
+ const value = e[prop];
1896
+ return typeof value === "function" ? value.bind(e) : value;
1897
+ } });
1898
+ copyEventPath(e, wrappedEvent);
1899
+ return wrappedEvent;
1900
+ }
1901
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/dismissible-layer/dismissible-layer.svelte
1902
+ function Dismissible_layer($$renderer, $$props) {
1903
+ $$renderer.component(($$renderer) => {
1904
+ let { interactOutsideBehavior = "close", onInteractOutside = noop, onFocusOutside = noop, id, children, enabled, isValidEvent = () => false, ref } = $$props;
1905
+ const dismissibleLayerState = DismissibleLayerState.create({
1906
+ id: boxWith(() => id),
1907
+ interactOutsideBehavior: boxWith(() => interactOutsideBehavior),
1908
+ onInteractOutside: boxWith(() => onInteractOutside),
1909
+ enabled: boxWith(() => enabled),
1910
+ onFocusOutside: boxWith(() => onFocusOutside),
1911
+ isValidEvent: boxWith(() => isValidEvent),
1912
+ ref: untrack(() => ref)
1900
1913
  });
1914
+ children?.($$renderer, { props: dismissibleLayerState.props });
1915
+ $$renderer.push(`<!---->`);
1916
+ });
1917
+ }
1918
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/escape-layer/use-escape-layer.svelte.js
1919
+ globalThis.bitsEscapeLayers ??= /* @__PURE__ */ new Map();
1920
+ var EscapeLayerState = class EscapeLayerState {
1921
+ static create(opts) {
1922
+ return new EscapeLayerState(opts);
1901
1923
  }
1902
- if (getComputedStyle(node).visibility === "hidden") return true;
1903
- var nodeUnderDetails = matches.call(node, "details>summary:first-of-type") ? node.parentElement : node;
1904
- if (matches.call(nodeUnderDetails, "details:not([open]) *")) return true;
1905
- if (!displayCheck || displayCheck === "full" || displayCheck === "full-native" || displayCheck === "legacy-full") {
1906
- if (typeof getShadowRoot === "function") {
1907
- var originalNode = node;
1908
- while (node) {
1909
- var parentElement = node.parentElement;
1910
- var rootNode = getRootNode(node);
1911
- if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true) return isZeroArea(node);
1912
- else if (node.assignedSlot) node = node.assignedSlot;
1913
- else if (!parentElement && rootNode !== node.ownerDocument) node = rootNode.host;
1914
- else node = parentElement;
1915
- }
1916
- node = originalNode;
1917
- }
1918
- if (isNodeAttached(node)) return !node.getClientRects().length;
1919
- if (displayCheck !== "legacy-full") return true;
1920
- } else if (displayCheck === "non-zero-area") return isZeroArea(node);
1921
- return false;
1922
- };
1923
- var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
1924
- if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
1925
- var parentNode = node.parentElement;
1926
- while (parentNode) {
1927
- if (parentNode.tagName === "FIELDSET" && parentNode.disabled) {
1928
- for (var i = 0; i < parentNode.children.length; i++) {
1929
- var child = parentNode.children.item(i);
1930
- if (child.tagName === "LEGEND") return matches.call(parentNode, "fieldset[disabled] *") ? true : !child.contains(node);
1931
- }
1932
- return true;
1924
+ opts;
1925
+ domContext;
1926
+ constructor(opts) {
1927
+ this.opts = opts;
1928
+ this.domContext = new DOMContext(this.opts.ref);
1929
+ let unsubEvents = noop;
1930
+ watch(() => opts.enabled.current, (enabled) => {
1931
+ if (enabled) {
1932
+ globalThis.bitsEscapeLayers.set(this, opts.escapeKeydownBehavior);
1933
+ unsubEvents = this.#addEventListener();
1933
1934
  }
1934
- parentNode = parentNode.parentElement;
1935
- }
1935
+ return () => {
1936
+ unsubEvents();
1937
+ globalThis.bitsEscapeLayers.delete(this);
1938
+ };
1939
+ });
1936
1940
  }
1937
- return false;
1938
- };
1939
- var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
1940
- if (node.disabled || isHiddenInput(node) || isHidden(node, options) || isDetailsWithSummary(node) || isDisabledFromFieldset(node)) return false;
1941
- return true;
1942
- };
1943
- var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {
1944
- if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) return false;
1945
- return true;
1946
- };
1947
- var isShadowRootTabbable = function isShadowRootTabbable(shadowHostNode) {
1948
- var tabIndex = parseInt(shadowHostNode.getAttribute("tabindex"), 10);
1949
- if (isNaN(tabIndex) || tabIndex >= 0) return true;
1950
- return false;
1941
+ #addEventListener = () => {
1942
+ return on(this.domContext.getDocument(), "keydown", this.#onkeydown, { passive: false });
1943
+ };
1944
+ #onkeydown = (e) => {
1945
+ if (e.key !== "Escape" || !isResponsibleEscapeLayer(this)) return;
1946
+ const clonedEvent = new KeyboardEvent(e.type, e);
1947
+ e.preventDefault();
1948
+ const behaviorType = this.opts.escapeKeydownBehavior.current;
1949
+ if (behaviorType !== "close" && behaviorType !== "defer-otherwise-close") return;
1950
+ this.opts.onEscapeKeydown.current(clonedEvent);
1951
+ };
1951
1952
  };
1952
- /**
1953
- * @param {Array.<Element|CandidateScope>} candidates
1954
- * @returns Element[]
1955
- */
1956
- var _sortByOrder = function sortByOrder(candidates) {
1957
- var regularTabbables = [];
1958
- var orderedTabbables = [];
1959
- candidates.forEach(function(item, i) {
1960
- var isScope = !!item.scopeParent;
1961
- var element = isScope ? item.scopeParent : item;
1962
- var candidateTabindex = getSortOrderTabIndex(element, isScope);
1963
- var elements = isScope ? _sortByOrder(item.candidates) : element;
1964
- if (candidateTabindex === 0) isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
1965
- else orderedTabbables.push({
1966
- documentOrder: i,
1967
- tabIndex: candidateTabindex,
1968
- item,
1969
- isScope,
1970
- content: elements
1953
+ function isResponsibleEscapeLayer(instance) {
1954
+ const layersArr = [...globalThis.bitsEscapeLayers];
1955
+ /**
1956
+ * We first check if we can find a top layer with `close` or `ignore`.
1957
+ * If that top layer was found and matches the provided node, then the node is
1958
+ * responsible for the escape. Otherwise, we know that all layers defer so
1959
+ * the first layer is the responsible one.
1960
+ */
1961
+ const topMostLayer = layersArr.findLast(([_, { current: behaviorType }]) => behaviorType === "close" || behaviorType === "ignore");
1962
+ if (topMostLayer) return topMostLayer[0] === instance;
1963
+ const [firstLayerNode] = layersArr[0];
1964
+ return firstLayerNode === instance;
1965
+ }
1966
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/escape-layer/escape-layer.svelte
1967
+ function Escape_layer($$renderer, $$props) {
1968
+ $$renderer.component(($$renderer) => {
1969
+ let { escapeKeydownBehavior = "close", onEscapeKeydown = noop, children, enabled, ref } = $$props;
1970
+ EscapeLayerState.create({
1971
+ escapeKeydownBehavior: boxWith(() => escapeKeydownBehavior),
1972
+ onEscapeKeydown: boxWith(() => onEscapeKeydown),
1973
+ enabled: boxWith(() => enabled),
1974
+ ref: untrack(() => ref)
1971
1975
  });
1976
+ children?.($$renderer);
1977
+ $$renderer.push(`<!---->`);
1972
1978
  });
1973
- return orderedTabbables.sort(sortOrderedTabbables).reduce(function(acc, sortable) {
1974
- sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);
1975
- return acc;
1976
- }, []).concat(regularTabbables);
1977
- };
1978
- var tabbable = function tabbable(container, options) {
1979
- options = options || {};
1980
- var candidates;
1981
- if (options.getShadowRoot) candidates = _getCandidatesIteratively([container], options.includeContainer, {
1982
- filter: isNodeMatchingSelectorTabbable.bind(null, options),
1983
- flatten: false,
1984
- getShadowRoot: options.getShadowRoot,
1985
- shadowRootFilter: isShadowRootTabbable
1986
- });
1987
- else candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
1988
- return _sortByOrder(candidates);
1979
+ }
1980
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/focus-scope/focus-scope-manager.js
1981
+ var FocusScopeManager = class FocusScopeManager {
1982
+ static instance;
1983
+ #scopeStack = simpleBox([]);
1984
+ #focusHistory = /* @__PURE__ */ new WeakMap();
1985
+ #preFocusHistory = /* @__PURE__ */ new WeakMap();
1986
+ static getInstance() {
1987
+ if (!this.instance) this.instance = new FocusScopeManager();
1988
+ return this.instance;
1989
+ }
1990
+ register(scope) {
1991
+ const current = this.getActive();
1992
+ if (current && current !== scope) current.pause();
1993
+ const activeElement = getActiveElement(document);
1994
+ if (activeElement && activeElement !== document.body) this.#preFocusHistory.set(scope, activeElement);
1995
+ this.#scopeStack.current = this.#scopeStack.current.filter((s) => s !== scope);
1996
+ this.#scopeStack.current.unshift(scope);
1997
+ scope.resume();
1998
+ }
1999
+ unregister(scope) {
2000
+ this.#scopeStack.current = this.#scopeStack.current.filter((s) => s !== scope);
2001
+ const next = this.getActive();
2002
+ if (next) next.resume();
2003
+ }
2004
+ getActive() {
2005
+ return this.#scopeStack.current[0];
2006
+ }
2007
+ setFocusMemory(scope, element) {
2008
+ this.#focusHistory.set(scope, element);
2009
+ }
2010
+ getFocusMemory(scope) {
2011
+ return this.#focusHistory.get(scope);
2012
+ }
2013
+ isActiveScope(scope) {
2014
+ return this.getActive() === scope;
2015
+ }
2016
+ setPreFocusMemory(scope, element) {
2017
+ this.#preFocusHistory.set(scope, element);
2018
+ }
2019
+ getPreFocusMemory(scope) {
2020
+ return this.#preFocusHistory.get(scope);
2021
+ }
2022
+ clearPreFocusMemory(scope) {
2023
+ this.#preFocusHistory.delete(scope);
2024
+ }
1989
2025
  };
1990
- var focusable = function focusable(container, options) {
1991
- options = options || {};
1992
- var candidates;
1993
- if (options.getShadowRoot) candidates = _getCandidatesIteratively([container], options.includeContainer, {
1994
- filter: isNodeMatchingSelectorFocusable.bind(null, options),
1995
- flatten: true,
1996
- getShadowRoot: options.getShadowRoot
1997
- });
1998
- else candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
1999
- return candidates;
2026
+ // ../node_modules/.bun/tabbable@6.5.2/node_modules/tabbable/dist/index.esm.js
2027
+ /*!
2028
+ * tabbable 6.5.2
2029
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
2030
+ */
2031
+ var candidateSelectors = [
2032
+ "input:not([inert]):not([inert] *)",
2033
+ "select:not([inert]):not([inert] *)",
2034
+ "textarea:not([inert]):not([inert] *)",
2035
+ "a[href]:not([inert]):not([inert] *)",
2036
+ "area[href]:not([inert]):not([inert] *)",
2037
+ "button:not([inert]):not([inert] *)",
2038
+ "[tabindex]:not(slot):not([inert]):not([inert] *)",
2039
+ "audio[controls]:not([inert]):not([inert] *)",
2040
+ "video[controls]:not([inert]):not([inert] *)",
2041
+ "[contenteditable]:not([contenteditable=\"false\"]):not([inert]):not([inert] *)",
2042
+ "details>summary:first-of-type:not([inert]):not([inert] *)",
2043
+ "details:not([inert]):not([inert] *)"
2044
+ ];
2045
+ var candidateSelector = /* #__PURE__ */ candidateSelectors.join(",");
2046
+ var NoElement = typeof Element === "undefined";
2047
+ var matches = NoElement ? function() {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
2048
+ var getRootNode = !NoElement && Element.prototype.getRootNode ? function(element) {
2049
+ return element == null || element.getRootNode == null ? void 0 : element.getRootNode();
2050
+ } : function(element) {
2051
+ return element == null ? void 0 : element.ownerDocument;
2000
2052
  };
2001
- var isTabbable = function isTabbable(node, options) {
2002
- options = options || {};
2003
- if (!node) throw new Error("No node provided");
2004
- if (matches.call(node, candidateSelector) === false) return false;
2005
- return isNodeMatchingSelectorTabbable(options, node);
2053
+ /**
2054
+ * Determines if a node is inert or in an inert ancestor.
2055
+ * @param {Node} [node]
2056
+ * @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to
2057
+ * see if any of them are inert. If false, only `node` itself is considered.
2058
+ * @returns {boolean} True if inert itself or by way of being in an inert ancestor.
2059
+ * False if `node` is falsy.
2060
+ */
2061
+ var _isInert = function isInert(node, lookUp) {
2062
+ if (lookUp === void 0) lookUp = true;
2063
+ var inertAtt = node == null || node.getAttribute == null ? void 0 : node.getAttribute("inert");
2064
+ return inertAtt === "" || inertAtt === "true" || lookUp && node && (typeof node.closest === "function" ? node.closest("[inert]") : _isInert(node.parentNode));
2006
2065
  };
2007
- var focusableCandidateSelector = /* #__PURE__ */ candidateSelectors.concat("iframe:not([inert]):not([inert] *)").join(",");
2008
- var isFocusable = function isFocusable(node, options) {
2009
- options = options || {};
2010
- if (!node) throw new Error("No node provided");
2011
- if (matches.call(node, focusableCandidateSelector) === false) return false;
2012
- return isNodeMatchingSelectorFocusable(options, node);
2066
+ /**
2067
+ * Determines if a node's content is editable.
2068
+ * @param {Element} [node]
2069
+ * @returns True if it's content-editable; false if it's not or `node` is falsy.
2070
+ */
2071
+ var isContentEditable = function isContentEditable(node) {
2072
+ var _node$getAttribute;
2073
+ var attValue = node == null || node.getAttribute == null || (_node$getAttribute = node.getAttribute("contenteditable")) == null ? void 0 : _node$getAttribute.toLowerCase();
2074
+ return attValue === "" || attValue === "true" || attValue === "plaintext-only";
2013
2075
  };
2014
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/tabbable.js
2015
- function getTabbableOptions() {
2016
- return {
2017
- getShadowRoot: true,
2018
- displayCheck: typeof ResizeObserver === "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
2019
- };
2020
- }
2021
2076
  /**
2022
- * Gets all tabbable elements in the body and finds the next/previous tabbable element
2023
- * from the `currentNode` based on the `direction` provided.
2024
- * @param currentNode - the node we want to get the next/previous tabbable from
2077
+ * @param {Element} el container to check in
2078
+ * @param {boolean} includeContainer add container to check
2079
+ * @param {(node: Element) => boolean} filter filter candidates
2080
+ * @returns {Element[]}
2025
2081
  */
2026
- function getTabbableFrom(currentNode, direction) {
2027
- if (!isTabbable(currentNode, getTabbableOptions())) return getTabbableFromFocusable(currentNode, direction);
2028
- const doc = getDocument(currentNode);
2029
- const allTabbable = tabbable(doc.body, getTabbableOptions());
2030
- if (direction === "prev") allTabbable.reverse();
2031
- const activeIndex = allTabbable.indexOf(currentNode);
2032
- if (activeIndex === -1) return doc.body;
2033
- return allTabbable.slice(activeIndex + 1)[0];
2034
- }
2035
- function getTabbableFromFocusable(currentNode, direction) {
2036
- const doc = getDocument(currentNode);
2037
- if (!isFocusable(currentNode, getTabbableOptions())) return doc.body;
2038
- const allFocusable = focusable(doc.body, getTabbableOptions());
2039
- if (direction === "prev") allFocusable.reverse();
2040
- const activeIndex = allFocusable.indexOf(currentNode);
2041
- if (activeIndex === -1) return doc.body;
2042
- return allFocusable.slice(activeIndex + 1).find((node) => isTabbable(node, getTabbableOptions())) ?? doc.body;
2043
- }
2044
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/arrays.js
2082
+ var getCandidates = function getCandidates(el, includeContainer, filter) {
2083
+ if (_isInert(el)) return [];
2084
+ var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
2085
+ if (includeContainer && matches.call(el, candidateSelector)) candidates.unshift(el);
2086
+ candidates = candidates.filter(filter);
2087
+ return candidates;
2088
+ };
2045
2089
  /**
2046
- * Returns the array element after the given index, or undefined for out-of-bounds or empty arrays.
2047
- * @param array the array.
2048
- * @param index the index of the current element.
2049
- * @param loop loop to the beginning of the array if the next index is out of bounds?
2090
+ * @callback GetShadowRoot
2091
+ * @param {Element} element to check for shadow root
2092
+ * @returns {ShadowRoot|boolean} ShadowRoot if available or boolean indicating if a shadowRoot is attached but not available.
2050
2093
  */
2051
2094
  /**
2052
- * Returns the array element after the given index, or undefined for out-of-bounds or empty arrays.
2053
- * For single-element arrays, returns the element if the index is 0.
2054
- * @param array the array.
2055
- * @param index the index of the current element.
2056
- * @param loop loop to the beginning of the array if the next index is out of bounds?
2095
+ * @callback ShadowRootFilter
2096
+ * @param {Element} shadowHostNode the element which contains shadow content
2097
+ * @returns {boolean} true if a shadow root could potentially contain valid candidates.
2057
2098
  */
2058
- function next(array, index, loop = true) {
2059
- if (array.length === 0 || index < 0 || index >= array.length) return;
2060
- if (array.length === 1 && index === 0) return array[0];
2061
- if (index === array.length - 1) return loop ? array[0] : void 0;
2062
- return array[index + 1];
2063
- }
2064
2099
  /**
2065
- * Returns the array element prior to the given index, or undefined for out-of-bounds or empty arrays.
2066
- * For single-element arrays, returns the element if the index is 0.
2067
- * @param array the array.
2068
- * @param index the index of the current element.
2069
- * @param loop loop to the end of the array if the previous index is out of bounds?
2100
+ * @typedef {Object} CandidateScope
2101
+ * @property {Element} scopeParent contains inner candidates
2102
+ * @property {Element[]} candidates list of candidates found in the scope parent
2070
2103
  */
2071
- function prev(array, index, loop = true) {
2072
- if (array.length === 0 || index < 0 || index >= array.length) return;
2073
- if (array.length === 1 && index === 0) return array[0];
2074
- if (index === 0) return loop ? array[array.length - 1] : void 0;
2075
- return array[index - 1];
2076
- }
2077
2104
  /**
2078
- * Returns the element some number after the given index. If the target index is out of bounds:
2079
- * - If looping is disabled, the first or last element will be returned.
2080
- * - If looping is enabled, it will wrap around the array.
2081
- * Returns undefined for empty arrays or out-of-bounds initial indices.
2082
- * @param array the array.
2083
- * @param index the index of the current element.
2084
- * @param increment the number of elements to move forward (can be negative).
2085
- * @param loop loop around the array if the target index is out of bounds?
2105
+ * @typedef {Object} IterativeOptions
2106
+ * @property {GetShadowRoot|boolean} getShadowRoot true if shadow support is enabled; falsy if not;
2107
+ * if a function, implies shadow support is enabled and either returns the shadow root of an element
2108
+ * or a boolean stating if it has an undisclosed shadow root
2109
+ * @property {(node: Element) => boolean} filter filter candidates
2110
+ * @property {boolean} flatten if true then result will flatten any CandidateScope into the returned list
2111
+ * @property {ShadowRootFilter} shadowRootFilter filter shadow roots;
2086
2112
  */
2087
- function forward(array, index, increment, loop = true) {
2088
- if (array.length === 0 || index < 0 || index >= array.length) return;
2089
- let targetIndex = index + increment;
2090
- if (loop) targetIndex = (targetIndex % array.length + array.length) % array.length;
2091
- else targetIndex = Math.max(0, Math.min(targetIndex, array.length - 1));
2092
- return array[targetIndex];
2093
- }
2094
2113
  /**
2095
- * Returns the element some number before the given index. If the target index is out of bounds:
2096
- * - If looping is disabled, the first or last element will be returned.
2097
- * - If looping is enabled, it will wrap around the array.
2098
- * Returns undefined for empty arrays or out-of-bounds initial indices.
2099
- * @param array the array.
2100
- * @param index the index of the current element.
2101
- * @param decrement the number of elements to move backward (can be negative).
2102
- * @param loop loop around the array if the target index is out of bounds?
2103
- */
2104
- function backward(array, index, decrement, loop = true) {
2105
- if (array.length === 0 || index < 0 || index >= array.length) return;
2106
- let targetIndex = index - decrement;
2107
- if (loop) targetIndex = (targetIndex % array.length + array.length) % array.length;
2108
- else targetIndex = Math.max(0, Math.min(targetIndex, array.length - 1));
2109
- return array[targetIndex];
2110
- }
2111
- /**
2112
- * Finds the next matching item from a list of values based on a search string.
2113
- *
2114
- * This function handles several special cases in typeahead behavior:
2115
- *
2116
- * 1. Space handling: When a search string ends with a space, it handles it specially:
2117
- * - If there's only one match for the text before the space, it ignores the space
2118
- * - If there are multiple matches and the current match already starts with the search prefix
2119
- * followed by a space, it keeps the current match (doesn't change selection on space)
2120
- * - Only after typing characters beyond the space will it move to a more specific match
2121
- *
2122
- * 2. Repeated character handling: If a search consists of repeated characters (e.g., "aaa"),
2123
- * it treats it as a single character for matching purposes
2124
- *
2125
- * 3. Cycling behavior: The function wraps around the values array starting from the current match
2126
- * to find the next appropriate match, creating a cycling selection behavior
2127
- *
2128
- * @param values - Array of string values to search through (e.g., the text content of menu items)
2129
- * @param search - The current search string typed by the user
2130
- * @param currentMatch - The currently selected/matched item, if any
2131
- * @returns The next matching value that should be selected, or undefined if no match is found
2114
+ * @param {Element[]} elements list of element containers to match candidates from
2115
+ * @param {boolean} includeContainer add container list to check
2116
+ * @param {IterativeOptions} options
2117
+ * @returns {Array.<Element|CandidateScope>}
2132
2118
  */
2133
- function getNextMatch(values, search, currentMatch) {
2134
- const lowerSearch = search.toLowerCase();
2135
- if (lowerSearch.endsWith(" ")) {
2136
- const searchWithoutSpace = lowerSearch.slice(0, -1);
2137
- /**
2138
- * If there's only one match for the prefix without space, we don't
2139
- * watch to match with space.
2140
- */
2141
- if (values.filter((value) => value.toLowerCase().startsWith(searchWithoutSpace)).length <= 1) return getNextMatch(values, searchWithoutSpace, currentMatch);
2142
- const currentMatchLowercase = currentMatch?.toLowerCase();
2143
- /**
2144
- * If the current match already starts with the search prefix and has a space afterward,
2145
- * and the user has only typed up to that space, keep the current match until they
2146
- * disambiguate.
2147
- */
2148
- if (currentMatchLowercase && currentMatchLowercase.startsWith(searchWithoutSpace) && currentMatchLowercase.charAt(searchWithoutSpace.length) === " " && search.trim() === searchWithoutSpace) return currentMatch;
2149
- /**
2150
- * With multiple matches, find items that match the full search string with space
2151
- */
2152
- const spacedMatches = values.filter((value) => value.toLowerCase().startsWith(lowerSearch));
2153
- /**
2154
- * If we found matches with the space, use the first one that's not the current match
2155
- */
2156
- if (spacedMatches.length > 0) {
2157
- const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;
2158
- return wrapArray(spacedMatches, Math.max(currentMatchIndex, 0)).find((match) => match !== currentMatch) || currentMatch;
2119
+ var _getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {
2120
+ var candidates = [];
2121
+ var elementsToCheck = Array.from(elements);
2122
+ while (elementsToCheck.length) {
2123
+ var element = elementsToCheck.shift();
2124
+ if (_isInert(element, false)) continue;
2125
+ if (element.tagName === "SLOT") {
2126
+ var assigned = element.assignedElements();
2127
+ var nestedCandidates = _getCandidatesIteratively(assigned.length ? assigned : element.children, true, options);
2128
+ if (options.flatten) candidates.push.apply(candidates, nestedCandidates);
2129
+ else candidates.push({
2130
+ scopeParent: element,
2131
+ candidates: nestedCandidates
2132
+ });
2133
+ } else {
2134
+ if (matches.call(element, candidateSelector) && options.filter(element) && (includeContainer || !elements.includes(element))) candidates.push(element);
2135
+ var shadowRoot = element.shadowRoot || typeof options.getShadowRoot === "function" && options.getShadowRoot(element);
2136
+ var validShadowRoot = !_isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));
2137
+ if (shadowRoot && validShadowRoot) {
2138
+ var _nestedCandidates = _getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);
2139
+ if (options.flatten) candidates.push.apply(candidates, _nestedCandidates);
2140
+ else candidates.push({
2141
+ scopeParent: element,
2142
+ candidates: _nestedCandidates
2143
+ });
2144
+ } else elementsToCheck.unshift.apply(elementsToCheck, element.children);
2159
2145
  }
2160
2146
  }
2161
- const normalizedSearch = search.length > 1 && Array.from(search).every((char) => char === search[0]) ? search[0] : search;
2162
- const normalizedLowerSearch = normalizedSearch.toLowerCase();
2163
- const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;
2164
- let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0));
2165
- if (normalizedSearch.length === 1) wrappedValues = wrappedValues.filter((v) => v !== currentMatch);
2166
- const nextMatch = wrappedValues.find((value) => value?.toLowerCase().startsWith(normalizedLowerSearch));
2167
- return nextMatch !== currentMatch ? nextMatch : void 0;
2168
- }
2147
+ return candidates;
2148
+ };
2169
2149
  /**
2170
- * Wraps an array around itself at a given start index
2171
- * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`
2150
+ * @private
2151
+ * Determines if the node has an explicitly specified `tabindex` attribute.
2152
+ * @param {HTMLElement} node
2153
+ * @returns {boolean} True if so; false if not.
2172
2154
  */
2173
- function wrapArray(array, startIndex) {
2174
- return array.map((_, index) => array[(startIndex + index) % array.length]);
2175
- }
2176
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/box-auto-reset.svelte.js
2177
- var defaultOptions = {
2178
- afterMs: 1e4,
2179
- onChange: noop
2155
+ var hasTabIndex = function hasTabIndex(node) {
2156
+ return !isNaN(parseInt(node.getAttribute("tabindex"), 10));
2180
2157
  };
2181
- function boxAutoReset(defaultValue, options) {
2182
- const { afterMs, onChange, getWindow } = {
2183
- ...defaultOptions,
2184
- ...options
2185
- };
2186
- let timeout = null;
2187
- let value = defaultValue;
2188
- function resetAfter() {
2189
- return getWindow().setTimeout(() => {
2190
- value = defaultValue;
2191
- onChange?.(defaultValue);
2192
- }, afterMs);
2158
+ /**
2159
+ * Determine the tab index of a given node.
2160
+ * @param {HTMLElement} node
2161
+ * @returns {number} Tab order (negative, 0, or positive number).
2162
+ * @throws {Error} If `node` is falsy.
2163
+ */
2164
+ var getTabIndex = function getTabIndex(node) {
2165
+ if (!node) throw new Error("No node provided");
2166
+ if (node.tabIndex < 0) {
2167
+ if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) return 0;
2193
2168
  }
2194
- return boxWith(() => value, (v) => {
2195
- value = v;
2196
- onChange?.(v);
2197
- if (timeout) getWindow().clearTimeout(timeout);
2198
- timeout = resetAfter();
2199
- });
2200
- }
2201
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/dom-typeahead.svelte.js
2202
- var DOMTypeahead = class {
2203
- #opts;
2204
- #search;
2205
- #onMatch = $.derived(() => {
2206
- if (this.#opts.onMatch) return this.#opts.onMatch;
2207
- return (node) => node.focus();
2208
- });
2209
- #getCurrentItem = $.derived(() => {
2210
- if (this.#opts.getCurrentItem) return this.#opts.getCurrentItem;
2211
- return this.#opts.getActiveElement;
2169
+ return node.tabIndex;
2170
+ };
2171
+ /**
2172
+ * Determine the tab index of a given node __for sort order purposes__.
2173
+ * @param {HTMLElement} node
2174
+ * @param {boolean} [isScope] True for a custom element with shadow root or slot that, by default,
2175
+ * has tabIndex -1, but needs to be sorted by document order in order for its content to be
2176
+ * inserted into the correct sort position.
2177
+ * @returns {number} Tab order (negative, 0, or positive number).
2178
+ */
2179
+ var getSortOrderTabIndex = function getSortOrderTabIndex(node, isScope) {
2180
+ var tabIndex = getTabIndex(node);
2181
+ if (tabIndex < 0 && isScope && !hasTabIndex(node)) return 0;
2182
+ return tabIndex;
2183
+ };
2184
+ var sortOrderedTabbables = function sortOrderedTabbables(a, b) {
2185
+ return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
2186
+ };
2187
+ var isInput = function isInput(node) {
2188
+ return node.tagName === "INPUT";
2189
+ };
2190
+ var isHiddenInput = function isHiddenInput(node) {
2191
+ return isInput(node) && node.type === "hidden";
2192
+ };
2193
+ var isDetailsWithSummary = function isDetailsWithSummary(node) {
2194
+ return node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) {
2195
+ return child.tagName === "SUMMARY";
2212
2196
  });
2213
- constructor(opts) {
2214
- this.#opts = opts;
2215
- this.#search = boxAutoReset("", {
2216
- afterMs: 1e3,
2217
- getWindow: opts.getWindow
2218
- });
2219
- this.handleTypeaheadSearch = this.handleTypeaheadSearch.bind(this);
2220
- this.resetTypeahead = this.resetTypeahead.bind(this);
2221
- }
2222
- handleTypeaheadSearch(key, candidates) {
2223
- if (!candidates.length) return;
2224
- this.#search.current = this.#search.current + key;
2225
- const currentItem = this.#getCurrentItem()();
2226
- const currentMatch = candidates.find((item) => item === currentItem)?.textContent?.trim() ?? "";
2227
- const nextMatch = getNextMatch(candidates.map((item) => item.textContent?.trim() ?? ""), this.#search.current, currentMatch);
2228
- const newItem = candidates.find((item) => item.textContent?.trim() === nextMatch);
2229
- if (newItem) this.#onMatch()(newItem);
2230
- return newItem;
2231
- }
2232
- resetTypeahead() {
2233
- this.#search.current = "";
2234
- }
2235
- get search() {
2236
- return this.#search.current;
2197
+ };
2198
+ var getCheckedRadio = function getCheckedRadio(nodes, form) {
2199
+ for (var i = 0; i < nodes.length; i++) if (nodes[i].checked && nodes[i].form === form) return nodes[i];
2200
+ };
2201
+ var isTabbableRadio = function isTabbableRadio(node) {
2202
+ if (!node.name) return true;
2203
+ var radioScope = node.form || getRootNode(node);
2204
+ var queryRadios = function queryRadios(name) {
2205
+ return radioScope.querySelectorAll("input[type=\"radio\"][name=\"" + name + "\"]");
2206
+ };
2207
+ var radioSet;
2208
+ if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") radioSet = queryRadios(window.CSS.escape(node.name));
2209
+ else try {
2210
+ radioSet = queryRadios(node.name);
2211
+ } catch (err) {
2212
+ console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", err.message);
2213
+ return false;
2237
2214
  }
2215
+ var checked = getCheckedRadio(radioSet, node.form);
2216
+ return !checked || checked === node;
2238
2217
  };
2239
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/menu/menu.svelte.js
2240
- var CONTEXT_MENU_TRIGGER_ATTR = "data-context-menu-trigger";
2241
- var CONTEXT_MENU_CONTENT_ATTR = "data-context-menu-content";
2242
- var MenuRootContext = new Context("Menu.Root");
2243
- var MenuMenuContext = new Context("Menu.Root | Menu.Sub");
2244
- var MenuContentContext = new Context("Menu.Content");
2245
- var MenuGroupContext = new Context("Menu.Group | Menu.RadioGroup");
2246
- new Context("Menu.RadioGroup");
2247
- new Context("Menu.CheckboxGroup");
2248
- var MenuOpenEvent = new CustomEventDispatcher("bitsmenuopen", {
2249
- bubbles: false,
2250
- cancelable: true
2251
- });
2252
- var menuAttrs = createBitsAttrs({
2253
- component: "menu",
2254
- parts: [
2255
- "trigger",
2256
- "content",
2257
- "sub-trigger",
2258
- "item",
2259
- "group",
2260
- "group-heading",
2261
- "checkbox-group",
2262
- "checkbox-item",
2263
- "radio-group",
2264
- "radio-item",
2265
- "separator",
2266
- "sub-content",
2267
- "arrow"
2268
- ]
2269
- });
2270
- var MenuSubmenuIntent = class {
2271
- #opts;
2272
- #cleanupDocMove = null;
2273
- #fallbackTimer = null;
2274
- #active = false;
2275
- #target = null;
2276
- #apex = null;
2277
- #pointerPoint = null;
2278
- #launchPoint = null;
2279
- constructor(opts) {
2280
- this.#opts = opts;
2281
- watch([
2282
- opts.triggerNode,
2283
- opts.contentNode,
2284
- opts.enabled
2285
- ], ([triggerNode, contentNode, enabled]) => {
2286
- this.#reset();
2287
- if (!triggerNode || !contentNode || !enabled) return;
2288
- const onTriggerMove = (e) => {
2289
- if (!isMouseEvent(e)) return;
2290
- this.#launchPoint = {
2291
- x: e.clientX,
2292
- y: e.clientY
2293
- };
2294
- if (!this.#active) this.#preview(e, "content");
2295
- };
2296
- const onTriggerLeave = (e) => {
2297
- if (!isMouseEvent(e)) return;
2298
- this.#engage(e, "content");
2299
- };
2300
- const onContentMove = (e) => {
2301
- if (!isMouseEvent(e)) return;
2302
- if (!this.#active) this.#preview(e, "trigger");
2303
- };
2304
- const onContentLeave = (e) => {
2305
- if (!isMouseEvent(e)) return;
2306
- if (isElement$1(e.relatedTarget)) {
2307
- const selector = this.#opts.subContentSelector();
2308
- const matchedSubContent = e.relatedTarget.closest(selector);
2309
- if (matchedSubContent && matchedSubContent !== contentNode && matchedSubContent.id) {
2310
- if (!!contentNode.querySelector(`[aria-controls="${matchedSubContent.id}"]`)) return;
2311
- }
2312
- }
2313
- this.#engage(e, "trigger");
2314
- };
2315
- const onTriggerEnter = (e) => {
2316
- if (!isMouseEvent(e)) return;
2317
- this.#disengage();
2318
- };
2319
- const onContentEnter = (e) => {
2320
- if (!isMouseEvent(e)) return;
2321
- this.#disengage();
2322
- };
2323
- triggerNode.addEventListener("pointermove", onTriggerMove);
2324
- triggerNode.addEventListener("pointerleave", onTriggerLeave);
2325
- triggerNode.addEventListener("pointerenter", onTriggerEnter);
2326
- contentNode.addEventListener("pointermove", onContentMove);
2327
- contentNode.addEventListener("pointerleave", onContentLeave);
2328
- contentNode.addEventListener("pointerenter", onContentEnter);
2329
- return () => {
2330
- triggerNode.removeEventListener("pointermove", onTriggerMove);
2331
- triggerNode.removeEventListener("pointerleave", onTriggerLeave);
2332
- triggerNode.removeEventListener("pointerenter", onTriggerEnter);
2333
- contentNode.removeEventListener("pointermove", onContentMove);
2334
- contentNode.removeEventListener("pointerleave", onContentLeave);
2335
- contentNode.removeEventListener("pointerenter", onContentEnter);
2336
- this.#reset();
2337
- };
2218
+ var isRadio = function isRadio(node) {
2219
+ return isInput(node) && node.type === "radio";
2220
+ };
2221
+ var isNonTabbableRadio = function isNonTabbableRadio(node) {
2222
+ return isRadio(node) && !isTabbableRadio(node);
2223
+ };
2224
+ var isZeroArea = function isZeroArea(node) {
2225
+ var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height;
2226
+ return width === 0 && height === 0;
2227
+ };
2228
+ var isHidden = function isHidden(node, _ref) {
2229
+ var displayCheck = _ref.displayCheck, getShadowRoot = _ref.getShadowRoot;
2230
+ if (displayCheck === "full-native") {
2231
+ if ("checkVisibility" in node) return !node.checkVisibility({
2232
+ checkOpacity: false,
2233
+ opacityProperty: false,
2234
+ contentVisibilityAuto: true,
2235
+ visibilityProperty: true,
2236
+ checkVisibilityCSS: true
2338
2237
  });
2339
2238
  }
2340
- #parentTargetRect() {
2341
- const parent = this.#opts.parentContentNode();
2342
- if (parent) return parent.getBoundingClientRect();
2343
- return this.#opts.triggerNode()?.getBoundingClientRect() ?? null;
2344
- }
2345
- #computePolygons(pointerPt, target) {
2346
- const triggerNode = this.#opts.triggerNode();
2347
- const contentNode = this.#opts.contentNode();
2348
- if (!triggerNode || !contentNode) return null;
2349
- const triggerRect = triggerNode.getBoundingClientRect();
2350
- const contentRect = contentNode.getBoundingClientRect();
2351
- const side = getSide$1(triggerRect, contentRect);
2352
- let apex;
2353
- let targetRect;
2354
- let sourceRect;
2355
- if (target === "content") {
2356
- apex = this.#active ? this.#apex ?? pointerPt : pointerPt;
2357
- targetRect = contentRect;
2358
- } else {
2359
- apex = this.#launchPoint ?? pointerPt;
2360
- targetRect = this.#parentTargetRect() ?? triggerRect;
2361
- sourceRect = contentRect;
2362
- }
2363
- this.#apex = apex;
2364
- return {
2365
- corridor: getCorridorPolygon(triggerRect, contentRect, side),
2366
- intent: getIntentPolygon(apex, targetRect, side, target, sourceRect),
2367
- targetRect,
2368
- side
2369
- };
2370
- }
2371
- #isInSafeZone(pt, corridor, intent) {
2372
- return isPointInPolygon(pt, corridor) || isPointInPolygon(pt, intent);
2373
- }
2374
- #preview(e, target) {
2375
- const pt = {
2376
- x: e.clientX,
2377
- y: e.clientY
2378
- };
2379
- if (!this.#computePolygons(pt, target)) return;
2380
- this.#target = target;
2381
- this.#pointerPoint = pt;
2382
- }
2383
- #engage(e, target) {
2384
- if (!this.#opts.enabled()) return;
2385
- const triggerNode = this.#opts.triggerNode();
2386
- const contentNode = this.#opts.contentNode();
2387
- if (!triggerNode || !contentNode) return;
2388
- const related = e.relatedTarget;
2389
- if (isElement$1(related)) {
2390
- if (target === "content" && contentNode.contains(related)) return;
2391
- if (target === "trigger" && triggerNode.contains(related)) return;
2392
- }
2393
- const pt = {
2394
- x: e.clientX,
2395
- y: e.clientY
2396
- };
2397
- const geo = this.#computePolygons(pt, target);
2398
- if (!geo) return;
2399
- if (!isInsideRect(pt, geo.targetRect) && !this.#isInSafeZone(pt, geo.corridor, geo.intent)) {
2400
- this.#clearVisuals();
2401
- return;
2402
- }
2403
- this.#active = true;
2404
- this.#target = target;
2405
- this.#pointerPoint = pt;
2406
- this.#opts.setIsPointerInTransit(true);
2407
- this.#attachDocMove();
2408
- this.#startFallback();
2409
- }
2410
- #disengageTimer = null;
2411
- #disengage() {
2412
- if (!this.#active) return;
2413
- const wasReturning = this.#target === "trigger";
2414
- this.#detachDocMove();
2415
- this.#clearFallback();
2416
- this.#active = false;
2417
- this.#clearVisuals();
2418
- if (wasReturning) {
2419
- this.#clearDisengageTimer();
2420
- this.#disengageTimer = setTimeout(() => {
2421
- this.#disengageTimer = null;
2422
- this.#opts.setIsPointerInTransit(false);
2423
- }, 100);
2424
- } else this.#opts.setIsPointerInTransit(false);
2425
- }
2426
- #clearDisengageTimer() {
2427
- if (this.#disengageTimer === null) return;
2428
- clearTimeout(this.#disengageTimer);
2429
- this.#disengageTimer = null;
2430
- }
2431
- #intentExit() {
2432
- const pointerPoint = this.#pointerPoint;
2433
- this.#detachDocMove();
2434
- this.#clearFallback();
2435
- this.#clearDisengageTimer();
2436
- this.#active = false;
2437
- this.#opts.setIsPointerInTransit(false);
2438
- this.#clearVisuals();
2439
- this.#opts.onIntentExit(pointerPoint);
2440
- }
2441
- #reset() {
2442
- this.#detachDocMove();
2443
- this.#clearFallback();
2444
- this.#clearDisengageTimer();
2445
- if (this.#active) this.#opts.setIsPointerInTransit(false);
2446
- this.#active = false;
2447
- this.#target = null;
2448
- this.#apex = null;
2449
- this.#pointerPoint = null;
2450
- this.#launchPoint = null;
2451
- }
2452
- #isPointerInDescendantSubContent(pt) {
2453
- const contentNode = this.#opts.contentNode();
2454
- if (!contentNode) return false;
2455
- const el = contentNode.ownerDocument.elementFromPoint(pt.x, pt.y);
2456
- if (!el) return false;
2457
- const selector = this.#opts.subContentSelector();
2458
- const subContent = el.closest(selector);
2459
- if (!subContent || subContent === contentNode) return false;
2460
- if (subContent.id) return !!contentNode.querySelector(`[aria-controls="${subContent.id}"]`);
2461
- return false;
2462
- }
2463
- #onDocMove = (e) => {
2464
- if (!this.#active || !this.#target) return;
2465
- if (!isMouseEvent(e)) return;
2466
- const triggerNode = this.#opts.triggerNode();
2467
- const contentNode = this.#opts.contentNode();
2468
- if (!triggerNode || !contentNode) {
2469
- this.#intentExit();
2470
- return;
2471
- }
2472
- this.#clearFallback();
2473
- const pt = {
2474
- x: e.clientX,
2475
- y: e.clientY
2476
- };
2477
- this.#pointerPoint = pt;
2478
- const triggerRect = triggerNode.getBoundingClientRect();
2479
- const contentRect = contentNode.getBoundingClientRect();
2480
- if (this.#target === "content" && isInsideRect(pt, contentRect)) {
2481
- this.#disengage();
2482
- return;
2483
- }
2484
- if (this.#target === "trigger" && isInsideInsetRect(pt, triggerRect, 4)) {
2485
- this.#disengage();
2486
- return;
2487
- }
2488
- if (this.#isPointerInDescendantSubContent(pt)) {
2489
- this.#startFallback();
2490
- return;
2491
- }
2492
- const geo = this.#computePolygons(pt, this.#target);
2493
- if (!geo) {
2494
- this.#intentExit();
2495
- return;
2496
- }
2497
- if (this.#isInSafeZone(pt, geo.corridor, geo.intent)) {
2498
- this.#startFallback();
2499
- return;
2239
+ var visibility = getComputedStyle(node).visibility;
2240
+ if (visibility === "hidden" || visibility === "collapse") return true;
2241
+ var nodeUnderDetails = matches.call(node, "details>summary:first-of-type") ? node.parentElement : node;
2242
+ if (matches.call(nodeUnderDetails, "details:not([open]) *")) return true;
2243
+ if (!displayCheck || displayCheck === "full" || displayCheck === "full-native" || displayCheck === "legacy-full") {
2244
+ if (typeof getShadowRoot === "function") {
2245
+ var originalNode = node;
2246
+ while (node) {
2247
+ var parentElement = node.parentElement;
2248
+ var rootNode = getRootNode(node);
2249
+ if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true) return isZeroArea(node);
2250
+ else if (node.assignedSlot) node = node.assignedSlot;
2251
+ else if (!parentElement && rootNode !== node.ownerDocument) node = rootNode.host;
2252
+ else node = parentElement;
2253
+ }
2254
+ node = originalNode;
2500
2255
  }
2501
- this.#intentExit();
2502
- };
2503
- #attachDocMove() {
2504
- if (this.#cleanupDocMove) return;
2505
- const doc = getDocument(this.#opts.triggerNode() ?? this.#opts.contentNode());
2506
- if (!doc) return;
2507
- doc.addEventListener("pointermove", this.#onDocMove, true);
2508
- this.#cleanupDocMove = () => {
2509
- doc.removeEventListener("pointermove", this.#onDocMove, true);
2510
- this.#cleanupDocMove = null;
2511
- };
2512
- }
2513
- #detachDocMove() {
2514
- this.#cleanupDocMove?.();
2515
- }
2516
- #startFallback() {
2517
- this.#clearFallback();
2518
- this.#fallbackTimer = setTimeout(() => {
2519
- this.#fallbackTimer = null;
2520
- if (this.#active) this.#intentExit();
2521
- }, 500);
2522
- }
2523
- #clearFallback() {
2524
- if (this.#fallbackTimer === null) return;
2525
- clearTimeout(this.#fallbackTimer);
2526
- this.#fallbackTimer = null;
2527
- }
2528
- #clearVisuals() {
2529
- this.#target = null;
2530
- this.#apex = null;
2531
- this.#pointerPoint = null;
2532
- }
2256
+ if (node.isConnected) return !node.getClientRects().length;
2257
+ if (displayCheck !== "legacy-full") return true;
2258
+ } else if (displayCheck === "non-zero-area") return isZeroArea(node);
2259
+ return false;
2533
2260
  };
2534
- function isPointInPolygon(point, polygon) {
2535
- const { x, y } = point;
2536
- let inside = false;
2537
- for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
2538
- const xi = polygon[i].x;
2539
- const yi = polygon[i].y;
2540
- const xj = polygon[j].x;
2541
- const yj = polygon[j].y;
2542
- if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) inside = !inside;
2543
- }
2544
- return inside;
2545
- }
2546
- function isInsideRect(point, rect) {
2547
- return point.x >= rect.left && point.x <= rect.right && point.y >= rect.top && point.y <= rect.bottom;
2548
- }
2549
- function isInsideInsetRect(point, rect, inset) {
2550
- return point.x >= rect.left + inset && point.x <= rect.right - inset && point.y >= rect.top + inset && point.y <= rect.bottom - inset;
2551
- }
2552
- function getSide$1(triggerRect, contentRect) {
2553
- const triggerCenterX = triggerRect.left + triggerRect.width / 2;
2554
- const triggerCenterY = triggerRect.top + triggerRect.height / 2;
2555
- const contentCenterX = contentRect.left + contentRect.width / 2;
2556
- const contentCenterY = contentRect.top + contentRect.height / 2;
2557
- const deltaX = contentCenterX - triggerCenterX;
2558
- const deltaY = contentCenterY - triggerCenterY;
2559
- if (Math.abs(deltaX) > Math.abs(deltaY)) return deltaX > 0 ? "right" : "left";
2560
- return deltaY > 0 ? "bottom" : "top";
2561
- }
2562
- function getCorridorPolygon(triggerRect, contentRect, side) {
2563
- const buffer = 2;
2564
- switch (side) {
2565
- case "top": return [
2566
- {
2567
- x: Math.min(triggerRect.left, contentRect.left) - buffer,
2568
- y: triggerRect.top
2569
- },
2570
- {
2571
- x: Math.min(triggerRect.left, contentRect.left) - buffer,
2572
- y: contentRect.bottom
2573
- },
2574
- {
2575
- x: Math.max(triggerRect.right, contentRect.right) + buffer,
2576
- y: contentRect.bottom
2577
- },
2578
- {
2579
- x: Math.max(triggerRect.right, contentRect.right) + buffer,
2580
- y: triggerRect.top
2581
- }
2582
- ];
2583
- case "bottom": return [
2584
- {
2585
- x: Math.min(triggerRect.left, contentRect.left) - buffer,
2586
- y: triggerRect.bottom
2587
- },
2588
- {
2589
- x: Math.min(triggerRect.left, contentRect.left) - buffer,
2590
- y: contentRect.top
2591
- },
2592
- {
2593
- x: Math.max(triggerRect.right, contentRect.right) + buffer,
2594
- y: contentRect.top
2595
- },
2596
- {
2597
- x: Math.max(triggerRect.right, contentRect.right) + buffer,
2598
- y: triggerRect.bottom
2599
- }
2600
- ];
2601
- case "left": return [
2602
- {
2603
- x: triggerRect.left,
2604
- y: Math.min(triggerRect.top, contentRect.top) - buffer
2605
- },
2606
- {
2607
- x: contentRect.right,
2608
- y: Math.min(triggerRect.top, contentRect.top) - buffer
2609
- },
2610
- {
2611
- x: contentRect.right,
2612
- y: Math.max(triggerRect.bottom, contentRect.bottom) + buffer
2613
- },
2614
- {
2615
- x: triggerRect.left,
2616
- y: Math.max(triggerRect.bottom, contentRect.bottom) + buffer
2617
- }
2618
- ];
2619
- case "right": return [
2620
- {
2621
- x: triggerRect.right,
2622
- y: Math.min(triggerRect.top, contentRect.top) - buffer
2623
- },
2624
- {
2625
- x: contentRect.left,
2626
- y: Math.min(triggerRect.top, contentRect.top) - buffer
2627
- },
2628
- {
2629
- x: contentRect.left,
2630
- y: Math.max(triggerRect.bottom, contentRect.bottom) + buffer
2631
- },
2632
- {
2633
- x: triggerRect.right,
2634
- y: Math.max(triggerRect.bottom, contentRect.bottom) + buffer
2635
- }
2636
- ];
2637
- }
2638
- }
2639
- function getIntentPolygon(exitPoint, targetRect, side, target, sourceRect) {
2640
- const edgeBuffer = 8;
2641
- const effectiveSide = target === "trigger" ? flipSide(side) : side;
2642
- const top = sourceRect ? Math.min(targetRect.top, sourceRect.top) - edgeBuffer : targetRect.top - edgeBuffer;
2643
- const bottom = sourceRect ? Math.max(targetRect.bottom, sourceRect.bottom) + edgeBuffer : targetRect.bottom + edgeBuffer;
2644
- const left = sourceRect ? Math.min(targetRect.left, sourceRect.left) - edgeBuffer : targetRect.left - edgeBuffer;
2645
- const right = sourceRect ? Math.max(targetRect.right, sourceRect.right) + edgeBuffer : targetRect.right + edgeBuffer;
2646
- switch (effectiveSide) {
2647
- case "right": return [
2648
- exitPoint,
2649
- {
2650
- x: targetRect.left,
2651
- y: top
2652
- },
2653
- {
2654
- x: targetRect.left,
2655
- y: bottom
2656
- }
2657
- ];
2658
- case "left": return [
2659
- exitPoint,
2660
- {
2661
- x: targetRect.right,
2662
- y: top
2663
- },
2664
- {
2665
- x: targetRect.right,
2666
- y: bottom
2667
- }
2668
- ];
2669
- case "bottom": return [
2670
- exitPoint,
2671
- {
2672
- x: left,
2673
- y: targetRect.top
2674
- },
2675
- {
2676
- x: right,
2677
- y: targetRect.top
2678
- }
2679
- ];
2680
- case "top": return [
2681
- exitPoint,
2682
- {
2683
- x: left,
2684
- y: targetRect.bottom
2685
- },
2686
- {
2687
- x: right,
2688
- y: targetRect.bottom
2261
+ var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
2262
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
2263
+ var parentNode = node.parentElement;
2264
+ while (parentNode) {
2265
+ if (parentNode.tagName === "FIELDSET" && parentNode.disabled) {
2266
+ for (var i = 0; i < parentNode.children.length; i++) {
2267
+ var child = parentNode.children.item(i);
2268
+ if (child.tagName === "LEGEND") return matches.call(parentNode, "fieldset[disabled] *") ? true : !child.contains(node);
2269
+ }
2270
+ return true;
2689
2271
  }
2690
- ];
2691
- }
2692
- }
2693
- function flipSide(side) {
2694
- switch (side) {
2695
- case "top": return "bottom";
2696
- case "bottom": return "top";
2697
- case "left": return "right";
2698
- case "right": return "left";
2699
- }
2700
- }
2701
- var MenuRootState = class MenuRootState {
2702
- static create(opts) {
2703
- const root = new MenuRootState(opts);
2704
- return MenuRootContext.set(root);
2705
- }
2706
- opts;
2707
- isUsingKeyboard = new IsUsingKeyboard();
2708
- ignoreCloseAutoFocus = false;
2709
- isPointerInTransit = false;
2710
- constructor(opts) {
2711
- this.opts = opts;
2272
+ parentNode = parentNode.parentElement;
2273
+ }
2712
2274
  }
2713
- getBitsAttr = (part) => {
2714
- return menuAttrs.getAttr(part, this.opts.variant.current);
2715
- };
2275
+ return false;
2716
2276
  };
2717
- var MenuMenuState = class MenuMenuState {
2718
- static create(opts, root) {
2719
- return MenuMenuContext.set(new MenuMenuState(opts, root, null));
2720
- }
2721
- opts;
2722
- root;
2723
- parentMenu;
2724
- contentId = boxWith(() => "");
2725
- contentNode = null;
2726
- contentPresence;
2727
- triggerNode = null;
2728
- constructor(opts, root, parentMenu) {
2729
- this.opts = opts;
2730
- this.root = root;
2731
- this.parentMenu = parentMenu;
2732
- this.contentPresence = new PresenceManager({
2733
- ref: boxWith(() => this.contentNode),
2734
- open: this.opts.open,
2735
- onComplete: () => {
2736
- this.opts.onOpenChangeComplete.current(this.opts.open.current);
2737
- },
2738
- shouldSkipExitAnimation: () => {
2739
- if (this.root.opts.variant.current !== "menubar" || this.parentMenu !== null) return false;
2740
- return this.root.opts.shouldSkipExitAnimation?.() ?? false;
2741
- }
2742
- });
2743
- if (parentMenu) watch(() => parentMenu.opts.open.current, () => {
2744
- if (parentMenu.opts.open.current) return;
2745
- this.opts.open.current = false;
2746
- });
2747
- }
2748
- toggleOpen() {
2749
- this.opts.open.current = !this.opts.open.current;
2750
- }
2751
- onOpen() {
2752
- this.opts.open.current = true;
2753
- }
2754
- onClose() {
2755
- this.opts.open.current = false;
2756
- }
2277
+ var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
2278
+ if (node.disabled || isHiddenInput(node) || isHidden(node, options) || isDetailsWithSummary(node) || isDisabledFromFieldset(node)) return false;
2279
+ return true;
2757
2280
  };
2758
- var MenuContentState = class MenuContentState {
2759
- static create(opts) {
2760
- return MenuContentContext.set(new MenuContentState(opts, MenuMenuContext.get()));
2761
- }
2762
- opts;
2763
- parentMenu;
2764
- rovingFocusGroup;
2765
- domContext;
2766
- attachment;
2767
- search = "";
2768
- #timer = 0;
2769
- #handleTypeaheadSearch;
2770
- mounted = false;
2771
- #isSub;
2772
- constructor(opts, parentMenu) {
2773
- this.opts = opts;
2774
- this.parentMenu = parentMenu;
2775
- this.domContext = new DOMContext(opts.ref);
2776
- this.attachment = attachRef(this.opts.ref, (v) => {
2777
- if (this.parentMenu.contentNode !== v) this.parentMenu.contentNode = v;
2778
- });
2779
- parentMenu.contentId = opts.id;
2780
- this.#isSub = opts.isSub ?? false;
2781
- this.onkeydown = this.onkeydown.bind(this);
2782
- this.onblur = this.onblur.bind(this);
2783
- this.onfocus = this.onfocus.bind(this);
2784
- this.handleInteractOutside = this.handleInteractOutside.bind(this);
2785
- new MenuSubmenuIntent({
2786
- contentNode: () => this.parentMenu.contentNode,
2787
- triggerNode: () => this.parentMenu.triggerNode,
2788
- parentContentNode: () => this.parentMenu.parentMenu?.contentNode ?? null,
2789
- subContentSelector: () => `[${this.parentMenu.root.getBitsAttr("sub-content")}]`,
2790
- enabled: () => this.parentMenu.opts.open.current && Boolean(this.parentMenu.triggerNode?.hasAttribute(this.parentMenu.root.getBitsAttr("sub-trigger"))),
2791
- onIntentExit: (pointerPoint) => {
2792
- this.parentMenu.opts.open.current = false;
2793
- this.#dispatchPointerMoveToHoveredSubTrigger(pointerPoint);
2794
- },
2795
- setIsPointerInTransit: (value) => {
2796
- this.parentMenu.root.isPointerInTransit = value;
2797
- }
2798
- });
2799
- this.#handleTypeaheadSearch = new DOMTypeahead({
2800
- getActiveElement: () => this.domContext.getActiveElement(),
2801
- getWindow: () => this.domContext.getWindow()
2802
- }).handleTypeaheadSearch;
2803
- this.rovingFocusGroup = new RovingFocusGroup({
2804
- rootNode: boxWith(() => this.parentMenu.contentNode),
2805
- candidateAttr: this.parentMenu.root.getBitsAttr("item"),
2806
- loop: this.opts.loop,
2807
- orientation: boxWith(() => "vertical")
2808
- });
2809
- watch(() => this.parentMenu.contentNode, (contentNode) => {
2810
- if (!contentNode) return;
2811
- const handler = () => {
2812
- afterTick(() => {
2813
- if (!this.parentMenu.root.isUsingKeyboard.current) return;
2814
- this.rovingFocusGroup.focusFirstCandidate();
2815
- });
2816
- };
2817
- return MenuOpenEvent.listen(contentNode, handler);
2818
- });
2819
- }
2820
- #getCandidateNodes() {
2821
- const node = this.parentMenu.contentNode;
2822
- if (!node) return [];
2823
- return Array.from(node.querySelectorAll(`[${this.parentMenu.root.getBitsAttr("item")}]:not([data-disabled])`));
2824
- }
2825
- #isPointerMovingToSubmenu() {
2826
- return this.parentMenu.root.isPointerInTransit;
2827
- }
2828
- #dispatchPointerMoveToHoveredSubTrigger(pointerPoint) {
2829
- if (!pointerPoint) return;
2830
- const parentContentNode = this.parentMenu.parentMenu?.contentNode;
2831
- if (!parentContentNode) return;
2832
- const hoveredNode = this.domContext.getDocument().elementFromPoint(pointerPoint.x, pointerPoint.y);
2833
- if (!isElement$1(hoveredNode)) return;
2834
- const hoveredSubTrigger = hoveredNode.closest(`[${this.parentMenu.root.getBitsAttr("sub-trigger")}]`);
2835
- if (!hoveredSubTrigger || !parentContentNode.contains(hoveredSubTrigger)) return;
2836
- if (hoveredSubTrigger === this.parentMenu.triggerNode) return;
2837
- hoveredSubTrigger.dispatchEvent(new PointerEvent("pointermove", {
2838
- bubbles: true,
2839
- cancelable: true,
2840
- pointerType: "mouse",
2841
- clientX: pointerPoint.x,
2842
- clientY: pointerPoint.y
2843
- }));
2844
- }
2845
- onCloseAutoFocus = (e) => {
2846
- this.opts.onCloseAutoFocus.current?.(e);
2847
- if (e.defaultPrevented || this.#isSub) return;
2848
- if (this.parentMenu.root.ignoreCloseAutoFocus) {
2849
- e.preventDefault();
2850
- return;
2851
- }
2852
- if (this.parentMenu.triggerNode && isTabbable(this.parentMenu.triggerNode)) {
2853
- e.preventDefault();
2854
- this.parentMenu.triggerNode.focus();
2855
- }
2856
- };
2857
- handleTabKeyDown(e) {
2858
- /**
2859
- * We locate the root `menu`'s trigger by going up the tree until
2860
- * we find a menu that has no parent. This will allow us to focus the next
2861
- * tabbable element before/after the root trigger.
2862
- */
2863
- let rootMenu = this.parentMenu;
2864
- while (rootMenu.parentMenu !== null) rootMenu = rootMenu.parentMenu;
2865
- if (!rootMenu.triggerNode) return;
2866
- e.preventDefault();
2867
- const nodeToFocus = getTabbableFrom(rootMenu.triggerNode, e.shiftKey ? "prev" : "next");
2868
- if (nodeToFocus) {
2869
- /**
2870
- * We set a flag to ignore the `onCloseAutoFocus` event handler
2871
- * as well as the fallbacks inside the focus scope to prevent
2872
- * race conditions causing focus to fall back to the body even
2873
- * though we're trying to focus the next tabbable element.
2874
- */
2875
- this.parentMenu.root.ignoreCloseAutoFocus = true;
2876
- rootMenu.onClose();
2877
- afterTick(() => {
2878
- nodeToFocus.focus();
2879
- afterTick(() => {
2880
- this.parentMenu.root.ignoreCloseAutoFocus = false;
2881
- });
2882
- });
2883
- } else this.domContext.getDocument().body.focus();
2884
- }
2885
- onkeydown(e) {
2886
- if (e.defaultPrevented) return;
2887
- if (e.key === "Tab") {
2888
- this.handleTabKeyDown(e);
2889
- return;
2890
- }
2891
- const target = e.target;
2892
- const currentTarget = e.currentTarget;
2893
- if (!isHTMLElement$1(target) || !isHTMLElement$1(currentTarget)) return;
2894
- const isKeydownInside = target.closest(`[${this.parentMenu.root.getBitsAttr("content")}]`)?.id === this.parentMenu.contentId.current;
2895
- const isModifierKey = e.ctrlKey || e.altKey || e.metaKey;
2896
- const isCharacterKey = e.key.length === 1;
2897
- if (this.rovingFocusGroup.handleKeydown(target, e)) return;
2898
- if (e.code === "Space") return;
2899
- const candidateNodes = this.#getCandidateNodes();
2900
- if (isKeydownInside) {
2901
- if (!isModifierKey && isCharacterKey) this.#handleTypeaheadSearch(e.key, candidateNodes);
2902
- }
2903
- if (e.target?.id !== this.parentMenu.contentId.current) return;
2904
- if (!FIRST_LAST_KEYS.includes(e.key)) return;
2905
- e.preventDefault();
2906
- if (LAST_KEYS.includes(e.key)) candidateNodes.reverse();
2907
- focusFirst(candidateNodes, { select: false }, () => this.domContext.getActiveElement());
2908
- }
2909
- onblur(e) {
2910
- if (!isElement$1(e.currentTarget)) return;
2911
- if (!isElement$1(e.target)) return;
2912
- if (!e.currentTarget.contains?.(e.target)) {
2913
- this.domContext.getWindow().clearTimeout(this.#timer);
2914
- this.search = "";
2915
- }
2916
- }
2917
- onfocus(_) {
2918
- if (!this.parentMenu.root.isUsingKeyboard.current) return;
2919
- afterTick(() => this.rovingFocusGroup.focusFirstCandidate());
2920
- }
2921
- onItemEnter() {
2922
- return this.#isPointerMovingToSubmenu();
2923
- }
2924
- onItemLeave(e) {
2925
- if (e.currentTarget.hasAttribute(this.parentMenu.root.getBitsAttr("sub-trigger"))) return;
2926
- if (this.#isPointerMovingToSubmenu() || this.parentMenu.root.isUsingKeyboard.current) return;
2927
- this.parentMenu.contentNode?.focus({ preventScroll: true });
2928
- this.rovingFocusGroup.setCurrentTabStopId("");
2929
- }
2930
- onTriggerLeave() {
2931
- if (this.#isPointerMovingToSubmenu()) return true;
2932
- return false;
2933
- }
2934
- handleInteractOutside(e) {
2935
- if (!isElementOrSVGElement(e.target)) return;
2936
- const triggerId = this.parentMenu.triggerNode?.id;
2937
- if (e.target.id === triggerId) {
2938
- e.preventDefault();
2939
- return;
2940
- }
2941
- if (e.target.closest(`#${triggerId}`)) {
2942
- e.preventDefault();
2943
- return;
2944
- }
2945
- /**
2946
- * when the menu closes due to an outside pointer interaction (for example,
2947
- * clicking another dropdown trigger), avoid focusing this menu's trigger
2948
- * to prevent stealing focus from the new interaction target.
2949
- */
2950
- this.parentMenu.root.ignoreCloseAutoFocus = true;
2951
- afterTick(() => {
2952
- this.parentMenu.root.ignoreCloseAutoFocus = false;
2953
- });
2954
- }
2955
- get shouldRender() {
2956
- return this.parentMenu.contentPresence.shouldRender;
2957
- }
2958
- #snippetProps = $.derived(() => ({ open: this.parentMenu.opts.open.current }));
2959
- get snippetProps() {
2960
- return this.#snippetProps();
2961
- }
2962
- set snippetProps($$value) {
2963
- return this.#snippetProps($$value);
2964
- }
2965
- #props = $.derived(() => ({
2966
- id: this.opts.id.current,
2967
- role: "menu",
2968
- "aria-orientation": "vertical",
2969
- [this.parentMenu.root.getBitsAttr("content")]: "",
2970
- "data-state": getDataOpenClosed(this.parentMenu.opts.open.current),
2971
- ...getDataTransitionAttrs(this.parentMenu.contentPresence.transitionStatus),
2972
- onkeydown: this.onkeydown,
2973
- onblur: this.onblur,
2974
- onfocus: this.onfocus,
2975
- dir: this.parentMenu.root.opts.dir.current,
2976
- style: {
2977
- pointerEvents: "auto",
2978
- contain: "layout style"
2979
- },
2980
- ...this.attachment
2981
- }));
2982
- get props() {
2983
- return this.#props();
2984
- }
2985
- set props($$value) {
2986
- return this.#props($$value);
2987
- }
2988
- popperProps = { onCloseAutoFocus: (e) => this.onCloseAutoFocus(e) };
2281
+ var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {
2282
+ if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) return false;
2283
+ return true;
2989
2284
  };
2990
- var MenuItemSharedState = class {
2991
- opts;
2992
- content;
2993
- attachment;
2994
- #isFocused = false;
2995
- constructor(opts, content) {
2996
- this.opts = opts;
2997
- this.content = content;
2998
- this.attachment = attachRef(this.opts.ref);
2999
- this.onpointermove = this.onpointermove.bind(this);
3000
- this.onpointerleave = this.onpointerleave.bind(this);
3001
- this.onfocus = this.onfocus.bind(this);
3002
- this.onblur = this.onblur.bind(this);
3003
- }
3004
- onpointermove(e) {
3005
- if (e.defaultPrevented) return;
3006
- if (!isMouseEvent(e)) return;
3007
- if (this.opts.disabled.current) this.content.onItemLeave(e);
3008
- else {
3009
- if (this.content.onItemEnter()) return;
3010
- const item = e.currentTarget;
3011
- if (!isHTMLElement$1(item)) return;
3012
- item.focus({ preventScroll: true });
3013
- }
3014
- }
3015
- onpointerleave(e) {
3016
- if (e.defaultPrevented) return;
3017
- if (!isMouseEvent(e)) return;
3018
- this.content.onItemLeave(e);
3019
- }
3020
- onfocus(e) {
3021
- afterTick(() => {
3022
- if (e.defaultPrevented || this.opts.disabled.current) return;
3023
- this.#isFocused = true;
3024
- });
3025
- }
3026
- onblur(e) {
3027
- afterTick(() => {
3028
- if (e.defaultPrevented) return;
3029
- this.#isFocused = false;
3030
- });
3031
- }
3032
- #props = $.derived(() => ({
3033
- id: this.opts.id.current,
3034
- tabindex: -1,
3035
- role: "menuitem",
3036
- "aria-disabled": boolToStr(this.opts.disabled.current),
3037
- "data-disabled": boolToEmptyStrOrUndef(this.opts.disabled.current),
3038
- "data-highlighted": this.#isFocused ? "" : void 0,
3039
- [this.content.parentMenu.root.getBitsAttr("item")]: "",
3040
- onpointermove: this.onpointermove,
3041
- onpointerleave: this.onpointerleave,
3042
- onfocus: this.onfocus,
3043
- onblur: this.onblur,
3044
- ...this.attachment
3045
- }));
3046
- get props() {
3047
- return this.#props();
3048
- }
3049
- set props($$value) {
3050
- return this.#props($$value);
3051
- }
2285
+ var isShadowRootTabbable = function isShadowRootTabbable(shadowHostNode) {
2286
+ var tabIndex = parseInt(shadowHostNode.getAttribute("tabindex"), 10);
2287
+ if (isNaN(tabIndex) || tabIndex >= 0) return true;
2288
+ return false;
3052
2289
  };
3053
- var MenuItemState = class MenuItemState {
3054
- static create(opts) {
3055
- const item = new MenuItemSharedState(opts, MenuContentContext.get());
3056
- return new MenuItemState(opts, item);
3057
- }
3058
- opts;
3059
- item;
3060
- root;
3061
- #isPointerDown = false;
3062
- constructor(opts, item) {
3063
- this.opts = opts;
3064
- this.item = item;
3065
- this.root = item.content.parentMenu.root;
3066
- this.onkeydown = this.onkeydown.bind(this);
3067
- this.onclick = this.onclick.bind(this);
3068
- this.onpointerdown = this.onpointerdown.bind(this);
3069
- this.onpointerup = this.onpointerup.bind(this);
3070
- }
3071
- #handleSelect() {
3072
- if (this.item.opts.disabled.current) return;
3073
- const selectEvent = new CustomEvent("menuitemselect", {
3074
- bubbles: true,
3075
- cancelable: true
2290
+ /**
2291
+ * @param {Array.<Element|CandidateScope>} candidates
2292
+ * @returns Element[]
2293
+ */
2294
+ var _sortByOrder = function sortByOrder(candidates) {
2295
+ var regularTabbables = [];
2296
+ var orderedTabbables = [];
2297
+ candidates.forEach(function(item, i) {
2298
+ var isScope = !!item.scopeParent;
2299
+ var element = isScope ? item.scopeParent : item;
2300
+ var candidateTabindex = getSortOrderTabIndex(element, isScope);
2301
+ var elements = isScope ? _sortByOrder(item.candidates) : element;
2302
+ if (candidateTabindex === 0) isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
2303
+ else orderedTabbables.push({
2304
+ documentOrder: i,
2305
+ tabIndex: candidateTabindex,
2306
+ item,
2307
+ isScope,
2308
+ content: elements
3076
2309
  });
3077
- this.opts.onSelect.current(selectEvent);
3078
- if (selectEvent.defaultPrevented) {
3079
- this.item.content.parentMenu.root.isUsingKeyboard.current = false;
3080
- return;
3081
- }
3082
- if (this.opts.closeOnSelect.current) this.item.content.parentMenu.root.opts.onClose();
3083
- }
3084
- onkeydown(e) {
3085
- const isTypingAhead = this.item.content.search !== "";
3086
- if (this.item.opts.disabled.current || isTypingAhead && e.key === " ") return;
3087
- if (SELECTION_KEYS.includes(e.key)) {
3088
- if (!isHTMLElement$1(e.currentTarget)) return;
3089
- e.currentTarget.click();
3090
- /**
3091
- * We prevent default browser behavior for selection keys as they should trigger
3092
- * a selection only:
3093
- * - prevents space from scrolling the page.
3094
- * - if keydown causes focus to move, prevents keydown from firing on the new target.
3095
- */
3096
- e.preventDefault();
3097
- }
3098
- }
3099
- onclick(_) {
3100
- if (this.item.opts.disabled.current) return;
3101
- this.#handleSelect();
3102
- }
3103
- onpointerup(e) {
3104
- if (e.defaultPrevented) return;
3105
- if (!this.#isPointerDown) {
3106
- if (!isHTMLElement$1(e.currentTarget)) return;
3107
- e.currentTarget?.click();
3108
- }
3109
- }
3110
- onpointerdown(_) {
3111
- this.#isPointerDown = true;
3112
- }
3113
- #props = $.derived(() => mergeProps(this.item.props, {
3114
- onclick: this.onclick,
3115
- onpointerdown: this.onpointerdown,
3116
- onpointerup: this.onpointerup,
3117
- onkeydown: this.onkeydown
3118
- }));
3119
- get props() {
3120
- return this.#props();
3121
- }
3122
- set props($$value) {
3123
- return this.#props($$value);
3124
- }
2310
+ });
2311
+ return orderedTabbables.sort(sortOrderedTabbables).reduce(function(acc, sortable) {
2312
+ sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);
2313
+ return acc;
2314
+ }, []).concat(regularTabbables);
3125
2315
  };
3126
- var MenuGroupState = class MenuGroupState {
3127
- static create(opts) {
3128
- return MenuGroupContext.set(new MenuGroupState(opts, MenuRootContext.get()));
3129
- }
3130
- opts;
3131
- root;
3132
- attachment;
3133
- groupHeadingId = void 0;
3134
- constructor(opts, root) {
3135
- this.opts = opts;
3136
- this.root = root;
3137
- this.attachment = attachRef(this.opts.ref);
3138
- }
3139
- #props = $.derived(() => ({
3140
- id: this.opts.id.current,
3141
- role: "group",
3142
- "aria-labelledby": this.groupHeadingId,
3143
- [this.root.getBitsAttr("group")]: "",
3144
- ...this.attachment
3145
- }));
3146
- get props() {
3147
- return this.#props();
3148
- }
3149
- set props($$value) {
3150
- return this.#props($$value);
3151
- }
3152
- };
3153
- var MenuSeparatorState = class MenuSeparatorState {
3154
- static create(opts) {
3155
- return new MenuSeparatorState(opts, MenuRootContext.get());
3156
- }
3157
- opts;
3158
- root;
3159
- attachment;
3160
- constructor(opts, root) {
3161
- this.opts = opts;
3162
- this.root = root;
3163
- this.attachment = attachRef(this.opts.ref);
3164
- }
3165
- #props = $.derived(() => ({
3166
- id: this.opts.id.current,
3167
- role: "group",
3168
- [this.root.getBitsAttr("separator")]: "",
3169
- ...this.attachment
3170
- }));
3171
- get props() {
3172
- return this.#props();
3173
- }
3174
- set props($$value) {
3175
- return this.#props($$value);
3176
- }
3177
- };
3178
- var DropdownMenuTriggerState = class DropdownMenuTriggerState {
3179
- static create(opts) {
3180
- return new DropdownMenuTriggerState(opts, MenuMenuContext.get());
3181
- }
3182
- opts;
3183
- parentMenu;
3184
- attachment;
3185
- constructor(opts, parentMenu) {
3186
- this.opts = opts;
3187
- this.parentMenu = parentMenu;
3188
- this.attachment = attachRef(this.opts.ref, (v) => this.parentMenu.triggerNode = v);
3189
- }
3190
- onclick = (e) => {
3191
- /**
3192
- * MacOS VoiceOver sends a click in Safari/Firefox bypassing the keydown event
3193
- * when V0+Space is pressed. Since we already handle the keydown event and the
3194
- * pointerdown events separately, we ignore it if the detail is not 0.
3195
- */
3196
- if (this.opts.disabled.current || e.detail !== 0) return;
3197
- this.parentMenu.toggleOpen();
3198
- e.preventDefault();
3199
- };
3200
- onpointerdown = (e) => {
3201
- if (this.opts.disabled.current) return;
3202
- if (e.pointerType === "touch") return e.preventDefault();
3203
- if (e.button === 0 && e.ctrlKey === false) {
3204
- this.parentMenu.toggleOpen();
3205
- if (!this.parentMenu.opts.open.current) e.preventDefault();
3206
- }
3207
- };
3208
- onpointerup = (e) => {
3209
- if (this.opts.disabled.current) return;
3210
- if (e.pointerType === "touch") {
3211
- e.preventDefault();
3212
- this.parentMenu.toggleOpen();
3213
- }
3214
- };
3215
- onkeydown = (e) => {
3216
- if (this.opts.disabled.current) return;
3217
- if (e.key === " " || e.key === "Enter") {
3218
- this.parentMenu.toggleOpen();
3219
- e.preventDefault();
3220
- return;
3221
- }
3222
- if (e.key === "ArrowDown") {
3223
- this.parentMenu.onOpen();
3224
- e.preventDefault();
3225
- }
3226
- };
3227
- #ariaControls = $.derived(() => {
3228
- if (this.parentMenu.opts.open.current && this.parentMenu.contentId.current) return this.parentMenu.contentId.current;
3229
- });
3230
- #props = $.derived(() => ({
3231
- id: this.opts.id.current,
3232
- disabled: this.opts.disabled.current,
3233
- "aria-haspopup": "menu",
3234
- "aria-expanded": boolToStr(this.parentMenu.opts.open.current),
3235
- "aria-controls": this.#ariaControls(),
3236
- "data-disabled": boolToEmptyStrOrUndef(this.opts.disabled.current),
3237
- "data-state": getDataOpenClosed(this.parentMenu.opts.open.current),
3238
- [this.parentMenu.root.getBitsAttr("trigger")]: "",
3239
- onclick: this.onclick,
3240
- onpointerdown: this.onpointerdown,
3241
- onpointerup: this.onpointerup,
3242
- onkeydown: this.onkeydown,
3243
- ...this.attachment
3244
- }));
3245
- get props() {
3246
- return this.#props();
3247
- }
3248
- set props($$value) {
3249
- return this.#props($$value);
3250
- }
3251
- };
3252
- var MenuSubmenuState = class {
3253
- static create(opts) {
3254
- const menu = MenuMenuContext.get();
3255
- return MenuMenuContext.set(new MenuMenuState(opts, menu.root, menu));
3256
- }
3257
- };
3258
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/dismissible-layer/use-dismissable-layer.svelte.js
3259
- globalThis.bitsDismissableLayers ??= /* @__PURE__ */ new Map();
3260
- var DismissibleLayerState = class DismissibleLayerState {
3261
- static create(opts) {
3262
- return new DismissibleLayerState(opts);
3263
- }
3264
- opts;
3265
- #interactOutsideProp;
3266
- #behaviorType;
3267
- #interceptedEvents = { pointerdown: false };
3268
- #isResponsibleLayer = false;
3269
- #isFocusInsideDOMTree = false;
3270
- #documentObj = void 0;
3271
- #onFocusOutside;
3272
- #unsubClickListener = noop;
3273
- constructor(opts) {
3274
- this.opts = opts;
3275
- this.#behaviorType = opts.interactOutsideBehavior;
3276
- this.#interactOutsideProp = opts.onInteractOutside;
3277
- this.#onFocusOutside = opts.onFocusOutside;
3278
- let unsubEvents = noop;
3279
- let pendingTimer = null;
3280
- const clearPendingTimer = () => {
3281
- if (pendingTimer != null) {
3282
- clearTimeout(pendingTimer);
3283
- pendingTimer = null;
3284
- }
3285
- };
3286
- const cleanup = () => {
3287
- clearPendingTimer();
3288
- this.#resetState();
3289
- globalThis.bitsDismissableLayers.delete(this);
3290
- this.#handleInteractOutside.destroy();
3291
- unsubEvents();
3292
- };
3293
- watch([() => this.opts.enabled.current, () => this.opts.ref.current], () => {
3294
- if (!this.opts.enabled.current || !this.opts.ref.current) return;
3295
- clearPendingTimer();
3296
- pendingTimer = afterSleep(1, () => {
3297
- pendingTimer = null;
3298
- if (!this.opts.ref.current) return;
3299
- globalThis.bitsDismissableLayers.set(this, this.#behaviorType);
3300
- unsubEvents();
3301
- unsubEvents = this.#addEventListeners();
3302
- });
3303
- return cleanup;
3304
- });
3305
- }
3306
- #handleFocus = (event) => {
3307
- if (event.defaultPrevented) return;
3308
- if (!this.opts.ref.current) return;
3309
- afterTick(() => {
3310
- if (!this.opts.ref.current || this.#isTargetWithinLayer(event.target)) return;
3311
- if (event.target && !this.#isFocusInsideDOMTree) this.#onFocusOutside.current?.(event);
3312
- });
3313
- };
3314
- #addEventListeners() {
3315
- return executeCallbacks(
3316
- /**
3317
- * CAPTURE INTERACTION START
3318
- * mark interaction-start event as intercepted.
3319
- * mark responsible layer during interaction start
3320
- * to avoid checking if is responsible layer during interaction end
3321
- * when a new floating element may have been opened.
3322
- */
3323
- on(this.#documentObj, "pointerdown", executeCallbacks(this.#markInterceptedEvent, this.#markResponsibleLayer), { capture: true }),
3324
- /**
3325
- * BUBBLE INTERACTION START
3326
- * Mark interaction-start event as non-intercepted. Debounce `onInteractOutsideStart`
3327
- * to avoid prematurely checking if other events were intercepted.
3328
- */
3329
- on(this.#documentObj, "pointerdown", executeCallbacks(this.#markNonInterceptedEvent, this.#handleInteractOutside)),
3330
- /**
3331
- * HANDLE FOCUS OUTSIDE
3332
- */
3333
- on(this.#documentObj, "focusin", this.#handleFocus)
3334
- );
3335
- }
3336
- #handleDismiss = (e) => {
3337
- let event = e;
3338
- if (event.defaultPrevented) event = createWrappedEvent(e);
3339
- this.#interactOutsideProp.current(e);
3340
- };
3341
- #handleInteractOutside = debounce((e) => {
3342
- if (!this.opts.ref.current) {
3343
- this.#unsubClickListener();
3344
- return;
3345
- }
3346
- const isEventValid = this.opts.isValidEvent.current(e, this.opts.ref.current) || isValidEvent(e, this.opts.ref.current);
3347
- if (!this.#isResponsibleLayer || this.#isAnyEventIntercepted() || !isEventValid) {
3348
- this.#unsubClickListener();
3349
- return;
3350
- }
3351
- let event = e;
3352
- if (event.defaultPrevented) event = createWrappedEvent(event);
3353
- if (this.#behaviorType.current !== "close" && this.#behaviorType.current !== "defer-otherwise-close") {
3354
- this.#unsubClickListener();
3355
- return;
3356
- }
3357
- if (e.pointerType === "touch") {
3358
- this.#unsubClickListener();
3359
- this.#unsubClickListener = on(this.#documentObj, "click", this.#handleDismiss, { once: true });
3360
- } else this.#interactOutsideProp.current(event);
3361
- }, 10);
3362
- #markInterceptedEvent = (e) => {
3363
- this.#interceptedEvents[e.type] = true;
3364
- };
3365
- #markNonInterceptedEvent = (e) => {
3366
- this.#interceptedEvents[e.type] = false;
3367
- };
3368
- #markResponsibleLayer = () => {
3369
- if (!this.opts.ref.current) return;
3370
- this.#isResponsibleLayer = isResponsibleLayer(this.opts.ref.current);
3371
- };
3372
- #isTargetWithinLayer = (target) => {
3373
- if (!this.opts.ref.current) return false;
3374
- return isOrContainsTarget(this.opts.ref.current, target);
3375
- };
3376
- #resetState = debounce(() => {
3377
- for (const eventType in this.#interceptedEvents) this.#interceptedEvents[eventType] = false;
3378
- this.#isResponsibleLayer = false;
3379
- }, 20);
3380
- #isAnyEventIntercepted() {
3381
- return Object.values(this.#interceptedEvents).some(Boolean);
3382
- }
3383
- #onfocuscapture = () => {
3384
- this.#isFocusInsideDOMTree = true;
3385
- };
3386
- #onblurcapture = () => {
3387
- this.#isFocusInsideDOMTree = false;
3388
- };
3389
- props = {
3390
- onfocuscapture: this.#onfocuscapture,
3391
- onblurcapture: this.#onblurcapture
3392
- };
3393
- };
3394
- function getTopMostDismissableLayer(layersArr = [...globalThis.bitsDismissableLayers]) {
3395
- return layersArr.findLast(([_, { current: behaviorType }]) => behaviorType === "close" || behaviorType === "ignore");
3396
- }
3397
- function isResponsibleLayer(node) {
3398
- const layersArr = [...globalThis.bitsDismissableLayers];
3399
- /**
3400
- * We first check if we can find a top layer with `close` or `ignore`.
3401
- * If that top layer was found and matches the provided node, then the node is
3402
- * responsible for the outside interaction. Otherwise, we know that all layers defer so
3403
- * the first layer is the responsible one.
3404
- */
3405
- const topMostLayer = getTopMostDismissableLayer(layersArr);
3406
- if (topMostLayer) return topMostLayer[0].opts.ref.current === node;
3407
- const [firstLayerNode] = layersArr[0];
3408
- return firstLayerNode.opts.ref.current === node;
3409
- }
3410
- function isValidEvent(e, node) {
3411
- const target = e.target;
3412
- if (!isElementOrSVGElement(target)) return false;
3413
- const targetIsContextMenuTrigger = Boolean(target.closest(`[${CONTEXT_MENU_TRIGGER_ATTR}]`));
3414
- const nodeIsContextMenu = Boolean(node.closest(`[${CONTEXT_MENU_CONTENT_ATTR}]`));
3415
- if ("button" in e && e.button > 0 && !targetIsContextMenuTrigger) return false;
3416
- if ("button" in e && e.button === 0 && targetIsContextMenuTrigger && nodeIsContextMenu) return true;
3417
- if (targetIsContextMenuTrigger && nodeIsContextMenu) return false;
3418
- return getOwnerDocument(target).documentElement.contains(target) && !isOrContainsTarget(node, target) && isClickTrulyOutside(e, node);
3419
- }
3420
- function createWrappedEvent(e) {
3421
- const capturedCurrentTarget = e.currentTarget;
3422
- const capturedTarget = e.target;
3423
- let newEvent;
3424
- if (e instanceof PointerEvent) newEvent = new PointerEvent(e.type, e);
3425
- else newEvent = new PointerEvent("pointerdown", e);
3426
- let isPrevented = false;
3427
- return new Proxy(newEvent, { get: (target, prop) => {
3428
- if (prop === "currentTarget") return capturedCurrentTarget;
3429
- if (prop === "target") return capturedTarget;
3430
- if (prop === "preventDefault") return () => {
3431
- isPrevented = true;
3432
- if (typeof target.preventDefault === "function") target.preventDefault();
3433
- };
3434
- if (prop === "defaultPrevented") return isPrevented;
3435
- if (prop in target) return target[prop];
3436
- return e[prop];
3437
- } });
3438
- }
3439
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/dismissible-layer/dismissible-layer.svelte
3440
- function Dismissible_layer($$renderer, $$props) {
3441
- $$renderer.component(($$renderer) => {
3442
- let { interactOutsideBehavior = "close", onInteractOutside = noop, onFocusOutside = noop, id, children, enabled, isValidEvent = () => false, ref } = $$props;
3443
- const dismissibleLayerState = DismissibleLayerState.create({
3444
- id: boxWith(() => id),
3445
- interactOutsideBehavior: boxWith(() => interactOutsideBehavior),
3446
- onInteractOutside: boxWith(() => onInteractOutside),
3447
- enabled: boxWith(() => enabled),
3448
- onFocusOutside: boxWith(() => onFocusOutside),
3449
- isValidEvent: boxWith(() => isValidEvent),
3450
- ref
3451
- });
3452
- children?.($$renderer, { props: dismissibleLayerState.props });
3453
- $$renderer.push(`<!---->`);
2316
+ var tabbable = function tabbable(container, options) {
2317
+ options = options || {};
2318
+ var candidates;
2319
+ if (options.getShadowRoot) candidates = _getCandidatesIteratively([container], options.includeContainer, {
2320
+ filter: isNodeMatchingSelectorTabbable.bind(null, options),
2321
+ flatten: false,
2322
+ getShadowRoot: options.getShadowRoot,
2323
+ shadowRootFilter: isShadowRootTabbable
3454
2324
  });
3455
- }
3456
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/escape-layer/use-escape-layer.svelte.js
3457
- globalThis.bitsEscapeLayers ??= /* @__PURE__ */ new Map();
3458
- var EscapeLayerState = class EscapeLayerState {
3459
- static create(opts) {
3460
- return new EscapeLayerState(opts);
3461
- }
3462
- opts;
3463
- domContext;
3464
- constructor(opts) {
3465
- this.opts = opts;
3466
- this.domContext = new DOMContext(this.opts.ref);
3467
- let unsubEvents = noop;
3468
- watch(() => opts.enabled.current, (enabled) => {
3469
- if (enabled) {
3470
- globalThis.bitsEscapeLayers.set(this, opts.escapeKeydownBehavior);
3471
- unsubEvents = this.#addEventListener();
3472
- }
3473
- return () => {
3474
- unsubEvents();
3475
- globalThis.bitsEscapeLayers.delete(this);
3476
- };
3477
- });
3478
- }
3479
- #addEventListener = () => {
3480
- return on(this.domContext.getDocument(), "keydown", this.#onkeydown, { passive: false });
3481
- };
3482
- #onkeydown = (e) => {
3483
- if (e.key !== "Escape" || !isResponsibleEscapeLayer(this)) return;
3484
- const clonedEvent = new KeyboardEvent(e.type, e);
3485
- e.preventDefault();
3486
- const behaviorType = this.opts.escapeKeydownBehavior.current;
3487
- if (behaviorType !== "close" && behaviorType !== "defer-otherwise-close") return;
3488
- this.opts.onEscapeKeydown.current(clonedEvent);
3489
- };
2325
+ else candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
2326
+ return _sortByOrder(candidates);
3490
2327
  };
3491
- function isResponsibleEscapeLayer(instance) {
3492
- const layersArr = [...globalThis.bitsEscapeLayers];
3493
- /**
3494
- * We first check if we can find a top layer with `close` or `ignore`.
3495
- * If that top layer was found and matches the provided node, then the node is
3496
- * responsible for the escape. Otherwise, we know that all layers defer so
3497
- * the first layer is the responsible one.
3498
- */
3499
- const topMostLayer = layersArr.findLast(([_, { current: behaviorType }]) => behaviorType === "close" || behaviorType === "ignore");
3500
- if (topMostLayer) return topMostLayer[0] === instance;
3501
- const [firstLayerNode] = layersArr[0];
3502
- return firstLayerNode === instance;
3503
- }
3504
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/escape-layer/escape-layer.svelte
3505
- function Escape_layer($$renderer, $$props) {
3506
- $$renderer.component(($$renderer) => {
3507
- let { escapeKeydownBehavior = "close", onEscapeKeydown = noop, children, enabled, ref } = $$props;
3508
- EscapeLayerState.create({
3509
- escapeKeydownBehavior: boxWith(() => escapeKeydownBehavior),
3510
- onEscapeKeydown: boxWith(() => onEscapeKeydown),
3511
- enabled: boxWith(() => enabled),
3512
- ref
3513
- });
3514
- children?.($$renderer);
3515
- $$renderer.push(`<!---->`);
3516
- });
3517
- }
3518
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/focus-scope/focus-scope-manager.js
3519
- var FocusScopeManager = class FocusScopeManager {
3520
- static instance;
3521
- #scopeStack = simpleBox([]);
3522
- #focusHistory = /* @__PURE__ */ new WeakMap();
3523
- #preFocusHistory = /* @__PURE__ */ new WeakMap();
3524
- static getInstance() {
3525
- if (!this.instance) this.instance = new FocusScopeManager();
3526
- return this.instance;
3527
- }
3528
- register(scope) {
3529
- const current = this.getActive();
3530
- if (current && current !== scope) current.pause();
3531
- const activeElement = document.activeElement;
3532
- if (activeElement && activeElement !== document.body) this.#preFocusHistory.set(scope, activeElement);
3533
- this.#scopeStack.current = this.#scopeStack.current.filter((s) => s !== scope);
3534
- this.#scopeStack.current.unshift(scope);
3535
- }
3536
- unregister(scope) {
3537
- this.#scopeStack.current = this.#scopeStack.current.filter((s) => s !== scope);
3538
- const next = this.getActive();
3539
- if (next) next.resume();
3540
- }
3541
- getActive() {
3542
- return this.#scopeStack.current[0];
3543
- }
3544
- setFocusMemory(scope, element) {
3545
- this.#focusHistory.set(scope, element);
3546
- }
3547
- getFocusMemory(scope) {
3548
- return this.#focusHistory.get(scope);
3549
- }
3550
- isActiveScope(scope) {
3551
- return this.getActive() === scope;
3552
- }
3553
- setPreFocusMemory(scope, element) {
3554
- this.#preFocusHistory.set(scope, element);
3555
- }
3556
- getPreFocusMemory(scope) {
3557
- return this.#preFocusHistory.get(scope);
3558
- }
3559
- clearPreFocusMemory(scope) {
3560
- this.#preFocusHistory.delete(scope);
3561
- }
2328
+ var focusable = function focusable(container, options) {
2329
+ options = options || {};
2330
+ var candidates;
2331
+ if (options.getShadowRoot) candidates = _getCandidatesIteratively([container], options.includeContainer, {
2332
+ filter: isNodeMatchingSelectorFocusable.bind(null, options),
2333
+ flatten: true,
2334
+ getShadowRoot: options.getShadowRoot
2335
+ });
2336
+ else candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
2337
+ return candidates;
2338
+ };
2339
+ var isTabbable = function isTabbable(node, options) {
2340
+ options = options || {};
2341
+ if (!node) throw new Error("No node provided");
2342
+ if (matches.call(node, candidateSelector) === false) return false;
2343
+ return isNodeMatchingSelectorTabbable(options, node);
2344
+ };
2345
+ var focusableCandidateSelector = /* #__PURE__ */ candidateSelectors.concat("iframe:not([inert]):not([inert] *)").join(",");
2346
+ var isFocusable = function isFocusable(node, options) {
2347
+ options = options || {};
2348
+ if (!node) throw new Error("No node provided");
2349
+ if (matches.call(node, focusableCandidateSelector) === false) return false;
2350
+ return isNodeMatchingSelectorFocusable(options, node);
3562
2351
  };
3563
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/focus-scope/focus-scope.svelte.js
2352
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/focus-scope/focus-scope.svelte.js
2353
+ function retargetToScopeTree(node, container) {
2354
+ const scopeRoot = container.getRootNode();
2355
+ while (node) {
2356
+ const root = node.getRootNode();
2357
+ if (root === scopeRoot) return node;
2358
+ node = root !== node && "host" in root ? root.host : null;
2359
+ }
2360
+ return null;
2361
+ }
3564
2362
  var FocusScope = class FocusScope {
3565
2363
  #paused = false;
3566
2364
  #container = null;
@@ -3584,6 +2382,7 @@ var FocusScope = class FocusScope {
3584
2382
  this.#cleanupFns = [];
3585
2383
  }
3586
2384
  mount(container) {
2385
+ if (this.#container === container) return;
3587
2386
  if (this.#container) this.unmount();
3588
2387
  this.#container = container;
3589
2388
  this.#manager.register(this);
@@ -3606,12 +2405,12 @@ var FocusScope = class FocusScope {
3606
2405
  });
3607
2406
  this.#opts.onOpenAutoFocus.current(event);
3608
2407
  if (!event.defaultPrevented) requestAnimationFrame(() => {
3609
- if (!this.#container) return;
2408
+ if (!this.#container || this.#paused || !this.#manager.isActiveScope(this) || this.#container.contains(retargetToScopeTree(getActiveElement(this.#container.ownerDocument), this.#container))) return;
3610
2409
  const firstTabbable = this.#getFirstTabbable();
3611
2410
  if (firstTabbable) {
3612
- firstTabbable.focus();
2411
+ firstTabbable.focus({ preventScroll: true });
3613
2412
  this.#manager.setFocusMemory(this, firstTabbable);
3614
- } else this.#container.focus();
2413
+ } else this.#container.focus({ preventScroll: true });
3615
2414
  });
3616
2415
  }
3617
2416
  #handleCloseAutoFocus() {
@@ -3622,8 +2421,8 @@ var FocusScope = class FocusScope {
3622
2421
  this.#opts.onCloseAutoFocus.current?.(event);
3623
2422
  if (!event.defaultPrevented) {
3624
2423
  const preFocusedElement = this.#manager.getPreFocusMemory(this);
3625
- if (preFocusedElement && document.contains(preFocusedElement)) try {
3626
- preFocusedElement.focus();
2424
+ if (preFocusedElement && preFocusedElement.isConnected) try {
2425
+ preFocusedElement.focus({ preventScroll: true });
3627
2426
  } catch {
3628
2427
  document.body.focus();
3629
2428
  }
@@ -3635,18 +2434,17 @@ var FocusScope = class FocusScope {
3635
2434
  const doc = container.ownerDocument;
3636
2435
  const handleFocus = (e) => {
3637
2436
  if (this.#paused || !this.#manager.isActiveScope(this)) return;
3638
- const target = e.target;
3639
- if (!target) return;
3640
- if (container.contains(target)) this.#manager.setFocusMemory(this, target);
2437
+ const target = retargetToScopeTree(e.composedPath()[0], container);
2438
+ if (target !== null && container.contains(target)) this.#manager.setFocusMemory(this, target);
3641
2439
  else {
3642
2440
  const lastFocused = this.#manager.getFocusMemory(this);
3643
2441
  if (lastFocused && container.contains(lastFocused) && isFocusable(lastFocused)) {
3644
2442
  e.preventDefault();
3645
- lastFocused.focus();
2443
+ lastFocused.focus({ preventScroll: true });
3646
2444
  } else {
3647
2445
  const firstTabbable = this.#getFirstTabbable();
3648
2446
  const firstFocusable = this.#getAllFocusables()[0];
3649
- (firstTabbable || firstFocusable || container).focus();
2447
+ (firstTabbable || firstFocusable || container).focus({ preventScroll: true });
3650
2448
  }
3651
2449
  }
3652
2450
  };
@@ -3657,10 +2455,10 @@ var FocusScope = class FocusScope {
3657
2455
  if (tabbables.length === 0) return;
3658
2456
  const first = tabbables[0];
3659
2457
  const last = tabbables[tabbables.length - 1];
3660
- if (!e.shiftKey && doc.activeElement === last) {
2458
+ if (!e.shiftKey && getActiveElement(doc) === last) {
3661
2459
  e.preventDefault();
3662
2460
  first.focus();
3663
- } else if (e.shiftKey && doc.activeElement === first) {
2461
+ } else if (e.shiftKey && getActiveElement(doc) === first) {
3664
2462
  e.preventDefault();
3665
2463
  last.focus();
3666
2464
  }
@@ -3673,9 +2471,9 @@ var FocusScope = class FocusScope {
3673
2471
  const firstFocusable = this.#getAllFocusables()[0];
3674
2472
  const elementToFocus = firstTabbable || firstFocusable;
3675
2473
  if (elementToFocus) {
3676
- elementToFocus.focus();
2474
+ elementToFocus.focus({ preventScroll: true });
3677
2475
  this.#manager.setFocusMemory(this, elementToFocus);
3678
- } else container.focus();
2476
+ } else container.focus({ preventScroll: true });
3679
2477
  }
3680
2478
  });
3681
2479
  observer.observe(container, {
@@ -3717,23 +2515,23 @@ var FocusScope = class FocusScope {
3717
2515
  } };
3718
2516
  }
3719
2517
  };
3720
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/focus-scope/focus-scope.svelte
2518
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/focus-scope/focus-scope.svelte
3721
2519
  function Focus_scope($$renderer, $$props) {
3722
2520
  $$renderer.component(($$renderer) => {
3723
2521
  let { enabled = false, trapFocus = false, loop = false, onCloseAutoFocus = noop, onOpenAutoFocus = noop, focusScope, ref } = $$props;
3724
2522
  const focusScopeState = FocusScope.use({
3725
2523
  enabled: boxWith(() => enabled),
3726
2524
  trap: boxWith(() => trapFocus),
3727
- loop,
2525
+ loop: untrack(() => loop),
3728
2526
  onCloseAutoFocus: boxWith(() => onCloseAutoFocus),
3729
2527
  onOpenAutoFocus: boxWith(() => onOpenAutoFocus),
3730
- ref
2528
+ ref: untrack(() => ref)
3731
2529
  });
3732
2530
  focusScope?.($$renderer, { props: focusScopeState.props });
3733
2531
  $$renderer.push(`<!---->`);
3734
2532
  });
3735
2533
  }
3736
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/text-selection-layer/use-text-selection-layer.svelte.js
2534
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/text-selection-layer/use-text-selection-layer.svelte.js
3737
2535
  var noopPointer = () => {};
3738
2536
  globalThis.bitsTextSelectionLayers ??= /* @__PURE__ */ new Map();
3739
2537
  var TextSelectionLayerState = class TextSelectionLayerState {
@@ -3772,13 +2570,16 @@ var TextSelectionLayerState = class TextSelectionLayerState {
3772
2570
  });
3773
2571
  }
3774
2572
  #addEventListeners() {
3775
- return executeCallbacks(on(this.domContext.getDocument(), "pointerdown", this.#pointerdown), on(this.domContext.getDocument(), "pointerup", composeHandlers(this.#resetSelectionLock, this.#pointerupUserHandler)));
2573
+ return executeCallbacks(on(this.domContext.getDocument(), "pointerdown", this.#pointerdown), on(this.domContext.getDocument(), "pointerup", this.#pointerup));
3776
2574
  }
3777
- #pointerupUserHandler = (e) => {
2575
+ #pointerup = (e) => {
2576
+ this.#resetSelectionLock();
2577
+ if (e.defaultPrevented) return;
3778
2578
  this.#onPointerUpSnapshot(e);
3779
2579
  };
3780
2580
  #pointerdown = (e) => {
3781
2581
  if (!this.#enabledSnapshot) return;
2582
+ this.#resetSelectionLock();
3782
2583
  const node = this.opts.ref.current;
3783
2584
  const target = e.target;
3784
2585
  if (!isHTMLElement$1(node) || !isHTMLElement$1(target)) return;
@@ -3819,7 +2620,7 @@ function isHighestLayer(instance) {
3819
2620
  if (!highestLayer) return false;
3820
2621
  return highestLayer[0] === instance;
3821
2622
  }
3822
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/text-selection-layer/text-selection-layer.svelte
2623
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/text-selection-layer/text-selection-layer.svelte
3823
2624
  function Text_selection_layer($$renderer, $$props) {
3824
2625
  $$renderer.component(($$renderer) => {
3825
2626
  let { preventOverflowTextSelection = true, onPointerDown = noop, onPointerUp = noop, id, children, enabled, ref } = $$props;
@@ -3828,13 +2629,13 @@ function Text_selection_layer($$renderer, $$props) {
3828
2629
  onPointerDown: boxWith(() => onPointerDown),
3829
2630
  onPointerUp: boxWith(() => onPointerUp),
3830
2631
  enabled: boxWith(() => enabled && preventOverflowTextSelection),
3831
- ref
2632
+ ref: untrack(() => ref)
3832
2633
  });
3833
2634
  children?.($$renderer);
3834
2635
  $$renderer.push(`<!---->`);
3835
2636
  });
3836
2637
  }
3837
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/use-id.js
2638
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/use-id.js
3838
2639
  globalThis.bitsIdCounter ??= { current: 0 };
3839
2640
  /**
3840
2641
  * Generates a unique ID based on a global counter.
@@ -3843,7 +2644,7 @@ function useId(prefix = "bits") {
3843
2644
  globalThis.bitsIdCounter.current++;
3844
2645
  return `${prefix}-${globalThis.bitsIdCounter.current}`;
3845
2646
  }
3846
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/shared-state.svelte.js
2647
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/shared-state.svelte.js
3847
2648
  var SharedState = class {
3848
2649
  #factory;
3849
2650
  #subscribers = 0;
@@ -3866,15 +2667,38 @@ var SharedState = class {
3866
2667
  return this.#state;
3867
2668
  }
3868
2669
  };
3869
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/body-scroll-lock.svelte.js
2670
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/body-scroll-lock.svelte.js
3870
2671
  var lockMap = new SvelteMap();
3871
- var initialBodyStyle = null;
2672
+ var pointerBlockers = /* @__PURE__ */ new Map();
2673
+ var MANAGED_PROPERTIES = [
2674
+ "padding-right",
2675
+ "margin-right",
2676
+ "overflow",
2677
+ "overflow-x",
2678
+ "overflow-y",
2679
+ "pointer-events",
2680
+ "--scrollbar-width"
2681
+ ];
2682
+ var initialProperties = null;
2683
+ var modifiedProperties = /* @__PURE__ */ new Set();
3872
2684
  var cleanupTimeoutId = null;
3873
2685
  var isInCleanupTransition = false;
2686
+ function setManagedProperty(style, property, value) {
2687
+ style.setProperty(property, value);
2688
+ modifiedProperties.add(property);
2689
+ if (property === "overflow") {
2690
+ modifiedProperties.add("overflow-x");
2691
+ modifiedProperties.add("overflow-y");
2692
+ }
2693
+ }
3874
2694
  var anyLocked = boxWith(() => {
3875
2695
  for (const value of lockMap.values()) if (value) return true;
3876
2696
  return false;
3877
2697
  });
2698
+ var anyPointerBlocking = boxWith(() => {
2699
+ for (const [id, locked] of lockMap) if (locked && (pointerBlockers.get(id)?.() ?? true)) return true;
2700
+ return false;
2701
+ });
3878
2702
  /**
3879
2703
  * We track the time we scheduled the cleanup to prevent race conditions
3880
2704
  * when multiple locks are created/destroyed in the same tick, ensuring
@@ -3884,7 +2708,23 @@ var anyLocked = boxWith(() => {
3884
2708
  */
3885
2709
  var cleanupScheduledAt = null;
3886
2710
  var bodyLockStackCount = new SharedState(() => {
3887
- function resetBodyStyle() {}
2711
+ function restoreProperty(documentObj, prop) {
2712
+ const initial = initialProperties?.get(prop);
2713
+ if (initial?.value) documentObj.body.style.setProperty(prop, initial.value, initial.priority);
2714
+ else documentObj.body.style.removeProperty(prop);
2715
+ }
2716
+ function resetBodyStyle(documentObj) {}
2717
+ /**
2718
+ * Unlike overflow/padding, pointer-events has no handover flicker to avoid, so it's
2719
+ * restored as soon as the last lock goes. A lock that arrives during the cleanup delay
2720
+ * sets it again in `afterTick`.
2721
+ *
2722
+ * reference: https://github.com/huntabyte/bits-ui/issues/2202
2723
+ */
2724
+ function restorePointerEvents(documentObj) {
2725
+ if (!modifiedProperties.delete("pointer-events")) return;
2726
+ restoreProperty(documentObj, "pointer-events");
2727
+ }
3888
2728
  function cancelPendingCleanup() {
3889
2729
  if (cleanupTimeoutId === null) return;
3890
2730
  window.clearTimeout(cleanupTimeoutId);
@@ -3916,91 +2756,373 @@ var bodyLockStackCount = new SharedState(() => {
3916
2756
  const actualDelay = delay === null ? 24 : delay;
3917
2757
  cleanupTimeoutId = window.setTimeout(cleanupFn, actualDelay);
3918
2758
  }
3919
- function ensureInitialStyleCaptured() {
3920
- if (initialBodyStyle === null && lockMap.size === 0 && !isInCleanupTransition) initialBodyStyle = document.body.getAttribute("style");
2759
+ function ensureInitialStyleCaptured() {
2760
+ if (initialProperties === null && lockMap.size === 0 && !isInCleanupTransition) {
2761
+ document.body.hasAttribute("style");
2762
+ initialProperties = /* @__PURE__ */ new Map();
2763
+ for (const prop of MANAGED_PROPERTIES) initialProperties.set(prop, {
2764
+ value: document.body.style.getPropertyValue(prop),
2765
+ priority: document.body.style.getPropertyPriority(prop)
2766
+ });
2767
+ }
2768
+ }
2769
+ watch(() => anyLocked.current, () => {
2770
+ if (!anyLocked.current) return;
2771
+ ensureInitialStyleCaptured();
2772
+ isInCleanupTransition = false;
2773
+ const htmlStyle = getComputedStyle(document.documentElement);
2774
+ const bodyStyle = getComputedStyle(document.body);
2775
+ const hasStableGutter = htmlStyle.scrollbarGutter?.includes("stable") || bodyStyle.scrollbarGutter?.includes("stable");
2776
+ const verticalScrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
2777
+ const config = {
2778
+ padding: Number.parseInt(bodyStyle.paddingRight ?? "0", 10) + verticalScrollbarWidth,
2779
+ margin: Number.parseInt(bodyStyle.marginRight ?? "0", 10)
2780
+ };
2781
+ if (verticalScrollbarWidth > 0 && !hasStableGutter) {
2782
+ setManagedProperty(document.body.style, "padding-right", `${config.padding}px`);
2783
+ setManagedProperty(document.body.style, "margin-right", `${config.margin}px`);
2784
+ setManagedProperty(document.body.style, "--scrollbar-width", `${verticalScrollbarWidth}px`);
2785
+ }
2786
+ setManagedProperty(document.body.style, "overflow", "hidden");
2787
+ if (isIOS) on(document, "touchmove", (e) => {
2788
+ if (e.target !== document.documentElement) return;
2789
+ if (e.touches.length > 1) return;
2790
+ e.preventDefault();
2791
+ }, { passive: false });
2792
+ /**
2793
+ * We ensure pointer-events: none is applied _after_ DOM updates, so that any focus/
2794
+ * interaction changes from opening overlays/menus complete _before_ we block pointer
2795
+ * events.
2796
+ *
2797
+ * this avoids race conditions where pointer-events could be set too early and break
2798
+ * focus/interaction.
2799
+ */
2800
+ afterTick(() => {
2801
+ if (anyPointerBlocking.current) setManagedProperty(document.body.style, "pointer-events", "none");
2802
+ setManagedProperty(document.body.style, "overflow", "hidden");
2803
+ });
2804
+ });
2805
+ watch(() => anyPointerBlocking.current, () => {
2806
+ if (!anyLocked.current) return;
2807
+ afterTick(() => {
2808
+ if (!anyLocked.current) return;
2809
+ if (anyPointerBlocking.current) setManagedProperty(document.body.style, "pointer-events", "none");
2810
+ else restorePointerEvents(document);
2811
+ });
2812
+ }, { lazy: true });
2813
+ return {
2814
+ get lockMap() {
2815
+ return lockMap;
2816
+ },
2817
+ resetBodyStyle,
2818
+ restorePointerEvents,
2819
+ scheduleCleanupIfNoNewLocks,
2820
+ cancelPendingCleanup,
2821
+ ensureInitialStyleCaptured
2822
+ };
2823
+ });
2824
+ var BodyScrollLock = class {
2825
+ #id = useId();
2826
+ #initialState;
2827
+ #restoreScrollDelay = () => null;
2828
+ #countState;
2829
+ locked;
2830
+ constructor(initialState, restoreScrollDelay = () => null, blockPointer = () => true) {
2831
+ this.#initialState = initialState;
2832
+ this.#restoreScrollDelay = restoreScrollDelay;
2833
+ this.#countState = bodyLockStackCount.get();
2834
+ if (!this.#countState) return;
2835
+ /**
2836
+ * Since a new lock is being created, we cancel any pending cleanup to
2837
+ * prevent the cleanup from running too early and resetting the body style
2838
+ * before the new lock has had a chance to apply its styles.
2839
+ *
2840
+ * reference: https://github.com/huntabyte/bits-ui/issues/1639
2841
+ */
2842
+ this.#countState.cancelPendingCleanup();
2843
+ this.#countState.ensureInitialStyleCaptured();
2844
+ pointerBlockers.set(this.#id, blockPointer);
2845
+ this.#countState.lockMap.set(this.#id, this.#initialState ?? false);
2846
+ this.locked = boxWith(() => this.#countState.lockMap.get(this.#id) ?? false, (v) => this.#countState.lockMap.set(this.#id, v));
2847
+ }
2848
+ };
2849
+ function isAnyLocked(map) {
2850
+ for (const [_, value] of map) if (value) return true;
2851
+ return false;
2852
+ }
2853
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/scroll-lock/scroll-lock.svelte
2854
+ function Scroll_lock($$renderer, $$props) {
2855
+ $$renderer.component(($$renderer) => {
2856
+ let { preventScroll = true, restoreScrollDelay = null, blockPointer = () => true } = $$props;
2857
+ untrack(() => {
2858
+ if (preventScroll) new BodyScrollLock(preventScroll, () => restoreScrollDelay, blockPointer);
2859
+ });
2860
+ });
2861
+ }
2862
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/arrays.js
2863
+ /**
2864
+ * Returns the array element after the given index, or undefined for out-of-bounds or empty arrays.
2865
+ * @param array the array.
2866
+ * @param index the index of the current element.
2867
+ * @param loop loop to the beginning of the array if the next index is out of bounds?
2868
+ */
2869
+ /**
2870
+ * Returns the array element after the given index, or undefined for out-of-bounds or empty arrays.
2871
+ * For single-element arrays, returns the element if the index is 0.
2872
+ * @param array the array.
2873
+ * @param index the index of the current element.
2874
+ * @param loop loop to the beginning of the array if the next index is out of bounds?
2875
+ */
2876
+ function next(array, index, loop = true) {
2877
+ if (array.length === 0 || index < 0 || index >= array.length) return;
2878
+ if (array.length === 1 && index === 0) return array[0];
2879
+ if (index === array.length - 1) return loop ? array[0] : void 0;
2880
+ return array[index + 1];
2881
+ }
2882
+ /**
2883
+ * Returns the array element prior to the given index, or undefined for out-of-bounds or empty arrays.
2884
+ * For single-element arrays, returns the element if the index is 0.
2885
+ * @param array the array.
2886
+ * @param index the index of the current element.
2887
+ * @param loop loop to the end of the array if the previous index is out of bounds?
2888
+ */
2889
+ function prev(array, index, loop = true) {
2890
+ if (array.length === 0 || index < 0 || index >= array.length) return;
2891
+ if (array.length === 1 && index === 0) return array[0];
2892
+ if (index === 0) return loop ? array[array.length - 1] : void 0;
2893
+ return array[index - 1];
2894
+ }
2895
+ /**
2896
+ * Returns the element some number after the given index. If the target index is out of bounds:
2897
+ * - If looping is disabled, the first or last element will be returned.
2898
+ * - If looping is enabled, it will wrap around the array.
2899
+ * Returns undefined for empty arrays or out-of-bounds initial indices.
2900
+ * @param array the array.
2901
+ * @param index the index of the current element.
2902
+ * @param increment the number of elements to move forward (can be negative).
2903
+ * @param loop loop around the array if the target index is out of bounds?
2904
+ */
2905
+ function forward(array, index, increment, loop = true) {
2906
+ if (array.length === 0 || index < 0 || index >= array.length) return;
2907
+ let targetIndex = index + increment;
2908
+ if (loop) targetIndex = (targetIndex % array.length + array.length) % array.length;
2909
+ else targetIndex = Math.max(0, Math.min(targetIndex, array.length - 1));
2910
+ return array[targetIndex];
2911
+ }
2912
+ /**
2913
+ * Returns the element some number before the given index. If the target index is out of bounds:
2914
+ * - If looping is disabled, the first or last element will be returned.
2915
+ * - If looping is enabled, it will wrap around the array.
2916
+ * Returns undefined for empty arrays or out-of-bounds initial indices.
2917
+ * @param array the array.
2918
+ * @param index the index of the current element.
2919
+ * @param decrement the number of elements to move backward (can be negative).
2920
+ * @param loop loop around the array if the target index is out of bounds?
2921
+ */
2922
+ function backward(array, index, decrement, loop = true) {
2923
+ if (array.length === 0 || index < 0 || index >= array.length) return;
2924
+ let targetIndex = index - decrement;
2925
+ if (loop) targetIndex = (targetIndex % array.length + array.length) % array.length;
2926
+ else targetIndex = Math.max(0, Math.min(targetIndex, array.length - 1));
2927
+ return array[targetIndex];
2928
+ }
2929
+ /**
2930
+ * Finds the next matching item from a list of values based on a search string.
2931
+ *
2932
+ * This function handles several special cases in typeahead behavior:
2933
+ *
2934
+ * 1. Space handling: When a search string ends with a space, it handles it specially:
2935
+ * - If there's only one match for the text before the space, it ignores the space
2936
+ * - If there are multiple matches and the current match already starts with the search prefix
2937
+ * followed by a space, it keeps the current match (doesn't change selection on space)
2938
+ * - Only after typing characters beyond the space will it move to a more specific match
2939
+ *
2940
+ * 2. Repeated character handling: If a search consists of repeated characters (e.g., "aaa"),
2941
+ * it treats it as a single character for matching purposes
2942
+ *
2943
+ * 3. Cycling behavior: The function wraps around the values array starting from the current match
2944
+ * to find the next appropriate match, creating a cycling selection behavior
2945
+ *
2946
+ * @param values - Array of string values to search through (e.g., the text content of menu items)
2947
+ * @param search - The current search string typed by the user
2948
+ * @param currentMatch - The currently selected/matched item, if any
2949
+ * @returns The next matching value that should be selected, or undefined if no match is found
2950
+ */
2951
+ function getNextMatch(values, search, currentMatch) {
2952
+ const lowerSearch = search.toLowerCase();
2953
+ if (lowerSearch.endsWith(" ")) {
2954
+ const searchWithoutSpace = lowerSearch.slice(0, -1);
2955
+ /**
2956
+ * If there's only one match for the prefix without space, we don't
2957
+ * watch to match with space.
2958
+ */
2959
+ if (values.filter((value) => value.toLowerCase().startsWith(searchWithoutSpace)).length <= 1) return getNextMatch(values, searchWithoutSpace, currentMatch);
2960
+ const currentMatchLowercase = currentMatch?.toLowerCase();
2961
+ /**
2962
+ * If the current match already starts with the search prefix and has a space afterward,
2963
+ * and the user has only typed up to that space, keep the current match until they
2964
+ * disambiguate.
2965
+ */
2966
+ if (currentMatchLowercase && currentMatchLowercase.startsWith(searchWithoutSpace) && currentMatchLowercase.charAt(searchWithoutSpace.length) === " " && search.trim() === searchWithoutSpace) return currentMatch;
2967
+ /**
2968
+ * With multiple matches, find items that match the full search string with space
2969
+ */
2970
+ const spacedMatches = values.filter((value) => value.toLowerCase().startsWith(lowerSearch));
2971
+ /**
2972
+ * If we found matches with the space, use the first one that's not the current match
2973
+ */
2974
+ if (spacedMatches.length > 0) {
2975
+ const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;
2976
+ return wrapArray(spacedMatches, Math.max(currentMatchIndex, 0)).find((match) => match !== currentMatch) || currentMatch;
2977
+ }
2978
+ }
2979
+ const normalizedSearch = search.length > 1 && Array.from(search).every((char) => char === search[0]) ? search[0] : search;
2980
+ const normalizedLowerSearch = normalizedSearch.toLowerCase();
2981
+ const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;
2982
+ let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0));
2983
+ if (normalizedSearch.length === 1) wrappedValues = wrappedValues.filter((v) => v !== currentMatch);
2984
+ const nextMatch = wrappedValues.find((value) => value?.toLowerCase().startsWith(normalizedLowerSearch));
2985
+ return nextMatch !== currentMatch ? nextMatch : void 0;
2986
+ }
2987
+ /**
2988
+ * Wraps an array around itself at a given start index
2989
+ * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`
2990
+ */
2991
+ function wrapArray(array, startIndex) {
2992
+ return array.map((_, index) => array[(startIndex + index) % array.length]);
2993
+ }
2994
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/floating-layer/floating-root.svelte.js
2995
+ var FloatingRootContext = new Context("Floating.Root");
2996
+ var FloatingTooltipRootContext = new Context("Floating.Root");
2997
+ var FloatingRootState = class FloatingRootState {
2998
+ static create(tooltip = false) {
2999
+ return tooltip ? FloatingTooltipRootContext.set(new FloatingRootState()) : FloatingRootContext.set(new FloatingRootState());
3000
+ }
3001
+ anchorNode = simpleBox(null);
3002
+ customAnchorNode = simpleBox(null);
3003
+ triggerNode = simpleBox(null);
3004
+ constructor() {}
3005
+ };
3006
+ var FloatingAnchorState = class FloatingAnchorState {
3007
+ static create(opts, tooltip = false) {
3008
+ return tooltip ? new FloatingAnchorState(opts, FloatingTooltipRootContext.get()) : new FloatingAnchorState(opts, FloatingRootContext.get());
3009
+ }
3010
+ opts;
3011
+ root;
3012
+ constructor(opts, root) {
3013
+ this.opts = opts;
3014
+ this.root = root;
3015
+ if (opts.virtualEl && opts.virtualEl.current) root.triggerNode = boxFrom(opts.virtualEl.current);
3016
+ else root.triggerNode = opts.ref;
3921
3017
  }
3922
- watch(() => anyLocked.current, () => {
3923
- if (!anyLocked.current) return;
3924
- ensureInitialStyleCaptured();
3925
- isInCleanupTransition = false;
3926
- const htmlStyle = getComputedStyle(document.documentElement);
3927
- const bodyStyle = getComputedStyle(document.body);
3928
- const hasStableGutter = htmlStyle.scrollbarGutter?.includes("stable") || bodyStyle.scrollbarGutter?.includes("stable");
3929
- const verticalScrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
3930
- const config = {
3931
- padding: Number.parseInt(bodyStyle.paddingRight ?? "0", 10) + verticalScrollbarWidth,
3932
- margin: Number.parseInt(bodyStyle.marginRight ?? "0", 10)
3933
- };
3934
- if (verticalScrollbarWidth > 0 && !hasStableGutter) {
3935
- document.body.style.paddingRight = `${config.padding}px`;
3936
- document.body.style.marginRight = `${config.margin}px`;
3937
- document.body.style.setProperty("--scrollbar-width", `${verticalScrollbarWidth}px`);
3938
- }
3939
- document.body.style.overflow = "hidden";
3940
- if (isIOS) on(document, "touchmove", (e) => {
3941
- if (e.target !== document.documentElement) return;
3942
- if (e.touches.length > 1) return;
3943
- e.preventDefault();
3944
- }, { passive: false });
3945
- /**
3946
- * We ensure pointer-events: none is applied _after_ DOM updates, so that any focus/
3947
- * interaction changes from opening overlays/menus complete _before_ we block pointer
3948
- * events.
3949
- *
3950
- * this avoids race conditions where pointer-events could be set too early and break
3951
- * focus/interaction.
3952
- */
3953
- afterTick(() => {
3954
- document.body.style.pointerEvents = "none";
3955
- document.body.style.overflow = "hidden";
3956
- });
3018
+ };
3019
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/floating-layer/components/floating-layer.svelte
3020
+ function Floating_layer($$renderer, $$props) {
3021
+ $$renderer.component(($$renderer) => {
3022
+ let { children, tooltip = false } = $$props;
3023
+ FloatingRootState.create(untrack(() => tooltip));
3024
+ children?.($$renderer);
3025
+ $$renderer.push(`<!---->`);
3957
3026
  });
3027
+ }
3028
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/floating-svelte/floating-utils.svelte.js
3029
+ function get(valueOrGetValue) {
3030
+ return typeof valueOrGetValue === "function" ? valueOrGetValue() : valueOrGetValue;
3031
+ }
3032
+ function getDPR(element) {
3033
+ if (typeof window === "undefined") return 1;
3034
+ return (element.ownerDocument.defaultView || window).devicePixelRatio || 1;
3035
+ }
3036
+ function roundByDPR(element, value) {
3037
+ const dpr = getDPR(element);
3038
+ return Math.round(value * dpr) / dpr;
3039
+ }
3040
+ function getFloatingContentCSSVars(name) {
3958
3041
  return {
3959
- get lockMap() {
3960
- return lockMap;
3961
- },
3962
- resetBodyStyle,
3963
- scheduleCleanupIfNoNewLocks,
3964
- cancelPendingCleanup,
3965
- ensureInitialStyleCaptured
3042
+ [`--bits-${name}-content-transform-origin`]: `var(--bits-floating-transform-origin)`,
3043
+ [`--bits-${name}-content-available-width`]: `var(--bits-floating-available-width)`,
3044
+ [`--bits-${name}-content-available-height`]: `var(--bits-floating-available-height)`,
3045
+ [`--bits-${name}-anchor-width`]: `var(--bits-floating-anchor-width)`,
3046
+ [`--bits-${name}-anchor-height`]: `var(--bits-floating-anchor-height)`
3966
3047
  };
3967
- });
3968
- var BodyScrollLock = class {
3969
- #id = useId();
3970
- #initialState;
3971
- #restoreScrollDelay = () => null;
3972
- #countState;
3973
- locked;
3974
- constructor(initialState, restoreScrollDelay = () => null) {
3975
- this.#initialState = initialState;
3976
- this.#restoreScrollDelay = restoreScrollDelay;
3977
- this.#countState = bodyLockStackCount.get();
3978
- if (!this.#countState) return;
3979
- /**
3980
- * Since a new lock is being created, we cancel any pending cleanup to
3981
- * prevent the cleanup from running too early and resetting the body style
3982
- * before the new lock has had a chance to apply its styles.
3983
- *
3984
- * reference: https://github.com/huntabyte/bits-ui/issues/1639
3985
- */
3986
- this.#countState.cancelPendingCleanup();
3987
- this.#countState.ensureInitialStyleCaptured();
3988
- this.#countState.lockMap.set(this.#id, this.#initialState ?? false);
3989
- this.locked = boxWith(() => this.#countState.lockMap.get(this.#id) ?? false, (v) => this.#countState.lockMap.set(this.#id, v));
3990
- }
3048
+ }
3049
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/box-auto-reset.svelte.js
3050
+ var defaultOptions = {
3051
+ afterMs: 1e4,
3052
+ onChange: noop
3991
3053
  };
3992
- function isAnyLocked(map) {
3993
- for (const [_, value] of map) if (value) return true;
3994
- return false;
3054
+ function boxAutoReset(defaultValue, options) {
3055
+ const { afterMs, onChange, getWindow } = {
3056
+ ...defaultOptions,
3057
+ ...options
3058
+ };
3059
+ let timeout = null;
3060
+ let value = defaultValue;
3061
+ function resetAfter() {
3062
+ return getWindow().setTimeout(() => {
3063
+ value = defaultValue;
3064
+ onChange?.(defaultValue);
3065
+ }, afterMs);
3066
+ }
3067
+ return boxWith(() => value, (v) => {
3068
+ value = v;
3069
+ onChange?.(v);
3070
+ if (timeout) getWindow().clearTimeout(timeout);
3071
+ timeout = resetAfter();
3072
+ });
3995
3073
  }
3996
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/scroll-lock/scroll-lock.svelte
3997
- function Scroll_lock($$renderer, $$props) {
3074
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/dom-typeahead.svelte.js
3075
+ var DOMTypeahead = class {
3076
+ #opts;
3077
+ #search;
3078
+ #onMatch = $.derived(() => {
3079
+ if (this.#opts.onMatch) return this.#opts.onMatch;
3080
+ return (node) => node.focus();
3081
+ });
3082
+ #getCurrentItem = $.derived(() => {
3083
+ if (this.#opts.getCurrentItem) return this.#opts.getCurrentItem;
3084
+ return this.#opts.getActiveElement;
3085
+ });
3086
+ constructor(opts) {
3087
+ this.#opts = opts;
3088
+ this.#search = boxAutoReset("", {
3089
+ afterMs: 1e3,
3090
+ getWindow: opts.getWindow
3091
+ });
3092
+ this.handleTypeaheadSearch = this.handleTypeaheadSearch.bind(this);
3093
+ this.resetTypeahead = this.resetTypeahead.bind(this);
3094
+ }
3095
+ handleTypeaheadSearch(key, candidates) {
3096
+ if (!candidates.length) return;
3097
+ this.#search.current = this.#search.current + key;
3098
+ const currentItem = this.#getCurrentItem()();
3099
+ const currentMatch = candidates.find((item) => item === currentItem)?.textContent?.trim() ?? "";
3100
+ const nextMatch = getNextMatch(candidates.map((item) => item.textContent?.trim() ?? ""), this.#search.current, currentMatch);
3101
+ const newItem = candidates.find((item) => item.textContent?.trim() === nextMatch);
3102
+ if (newItem) this.#onMatch()(newItem);
3103
+ return newItem;
3104
+ }
3105
+ resetTypeahead() {
3106
+ this.#search.current = "";
3107
+ }
3108
+ get search() {
3109
+ return this.#search.current;
3110
+ }
3111
+ };
3112
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/floating-layer/components/floating-layer-anchor.svelte
3113
+ function Floating_layer_anchor($$renderer, $$props) {
3998
3114
  $$renderer.component(($$renderer) => {
3999
- let { preventScroll = true, restoreScrollDelay = null } = $$props;
4000
- if (preventScroll) new BodyScrollLock(preventScroll, () => restoreScrollDelay);
3115
+ let { id, children, virtualEl, ref, tooltip = false } = $$props;
3116
+ FloatingAnchorState.create({
3117
+ id: boxWith(() => id),
3118
+ virtualEl: boxWith(() => virtualEl),
3119
+ ref: untrack(() => ref)
3120
+ }, untrack(() => tooltip));
3121
+ children?.($$renderer);
3122
+ $$renderer.push(`<!---->`);
4001
3123
  });
4002
3124
  }
4003
- // ../node_modules/.bun/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
3125
+ // ../node_modules/.bun/@floating-ui+utils@0.2.12/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
4004
3126
  /**
4005
3127
  * Custom positioning reference element.
4006
3128
  * @see https://floating-ui.com/docs/virtual-elements
@@ -4099,12 +3221,12 @@ function getOppositePlacement(placement) {
4099
3221
  return oppositeSideMap[side] + placement.slice(side.length);
4100
3222
  }
4101
3223
  function expandPaddingObject(padding) {
3224
+ var _padding$top, _padding$right, _padding$bottom, _padding$left;
4102
3225
  return {
4103
- top: 0,
4104
- right: 0,
4105
- bottom: 0,
4106
- left: 0,
4107
- ...padding
3226
+ top: (_padding$top = padding.top) != null ? _padding$top : 0,
3227
+ right: (_padding$right = padding.right) != null ? _padding$right : 0,
3228
+ bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,
3229
+ left: (_padding$left = padding.left) != null ? _padding$left : 0
4108
3230
  };
4109
3231
  }
4110
3232
  function getPaddingObject(padding) {
@@ -4128,7 +3250,7 @@ function rectToClientRect(rect) {
4128
3250
  y
4129
3251
  };
4130
3252
  }
4131
- // ../node_modules/.bun/@floating-ui+core@1.7.5/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
3253
+ // ../node_modules/.bun/@floating-ui+core@1.8.0/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
4132
3254
  function computeCoordsFromPlacement(_ref, placement, rtl) {
4133
3255
  let { reference, floating } = _ref;
4134
3256
  const sideAxis = getSideAxis(placement);
@@ -4170,12 +3292,8 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
4170
3292
  y: reference.y
4171
3293
  };
4172
3294
  }
4173
- switch (getAlignment(placement)) {
4174
- case "start":
4175
- coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
4176
- break;
4177
- case "end": coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
4178
- }
3295
+ const alignment = getAlignment(placement);
3296
+ if (alignment) coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1);
4179
3297
  return coords;
4180
3298
  }
4181
3299
  /**
@@ -4206,10 +3324,7 @@ async function detectOverflow(state, options) {
4206
3324
  height: rects.floating.height
4207
3325
  } : rects.reference;
4208
3326
  const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
4209
- const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) ? await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || {
4210
- x: 1,
4211
- y: 1
4212
- } : {
3327
+ const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) && await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || {
4213
3328
  x: 1,
4214
3329
  y: 1
4215
3330
  };
@@ -4329,12 +3444,11 @@ var arrow$1 = (options) => ({
4329
3444
  const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
4330
3445
  const minPadding = min(paddingObject[minProp], largestPossiblePadding);
4331
3446
  const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
4332
- const min$1 = minPadding;
4333
3447
  const max = clientSize - arrowDimensions[length] - maxPadding;
4334
3448
  const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
4335
- const offset = clamp(min$1, center, max);
4336
- const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
4337
- const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
3449
+ const offset = clamp(minPadding, center, max);
3450
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < minPadding ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
3451
+ const alignmentOffset = shouldAddOffset ? center < minPadding ? center - minPadding : center - max : 0;
4338
3452
  return {
4339
3453
  [axis]: coords[axis] + alignmentOffset,
4340
3454
  data: {
@@ -4547,24 +3661,13 @@ var shift$1 = function(options) {
4547
3661
  y
4548
3662
  };
4549
3663
  const overflow = await platform.detectOverflow(state, detectOverflowOptions);
4550
- const crossAxis = getSideAxis(getSide(placement));
3664
+ const crossAxis = getSideAxis(placement);
4551
3665
  const mainAxis = getOppositeAxis(crossAxis);
4552
3666
  let mainAxisCoord = coords[mainAxis];
4553
3667
  let crossAxisCoord = coords[crossAxis];
4554
- if (checkMainAxis) {
4555
- const minSide = mainAxis === "y" ? "top" : "left";
4556
- const maxSide = mainAxis === "y" ? "bottom" : "right";
4557
- const min = mainAxisCoord + overflow[minSide];
4558
- const max = mainAxisCoord - overflow[maxSide];
4559
- mainAxisCoord = clamp(min, mainAxisCoord, max);
4560
- }
4561
- if (checkCrossAxis) {
4562
- const minSide = crossAxis === "y" ? "top" : "left";
4563
- const maxSide = crossAxis === "y" ? "bottom" : "right";
4564
- const min = crossAxisCoord + overflow[minSide];
4565
- const max = crossAxisCoord - overflow[maxSide];
4566
- crossAxisCoord = clamp(min, crossAxisCoord, max);
4567
- }
3668
+ const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]);
3669
+ if (checkMainAxis) mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);
3670
+ if (checkCrossAxis) crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);
4568
3671
  const limitedCoords = limiter.fn({
4569
3672
  ...state,
4570
3673
  [mainAxis]: mainAxisCoord,
@@ -4592,6 +3695,7 @@ var limitShift$1 = function(options) {
4592
3695
  return {
4593
3696
  options,
4594
3697
  fn(state) {
3698
+ var _rawOffset$mainAxis, _rawOffset$crossAxis;
4595
3699
  const { x, y, placement, rects, middlewareData } = state;
4596
3700
  const { offset = 0, mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true } = evaluate(options, state);
4597
3701
  const coords = {
@@ -4607,9 +3711,8 @@ var limitShift$1 = function(options) {
4607
3711
  mainAxis: rawOffset,
4608
3712
  crossAxis: 0
4609
3713
  } : {
4610
- mainAxis: 0,
4611
- crossAxis: 0,
4612
- ...rawOffset
3714
+ mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0,
3715
+ crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0
4613
3716
  };
4614
3717
  if (checkMainAxis) {
4615
3718
  const len = mainAxis === "y" ? "height" : "width";
@@ -4646,7 +3749,6 @@ var size$1 = function(options) {
4646
3749
  name: "size",
4647
3750
  options,
4648
3751
  async fn(state) {
4649
- var _state$middlewareData, _state$middlewareData2;
4650
3752
  const { placement, rects, platform, elements } = state;
4651
3753
  const { apply = () => {}, ...detectOverflowOptions } = evaluate(options, state);
4652
3754
  const overflow = await platform.detectOverflow(state, detectOverflowOptions);
@@ -4667,18 +3769,15 @@ var size$1 = function(options) {
4667
3769
  const maximumClippingWidth = width - overflow.left - overflow.right;
4668
3770
  const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
4669
3771
  const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
4670
- const noShift = !state.middlewareData.shift;
3772
+ const shiftData = state.middlewareData.shift;
3773
+ const noShift = !shiftData;
4671
3774
  let availableHeight = overflowAvailableHeight;
4672
3775
  let availableWidth = overflowAvailableWidth;
4673
- if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) availableWidth = maximumClippingWidth;
4674
- if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) availableHeight = maximumClippingHeight;
3776
+ if (shiftData != null && shiftData.enabled.x) availableWidth = maximumClippingWidth;
3777
+ if (shiftData != null && shiftData.enabled.y) availableHeight = maximumClippingHeight;
4675
3778
  if (noShift && !alignment) {
4676
- const xMin = max(overflow.left, 0);
4677
- const xMax = max(overflow.right, 0);
4678
- const yMin = max(overflow.top, 0);
4679
- const yMax = max(overflow.bottom, 0);
4680
- if (isYAxis) availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
4681
- else availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
3779
+ if (isYAxis) availableWidth = width - 2 * max(overflow.left, overflow.right);
3780
+ else availableHeight = height - 2 * max(overflow.top, overflow.bottom);
4682
3781
  }
4683
3782
  await apply({
4684
3783
  ...state,
@@ -4691,7 +3790,7 @@ var size$1 = function(options) {
4691
3790
  }
4692
3791
  };
4693
3792
  };
4694
- // ../node_modules/.bun/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
3793
+ // ../node_modules/.bun/@floating-ui+utils@0.2.12/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
4695
3794
  function hasWindow() {
4696
3795
  return typeof window !== "undefined";
4697
3796
  }
@@ -4784,7 +3883,7 @@ function getParentNode(node) {
4784
3883
  }
4785
3884
  function getNearestOverflowAncestor(node) {
4786
3885
  const parentNode = getParentNode(node);
4787
- if (isLastTraversableNode(parentNode)) return node.ownerDocument ? node.ownerDocument.body : node.body;
3886
+ if (isLastTraversableNode(parentNode)) return (node.ownerDocument || node).body;
4788
3887
  if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) return parentNode;
4789
3888
  return getNearestOverflowAncestor(parentNode);
4790
3889
  }
@@ -4803,7 +3902,7 @@ function getOverflowAncestors(node, list, traverseIframes) {
4803
3902
  function getFrameElement(win) {
4804
3903
  return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
4805
3904
  }
4806
- // ../node_modules/.bun/@floating-ui+dom@1.7.6/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
3905
+ // ../node_modules/.bun/@floating-ui+dom@1.8.0/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
4807
3906
  function getCssDimensions(element) {
4808
3907
  const css = getComputedStyle$1(element);
4809
3908
  let width = parseFloat(css.width) || 0;
@@ -4850,8 +3949,7 @@ function getVisualOffsets(element) {
4850
3949
  }
4851
3950
  function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
4852
3951
  if (isFixed === void 0) isFixed = false;
4853
- if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) return false;
4854
- return isFixed;
3952
+ return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);
4855
3953
  }
4856
3954
  function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
4857
3955
  if (includeScale === void 0) includeScale = false;
@@ -4869,12 +3967,12 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
4869
3967
  let y = (clientRect.top + visualOffsets.y) / scale.y;
4870
3968
  let width = clientRect.width / scale.x;
4871
3969
  let height = clientRect.height / scale.y;
4872
- if (domElement) {
3970
+ if (domElement && offsetParent) {
4873
3971
  const win = getWindow(domElement);
4874
- const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
3972
+ const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
4875
3973
  let currentWin = win;
4876
3974
  let currentIFrame = getFrameElement(currentWin);
4877
- while (currentIFrame && offsetParent && offsetWin !== currentWin) {
3975
+ while (currentIFrame && offsetWin !== currentWin) {
4878
3976
  const iframeScale = getScale(currentIFrame);
4879
3977
  const iframeRect = currentIFrame.getBoundingClientRect();
4880
3978
  const css = getComputedStyle$1(currentIFrame);
@@ -4922,7 +4020,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
4922
4020
  let scale = createCoords(1);
4923
4021
  const offsets = createCoords(0);
4924
4022
  const isOffsetParentAnElement = isHTMLElement(offsetParent);
4925
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
4023
+ if (isOffsetParentAnElement || !isFixed) {
4926
4024
  if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent);
4927
4025
  if (isOffsetParentAnElement) {
4928
4026
  const offsetRect = getBoundingClientRect(offsetParent);
@@ -4940,15 +4038,14 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
4940
4038
  };
4941
4039
  }
4942
4040
  function getClientRects(element) {
4943
- return Array.from(element.getClientRects());
4041
+ return element.getClientRects ? Array.from(element.getClientRects()) : [];
4944
4042
  }
4945
- function getDocumentRect(element) {
4946
- const html = getDocumentElement(element);
4947
- const scroll = getNodeScroll(element);
4948
- const body = element.ownerDocument.body;
4043
+ function getDocumentRect(html) {
4044
+ const scroll = getNodeScroll(html);
4045
+ const body = html.ownerDocument.body;
4949
4046
  const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
4950
4047
  const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
4951
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
4048
+ let x = -scroll.scrollLeft + getWindowScrollBarX(html);
4952
4049
  const y = -scroll.scrollTop;
4953
4050
  if (getComputedStyle$1(body).direction === "rtl") x += max(html.clientWidth, body.clientWidth) - width;
4954
4051
  return {
@@ -4959,7 +4056,9 @@ function getDocumentRect(element) {
4959
4056
  };
4960
4057
  }
4961
4058
  var SCROLLBAR_MAX = 25;
4962
- function getViewportRect(element, strategy) {
4059
+ function getViewportRect(element, strategy, rootBoundary) {
4060
+ if (rootBoundary === void 0) rootBoundary = "viewport";
4061
+ const isLayoutViewport = rootBoundary === "layoutViewport";
4963
4062
  const win = getWindow(element);
4964
4063
  const html = getDocumentElement(element);
4965
4064
  const visualViewport = win.visualViewport;
@@ -4968,23 +4067,30 @@ function getViewportRect(element, strategy) {
4968
4067
  let x = 0;
4969
4068
  let y = 0;
4970
4069
  if (visualViewport) {
4971
- width = visualViewport.width;
4972
- height = visualViewport.height;
4973
- const visualViewportBased = isWebKit();
4974
- if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
4975
- x = visualViewport.offsetLeft;
4976
- y = visualViewport.offsetTop;
4070
+ const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed";
4071
+ if (isLayoutViewport) {
4072
+ if (!layoutRelativeClientCoords) {
4073
+ x = -visualViewport.offsetLeft;
4074
+ y = -visualViewport.offsetTop;
4075
+ }
4076
+ } else {
4077
+ width = visualViewport.width;
4078
+ height = visualViewport.height;
4079
+ if (layoutRelativeClientCoords) {
4080
+ x = visualViewport.offsetLeft;
4081
+ y = visualViewport.offsetTop;
4082
+ }
4977
4083
  }
4978
4084
  }
4979
- const windowScrollbarX = getWindowScrollBarX(html);
4980
- if (windowScrollbarX <= 0) {
4085
+ if (getWindowScrollBarX(html) <= 0) {
4981
4086
  const doc = html.ownerDocument;
4982
4087
  const body = doc.body;
4983
4088
  const bodyStyles = getComputedStyle(body);
4984
4089
  const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
4985
- const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
4986
- if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) width -= clippingStableScrollbarWidth;
4987
- } else if (windowScrollbarX <= SCROLLBAR_MAX) width += windowScrollbarX;
4090
+ const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
4091
+ const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth;
4092
+ if (gutter <= SCROLLBAR_MAX) width -= gutter;
4093
+ }
4988
4094
  return {
4989
4095
  width,
4990
4096
  height,
@@ -4996,7 +4102,7 @@ function getInnerBoundingClientRect(element, strategy) {
4996
4102
  const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
4997
4103
  const top = clientRect.top + element.clientTop;
4998
4104
  const left = clientRect.left + element.clientLeft;
4999
- const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
4105
+ const scale = getScale(element);
5000
4106
  return {
5001
4107
  width: element.clientWidth * scale.x,
5002
4108
  height: element.clientHeight * scale.y,
@@ -5006,7 +4112,7 @@ function getInnerBoundingClientRect(element, strategy) {
5006
4112
  }
5007
4113
  function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
5008
4114
  let rect;
5009
- if (clippingAncestor === "viewport") rect = getViewportRect(element, strategy);
4115
+ if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") rect = getViewportRect(element, strategy, clippingAncestor);
5010
4116
  else if (clippingAncestor === "document") rect = getDocumentRect(getDocumentElement(element));
5011
4117
  else if (isElement(clippingAncestor)) rect = getInnerBoundingClientRect(clippingAncestor, strategy);
5012
4118
  else {
@@ -5020,24 +4126,19 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
5020
4126
  }
5021
4127
  return rectToClientRect(rect);
5022
4128
  }
5023
- function hasFixedPositionAncestor(element, stopNode) {
5024
- const parentNode = getParentNode(element);
5025
- if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) return false;
5026
- return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
5027
- }
5028
4129
  function getClippingElementAncestors(element, cache) {
5029
4130
  const cachedResult = cache.get(element);
5030
4131
  if (cachedResult) return cachedResult;
5031
4132
  let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
5032
- let currentContainingBlockComputedStyle = null;
4133
+ let lastKeptComputedStyle = null;
5033
4134
  const elementIsFixed = getComputedStyle$1(element).position === "fixed";
5034
4135
  let currentNode = elementIsFixed ? getParentNode(element) : element;
5035
4136
  while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
5036
4137
  const computedStyle = getComputedStyle$1(currentNode);
5037
4138
  const currentNodeIsContaining = isContainingBlock(currentNode);
5038
- if (!currentNodeIsContaining && computedStyle.position === "fixed") currentContainingBlockComputedStyle = null;
5039
- if (elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode)) result = result.filter((ancestor) => ancestor !== currentNode);
5040
- else currentContainingBlockComputedStyle = computedStyle;
4139
+ const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : "";
4140
+ if (!currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static")) result = result.filter((ancestor) => ancestor !== currentNode);
4141
+ else lastKeptComputedStyle = computedStyle;
5041
4142
  currentNode = getParentNode(currentNode);
5042
4143
  }
5043
4144
  cache.set(element, result);
@@ -5082,18 +4183,15 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
5082
4183
  scrollTop: 0
5083
4184
  };
5084
4185
  const offsets = createCoords(0);
5085
- function setLeftRTLScrollbarOffset() {
5086
- offsets.x = getWindowScrollBarX(documentElement);
5087
- }
5088
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
4186
+ if (isOffsetParentAnElement || !isFixed) {
5089
4187
  if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent);
5090
4188
  if (isOffsetParentAnElement) {
5091
4189
  const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
5092
4190
  offsets.x = offsetRect.x + offsetParent.clientLeft;
5093
4191
  offsets.y = offsetRect.y + offsetParent.clientTop;
5094
- } else if (documentElement) setLeftRTLScrollbarOffset();
4192
+ }
5095
4193
  }
5096
- if (isFixed && !isOffsetParentAnElement && documentElement) setLeftRTLScrollbarOffset();
4194
+ if (!isOffsetParentAnElement && documentElement) offsets.x = getWindowScrollBarX(documentElement);
5097
4195
  const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
5098
4196
  return {
5099
4197
  x: rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x,
@@ -5130,8 +4228,7 @@ function getOffsetParent(element, polyfill) {
5130
4228
  }
5131
4229
  var getElementRects = async function(data) {
5132
4230
  const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
5133
- const getDimensionsFn = this.getDimensions;
5134
- const floatingDimensions = await getDimensionsFn(data.floating);
4231
+ const floatingDimensions = await (0, this.getDimensions)(data.floating);
5135
4232
  return {
5136
4233
  reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
5137
4234
  floating: {
@@ -5160,7 +4257,7 @@ var platform = {
5160
4257
  function rectsAreEqual(a, b) {
5161
4258
  return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
5162
4259
  }
5163
- function observeMove(element, onMove) {
4260
+ function observeMove(element, onMove, ancestorResize) {
5164
4261
  let io = null;
5165
4262
  let timeoutId;
5166
4263
  const root = getDocumentElement(element);
@@ -5189,6 +4286,7 @@ function observeMove(element, onMove) {
5189
4286
  let isFirstUpdate = true;
5190
4287
  function handleObserve(entries) {
5191
4288
  const ratio = entries[0].intersectionRatio;
4289
+ if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) return refresh();
5192
4290
  if (ratio !== threshold) {
5193
4291
  if (!isFirstUpdate) return refresh();
5194
4292
  if (!ratio) timeoutId = setTimeout(() => {
@@ -5196,7 +4294,6 @@ function observeMove(element, onMove) {
5196
4294
  }, 1e3);
5197
4295
  else refresh(false, ratio);
5198
4296
  }
5199
- if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) refresh();
5200
4297
  isFirstUpdate = false;
5201
4298
  }
5202
4299
  try {
@@ -5209,8 +4306,14 @@ function observeMove(element, onMove) {
5209
4306
  }
5210
4307
  io.observe(element);
5211
4308
  }
4309
+ const win = getWindow(element);
4310
+ const handleResize = () => refresh(ancestorResize);
4311
+ win.addEventListener("resize", handleResize);
5212
4312
  refresh(true);
5213
- return cleanup;
4313
+ return () => {
4314
+ win.removeEventListener("resize", handleResize);
4315
+ cleanup();
4316
+ };
5214
4317
  }
5215
4318
  /**
5216
4319
  * Automatically updates the position of the floating element when necessary.
@@ -5226,10 +4329,10 @@ function autoUpdate(reference, floating, update, options) {
5226
4329
  const referenceEl = unwrapElement(reference);
5227
4330
  const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
5228
4331
  ancestors.forEach((ancestor) => {
5229
- ancestorScroll && ancestor.addEventListener("scroll", update, { passive: true });
4332
+ ancestorScroll && ancestor.addEventListener("scroll", update);
5230
4333
  ancestorResize && ancestor.addEventListener("resize", update);
5231
4334
  });
5232
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
4335
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update, ancestorResize) : null;
5233
4336
  let reobserveFrame = -1;
5234
4337
  let resizeObserver = null;
5235
4338
  if (elementResize) {
@@ -5320,11 +4423,9 @@ var limitShift = limitShift$1;
5320
4423
  */
5321
4424
  var computePosition = (reference, floating, options) => {
5322
4425
  const cache = /* @__PURE__ */ new Map();
5323
- const mergedOptions = {
5324
- platform,
5325
- ...options
5326
- };
4426
+ const mergedOptions = options != null ? options : {};
5327
4427
  const platformWithCache = {
4428
+ ...platform,
5328
4429
  ...mergedOptions.platform,
5329
4430
  _c: cache
5330
4431
  };
@@ -5333,38 +4434,18 @@ var computePosition = (reference, floating, options) => {
5333
4434
  platform: platformWithCache
5334
4435
  });
5335
4436
  };
5336
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/floating-svelte/floating-utils.svelte.js
5337
- function get(valueOrGetValue) {
5338
- return typeof valueOrGetValue === "function" ? valueOrGetValue() : valueOrGetValue;
5339
- }
5340
- function getDPR(element) {
5341
- if (typeof window === "undefined") return 1;
5342
- return (element.ownerDocument.defaultView || window).devicePixelRatio || 1;
5343
- }
5344
- function roundByDPR(element, value) {
5345
- const dpr = getDPR(element);
5346
- return Math.round(value * dpr) / dpr;
5347
- }
5348
- function getFloatingContentCSSVars(name) {
5349
- return {
5350
- [`--bits-${name}-content-transform-origin`]: `var(--bits-floating-transform-origin)`,
5351
- [`--bits-${name}-content-available-width`]: `var(--bits-floating-available-width)`,
5352
- [`--bits-${name}-content-available-height`]: `var(--bits-floating-available-height)`,
5353
- [`--bits-${name}-anchor-width`]: `var(--bits-floating-anchor-width)`,
5354
- [`--bits-${name}-anchor-height`]: `var(--bits-floating-anchor-height)`
5355
- };
5356
- }
5357
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/internal/floating-svelte/use-floating.svelte.js
4437
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/internal/floating-svelte/use-floating.svelte.js
5358
4438
  function useFloating(options) {
5359
4439
  options.whileElementsMounted;
5360
- const openOption = $.derived(() => get(options.open) ?? true);
5361
- const middlewareOption = $.derived(() => get(options.middleware));
4440
+ $.derived(() => get(options.open) ?? true);
4441
+ $.derived(() => get(options.middleware));
5362
4442
  const transformOption = $.derived(() => get(options.transform) ?? true);
5363
4443
  const placementOption = $.derived(() => get(options.placement) ?? "bottom");
5364
4444
  const strategyOption = $.derived(() => get(options.strategy) ?? "absolute");
5365
- const sideOffsetOption = $.derived(() => get(options.sideOffset) ?? 0);
5366
- const alignOffsetOption = $.derived(() => get(options.alignOffset) ?? 0);
4445
+ $.derived(() => get(options.sideOffset) ?? 0);
4446
+ $.derived(() => get(options.alignOffset) ?? 0);
5367
4447
  const reference = options.reference;
4448
+ let latestOptions;
5368
4449
  /** State */
5369
4450
  let x = 0;
5370
4451
  let y = 0;
@@ -5396,9 +4477,9 @@ function useFloating(options) {
5396
4477
  const floatingNode = floating.current;
5397
4478
  const requestId = ++updateRequestId;
5398
4479
  computePosition(referenceNode, floatingNode, {
5399
- middleware: middlewareOption(),
5400
- placement: placementOption(),
5401
- strategy: strategyOption()
4480
+ middleware: latestOptions.middleware,
4481
+ placement: latestOptions.placement,
4482
+ strategy: latestOptions.strategy
5402
4483
  }).then((position) => {
5403
4484
  if (requestId !== updateRequestId) return;
5404
4485
  if (reference.current !== referenceNode || floating.current !== floatingNode) return;
@@ -5412,8 +4493,8 @@ function useFloating(options) {
5412
4493
  };
5413
4494
  return;
5414
4495
  }
5415
- if (!openOption() && x !== 0 && y !== 0) {
5416
- const maxExpectedOffset = Math.max(Math.abs(sideOffsetOption()), Math.abs(alignOffsetOption()), 15);
4496
+ if (!latestOptions.open && x !== 0 && y !== 0) {
4497
+ const maxExpectedOffset = Math.max(Math.abs(latestOptions.sideOffset), Math.abs(latestOptions.alignOffset), 15);
5417
4498
  if (position.x <= maxExpectedOffset && position.y <= maxExpectedOffset) return;
5418
4499
  }
5419
4500
  x = position.x;
@@ -5453,25 +4534,14 @@ function isReferenceHidden(node) {
5453
4534
  if (node instanceof HTMLElement && node.hidden) return true;
5454
4535
  return node.getClientRects().length === 0;
5455
4536
  }
5456
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/floating-layer/use-floating-layer.svelte.js
4537
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/floating-layer/use-floating-layer.svelte.js
5457
4538
  var OPPOSITE_SIDE = {
5458
4539
  top: "bottom",
5459
4540
  right: "left",
5460
4541
  bottom: "top",
5461
4542
  left: "right"
5462
4543
  };
5463
- var FloatingRootContext = new Context("Floating.Root");
5464
4544
  var FloatingContentContext = new Context("Floating.Content");
5465
- var FloatingTooltipRootContext = new Context("Floating.Root");
5466
- var FloatingRootState = class FloatingRootState {
5467
- static create(tooltip = false) {
5468
- return tooltip ? FloatingTooltipRootContext.set(new FloatingRootState()) : FloatingRootContext.set(new FloatingRootState());
5469
- }
5470
- anchorNode = simpleBox(null);
5471
- customAnchorNode = simpleBox(null);
5472
- triggerNode = simpleBox(null);
5473
- constructor() {}
5474
- };
5475
4545
  var FloatingContentState = class FloatingContentState {
5476
4546
  static create(opts, tooltip = false) {
5477
4547
  return tooltip ? FloatingContentContext.set(new FloatingContentState(opts, FloatingTooltipRootContext.get())) : FloatingContentContext.set(new FloatingContentState(opts, FloatingRootContext.get()));
@@ -5494,7 +4564,7 @@ var FloatingContentState = class FloatingContentState {
5494
4564
  #arrowWidth = $.derived(() => this.#arrowSize?.width ?? 0);
5495
4565
  #arrowHeight = $.derived(() => this.#arrowSize?.height ?? 0);
5496
4566
  #desiredPlacement = $.derived(() => this.opts.side?.current + (this.opts.align.current !== "center" ? `-${this.opts.align.current}` : ""));
5497
- #boundary = $.derived(() => Array.isArray(this.opts.collisionBoundary.current) ? this.opts.collisionBoundary.current : [this.opts.collisionBoundary.current]);
4567
+ #boundary = $.derived(() => (Array.isArray(this.opts.collisionBoundary.current) ? this.opts.collisionBoundary.current : [this.opts.collisionBoundary.current]).filter(isNotNull));
5498
4568
  #hasExplicitBoundaries = $.derived(() => this.#boundary().length > 0);
5499
4569
  get hasExplicitBoundaries() {
5500
4570
  return this.#hasExplicitBoundaries();
@@ -5504,7 +4574,7 @@ var FloatingContentState = class FloatingContentState {
5504
4574
  }
5505
4575
  #detectOverflowOptions = $.derived(() => ({
5506
4576
  padding: this.opts.collisionPadding.current,
5507
- boundary: this.#boundary().filter(isNotNull),
4577
+ boundary: this.#boundary(),
5508
4578
  altBoundary: this.hasExplicitBoundaries
5509
4579
  }));
5510
4580
  get detectOverflowOptions() {
@@ -5550,7 +4620,14 @@ var FloatingContentState = class FloatingContentState {
5550
4620
  this.opts.hideWhenDetached.current && hide({
5551
4621
  strategy: "referenceHidden",
5552
4622
  ...this.detectOverflowOptions
5553
- })
4623
+ }),
4624
+ this.opts.hideWhenDetached.current && !this.hasExplicitBoundaries && {
4625
+ ...hide({
4626
+ strategy: "referenceHidden",
4627
+ boundary: "clippingAncestors"
4628
+ }),
4629
+ name: "hideClipping"
4630
+ }
5554
4631
  ].filter(Boolean));
5555
4632
  get middleware() {
5556
4633
  return this.#middleware();
@@ -5594,7 +4671,7 @@ var FloatingContentState = class FloatingContentState {
5594
4671
  set cannotCenterArrow($$value) {
5595
4672
  return this.#cannotCenterArrow($$value);
5596
4673
  }
5597
- contentZIndex;
4674
+ contentZIndex = "auto";
5598
4675
  #arrowBaseSide = $.derived(() => OPPOSITE_SIDE[this.placedSide]);
5599
4676
  get arrowBaseSide() {
5600
4677
  return this.#arrowBaseSide();
@@ -5615,7 +4692,7 @@ var FloatingContentState = class FloatingContentState {
5615
4692
  "--bits-floating-available-height": `${this.#availableHeight}px`,
5616
4693
  "--bits-floating-anchor-width": `${this.#anchorWidth}px`,
5617
4694
  "--bits-floating-anchor-height": `${this.#anchorHeight}px`,
5618
- ...this.floating.middlewareData.hide?.referenceHidden && {
4695
+ ...(this.floating.middlewareData.hide?.referenceHidden || this.floating.middlewareData.hideClipping?.referenceHidden) && {
5619
4696
  visibility: "hidden",
5620
4697
  "pointer-events": "none"
5621
4698
  },
@@ -5687,8 +4764,8 @@ var FloatingContentState = class FloatingContentState {
5687
4764
  sideOffset: () => this.opts.sideOffset.current,
5688
4765
  alignOffset: () => this.opts.alignOffset.current
5689
4766
  });
5690
- watch(() => this.contentRef.current, (contentNode) => {
5691
- if (!contentNode || !this.opts.enabled.current) return;
4767
+ watch([() => this.contentRef.current, () => this.opts.enabled.current], ([contentNode, enabled]) => {
4768
+ if (!contentNode || !enabled) return;
5692
4769
  const win = getWindow$1(contentNode);
5693
4770
  const rafId = win.requestAnimationFrame(() => {
5694
4771
  if (this.contentRef.current !== contentNode || !this.opts.enabled.current) return;
@@ -5701,19 +4778,6 @@ var FloatingContentState = class FloatingContentState {
5701
4778
  });
5702
4779
  }
5703
4780
  };
5704
- var FloatingAnchorState = class FloatingAnchorState {
5705
- static create(opts, tooltip = false) {
5706
- return tooltip ? new FloatingAnchorState(opts, FloatingTooltipRootContext.get()) : new FloatingAnchorState(opts, FloatingRootContext.get());
5707
- }
5708
- opts;
5709
- root;
5710
- constructor(opts, root) {
5711
- this.opts = opts;
5712
- this.root = root;
5713
- if (opts.virtualEl && opts.virtualEl.current) root.triggerNode = boxFrom(opts.virtualEl.current);
5714
- else root.triggerNode = opts.ref;
5715
- }
5716
- };
5717
4781
  function transformOrigin(options) {
5718
4782
  return {
5719
4783
  name: "transformOrigin",
@@ -5763,32 +4827,11 @@ function getSideFromPlacement(placement) {
5763
4827
  function getAlignFromPlacement(placement) {
5764
4828
  return getSideAndAlignFromPlacement(placement)[1];
5765
4829
  }
5766
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/floating-layer/components/floating-layer.svelte
5767
- function Floating_layer($$renderer, $$props) {
5768
- $$renderer.component(($$renderer) => {
5769
- let { children, tooltip = false } = $$props;
5770
- FloatingRootState.create(tooltip);
5771
- children?.($$renderer);
5772
- $$renderer.push(`<!---->`);
5773
- });
5774
- }
5775
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/floating-layer/components/floating-layer-anchor.svelte
5776
- function Floating_layer_anchor($$renderer, $$props) {
5777
- $$renderer.component(($$renderer) => {
5778
- let { id, children, virtualEl, ref, tooltip = false } = $$props;
5779
- FloatingAnchorState.create({
5780
- id: boxWith(() => id),
5781
- virtualEl: boxWith(() => virtualEl),
5782
- ref
5783
- }, tooltip);
5784
- children?.($$renderer);
5785
- $$renderer.push(`<!---->`);
5786
- });
5787
- }
5788
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/floating-layer/components/floating-layer-content.svelte
4830
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/floating-layer/components/floating-layer-content.svelte
5789
4831
  function Floating_layer_content($$renderer, $$props) {
5790
4832
  $$renderer.component(($$renderer) => {
5791
- let { content, side = "bottom", sideOffset = 0, align = "center", alignOffset = 0, id, arrowPadding = 0, avoidCollisions = true, collisionBoundary = [], collisionPadding = 0, hideWhenDetached = false, onPlaced = () => {}, sticky = "partial", updatePositionStrategy = "optimized", strategy = "fixed", dir = "ltr", style = {}, wrapperId = useId(), customAnchor = null, enabled, tooltip = false } = $$props;
4833
+ const uid = $.props_id($$renderer);
4834
+ let { content, side = "bottom", sideOffset = 0, align = "center", alignOffset = 0, id, arrowPadding = 0, avoidCollisions = true, collisionBoundary = [], collisionPadding = 0, hideWhenDetached = false, onPlaced = () => {}, sticky = "partial", updatePositionStrategy = "optimized", strategy = "fixed", dir, style = {}, wrapperId = createId(uid), customAnchor = null, enabled, tooltip = false } = $$props;
5792
4835
  const contentState = FloatingContentState.create({
5793
4836
  side: boxWith(() => side),
5794
4837
  sideOffset: boxWith(() => sideOffset),
@@ -5804,12 +4847,12 @@ function Floating_layer_content($$renderer, $$props) {
5804
4847
  sticky: boxWith(() => sticky),
5805
4848
  updatePositionStrategy: boxWith(() => updatePositionStrategy),
5806
4849
  strategy: boxWith(() => strategy),
5807
- dir: boxWith(() => dir),
4850
+ dir: resolveDirProp(() => dir),
5808
4851
  style: boxWith(() => style),
5809
4852
  enabled: boxWith(() => enabled),
5810
4853
  wrapperId: boxWith(() => wrapperId),
5811
4854
  customAnchor: boxWith(() => customAnchor)
5812
- }, tooltip);
4855
+ }, untrack(() => tooltip));
5813
4856
  const mergedProps = $.derived(() => mergeProps(contentState.wrapperProps, { style: { pointerEvents: "auto" } }));
5814
4857
  content?.($$renderer, {
5815
4858
  props: contentState.props,
@@ -5818,7 +4861,7 @@ function Floating_layer_content($$renderer, $$props) {
5818
4861
  $$renderer.push(`<!---->`);
5819
4862
  });
5820
4863
  }
5821
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/floating-layer/components/floating-layer-content-static.svelte
4864
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/floating-layer/components/floating-layer-content-static.svelte
5822
4865
  function Floating_layer_content_static($$renderer, $$props) {
5823
4866
  $$renderer.component(($$renderer) => {
5824
4867
  let { content, onPlaced } = $$props;
@@ -5832,7 +4875,7 @@ function Floating_layer_content_static($$renderer, $$props) {
5832
4875
  $$renderer.push(`<!---->`);
5833
4876
  });
5834
4877
  }
5835
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/popper-layer/popper-content.svelte
4878
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/popper-layer/popper-content.svelte
5836
4879
  function Popper_content($$renderer, $$props) {
5837
4880
  let { content, isStatic = false, onPlaced, $$slots, $$events, ...restProps } = $$props;
5838
4881
  if (isStatic) {
@@ -5850,18 +4893,18 @@ function Popper_content($$renderer, $$props) {
5850
4893
  }
5851
4894
  $$renderer.push(`<!--]-->`);
5852
4895
  }
5853
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/popper-layer/popper-layer-inner.svelte
4896
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/popper-layer/popper-layer-inner.svelte
5854
4897
  function Popper_layer_inner($$renderer, $$props) {
5855
4898
  $$renderer.component(($$renderer) => {
5856
- let { popper, onEscapeKeydown, escapeKeydownBehavior, preventOverflowTextSelection, id, onPointerDown, onPointerUp, side, sideOffset, align, alignOffset, arrowPadding, avoidCollisions, collisionBoundary, collisionPadding, sticky, hideWhenDetached, updatePositionStrategy, strategy, dir, preventScroll, wrapperId, style, onPlaced, onInteractOutside, onCloseAutoFocus, onOpenAutoFocus, onFocusOutside, interactOutsideBehavior = "close", loop, trapFocus = true, isValidEvent = () => false, customAnchor = null, isStatic = false, enabled, ref, tooltip = false, contentPointerEvents = "auto", $$slots, $$events, ...restProps } = $$props;
4899
+ let { popper, onEscapeKeydown, escapeKeydownBehavior, preventOverflowTextSelection, id, onPointerDown, onPointerUp, side, sideOffset, align, alignOffset, arrowPadding, avoidCollisions, collisionBoundary, collisionPadding, sticky, hideWhenDetached, updatePositionStrategy, strategy, dir, preventScroll, wrapperId, style, onPlaced, onInteractOutside, onCloseAutoFocus, onOpenAutoFocus, onFocusOutside, interactOutsideBehavior = "close", loop, trapFocus = true, isValidEvent = () => false, customAnchor = null, isStatic = false, enabled, forceMount, ref, tooltip = false, contentPointerEvents = "auto", $$slots, $$events, ...restProps } = $$props;
5857
4900
  const resolvedPreventScroll = $.derived(() => preventScroll ?? true);
5858
4901
  const effectiveStrategy = $.derived(() => strategy ?? (resolvedPreventScroll() ? "fixed" : "absolute"));
5859
4902
  {
5860
4903
  function content($$renderer, { props: floatingProps, wrapperProps }) {
5861
- if (restProps.forceMount && enabled) {
4904
+ if (forceMount && enabled) {
5862
4905
  $$renderer.push("<!--[0-->");
5863
4906
  Scroll_lock($$renderer, { preventScroll: resolvedPreventScroll() });
5864
- } else if (!restProps.forceMount) {
4907
+ } else if (!forceMount) {
5865
4908
  $$renderer.push("<!--[1-->");
5866
4909
  Scroll_lock($$renderer, { preventScroll: resolvedPreventScroll() });
5867
4910
  } else $$renderer.push("<!--[-1-->");
@@ -5885,7 +4928,10 @@ function Popper_layer_inner($$renderer, $$props) {
5885
4928
  ref,
5886
4929
  children: ($$renderer) => {
5887
4930
  popper?.($$renderer, {
5888
- props: mergeProps(restProps, floatingProps, dismissibleProps, focusScopeProps, { style: { pointerEvents: contentPointerEvents } }),
4931
+ props: mergeProps(restProps, floatingProps, dismissibleProps, focusScopeProps, {
4932
+ id,
4933
+ style: { pointerEvents: contentPointerEvents }
4934
+ }),
5889
4935
  wrapperProps
5890
4936
  });
5891
4937
  $$renderer.push(`<!---->`);
@@ -5915,7 +4961,7 @@ function Popper_layer_inner($$renderer, $$props) {
5915
4961
  loop,
5916
4962
  enabled,
5917
4963
  trapFocus,
5918
- forceMount: restProps.forceMount,
4964
+ forceMount,
5919
4965
  ref,
5920
4966
  focusScope,
5921
4967
  $$slots: { focusScope: true }
@@ -5951,7 +4997,7 @@ function Popper_layer_inner($$renderer, $$props) {
5951
4997
  }
5952
4998
  });
5953
4999
  }
5954
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/popper-layer/popper-layer.svelte
5000
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/popper-layer/popper-layer.svelte
5955
5001
  function Popper_layer($$renderer, $$props) {
5956
5002
  let { popper, open, onEscapeKeydown, escapeKeydownBehavior, preventOverflowTextSelection, id, onPointerDown, onPointerUp, side, sideOffset, align, alignOffset, arrowPadding, avoidCollisions, collisionBoundary, collisionPadding, sticky, hideWhenDetached, updatePositionStrategy, strategy, dir, preventScroll, wrapperId, style, onPlaced, onInteractOutside, onCloseAutoFocus, onOpenAutoFocus, onFocusOutside, interactOutsideBehavior = "close", loop, trapFocus = true, isValidEvent = () => false, customAnchor = null, isStatic = false, ref, shouldRender, $$slots, $$events, ...restProps } = $$props;
5957
5003
  if (shouldRender) {
@@ -5998,7 +5044,7 @@ function Popper_layer($$renderer, $$props) {
5998
5044
  } else $$renderer.push("<!--[-1-->");
5999
5045
  $$renderer.push(`<!--]-->`);
6000
5046
  }
6001
- // ../node_modules/.bun/bits-ui@2.19.0+c45836e0534e7f3d/node_modules/bits-ui/dist/bits/utilities/popper-layer/popper-layer-force-mount.svelte
5047
+ // ../node_modules/.bun/bits-ui@2.22.0+d1c897ff0ec09ac1/node_modules/bits-ui/dist/bits/utilities/popper-layer/popper-layer-force-mount.svelte
6002
5048
  function Popper_layer_force_mount($$renderer, $$props) {
6003
5049
  let { popper, onEscapeKeydown, escapeKeydownBehavior, preventOverflowTextSelection, id, onPointerDown, onPointerUp, side, sideOffset, align, alignOffset, arrowPadding, avoidCollisions, collisionBoundary, collisionPadding, sticky, hideWhenDetached, updatePositionStrategy, strategy, dir, preventScroll, wrapperId, style, onPlaced, onInteractOutside, onCloseAutoFocus, onOpenAutoFocus, onFocusOutside, interactOutsideBehavior = "close", loop, trapFocus = true, isValidEvent = () => false, customAnchor = null, isStatic = false, enabled, $$slots, $$events, ...restProps } = $$props;
6004
5050
  Popper_layer_inner($$renderer, $.spread_props([
@@ -6043,4 +5089,4 @@ function Popper_layer_force_mount($$renderer, $$props) {
6043
5089
  { forceMount: true }
6044
5090
  ]));
6045
5091
  }
6046
- export { styleToString as $, CAPS_LOCK as A, boolToStr as B, PresenceManager as C, ARROW_LEFT as D, ARROW_DOWN as E, META as F, attachRef as G, createBitsAttrs as H, PAGE_DOWN as I, onDestroyEffect as J, DOMContext as K, PAGE_UP as L, ENTER as M, ESCAPE as N, ARROW_RIGHT as O, HOME as P, mergeProps as Q, SHIFT as R, noop as S, isIOS as T, getDataOpenClosed as U, boolToTrueOrUndef as V, getDataTransitionAttrs as W, watch as X, Previous as Y, Context as Z, forward as _, getFloatingContentCSSVars as a, prev as b, MenuGroupState as c, MenuRootState as d, boxWith as et, MenuSeparatorState as f, backward as g, boxAutoReset as h, Floating_layer as i, CONTROL as j, ARROW_UP as k, MenuItemState as l, DOMTypeahead as m, Popper_layer as n, DropdownMenuTriggerState as o, MenuSubmenuState as p, afterTick as q, Floating_layer_anchor as r, MenuContentState as s, Popper_layer_force_mount as t, MenuMenuState as u, getNextMatch as v, isBrowser as w, createId as x, next as y, boolToEmptyStrOrUndef as z };
5092
+ export { getDocument as $, isIOS as A, HOME as B, noop as C, isElement$1 as D, isDisabledElement as E, ARROW_UP as F, boolToEmptyStrOrUndef as G, PAGE_DOWN as H, CAPS_LOCK as I, createBitsAttrs as J, boolToStr as K, CONTROL as L, ARROW_DOWN as M, ARROW_LEFT as N, isElementOrSVGElement as O, ARROW_RIGHT as P, DOMContext as Q, ENTER as R, createId as S, isBrowser as T, PAGE_UP as U, META as V, SHIFT as W, getDataTransitionAttrs as X, getDataOpenClosed as Y, attachRef as Z, CustomEventDispatcher as _, boxAutoReset as a, mergeProps as at, resolveDirProp as b, backward as c, BoxSymbol as ct, next as d, boxWith as dt, afterTick as et, prev as f, isBox as ft, tabbable as g, isTabbable as h, toReadonlyBox as ht, DOMTypeahead as i, Context as it, isSelectableInput as j, isHTMLElement$1 as k, forward as l, boxFlatten as lt, isFocusable as m, isWritableSymbol as mt, Popper_layer as n, Previous as nt, getFloatingContentCSSVars as o, styleToString as ot, focusable as p, isWritableBox as pt, boolToTrueOrUndef as q, Floating_layer_anchor as r, watch as rt, Floating_layer as s, executeCallbacks as st, Popper_layer_force_mount as t, onDestroyEffect as tt, getNextMatch as u, boxFrom as ut, getEventTargetClosest as v, PresenceManager as w, resolvePortalToProp as x, isEventTargetWithin as y, ESCAPE as z };