ryco-cli 0.1.10 → 0.1.12

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 (233) hide show
  1. package/dist/bin.cjs +1 -1
  2. package/dist/bin.mjs +1 -1
  3. package/dist/client/assets/AccountSettings-C3v2klAG.js +1 -0
  4. package/dist/client/assets/AiFocusSettings-BquKjnWf.js +1 -0
  5. package/dist/client/assets/AnimatedHeight-BIsV_Z3J.js +1 -0
  6. package/dist/client/assets/AppearanceSettings-CYbSApl4.js +1 -0
  7. package/dist/client/assets/{BranchToolbar.logic-C1Dh4xQW.js → BranchToolbar.logic-CmvD76Cw.js} +1 -1
  8. package/dist/client/assets/ChatRightPanel-DVxRdZWT.js +27 -0
  9. package/dist/client/assets/ChatThreadRouteView-DlgAAOCp.js +1 -0
  10. package/dist/client/assets/CommandPaletteDialog-BnJURcy7.js +1 -0
  11. package/dist/client/assets/{CompositeItem-D-K93PI3.js → CompositeItem-F3NGn6aG.js} +1 -1
  12. package/dist/client/assets/CompositeRoot-CmJGfRtc.js +1 -0
  13. package/dist/client/assets/ConnectionsSettings-Ccn8q4fG.js +7 -0
  14. package/dist/client/assets/DiagnosticsSettings-QXpjXOrH.js +2 -0
  15. package/dist/client/assets/{DialogHandle-pL0RAsXa.js → DialogHandle-C4uSr9wX.js} +1 -1
  16. package/dist/client/assets/DialogPopup-Dck8r8Hn.js +1 -0
  17. package/dist/client/assets/DialogRoot-BpIvUdm7.js +1 -0
  18. package/dist/client/assets/{DialogTitle-BamZsRNz.js → DialogTitle-CCedPAjV.js} +1 -1
  19. package/dist/client/assets/{DialogTrigger-DR3vtVpa.js → DialogTrigger-CYJ7_YcV.js} +1 -1
  20. package/dist/client/assets/DialogViewport-D-CrTM-P.js +1 -0
  21. package/dist/client/assets/DraftChatThreadRouteView-DFMY6O91.js +1 -0
  22. package/dist/client/assets/{GlassSurface-DTmaROoR.js → GlassSurface-C3IIWMu9.js} +1 -1
  23. package/dist/client/assets/HostedConnectionControls-BC4kVWTa.js +1 -0
  24. package/dist/client/assets/HostedHubRoot-pBGVub10.js +1 -0
  25. package/dist/client/assets/HostedNativeAuthorizationRoute-Df0oSrLR.js +1 -0
  26. package/dist/client/assets/HostedRelayTrustNotice-ffS_O2AX.js +1 -0
  27. package/dist/client/assets/Icons-CT3nd2MA.js +1 -0
  28. package/dist/client/assets/IntegrationsSettingsPanel-BHyy-VM0.js +1 -0
  29. package/dist/client/assets/KeybindingsSettings-BfkONqmZ.js +7 -0
  30. package/dist/client/assets/McpServersSettings-UthT1T80.js +6 -0
  31. package/dist/client/assets/MobileSheet-CkeG6_SP.js +1 -0
  32. package/dist/client/assets/NewWorktreeDialog-DTZnArOC.js +4 -0
  33. package/dist/client/assets/NoActiveThreadState-jcEAWu7N.js +1 -0
  34. package/dist/client/assets/NodeSecuritySettings-DPqjRphc.js +1 -0
  35. package/dist/client/assets/OpinionatedPluginsSettings-BSy3F4v6.js +1 -0
  36. package/dist/client/assets/PhoneGetAppInterstitial-B2mrJtgM.js +1 -0
  37. package/dist/client/assets/PhoneGetAppInterstitialBackdrop-B8vfJdZd.js +1 -0
  38. package/dist/client/assets/PhoneHome-C-ttaKuE.js +1 -0
  39. package/dist/client/assets/PhoneSettingsSurface-CJddundi.js +1 -0
  40. package/dist/client/assets/ProjectFavicon-BhQnkxbx.js +1 -0
  41. package/dist/client/assets/ProviderModelPicker-COg6CGM4.js +1 -0
  42. package/dist/client/assets/ProvidersSettingsPanel-C3aPyCrN.js +1 -0
  43. package/dist/client/assets/RedactedSensitiveText-CxtaUiKH.js +1 -0
  44. package/dist/client/assets/RootAppShell-3T2sBtpP.js +6 -0
  45. package/dist/client/assets/RycoLetterMark-Bk0kvGJ_.js +1 -0
  46. package/dist/client/assets/SettingsDialog-krsStFrf.js +1 -0
  47. package/dist/client/assets/SettingsPanels-D8Xy3pPC.js +3 -0
  48. package/dist/client/assets/SettingsPanels.editor-B2x4U4rW.js +1 -0
  49. package/dist/client/assets/SourceControlSettings-KIx9EfEZ.js +1 -0
  50. package/dist/client/assets/StatisticsPage-C38pI2_b.js +1 -0
  51. package/dist/client/assets/StatisticsPanel-6sINT28-.js +1 -0
  52. package/dist/client/assets/StatisticsSettingsLink-Cx43bOeo.js +1 -0
  53. package/dist/client/assets/ThreadStatusIndicators-CL0KGLlj.js +0 -0
  54. package/dist/client/assets/{ThreadTerminalDrawer-BYQ6EMgr.js → ThreadTerminalDrawer-C4NJu8Qs.js} +3 -3
  55. package/dist/client/assets/{ThreadWorkspacePanel-DuaQ9DMj.js → ThreadWorkspacePanel-D9qlHXCA.js} +18 -18
  56. package/dist/client/assets/{ToolbarRootContext-Cp1bgmpz.js → ToolbarRootContext-BgqqXVly.js} +1 -1
  57. package/dist/client/assets/{WorkItemsTab-BDfun24H.js → WorkItemsTab-BDAeQe4D.js} +8 -8
  58. package/dist/client/assets/alert-LqMhbdE9.js +1 -0
  59. package/dist/client/assets/alert-dialog-DxoA6ky8.js +1 -0
  60. package/dist/client/assets/badge-CXw6fWrB.js +1 -0
  61. package/dist/client/assets/{branding-yW_ACj9l.js → branding-DeKsIp6g.js} +1 -1
  62. package/dist/client/assets/button-BAbJxRzt.js +1 -0
  63. package/dist/client/assets/{capabilities-j43xmCXg.js → capabilities-BkVqeGLQ.js} +1 -1
  64. package/dist/client/assets/collapsible-dxy6kc2k.js +1 -0
  65. package/dist/client/assets/command-CGNKG_Oe.js +1 -0
  66. package/dist/client/assets/composerDraftStore-CdJJZe42.js +11 -0
  67. package/dist/client/assets/data-list-CYKBxN62.js +1 -0
  68. package/dist/client/assets/{desktopUpdateAtoms-Cy06xm8M.js → desktopUpdateAtoms-B9iJXSdW.js} +1 -1
  69. package/dist/client/assets/{desktopWorkspace-Cw4Fu0Dd.js → desktopWorkspace-B-cSBe8H.js} +1 -1
  70. package/dist/client/assets/{device-hx7RX9fI.js → device-DfIh5pQV.js} +12 -12
  71. package/dist/client/assets/dialog-DQsYchqu.js +1 -0
  72. package/dist/client/assets/draft-input-CkzOk8BY.js +1 -0
  73. package/dist/client/assets/{editorPreferences-C3i2Nkh2.js → editorPreferences-0DWMgcci.js} +1 -1
  74. package/dist/client/assets/empty-DwzqNgCP.js +1 -0
  75. package/dist/client/assets/{getPseudoElementBounds-NLvUMZyQ.js → getPseudoElementBounds-X62ElHN8.js} +1 -1
  76. package/dist/client/assets/group-D9ER9giz.js +1 -0
  77. package/dist/client/assets/{index-COc-h_V9.js → index-Bntnmu6O.js} +1 -1
  78. package/dist/client/assets/input-CHEwW3oH.js +1 -0
  79. package/dist/client/assets/kbd-DCGQZk18.js +1 -0
  80. package/dist/client/assets/{keybindings-BCns_TPr.js → keybindings-CWJ7E9ZI.js} +1 -1
  81. package/dist/client/assets/label-CVFHsLFO.js +1 -0
  82. package/dist/client/assets/{lib-BBbQoz14.js → lib-qiiNMGgU.js} +1 -1
  83. package/dist/client/assets/{main-9Wu8G64Y.js → main-BjVnVob0.js} +3 -3
  84. package/dist/client/assets/menu-Dvxh8sD5.js +1 -0
  85. package/dist/client/assets/popover-CuH9Yrj3.js +1 -0
  86. package/dist/client/assets/{projectPaths-DSRhOXwD.js → projectPaths-SSsIvt0g.js} +1 -1
  87. package/dist/client/assets/{providerDriverMeta-DcAmgw5o.js → providerDriverMeta-I0TSo-QI.js} +1 -1
  88. package/dist/client/assets/providerIconUtils-CzSa_16f.js +1 -0
  89. package/dist/client/assets/providerInstances-BJcfB_9E.js +1 -0
  90. package/dist/client/assets/providerModels-BJcfB_9E.js +1 -0
  91. package/dist/client/assets/qr-code-Bddq6K7S.js +1 -0
  92. package/dist/client/assets/radio-group-CBZFr4C8.js +2 -0
  93. package/dist/client/assets/resolveAriaLabelledBy-CD_ugzhJ.js +1 -0
  94. package/dist/client/assets/{rightPanelRouteSearch-DE_7uWlN.js → rightPanelRouteSearch-DB5gQGHK.js} +1 -1
  95. package/dist/client/assets/runtime-DfGHeCnR.js +1 -0
  96. package/dist/client/assets/scroll-area-Drsa8bNB.js +1 -0
  97. package/dist/client/assets/scrollEdges-B-cqxY4l.js +1 -0
  98. package/dist/client/assets/select-BYbVr-yg.js +1 -0
  99. package/dist/client/assets/separator-CdS5bi4Z.js +1 -0
  100. package/dist/client/assets/{session-logic-DOQPF0oN.js → session-logic-wxhvMgEN.js} +1 -1
  101. package/dist/client/assets/settingsDialogStore-ygYoScKe.js +1 -0
  102. package/dist/client/assets/settingsLayout-D8glO7f1.js +1 -0
  103. package/dist/client/assets/sheet-BO78gIKZ.js +1 -0
  104. package/dist/client/assets/sidebar-Dm6l2GA6.js +1 -0
  105. package/dist/client/assets/sidebarProjectFolders-CGVDJ0ZT.js +4 -0
  106. package/dist/client/assets/{sidebarStatusText-DaNVnBiR.js → sidebarStatusText-D0HT0fek.js} +1 -1
  107. package/dist/client/assets/skeleton-CvQSeJbw.js +1 -0
  108. package/dist/client/assets/spinner-ClF0jOcX.js +1 -0
  109. package/dist/client/assets/storeSelectors-Bpr2pdhU.js +1 -0
  110. package/dist/client/assets/switch-BTGo9Yip.js +1 -0
  111. package/dist/client/assets/{terminal-links-BaX-ICJT.js → terminal-links-CZ3c9AbA.js} +1 -1
  112. package/dist/client/assets/textarea-RFPODxWW.js +1 -0
  113. package/dist/client/assets/{threadPriorityRefreshRuntime-DqqfcbZE.js → threadPriorityRefreshRuntime-tRDgvBzr.js} +1 -1
  114. package/dist/client/assets/toast-CcSCAm4B.js +1 -0
  115. package/dist/client/assets/toggle-I6h33Cu5.js +1 -0
  116. package/dist/client/assets/toggle-group-mLIkiJtU.js +1 -0
  117. package/dist/client/assets/tooltip-C8sAONBj.js +1 -0
  118. package/dist/client/assets/types-Bpr2pdhU.js +1 -0
  119. package/dist/client/assets/{uiStateStore-VVodpTkG.js → uiStateStore-B6pjzSjj.js} +1 -1
  120. package/dist/client/assets/{useAtlassian-DzQhYzCz.js → useAtlassian-DC0XOw4u.js} +0 -0
  121. package/dist/client/assets/{useButton-CQaIys_r.js → useButton-D__1LqCF.js} +1 -1
  122. package/dist/client/assets/useCompositeListItem-Cmr_nuuG.js +1 -0
  123. package/dist/client/assets/{useDebouncedValue-Dl2JtWSe.js → useDebouncedValue-DHjoudTq.js} +1 -1
  124. package/dist/client/assets/{useFloatingRootContext-DKAeq7FI.js → useFloatingRootContext-D5EZmrCa.js} +1 -1
  125. package/dist/client/assets/{useHandleNewThread-CzfIpG9Y.js → useHandleNewThread-Bvz-DKgn.js} +1 -1
  126. package/dist/client/assets/{useLabelableId-C7EOshps.js → useLabelableId-DnQJ7amm.js} +1 -1
  127. package/dist/client/assets/useLocation-CDeYzWW6.js +1 -0
  128. package/dist/client/assets/{useOpenInteractionType-D9ngong8.js → useOpenInteractionType-CjtpACKR.js} +1 -1
  129. package/dist/client/assets/usePhoneThreadActions-CAgIq9aZ.js +1 -0
  130. package/dist/client/assets/usePopupViewport-BuhsNdVy.js +1 -0
  131. package/dist/client/assets/useScrollLock-D3tMGsRk.js +1 -0
  132. package/dist/client/assets/{useStatistics-CP8uxvx6.js → useStatistics-CiLROMJP.js} +14 -14
  133. package/dist/client/assets/{useSwipeDismiss-DESLmDpT.js → useSwipeDismiss-CbgDJvw1.js} +1 -1
  134. package/dist/client/assets/{useThreadActions-fOb3ApmL.js → useThreadActions-Vew3ScxG.js} +1 -1
  135. package/dist/client/assets/{useTriggerFocusGuards-DkAmJBLw.js → useTriggerFocusGuards-CrugmkhX.js} +1 -1
  136. package/dist/client/assets/{useValueChanged-CSGMZCwN.js → useValueChanged-MQtIzPIU.js} +1 -1
  137. package/dist/client/assets/utils-BofFIn5Y.js +1 -0
  138. package/dist/client/index.html +1 -1
  139. package/package.json +1 -1
  140. package/dist/client/assets/AccountSettings-CxbiGHT-.js +0 -1
  141. package/dist/client/assets/AiFocusSettings-Cx2vpGdu.js +0 -1
  142. package/dist/client/assets/AnimatedHeight-D5lUTPRn.js +0 -1
  143. package/dist/client/assets/AppearanceSettings-eWri4YVm.js +0 -1
  144. package/dist/client/assets/ChatRightPanel-DAVHrLN_.js +0 -27
  145. package/dist/client/assets/ChatThreadRouteView-D11uiGPL.js +0 -1
  146. package/dist/client/assets/CommandPaletteDialog-DDXuLFyX.js +0 -1
  147. package/dist/client/assets/CompositeRoot-Cee5L4T9.js +0 -1
  148. package/dist/client/assets/ConnectionsSettings-Cf1RRkcn.js +0 -7
  149. package/dist/client/assets/DiagnosticsSettings-R00QjM1b.js +0 -2
  150. package/dist/client/assets/DialogPopup-DqvvwMxX.js +0 -1
  151. package/dist/client/assets/DialogRoot-BZCu6XdB.js +0 -1
  152. package/dist/client/assets/DialogViewport-CuRGvCfw.js +0 -1
  153. package/dist/client/assets/DraftChatThreadRouteView-CGMtPPGt.js +0 -1
  154. package/dist/client/assets/HostedConnectionControls-CXiER4OL.js +0 -1
  155. package/dist/client/assets/HostedHubRoot-MbaWk1RQ.js +0 -1
  156. package/dist/client/assets/HostedNativeAuthorizationRoute-DQ71L_yc.js +0 -1
  157. package/dist/client/assets/HostedRelayTrustNotice-Cv7T3mW5.js +0 -1
  158. package/dist/client/assets/Icons-DjUJVKIP.js +0 -1
  159. package/dist/client/assets/IntegrationsSettingsPanel-BUDT_BAr.js +0 -1
  160. package/dist/client/assets/KeybindingsSettings-DpU1kPiV.js +0 -7
  161. package/dist/client/assets/McpServersSettings-DQqM_vIq.js +0 -6
  162. package/dist/client/assets/MobileSheet-PksVmYO6.js +0 -1
  163. package/dist/client/assets/NewWorktreeDialog-CAe3UUk5.js +0 -4
  164. package/dist/client/assets/NoActiveThreadState-B020r2KX.js +0 -1
  165. package/dist/client/assets/NodeSecuritySettings-DlVOOlej.js +0 -1
  166. package/dist/client/assets/OpinionatedPluginsSettings-DMshW6cD.js +0 -1
  167. package/dist/client/assets/PhoneGetAppInterstitial-BCO-RNVk.js +0 -1
  168. package/dist/client/assets/PhoneGetAppInterstitialBackdrop-CkHNzjRm.js +0 -1
  169. package/dist/client/assets/PhoneHome-DY2ItxYl.js +0 -1
  170. package/dist/client/assets/PhoneSettingsSurface-DTP9FXLL.js +0 -1
  171. package/dist/client/assets/ProjectFavicon-Dopa4Rxy.js +0 -1
  172. package/dist/client/assets/ProviderModelPicker-ChoxerzY.js +0 -1
  173. package/dist/client/assets/ProvidersSettingsPanel-Ubea3yAA.js +0 -1
  174. package/dist/client/assets/RedactedSensitiveText-CdVeknPX.js +0 -1
  175. package/dist/client/assets/RootAppShell-BkUPk443.js +0 -6
  176. package/dist/client/assets/RycoLetterMark-GW-n9UxM.js +0 -1
  177. package/dist/client/assets/SettingsDialog-DMPrhOeR.js +0 -1
  178. package/dist/client/assets/SettingsPanels-ChP1z6Bu.js +0 -3
  179. package/dist/client/assets/SettingsPanels.editor-CiyAxlms.js +0 -1
  180. package/dist/client/assets/SourceControlSettings-8w3XlkuZ.js +0 -1
  181. package/dist/client/assets/StatisticsPage-D4lU63rD.js +0 -1
  182. package/dist/client/assets/StatisticsPanel-C2yBieuM.js +0 -1
  183. package/dist/client/assets/StatisticsSettingsLink-DZwvRI-Y.js +0 -1
  184. package/dist/client/assets/ThreadStatusIndicators-B43wkv-s.js +0 -0
  185. package/dist/client/assets/alert-DdU9OGtC.js +0 -1
  186. package/dist/client/assets/alert-dialog-zAmnOpaF.js +0 -1
  187. package/dist/client/assets/badge-CNPL77i3.js +0 -1
  188. package/dist/client/assets/button-CXfaxtRp.js +0 -1
  189. package/dist/client/assets/collapsible-oJfDmFRs.js +0 -1
  190. package/dist/client/assets/command-DK1D8p4-.js +0 -1
  191. package/dist/client/assets/composerDraftStore-BaAeiPHc.js +0 -11
  192. package/dist/client/assets/data-list-BpzwKa1z.js +0 -1
  193. package/dist/client/assets/dialog-JVv-MNDj.js +0 -1
  194. package/dist/client/assets/draft-input-CxoGkZxM.js +0 -1
  195. package/dist/client/assets/empty-DhkXzm1N.js +0 -1
  196. package/dist/client/assets/group-CafmSbGU.js +0 -1
  197. package/dist/client/assets/input-Bz9pd_f3.js +0 -1
  198. package/dist/client/assets/kbd-qh5s29Yp.js +0 -1
  199. package/dist/client/assets/label-Ct6uH6qL.js +0 -1
  200. package/dist/client/assets/menu-DL-18Hfn.js +0 -1
  201. package/dist/client/assets/popover-C9y_0-ZN.js +0 -1
  202. package/dist/client/assets/providerIconUtils-DSXSWHwg.js +0 -1
  203. package/dist/client/assets/providerInstances-D5NRn-MS.js +0 -1
  204. package/dist/client/assets/providerModels-D5NRn-MS.js +0 -1
  205. package/dist/client/assets/qr-code-DsN9sWfN.js +0 -1
  206. package/dist/client/assets/radio-group-DGUZYMAN.js +0 -2
  207. package/dist/client/assets/resolveAriaLabelledBy-l3Wj7Mso.js +0 -1
  208. package/dist/client/assets/runtime-CqhG6EOG.js +0 -1
  209. package/dist/client/assets/scroll-area-gtur6NxN.js +0 -1
  210. package/dist/client/assets/scrollEdges-Ccq9Jqpk.js +0 -1
  211. package/dist/client/assets/select-BB7zCkpA.js +0 -1
  212. package/dist/client/assets/separator-DOGIr29S.js +0 -1
  213. package/dist/client/assets/settingsDialogStore-DM98Sea0.js +0 -1
  214. package/dist/client/assets/settingsLayout-CS7P71tz.js +0 -1
  215. package/dist/client/assets/sheet-DVALF6mw.js +0 -1
  216. package/dist/client/assets/sidebar-Dft4bIEi.js +0 -1
  217. package/dist/client/assets/sidebarProjectFolders-BOfJCYjK.js +0 -4
  218. package/dist/client/assets/skeleton-CBHDWLDX.js +0 -1
  219. package/dist/client/assets/spinner-JhkVC8d7.js +0 -1
  220. package/dist/client/assets/storeSelectors-CP3vrsGY.js +0 -1
  221. package/dist/client/assets/switch-vkC1QGDn.js +0 -1
  222. package/dist/client/assets/textarea-Cz_x76EQ.js +0 -1
  223. package/dist/client/assets/toast-Bnfw8LOb.js +0 -1
  224. package/dist/client/assets/toggle-DNtHlm45.js +0 -1
  225. package/dist/client/assets/toggle-group-BNtjyirT.js +0 -1
  226. package/dist/client/assets/tooltip-lYatfjuN.js +0 -1
  227. package/dist/client/assets/types-CP3vrsGY.js +0 -1
  228. package/dist/client/assets/useCompositeListItem-D_u_nlWz.js +0 -1
  229. package/dist/client/assets/useLocation-CvhfNIUj.js +0 -1
  230. package/dist/client/assets/usePhoneThreadActions-CiFBnOHD.js +0 -1
  231. package/dist/client/assets/usePopupViewport-CQTeg5Y-.js +0 -1
  232. package/dist/client/assets/useScrollLock-TdF-Iq8H.js +0 -1
  233. package/dist/client/assets/utils-BPUctpTG.js +0 -1
@@ -0,0 +1 @@
1
+ import{i as e,t}from"./react-SIfiwpqq.js";import{It as n}from"./composerDraftStore-CdJJZe42.js";import{Mn as r,Nn as i}from"./usePopupViewport-BuhsNdVy.js";import{u as a}from"./useRenderElement-DchFnsR8.js";var o=e(t(),1),s=o.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function c(){return o.useContext(s)}var l=n();function u(e){let{children:t,elementsRef:n,labelsRef:c,onMapChange:u}=e,_=i(u),[,v]=o.useState(!1),y=a(f).current,b=a(d).current,x=o.useRef(0),S=o.useRef(!0),C=o.useRef([]),w=o.useRef(null),T=i(()=>{S.current||(S.current=!0,v(e=>!e))}),E=i((e,t)=>{b.set(e,t),T()}),D=i(e=>{b.delete(e),T()}),O=i(e=>{let t=new Map;return n.current.length=0,c&&(c.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,c&&(c.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),x.current=n.current.length,t});function k(e){if(w.current?.disconnect(),w.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!h(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&g(r,n)>0){t.disconnect(),T();return}r=n}});w.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=m(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let A=i(()=>{let[e,t]=p(b),n=O(e);k(t),C.current=e,S.current=!1,y.forEach(e=>e(n)),_(n)});r(()=>(S.current||O(C.current),()=>{n.current=[],c&&(c.current=[])}),[n,c,O]),r(()=>{S.current&&A()}),r(()=>()=>{w.current?.disconnect(),S.current=!0},[]);let j=i(e=>(y.add(e),()=>{y.delete(e)})),M=o.useMemo(()=>({register:E,unregister:D,subscribeMapChange:j,nextIndexRef:x}),[E,D,j,x]);return(0,l.jsx)(s.Provider,{value:M,children:t})}function d(){return new Map}function f(){return new Set}function p(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>g(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function m(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function h(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function g(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function _(e={}){let{guess:t,label:n,metadata:i,textRef:a,index:s}=e,{register:l,unregister:u,subscribeMapChange:d,nextIndexRef:f}=c(),p=o.useRef(-1),[m,h]=o.useState(s==null&&t?()=>{if(p.current===-1){let e=f.current;f.current+=1,p.current=e}return p.current}:-1),g=s??m,_=o.useRef(null),v=o.useCallback(e=>{let t=_.current;t&&u(t),_.current=e,e&&l(e,{metadata:i??null,index:s??null,label:n,textRef:a})},[s,l,u,i,n,a]);return r(()=>{if(s==null)return d(e=>{let t=_.current?e.get(_.current)?.index:null;t!=null&&h(t)})},[s,d]),{ref:v,index:g}}export{u as n,_ as t};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{Ft as n}from"./composerDraftStore-BaAeiPHc.js";import{Zn as r}from"./usePopupViewport-CQTeg5Y-.js";var i=e(t(),1),a=(0,i.createContext)(null);function o(){return(0,i.useContext)(a)?.defaultOptions??{}}function s(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=c(e);if(n.length!==c(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function c(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var l=r();function u(e,t){return e===t}function d(e,t=e=>e,n){let r=n?.compare??u,a=(0,i.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),o=(0,i.useCallback)(()=>e.get(),[e]);return(0,l.useSyncExternalStoreWithSelector)(a,o,o,t,r)}function f(e,t,r=()=>({})){let a={...o().debouncer,...t},[c]=(0,i.useState)(()=>{let t=new n(e,a);return t.Subscribe=function(e){let n=d(t.store,e.selector,{compare:s});return typeof e.children==`function`?e.children(n):e.children},t});c.fn=e,c.setOptions(a),(0,i.useEffect)(()=>()=>{a.onUnmount?a.onUnmount(c):c.cancel()},[]);let l=d(c.store,r,{compare:s});return(0,i.useMemo)(()=>({...c,state:l}),[c,l])}function p(e,t,n){let[r,a]=(0,i.useState)(e),o=f(a,t,n);return[r,o.maybeExecute,o]}function m(e,t,n){let[r,a,o]=p(e,t,n);return(0,i.useEffect)(()=>{a(e)},[e,a]),[r,o]}export{m as t};
1
+ import{i as e,t}from"./react-SIfiwpqq.js";import{Ft as n}from"./composerDraftStore-CdJJZe42.js";import{Zn as r}from"./usePopupViewport-BuhsNdVy.js";var i=e(t(),1),a=(0,i.createContext)(null);function o(){return(0,i.useContext)(a)?.defaultOptions??{}}function s(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=c(e);if(n.length!==c(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function c(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var l=r();function u(e,t){return e===t}function d(e,t=e=>e,n){let r=n?.compare??u,a=(0,i.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),o=(0,i.useCallback)(()=>e.get(),[e]);return(0,l.useSyncExternalStoreWithSelector)(a,o,o,t,r)}function f(e,t,r=()=>({})){let a={...o().debouncer,...t},[c]=(0,i.useState)(()=>{let t=new n(e,a);return t.Subscribe=function(e){let n=d(t.store,e.selector,{compare:s});return typeof e.children==`function`?e.children(n):e.children},t});c.fn=e,c.setOptions(a),(0,i.useEffect)(()=>()=>{a.onUnmount?a.onUnmount(c):c.cancel()},[]);let l=d(c.store,r,{compare:s});return(0,i.useMemo)(()=>({...c,state:l}),[c,l])}function p(e,t,n){let[r,a]=(0,i.useState)(e),o=f(a,t,n);return[r,o.maybeExecute,o]}function m(e,t,n){let[r,a,o]=p(e,t,n);return(0,i.useEffect)(()=>{a(e)},[e,a]),[r,o]}export{m as t};
@@ -1 +1 @@
1
- import{F as e,J as t,Mn as n,an as r,v as i,zn as a}from"./usePopupViewport-CQTeg5Y-.js";import{f as o,u as s}from"./useRenderElement-DchFnsR8.js";var c=o(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]);function l(o){let{open:c=!1,onOpenChange:l,elements:u={}}=o,d=r(),f=t()!=null,p=s(()=>new e({open:c,transitionStatus:void 0,onOpenChange:l,referenceElement:u.reference??null,floatingElement:u.floating??null,triggerElements:new i,floatingId:d,syncOnly:!1,nested:f})).current;return n(()=>{let e={open:c,floatingId:d};u.reference!==void 0&&(e.referenceElement=u.reference,e.domReferenceElement=a(u.reference)?u.reference:null),u.floating!==void 0&&(e.floatingElement=u.floating),p.update(e)},[c,d,u.reference,u.floating,p]),p.context.onOpenChange=l,p.context.nested=f,p}export{c as n,l as t};
1
+ import{F as e,J as t,Mn as n,an as r,v as i,zn as a}from"./usePopupViewport-BuhsNdVy.js";import{f as o,u as s}from"./useRenderElement-DchFnsR8.js";var c=o(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]);function l(o){let{open:c=!1,onOpenChange:l,elements:u={}}=o,d=r(),f=t()!=null,p=s(()=>new e({open:c,transitionStatus:void 0,onOpenChange:l,referenceElement:u.reference??null,floatingElement:u.floating??null,triggerElements:new i,floatingId:d,syncOnly:!1,nested:f})).current;return n(()=>{let e={open:c,floatingId:d};u.reference!==void 0&&(e.referenceElement=u.reference,e.domReferenceElement=a(u.reference)?u.reference:null),u.floating!==void 0&&(e.floatingElement=u.floating),p.update(e)},[c,d,u.reference,u.floating,p]),p.context.onOpenChange=l,p.context.nested=f,p}export{c as n,l as t};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{g as r,v as i}from"./env-B4arEvJg.js";import{z as a}from"./src-Vf4LVnMX.js";import{At as o,C as s,E as c,Ft as l,I as u,Jt as d,Mt as f,N as p,Ot as m,Rn as h,S as g,b as _,jt as v}from"./runtime-CqhG6EOG.js";import{i as y}from"./composerDraftStore-BaAeiPHc.js";import{a as b,c as x,t as S}from"./utils-BPUctpTG.js";import{d as C,u as w}from"./useSwipeDismiss-DESLmDpT.js";import{t as T}from"./useRouter-CcIDS3PN.js";import{o as E,s as D}from"./authorization-mIJKV2yp.js";import{i as O}from"./uiStateStore-VVodpTkG.js";import{c as k,d as A,f as j,l as M,o as ee,s as N,u as P}from"./desktopWorkspace-Cw4Fu0Dd.js";import{t as te}from"./shallow-DWZCFNun.js";import{p as ne}from"./session-logic-DOQPF0oN.js";import"./storeSelectors-CP3vrsGY.js";var F=`__TSR_index`,re=`popstate`,ie=`beforeunload`;function ae(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=I(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[F];i=oe(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[F];i=oe(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[F]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function oe(e,t){t||={};let n=ue();return{...t,key:n,__TSR_key:n,[F]:e}}function se(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>I(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=ue();t.history.replaceState({[F]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(e,t,n)=>{let r=s(t),i=!!g;i||(u=l),l=I(t,n),g=[r,n,g?.[2]||e],i||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(f){f=!1;return}let e=c(),n=e.state[F]-l.state[F],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=ae({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(ie,x,{capture:!0}),t.removeEventListener(re,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(ie,x,{capture:!0}),t.addEventListener(re,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function ce(e){let t=e?.window??(typeof document<`u`?window:void 0);return se({window:t,parseLocation:()=>{let e=t.location.hash.split(`#`).slice(1),n=e[0]??`/`,r=t.location.search,i=e.slice(1);return I(`${n}${r}${i.length===0?``:`#${i.join(`#`)}`}`,t.history.state)},createHref:e=>`${t.location.pathname}${t.location.search}#${e}`})}function le(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function I(e,t){let n=le(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=ue();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[F]:0,key:a,__TSR_key:a}}}function ue(){return(Math.random()+1).toString(36).substring(7)}function de(e){return Number.isSafeInteger(e)&&e>=0}function fe(e){return e.environmentId===null||!de(e.selectionGeneration)||!de(e.snapshotGeneration)||e.effectiveRole!==`owner`||!e.directoryReady||!e.relayReady||!e.shellReady?null:{environmentId:e.environmentId,selectionGeneration:e.selectionGeneration,snapshotGeneration:e.snapshotGeneration,effectiveRole:e.effectiveRole,directoryReady:!0,relayReady:!0,shellReady:!0}}function pe(e,t,n){let r=fe(n);return r!==null&&e.environmentId===t&&r.environmentId===t&&e.selectionGeneration===r.selectionGeneration&&e.snapshotGeneration===r.snapshotGeneration&&e.effectiveRole===r.effectiveRole}function me(){let e=new Set,t={environmentId:null,selectionGeneration:0,snapshotGeneration:0,effectiveRole:null,directoryReady:!1,relayReady:!1,shellReady:!1};return{update(n){let r=t.environmentId!==n.environmentId||t.effectiveRole!==n.effectiveRole||t.directoryReady!==n.directoryReady||t.relayReady!==n.relayReady||t.shellReady!==n.shellReady;t={...n,selectionGeneration:r?t.selectionGeneration+1:t.selectionGeneration};for(let t of Array.from(e))t()},read:()=>t,lease(e){let n=fe(t);return n?.environmentId===e?n:null},validate:(e,n)=>pe(e,n,t),subscribe(t){return e.add(t),()=>e.delete(t)}}}var he=45e3;function ge(e){if(!Number.isInteger(e)||e<1||e>3)throw RangeError(`platformMaxConnections must be between 1 and 3`);return{platformMaxConnections:e,backgrounded:!1,leases:[],connections:[]}}function _e(e,t,n){let r=e.connections.find(e=>e.environmentId===t)??{environmentId:t,connected:!1,lastAccessedAt:0};return{...e,connections:[...e.connections.filter(e=>e.environmentId!==t),n(r)]}}function ve(e,t,n){return _e(e,t,e=>({...e,lastAccessedAt:Math.max(e.lastAccessedAt,n)}))}function L(e,t,n,r){return _e(e,t,e=>({...e,connected:n,lastAccessedAt:Math.max(e.lastAccessedAt,r)}))}function ye(e,t){if(t.leaseId.length===0)throw TypeError(`leaseId must not be empty`);if(e.leases.some(e=>e.leaseId===t.leaseId))throw Error(`Duplicate workspace connection lease: ${t.leaseId}`);let n=t.ttlMs??45e3;if(!Number.isFinite(n)||n<=0)throw RangeError(`ttlMs must be positive`);return ve({...e,leases:[...e.leases,{leaseId:t.leaseId,environmentId:t.environmentId,scope:t.scope,retainedAt:t.now,expiresAt:t.now+n}]},t.environmentId,t.now)}function be(e,t,n,r=he){if(!Number.isFinite(r)||r<=0)throw RangeError(`ttlMs must be positive`);return{...e,leases:e.leases.map(e=>e.leaseId===t?{...e,expiresAt:n+r}:e)}}function xe(e,t){return{...e,leases:e.leases.filter(e=>e.leaseId!==t)}}function Se(e,t){return e.backgrounded===t?e:{...e,backgrounded:t}}function Ce(e,t){let n=e.leases.filter(e=>e.expiresAt>t);return n.length===e.leases.length?e:{...e,leases:n}}function we(e,t){let n=Ce(e,t.now),r=new Map;for(let e of n.leases)r.set(e.environmentId,Math.max(r.get(e.environmentId)??0,e.retainedAt));let i=Array.from(r.keys()),a=new Set(i),o=n.connections.filter(e=>e.connected),s=new Set(o.map(e=>e.environmentId)),c=o.filter(e=>!a.has(e.environmentId)).toSorted((e,t)=>e.lastAccessedAt-t.lastAccessedAt||String(e.environmentId).localeCompare(String(t.environmentId))),l=i.filter(e=>!s.has(e)).toSorted((e,t)=>(r.get(t)??0)-(r.get(e)??0)||String(e).localeCompare(String(t))),u=[];if(n.backgrounded)return u.push(...c.map(e=>e.environmentId)),{state:n,retain:i.filter(e=>s.has(e)),release:u,connect:[],queued:l};let d=o.length,f=[...c];for(;f.length>0&&(d>n.platformMaxConnections||d+l.length>n.platformMaxConnections);){let e=f.shift();u.push(e.environmentId),--d}let p=Math.max(0,n.platformMaxConnections-d),m=l.slice(0,p),h=Math.max(0,t.wakeStaggerMs??0);return{state:n,retain:i.filter(e=>s.has(e)),release:u,connect:m.map((e,t)=>({environmentId:e,delayMs:t*h})),queued:l.slice(m.length)}}function Te(e){return e.online&&e.canMutate&&(e.nativeTrust===`verified`||e.nativeTrust===`not-required`)}function Ee(e){return{environmentId:e.environmentId,projectId:e.projectId,physicalKey:e.physicalKey,machineLabel:e.machineLabel}}function De(e){if(e.override){let t=e.override,n=e.project.variants.find(e=>e.environmentId===t.environmentId&&e.projectId===t.projectId);return n?Te(n)?{status:`resolved`,target:Ee(n),source:`override`}:{status:`unavailable`,message:`No verified machine available`,reason:`override-unavailable`}:{status:`unavailable`,message:`No verified machine available`,reason:`override-not-in-project`}}let t=e.project.variants.filter(Te);if(t.length===0)return{status:`unavailable`,message:`No verified machine available`,reason:`no-eligible-variant`};let n=t.toSorted((e,t)=>{let n=e.lastUsedAt??-1/0,r=t.lastUsedAt??-1/0;return n===r?e.localDesktop===t.localDesktop?String(e.environmentId).localeCompare(String(t.environmentId)):e.localDesktop?-1:1:r-n})[0],r=Math.max(...t.map(e=>e.lastUsedAt??-1/0)),i=Number.isFinite(r)&&n.lastUsedAt===r?`recent`:n.localDesktop?`local-desktop`:`stable`;return{status:`resolved`,target:Ee(n),source:i}}var Oe={os:`unknown`,arch:`other`};function ke(e){return Array.from(new Set(e.filter(e=>e!==null)))}function Ae(e){let t=e.revokedAt!=null,n=e.removed===!0,r=e.clientTier===`hosted-web`&&e.capabilities?.nativeClientRequired===!0,i=e.clientTier===`native`&&e.requiresNativeVerification&&e.nativeTrust===`unknown`,a=e.clientTier===`native`&&e.requiresNativeVerification&&e.nativeTrust===`unverified`,o=e.nativeTrust===`identity-conflict`,s=e.clientTier===`hosted-web`?!r:!e.requiresNativeVerification||e.nativeTrust===`verified`,c=!t&&!n&&s&&!o,l=c&&e.online,u=l&&e.effectiveRole!==null&&e.effectiveRole!==`viewer`,d=ke([t?`revoked`:null,n?`removed`:null,r?`native-client-required`:null,i?`trust-unknown`:null,a?`not-verified`:null,o?`identity-conflict`:null,e.online?null:`offline`,e.effectiveRole===null?`role-unknown`:null,e.effectiveRole===`viewer`?`viewer`:null]);return{environmentId:e.environmentId,nodeId:e.nodeId??null,label:e.label,platform:e.platform??Oe,serverVersion:e.serverVersion??null,capabilities:{repositoryIdentity:e.capabilities?.repositoryIdentity??!1,nativeClientRequired:e.capabilities?.nativeClientRequired??!1,threadSettlement:e.capabilities?.threadSettlement??!1},clientTier:e.clientTier,nativeTrust:e.nativeTrust,effectiveRole:e.effectiveRole,presence:{online:e.online,lastSeenAt:e.lastSeenAt,observedAt:e.observedAt},connectionState:e.connectionState??`disconnected`,deliveryUnknown:e.deliveryUnknown??!1,revokedAt:e.revokedAt??null,removed:n,canReadMetadata:c,canConnect:l,canMutate:u,cacheDisposition:t||n||r||i||a?`purge`:o?`locked-stale`:`available`,accessReasons:d}}function je(e){let t=new Map;for(let n of e)t.set(n.environmentId,Ae(n));return Array.from(t.values()).toSorted((e,t)=>e.label.localeCompare(t.label)||String(e.environmentId).localeCompare(String(t.environmentId)))}function Me(e){if(e===null)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function Ne(e){let t=new Map(e.machines.map(e=>[e.environmentId,e])),n=new Map;for(let t of e.snapshots){let e=n.get(t.environmentId);(!e||t.capturedAt>e.capturedAt)&&n.set(t.environmentId,t)}let r=[],i=[];for(let[e,a]of n){let n=t.get(e);if(!(!n||n.cacheDisposition===`purge`)){if(n.cacheDisposition===`locked-stale`){i.push({status:`locked-stale`,environmentId:e,capturedAt:a.capturedAt});continue}n.canReadMetadata&&(i.push({status:`available`,snapshot:a}),r.push(a))}}let a=r.flatMap(e=>e.projects),o=r.flatMap(e=>e.worktrees),l=r.flatMap(e=>{let n=t.get(e.environmentId);return e.threads.map(e=>({...e,deliveryUnknown:e.deliveryUnknown||n?.deliveryUnknown===!0}))}),u=a.flatMap(n=>{let r=t.get(n.environmentId);if(!r)return[];let i=s(n);return[{environmentId:n.environmentId,projectId:n.id,physicalKey:i,name:n.name,cwd:n.cwd,repositoryIdentity:n.repositoryIdentity,machineLabel:r.label,online:r.presence.online,canMutate:r.canMutate,nativeTrust:r.nativeTrust,effectiveRole:r.effectiveRole,lastUsedAt:e.lastUsedAtByPhysicalProjectKey?.[i]??null,lastLiveAt:Me(n.updatedAt)??r.presence.lastSeenAt,localDesktop:e.localDesktopEnvironmentId===n.environmentId}]});return{machines:e.machines,snapshots:i.toSorted((e,t)=>{let n=e.status===`available`?e.snapshot.environmentId:e.environmentId,r=t.status===`available`?t.snapshot.environmentId:t.environmentId;return String(n).localeCompare(String(r))}),projects:a,worktrees:o,threads:l,logicalProjects:c(u)}}var R=e(t(),1),Pe=n(),Fe=`[data-thread-item], [data-thread-selection-safe]`,Ie=`phone:pointer-coarse:size-8 phone:pointer-coarse:after:absolute phone:pointer-coarse:after:top-1/2 phone:pointer-coarse:after:left-1/2 phone:pointer-coarse:after:size-11 phone:pointer-coarse:after:-translate-x-1/2 phone:pointer-coarse:after:-translate-y-1/2`,Le=`phone:pointer-coarse:relative ${Ie}`;function Re(e){if(e.manualBucket!==null)return e.manualBucket;switch(e.statusPill?.label){case`Working`:case`Monitoring`:case`Connecting`:return`in_progress`;case`Plan Ready`:case`Pending Approval`:case`Awaiting Input`:return`review`;case`Completed`:return`done`;default:return`idle`}}function ze(e){return e.includes(`in_progress`)?`in_progress`:e.includes(`review`)?`review`:e.length>0&&e.every(e=>e===`done`)?`done`:`idle`}var Be=6048e5;function Ve(e){if(e.buckets.length===0||!e.buckets.every(e=>e===`done`)||!e.latestUpdatedAt)return!1;let t=Date.parse(e.latestUpdatedAt);return!Number.isNaN(t)&&e.nowMs-t>=Be}function He(e){return e.latestUserMessageAt!==null}function Ue(e){return e.latestUserMessageAt!==null}function We(e){return e.confirmThreadDelete&&Ue(e.thread)}function Ge(e){for(let t of e.threads)if(t&&We({confirmThreadDelete:e.confirmThreadDelete,thread:t}))return!0;return!1}function Ke(e){return e.archiveAvailable&&e.confirmThreadArchive}var qe={"Pending Approval":6,"Awaiting Input":5,Working:4,Connecting:4,"Plan Ready":3,Monitoring:2,Completed:1};function Je(e){let t=e.setTimeoutFn??globalThis.setTimeout,n=e.clearTimeoutFn??globalThis.clearTimeout,r=!1,i=null,a=()=>{i!==null&&(n(i),i=null)};return{sync:n=>{if(!n){a(),r&&(r=!1,e.onVisibilityChange(!1));return}r||i!==null||(i=t(()=>{i=null,r=!0,e.onVisibilityChange(!0)},e.delayMs))},dispose:()=>{a()}}}function Ye(){let[e,t]=R.useState(!1),n=R.useRef(null);return R.useEffect(()=>{let e=Je({delayMs:100,onVisibilityChange:e=>{t(e)},setTimeoutFn:window.setTimeout.bind(window),clearTimeoutFn:window.clearTimeout.bind(window)});return n.current=e,()=>{e.dispose(),n.current=null}},[]),{showThreadJumpHints:e,updateThreadJumpHintsVisibility:R.useCallback(e=>{n.current?.sync(e)},[])}}function Xe(e){if(!e.latestTurn?.completedAt)return!1;let t=Date.parse(e.latestTurn.completedAt);if(Number.isNaN(t))return!1;if(!e.lastVisitedAt)return!0;let n=Date.parse(e.lastVisitedAt);return Number.isNaN(n)?!0:t>n}function Ze(e){return e===null||!e.closest(Fe)}function Qe(e){return e>1}function $e(e){return e.requestedEnvMode??e.defaultEnvMode}function et(e){return e.defaultEnvMode===`worktree`?{envMode:`worktree`}:e.activeDraftThread?.projectId===e.projectId?{branch:e.activeDraftThread.branch,worktreePath:e.activeDraftThread.worktreePath,envMode:e.activeDraftThread.envMode}:e.activeThread?.projectId===e.projectId?{branch:e.activeThread.branch,worktreePath:e.activeThread.worktreePath,envMode:e.activeThread.worktreePath?`worktree`:`local`}:{envMode:e.defaultEnvMode}}function tt(e){let{getId:t,items:n,preferredIds:r}=e;if(r.length===0)return[...n];let i=new Map(n.map(e=>[t(e),e])),a=new Set(r),o=new Set,s=r.flatMap(e=>{if(o.has(e))return[];let t=i.get(e);return t?(o.add(e),[t]):[]}),c=n.filter(e=>!a.has(t(e)));return[...s,...c]}function nt(e,t=10){return e.slice(0,Math.max(0,t))}function rt(e){let t=v(e.threads,e.sortOrder);return e.pinnedThreadKeys.size===0?t:t.toSorted((t,n)=>{let r=e.pinnedThreadKeys.has(e.getThreadKey(t));return r===e.pinnedThreadKeys.has(e.getThreadKey(n))?0:r?-1:1})}function it(e){return e<=80}function at(e){return e.projectCount<=80&&e.visibleThreadCount<=120}function ot(e){return e.explorerOpen||e.projectVisible}function st(e,t){let n=null;for(let r of e){let e=t(r);if(e!==null){if(n===null){n=e;continue}if(n.environmentId!==e.environmentId||n.cwd!==e.cwd)return{kind:`mixed`}}}return n===null?{kind:`none`}:{kind:`shared`,target:n}}function ct(e){let{currentThreadId:t,direction:n,threadIds:r}=e;if(r.length===0)return null;if(t===null)return n===`previous`?r.at(-1)??null:r[0]??null;let i=r.indexOf(t);return i===-1?null:n===`previous`?i>0?r[i-1]??null:null:i<r.length-1?r[i+1]??null:null}function lt(e){return e.button===2||e.isMac&&e.button===0&&e.ctrlKey}function ut(e){let t=`h-7 w-full translate-x-0 cursor-pointer justify-start px-2 text-left select-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`;return e.isSelected&&e.isActive?S(t,`bg-primary/22 text-foreground font-medium hover:bg-primary/26 hover:text-foreground dark:bg-primary/30 dark:hover:bg-primary/36`):e.isSelected?S(t,`bg-primary/15 text-foreground hover:bg-primary/19 hover:text-foreground dark:bg-primary/22 dark:hover:bg-primary/28`):e.isActive?S(t,`bg-accent/85 text-foreground font-medium hover:bg-accent hover:text-foreground dark:bg-accent/55 dark:hover:bg-accent/70`):S(t,`text-muted-foreground hover:bg-accent hover:text-foreground`)}function dt(e){let{thread:t}=e;return t.hasPendingApprovals?{label:`Pending Approval`,colorClass:`text-amber-600 dark:text-amber-300/90`,dotClass:`bg-amber-500 dark:bg-amber-300/90`,pulse:!1}:t.hasPendingUserInput?{label:`Awaiting Input`,colorClass:`text-indigo-600 dark:text-indigo-300/90`,dotClass:`bg-indigo-500 dark:bg-indigo-300/90`,pulse:!1}:t.session?.status===`running`?{label:`Working`,colorClass:`text-sky-600 dark:text-sky-300/80`,dotClass:`bg-sky-500 dark:bg-sky-300/80`,pulse:!0}:t.session?.status===`connecting`?{label:`Connecting`,colorClass:`text-sky-600 dark:text-sky-300/80`,dotClass:`bg-sky-500 dark:bg-sky-300/80`,pulse:!0}:!t.hasPendingUserInput&&t.interactionMode===`plan`&&ne(t.latestTurn,t.session)&&t.hasActionableProposedPlan?{label:`Plan Ready`,colorClass:`text-violet-600 dark:text-violet-300/90`,dotClass:`bg-violet-500 dark:bg-violet-300/90`,pulse:!1}:t.backgroundLiveness===`working`?{label:`Working`,colorClass:`text-sky-600 dark:text-sky-300/80`,dotClass:`bg-sky-500 dark:bg-sky-300/80`,pulse:!0}:t.backgroundLiveness===`monitoring`?{label:`Monitoring`,colorClass:`text-sky-600 dark:text-sky-300/80`,dotClass:`bg-sky-500 dark:bg-sky-300/80`,pulse:!0}:Xe(t)?{label:`Completed`,colorClass:`text-emerald-600 dark:text-emerald-300/90`,dotClass:`bg-emerald-500 dark:bg-emerald-300/90`,pulse:!1}:null}function ft(e){let t=null;for(let n of e)n!==null&&(t===null||qe[n.label]>qe[t.label])&&(t=n);return t}function pt(e){let{deletedThreadId:t,deletedThreadIds:n,sortOrder:r,threads:i}=e,a=i.find(e=>e.id===t);if(!a)return null;let o=i.filter(e=>e.id!==t&&!n?.has(e.id));return v(o.filter(e=>e.projectId===a.projectId),r)[0]?.id??v(o,r)[0]?.id??null}function mt(e,t,n){return t.length>0?t.reduce((e,t)=>Math.max(e,o(t,n)),-1/0):n===`created_at`?f(e.createdAt)??-1/0:f(e.updatedAt??e.createdAt)??-1/0}function ht(e,t,n){if(n===`manual`)return[...e];let r=new Map;for(let e of t){let t=r.get(e.projectId)??[];t.push(e),r.set(e.projectId,t)}return[...e].toSorted((e,t)=>{let i=mt(t,r.get(t.id)??[],n),a=mt(e,r.get(e.id)??[],n),o=i===a?0:i>a?1:-1;return o===0?e.name.localeCompare(t.name)||e.id.localeCompare(t.id):o})}function gt(e){if(e.preferredEnvironmentId!==void 0&&e.preferredEnvironmentId!==null){if(!e.ready)return null;let t=e.machines.find(t=>t.environmentId===e.preferredEnvironmentId);if(!t?.online||!t.canMutate)return null;let n=e.orderedProjects.find(t=>t.environmentId===e.preferredEnvironmentId);return n===void 0?null:r(n.environmentId,n.id)}let t=e.orderedProjects[0];if(!t)return null;if(!e.ready)return r(t.environmentId,t.id);let n=e.logicalKey(t),a=new Map(e.machines.map(e=>[e.environmentId,e])),o=e.orderedProjects.filter(t=>e.logicalKey(t)===n),s=De({project:{key:n,label:t.name,repositoryIdentity:t.repositoryIdentity??null,ambiguous:o.length>1,variants:o.flatMap(t=>{let n=a.get(t.environmentId);return n?[{environmentId:t.environmentId,projectId:t.id,physicalKey:i(r(t.environmentId,t.id)),name:t.name,cwd:t.cwd,repositoryIdentity:t.repositoryIdentity??null,machineLabel:n.label,online:n.online,canMutate:n.canMutate,nativeTrust:n.nativeTrust,effectiveRole:n.canMutate?`owner`:null,lastUsedAt:null,lastLiveAt:null,localDesktop:e.localEnvironmentId===t.environmentId}]:[]})}});return s.status===`resolved`?r(s.target.environmentId,s.target.projectId):null}var _t=`ryco:hosted-workspace-metadata:v1`,z=1;function B(e){try{return new URL(e).origin.toLowerCase()}catch{return e.replace(/\/+$/gu,``).toLowerCase()}}function vt(e){return{...e,hubOrigin:B(e.hubOrigin)}}function yt(e){return{...e,namespace:vt(e.namespace)}}function bt(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;return typeof t.hubOrigin==`string`&&t.hubOrigin.length>0&&t.hubOrigin.length<=2048&&typeof t.accountId==`string`&&t.accountId.length>0&&t.accountId.length<=2048&&typeof t.environmentId==`string`&&t.environmentId.length>0&&t.environmentId.length<=2048}function xt(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;return bt(t.namespace)&&M(t.snapshot,t.namespace.environmentId)&&Number.isSafeInteger(t.payloadBytes)&&t.payloadBytes===j(t.snapshot)&&Number.isSafeInteger(t.updatedAt)&&Number(t.updatedAt)>=0}function V(e){try{let t=e.getItem(_t);if(!t)return{version:z,records:[]};let n=JSON.parse(t);if(typeof n!=`object`||!n||Array.isArray(n))return{version:z,records:[]};let r=n;if(r.version!==z||!Array.isArray(r.records))return{version:z,records:[]};let i=new Map;for(let e of r.records){if(!xt(e))continue;let t=yt(e),n=A(t.namespace),r=i.get(n);(!r||t.updatedAt>r.updatedAt)&&i.set(n,t)}return{version:z,records:Array.from(i.values())}}catch{return{version:z,records:[]}}}function St(e,t){if(t.length===0){e.removeItem(_t);return}e.setItem(_t,JSON.stringify({version:z,records:t}))}function Ct(e){let t=Promise.resolve(),n=e=>{let n=t.then(e,e);return t=n.then(()=>void 0,()=>void 0),n};return{load:async t=>{let n=A(vt(t));return V(e).records.find(e=>A(e.namespace)===n)??null},list:async({hubOrigin:t,accountId:n})=>V(e).records.filter(e=>B(e.namespace.hubOrigin)===B(t)&&e.namespace.accountId===n),replace:t=>n(async()=>{if(!xt(t))throw TypeError(`Invalid hosted workspace metadata record.`);let n=yt(t),r=V(e),i=P({existing:r.records,incoming:n});if(!i.accepted)return;let a=A(n.namespace),o=new Set(i.evict.map(A));St(e,[...r.records.filter(e=>{let t=A(e.namespace);return t!==a&&!o.has(t)}),n])}),purgeEnvironment:t=>n(async()=>{let n=A(vt(t));St(e,V(e).records.filter(e=>A(e.namespace)!==n))}),purgeAccount:({hubOrigin:t,accountId:r})=>n(async()=>{St(e,V(e).records.filter(e=>B(e.namespace.hubOrigin)!==B(t)||e.namespace.accountId!==r))})}}var wt=null;function Tt(){return wt||=Ct(window.localStorage),wt}var H=`/node`,Et=/^[A-Za-z0-9_-]{1,128}$/,Dt={nodeId:null,malformed:!1,logicalPathname:`/`},Ot={nodeId:null,malformed:!0},kt={nodeId:null,malformed:!1};function U(e){return Et.test(e)}function At(e){let t=e.indexOf(`#`),n=t===-1?e:e.slice(0,t),r=n.indexOf(`?`),i=r===-1?n:n.slice(0,r);return{pathname:i,suffix:e.slice(i.length)}}function jt(e){let{pathname:t,suffix:n}=At(e);if(t!==H&&!t.startsWith(`${H}/`))return{routed:kt,logicalHref:e};let r=t.slice(6),i=r.indexOf(`/`),a=i===-1?r:r.slice(0,i);if(!U(a))return{routed:Ot,logicalHref:`/`};let o=i===-1?`/`:r.slice(i)||`/`;return{routed:{nodeId:a,malformed:!1},logicalHref:`${o}${n}`}}var Mt=new Set([`sign-in`,`sign-up`,`public-signup`,`password-reset`,`invitation`,`setup`,`email-verification`,`nodes`,`account`]),W=()=>null;function Nt(e){return W=e,()=>{W===e&&(W=()=>null)}}function Pt(e){let t=/^\/([^/]+)\/[^/]+\/?$/u.exec(e)?.[1];if(!t||Mt.has(t)||t===`draft`||t===`node`)return null;try{return decodeURIComponent(t)}catch{return t}}function Ft(e){if(!e.startsWith(`/`))return!1;let t=e.slice(1).split(`/`,1)[0]??``;return Mt.has(t)}function It(e,t){let{pathname:n,suffix:r}=At(e);if(Ft(n))return e;let i=Pt(n),a=i?W(i)??t:t;return a===null||!U(a)?e:`${n===``||n===`/`?`${H}/${a}`:`${H}/${a}${n}`}${r}`}var G=Dt,Lt=new Set,K=null;function q(e){if(e.nodeId!==G.nodeId||e.malformed!==G.malformed||e.logicalPathname!==G.logicalPathname){G=e;for(let e of Array.from(Lt))e()}}function Rt(e){let{pathname:t}=At(e);return t===``?`/`:t}function zt(){return G}function Bt(e){return Lt.add(e),()=>{Lt.delete(e)}}function Vt(e,t){let n=e.indexOf(`#`),r=n===-1?e:e.slice(0,n),i=r.indexOf(`?`);return{href:e,pathname:i===-1?r:r.slice(0,i),search:i===-1?``:r.slice(i),hash:n===-1?``:e.slice(n),state:t??{__TSR_index:0}}}function Ht(e=window){let t=se({window:e,parseLocation:()=>{let t=jt(`${e.location.pathname}${e.location.search}${e.location.hash}`);return q({...t.routed,logicalPathname:Rt(t.logicalHref)}),Vt(t.logicalHref,e.history.state)},createHref:e=>It(e,G.nodeId)}),n=t.subscribe(({location:e,action:t})=>{if(t.type!==`PUSH`&&t.type!==`REPLACE`)return;let n=jt(It(e.href,G.nodeId));q({...n.routed,logicalPathname:Rt(n.logicalHref)})}),r=t.destroy.bind(t);return t.destroy=()=>{n(),r()},K=t,t}function Ut(){return K}function Wt(e){let t=K;return!t||!U(e)?!1:(q({nodeId:e,malformed:!1,logicalPathname:`/`}),t.push(`/`),!0)}function Gt(e){let t=K;return!t||!U(e)?!1:(q({nodeId:e,malformed:!1,logicalPathname:G.logicalPathname}),t.replace(t.location.href),!0)}function Kt(){let e=K;return e?(q({nodeId:null,malformed:!1,logicalPathname:`/nodes`}),e.push(`/nodes`),!0):!1}function qt(){let e=K;e&&(q(Dt),e.replace(`/`))}var Jt=25e3,Yt=he;function Xt(e,t){switch(t.type){case`interactive`:return JSON.stringify([e,t.type]);case`thread-detail`:return JSON.stringify([e,t.type,t.threadId]);case`vcs-status`:return JSON.stringify([e,t.type,t.cwd]);case`provider-status`:return JSON.stringify([e,t.type,t.instanceId??null])}}function Zt(){let e=new Map,t=new Set,n=()=>{for(let e of Array.from(t))e()};return{retain(t,r){let i=Xt(t,r),a=e.get(i);e.set(i,{key:i,environmentId:t,scope:r,refCount:(a?.refCount??0)+1}),a||n();let o=!1;return()=>{if(o)return;o=!0;let t=e.get(i);if(t){if(t.refCount>1){e.set(i,{...t,refCount:t.refCount-1});return}e.delete(i),n()}}},list:()=>Array.from(e.values()),subscribe(e){return t.add(e),()=>t.delete(e)},reset(){e.size!==0&&(e.clear(),n())}}}var J=Zt();function Qt(e,t){return J.retain(e,{type:`thread-detail`,threadId:t})}function $t(e,t){return J.retain(e,{type:`vcs-status`,cwd:t})}function en(e,t){return J.retain(e,{type:`provider-status`,...t?{instanceId:t}:{}})}function tn(e){let t=ge(1),n=[],r=Promise.resolve(),i=!1,a=0,o=new Map,s=new Set,c=()=>{for(let e of Array.from(s))e()},l=()=>{let n=new Map(e.scopes.list().map(e=>[e.key,e]));for(let[e,r]of Array.from(o))n.has(e)||(o.delete(e),t=xe(t,r));for(let[r,i]of n){let n=o.get(r);if(n){t=be(t,n,e.now(),Yt);continue}let s=`hosted-web-${++a}`;o.set(r,s),t=ye(t,{leaseId:s,environmentId:i.environmentId,scope:i.scope,now:e.now(),ttlMs:Yt})}},u=async()=>{if(i)return;l();let r=we(t,{now:e.now(),wakeStaggerMs:750});t=r.state,n=r.queued,c();for(let n of r.release)await e.release(n).catch(()=>void 0),t=L(t,n,!1,e.now());for(let n of r.connect)try{await e.connect(n.environmentId,n.delayMs),t=L(t,n.environmentId,!0,e.now())}catch{t=L(t,n.environmentId,!1,e.now())}n=we(t,{now:e.now(),wakeStaggerMs:750}).queued,c()},d=()=>{let e=r.catch(()=>void 0).then(u);return r=e.catch(()=>void 0),e},f=e.scopes.subscribe(()=>void d()),p=e.setInterval(()=>void d(),Jt);return{snapshot:()=>({demand:t,queuedEnvironmentIds:n,activeConnectionCount:t.connections.filter(e=>e.connected).length}),subscribe(e){return s.add(e),()=>s.delete(e)},reportConnected(n,r){t=L(t,n,r,e.now()),c()},setBackgrounded(e){return t=Se(t,e),d()},reconcile:d,dispose(){i||(i=!0,f(),e.clearInterval(p),s.clear())}}}var nn={machines:[],snapshots:[],projects:[],worktrees:[],threads:[],logicalProjects:[]},Y={status:`signed-out`,accountId:null,machines:[],workspace:nn,demand:{demand:ge(1),queuedEnvironmentIds:[],activeConnectionCount:0}},X=new Set,Z=null,Q=me();function rn(e){return Q.lease(e)}function an(e,t=3e4){let n=rn(e);return n?Promise.resolve(n):new Promise(n=>{let r=!1,i=e=>{r||(r=!0,globalThis.clearTimeout(o),a(),n(e))},a=Q.subscribe(()=>{let t=rn(e);t&&i(t)}),o=globalThis.setTimeout(()=>i(null),t)})}function on(e){Y=e;for(let e of Array.from(X))e()}function sn(){return Y}function cn(){return(0,R.useSyncExternalStore)(ln,sn,sn)}function ln(e){return X.add(e),()=>X.delete(e)}function $(e){return e.capabilities?.nativeClientRequired===!0}function un(e,t,n,r,i){return je(e.map(e=>({environmentId:e.environmentId,nodeId:e.id,label:e.label,platform:{os:e.platformOs,arch:e.platformArch},serverVersion:e.clientVersion,capabilities:{repositoryIdentity:e.capabilities?.repositoryIdentity??!0,threadSettlement:e.capabilities?.threadSettlement??!1,nativeClientRequired:e.capabilities?.nativeClientRequired??!1},clientTier:`hosted-web`,nativeTrust:`not-required`,requiresNativeVerification:!1,effectiveRole:e.effectiveRole,online:e.presence.online,lastSeenAt:e.presence.lastHeartbeatAt,observedAt:i,connectionState:e.environmentId===t&&n?`connected`:`disconnected`,deliveryUnknown:e.environmentId===t&&r,revokedAt:e.revokedAt})))}function dn(e){let t=e?.cache??Tt(),n=e?.now??Date.now,r=e?.setTimeout??((e,t)=>globalThis.setTimeout(e,t)),i=e?.clearTimeout??(e=>globalThis.clearTimeout(e)),a=e?.setInterval??((e,t)=>globalThis.setInterval(e,t)),o=e?.clearInterval??(e=>globalThis.clearInterval(e)),s=e?.hubOrigin??window.location.origin,c=new Map,l=null,f=null,p=null,m=!1,h=0,g=null,_=tn({scopes:J,now:n,setInterval:a,clearInterval:o,connect:async(e,t)=>{t>0&&await new Promise(e=>r(e,t));let n=D.getState();if(n.directoryStatus!==`ready`||n.browserStatus!==`current`)throw Error(`Hosted Web directory is not current.`);let i=n.nodes.find(t=>t.environmentId===e&&t.revokedAt===null&&t.presence.online&&!$(t));if(!i)throw Error(`Hosted Web environment is not eligible.`);await E.selectNode(i.id)},release:async e=>{D.getState().selectedNode?.environmentId===e&&await E.returnToDirectory()}});Z=_;let v=e=>{let t=D.getState(),n=t.accountStatus===`authenticated`?t.directoryStatus===`ready`?`ready`:t.directoryStatus===`stale`?`stale`:`loading`:`signed-out`,r=t.selectedNode?.environmentId??null,i=r===null?void 0:c.get(r);Q.update({environmentId:r,snapshotGeneration:i?.capturedAt??0,effectiveRole:t.effectiveRole,directoryReady:t.directoryStatus===`ready`&&t.browserStatus===`current`,relayReady:t.transportStatus===`online`&&t.sessionEstablished&&r!==null,shellReady:i!==void 0&&e.some(e=>e.environmentId===r&&e.connectionState===`connected`&&e.canMutate)}),on({status:n,accountId:t.account?.id??null,machines:e,workspace:Ne({machines:e,snapshots:Array.from(c.values())}),demand:_.snapshot()})},y=async()=>{let e=++h,r=D.getState(),i=r.accountStatus===`authenticated`?r.account?.id??null:null,a=i?JSON.stringify([s,i]):null,o=f;if(f=i,o&&i!==o&&(await t.purgeAccount({hubOrigin:s,accountId:o}).catch(()=>void 0),c.clear(),J.reset(),u()),!i){l=null,v([]);return}if(a!==l&&r.directoryStatus===`ready`){l=a;let n=await t.list({hubOrigin:s,accountId:i});if(m||e!==h)return;let o=new Set(r.nodes.filter(e=>e.revokedAt===null&&!$(e)).map(e=>e.environmentId));for(let e of n){if(!o.has(e.namespace.environmentId)){await t.purgeEnvironment(e.namespace).catch(()=>void 0);continue}c.set(e.namespace.environmentId,e.snapshot),d.getState().hydrateEnvironmentStateFromCache(k(e.snapshot),e.namespace.environmentId)}}let p=r.selectedNode?.environmentId??null,y=p!==null&&r.transportStatus!==`idle`&&r.transportStatus!==`terminal-failure`,b=r.transportStatus===`online`&&r.sessionEstablished;g&&g!==p&&_.reportConnected(g,!1),p&&_.reportConnected(p,y),g=p;let x=un(r.nodes,p,b,r.sessionStatus===`delivery-unknown`,n()),S=new Map(x.map(e=>[e.environmentId,e]));if(r.directoryStatus===`ready`)for(let[e]of Array.from(c))S.get(e)?.cacheDisposition!==`available`&&(c.delete(e),d.getState().removeEnvironmentState(e),await t.purgeEnvironment({hubOrigin:s,accountId:i,environmentId:e}).catch(()=>void 0));m||e!==h||v(x)},b=()=>{p!==null&&i(p),p=r(()=>{if(p=null,m||!f)return;let e=Y.machines;for(let r of e){if(!r.canReadMetadata)continue;let e=N(r.environmentId,n(),r.deliveryUnknown);e&&(c.set(r.environmentId,e),t.replace({namespace:{hubOrigin:s,accountId:f,environmentId:r.environmentId},snapshot:e,payloadBytes:j(e),updatedAt:n()}).catch(()=>void 0))}v(e)},100)},x=D.subscribe(()=>void y()),S=d.subscribe(b),C=_.subscribe(()=>v(Y.machines)),w=Nt(mn);return _.reconcile(),y(),()=>{m=!0,h+=1,p!==null&&i(p),x(),S(),C(),w(),_.dispose(),Z===_&&(Z=null,Q.update({environmentId:null,snapshotGeneration:0,effectiveRole:null,directoryReady:!1,relayReady:!1,shellReady:!1}),on({status:`signed-out`,accountId:null,machines:[],workspace:nn,demand:_.snapshot()}))}}function fn(e){return Z?.setBackgrounded(e)??Promise.resolve()}function pn(){return Z!==null}function mn(e){return D.getState().nodes.find(t=>t.environmentId===e&&t.revokedAt===null&&!$(t))?.id??null}function hn(){let e=d(te(e=>l(e))),t=h(e=>({sidebarProjectGroupingMode:e.sidebarProjectGroupingMode,sidebarProjectGroupingOverrides:e.sidebarProjectGroupingOverrides,defaultAgentTokenMode:e.defaultAgentTokenMode})),n=T(),r=(0,R.useCallback)(e=>{let t=mn(e);t&&Gt(t)},[]),o=(0,R.useCallback)(()=>{let e=n.state.matches[n.state.matches.length-1]?.params??{};return w(e)},[n]),s=(0,R.useCallback)((c,l)=>{if(mn(c.environmentId)!==null&&(r(c.environmentId),rn(c.environmentId)===null))return an(c.environmentId).then(e=>{if(e!==null)return s(c,l)});let{getDraftSessionByLogicalProjectKey:u,getDraftSession:d,getDraftThread:f,applyStickyState:p,setDraftThreadContext:m,setLogicalProjectDraftThreadId:h}=y.getState(),g=o(),v=e.find(e=>e.id===c.projectId&&e.environmentId===c.environmentId),S=v?_(v,t):i(c),C=l?.branch!==void 0,w=l?.worktreePath!==void 0,T=l?.envMode!==void 0,E=u(S),D=g?g.kind===`server`?f(g.threadRef):d(g.draftId):null;if(E)return(async()=>{(C||w||T)&&m(E.draftId,{...C?{branch:l?.branch??null}:{},...w?{worktreePath:l?.worktreePath??null}:{},...T?{envMode:l?.envMode}:{}}),h(S,c,E.draftId,{threadId:E.threadId}),(g?.kind!==`draft`||g.draftId!==E.draftId)&&(r(c.environmentId),await n.navigate({to:`/draft/$draftId`,params:{draftId:E.draftId}}))})();if(D&&g?.kind===`draft`&&D.logicalProjectKey===S&&D.promotedTo==null)return(C||w||T)&&m(g.draftId,{...C?{branch:l?.branch??null}:{},...w?{worktreePath:l?.worktreePath??null}:{},...T?{envMode:l?.envMode}:{}}),h(S,c,g.draftId,{threadId:D.threadId,createdAt:D.createdAt,runtimeMode:D.runtimeMode,interactionMode:D.interactionMode,tokenMode:D.tokenMode??`balanced`,...C?{branch:l?.branch??null}:{},...w?{worktreePath:l?.worktreePath??null}:{},...T?{envMode:l?.envMode}:{}}),Promise.resolve();let O=b(),k=x(),A=new Date().toISOString();return(async()=>{h(S,c,O,{threadId:k,createdAt:A,branch:l?.branch??null,worktreePath:l?.worktreePath??null,envMode:l?.envMode??`local`,runtimeMode:a,tokenMode:t.defaultAgentTokenMode??`balanced`}),p(O),r(c.environmentId),await n.navigate({to:`/draft/$draftId`,params:{draftId:O}})})()},[r,o,t,n,e]);return s}function gn(){let e=(0,Pe.c)(2),t=hn(),n;return e[0]===t?n=e[1]:(n={handleNewThread:t},e[0]=t,e[1]=n),n}function _n(){let e=(0,Pe.c)(27),t=O(wn),n=h(Cn),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={strict:!1,select:Sn},e[0]=r):r=e[0];let i=C(r),a=i?.kind===`server`?i.threadRef:null,o;e[1]===a?o=e[2]:(o=m(a),e[1]=a,e[2]=o);let s=d(o),c=y(xn),l;e[3]!==c||e[4]!==i?(l=()=>i?i.kind===`server`?c(i.threadRef):y.getState().getDraftSession(i.draftId):null,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=y(l),f=d(te(bn)),v;e[6]!==t||e[7]!==f?(v=tt({items:f,preferredIds:t,getId:g}),e[6]=t,e[7]=f,e[8]=v):v=e[8];let b=v,x=hn(),S=ee(),w=cn(),T=p(yn),E;e[9]!==S||e[10]!==w.machines||e[11]!==w.status?(E=w.status===`signed-out`?{machines:S.machines,ready:S.status===`ready`,localEnvironmentId:S.localEnvironmentId}:{machines:w.machines.map(vn),ready:w.status===`ready`,localEnvironmentId:null},e[9]=S,e[10]=w.machines,e[11]=w.status,e[12]=E):E=e[12];let D=E,k;e[13]===n?k=e[14]:(k=e=>_(e,n),e[13]=n,e[14]=k);let A;e[15]!==w.status||e[16]!==b||e[17]!==T||e[18]!==k||e[19]!==D?(A=gt({orderedProjects:b,...D,logicalKey:k,...w.status===`signed-out`?{}:{preferredEnvironmentId:T}}),e[15]=w.status,e[16]=b,e[17]=T,e[18]=k,e[19]=D,e[20]=A):A=e[20];let j=A,M=T!==null&&s?.environmentId!==T?void 0:s,N=T!==null&&u?.environmentId!==T?null:u,P;return e[21]!==N||e[22]!==M||e[23]!==j||e[24]!==x||e[25]!==a?(P={activeDraftThread:N,activeThread:M,defaultProjectRef:j,handleNewThread:x,routeThreadRef:a},e[21]=N,e[22]=M,e[23]=j,e[24]=x,e[25]=a,e[26]=P):P=e[26],P}function vn(e){return{...e,online:e.presence.online}}function yn(e){return e.selectedNode?.environmentId??null}function bn(e){return l(e)}function xn(e){return e.getDraftThread}function Sn(e){return w(e)}function Cn(e){return{sidebarProjectGroupingMode:e.sidebarProjectGroupingMode,sidebarProjectGroupingOverrides:e.sidebarProjectGroupingOverrides}}function wn(e){return e.projectOrder}export{ft as A,We as B,Re as C,Qe as D,lt as E,dt as F,rt as G,ot as H,it as I,ce as J,Ye as K,at as L,$e as M,et as N,tt as O,ut as P,Ze as R,He as S,nt as T,Ve as U,Ge as V,ht as W,I as Y,Kt as _,fn as a,Le as b,en as c,Gt as d,qt as f,Ht as g,zt as h,$ as i,st as j,ct as k,Qt as l,Ut as m,gn as n,dn as o,Wt as p,se as q,pn as r,cn as s,_n as t,$t as u,Bt as v,pt as w,ze as x,Ie as y,Ke as z};
1
+ import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{g as r,v as i}from"./env-B4arEvJg.js";import{z as a}from"./src-Vf4LVnMX.js";import{At as o,C as s,E as c,Ft as l,I as u,Jt as d,Mt as f,N as p,Ot as m,Rn as h,S as g,b as _,jt as v}from"./runtime-DfGHeCnR.js";import{i as y}from"./composerDraftStore-CdJJZe42.js";import{d as b,u as x}from"./useSwipeDismiss-CbgDJvw1.js";import{t as S}from"./useRouter-CcIDS3PN.js";import{o as C,s as w}from"./authorization-mIJKV2yp.js";import{i as T}from"./uiStateStore-B6pjzSjj.js";import{c as E,d as D,f as O,l as k,o as ee,s as A,u as j}from"./desktopWorkspace-B-cSBe8H.js";import{t as te}from"./shallow-DWZCFNun.js";import{a as M,c as N,t as P}from"./utils-BofFIn5Y.js";import{p as ne}from"./session-logic-wxhvMgEN.js";import"./storeSelectors-Bpr2pdhU.js";var F=`__TSR_index`,re=`popstate`,ie=`beforeunload`;function ae(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=I(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[F];i=oe(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[F];i=oe(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[F]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function oe(e,t){t||={};let n=ue();return{...t,key:n,__TSR_key:n,[F]:e}}function se(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>I(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=ue();t.history.replaceState({[F]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(e,t,n)=>{let r=s(t),i=!!g;i||(u=l),l=I(t,n),g=[r,n,g?.[2]||e],i||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(f){f=!1;return}let e=c(),n=e.state[F]-l.state[F],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=ae({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(ie,x,{capture:!0}),t.removeEventListener(re,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(ie,x,{capture:!0}),t.addEventListener(re,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function ce(e){let t=e?.window??(typeof document<`u`?window:void 0);return se({window:t,parseLocation:()=>{let e=t.location.hash.split(`#`).slice(1),n=e[0]??`/`,r=t.location.search,i=e.slice(1);return I(`${n}${r}${i.length===0?``:`#${i.join(`#`)}`}`,t.history.state)},createHref:e=>`${t.location.pathname}${t.location.search}#${e}`})}function le(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function I(e,t){let n=le(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=ue();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[F]:0,key:a,__TSR_key:a}}}function ue(){return(Math.random()+1).toString(36).substring(7)}function de(e){return Number.isSafeInteger(e)&&e>=0}function fe(e){return e.environmentId===null||!de(e.selectionGeneration)||!de(e.snapshotGeneration)||e.effectiveRole!==`owner`||!e.directoryReady||!e.relayReady||!e.shellReady?null:{environmentId:e.environmentId,selectionGeneration:e.selectionGeneration,snapshotGeneration:e.snapshotGeneration,effectiveRole:e.effectiveRole,directoryReady:!0,relayReady:!0,shellReady:!0}}function pe(e,t,n){let r=fe(n);return r!==null&&e.environmentId===t&&r.environmentId===t&&e.selectionGeneration===r.selectionGeneration&&e.snapshotGeneration===r.snapshotGeneration&&e.effectiveRole===r.effectiveRole}function me(){let e=new Set,t={environmentId:null,selectionGeneration:0,snapshotGeneration:0,effectiveRole:null,directoryReady:!1,relayReady:!1,shellReady:!1};return{update(n){let r=t.environmentId!==n.environmentId||t.effectiveRole!==n.effectiveRole||t.directoryReady!==n.directoryReady||t.relayReady!==n.relayReady||t.shellReady!==n.shellReady;t={...n,selectionGeneration:r?t.selectionGeneration+1:t.selectionGeneration};for(let t of Array.from(e))t()},read:()=>t,lease(e){let n=fe(t);return n?.environmentId===e?n:null},validate:(e,n)=>pe(e,n,t),subscribe(t){return e.add(t),()=>e.delete(t)}}}var he=45e3;function ge(e){if(!Number.isInteger(e)||e<1||e>3)throw RangeError(`platformMaxConnections must be between 1 and 3`);return{platformMaxConnections:e,backgrounded:!1,leases:[],connections:[]}}function _e(e,t,n){let r=e.connections.find(e=>e.environmentId===t)??{environmentId:t,connected:!1,lastAccessedAt:0};return{...e,connections:[...e.connections.filter(e=>e.environmentId!==t),n(r)]}}function ve(e,t,n){return _e(e,t,e=>({...e,lastAccessedAt:Math.max(e.lastAccessedAt,n)}))}function L(e,t,n,r){return _e(e,t,e=>({...e,connected:n,lastAccessedAt:Math.max(e.lastAccessedAt,r)}))}function ye(e,t){if(t.leaseId.length===0)throw TypeError(`leaseId must not be empty`);if(e.leases.some(e=>e.leaseId===t.leaseId))throw Error(`Duplicate workspace connection lease: ${t.leaseId}`);let n=t.ttlMs??45e3;if(!Number.isFinite(n)||n<=0)throw RangeError(`ttlMs must be positive`);return ve({...e,leases:[...e.leases,{leaseId:t.leaseId,environmentId:t.environmentId,scope:t.scope,retainedAt:t.now,expiresAt:t.now+n}]},t.environmentId,t.now)}function be(e,t,n,r=he){if(!Number.isFinite(r)||r<=0)throw RangeError(`ttlMs must be positive`);return{...e,leases:e.leases.map(e=>e.leaseId===t?{...e,expiresAt:n+r}:e)}}function xe(e,t){return{...e,leases:e.leases.filter(e=>e.leaseId!==t)}}function Se(e,t){return e.backgrounded===t?e:{...e,backgrounded:t}}function Ce(e,t){let n=e.leases.filter(e=>e.expiresAt>t);return n.length===e.leases.length?e:{...e,leases:n}}function we(e,t){let n=Ce(e,t.now),r=new Map;for(let e of n.leases)r.set(e.environmentId,Math.max(r.get(e.environmentId)??0,e.retainedAt));let i=Array.from(r.keys()),a=new Set(i),o=n.connections.filter(e=>e.connected),s=new Set(o.map(e=>e.environmentId)),c=o.filter(e=>!a.has(e.environmentId)).toSorted((e,t)=>e.lastAccessedAt-t.lastAccessedAt||String(e.environmentId).localeCompare(String(t.environmentId))),l=i.filter(e=>!s.has(e)).toSorted((e,t)=>(r.get(t)??0)-(r.get(e)??0)||String(e).localeCompare(String(t))),u=[];if(n.backgrounded)return u.push(...c.map(e=>e.environmentId)),{state:n,retain:i.filter(e=>s.has(e)),release:u,connect:[],queued:l};let d=o.length,f=[...c];for(;f.length>0&&(d>n.platformMaxConnections||d+l.length>n.platformMaxConnections);){let e=f.shift();u.push(e.environmentId),--d}let p=Math.max(0,n.platformMaxConnections-d),m=l.slice(0,p),h=Math.max(0,t.wakeStaggerMs??0);return{state:n,retain:i.filter(e=>s.has(e)),release:u,connect:m.map((e,t)=>({environmentId:e,delayMs:t*h})),queued:l.slice(m.length)}}function Te(e){return e.online&&e.canMutate&&(e.nativeTrust===`verified`||e.nativeTrust===`not-required`)}function Ee(e){return{environmentId:e.environmentId,projectId:e.projectId,physicalKey:e.physicalKey,machineLabel:e.machineLabel}}function De(e){if(e.override){let t=e.override,n=e.project.variants.find(e=>e.environmentId===t.environmentId&&e.projectId===t.projectId);return n?Te(n)?{status:`resolved`,target:Ee(n),source:`override`}:{status:`unavailable`,message:`No verified machine available`,reason:`override-unavailable`}:{status:`unavailable`,message:`No verified machine available`,reason:`override-not-in-project`}}let t=e.project.variants.filter(Te);if(t.length===0)return{status:`unavailable`,message:`No verified machine available`,reason:`no-eligible-variant`};let n=t.toSorted((e,t)=>{let n=e.lastUsedAt??-1/0,r=t.lastUsedAt??-1/0;return n===r?e.localDesktop===t.localDesktop?String(e.environmentId).localeCompare(String(t.environmentId)):e.localDesktop?-1:1:r-n})[0],r=Math.max(...t.map(e=>e.lastUsedAt??-1/0)),i=Number.isFinite(r)&&n.lastUsedAt===r?`recent`:n.localDesktop?`local-desktop`:`stable`;return{status:`resolved`,target:Ee(n),source:i}}var Oe={os:`unknown`,arch:`other`};function ke(e){return Array.from(new Set(e.filter(e=>e!==null)))}function Ae(e){let t=e.revokedAt!=null,n=e.removed===!0,r=e.clientTier===`hosted-web`&&e.capabilities?.nativeClientRequired===!0,i=e.clientTier===`native`&&e.requiresNativeVerification&&e.nativeTrust===`unknown`,a=e.clientTier===`native`&&e.requiresNativeVerification&&e.nativeTrust===`unverified`,o=e.nativeTrust===`identity-conflict`,s=e.clientTier===`hosted-web`?!r:!e.requiresNativeVerification||e.nativeTrust===`verified`,c=!t&&!n&&s&&!o,l=c&&e.online,u=l&&e.effectiveRole!==null&&e.effectiveRole!==`viewer`,d=ke([t?`revoked`:null,n?`removed`:null,r?`native-client-required`:null,i?`trust-unknown`:null,a?`not-verified`:null,o?`identity-conflict`:null,e.online?null:`offline`,e.effectiveRole===null?`role-unknown`:null,e.effectiveRole===`viewer`?`viewer`:null]);return{environmentId:e.environmentId,nodeId:e.nodeId??null,label:e.label,platform:e.platform??Oe,serverVersion:e.serverVersion??null,capabilities:{repositoryIdentity:e.capabilities?.repositoryIdentity??!1,nativeClientRequired:e.capabilities?.nativeClientRequired??!1,threadSettlement:e.capabilities?.threadSettlement??!1},clientTier:e.clientTier,nativeTrust:e.nativeTrust,effectiveRole:e.effectiveRole,presence:{online:e.online,lastSeenAt:e.lastSeenAt,observedAt:e.observedAt},connectionState:e.connectionState??`disconnected`,deliveryUnknown:e.deliveryUnknown??!1,revokedAt:e.revokedAt??null,removed:n,canReadMetadata:c,canConnect:l,canMutate:u,cacheDisposition:t||n||r||i||a?`purge`:o?`locked-stale`:`available`,accessReasons:d}}function je(e){let t=new Map;for(let n of e)t.set(n.environmentId,Ae(n));return Array.from(t.values()).toSorted((e,t)=>e.label.localeCompare(t.label)||String(e.environmentId).localeCompare(String(t.environmentId)))}function Me(e){if(e===null)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function Ne(e){let t=new Map(e.machines.map(e=>[e.environmentId,e])),n=new Map;for(let t of e.snapshots){let e=n.get(t.environmentId);(!e||t.capturedAt>e.capturedAt)&&n.set(t.environmentId,t)}let r=[],i=[];for(let[e,a]of n){let n=t.get(e);if(!(!n||n.cacheDisposition===`purge`)){if(n.cacheDisposition===`locked-stale`){i.push({status:`locked-stale`,environmentId:e,capturedAt:a.capturedAt});continue}n.canReadMetadata&&(i.push({status:`available`,snapshot:a}),r.push(a))}}let a=r.flatMap(e=>e.projects),o=r.flatMap(e=>e.worktrees),l=r.flatMap(e=>{let n=t.get(e.environmentId);return e.threads.map(e=>({...e,deliveryUnknown:e.deliveryUnknown||n?.deliveryUnknown===!0}))}),u=a.flatMap(n=>{let r=t.get(n.environmentId);if(!r)return[];let i=s(n);return[{environmentId:n.environmentId,projectId:n.id,physicalKey:i,name:n.name,cwd:n.cwd,repositoryIdentity:n.repositoryIdentity,machineLabel:r.label,online:r.presence.online,canMutate:r.canMutate,nativeTrust:r.nativeTrust,effectiveRole:r.effectiveRole,lastUsedAt:e.lastUsedAtByPhysicalProjectKey?.[i]??null,lastLiveAt:Me(n.updatedAt)??r.presence.lastSeenAt,localDesktop:e.localDesktopEnvironmentId===n.environmentId}]});return{machines:e.machines,snapshots:i.toSorted((e,t)=>{let n=e.status===`available`?e.snapshot.environmentId:e.environmentId,r=t.status===`available`?t.snapshot.environmentId:t.environmentId;return String(n).localeCompare(String(r))}),projects:a,worktrees:o,threads:l,logicalProjects:c(u)}}var R=e(t(),1),Pe=n(),Fe=`[data-thread-item], [data-thread-selection-safe]`,Ie=`phone:pointer-coarse:size-8 phone:pointer-coarse:after:absolute phone:pointer-coarse:after:top-1/2 phone:pointer-coarse:after:left-1/2 phone:pointer-coarse:after:size-11 phone:pointer-coarse:after:-translate-x-1/2 phone:pointer-coarse:after:-translate-y-1/2`,Le=`phone:pointer-coarse:relative ${Ie}`;function Re(e){if(e.manualBucket!==null)return e.manualBucket;switch(e.statusPill?.label){case`Working`:case`Monitoring`:case`Connecting`:return`in_progress`;case`Plan Ready`:case`Pending Approval`:case`Awaiting Input`:return`review`;case`Completed`:return`done`;default:return`idle`}}function ze(e){return e.includes(`in_progress`)?`in_progress`:e.includes(`review`)?`review`:e.length>0&&e.every(e=>e===`done`)?`done`:`idle`}var Be=6048e5;function Ve(e){if(e.buckets.length===0||!e.buckets.every(e=>e===`done`)||!e.latestUpdatedAt)return!1;let t=Date.parse(e.latestUpdatedAt);return!Number.isNaN(t)&&e.nowMs-t>=Be}function He(e){return e.latestUserMessageAt!==null}function Ue(e){return e.latestUserMessageAt!==null}function We(e){return e.confirmThreadDelete&&Ue(e.thread)}function Ge(e){for(let t of e.threads)if(t&&We({confirmThreadDelete:e.confirmThreadDelete,thread:t}))return!0;return!1}function Ke(e){return e.archiveAvailable&&e.confirmThreadArchive}var qe={"Pending Approval":6,"Awaiting Input":5,Working:4,Connecting:4,"Plan Ready":3,Monitoring:2,Completed:1};function Je(e){let t=e.setTimeoutFn??globalThis.setTimeout,n=e.clearTimeoutFn??globalThis.clearTimeout,r=!1,i=null,a=()=>{i!==null&&(n(i),i=null)};return{sync:n=>{if(!n){a(),r&&(r=!1,e.onVisibilityChange(!1));return}r||i!==null||(i=t(()=>{i=null,r=!0,e.onVisibilityChange(!0)},e.delayMs))},dispose:()=>{a()}}}function Ye(){let[e,t]=R.useState(!1),n=R.useRef(null);return R.useEffect(()=>{let e=Je({delayMs:100,onVisibilityChange:e=>{t(e)},setTimeoutFn:window.setTimeout.bind(window),clearTimeoutFn:window.clearTimeout.bind(window)});return n.current=e,()=>{e.dispose(),n.current=null}},[]),{showThreadJumpHints:e,updateThreadJumpHintsVisibility:R.useCallback(e=>{n.current?.sync(e)},[])}}function Xe(e){if(!e.latestTurn?.completedAt)return!1;let t=Date.parse(e.latestTurn.completedAt);if(Number.isNaN(t))return!1;if(!e.lastVisitedAt)return!0;let n=Date.parse(e.lastVisitedAt);return Number.isNaN(n)?!0:t>n}function Ze(e){return e===null||!e.closest(Fe)}function Qe(e){return e>1}function $e(e){return e.requestedEnvMode??e.defaultEnvMode}function et(e){return e.defaultEnvMode===`worktree`?{envMode:`worktree`}:e.activeDraftThread?.projectId===e.projectId?{branch:e.activeDraftThread.branch,worktreePath:e.activeDraftThread.worktreePath,envMode:e.activeDraftThread.envMode}:e.activeThread?.projectId===e.projectId?{branch:e.activeThread.branch,worktreePath:e.activeThread.worktreePath,envMode:e.activeThread.worktreePath?`worktree`:`local`}:{envMode:e.defaultEnvMode}}function tt(e){let{getId:t,items:n,preferredIds:r}=e;if(r.length===0)return[...n];let i=new Map(n.map(e=>[t(e),e])),a=new Set(r),o=new Set,s=r.flatMap(e=>{if(o.has(e))return[];let t=i.get(e);return t?(o.add(e),[t]):[]}),c=n.filter(e=>!a.has(t(e)));return[...s,...c]}function nt(e,t=10){return e.slice(0,Math.max(0,t))}function rt(e){let t=v(e.threads,e.sortOrder);return e.pinnedThreadKeys.size===0?t:t.toSorted((t,n)=>{let r=e.pinnedThreadKeys.has(e.getThreadKey(t));return r===e.pinnedThreadKeys.has(e.getThreadKey(n))?0:r?-1:1})}function it(e){return e<=80}function at(e){return e.projectCount<=80&&e.visibleThreadCount<=120}function ot(e){return e.explorerOpen||e.projectVisible}function st(e,t){let n=null;for(let r of e){let e=t(r);if(e!==null){if(n===null){n=e;continue}if(n.environmentId!==e.environmentId||n.cwd!==e.cwd)return{kind:`mixed`}}}return n===null?{kind:`none`}:{kind:`shared`,target:n}}function ct(e){let{currentThreadId:t,direction:n,threadIds:r}=e;if(r.length===0)return null;if(t===null)return n===`previous`?r.at(-1)??null:r[0]??null;let i=r.indexOf(t);return i===-1?null:n===`previous`?i>0?r[i-1]??null:null:i<r.length-1?r[i+1]??null:null}function lt(e){return e.button===2||e.isMac&&e.button===0&&e.ctrlKey}function ut(e){let t=`h-7 w-full translate-x-0 cursor-pointer justify-start px-2 text-left select-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`;return e.isSelected&&e.isActive?P(t,`bg-primary/22 text-foreground font-medium hover:bg-primary/26 hover:text-foreground dark:bg-primary/30 dark:hover:bg-primary/36`):e.isSelected?P(t,`bg-primary/15 text-foreground hover:bg-primary/19 hover:text-foreground dark:bg-primary/22 dark:hover:bg-primary/28`):e.isActive?P(t,`bg-accent/85 text-foreground font-medium hover:bg-accent hover:text-foreground dark:bg-accent/55 dark:hover:bg-accent/70`):P(t,`text-muted-foreground hover:bg-accent hover:text-foreground`)}function dt(e){let{thread:t}=e;return t.hasPendingApprovals?{label:`Pending Approval`,colorClass:`text-amber-600 dark:text-amber-300/90`,dotClass:`bg-amber-500 dark:bg-amber-300/90`,pulse:!1}:t.hasPendingUserInput?{label:`Awaiting Input`,colorClass:`text-indigo-600 dark:text-indigo-300/90`,dotClass:`bg-indigo-500 dark:bg-indigo-300/90`,pulse:!1}:t.session?.status===`running`?{label:`Working`,colorClass:`text-sky-600 dark:text-sky-300/80`,dotClass:`bg-sky-500 dark:bg-sky-300/80`,pulse:!0}:t.session?.status===`connecting`?{label:`Connecting`,colorClass:`text-sky-600 dark:text-sky-300/80`,dotClass:`bg-sky-500 dark:bg-sky-300/80`,pulse:!0}:!t.hasPendingUserInput&&t.interactionMode===`plan`&&ne(t.latestTurn,t.session)&&t.hasActionableProposedPlan?{label:`Plan Ready`,colorClass:`text-violet-600 dark:text-violet-300/90`,dotClass:`bg-violet-500 dark:bg-violet-300/90`,pulse:!1}:t.backgroundLiveness===`working`?{label:`Working`,colorClass:`text-sky-600 dark:text-sky-300/80`,dotClass:`bg-sky-500 dark:bg-sky-300/80`,pulse:!0}:t.backgroundLiveness===`monitoring`?{label:`Monitoring`,colorClass:`text-sky-600 dark:text-sky-300/80`,dotClass:`bg-sky-500 dark:bg-sky-300/80`,pulse:!0}:Xe(t)?{label:`Completed`,colorClass:`text-emerald-600 dark:text-emerald-300/90`,dotClass:`bg-emerald-500 dark:bg-emerald-300/90`,pulse:!1}:null}function ft(e){let t=null;for(let n of e)n!==null&&(t===null||qe[n.label]>qe[t.label])&&(t=n);return t}function pt(e){let{deletedThreadId:t,deletedThreadIds:n,sortOrder:r,threads:i}=e,a=i.find(e=>e.id===t);if(!a)return null;let o=i.filter(e=>e.id!==t&&!n?.has(e.id));return v(o.filter(e=>e.projectId===a.projectId),r)[0]?.id??v(o,r)[0]?.id??null}function mt(e,t,n){return t.length>0?t.reduce((e,t)=>Math.max(e,o(t,n)),-1/0):n===`created_at`?f(e.createdAt)??-1/0:f(e.updatedAt??e.createdAt)??-1/0}function ht(e,t,n){if(n===`manual`)return[...e];let r=new Map;for(let e of t){let t=r.get(e.projectId)??[];t.push(e),r.set(e.projectId,t)}return[...e].toSorted((e,t)=>{let i=mt(t,r.get(t.id)??[],n),a=mt(e,r.get(e.id)??[],n),o=i===a?0:i>a?1:-1;return o===0?e.name.localeCompare(t.name)||e.id.localeCompare(t.id):o})}function gt(e){if(e.preferredEnvironmentId!==void 0&&e.preferredEnvironmentId!==null){if(!e.ready)return null;let t=e.machines.find(t=>t.environmentId===e.preferredEnvironmentId);if(!t?.online||!t.canMutate)return null;let n=e.orderedProjects.find(t=>t.environmentId===e.preferredEnvironmentId);return n===void 0?null:r(n.environmentId,n.id)}let t=e.orderedProjects[0];if(!t)return null;if(!e.ready)return r(t.environmentId,t.id);let n=e.logicalKey(t),a=new Map(e.machines.map(e=>[e.environmentId,e])),o=e.orderedProjects.filter(t=>e.logicalKey(t)===n),s=De({project:{key:n,label:t.name,repositoryIdentity:t.repositoryIdentity??null,ambiguous:o.length>1,variants:o.flatMap(t=>{let n=a.get(t.environmentId);return n?[{environmentId:t.environmentId,projectId:t.id,physicalKey:i(r(t.environmentId,t.id)),name:t.name,cwd:t.cwd,repositoryIdentity:t.repositoryIdentity??null,machineLabel:n.label,online:n.online,canMutate:n.canMutate,nativeTrust:n.nativeTrust,effectiveRole:n.canMutate?`owner`:null,lastUsedAt:null,lastLiveAt:null,localDesktop:e.localEnvironmentId===t.environmentId}]:[]})}});return s.status===`resolved`?r(s.target.environmentId,s.target.projectId):null}var _t=`ryco:hosted-workspace-metadata:v1`,z=1;function B(e){try{return new URL(e).origin.toLowerCase()}catch{return e.replace(/\/+$/gu,``).toLowerCase()}}function vt(e){return{...e,hubOrigin:B(e.hubOrigin)}}function yt(e){return{...e,namespace:vt(e.namespace)}}function bt(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;return typeof t.hubOrigin==`string`&&t.hubOrigin.length>0&&t.hubOrigin.length<=2048&&typeof t.accountId==`string`&&t.accountId.length>0&&t.accountId.length<=2048&&typeof t.environmentId==`string`&&t.environmentId.length>0&&t.environmentId.length<=2048}function xt(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;return bt(t.namespace)&&k(t.snapshot,t.namespace.environmentId)&&Number.isSafeInteger(t.payloadBytes)&&t.payloadBytes===O(t.snapshot)&&Number.isSafeInteger(t.updatedAt)&&Number(t.updatedAt)>=0}function V(e){try{let t=e.getItem(_t);if(!t)return{version:z,records:[]};let n=JSON.parse(t);if(typeof n!=`object`||!n||Array.isArray(n))return{version:z,records:[]};let r=n;if(r.version!==z||!Array.isArray(r.records))return{version:z,records:[]};let i=new Map;for(let e of r.records){if(!xt(e))continue;let t=yt(e),n=D(t.namespace),r=i.get(n);(!r||t.updatedAt>r.updatedAt)&&i.set(n,t)}return{version:z,records:Array.from(i.values())}}catch{return{version:z,records:[]}}}function St(e,t){if(t.length===0){e.removeItem(_t);return}e.setItem(_t,JSON.stringify({version:z,records:t}))}function Ct(e){let t=Promise.resolve(),n=e=>{let n=t.then(e,e);return t=n.then(()=>void 0,()=>void 0),n};return{load:async t=>{let n=D(vt(t));return V(e).records.find(e=>D(e.namespace)===n)??null},list:async({hubOrigin:t,accountId:n})=>V(e).records.filter(e=>B(e.namespace.hubOrigin)===B(t)&&e.namespace.accountId===n),replace:t=>n(async()=>{if(!xt(t))throw TypeError(`Invalid hosted workspace metadata record.`);let n=yt(t),r=V(e),i=j({existing:r.records,incoming:n});if(!i.accepted)return;let a=D(n.namespace),o=new Set(i.evict.map(D));St(e,[...r.records.filter(e=>{let t=D(e.namespace);return t!==a&&!o.has(t)}),n])}),purgeEnvironment:t=>n(async()=>{let n=D(vt(t));St(e,V(e).records.filter(e=>D(e.namespace)!==n))}),purgeAccount:({hubOrigin:t,accountId:r})=>n(async()=>{St(e,V(e).records.filter(e=>B(e.namespace.hubOrigin)!==B(t)||e.namespace.accountId!==r))})}}var wt=null;function Tt(){return wt||=Ct(window.localStorage),wt}var H=`/node`,Et=/^[A-Za-z0-9_-]{1,128}$/,Dt={nodeId:null,malformed:!1,logicalPathname:`/`},Ot={nodeId:null,malformed:!0},kt={nodeId:null,malformed:!1};function U(e){return Et.test(e)}function At(e){let t=e.indexOf(`#`),n=t===-1?e:e.slice(0,t),r=n.indexOf(`?`),i=r===-1?n:n.slice(0,r);return{pathname:i,suffix:e.slice(i.length)}}function jt(e){let{pathname:t,suffix:n}=At(e);if(t!==H&&!t.startsWith(`${H}/`))return{routed:kt,logicalHref:e};let r=t.slice(6),i=r.indexOf(`/`),a=i===-1?r:r.slice(0,i);if(!U(a))return{routed:Ot,logicalHref:`/`};let o=i===-1?`/`:r.slice(i)||`/`;return{routed:{nodeId:a,malformed:!1},logicalHref:`${o}${n}`}}var Mt=new Set([`sign-in`,`sign-up`,`public-signup`,`password-reset`,`invitation`,`setup`,`email-verification`,`nodes`,`account`]),W=()=>null;function Nt(e){return W=e,()=>{W===e&&(W=()=>null)}}function Pt(e){let t=/^\/([^/]+)\/[^/]+\/?$/u.exec(e)?.[1];if(!t||Mt.has(t)||t===`draft`||t===`node`)return null;try{return decodeURIComponent(t)}catch{return t}}function Ft(e){if(!e.startsWith(`/`))return!1;let t=e.slice(1).split(`/`,1)[0]??``;return Mt.has(t)}function It(e,t){let{pathname:n,suffix:r}=At(e);if(Ft(n))return e;let i=Pt(n),a=i?W(i)??t:t;return a===null||!U(a)?e:`${n===``||n===`/`?`${H}/${a}`:`${H}/${a}${n}`}${r}`}var G=Dt,Lt=new Set,K=null;function q(e){if(e.nodeId!==G.nodeId||e.malformed!==G.malformed||e.logicalPathname!==G.logicalPathname){G=e;for(let e of Array.from(Lt))e()}}function Rt(e){let{pathname:t}=At(e);return t===``?`/`:t}function zt(){return G}function Bt(e){return Lt.add(e),()=>{Lt.delete(e)}}function Vt(e,t){let n=e.indexOf(`#`),r=n===-1?e:e.slice(0,n),i=r.indexOf(`?`);return{href:e,pathname:i===-1?r:r.slice(0,i),search:i===-1?``:r.slice(i),hash:n===-1?``:e.slice(n),state:t??{__TSR_index:0}}}function Ht(e=window){let t=se({window:e,parseLocation:()=>{let t=jt(`${e.location.pathname}${e.location.search}${e.location.hash}`);return q({...t.routed,logicalPathname:Rt(t.logicalHref)}),Vt(t.logicalHref,e.history.state)},createHref:e=>It(e,G.nodeId)}),n=t.subscribe(({location:e,action:t})=>{if(t.type!==`PUSH`&&t.type!==`REPLACE`)return;let n=jt(It(e.href,G.nodeId));q({...n.routed,logicalPathname:Rt(n.logicalHref)})}),r=t.destroy.bind(t);return t.destroy=()=>{n(),r()},K=t,t}function Ut(){return K}function Wt(e){let t=K;return!t||!U(e)?!1:(q({nodeId:e,malformed:!1,logicalPathname:`/`}),t.push(`/`),!0)}function Gt(e){let t=K;return!t||!U(e)?!1:(q({nodeId:e,malformed:!1,logicalPathname:G.logicalPathname}),t.replace(t.location.href),!0)}function Kt(){let e=K;return e?(q({nodeId:null,malformed:!1,logicalPathname:`/nodes`}),e.push(`/nodes`),!0):!1}function qt(){let e=K;e&&(q(Dt),e.replace(`/`))}var Jt=25e3,Yt=he;function Xt(e,t){switch(t.type){case`interactive`:return JSON.stringify([e,t.type]);case`thread-detail`:return JSON.stringify([e,t.type,t.threadId]);case`vcs-status`:return JSON.stringify([e,t.type,t.cwd]);case`provider-status`:return JSON.stringify([e,t.type,t.instanceId??null])}}function Zt(){let e=new Map,t=new Set,n=()=>{for(let e of Array.from(t))e()};return{retain(t,r){let i=Xt(t,r),a=e.get(i);e.set(i,{key:i,environmentId:t,scope:r,refCount:(a?.refCount??0)+1}),a||n();let o=!1;return()=>{if(o)return;o=!0;let t=e.get(i);if(t){if(t.refCount>1){e.set(i,{...t,refCount:t.refCount-1});return}e.delete(i),n()}}},list:()=>Array.from(e.values()),subscribe(e){return t.add(e),()=>t.delete(e)},reset(){e.size!==0&&(e.clear(),n())}}}var J=Zt();function Qt(e,t){return J.retain(e,{type:`thread-detail`,threadId:t})}function $t(e,t){return J.retain(e,{type:`vcs-status`,cwd:t})}function en(e,t){return J.retain(e,{type:`provider-status`,...t?{instanceId:t}:{}})}function tn(e){let t=ge(1),n=[],r=Promise.resolve(),i=!1,a=0,o=new Map,s=new Set,c=()=>{for(let e of Array.from(s))e()},l=()=>{let n=new Map(e.scopes.list().map(e=>[e.key,e]));for(let[e,r]of Array.from(o))n.has(e)||(o.delete(e),t=xe(t,r));for(let[r,i]of n){let n=o.get(r);if(n){t=be(t,n,e.now(),Yt);continue}let s=`hosted-web-${++a}`;o.set(r,s),t=ye(t,{leaseId:s,environmentId:i.environmentId,scope:i.scope,now:e.now(),ttlMs:Yt})}},u=async()=>{if(i)return;l();let r=we(t,{now:e.now(),wakeStaggerMs:750});t=r.state,n=r.queued,c();for(let n of r.release)await e.release(n).catch(()=>void 0),t=L(t,n,!1,e.now());for(let n of r.connect)try{await e.connect(n.environmentId,n.delayMs),t=L(t,n.environmentId,!0,e.now())}catch{t=L(t,n.environmentId,!1,e.now())}n=we(t,{now:e.now(),wakeStaggerMs:750}).queued,c()},d=()=>{let e=r.catch(()=>void 0).then(u);return r=e.catch(()=>void 0),e},f=e.scopes.subscribe(()=>void d()),p=e.setInterval(()=>void d(),Jt);return{snapshot:()=>({demand:t,queuedEnvironmentIds:n,activeConnectionCount:t.connections.filter(e=>e.connected).length}),subscribe(e){return s.add(e),()=>s.delete(e)},reportConnected(n,r){t=L(t,n,r,e.now()),c()},setBackgrounded(e){return t=Se(t,e),d()},reconcile:d,dispose(){i||(i=!0,f(),e.clearInterval(p),s.clear())}}}var nn={machines:[],snapshots:[],projects:[],worktrees:[],threads:[],logicalProjects:[]},Y={status:`signed-out`,accountId:null,machines:[],workspace:nn,demand:{demand:ge(1),queuedEnvironmentIds:[],activeConnectionCount:0}},X=new Set,Z=null,Q=me();function rn(e){return Q.lease(e)}function an(e,t=3e4){let n=rn(e);return n?Promise.resolve(n):new Promise(n=>{let r=!1,i=e=>{r||(r=!0,globalThis.clearTimeout(o),a(),n(e))},a=Q.subscribe(()=>{let t=rn(e);t&&i(t)}),o=globalThis.setTimeout(()=>i(null),t)})}function on(e){Y=e;for(let e of Array.from(X))e()}function sn(){return Y}function cn(){return(0,R.useSyncExternalStore)(ln,sn,sn)}function ln(e){return X.add(e),()=>X.delete(e)}function $(e){return e.capabilities?.nativeClientRequired===!0}function un(e,t,n,r,i){return je(e.map(e=>({environmentId:e.environmentId,nodeId:e.id,label:e.label,platform:{os:e.platformOs,arch:e.platformArch},serverVersion:e.clientVersion,capabilities:{repositoryIdentity:e.capabilities?.repositoryIdentity??!0,threadSettlement:e.capabilities?.threadSettlement??!1,nativeClientRequired:e.capabilities?.nativeClientRequired??!1},clientTier:`hosted-web`,nativeTrust:`not-required`,requiresNativeVerification:!1,effectiveRole:e.effectiveRole,online:e.presence.online,lastSeenAt:e.presence.lastHeartbeatAt,observedAt:i,connectionState:e.environmentId===t&&n?`connected`:`disconnected`,deliveryUnknown:e.environmentId===t&&r,revokedAt:e.revokedAt})))}function dn(e){let t=e?.cache??Tt(),n=e?.now??Date.now,r=e?.setTimeout??((e,t)=>globalThis.setTimeout(e,t)),i=e?.clearTimeout??(e=>globalThis.clearTimeout(e)),a=e?.setInterval??((e,t)=>globalThis.setInterval(e,t)),o=e?.clearInterval??(e=>globalThis.clearInterval(e)),s=e?.hubOrigin??window.location.origin,c=new Map,l=null,f=null,p=null,m=!1,h=0,g=null,_=tn({scopes:J,now:n,setInterval:a,clearInterval:o,connect:async(e,t)=>{t>0&&await new Promise(e=>r(e,t));let n=w.getState();if(n.directoryStatus!==`ready`||n.browserStatus!==`current`)throw Error(`Hosted Web directory is not current.`);let i=n.nodes.find(t=>t.environmentId===e&&t.revokedAt===null&&t.presence.online&&!$(t));if(!i)throw Error(`Hosted Web environment is not eligible.`);await C.selectNode(i.id)},release:async e=>{w.getState().selectedNode?.environmentId===e&&await C.returnToDirectory()}});Z=_;let v=e=>{let t=w.getState(),n=t.accountStatus===`authenticated`?t.directoryStatus===`ready`?`ready`:t.directoryStatus===`stale`?`stale`:`loading`:`signed-out`,r=t.selectedNode?.environmentId??null,i=r===null?void 0:c.get(r);Q.update({environmentId:r,snapshotGeneration:i?.capturedAt??0,effectiveRole:t.effectiveRole,directoryReady:t.directoryStatus===`ready`&&t.browserStatus===`current`,relayReady:t.transportStatus===`online`&&t.sessionEstablished&&r!==null,shellReady:i!==void 0&&e.some(e=>e.environmentId===r&&e.connectionState===`connected`&&e.canMutate)}),on({status:n,accountId:t.account?.id??null,machines:e,workspace:Ne({machines:e,snapshots:Array.from(c.values())}),demand:_.snapshot()})},y=async()=>{let e=++h,r=w.getState(),i=r.accountStatus===`authenticated`?r.account?.id??null:null,a=i?JSON.stringify([s,i]):null,o=f;if(f=i,o&&i!==o&&(await t.purgeAccount({hubOrigin:s,accountId:o}).catch(()=>void 0),c.clear(),J.reset(),u()),!i){l=null,v([]);return}if(a!==l&&r.directoryStatus===`ready`){l=a;let n=await t.list({hubOrigin:s,accountId:i});if(m||e!==h)return;let o=new Set(r.nodes.filter(e=>e.revokedAt===null&&!$(e)).map(e=>e.environmentId));for(let e of n){if(!o.has(e.namespace.environmentId)){await t.purgeEnvironment(e.namespace).catch(()=>void 0);continue}c.set(e.namespace.environmentId,e.snapshot),d.getState().hydrateEnvironmentStateFromCache(E(e.snapshot),e.namespace.environmentId)}}let p=r.selectedNode?.environmentId??null,y=p!==null&&r.transportStatus!==`idle`&&r.transportStatus!==`terminal-failure`,b=r.transportStatus===`online`&&r.sessionEstablished;g&&g!==p&&_.reportConnected(g,!1),p&&_.reportConnected(p,y),g=p;let x=un(r.nodes,p,b,r.sessionStatus===`delivery-unknown`,n()),S=new Map(x.map(e=>[e.environmentId,e]));if(r.directoryStatus===`ready`)for(let[e]of Array.from(c))S.get(e)?.cacheDisposition!==`available`&&(c.delete(e),d.getState().removeEnvironmentState(e),await t.purgeEnvironment({hubOrigin:s,accountId:i,environmentId:e}).catch(()=>void 0));m||e!==h||v(x)},b=()=>{p!==null&&i(p),p=r(()=>{if(p=null,m||!f)return;let e=Y.machines;for(let r of e){if(!r.canReadMetadata)continue;let e=A(r.environmentId,n(),r.deliveryUnknown);e&&(c.set(r.environmentId,e),t.replace({namespace:{hubOrigin:s,accountId:f,environmentId:r.environmentId},snapshot:e,payloadBytes:O(e),updatedAt:n()}).catch(()=>void 0))}v(e)},100)},x=w.subscribe(()=>void y()),S=d.subscribe(b),T=_.subscribe(()=>v(Y.machines)),D=Nt(mn);return _.reconcile(),y(),()=>{m=!0,h+=1,p!==null&&i(p),x(),S(),T(),D(),_.dispose(),Z===_&&(Z=null,Q.update({environmentId:null,snapshotGeneration:0,effectiveRole:null,directoryReady:!1,relayReady:!1,shellReady:!1}),on({status:`signed-out`,accountId:null,machines:[],workspace:nn,demand:_.snapshot()}))}}function fn(e){return Z?.setBackgrounded(e)??Promise.resolve()}function pn(){return Z!==null}function mn(e){return w.getState().nodes.find(t=>t.environmentId===e&&t.revokedAt===null&&!$(t))?.id??null}function hn(){let e=d(te(e=>l(e))),t=h(e=>({sidebarProjectGroupingMode:e.sidebarProjectGroupingMode,sidebarProjectGroupingOverrides:e.sidebarProjectGroupingOverrides,defaultAgentTokenMode:e.defaultAgentTokenMode})),n=S(),r=(0,R.useCallback)(e=>{let t=mn(e);t&&Gt(t)},[]),o=(0,R.useCallback)(()=>{let e=n.state.matches[n.state.matches.length-1]?.params??{};return x(e)},[n]),s=(0,R.useCallback)((c,l)=>{if(mn(c.environmentId)!==null&&(r(c.environmentId),rn(c.environmentId)===null))return an(c.environmentId).then(e=>{if(e!==null)return s(c,l)});let{getDraftSessionByLogicalProjectKey:u,getDraftSession:d,getDraftThread:f,applyStickyState:p,setDraftThreadContext:m,setLogicalProjectDraftThreadId:h}=y.getState(),g=o(),v=e.find(e=>e.id===c.projectId&&e.environmentId===c.environmentId),b=v?_(v,t):i(c),x=l?.branch!==void 0,S=l?.worktreePath!==void 0,C=l?.envMode!==void 0,w=u(b),T=g?g.kind===`server`?f(g.threadRef):d(g.draftId):null;if(w)return(async()=>{(x||S||C)&&m(w.draftId,{...x?{branch:l?.branch??null}:{},...S?{worktreePath:l?.worktreePath??null}:{},...C?{envMode:l?.envMode}:{}}),h(b,c,w.draftId,{threadId:w.threadId}),(g?.kind!==`draft`||g.draftId!==w.draftId)&&(r(c.environmentId),await n.navigate({to:`/draft/$draftId`,params:{draftId:w.draftId}}))})();if(T&&g?.kind===`draft`&&T.logicalProjectKey===b&&T.promotedTo==null)return(x||S||C)&&m(g.draftId,{...x?{branch:l?.branch??null}:{},...S?{worktreePath:l?.worktreePath??null}:{},...C?{envMode:l?.envMode}:{}}),h(b,c,g.draftId,{threadId:T.threadId,createdAt:T.createdAt,runtimeMode:T.runtimeMode,interactionMode:T.interactionMode,tokenMode:T.tokenMode??`balanced`,...x?{branch:l?.branch??null}:{},...S?{worktreePath:l?.worktreePath??null}:{},...C?{envMode:l?.envMode}:{}}),Promise.resolve();let E=M(),D=N(),O=new Date().toISOString();return(async()=>{h(b,c,E,{threadId:D,createdAt:O,branch:l?.branch??null,worktreePath:l?.worktreePath??null,envMode:l?.envMode??`local`,runtimeMode:a,tokenMode:t.defaultAgentTokenMode??`balanced`}),p(E),r(c.environmentId),await n.navigate({to:`/draft/$draftId`,params:{draftId:E}})})()},[r,o,t,n,e]);return s}function gn(){let e=(0,Pe.c)(2),t=hn(),n;return e[0]===t?n=e[1]:(n={handleNewThread:t},e[0]=t,e[1]=n),n}function _n(){let e=(0,Pe.c)(27),t=T(wn),n=h(Cn),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={strict:!1,select:Sn},e[0]=r):r=e[0];let i=b(r),a=i?.kind===`server`?i.threadRef:null,o;e[1]===a?o=e[2]:(o=m(a),e[1]=a,e[2]=o);let s=d(o),c=y(xn),l;e[3]!==c||e[4]!==i?(l=()=>i?i.kind===`server`?c(i.threadRef):y.getState().getDraftSession(i.draftId):null,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=y(l),f=d(te(bn)),v;e[6]!==t||e[7]!==f?(v=tt({items:f,preferredIds:t,getId:g}),e[6]=t,e[7]=f,e[8]=v):v=e[8];let x=v,S=hn(),C=ee(),w=cn(),E=p(yn),D;e[9]!==C||e[10]!==w.machines||e[11]!==w.status?(D=w.status===`signed-out`?{machines:C.machines,ready:C.status===`ready`,localEnvironmentId:C.localEnvironmentId}:{machines:w.machines.map(vn),ready:w.status===`ready`,localEnvironmentId:null},e[9]=C,e[10]=w.machines,e[11]=w.status,e[12]=D):D=e[12];let O=D,k;e[13]===n?k=e[14]:(k=e=>_(e,n),e[13]=n,e[14]=k);let A;e[15]!==w.status||e[16]!==x||e[17]!==E||e[18]!==k||e[19]!==O?(A=gt({orderedProjects:x,...O,logicalKey:k,...w.status===`signed-out`?{}:{preferredEnvironmentId:E}}),e[15]=w.status,e[16]=x,e[17]=E,e[18]=k,e[19]=O,e[20]=A):A=e[20];let j=A,M=E!==null&&s?.environmentId!==E?void 0:s,N=E!==null&&u?.environmentId!==E?null:u,P;return e[21]!==N||e[22]!==M||e[23]!==j||e[24]!==S||e[25]!==a?(P={activeDraftThread:N,activeThread:M,defaultProjectRef:j,handleNewThread:S,routeThreadRef:a},e[21]=N,e[22]=M,e[23]=j,e[24]=S,e[25]=a,e[26]=P):P=e[26],P}function vn(e){return{...e,online:e.presence.online}}function yn(e){return e.selectedNode?.environmentId??null}function bn(e){return l(e)}function xn(e){return e.getDraftThread}function Sn(e){return x(e)}function Cn(e){return{sidebarProjectGroupingMode:e.sidebarProjectGroupingMode,sidebarProjectGroupingOverrides:e.sidebarProjectGroupingOverrides}}function wn(e){return e.projectOrder}export{ft as A,We as B,Re as C,Qe as D,lt as E,dt as F,rt as G,ot as H,it as I,ce as J,Ye as K,at as L,$e as M,et as N,tt as O,ut as P,Ze as R,He as S,nt as T,Ve as U,Ge as V,ht as W,I as Y,Kt as _,fn as a,Le as b,en as c,Gt as d,qt as f,Ht as g,zt as h,$ as i,st as j,ct as k,Qt as l,Ut as m,gn as n,dn as o,Wt as p,se as q,pn as r,cn as s,_n as t,$t as u,Bt as v,pt as w,ze as x,Ie as y,Ke as z};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{Mn as n,Nn as r,in as i,zn as a}from"./usePopupViewport-CQTeg5Y-.js";import{d as o,o as s,s as c,u as l}from"./useRenderElement-DchFnsR8.js";var u=e(t(),1),d={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},f={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},p={disabled:!1,...f},m={valid(e){return e===null?null:e?{"data-valid":``}:{"data-invalid":``}}},h={invalid:void 0,name:void 0,validityData:{state:d,errors:[],error:``,value:``,initialValue:null},setValidityData:c,disabled:void 0,setTouched:c,setDirty:c,setFilled:c,setFocused:c,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:p,registerFieldControl:c,validation:{getValidationProps:(e,t=s)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:c,getInputControl:()=>null,commit:async()=>{},change:c}},g=u.createContext(h);function _(e=!0){let t=u.useContext(g);if(t.setValidityData===c&&!e)throw Error(o(28));return t}function v(e,t,r,i,a=!0,o){let{registerFieldControl:s}=_(),c=l(()=>Symbol());n(()=>{let n=c.current;if(!a){s(n,void 0);return}s(n,{controlRef:e,getValue:i,id:t,name:o,value:r})},[e,a,i,t,o,s,c,r]),n(()=>{let e=c.current;return()=>{s(e,void 0)}},[s,c])}var y=u.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:c,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function b(){return u.useContext(y)}var x=u.createContext({controlId:void 0,registerControlId:c,labelId:void 0,setLabelId:c,messageIds:[],setMessageIds:c,getDescriptionProps:e=>e});function S(){return u.useContext(x)}function C(e={}){let{id:t,implicit:o=!1,controlRef:s}=e,{controlId:d,registerControlId:f}=S(),p=i(t),m=o?d:void 0,h=l(()=>Symbol()),g=u.useRef(!1),_=u.useRef(t!=null),v=r(()=>{!g.current||f===c||(g.current=!1,f(h.current,void 0))});return n(()=>{if(f===c)return;let e;if(o){let n=s?.current;e=a(n)&&n.closest(`label`)!=null?t??null:m??p}else if(t!=null)_.current=!0,e=t;else if(_.current)e=p;else{v();return}if(e===void 0){v();return}g.current=!0,f(h.current,e)},[t,s,m,f,o,p,h,v]),u.useEffect(()=>v,[v]),d??p}export{h as a,f as c,v as i,d as l,S as n,g as o,b as r,_ as s,C as t,m as u};
1
+ import{i as e,t}from"./react-SIfiwpqq.js";import{Mn as n,Nn as r,in as i,zn as a}from"./usePopupViewport-BuhsNdVy.js";import{d as o,o as s,s as c,u as l}from"./useRenderElement-DchFnsR8.js";var u=e(t(),1),d={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},f={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},p={disabled:!1,...f},m={valid(e){return e===null?null:e?{"data-valid":``}:{"data-invalid":``}}},h={invalid:void 0,name:void 0,validityData:{state:d,errors:[],error:``,value:``,initialValue:null},setValidityData:c,disabled:void 0,setTouched:c,setDirty:c,setFilled:c,setFocused:c,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:p,registerFieldControl:c,validation:{getValidationProps:(e,t=s)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:c,getInputControl:()=>null,commit:async()=>{},change:c}},g=u.createContext(h);function _(e=!0){let t=u.useContext(g);if(t.setValidityData===c&&!e)throw Error(o(28));return t}function v(e,t,r,i,a=!0,o){let{registerFieldControl:s}=_(),c=l(()=>Symbol());n(()=>{let n=c.current;if(!a){s(n,void 0);return}s(n,{controlRef:e,getValue:i,id:t,name:o,value:r})},[e,a,i,t,o,s,c,r]),n(()=>{let e=c.current;return()=>{s(e,void 0)}},[s,c])}var y=u.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:c,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function b(){return u.useContext(y)}var x=u.createContext({controlId:void 0,registerControlId:c,labelId:void 0,setLabelId:c,messageIds:[],setMessageIds:c,getDescriptionProps:e=>e});function S(){return u.useContext(x)}function C(e={}){let{id:t,implicit:o=!1,controlRef:s}=e,{controlId:d,registerControlId:f}=S(),p=i(t),m=o?d:void 0,h=l(()=>Symbol()),g=u.useRef(!1),_=u.useRef(t!=null),v=r(()=>{!g.current||f===c||(g.current=!1,f(h.current,void 0))});return n(()=>{if(f===c)return;let e;if(o){let n=s?.current;e=a(n)&&n.closest(`label`)!=null?t??null:m??p}else if(t!=null)_.current=!0,e=t;else if(_.current)e=p;else{v();return}if(e===void 0){v();return}g.current=!0,f(h.current,e)},[t,s,m,f,o,p,h,v]),u.useEffect(()=>v,[v]),d??p}export{h as a,f as c,v as i,d as l,S as n,g as o,b as r,_ as s,C as t,m as u};
@@ -0,0 +1 @@
1
+ import{i as e,t}from"./react-SIfiwpqq.js";import{It as n}from"./composerDraftStore-CdJJZe42.js";import{S as r,T as i,b as a,g as o,h as s,m as c,p as l,w as u}from"./useSwipeDismiss-CbgDJvw1.js";import{t as d}from"./useRouter-CcIDS3PN.js";var f=e(t(),1),p=f.useLayoutEffect;function m(e,t,n){f.useEffect(()=>{if(!e.current||n||typeof IntersectionObserver!=`function`)return()=>t();let r=new IntersectionObserver(e=>{t(e.pop())},{rootMargin:`100px`});return r.observe(e.current),()=>{r.disconnect(),t()}},[t,n,e])}function h(e){let t=f.useRef(null);return f.useImperativeHandle(e,()=>t.current,[]),t}function g(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var _=4,v=5;function y(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=a.indexOf(`{`),s;if(o!==-1&&o+1<a.length&&(s=a.indexOf(`}`,o))!==-1){let r=a.charCodeAt(o+1);if(r===45){if(o+2<a.length&&a.charCodeAt(o+2)===36){let e=o+3,r=s;if(e<r)return n[0]=3,n[1]=t+o,n[2]=t+e,n[3]=t+r,n[4]=t+s+1,n[5]=i,n}}else if(r===36){let r=o+1,a=o+2;return a===s?(n[0]=2,n[1]=t+o,n[2]=t+r,n[3]=t+a,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+o,n[2]=t+a,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function b(e,t,n,r,i,a,o,s){s?.(n);let c=r;{let r=n.fullPath??n.from,s=n.options,l=r.length,u=s?.caseSensitive??e,d=s?.params?.parse??s?.parseParams;for(;c<l;){let e=y(r,c,t),n,s=c,l=e[5];c=l+1,a++;let f=e[0];switch(f){case 0:{let t=r.substring(e[2],e[3]),o=t,s;u?s=i.static??=new Map:(o=t.toLowerCase(),s=i.staticInsensitive??=new Map);let c=s.get(o);if(c)n=c;else{let e=S(r);e.parent=i,e.depth=a,n=e,s.set(o,e)}break}case 1:case 3:case 2:{let t=r.substring(s,e[1]),c=r.substring(e[4],l),p=u&&!!(t||c),m=t?p?t:t.toLowerCase():void 0,h=c?p?c:c.toLowerCase():void 0,g=f===1?i.dynamic:f===3?i.optional:i.wildcard,_=f!==2&&!d&&g?.find(e=>!e.parse&&e.caseSensitive===p&&e.prefix===m&&e.suffix===h);if(_)n=_;else{let e=C(f,r,p,m,h);n=e,e.parent=i,e.depth=a;let t;t=f===1?i.dynamic??=[]:f===3?i.optional??=[]:i.wildcard??=[],t.push(e),t.length===2&&o?.push(t)}break}}i=n}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=S(r);e.kind=v,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let f=(n.path||!n.children)&&!n.isRoot;if(f&&r.endsWith(`/`)){let e=S(r);e.kind=_,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=d??null,i.priority=s?.params?.priority??0,f&&!i.route&&(i.route=n,i.fullPath=r)}if(n.children)for(let r of n.children)b(e,t,r,c,i,a,o,s)}function x(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function S(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function C(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function w(e,t){let n=S(`/`),r=new Uint16Array(6),i=[];for(let t of e)b(!1,r,t,1,n,0,i);for(let e of i)e.sort(x);t.masksTree=n,t.flatCache=g(1e3)}function T(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=A(e,t.masksTree);return t.flatCache.set(e,r),r}function E(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=S(`/`),b(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),A(r,o,n)}function D(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=A(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=M(a.route)),t.matchCache.set(r,a),a}function O(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function k(e,t=!1,n){let r=S(e.fullPath),i=new Uint16Array(6),a=[],s={},c={},l=0;b(t,i,e,1,r,0,a,e=>{if(n?.(e,l),e.id in s&&o(),s[e.id]=e,l!==0&&e.path){let t=O(e.fullPath);(!c[t]||e.fullPath.endsWith(`/`))&&(c[t]=e)}l++});for(let e of a)e.sort(x);return{processedTree:{segmentTree:r,singleCache:g(1e3),matchCache:g(1e3),flatCache:null,masksTree:null},routesById:s,routesByPath:c}}function A(e,t,n=!1){let r=e.split(`/`),i=te(e,r,t,n);if(!i)return null;let[a]=j(e,r,i);return{route:i.node.route,rawParams:a}}function j(e,t,n){let r=ee(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===_)break;if(u.kind===v){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function M(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function ee(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function te(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let a=!i(t),o=a&&e!==`/`,s=t.length-+!!a,c=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],l=null,u=null;for(;c.length;){let n=c.pop(),{node:i,index:a,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!P(u,n))continue;if(i.parse){if(!re(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==_&&P(l,n)&&(l=n);let v=a===s;if(v&&(i.route&&(!o||i.kind===_||i.kind===2)&&P(u,n)&&(u=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let y=v?void 0:t[a],b;if(v&&i.index){let n={node:i.index,index:a,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(re(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&ne(f,s))return n;P(u,n)&&(u=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:o}=n;if(!(r&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(o){if(v)continue;let e=t.slice(a).join(`/`).slice(-o.length);if((n.caseSensitive?e:e.toLowerCase())!==o)continue}c.push({node:n,index:s,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];c.push({node:n,index:a,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}c.push({node:t,index:a+1,skipped:d,statics:f,dynamics:p,optionals:m+N(s,a),extract:h,rawParams:g})}}if(!v&&i.dynamic&&y)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}c.push({node:t,index:a+1,skipped:d,statics:f,dynamics:p+N(s,a),optionals:m,extract:h,rawParams:g})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&c.push({node:e,index:a+1,skipped:d,statics:f+N(s,a),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!v&&i.static){let e=i.static.get(y);e&&c.push({node:e,index:a+1,skipped:d,statics:f+N(s,a),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];c.push({node:t,index:a,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(u)return u;if(r&&l){let n=l.index;for(let e=0;e<l.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return l.rawParams??=Object.create(null),l.rawParams[`**`]=decodeURIComponent(r),l}return null}function N(e,t){return 2**(e-t-1)}function ne(e,t){return e===2**(t-1)-1}function re(e,t,n){let r,i;try{[r,i]=j(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function P(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===_)>(e.node.kind===_)||t.node.kind===_==(e.node.kind===_)&&t.node.depth>e.node.depth)))}function ie(e){return F(e.filter(e=>e!==void 0).join(`/`))}function F(e){return e.replace(/\/{2,}/g,`/`)}function ae(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function oe(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function se(e){return oe(ae(e))}function I(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function ce(e,t,n){return I(e,n)===I(t,n)}function le({base:e,to:t,trailingSlash:n=`never`,cache:r}){let a=t===`.`,o=t.startsWith(`/`),s;if(r){s=o?t:a?e:e+`\0`+t;let n=r.get(s);if(n)return n}let c;if(a)c=e.split(`/`);else if(o)c=t.split(`/`);else{for(c=e.split(`/`);c.length>1&&i(c)===``;)c.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&c.push(r):c=[r]:r===`..`?c.length>1?c.pop():c=[``]:r===`.`||c.push(r)}}c.length>1&&(i(c)===``?n===`never`&&c.pop():n===`always`&&c.push(``));let l=F(c.join(`/`))||`/`;return s&&r&&r.set(s,l),l}function ue(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function L(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>R(e,n)).join(`/`):R(r,n):r}function de({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=y(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=L(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=L(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=L(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function R(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function z(e){return e?.isNotFound===!0}var B=`__root__`,fe=`Error preloading route! ☝️`,V=n();function H(e){return(0,V.jsx)(U,{...e})}var U=class extends f.Component{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?f.createElement(this.props.errorComponent??W,{error:e,reset:this.reset}):this.props.children}};function W({error:e}){let[t,n]=f.useState(!1);return(0,V.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,V.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,V.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,V.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,V.jsx)(`div`,{children:(0,V.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,V.jsx)(`code`,{children:e.message}):null})}):null]})}function G({children:e,fallback:t=null}){return(0,V.jsx)(f.Fragment,{children:pe()?e:t})}function pe(){return f.useSyncExternalStore(K,()=>!0,()=>!1)}function K(){return()=>{}}function me(e){let t=f.useRef(e);return a(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function he(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function ge(e,t,n){if(e?.external)return u(e.href,n)?void 0:e.href;if(!X(t)&&typeof t==`string`&&t.indexOf(`:`)!==-1)try{return new URL(t),u(t,n)?void 0:t}catch{}}function _e(e,t,n,r,i,o){if(o)return!1;if(n?.exact){if(!ce(e.pathname,t.pathname,r))return!1}else{let n=I(e.pathname,r),i=I(t.pathname,r);if(!(n.startsWith(i)&&(n.length===i.length||n[i.length]===`/`)))return!1}return(n?.includeSearch??!0)&&!a(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function q(e,t){let n=d(),i=h(t),{activeProps:a,inactiveProps:o,activeOptions:s,to:l,preload:u,preloadDelay:p,preloadIntentProximity:g,hashScrollIntoView:_,replace:v,startTransition:y,resetScroll:b,viewTransition:x,children:S,target:C,disabled:w,style:T,className:E,onClick:D,onBlur:O,onFocus:k,onMouseEnter:A,onMouseLeave:j,onTouchStart:M,ignoreBlocker:ee,params:te,search:N,hash:ne,state:re,mask:P,reloadDocument:ie,unsafeRelative:F,from:ae,_fromLocation:oe,...se}=e,I=pe(),ce=me(e.search),le=me(e.params),ue=me(s),L=f.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,ce,le,e.state,e.mask,e.unsafeRelative]),de=f.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...L}),r=Ce(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,w),i=ge(r,l,n.protocolAllowlist);return[r?.href,i,_e(e,t,ue,n.basepath,I,i!==void 0)]},[ue,w,I,L,n,l]),[R,z,B]=c(n.stores.location,de,he),V=B?r(a,{})??ye:ve,H=B?ve:r(o,{})??ve,U=[E,V.className,H.className].filter(Boolean).join(` `),W=(T||V.style||H.style)&&{...T,...V.style,...H.style},G=f.useRef(!1),K=e.reloadDocument||z||w?!1:u??n.options.defaultPreload,q=p??n.options.defaultPreloadDelay??0,X=f.useCallback(()=>{n.preloadRoute(L).catch(e=>{console.warn(e),console.warn(fe)})},[n,L]),Z=f.useCallback(e=>{if(!e){Se(i);return}if(!(e.isIntersecting??K===`intent`)){e.isIntersecting===!1&&Se(i);return}if(!q){X();return}J.has(i)||J.set(i,setTimeout(()=>{J.delete(i),X()},q))},[X,i,K,q]);m(i,Z,K!==`viewport`),f.useEffect(()=>{G.current||K===`render`&&(X(),G.current=!0)},[X,K]);let we=e=>{let t=e.currentTarget.getAttribute(`target`),r=C===void 0?t:C;!w&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0&&(e.preventDefault(),n.navigate({...L,replace:v,resetScroll:b,hashScrollIntoView:_,startTransition:y,viewTransition:x,ignoreBlocker:ee}))};if(z)return{...se,ref:i,href:z,...S&&{children:S},...C&&{target:C},...w&&{disabled:w},...T&&{style:T},...E&&{className:E},...D&&{onClick:D},...O&&{onBlur:O},...k&&{onFocus:k},...A&&{onMouseEnter:A},...j&&{onMouseLeave:j},...M&&{onTouchStart:M}};let Te=()=>{K===`intent`&&X()},Q=()=>{K===`intent`&&Se(i)};return{...se,...V,...H,href:R,ref:i,onClick:Y([D,we]),onBlur:Y([O,Q]),onFocus:Y([k,Z]),onMouseEnter:Y([A,Z]),onMouseLeave:Y([j,Q]),onTouchStart:Y([M,Te]),disabled:!!w,target:C,...W&&{style:W},...U&&{className:U},...w&&be,...B&&xe}}var ve={},ye={className:`active`},be={role:`link`,"aria-disabled":!0},xe={"data-status":`active`,"aria-current":`page`},J=new WeakMap,Se=e=>{clearTimeout(J.get(e)),J.delete(e)},Y=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Ce(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function X(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Z=f.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=q(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return f.createElement(`a`,t,o)}return f.createElement(n,a,o)});function we(e){let t=d(),n=`not-found-${c(t.stores.location,e=>e.pathname)}-${c(t.stores.status,e=>e)}`;return(0,V.jsx)(H,{getResetKey:()=>n,onCatch:(t,n)=>{if(z(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(z(t))return e.fallback?.(t);throw t},children:e.children})}function Te(){return(0,V.jsx)(`p`,{children:`Not Found`})}function Q(e){return(0,V.jsx)(V.Fragment,{children:e.children})}function Ee(e,t,n){return t.options.notFoundComponent?(0,V.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,V.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,V.jsx)(Te,{})}function $(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,V.jsx)(n,{}):null}var De=(e,t)=>e[0]===t[0]&&e[1]===t[1],Oe=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,ke=f.memo(function({routeId:e}){let t=d();return(0,V.jsx)(Ae,{router:t,match:c(t.stores.getMatchStore(e),e=>e)})});function Ae({router:e,match:t}){let n=e.routesById[t.routeId],r=$(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,c=t.ssr===!1||t.ssr===`data-only`,l=Oe(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||c))?f.Suspense:Q,u=i?H:Q,d=o?we:Q;return(0,V.jsxs)(n.isRoot?n.options.shellComponent??Q:Q,{children:[(0,V.jsx)(s.Provider,{value:t.routeId,children:(0,V.jsx)(l,{fallback:r,children:(0,V.jsx)(u,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(z(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:(0,V.jsx)(d,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return f.createElement(o,e)},children:c?(0,V.jsx)(G,{fallback:r,children:(0,V.jsx)(je,{match:t})}):(0,V.jsx)(je,{match:t})})})})}),null]})}var je=f.memo(function({match:e}){let t=d(),n=e.routeId,r=t.routesById[n],i=f.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=f.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,V.jsx)(e,{},i):(0,V.jsx)(Me,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!Oe(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return $(t,r)}if(e.status===`notFound`)return Ee(t,r,e.error);if(e.status===`error`)throw e.error;return a}),Me=f.memo(function(){let e=d(),t=f.useContext(s),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=c(a,e=>[!!e._notFound,e.error],De),i=c(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return Ee(e,e.routesById[t],r);if(!i)return null;let a=(0,V.jsx)(ke,{routeId:i});return t===`__root__`?(0,V.jsx)(f.Suspense,{fallback:$(e),children:a}):a});function Ne(e){let t=d();return c(t.stores.location,l(e,t))}export{k as C,w as S,p as T,oe as _,Q as a,D as b,B as c,ue as d,de as f,ae as g,se as h,$ as i,z as l,le as m,ke as n,Z as o,ie as p,Me as r,H as s,Ne as t,F as u,M as v,g as w,E as x,T as y};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{$t as n,Bt as r,Gt as i,It as a,Nn as o,Ot as s,kn as c,nn as l,on as u,qt as d}from"./usePopupViewport-CQTeg5Y-.js";import{o as f}from"./useRenderElement-DchFnsR8.js";import{t as p}from"./useValueChanged-CSGMZCwN.js";var m=e(t(),1);function h(e,t={}){let{enabled:n=!0,event:o=`click`,toggle:p=!0,ignoreMouse:h=!1,stickIfOpen:g=!0,touchOpenDelay:_=0,reason:v=c}=t,y=`rootStore`in e?e.rootStore:e,b=y.context.dataRef,x=m.useRef(void 0),S=s(),C=l(),w=m.useMemo(()=>{function e(e,t,n,r){let i=u(v,t,n);e&&r===`touch`&&_>0?C.start(_,()=>{y.setOpen(!0,i)}):y.setOpen(e,i)}function t(e,t,n){let r=b.current.openEvent,i=y.select(`domReferenceElement`)!==t;return e&&i||!e||!p?!0:r&&g?!n(r.type):!1}return{onPointerDown(e){x.current=i(e.pointerType,!0)&&d(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let s=x.current,c=n.nativeEvent,l=y.select(`open`);if(n.button!==0||o===`click`||i(s,!0)&&h)return;let u=t(l,n.currentTarget,e=>e===`click`||e===`mousedown`),d=r(c);if(a(d)){e(u,c,d,s);return}let f=n.currentTarget;S.request(()=>{e(u,c,f,s)})},onClick(n){if(o===`mousedown-only`)return;let r=x.current;if(o===`mousedown`&&r){x.current=void 0;return}i(r,!0)&&h||e(t(y.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,r)},onKeyDown(){x.current=void 0}}},[b,o,h,v,y,g,p,S,C,_]);return m.useMemo(()=>n?{reference:w}:f,[n,w])}function g(e){let t=m.useRef(``),n=m.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:m.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function _(e,t){let{onClick:r,onPointerDown:i}=g(o((r,i)=>{(typeof e==`function`?e():e)||t(i||(n?`touch`:``))}));return m.useMemo(()=>({onClick:r,onPointerDown:i}),[r,i])}function v(e){let[t,n]=m.useState(null),r=_(e,n);return p(e,t=>{t&&!e&&n(null)}),m.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}export{_ as n,h as r,v as t};
1
+ import{i as e,t}from"./react-SIfiwpqq.js";import{$t as n,Bt as r,Gt as i,It as a,Nn as o,Ot as s,kn as c,nn as l,on as u,qt as d}from"./usePopupViewport-BuhsNdVy.js";import{o as f}from"./useRenderElement-DchFnsR8.js";import{t as p}from"./useValueChanged-MQtIzPIU.js";var m=e(t(),1);function h(e,t={}){let{enabled:n=!0,event:o=`click`,toggle:p=!0,ignoreMouse:h=!1,stickIfOpen:g=!0,touchOpenDelay:_=0,reason:v=c}=t,y=`rootStore`in e?e.rootStore:e,b=y.context.dataRef,x=m.useRef(void 0),S=s(),C=l(),w=m.useMemo(()=>{function e(e,t,n,r){let i=u(v,t,n);e&&r===`touch`&&_>0?C.start(_,()=>{y.setOpen(!0,i)}):y.setOpen(e,i)}function t(e,t,n){let r=b.current.openEvent,i=y.select(`domReferenceElement`)!==t;return e&&i||!e||!p?!0:r&&g?!n(r.type):!1}return{onPointerDown(e){x.current=i(e.pointerType,!0)&&d(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let s=x.current,c=n.nativeEvent,l=y.select(`open`);if(n.button!==0||o===`click`||i(s,!0)&&h)return;let u=t(l,n.currentTarget,e=>e===`click`||e===`mousedown`),d=r(c);if(a(d)){e(u,c,d,s);return}let f=n.currentTarget;S.request(()=>{e(u,c,f,s)})},onClick(n){if(o===`mousedown-only`)return;let r=x.current;if(o===`mousedown`&&r){x.current=void 0;return}i(r,!0)&&h||e(t(y.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,r)},onKeyDown(){x.current=void 0}}},[b,o,h,v,y,g,p,S,C,_]);return m.useMemo(()=>n?{reference:w}:f,[n,w])}function g(e){let t=m.useRef(``),n=m.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:m.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function _(e,t){let{onClick:r,onPointerDown:i}=g(o((r,i)=>{(typeof e==`function`?e():e)||t(i||(n?`touch`:``))}));return m.useMemo(()=>({onClick:r,onPointerDown:i}),[r,i])}function v(e){let[t,n]=m.useState(null),r=_(e,n);return p(e,t=>{t&&!e&&n(null)}),m.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}export{_ as n,h as r,v as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./compiler-runtime-qmuS0Svy.js";import{h as t}from"./env-B4arEvJg.js";import{L as n,Rn as r}from"./runtime-DfGHeCnR.js";import{It as i}from"./composerDraftStore-CdJJZe42.js";import{n as a}from"./useHandleNewThread-Bvz-DKgn.js";import{t as o}from"./useRouter-CcIDS3PN.js";import{i as s}from"./uiStateStore-B6pjzSjj.js";import{c,l}from"./WorkItemsTab-BDAeQe4D.js";import{t as u}from"./button-BAbJxRzt.js";import{t as d}from"./useThreadActions-Vew3ScxG.js";import{g as f}from"./sidebar-Dm6l2GA6.js";import{a as p,c as m,i as h,o as g,s as _,t as v}from"./dialog-DQsYchqu.js";import{a as y,i as b,n as x,o as S,s as C,t as w}from"./MobileSheet-CkeG6_SP.js";var T=e(),E=i();function D(e){let t=(0,T.c)(22),{open:n,onOpenChange:r,title:i,items:a,onAction:o,leadingSections:s}=e,c;t[0]===i?c=t[1]:(c=(0,E.jsx)(S,{children:i}),t[0]=i,t[1]=c);let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,E.jsx)(x,{className:`sr-only`,children:`Thread actions`}),t[2]=l):l=t[2];let u;t[3]===c?u=t[4]:(u=(0,E.jsxs)(b,{children:[c,l]}),t[3]=c,t[4]=u);let d;if(t[5]!==a||t[6]!==o||t[7]!==r){let e;t[9]!==o||t[10]!==r?(e=e=>(0,E.jsx)(C,{label:e.label,destructive:e.destructive===!0,onClick:()=>{r(!1),o(e.id)}},e.id),t[9]=o,t[10]=r,t[11]=e):e=t[11],d=a.map(e),t[5]=a,t[6]=o,t[7]=r,t[8]=d}else d=t[8];let f;t[12]===d?f=t[13]:(f=(0,E.jsx)(`div`,{role:`group`,"aria-label":`Thread actions`,className:`space-y-0.5`,children:d}),t[12]=d,t[13]=f);let p;t[14]!==s||t[15]!==f?(p=(0,E.jsxs)(y,{children:[s,f]}),t[14]=s,t[15]=f,t[16]=p):p=t[16];let m;return t[17]!==r||t[18]!==n||t[19]!==u||t[20]!==p?(m=(0,E.jsxs)(w,{open:n,onOpenChange:r,label:`Thread actions`,children:[u,p]}),t[17]=r,t[18]=n,t[19]=u,t[20]=p,t[21]=m):m=t[21],m}function O(e){let n=(0,T.c)(32),{renamingThreadKey:r,originalTitle:i,renamingTitle:a,setRenamingTitle:o,commitRename:s,cancelRename:c}=e,l;n[0]===r?l=n[1]:(l=r?t(r):null,n[0]=r,n[1]=l);let d=l;if(!d)return null;let f;n[2]!==s||n[3]!==i||n[4]!==a||n[5]!==d?(f=()=>{s(d,a,i)},n[2]=s,n[3]=i,n[4]=a,n[5]=d,n[6]=f):f=n[6];let y=f,b;n[7]===c?b=n[8]:(b=e=>{e||c()},n[7]=c,n[8]=b);let x;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,E.jsx)(p,{children:(0,E.jsx)(m,{children:`Rename thread`})}),n[9]=x):x=n[9];let S;n[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,E.jsx)(`label`,{htmlFor:`phone-thread-rename-title`,className:`sr-only`,children:`Thread title`}),n[10]=S):S=n[10];let C;n[11]===o?C=n[12]:(C=e=>o(e.currentTarget.value),n[11]=o,n[12]=C);let w;n[13]===y?w=n[14]:(w=e=>{e.key===`Enter`&&(e.preventDefault(),y())},n[13]=y,n[14]=w);let D;n[15]!==a||n[16]!==C||n[17]!==w?(D=(0,E.jsxs)(g,{children:[S,(0,E.jsx)(`input`,{id:`phone-thread-rename-title`,autoFocus:!0,value:a,maxLength:500,onChange:C,onKeyDown:w,className:`h-11 w-full rounded-lg border border-input bg-background px-3 text-base outline-none focus-visible:ring-2 focus-visible:ring-ring`})]}),n[15]=a,n[16]=C,n[17]=w,n[18]=D):D=n[18];let O;n[19]===c?O=n[20]:(O=(0,E.jsx)(u,{variant:`outline`,className:`phone:min-h-11`,onClick:c,children:`Cancel`}),n[19]=c,n[20]=O);let k;n[21]===y?k=n[22]:(k=(0,E.jsx)(u,{className:`phone:min-h-11`,onClick:y,children:`Rename`}),n[21]=y,n[22]=k);let A;n[23]!==k||n[24]!==O?(A=(0,E.jsxs)(h,{children:[O,k]}),n[23]=k,n[24]=O,n[25]=A):A=n[25];let j;n[26]!==A||n[27]!==D?(j=(0,E.jsxs)(_,{children:[x,D,A]}),n[26]=A,n[27]=D,n[28]=j):j=n[28];let M;return n[29]!==j||n[30]!==b?(M=(0,E.jsx)(v,{open:!0,onOpenChange:b,children:j}),n[29]=j,n[30]=b,n[31]=M):M=n[31],M}function k(e){let t=(0,T.c)(22),i=o(),{isMobile:u,setOpenMobile:p}=f(),m=r(z),h=r(R),g=r(L),{archiveThread:_,deleteThread:v}=d(),{handleNewThread:y}=a(),b=s(I),x=n(F),S=n(P),C=n(N),w=n(M),E=n(j),D=n(A),{copyThreadIdToClipboard:O,copyPathToClipboard:k}=l(),B;return t[0]!==h||t[1]!==m||t[2]!==_||t[3]!==C||t[4]!==k||t[5]!==O||t[6]!==g||t[7]!==v||t[8]!==y||t[9]!==u||t[10]!==b||t[11]!==e.memberProjectByScopedKey||t[12]!==e.projectCwd||t[13]!==e.sidebarThreadByKeyRef||t[14]!==S||t[15]!==w||t[16]!==i||t[17]!==D||t[18]!==p||t[19]!==E||t[20]!==x?(B={router:i,isMobile:u,setOpenMobile:p,clearSelection:C,setSelectionAnchor:E,toggleThreadSelection:x,rangeSelectTo:S,removeFromSelection:w,selectedThreadCount:D,appSettingsConfirmThreadDelete:m,appSettingsConfirmThreadArchive:h,defaultThreadEnvMode:g,deleteThread:v,archiveThread:_,handleNewThread:y,markThreadUnread:b,copyPathToClipboard:k,copyThreadIdToClipboard:O,sidebarThreadByKeyRef:e.sidebarThreadByKeyRef,memberProjectByScopedKey:e.memberProjectByScopedKey,projectCwd:e.projectCwd},t[0]=h,t[1]=m,t[2]=_,t[3]=C,t[4]=k,t[5]=O,t[6]=g,t[7]=v,t[8]=y,t[9]=u,t[10]=b,t[11]=e.memberProjectByScopedKey,t[12]=e.projectCwd,t[13]=e.sidebarThreadByKeyRef,t[14]=S,t[15]=w,t[16]=i,t[17]=D,t[18]=p,t[19]=E,t[20]=x,t[21]=B):B=t[21],c(B)}function A(e){return e.selectedThreadKeys.size}function j(e){return e.setAnchor}function M(e){return e.removeFromSelection}function N(e){return e.clearSelection}function P(e){return e.rangeSelectTo}function F(e){return e.toggleThread}function I(e){return e.markThreadUnread}function L(e){return e.defaultThreadEnvMode}function R(e){return e.confirmThreadArchive}function z(e){return e.confirmThreadDelete}export{D as n,O as r,k as t};
@@ -0,0 +1 @@
1
+ import{i as e,n as t,t as n}from"./react-SIfiwpqq.js";import{It as r}from"./composerDraftStore-CdJJZe42.js";import{a as i,c as a,d as o,o as s,s as c,t as l,u}from"./useRenderElement-DchFnsR8.js";import{t as d}from"./react-dom-x9LNwWQc.js";var f=t((e=>{var t=n();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),p=t(((e,t)=>{t.exports=f()})),m=t((e=>{var t=n(),r=p();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),h=t(((e,t)=>{t.exports=m()})),g=e(n(),1),_=r(),v=p(),y=h(),b=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),x={"data-starting-style":``},S={"data-ending-style":``},C={transitionStatus(e){return e===`starting`?x:e===`ending`?S:null}},w=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=b.startingStyle]=`startingStyle`,e[e.endingStyle=b.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),T={"data-popup-open":``},E={"data-popup-open":``,"data-pressed":``},D={"data-open":``},O={"data-closed":``},k={"data-anchor-hidden":``},A={open(e){return e?T:null}},j={open(e){return e?E:null}},M={open(e){return e?D:O},anchorHidden(e){return e?k:null}},N={...M,...C};function P(){return typeof window<`u`}function F(e){return R(e)?(e.nodeName||``).toLowerCase():`#document`}function I(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function L(e){return((R(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function R(e){return P()?e instanceof Node||e instanceof I(e).Node:!1}function z(e){return P()?e instanceof Element||e instanceof I(e).Element:!1}function B(e){return P()?e instanceof HTMLElement||e instanceof I(e).HTMLElement:!1}function ee(e){return!P()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof I(e).ShadowRoot}function te(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=H(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ne(e){return/^(table|td|th)$/.test(F(e))}function re(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var ie=/transform|translate|scale|rotate|perspective|filter/,V=/paint|layout|strict|content/,ae=e=>!!e&&e!==`none`,oe;function se(e){let t=z(e)?H(e):e;return ae(t.transform)||ae(t.translate)||ae(t.scale)||ae(t.rotate)||ae(t.perspective)||!le()&&(ae(t.backdropFilter)||ae(t.filter))||ie.test(t.willChange||``)||V.test(t.contain||``)}function ce(e){let t=fe(e);for(;B(t)&&!ue(t);){if(se(t))return t;if(re(t))return null;t=fe(t)}return null}function le(){return oe??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),oe}function ue(e){return/^(html|body|#document)$/.test(F(e))}function H(e){return I(e).getComputedStyle(e)}function de(e){return z(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function fe(e){if(F(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ee(e)&&e.host||L(e);return ee(t)?t.host:t}function pe(e){let t=fe(e);return ue(t)?(e.ownerDocument||e).body:B(t)&&te(t)?t:pe(t)}function U(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=pe(e),i=r===e.ownerDocument?.body,a=I(r);if(i){let e=me(a);return t.concat(a,a.visualViewport||[],te(r)?r:[],e&&n?U(e):[])}return t.concat(r,U(r,[],n))}function me(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var he={...g},ge=he.useInsertionEffect,_e=ge&&ge!==he.useLayoutEffect?ge:e=>e();function W(e){let t=u(ve).current;return t.next=e,_e(t.effect),t.trampoline}function ve(){let e={next:void 0,callback:ye,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function ye(){}var G=typeof document<`u`?g.useLayoutEffect:()=>{};function K(e){return e?.ownerDocument||document}var be=`none`,xe=`trigger-press`,q=`trigger-hover`,Se=`trigger-focus`,Ce=`outside-press`,we=`item-press`,Te=`close-press`,Ee=`clear-press`,De=`input-change`,Oe=`input-clear`,ke=`input-press`,Ae=`focus-out`,je=`escape-key`,Me=`close-watcher`,Ne=`list-navigation`,Pe=`keyboard`,Fe=`pointer`,Ie=`cancel-open`,Le=`sibling-open`,Re=`disabled`,ze=`imperative-action`,Be=`swipe`,Ve=`window-resize`;function J(e,t,n,r){let i=!1,a=!1,o=r??s;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function He(e,t,n){let r=n??s;return{reason:e,event:t??new Event(`base-ui`),...r}}var Ue=0;function We(e,t=`mui`){let[n,r]=g.useState(e),i=e||n;return g.useEffect(()=>{n??(Ue+=1,r(`${t}-${Ue}`))},[n,t]),i}var Ge=he.useId;function Ke(e,t){if(Ge!==void 0){let n=Ge();return e??(t?`${t}-${n}`:n)}return We(e,t)}function qe(e){return Ke(e,`base-ui`)}function Je(e){g.useEffect(e,i)}var Ye=0,Xe=class e{static create(){return new e}currentId=Ye;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ye,t()},e)}isStarted(){return this.currentId!==Ye}clear=()=>{this.currentId!==Ye&&(clearTimeout(this.currentId),this.currentId=Ye)};disposeEffect=()=>this.clear};function Ze(){let e=u(Xe.create).current;return Je(e.disposeEffect),e}function Qe(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:$e,platform:et,maxTouchPoints:tt}=Qe(),nt=$e.toLowerCase(),rt=et.toLowerCase(),it=/^i(os$|p)/.test(rt)||rt===`macintel`&&tt>1,at=`android`,ot=rt===at||nt.includes(at),st=!it&&rt.startsWith(`mac`);rt.startsWith(`win`),!ot&&/^(linux|chrome os)/.test(rt);var ct=st||it,lt=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`),ut=!lt&&nt.includes(`firefox`);!lt&&nt.includes(`chrom`);var dt=ct,ft=/jsdom|happydom/.test(nt);function pt(e){e.preventDefault(),e.stopPropagation()}function mt(e){return`nativeEvent`in e}function ht(e){return e.pointerType===``&&e.isTrusted?!0:ot&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function gt(e){return ft?!1:!ot&&e.width===0&&e.height===0||ot&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function _t(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function vt(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var yt=`data-base-ui-focusable`,bt=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,xt=`ArrowLeft`,St=`ArrowRight`,Ct=`ArrowUp`,wt=`ArrowDown`;function Tt(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Y(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&ee(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Et(e){return`composedPath`in e?e.composedPath()[0]:e.target}function Dt(e,t){if(!z(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(Y(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function Ot(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function kt(e){return e.matches(`html,body`)}function At(e){return B(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function jt(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${bt}`)!=null}function Mt(e){return e?e.getAttribute(`role`)===`combobox`&&At(e):!1}function Nt(e){if(!e||ft)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Pt(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Ft(e,t){return t!=null&&!_t(t)?0:typeof e==`function`?e():e}function It(e,t,n){let r=Ft(e,n);return typeof r==`number`?r:r?.[t]}function Lt(e){return typeof e==`function`?e():e}function Rt(e,t){return t||e===`click`||e===`mousedown`}function zt(e){return e?.includes(`mouse`)&&e!==`mousedown`}function X(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Bt(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function Vt(e){let t=u(Ht,e).current;return t.next=e,G(t.effect),t}function Ht(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Ut=null;globalThis.requestAnimationFrame;var Wt=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},Gt=class e{static create(){return new e}static request(e){return Wt.request(e)}static cancel(e){return Wt.cancel(e)}currentId=Ut;request(e){this.cancel(),this.currentId=Wt.request(()=>{this.currentId=Ut,e()})}cancel=()=>{this.currentId!==Ut&&(Wt.cancel(this.currentId),this.currentId=Ut)};disposeEffect=()=>this.cancel};function Kt(){let e=u(Gt.create).current;return Je(e.disposeEffect),e}var qt={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Jt={...qt,position:`fixed`,top:0,left:0},Yt={...qt,position:`absolute`},Xt=g.forwardRef(function(e,t){let[n,r]=g.useState();G(()=>{dt&&lt&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,_.jsx)(`span`,{...e,ref:t,style:Jt,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),Zt=Math.min,Qt=Math.max,$t=Math.round,en=Math.floor,tn=e=>({x:e,y:e}),nn={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function rn(e,t,n){return Qt(e,Zt(t,n))}function an(e,t){return typeof e==`function`?e(t):e}function Z(e){return e.split(`-`)[0]}function on(e){return e.split(`-`)[1]}function sn(e){return e===`x`?`y`:`x`}function cn(e){return e===`y`?`height`:`width`}function Q(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ln(e){return sn(Q(e))}function un(e,t,n){n===void 0&&(n=!1);let r=on(e),i=ln(e),a=cn(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=yn(o)),[o,yn(o)]}function dn(e){let t=yn(e);return[fn(e),t,fn(t)]}function fn(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var pn=[`left`,`right`],mn=[`right`,`left`],hn=[`top`,`bottom`],gn=[`bottom`,`top`];function _n(e,t,n){switch(e){case`top`:case`bottom`:return n?t?mn:pn:t?pn:mn;case`left`:case`right`:return t?hn:gn;default:return[]}}function vn(e,t,n,r){let i=on(e),a=_n(Z(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(fn)))),a}function yn(e){let t=Z(e);return nn[t]+e.slice(t.length)}function bn(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function xn(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:bn(e)}function Sn(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Cn(e,t,n){return Math.floor(e/t)!==n}function wn(e,t){return t<0||t>=e.length}function Tn(e,t){return Dn(e.current,{disabledIndices:t})}function En(e,t){return Dn(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Dn(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&kn(e,a,r));return a}function On(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1),r=i(t,u,n[o][e]??n[o][0]);o=a[r]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!kn(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=en(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!kn(e,r,s))return r}};d&&pt(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=Dn(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=Dn(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}wn(e,f)&&(f=u)}if(n===`both`){let n=en(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&pt(t),u%o===o-1?r&&(f=Dn(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=Dn(e,{startingIndex:u,disabledIndices:s}),r&&Cn(f,o,n)&&(f=Dn(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),Cn(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&pt(t),u%o===0?r&&(f=Dn(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=Dn(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&Cn(f,o,n)&&(f=Dn(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),Cn(f,o,n)&&(f=u));let c=en(l/o)===n;wn(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:Dn(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function kn(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!jn(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function An(e){return e.visibility===`hidden`||e.visibility===`collapse`}function jn(e,t=e?H(e):null){return!e||!e.isConnected||!t||An(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var Mn=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function Nn(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return ee(n)?n.host:null}function Pn(e){for(let t of Array.from(e.children))if(F(t)===`summary`)return t;return null}function Fn(e,t){let n=Pn(t);return!!n&&(e===n||Y(n,e))}function In(e){let t=e?F(e):``;return e!=null&&e.matches(Mn)&&(t!==`summary`||e.parentElement!=null&&F(e.parentElement)===`details`&&Pn(e.parentElement)===e)&&(t!==`details`||Pn(e)==null)&&(t!==`input`||e.type!==`hidden`)}function Ln(e){if(!In(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=Nn(t)){let n=t!==e,r=F(t)===`slot`;if(t.hasAttribute(`inert`)||n&&F(t)===`details`&&!t.open&&!Fn(e,t)||t.hasAttribute(`hidden`)||!r&&!Rn(t,n))return!1}return!0}function Rn(e,t){let n=H(e);return t?n.display!==`none`:jn(e,n)}function zn(e){let t=e.tabIndex;if(t<0){let t=F(e);if(t===`details`||t===`audio`||t===`video`||B(e)&&e.isContentEditable)return 0}return t}function Bn(e){if(F(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Vn(e,t){let n=Bn(e);if(!n)return!0;let r=t.find(e=>{let t=Bn(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Bn(e);return t?.name===n.name&&t.form===n.form})===n}function Hn(e){if(B(e)&&F(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return B(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Un(e,t){Hn(e).forEach(e=>{In(e)&&t.push(e),Un(e,t)})}function Wn(e,t,n){Hn(e).forEach(e=>{B(e)&&e.matches(t)&&n.push(e),Wn(e,t,n)})}function Gn(e){return Ln(e)&&zn(e)>=0}function Kn(e){let t=[];return Un(e,t),t.filter(Ln)}function qn(e){let t=Kn(e);return t.filter(e=>zn(e)>=0&&Vn(e,t))}function Jn(e,t){let n=qn(e),r=n.length;if(r===0)return;let i=Tt(K(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Yn(e){return Jn(K(e).body,1)||e}function Xn(e){return Jn(K(e).body,-1)||e}function Zn(e,t){if(!e)return null;let n=qn(K(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function Qn(e){return Zn(e,1)}function $n(e){return Zn(e,-1)}function er(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Y(n,r)}function tr(e){qn(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function nr(e){let t=[];Wn(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function rr(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...rr(e,t.id,n)])}function ir(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function ar(e){return`data-base-ui-${e}`}var or=e(d(),1),sr={style:{transition:`none`}},cr=`data-base-ui-click-trigger`,lr=`data-base-ui-swipe-ignore`,ur=`data-swipe-ignore`,dr=`[${lr}]`,fr=`[${ur}]`,pr={fallbackAxisSide:`none`},mr={fallbackAxisSide:`end`},hr={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},gr=g.createContext(null),_r=()=>g.useContext(gr),vr=ar(`portal`);function yr(e={}){let{ref:t,container:n,componentProps:r=s,elementProps:i}=e,a=Ke(),o=_r()?.portalNode,[c,u]=g.useState(null),[d,f]=g.useState(null),p=W(e=>{e!==null&&f(e)}),m=g.useRef(null);G(()=>{if(n===null){m.current&&(m.current=null,f(null),u(null));return}let e=(n&&(R(n)?n:n.current))??o??document.body;if(e==null){m.current&&(m.current=null,f(null),u(null));return}m.current!==e&&(m.current=e,f(null),u(e))},[n,o]);let h=l(`div`,r,{ref:[t,p],props:[{id:a,[vr]:``},i]}),_=c&&h?or.createPortal(h,c):null;return{node:d,nodeId:g.isValidElement(h)?h.props.id:void 0,subtree:_}}var br=g.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,...s}=e,{node:c,nodeId:l,subtree:u}=yr({container:o,ref:t,componentProps:e,elementProps:s}),d=g.useRef(null),f=g.useRef(null),p=g.useRef(null),m=g.useRef(null),[h,v]=g.useState(null),y=g.useRef(!1),b=h?.modal,x=h?.open,S=!!h&&!h.modal&&h.open&&!!c;g.useEffect(()=>{if(!c||b)return;function e(e){c&&e.relatedTarget&&er(e)&&(e.type===`focusin`?y.current&&=(nr(c),!1):(tr(c),y.current=!0))}return Bt(X(c,`focusin`,e,!0),X(c,`focusout`,e,!0))},[c,b]),G(()=>{!c||x!==!0||!y.current||(nr(c),y.current=!1)},[x,c]);let C=g.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:c,setFocusManagerState:v}),[c]);return(0,_.jsxs)(g.Fragment,{children:[u,(0,_.jsxs)(gr.Provider,{value:C,children:[S&&c&&(0,_.jsx)(Xt,{"data-type":`outside`,ref:d,onFocus:e=>{er(e,c)?p.current?.focus():Xn(h?h.domReference:null)?.focus()}}),S&&c&&(0,_.jsx)(`span`,{"aria-owns":l,style:hr}),c&&or.createPortal(a,c),S&&c&&(0,_.jsx)(Xt,{"data-type":`outside`,ref:f,onFocus:e=>{er(e,c)?m.current?.focus():(Yn(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,J(`focus-out`,e.nativeEvent)))}})]})]})});function xr(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var Sr=class{nodesRef={current:[]};events=xr();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},Cr=g.createContext(null),wr=g.createContext(null),Tr=()=>g.useContext(Cr)?.id||null,Er=e=>{let t=g.useContext(wr);return e??t};function Dr(e){let t=Ke(),n=Er(e),r=Tr();return G(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function Or(e){let{children:t,id:n}=e,r=Tr();return(0,_.jsx)(Cr.Provider,{value:g.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function kr(e){let{children:t,externalTree:n}=e,r=u(()=>n??new Sr).current;return(0,_.jsx)(wr.Provider,{value:r,children:t})}function Ar(e){return e==null?e:`current`in e?e.current:e}function jr(){return!1}function Mr(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function Nr(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=jr,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:f}=l.context,p=Er(c),m=W(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,_=h!==!1,v=W(()=>a),{escapeKey:y,outsidePress:b}=Mr(s),x=g.useRef(!1),S=g.useRef(!1),C=g.useRef(!1),w=g.useRef(!1),T=g.useRef(``),E=g.useRef(null),D=Ze(),O=Ze(),k=W(()=>{O.clear(),f.current.insideReactTree=!1}),A=W(e=>{let t=f.current.floatingContext?.nodeId;return(p?rr(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),j=W(e=>Ot(e,l.select(`floatingElement`))||Ot(e,l.select(`domReferenceElement`))),M=W(e=>{o()&&l.setOpen(!1,J(xe,e.nativeEvent))}),N=W(e=>{if(!u||!n||!r||e.key!==`Escape`||w.current||!y&&A(`__escapeKeyBubbles`))return;let t=J(je,mt(e)?e.nativeEvent:e);l.setOpen(!1,t),t.isCanceled||e.preventDefault(),!y&&!t.isPropagationAllowed&&e.stopPropagation()}),P=W(()=>{f.current.insideReactTree=!0,O.start(0,k)}),F=W(e=>{if(!u||!n||e.button!==0)return;let t=Et(e.nativeEvent);Y(l.select(`floatingElement`),t)&&(x.current||(x.current=!0,S.current=!1))}),I=W(e=>{!u||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&x.current&&(S.current=!0)});g.useEffect(()=>{if(!u||!n)return k;f.current.__escapeKeyBubbles=y,f.current.__outsidePressBubbles=b;let e=new Xe,t=new Xe;function i(){e.clear(),w.current=!0}function a(){e.start(lt?5:0,()=>{w.current=!1})}function o(){C.current=!0,t.start(0,()=>{C.current=!1})}function s(){x.current=!1,S.current=!1}function c(){let e=T.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=c();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function g(e){let t=f.current.floatingContext?.nodeId,n=p&&rr(p.nodesRef.current,t).some(t=>Ot(e,t.context?.elements.floating));return j(e)||n}function O(e){if(m(e)){e.type!==`click`&&!j(e)&&(t.clear(),C.current=!1),k();return}if(f.current.insideReactTree){k();return}let n=Et(e),r=`[${ar(`inert`)}]`,i=z(n)?n.getRootNode():null,a=Array.from((ee(i)?i:K(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>Y(e,n))))return;let s=z(n)?n:null;for(;s&&!ue(s);){let e=fe(s);if(ue(e)||!z(e))break;s=e}if(!(a.length&&z(n)&&!kt(n)&&!Y(n,l.select(`floatingElement`))&&a.every(e=>!Y(s,e)))){if(B(n)&&!(`touches`in e)){let t=ue(n),r=H(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!g(e)){if(c()===`intentional`&&C.current){t.clear(),C.current=!1;return}typeof h==`function`&&!h(e)||A(`__outsidePressBubbles`)||(l.setOpen(!1,J(Ce,e)),k())}}}function M(e){c()!==`sloppy`||e.pointerType===`touch`||!l.select(`open`)||!n||j(e)||O(e)}function P(e){if(c()!==`sloppy`||!l.select(`open`)||!n||j(e))return;let t=e.touches[0];t&&(E.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{E.current&&(E.current.dismissOnTouchEnd=!1,E.current.dismissOnMouseDown=!1)}))}function F(e,t){let n=Et(e);if(!n)return;let r=X(n,e.type,()=>{t(e),r()})}function I(e){T.current=`touch`,F(e,P)}function L(e){D.clear(),e.type===`pointerdown`&&(T.current=e.pointerType),!(e.type===`mousedown`&&E.current&&!E.current.dismissOnMouseDown)&&F(e,e=>{e.type===`pointerdown`?M(e):O(e)})}function R(e){if(!x.current)return;let n=S.current;if(s(),c()===`intentional`){if(e.type===`pointercancel`){n&&o();return}if(!g(e)){if(n){o();return}typeof h==`function`&&!h(e)||(t.clear(),C.current=!0,k())}}}function te(e){if(c()!==`sloppy`||!E.current||j(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-E.current.startX),r=Math.abs(t.clientY-E.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(E.current.dismissOnTouchEnd=!0),i>10&&(O(e),D.clear(),E.current=null)}function ne(e){F(e,te)}function re(e){c()!==`sloppy`||!E.current||j(e)||(E.current.dismissOnTouchEnd&&O(e),D.clear(),E.current=null)}function ie(e){F(e,re)}let V=K(d),ae=Bt(r&&Bt(X(V,`keydown`,N),X(V,`compositionstart`,i),X(V,`compositionend`,a)),_&&Bt(X(V,`click`,L,!0),X(V,`pointerdown`,L,!0),X(V,`pointerup`,R,!0),X(V,`pointercancel`,R,!0),X(V,`mousedown`,L,!0),X(V,`mouseup`,R,!0),X(V,`touchstart`,I,!0),X(V,`touchmove`,ne,!0),X(V,`touchend`,ie,!0)));return()=>{ae(),e.clear(),t.clear(),s(),C.current=!1,k()}},[f,d,r,_,h,u,n,y,b,N,k,v,A,j,p,l,D]);let L=g.useMemo(()=>({onKeyDown:N,onPointerDown:M,onClick:M}),[N,M]),R=g.useMemo(()=>({onKeyDown:N,onPointerDown:I,onMouseDown:I,onClickCapture:P,onMouseDownCapture(e){P(),F(e)},onPointerDownCapture(e){P(),F(e)},onMouseUpCapture:P,onTouchEndCapture:P,onTouchMoveCapture:P}),[N,P,F,I]);return g.useMemo(()=>n?{reference:L,floating:R,trigger:L}:{},[n,L,R])}function Pr(e,t,n){let{reference:r,floating:i}=e,a=Q(t),o=ln(t),s=cn(o),c=Z(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=on(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Fr(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=an(t,e),p=xn(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Sn(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Sn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Ir=50,Lr=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Fr},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Pr(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Ir&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Pr(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Rr=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=an(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Z(r),_=Q(o),v=Z(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[yn(o)]:dn(o)),x=p!==`none`;!d&&x&&b.push(...vn(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=un(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Q(t)||T.every(e=>Q(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Q(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},zr=new Set([`left`,`top`]);async function Br(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Z(n),s=on(n),c=Q(n)===`y`,l=zr.has(o)?-1:1,u=a&&c?-1:1,d=an(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Vr=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Br(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Hr=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=an(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Q(i),p=sn(f),m=u[p],h=u[f],g=(e,t)=>rn(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Ur=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=an(e,t),u={x:n,y:r},d=Q(i),f=sn(d),p=u[f],m=u[d],h=an(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=zr.has(Z(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Wr=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=an(e,t),c=await i.detectOverflow(t,s),l=Z(n),u=on(n),d=Q(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Zt(p-c[m],g),y=Zt(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Qt(c.left,c.right):S=p-2*Qt(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Gr(e){let t=H(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=B(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=$t(n)!==a||$t(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Kr(e){return z(e)?e:e.contextElement}function qr(e){let t=Kr(e);if(!B(t))return tn(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Gr(t),o=(a?$t(n.width):n.width)/r,s=(a?$t(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Jr=tn(0);function Yr(e){let t=I(e);return!le()||!t.visualViewport?Jr:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Xr(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===I(e)}function Zr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Kr(e),o=tn(1);t&&(r?z(r)&&(o=qr(r)):o=qr(e));let s=Xr(a,n,r)?Yr(a):tn(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=I(a),t=z(r)?I(r):r,n=e,i=me(n);for(;i&&t!==n;){let e=qr(i),t=i.getBoundingClientRect(),r=H(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=I(i),i=me(n)}}return Sn({width:u,height:d,x:c,y:l})}function Qr(e,t){let n=de(e).scrollLeft;return t?t.left+n:Zr(L(e)).left+n}function $r(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Qr(e,n),y:n.top+t.scrollTop}}function ei(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=L(r),s=t?re(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=tn(1),u=tn(0),d=B(r);if((d||!a)&&((F(r)!==`body`||te(o))&&(c=de(r)),d)){let e=Zr(r);l=qr(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?$r(o,c):tn(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ti(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function ni(e){let t=de(e),n=e.ownerDocument.body,r=Qt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Qt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Qr(e),o=-t.scrollTop;return H(n).direction===`rtl`&&(a+=Qt(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var ri=25;function ii(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=I(e),a=L(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!le()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Qr(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=ri&&(s-=o)}return{width:s,height:c,x:l,y:u}}function ai(e,t){let n=Zr(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=qr(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function oi(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=ii(e,n,t);else if(t===`document`)r=ni(L(e));else if(z(t))r=ai(t,n);else{let n=Yr(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Sn(r)}function si(e,t){let n=t.get(e);if(n)return n;let r=U(e,[],!1).filter(e=>z(e)&&F(e)!==`body`),i=null,a=H(e).position===`fixed`,o=a?fe(e):e;for(;z(o)&&!ue(o);){let e=H(o),t=se(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=fe(o)}return t.set(e,r),r}function ci(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?re(t)?[]:si(t,this._c):[].concat(n),r],o=oi(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=oi(t,a[e],i);s=Qt(n.top,s),c=Zt(n.right,c),l=Zt(n.bottom,l),u=Qt(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function li(e){let{width:t,height:n}=Gr(e);return{width:t,height:n}}function ui(e,t,n){let r=B(t),i=L(t),a=n===`fixed`,o=Zr(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=tn(0);if((r||!a)&&((F(t)!==`body`||te(i))&&(s=de(t)),r)){let e=Zr(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Qr(i));let l=i&&!r&&!a?$r(i,s):tn(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function di(e){return H(e).position===`static`}function fi(e,t){if(!B(e)||H(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return L(e)===n&&(n=n.ownerDocument.body),n}function pi(e,t){let n=I(e);if(re(e))return n;if(!B(e)){let t=fe(e);for(;t&&!ue(t);){if(z(t)&&!di(t))return t;t=fe(t)}return n}let r=fi(e,t);for(;r&&ne(r)&&di(r);)r=fi(r,t);return r&&ue(r)&&di(r)&&!se(r)?n:r||ce(e)||n}var mi=async function(e){let t=this.getOffsetParent||pi,n=this.getDimensions,r=await n(e.floating);return{reference:ui(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function hi(e){return H(e).direction===`rtl`}var gi={convertOffsetParentRelativeRectToViewportRelativeRect:ei,getDocumentElement:L,getClippingRect:ci,getOffsetParent:pi,getElementRects:mi,getClientRects:ti,getDimensions:li,getScale:qr,isElement:z,isRTL:hi};function _i(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function vi(e,t,n){let r=null,i,a=L(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=en(d),h=en(a.clientWidth-(u+f)),g=en(a.clientHeight-(d+p)),_=en(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Qt(0,Zt(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!_i(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=I(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function yi(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Kr(e),u=i||a?[...l?U(l):[],...t?U(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?vi(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Zr(e):null;c&&g();function g(){let t=Zr(e);h&&!_i(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var bi=Vr,xi=Hr,Si=Rr,Ci=Wr,wi=Ur,Ti=(e,t,n)=>{let r=new Map,i=n??{},a={...gi,...i.platform,_c:r};return Lr(e,t,{...i,platform:a})},Ei=typeof document<`u`?g.useLayoutEffect:function(){};function Di(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Di(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Di(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Oi(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ki(e,t){let n=Oi(e);return Math.round(t*n)/n}function Ai(e){let t=g.useRef(e);return Ei(()=>{t.current=e}),t}function ji(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=g.useState(r);Di(f,r)||p(r);let[m,h]=g.useState(null),[_,v]=g.useState(null),y=g.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=g.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||m,S=o||_,C=g.useRef(null),w=g.useRef(null),T=g.useRef(u),E=c!=null,D=Ai(c),O=Ai(i),k=Ai(l),A=g.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Ti(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Di(T.current,t)&&(T.current=t,or.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Ei(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=g.useRef(!1);Ei(()=>(j.current=!0,()=>{j.current=!1}),[]),Ei(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=g.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=g.useMemo(()=>({reference:x,floating:S}),[x,S]),P=g.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=ki(N.floating,u.x),r=ki(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Oi(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var Mi=(e,t)=>{let n=bi(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ni=(e,t)=>{let n=xi(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pi=(e,t)=>({fn:wi(e).fn,options:[e,t]}),Fi=(e,t)=>{let n=Si(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ii=(e,t)=>{let n=Ci(e);return{name:n.name,fn:n.fn,options:[e,t]}},Li=class{attachedStores=[];attachedStoreValue=null;storeListeners=new Set;constructor(e,t,n=!0){this.fallbackStore=e,this.componentName=t,this.throwOnMissingTrigger=n}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(e){return this.storeListeners.add(e),()=>{this.storeListeners.delete(e)}}attachStore(e){return this.attachedStores.push(e),this.setActiveStore(e),()=>{let t=this.attachedStores.lastIndexOf(e);t!==-1&&this.attachedStores.splice(t,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(e){this.attachedStoreValue!==e&&(this.attachedStoreValue=e,this.storeListeners.forEach(e=>{e()}))}openByTrigger(e){let t=this.attachedStore;if(t===null)return;let n;if(e){for(let t=this.attachedStores.length-1;t>=0&&!n;--t)n=this.attachedStores[t].context.triggerElements.getById(e);n??=this.fallbackStore.context.triggerElements.getById(e)}if(e&&!n&&this.throwOnMissingTrigger)throw Error(o(99,this.componentName,e,this.componentName));t.setOpen(!0,J(ze,void 0,n))}closePopup(){let e=this.attachedStore;e!==null&&e.setOpen(!1,J(ze))}},Ri=[],zi=void 0;function Bi(){return zi}function Vi(e){Ri.push(e)}function Hi(e){let t=(t,n)=>{let r=u(Wi).current,i;try{zi=r;for(let e of Ri)e.before(r);i=e(t,n);for(let e of Ri)e.after(r);r.didInitialize=!0}finally{zi=void 0}return i};return t.displayName=e.displayName||e.name,t}function Ui(e){return g.forwardRef(Hi(e))}function Wi(){return{didInitialize:!1}}var Gi=a(19)?Ji:Yi;function Ki(e,t,n,r,i){return Gi(e,t,n,r,i)}function qi(e,t,n,r,i){let a=g.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,v.useSyncExternalStore)(e.subscribe,a,a)}Vi({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,v.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Ji(e,t,n,r,i){let a=Bi();if(!a)return qi(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function Yi(e,t,n,r,i){return(0,y.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Xi=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return Ki(this,e,t,n,r)}},Zi=class extends Xi{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){g.useDebugValue(e);let n=this;G(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;G(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;G(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){g.useDebugValue(e);let n=this,r=t!==void 0;G(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return g.useDebugValue(e),Ki(this,this.selectors[e],t,n,r)}useContextCallback(e,t){g.useDebugValue(e);let n=W(t??c);this.context[e]=n}useStateSetter(e){let t=g.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},Qi={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},$i=class extends Zi{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:xr(),nested:n,triggerElements:i},Qi),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&vt(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function ea(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=g.useRef(null);r===void 0&&f.current===null&&(f.current=new $i({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),G(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};z(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}function ta(e,t=!1,n=!1){let[r,i]=g.useState(e&&t?`idle`:void 0),[a,o]=g.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),G(()=>{if(!e&&a&&r!==`ending`&&n){let e=Gt.request(()=>{i(`ending`)});return()=>{Gt.cancel(e)}}},[e,a,r,n]),G(()=>{if(!e||t)return;let n=Gt.request(()=>{i(void 0)});return()=>{Gt.cancel(n)}},[t,e]),G(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=Gt.request(()=>{i(`idle`)});return()=>{Gt.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}function na(e,t=!1){let n=Kt();return W((r,i=null)=>{n.cancel();let a=Ar(e);if(a==null)return;let o=a,s=()=>{or.flushSync(r)};if(typeof o.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function c(){Promise.all(o.getAnimations().map(e=>e.finished)).then(()=>{i?.aborted||s()},()=>{if(!i?.aborted){if(o.getAnimations().some(e=>e.pending||e.playState!==`finished`)){c();return}s()}})}if(t){let e=`data-starting-style`;if(!o.hasAttribute(e)){n.request(c);return}let t=new MutationObserver(()=>{o.hasAttribute(e)||(t.disconnect(),c())});t.observe(o,{attributes:!0,attributeFilter:[e]}),i?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}n.request(c)})}function ra(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=W(i),o=na(r,n);g.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var ia={tabIndex:-1,[yt]:``};function aa(e){return t=>t!==`touch`||e.current}function oa(e,t=!1){let n=Ke(),r=Tr()!=null,i=u(()=>e(n,r)).current;return ea({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function sa({handle:e,store:t}){return G(()=>e.attachStore(t),[e,t]),null}function ca(e,t){let n=g.useRef(null),r=g.useRef(null);return g.useCallback(i=>{if(e===void 0)return;let a=!1;if(n.current!==null){let e=n.current,i=r.current,o=t.context.triggerElements.getById(e);i&&o===i&&(t.context.triggerElements.delete(e),a=!0),n.current=null,r.current=null}if(i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i),a=!0),a){let e=t.context.triggerElements.size;t.select(`open`)&&t.state.triggerCount!==e&&t.set(`triggerCount`,e)}},[t,e])}function la(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);let i=n?.id??null;(i||t)&&(e.activeTriggerId=i,e.activeTriggerElement=n??null)}function ua(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function da(e,t,n,r={}){let i=n.reason,a=i===q,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=ua(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i={...r.extraState,open:t};o?i.instantType=`focus`:s?i.instantType=`dismiss`:a&&(i.instantType=void 0),la(i,t,n.trigger,c()),e.update(i)};a?or.flushSync(l):l()}function fa(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=ca(e,n),o=W(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){n.update({activeTriggerElement:t,...i?r:null});return}a==null&&i&&n.update({activeTriggerId:e,activeTriggerElement:t,...r})}),s=g.useCallback(e=>{a(e),e&&o(e)},[a,o]);return G(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function pa(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=g.useRef(null),i=e.useState(`open`);G(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=J(be);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function ma(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=ta(e),o=t.useState(`preventUnmountingOnClose`),s=!e&&o;t.useSyncedValues({mounted:r,transitionStatus:a,preventUnmountingOnClose:s});let c=W(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return ra({enabled:r&&!e&&!s,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:a}}function ha(e,t){e.useSyncedValues(t),G(()=>()=>{e.update({activeTriggerProps:s,inactiveTriggerProps:s,popupProps:s})},[e])}function ga(e,t){G(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),G(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var _a=class{constructor(){this.idMap=new Map}add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}};function va(){return new $i({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new _a,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function ya(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:va(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:s,inactiveTriggerProps:s,popupProps:s}}function ba(e,t,n=!1){return new $i({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}var xa=e=>e.triggerIdProp??e.activeTriggerId,Sa=e=>e.openProp??e.open,Ca=e=>(e.popupElement?.id??e.floatingId)||void 0;function wa(e,t){return t!==void 0&&Sa(e)&&xa(e)===t}function Ta(e,t){return wa(e,t)?!0:t!==void 0&&Sa(e)&&xa(e)==null&&e.triggerCount===1}var Ea={open:Sa,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:xa,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Ca,isTriggerActive:(e,t)=>t!==void 0&&xa(e)===t,isOpenedByTrigger:(e,t)=>wa(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&xa(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Ta(e,t)?Ca(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Da(e){let t=g.useCallback(t=>e===void 0?c:e.subscribeStore(t),[e]),n=g.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,v.useSyncExternalStore)(t,n,()=>e?.serverStore)}function Oa(e){return ka(e,e.rootContext)}function ka(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=g.useState(null),[d,f]=g.useState(void 0),[p,m]=g.useState(void 0),h=g.useRef(null),_=Er(r),v=g.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),y=ji({...e,elements:{...v,...l&&{reference:l}}}),b=z(d)?d:null,x=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:b),t.useSyncedValue(`floatingElement`,x);let S=g.useCallback(e=>{let t=z(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),y.refs.setReference(t)},[y.refs]),C=g.useCallback(e=>{(z(e)||e===null)&&(h.current=e,f(e)),(z(y.refs.reference.current)||y.refs.reference.current===null||e!==null&&!z(e))&&y.refs.setReference(e)},[y.refs,f]),w=g.useCallback(e=>{m(e),y.refs.setFloating(e)},[y.refs]),T=g.useMemo(()=>({...y.refs,setReference:C,setFloating:w,setPositionReference:S,domReference:h}),[y.refs,C,w,S]),E=g.useMemo(()=>({...y.elements,domReference:o}),[y.elements,o]),D=g.useMemo(()=>({...y,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:T,elements:E,nodeId:n,rootStore:t}),[y,T,E,n,t,s,c]);return G(()=>{o&&(h.current=o)},[o]),G(()=>{t.context.dataRef.current.floatingContext=D;let e=_?.nodesRef.current.find(e=>e.id===n);e&&(e.context=D)}),g.useMemo(()=>({...y,context:D,refs:T,elements:E,rootStore:t}),[y,T,E,D,t])}var Aa=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Xe,this.restTimeout=new Xe,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},ja=new WeakMap;function Ma(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&ja.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),ja.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Na(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=ja.get(n);a&&a!==e&&Ma(a),Ma(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,ja.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function Pa(e){let t=e.context.dataRef.current,n=u(()=>t.hoverInteractionState??Aa.create()).current;return t.hoverInteractionState||=n,Je(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Fa(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=Er(),d=Tr(),f=Pa(a),p=Ze(),m=W(()=>Rt(l.current.openEvent?.type,f.interactedInside)),h=W(()=>zt(l.current.openEvent?.type)),_=W(()=>{Ma(f)});G(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,_())},[o,f,_]),g.useEffect(()=>_,[_]),G(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&z(c)&&s){let e=c,t=s,n=K(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return Na(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{_()}}},[n,o,c,s,f,h,u,d,_]),g.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&rr(u.nodesRef.current,d).length>0)}function t(e){let t=It(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,J(q,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=Et(e);if(!jt(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),_()}function g(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(Dt(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&z(o)&&rr(u.nodesRef.current,r,!1).some(e=>Y(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}_(),h()&&!m()&&t(n)}}function v(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,J(q,t)),u.events.emit(`floating.closed`,t)})}let y=s;return Bt(y&&X(y,`mouseenter`,c),y&&X(y,`mouseleave`,g),y&&X(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,_,f,u,d,p])}var Ia={current:null};function La(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=Ia,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,h=`rootStore`in e?e.rootStore:e,{dataRef:_,events:v}=h.context,y=Er(l),b=Pa(h),x=g.useRef(!1),S=Vt(i),C=Vt(r),w=Vt(o),T=Vt(n),E=Vt(p),D=Vt(f),O=W(()=>Rt(_.current.openEvent?.type,b.interactedInside)),k=W(()=>E.current?.()!==!1),A=W((e,t,n)=>{let r=h.context.triggerElements;if(r.hasElement(t))return!e||!Y(e,t);if(!z(n))return!1;let i=n;return r.hasMatchingElement(e=>Y(e,i))&&(!e||!Y(e,i))}),j=W(()=>{b.handler&&=(K(h.select(`domReferenceElement`)).removeEventListener(`mousemove`,b.handler),void 0)}),M=W(()=>{Ma(b)});return u&&(b.handleCloseOptions=S.current?.__options),g.useEffect(()=>j,[j]),g.useEffect(()=>{if(!n)return;function e(e){e.open?x.current=!1:(x.current=e.reason===q,j(),b.openChangeTimeout.clear(),b.restTimeout.clear(),b.blockMouseMove=!0,b.restTimeoutPending=!1)}return v.on(`openchange`,e),()=>{v.off(`openchange`,e)}},[n,v,b,j]),g.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=It(C.current,`close`,b.pointerType);n?b.openChangeTimeout.start(n,()=>{h.setOpen(!1,J(q,e)),y?.events.emit(`floating.closed`,e)}):t&&(b.openChangeTimeout.clear(),h.setOpen(!1,J(q,e)),y?.events.emit(`floating.closed`,e))}let t=c.current??(u?h.select(`domReferenceElement`):null);if(!z(t))return;function r(e){if(b.openChangeTimeout.clear(),b.blockMouseMove=!1,a&&!_t(b.pointerType))return;let t=Lt(w.current),n=It(C.current,`open`,b.pointerType),r=Et(e),i=e.currentTarget??null,o=h.select(`domReferenceElement`),s=i;if(z(r)&&!h.context.triggerElements.hasElement(r)){for(let e of h.context.triggerElements.elements())if(Y(e,r)){s=e;break}}z(i)&&z(o)&&!h.context.triggerElements.hasElement(i)&&Y(i,o)&&(s=o);let c=s!=null&&A(o,s,r),l=h.select(`open`),u=D.current?.()??h.select(`transitionStatus`)===`ending`,d=!l&&u&&x.current,f=!c&&z(s)&&z(o)&&Y(o,s)&&d,p=t>0&&!n,m=c&&(l||d)||f,g=!l||c;if(m){k()&&h.setOpen(!0,J(q,e,s));return}p||(n?b.openChangeTimeout.start(n,()=>{g&&k()&&h.setOpen(!0,J(q,e,s))}):g&&k()&&h.setOpen(!0,J(q,e,s)))}function i(t){if(O()){M();return}j();let n=K(h.select(`domReferenceElement`));b.restTimeout.clear(),b.restTimeoutPending=!1;let r=_.current.floatingContext??d?.();if(!Dt(t.relatedTarget,h.context.triggerElements)){if(S.current&&r){h.select(`open`)||b.openChangeTimeout.clear();let i=c.current;b.handler=S.current({...r,tree:y,x:t.clientX,y:t.clientY,onClose(){M(),j(),T.current&&!O()&&i===h.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,b.handler),b.handler(t);return}(b.pointerType!==`touch`||!Y(h.select(`floatingElement`),t.relatedTarget))&&e(t)}}function o(e){Y(t,e.relatedTarget)||(b.openChangeTimeout.clear(),b.restTimeout.clear(),b.restTimeoutPending=!1)}let l=m?X(t,`mouseout`,o):void 0;return s?Bt(X(t,`mousemove`,r,{once:!0}),X(t,`mouseenter`,r),X(t,`mouseleave`,i),l):Bt(X(t,`mouseenter`,r),X(t,`mouseleave`,i),l)},[j,M,_,C,h,n,S,b,u,A,O,a,s,w,c,y,T,d,D,k,m]),g.useMemo(()=>{if(!n)return;function e(e){b.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=h.select(`domReferenceElement`),i=h.select(`open`),o=A(r,n,e.target);if(a&&!_t(b.pointerType))return;if(i&&o&&b.handleCloseOptions?.blockPointerEvents){let e=h.select(`floatingElement`);if(e){let t=b.handleCloseOptions?.getScope?.()??n.ownerDocument.body;Na(b,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=Lt(w.current);if(i&&!o||s===0||!o&&b.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;b.restTimeout.clear();function c(){if(b.restTimeoutPending=!1,O())return;let e=h.select(`open`);!b.blockMouseMove&&(!e||o)&&k()&&h.setOpen(!0,J(q,t,n))}b.pointerType===`touch`?or.flushSync(()=>{c()}):o&&i?c():(b.restTimeoutPending=!0,b.restTimeout.start(s,c))}}},[n,b,O,A,a,h,w,k])}var Ra=.1,za=Ra*Ra,$=.5;function Ba(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Va(e,t,n,r,i,a,o,s,c,l){let u=!1;return Ba(e,t,n,r,i,a)&&(u=!u),Ba(e,t,i,a,o,s)&&(u=!u),Ba(e,t,o,s,c,l)&&(u=!u),Ba(e,t,c,l,n,r)&&(u=!u),u}function Ha(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Ua(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Wa(e={}){let{blockPointerEvents:t=!1}=e,n=new Xe,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*za;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=Et(r),g=r.type===`mouseleave`,_=Y(u,h),v=Y(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&z(r.relatedTarget)&&Y(u,r.relatedTarget))return;function y(){return!!(s&&rr(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=Ua(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=Ua(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=Ua(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=Ua(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!Ha(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?$/2:$*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+$+1,o=C||T?S.bottom-$:S.top,s=C?T?S.bottom-$:S.top:S.bottom-$;M=Va(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?$/2:$*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-$,o=C||T?S.top+$:S.bottom,s=C?T?S.top+$:S.bottom:S.top+$;M=Va(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?$/2:$*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+$+1,o=w||E?S.right-$:S.left,s=w?E?S.right-$:S.left:S.right-$;M=Va(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?$/2:$*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-$,o=w||E?S.left+$:S.right,s=w?E?S.left+$:S.right:S.left+$;M=Va(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function Ga(e){return a(19)?e:e?`true`:void 0}var Ka=class extends Zi{setState(e){}update(e){}set(e,t){}notifyAll(){}},qa=g.createContext(void 0);function Ja(){return g.useContext(qa)?.direction??`ltr`}var Ya=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=an(e,t)||{};if(l==null)return{};let f=xn(u),p={x:n,y:r},m=ln(i),h=cn(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=rn(k,j,A),N=!c.arrow&&on(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),Xa=(e,t)=>({...Ya(e),options:[e,t]}),Za={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},Qa={sideX:`left`,sideY:`top`},$a=`--available-width`,eo=`--available-height`;function to(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function no(e,t,n){let{rects:r,placement:i}=e;return{side:to(t,Z(i),n),align:on(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function ro(e){return io(e,Oa)}function io(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:_,collisionAvoidance:v,shift:y,nodeId:b,adaptiveOrigin:x,lazyFlip:S=!1,externalTree:C}=e,[w,T]=g.useState(null);!_&&w!==null&&T(null);let E=v.side||`flip`,D=v.align||`flip`,O=v.fallbackAxisSide||`end`,k=y?.crossAxis??!1,A=y?.rootBoundary,j=typeof n==`function`?n:void 0,M=W(j),N=j?M:n,P=Vt(n),F=Vt(_),L=Ja()===`rtl`,R=w||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":L?`left`:`right`,"inline-start":L?`right`:`left`}[i],z=o===`center`?R:`${R}-${o}`,B=l;typeof B==`number`?B={top:B,right:B,bottom:B,left:B}:B&&={top:B.top||0,right:B.right||0,bottom:B.bottom||0,left:B.left||0};let ee=+(i===`bottom`),te=+(i===`top`),ne=+(i===`right`),re=+(i===`left`),ie={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:B},V=g.useRef(null),ae=Vt(a),oe=Vt(s),se=typeof a==`function`?0:a,ce=typeof s==`function`?0:s,le=[];p&&le.push(p),le.push(Mi(e=>{let t=no(e,i,L),n=typeof ae.current==`function`?ae.current(t):ae.current,r=typeof oe.current==`function`?oe.current(t):oe.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[se,ce,L,i]));let ue=D===`none`&&E!==`shift`,H=!ue&&(u||k||E===`shift`),de=E===`none`?null:Fi({...ie,padding:{top:B.top+1+ee,right:B.right+1+re,bottom:B.bottom+1+te,left:B.left+1+ne},mainAxis:!k&&E===`flip`,crossAxis:D===`flip`&&`alignment`,fallbackAxisSideDirection:O}),fe=ue?null:Ni({...ie,rootBoundary:A,mainAxis:D!==`none`,crossAxis:H,limiter:u||k?void 0:Pi(e=>{if(!V.current)return{};let{width:t,height:n}=V.current.getBoundingClientRect(),r=Q(Z(e.placement)),i=r===`y`?t:n,a=r===`y`?B.left+B.right:B.top+B.bottom;return{offset:i/2+a/2}})},[ie,u,k,A,B,D]);E===`shift`||D===`shift`||o===`center`?le.push(fe,de):le.push(de,fe),le.push(Ii({...ie,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!F.current)return;let i=e.style;i.setProperty($a,`${t}px`),i.setProperty(eo,`${n}px`);let a=I(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),Xa(e=>({element:V.current||K(e.elements.floating).createElement(`div`),padding:d,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:r,rects:o,y:s}=e,c=Z(r),l=Q(c),u=V.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof a==`function`?a(no(e,i,L)):a,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,H&&l===`y`&&b?S:x),{}}},Za,x),G(()=>{!_&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[_,h]);let pe=g.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:U,elements:me,x:he,y:ge,middlewareData:_e,update:ve,placement:ye,context:be,isPositioned:xe,floatingStyles:q}=t({rootContext:h,open:m?_:void 0,placement:z,middleware:le,strategy:r,whileElementsMounted:m?void 0:(...e)=>yi(...e,pe),nodeId:b,externalTree:C}),{sideX:Se,sideY:Ce}=_e.adaptiveOrigin||Qa,we=xe?r:`fixed`,Te=g.useMemo(()=>{let e;return e=xe?x?{position:we,[Se]:he,[Ce]:ge}:{...q,position:we}:{position:we,top:0,left:0},e[$a]=`100vw`,e[eo]=`100vh`,xe||(e.opacity=0),e},[x,we,Se,he,Ce,ge,q,xe]),Ee=g.useRef(null);G(()=>{if(!_)return;let e=P.current,t=typeof e==`function`?e():e,n=(ao(t)?t.current:t)||null;n!==Ee.current&&(U.setPositionReference(n),Ee.current=n)},[_,U,N,P]),g.useEffect(()=>{if(!_)return;let e=P.current;typeof e!=`function`&&ao(e)&&e.current!==Ee.current&&(U.setPositionReference(e.current),Ee.current=e.current)},[_,U,N,P]),g.useEffect(()=>{if(m&&_&&me.reference&&me.floating)return yi(me.reference,me.floating,ve,pe)},[m,_,me,ve,pe]);let De=Z(ye),Oe=to(i,De,L),ke=on(ye)||`center`,Ae=!!_e.hide?.referenceHidden;G(()=>{S&&_&&xe&&De!==R&&T(De)},[S,_,xe,De,R]);let je=g.useMemo(()=>({position:`absolute`,top:_e.arrow?.y,left:_e.arrow?.x}),[_e.arrow]),Me=_e.arrow?.centerOffset!==0;return g.useMemo(()=>({positionerStyles:Te,arrowStyles:je,arrowRef:V,arrowUncentered:Me,side:Oe,align:ke,physicalSide:De,anchorHidden:Ae,refs:U,context:be,isPositioned:xe,update:ve}),[Te,je,V,Me,Oe,ke,De,Ae,U,be,xe,ve])}function ao(e){return e!=null&&`current`in e}function oo(e){return e===`starting`?sr:s}function so(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),l(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},oo(r),i],stateAttributesMapping:M})}function co(e){let[t,n]=g.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function lo(e){let t=H(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=B(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return($t(n)!==a||$t(r)!==o)&&(n=a,r=o),{width:n,height:r}}function uo(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,onMeasureLayout:a,onMeasureLayoutComplete:o,side:s,direction:l}=e,u=na(t,!0),d=Kt(),f=g.useRef(null),p=g.useRef(!0),m=g.useRef(c),h=W(a),_=W(o),v=g.useMemo(()=>fo(s,l),[s,l]);G(()=>{if(!i){m.current=c,p.current=!0,f.current=null;return}if(!t||!n)return;m.current=mo(t,v),ho(t,`auto`);let e=po(t,`position`,`static`),r=po(t,`transform`,`none`),a=po(t,`scale`,`1`),o=mo(n,{"--available-width":`max-content`,"--available-height":`max-content`});function s(){e(),r(),o()}function l(){s(),a()}if(h?.(),p.current||f.current===null){go(n,`max-content`);let e=lo(t);return f.current=e,go(n,e),l(),_?.(null,e),p.current=!1,()=>{m.current(),m.current=c}}go(n,`max-content`);let g=f.current,y=lo(t);f.current=y,ho(t,g),l(),_?.(g,y),go(n,y);let b=new AbortController;return d.request(()=>{ho(t,y),u(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},b.signal)}),()=>{b.abort(),d.cancel(),m.current(),m.current=c}},[r,t,n,u,d,i,h,_,v])}function fo(e,t){let n=e===`top`,r=e===`left`||e===(t===`rtl`?`inline-end`:`inline-start`);return!n&&!r?s:{position:`absolute`,[n?`bottom`:`top`]:`0`,[r?`right`:`left`]:`0`}}function po(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function mo(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(po(e,r,i));return n.length?()=>{n.forEach(e=>e())}:c}function ho(e,t){let n=t===`auto`?`auto`:`${t.width}px`,r=t===`auto`?`auto`:`${t.height}px`;e.style.setProperty(`--popup-width`,n),e.style.setProperty(`--popup-height`,r)}function go(e,t){let n=t===`max-content`?`max-content`:`${t.width}px`,r=t===`max-content`?`max-content`:`${t.height}px`;e.style.setProperty(`--positioner-width`,n),e.style.setProperty(`--positioner-height`,r)}var _o={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=I(i),l=c.getComputedStyle(i);if(l.transitionDuration===`0s`||l.transitionDuration===``)return{x:t,y:n,data:Qa};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=K(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=Z(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:Qa.sideX,g=f===`top`?`bottom`:Qa.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}},vo={activationDirection:e=>e?{"data-activation-direction":e}:null};function yo(e){let{store:t,side:n,children:r}=e,i=Ja(),a=t.useState(`activeTriggerElement`),o=t.useState(`activeTriggerId`),s=t.useState(`open`),c=t.useState(`payload`),l=t.useState(`mounted`),u=t.useState(`popupElement`),d=t.useState(`positionerElement`),f=co(s?a:null),p=Co(o,c),m=g.useRef(null),[h,v]=g.useState(null),[y,b]=g.useState(null),x=g.useRef(null),S=g.useRef(null),C=na(x,!0),w=Kt(),T=g.useRef(null),[E,D]=g.useState(null),[O,k]=g.useState(!1);G(()=>(t.set(`adaptiveOrigin`,_o),()=>{t.set(`adaptiveOrigin`,void 0)}),[t]);let A=W(()=>{x.current?.style.setProperty(`animation`,`none`),x.current?.style.setProperty(`transition`,`none`),S.current?.style.setProperty(`display`,`none`)}),j=W(e=>{x.current?.style.removeProperty(`animation`),x.current?.style.removeProperty(`transition`),S.current?.style.removeProperty(`display`),e&&D(e)}),M=W(()=>{T.current?.abort();let e=new AbortController;T.current=e,C(()=>{v(null),D(null),m.current=null},e.signal)}),N=g.useRef(null);G(()=>{(!s||!l)&&(N.current=null)},[s,l]),G(()=>{if(a&&f&&a!==f&&N.current!==a&&m.current){v(m.current),k(!0);let e=So(f,a);b(e),N.current=a}},[a,f]),G(()=>{h!=null&&(T.current?.abort(),k(!0),w.request(()=>{or.flushSync(()=>{k(!1)}),M()}))},[p,h,M,w]),G(()=>{let e=x.current;if(!e)return;let t=K(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));m.current=t});let P=h!=null,F;F=P?(0,_.jsxs)(g.Fragment,{children:[(0,_.jsx)(`div`,{"data-previous":!0,inert:Ga(!0),ref:S,style:{...E?{"--popup-width":`${E.width}px`,"--popup-height":`${E.height}px`}:null,position:`absolute`},"data-ending-style":O?void 0:``},`previous`),(0,_.jsx)(`div`,{"data-current":!0,ref:x,"data-starting-style":O?``:void 0,children:r},p)]}):(0,_.jsx)(`div`,{"data-current":!0,ref:x,children:r},p),G(()=>{let e=S.current;!e||!h||e.replaceChildren(...Array.from(h.childNodes))},[h]),uo({popupElement:u,positionerElement:d,mounted:l,content:c,onMeasureLayout:A,onMeasureLayoutComplete:j,side:n,direction:i});let I={activationDirection:bo(y),transitioning:P};return{children:F,state:I}}function bo(e){if(e)return`${xo(e.horizontal,5,`right`,`left`)} ${xo(e.vertical,5,`down`,`up`)}`}function xo(e,t,n,r){return e>t?n:e<-t?r:``}function So(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:a.x-i.x,vertical:a.y-i.y}}function Co(e,t){let[n,r]=g.useState(0),i=g.useRef(e),a=g.useRef(t),o=g.useRef(!1);return G(()=>{let n=i.current,s=a.current,c=e!==n,l=t!==s;c?(r(e=>e+1),o.current=!l):o.current&&l&&(r(e=>e+1),o.current=!1),i.current=e,a.current=t},[e,t]),`${e??`current`}-${n}`}export{_r as $,it as $t,fa as A,Ve as An,Bt as At,Ui as B,B as Bn,Et as Bt,aa as C,Ce as Cn,Sn as Ct,ha as D,Se as Dn,Gt as Dt,ma as E,Be as En,Yt as Et,$i as F,F as Fn,Mt as Ft,Or as G,M as Gn,_t as Gt,gi as H,te as Hn,xt as Ht,Zi as I,U as In,At as It,Tr as J,A as Jn,pt as Jt,kr as K,N as Kn,ht as Kt,Xi as L,fe as Ln,Nt as Lt,na as M,G as Mn,It as Mt,ta as N,W as Nn,Pt as Nt,oa as O,q as On,Kt as Ot,ea as P,H as Pn,Dt as Pt,yr as Q,p as Qn,ot as Qt,Ki as R,I as Rn,Tt as Rt,ua as S,be as Sn,kn as St,pa as T,Le as Tn,Jt as Tt,Nr as U,ee as Un,St as Ut,Li as V,ue as Vn,wt as Vt,Ar as W,w as Wn,Ct as Wt,Sr as X,C as Xn,ut as Xt,Er as Y,b as Yn,ft as Yt,br as Z,h as Zn,lt as Zt,Ea as _,Oe as _n,On as _t,oo as a,Ke as an,ar as at,sa as b,Pe as bn,jn as bt,Ka as c,Ie as cn,Kn as ct,La as d,Me as dn,Qn as dt,st as en,dr as et,Fa as f,Re as fn,$n as ft,ba as g,De as gn,Dn as gt,ya as h,ze as hn,qn as ht,so as i,qe as in,mr as it,ra as j,K as jn,X as jt,ga as k,xe as kn,Vt as kt,Ga as l,Ee as ln,Yn as lt,Da as m,Ae as mn,Gn as mt,yo as n,Ze as nn,pr as nt,ro as o,J as on,ir as ot,Pa as p,je as pn,er as pt,Dr as q,j as qn,gt as qt,co as r,Je as rn,fr as rt,Ja as s,He as sn,rr as st,vo as t,Xe as tn,cr as tt,Wa as u,Te as un,Xn as ut,_a as v,ke as vn,En as vt,la as w,Fe as wn,Xt as wt,da as x,Ne as xn,wn as xt,ia as y,we as yn,Tn as yt,Hi as z,z as zn,Y as zt};
@@ -0,0 +1 @@
1
+ import{i as e,t}from"./react-SIfiwpqq.js";import{It as n}from"./composerDraftStore-CdJJZe42.js";import{$ as r,$t as i,At as a,Bn as o,Bt as s,Dt as c,Fn as l,Ft as u,Hn as d,It as ee,Jt as te,Kt as ne,Mn as f,Nn as p,Nt as m,Ot as re,Rn as h,Rt as g,Un as _,W as v,Y as ie,Zt as ae,at as oe,bt as se,ct as y,ht as ce,jn as b,jt as x,kt as S,lt as le,mn as ue,mt as de,nn as fe,on as pe,ot as me,pt as he,qt as ge,st as _e,tn as ve,ut as ye,wt as be,zt as C}from"./usePopupViewport-BuhsNdVy.js";import{l as xe,s as w}from"./useRenderElement-DchFnsR8.js";var T=e(t(),1),E=0;function Se(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(E);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),w;let o=requestAnimationFrame(a);return E=o,()=>{E===o&&(cancelAnimationFrame(o),E=0)}}var D={inert:new WeakMap,"aria-hidden":new WeakMap},Ce=`data-base-ui-inert`,O={inert:new WeakSet,"aria-hidden":new WeakSet},k=new WeakMap,A=0;function j(e){return O[e]}function M(e){return e?_(e)?e.host:M(e.parentNode):null}var N=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=M(t);return e.contains(n)?n:null}).filter(e=>e!=null),P=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},F=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{l(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function we(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=N(t,e),l=i?F(t,P(c),new Set(c)):[],u=[],d=[];if(a){let e=D[a],n=j(a);s=n,o=e;let r=N(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);F(t,P(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(k.get(e)||0)+1;k.set(e,t),d.push(e),t===1&&e.setAttribute(Ce,``)}),A+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(k.get(e)||0)-1;k.set(e,t),t||e.removeAttribute(Ce)}),--A,A||(D.inert=new WeakMap,D[`aria-hidden`]=new WeakMap,O.inert=new WeakSet,O[`aria-hidden`]=new WeakSet,k=new WeakMap)}}function Te(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=b(e[0]).body;return we(e,a,n,r,{mark:i})}var I=n();function Ee(e,t){let n=h(s(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var L=20,R=[];function De(){R=R.filter(e=>e.deref()?.isConnected)}function Oe(e){De(),e&&l(e)!==`body`&&(R.push(new WeakRef(e)),R.length>L&&(R=R.slice(-20)))}function ke(){return De(),R[R.length-1]?.deref()}function Ae(e){return e?de(e)?e:ce(e)[0]||e:null}function je(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=y(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return de(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function Me(e){let{context:t,children:n,disabled:i=!1,initialFocus:c=!0,returnFocus:d=!0,restoreFocus:h=!1,modal:_=!0,closeOnFocusOut:y=!0,openInteractionType:ve=``,nextFocusableElement:w,previousFocusableElement:E,beforeContentFocusGuardRef:D,externalTree:Ce,getInsideElements:O}=e,k=`rootStore`in t?t.rootStore:t,A=k.useState(`open`),j=k.useState(`domReferenceElement`),M=k.useState(`floatingElement`),{events:N,dataRef:P}=k.context,F=p(()=>P.current.floatingContext?.nodeId),we=c===!1,L=u(j)&&we,R=S(c),Me=S(d),z=S(ve),Ne=S(A),B=ie(Ce),V=r(),H=T.useRef(!1),U=T.useRef(!1),W=T.useRef(!1),Pe=T.useRef(null),Fe=T.useRef(``),G=T.useRef(``),Ie=T.useRef(null),K=T.useRef(null),q=xe(Ie,D,V?.beforeInsideRef),Le=xe(K,V?.afterInsideRef),J=fe(),Y=fe(),Re=re(),X=V!=null,Z=m(M),Q=p((e=Z)=>e?ce(e):[]),$=p(()=>O?.().filter(e=>e!=null)??[]);T.useEffect(()=>{if(i||!_)return;function e(e){e.key===`Tab`&&C(Z,g(b(Z)))&&Q().length===0&&!L&&te(e)}let t=b(Z);return x(t,`keydown`,e)},[i,Z,_,L,Q]),T.useEffect(()=>{if(i||!A)return;let e=b(Z);function t(){W.current=!1}function n(e){let t=s(e),n=$(),r=C(M,t)||C(j,t)||C(V?.portalNode,t)||n.some(e=>e===t||C(e,t));W.current=!r,G.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(U.current=!0,Y.start(0,()=>{U.current=!1}))}function r(){G.current=`keyboard`}return a(x(e,`pointerdown`,n,!0),x(e,`pointerup`,t,!0),x(e,`pointercancel`,t,!0),x(e,`keydown`,r,!0),t)},[i,M,j,Z,A,V,Y,$]),T.useEffect(()=>{if(i||!y)return;let e=b(Z);function t(){U.current=!0,Y.start(0,()=>{U.current=!1})}function n(e){let t=s(e);de(t)&&(Pe.current=t)}function r(t){let n=t.relatedTarget,r=t.currentTarget,i=s(t);_&&n==null&&i!=null&&C(M,i)&&Oe(i),queueMicrotask(()=>{let a=F(),s=k.context.triggerElements,c=$(),l=n?.hasAttribute(oe(`focus-guard`))&&[Ie.current,K.current,V?.beforeInsideRef.current,V?.afterInsideRef.current,V?.beforeOutsideRef.current,V?.afterOutsideRef.current,v(E),v(w)].includes(n),u=!(C(j,n)||C(M,n)||C(n,M)||C(V?.portalNode,n)||c.some(e=>e===n||C(e,n))||s.hasMatchingElement(e=>C(e,n))||l||B&&(_e(B.nodesRef.current,a).find(e=>C(e.context?.elements.floating,n)||C(e.context?.elements.domReference,n))||me(B.nodesRef.current,a).find(e=>[e.context?.elements.floating,m(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===j&&Z&&je(Z),h&&r!==j&&!se(i)&&g(e)===e.body){if(o(Z)&&(Z.focus(),h===`popup`)){Re.request(()=>{Z.focus()});return}let e=Q(),t=Pe.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||Z;o(n)&&n.focus()}if(P.current.insideReactTree){P.current.insideReactTree=!1;return}(L||!_)&&n&&u&&!U.current&&(L||n!==ke())&&(H.current=!0,k.setOpen(!1,pe(ue,t)))})}function c(){W.current||(P.current.insideReactTree=!0,J.start(0,()=>{P.current.insideReactTree=!1}))}let l=o(j)?j:null;if(!(!M&&!l))return a(l&&x(l,`focusout`,r),l&&x(l,`pointerdown`,t),M&&x(M,`focusin`,n),M&&x(M,`focusout`,r),M&&V&&x(M,`focusout`,c,!0))},[i,j,M,Z,_,B,V,k,y,h,Q,L,F,P,J,Y,Re,w,E,$]),T.useEffect(()=>{if(i||!M||!A)return;let e=Array.from(V?.portalNode?.querySelectorAll(`[${oe(`portal`)}]`)||[]),t=(B?me(B.nodesRef.current,F()):[]).find(e=>u(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Te([M,...e,Ie.current,K.current,V?.beforeOutsideRef.current,V?.afterOutsideRef.current,...$(),t,v(E),v(w),L?j:null].filter(e=>e!=null),{ariaHidden:_||L,mark:!1}),r=Te([M,...e].filter(e=>e!=null));return()=>{r(),n()}},[A,i,j,M,_,V,L,B,F,w,E,$]),f(()=>{if(!A||i||!o(Z))return;Fe.current=``,G.current=``;let e=b(Z),t=g(e);queueMicrotask(()=>{let n=R.current,r=typeof n==`function`?n(z.current||``):n;if(r===void 0||r===!1||C(Z,t))return;let i=null,a=()=>(i??=Q(Z),i[0]||Z),o;o=r===!0||r===null?a():v(r),o||=a();let s=C(Z,g(e));Se(o,{preventScroll:o===Z,shouldFocus(){if(!Ne.current)return!1;if(s)return!0;let t=g(e);return!(t!==o&&C(Z,t))}})})},[i,A,Z,Q,R,z,Ne]),f(()=>{if(i||!Z)return;let e=b(Z),t=g(e),n=z.current==null;Oe(t);function r(e){if(e.open||(Fe.current=Ee(e.nativeEvent,G.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(H.current=!0),e.reason===`outside-press`){if(e.nested)H.current=!1;else if(ne(e.nativeEvent)||ge(e.nativeEvent))H.current=!1;else{let e=!1;b(Z).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?H.current=!1:H.current=!0}}}N.on(`openchange`,r);function a(e){let r=Me.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=j?.isConnected?j:null,o=t?.isConnected&&l(t)!==`body`?t:null,s=n?o||a:a||o;return s||=ke()||null,typeof i==`boolean`?s:v(i)||s||null}return()=>{N.off(`openchange`,r);let t=g(e),n=$(),i=C(M,t)||n.some(e=>e===t||C(e,t))||B&&_e(B.nodesRef.current,F(),!1).some(e=>C(e.context?.elements.floating,t)),s=Me.current,c=Fe.current,l=a(c);queueMicrotask(()=>{let n=Ae(l),r=typeof s!=`boolean`;if(s&&!H.current&&o(n)&&(!(!r&&n!==t&&t!==e.body)||i)){let e={preventScroll:!0};c===`keyboard`&&(e.focusVisible=!0),n.focus(e)}H.current=!1})}},[i,M,Z,Me,z,N,B,j,F,$]),f(()=>{if(!ae||A||!M)return;let e=g(b(M));!o(e)||!ee(e)||C(M,e)&&e.blur()},[A,M]),f(()=>{if(!(i||!V))return V.setFocusManagerState({modal:_,closeOnFocusOut:y,open:A,onOpenChange:k.setOpen,domReference:j}),()=>{V.setFocusManagerState(null)}},[i,V,_,A,k,y,j]),f(()=>{if(!(i||!Z))return je(Z),()=>{queueMicrotask(De)}},[i,Z]);let ze=!i&&(!_||!L)&&(X||_);return(0,I.jsxs)(T.Fragment,{children:[ze&&(0,I.jsx)(be,{"data-type":`inside`,ref:q,onFocus:e=>{if(_){let e=Q();Se(e[e.length-1])}else V?.portalNode&&(H.current=!1,he(e,V.portalNode)?le(j)?.focus():v(E??V.beforeOutsideRef)?.focus())}}),n,ze&&(0,I.jsx)(be,{"data-type":`inside`,ref:Le,onFocus:e=>{_?Se(Q()[0]):V?.portalNode&&(y&&(H.current=!0),he(e,V.portalNode)?ye(j)?.focus():v(w??V.afterOutsideRef)?.focus())}})]})}var z=`ArrowUp`,Ne=`ArrowDown`,B=`ArrowLeft`,V=`ArrowRight`,H=`Home`,U=new Set([z,Ne,B,V,H,`End`]),W=`Shift`,Pe=[W,`Control`,`Alt`,`Meta`];function Fe(e){return o(e)&&e.tagName===`INPUT`}function G(e){return!!(Fe(e)&&e.selectionStart!=null||o(e)&&e.tagName===`TEXTAREA`)}function Ie(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=K(e,t,`left`),a=q(e),o=q(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=K(e,t,`top`),r=q(e),i=q(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function K(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function q(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var Le=T.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,I.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),J={},Y={},Re=``;function X(e,t){return d(e)?e:t}function Z(e,t,n){return/hidden|clip/.test(e.getComputedStyle(X(t,n)).overflowY)}function Q(e){if(typeof document>`u`)return!1;let t=b(e);return h(t).innerWidth-t.documentElement.clientWidth>0}function $(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=b(e),n=t.documentElement,r=t.body,i=X(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function ze(e){let t=b(e),n=t.documentElement,r=t.body,i=X(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function Be(e){let t=b(e),n=t.documentElement,r=t.body,i=h(n),a=0,o=0,s=!1,l=c.create();if(ae&&(i.visualViewport?.scale??1)!==1)return()=>{};function u(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,J={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Re=n.style.scrollBehavior,Y={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,ee=t.overflowY===`scroll`||c.overflowY===`scroll`,te=t.overflowX===`scroll`||c.overflowX===`scroll`,ne=Math.max(0,i.innerWidth-r.clientWidth),f=Math.max(0,i.innerHeight-r.clientHeight),p=parseFloat(c.marginTop)+parseFloat(c.marginBottom),m=parseFloat(c.marginLeft)+parseFloat(c.marginRight),re=X(n,r);if(s=$(e),s){n.style.scrollbarGutter=l,re.style.overflowY=`hidden`,re.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||ee)&&(n.style.overflowY=`scroll`),(d||te)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:p||f?`calc(100dvh - ${p+f}px)`:`100dvh`,width:m||ne?`calc(100vw - ${m+ne}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function d(){Object.assign(n.style,J),Object.assign(r.style,Y),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=Re)}function ee(){d(),l.request(u)}u();let te=x(i,`resize`,ee);return()=>{l.cancel(),d(),typeof i.removeEventListener==`function`&&te()}}var Ve=new class{lockCount=0;restore=null;timeoutLock=ve.create();timeoutUnlock=ve.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=b(e),n=t.documentElement,r=t.body,a=h(n);if(Z(a,n,r)){let t=new a.MutationObserver(()=>{Z(a,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),i={attributes:!0};t.observe(n,i),t.observe(r,i),this.restore=()=>t.disconnect();return}let o=i||!Q(e);this.restore=o?ze(e):Be(e)}};function He(e=!0,t=null){f(()=>{if(e)return Ve.acquire(t)},[e,t])}export{V as a,H as c,G as d,Ie as f,B as i,Pe as l,Se as m,Le as n,z as o,Me as p,Ne as r,U as s,He as t,W as u};