@openscout/scout 0.2.87 → 0.2.90

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 (486) hide show
  1. package/README.md +10 -5
  2. package/bin/scoutd +0 -0
  3. package/dist/build-manifest.json +4 -4
  4. package/dist/client/assets/ActivityScreen-BUeb4ERK.js +1 -0
  5. package/dist/client/assets/{AddProjectForm-Dw2oyCcz.js → AddProjectForm-DtTfn4Zk.js} +1 -1
  6. package/dist/client/assets/AgentAvatar-CneOa70z.js +1 -0
  7. package/dist/client/assets/AgentConfigurationScreen-CkZ7EjZh.js +1 -0
  8. package/dist/client/assets/AgentDefinitionsWorkspace-0Y3kqMtv.js +1 -0
  9. package/dist/client/assets/{AgentDetailCard-2DZQahiN.js → AgentDetailCard-Dtc02KUO.js} +1 -1
  10. package/dist/client/assets/AgentFloorView-B5raPB_U.js +1 -0
  11. package/dist/client/assets/AgentInfoScreen-DFG4ElZD.js +1 -0
  12. package/dist/client/assets/{AgentLaneCard-CeSjWWwh.js → AgentLaneCard-BRAkw8YJ.js} +1 -1
  13. package/dist/client/assets/{AgentLaneChrome-Do7CXwin.js → AgentLaneChrome-T8QE5742.js} +1 -1
  14. package/dist/client/assets/AgentLaneDetailSheet-C8RYotnv.js +4 -0
  15. package/dist/client/assets/{AgentLaneSummaryResize--lHgnncr.js → AgentLaneSummaryResize-FyYweLo_.js} +1 -1
  16. package/dist/client/assets/AgentLanesEmbedScreen-Br7cmZVO.js +1 -0
  17. package/dist/client/assets/{AgentLanesPreflight-BwkGk8JH.js → AgentLanesPreflight-Cil3dNwu.js} +1 -1
  18. package/dist/client/assets/AgentLanesView-DPfO8MOo.js +2 -0
  19. package/dist/client/assets/{AgentLiveActions-BmXDRxER.js → AgentLiveActions-DwScaVRF.js} +1 -1
  20. package/dist/client/assets/AgentSessions-DKoWA0Lm.js +6 -0
  21. package/dist/client/assets/AgentsConsole-DoBIWGoq.js +1 -0
  22. package/dist/client/assets/AgentsScreen-JuUiSuwY.js +1 -0
  23. package/dist/client/assets/AgentsSubnav-BV0WAgzf.js +1 -0
  24. package/dist/client/assets/{AtopView-DOKJbiJL.js → AtopView-ycxMrRwp.js} +1 -1
  25. package/dist/client/assets/BackToPicker-D6WgIDb-.js +1 -0
  26. package/dist/client/assets/BriefingDetailScreen-Zw-taW1s.js +6 -0
  27. package/dist/client/assets/{BriefingsScreen-DLIJ8eYj.js → BriefingsScreen-BerYOoWS.js} +1 -1
  28. package/dist/client/assets/{BrokerMetadataPanel-C8WERmHF.js → BrokerMetadataPanel-Cu93j-Ga.js} +1 -1
  29. package/dist/client/assets/BrokerScreen-CeN90URH.js +5 -0
  30. package/dist/client/assets/ChatCollapsedStrip-DdKyMSEM.js +1 -0
  31. package/dist/client/assets/{CodeDiffPane-CtgqIuS0.js → CodeDiffPane-BjCOBLze.js} +1 -1
  32. package/dist/client/assets/{CodeProjectPicker-C4W_udc7.js → CodeProjectPicker-NSGdCaK0.js} +1 -1
  33. package/dist/client/assets/{CodeScreen-WhTvVUKY.js → CodeScreen-CA9Sq6Dx.js} +1 -1
  34. package/dist/client/assets/ContextMenu-DnFcmfMR.js +1 -0
  35. package/dist/client/assets/ConversationComposer-CjRXFkvY.js +1 -0
  36. package/dist/client/assets/ConversationFeedRows-CgRTIpAv.js +1 -0
  37. package/dist/client/assets/ConversationHeader-CRmdtuL7.js +1 -0
  38. package/dist/client/assets/ConversationPanels-DCkcLIHk.js +2 -0
  39. package/dist/client/assets/ConversationScreen-Br0QQ3xo.js +1 -0
  40. package/dist/client/assets/ConversationScreen-yIKEsm-8.css +1 -0
  41. package/dist/client/assets/ConversationStatus-BJ1CMbAv.js +1 -0
  42. package/dist/client/assets/{DataTable-DFacT2uu.js → DataTable-Dzqiaha4.js} +1 -1
  43. package/dist/client/assets/{DispatchAftermath-D797PbCe.js → DispatchAftermath-B0WMg_z3.js} +1 -1
  44. package/dist/client/assets/DocumentFocusViewer-CZVVIAD5.js +1 -0
  45. package/dist/client/assets/{EmbeddableSurfacesLab-JczLmmF-.js → EmbeddableSurfacesLab-C3a7hJWO.js} +1 -1
  46. package/dist/client/assets/{EmptyState-uQbB-bvP.js → EmptyState-CYNJZMrZ.js} +1 -1
  47. package/dist/client/assets/{FileViewerPane-ebbCtnHE.js → FileViewerPane-Fwt8_KmD.js} +1 -1
  48. package/dist/client/assets/FleetSearch-Dsi_l2KW.js +1 -0
  49. package/dist/client/assets/FleetSearch-EXOe8ulE.css +1 -0
  50. package/dist/client/assets/FlightObserveScreen-g_tiGmvz.js +1 -0
  51. package/dist/client/assets/{FollowScreen-Bfu2_KtU.js → FollowScreen-Bb_rcrzi.js} +1 -1
  52. package/dist/client/assets/{HarnessMark-CEzmPFHC.js → HarnessMark-DrE57dUq.js} +1 -1
  53. package/dist/client/assets/HarnessesScreen-CAsCJ_tG.js +1 -0
  54. package/dist/client/assets/{HerdrSession-BDLa_rrK.js → HerdrSession-1eVu9Owj.js} +1 -1
  55. package/dist/client/assets/HomeHero-DEl-WBsT.css +1 -0
  56. package/dist/client/assets/HomeHero-W445QrG1.js +1 -0
  57. package/dist/client/assets/{KnowledgeSearchInspector-GjmxYBi_.js → KnowledgeSearchInspector-CbPVg3fr.js} +1 -1
  58. package/dist/client/assets/KnowledgeSearchScreen-C1lN1xJk.js +1 -0
  59. package/dist/client/assets/{LaneToolHoverCard-DCY-m0JK.js → LaneToolHoverCard-BkBcDYm-.js} +1 -1
  60. package/dist/client/assets/LaneTraceDetailSheet-CzTd44rf.js +1 -0
  61. package/dist/client/assets/{LaneTraceEventFocus-BfKZ7G5c.js → LaneTraceEventFocus-BmMmPTyJ.js} +1 -1
  62. package/dist/client/assets/{MeshCanvas-CZYHLTvw.js → MeshCanvas-DwkjsiJ5.js} +2 -2
  63. package/dist/client/assets/{MeshCanvasMinimap-D3mJ78CM.js → MeshCanvasMinimap-vmCpU1sD.js} +1 -1
  64. package/dist/client/assets/MeshScreen-CkMepUpT.js +1 -0
  65. package/dist/client/assets/{MeshTopologyView-A-wh0Ad1.js → MeshTopologyView-BD2xLE2C.js} +2 -2
  66. package/dist/client/assets/MessageComposerSuggestions-qbalTne_.js +1 -0
  67. package/dist/client/assets/MessagesScreen-C8UynyLC.js +1 -0
  68. package/dist/client/assets/{MissionContextRail-MTL2EAnr.js → MissionContextRail-D5MEP2f4.js} +1 -1
  69. package/dist/client/assets/MissionControlView-K_I7eftL.js +1 -0
  70. package/dist/client/assets/MissionFocusOverlay-CWKLdUKG.js +1 -0
  71. package/dist/client/assets/MissionLeftAgentRow-ByGrNAcs.js +1 -0
  72. package/dist/client/assets/MissionLogPane-ZwHJ137T.js +1 -0
  73. package/dist/client/assets/{NewAgentModal-Ctixol4_.js → NewAgentModal-Do9aVvan.js} +1 -1
  74. package/dist/client/assets/NewChatComposer-DKlNX1UA.js +19 -0
  75. package/dist/client/assets/{NewChatOrigin-CCiPg_WR.js → NewChatOrigin-DXPvX-hh.js} +1 -1
  76. package/dist/client/assets/ObserveEmbedScreen-Dghsq2on.js +2 -0
  77. package/dist/client/assets/ObserveTextFlow-DWNlmTVm.js +2 -0
  78. package/dist/client/assets/ObservedTopologyPanel-BlmGoxCE.js +2 -0
  79. package/dist/client/assets/OpenScoutAppShell-DDqQi-oe.js +87 -0
  80. package/dist/client/assets/OpsAgentsView-Bn_fGBdo.js +1 -0
  81. package/dist/client/assets/OpsScreen-DHnT-Q9R.js +1 -0
  82. package/dist/client/assets/OpsSubnav-CJRD7MjM.js +1 -0
  83. package/dist/client/assets/PlanView-B6gKo543.js +1 -0
  84. package/dist/client/assets/ProjectAgentProfile-Be1VOkI4.js +1 -0
  85. package/dist/client/assets/{ProjectAgentProfileBar-B4RqrI0Q.js → ProjectAgentProfileBar-C5QWwZCn.js} +1 -1
  86. package/dist/client/assets/ProjectAgentProfileHero-DC7Dd8VL.js +1 -0
  87. package/dist/client/assets/ProjectsInbox-DCLrDmj1.js +2 -0
  88. package/dist/client/assets/ProjectsRail-C4hiXYSb.js +1 -0
  89. package/dist/client/assets/ProjectsScreen-jruZRjgD.js +1 -0
  90. package/dist/client/assets/ProjectsThreadAside-DYmL2dCY.js +1 -0
  91. package/dist/client/assets/Provider-p-xuaAoE.js +1 -0
  92. package/dist/client/assets/RailRow-Cf9LOiEj.css +1 -0
  93. package/dist/client/assets/RailRow-bRkkXIpR.js +1 -0
  94. package/dist/client/assets/RawSessionsTable-B7WKmXrk.js +1 -0
  95. package/dist/client/assets/RealtimeVoiceScreen-BzP3BQq9.js +1 -0
  96. package/dist/client/assets/{RepoDiffEmbedScreen-Cr1SL5ht.js → RepoDiffEmbedScreen-xjzjcJ_c.js} +1 -1
  97. package/dist/client/assets/{RepoDiffPageScreen-DeC8fsh_.js → RepoDiffPageScreen-DRzIY-dk.js} +1 -1
  98. package/dist/client/assets/RepoDiffViewer-CNDp01KM.js +7 -0
  99. package/dist/client/assets/RepoDiffViewerLazy-b6vjYxez.js +2 -0
  100. package/dist/client/assets/{ReposScreen-BQwIShXf.js → ReposScreen-CpaLC_NU.js} +6 -6
  101. package/dist/client/assets/ScoutDeckSurface-DkpZ-0DH.js +1 -0
  102. package/dist/client/assets/{ScoutSurface-DdVzN3DA.js → ScoutSurface-BENBUt5-.js} +1 -1
  103. package/dist/client/assets/ScoutbotBroadcastChip-CGZyxS5H.js +2 -0
  104. package/dist/client/assets/{agent-autocomplete-C7xwIcwd.css → ScoutbotBroadcastChip-CxtYZWPZ.css} +1 -1
  105. package/dist/client/assets/{ScoutbotFxLab-sLjfSKtS.js → ScoutbotFxLab-Bk2ZsfPp.js} +1 -1
  106. package/dist/client/assets/ScoutbotRealtimeVoiceCall-n63LdBZs.js +1 -0
  107. package/dist/client/assets/{SecondaryNav-CCQqTT3e.js → SecondaryNav-B4IsujYh.js} +1 -1
  108. package/dist/client/assets/{SessionEmbedScreen-BrLMZJ3N.js → SessionEmbedScreen-CPfH-jqN.js} +1 -1
  109. package/dist/client/assets/{SessionObserve-pbozyqVv.js → SessionObserve-B-SkP3tu.js} +1 -1
  110. package/dist/client/assets/{SessionObserveEvidence-C54Xvbps.js → SessionObserveEvidence-CF5jnH3-.js} +1 -1
  111. package/dist/client/assets/SessionRefScreen-C-4jjmVG.js +1 -0
  112. package/dist/client/assets/SessionsScreen-HAjFvmIq.js +1 -0
  113. package/dist/client/assets/SettingsDrawer-DATxwZrn.js +3 -0
  114. package/dist/client/assets/SettingsDrawer-UX7pFJU_.css +1 -0
  115. package/dist/client/assets/SettingsScreen-Bu53X7J_.js +1 -0
  116. package/dist/client/assets/{ShikiPane-CiVH-45m.js → ShikiPane-DH8yYDks.js} +1 -1
  117. package/dist/client/assets/{SlidePanel-BLrLF9dt.js → SlidePanel-RFXJpfUa.js} +1 -1
  118. package/dist/client/assets/{SpriteAvatar-vpHO-rXs.js → SpriteAvatar-CEYdCzem.js} +1 -1
  119. package/dist/client/assets/{StatusPill-a3XBw1GG.js → StatusPill-9uy70ttd.js} +1 -1
  120. package/dist/client/assets/{TailView-C3rjOV7i.js → TailView-6bIrgdxN.js} +2 -2
  121. package/dist/client/assets/Terminal-BI6km7H4.js +1 -0
  122. package/dist/client/assets/TerminalEmbedScreen-D4JOWwtm.js +1 -0
  123. package/dist/client/assets/{TextDocumentSurface-B29xZNlI.js → TextDocumentSurface-BcP9vvji.js} +1 -1
  124. package/dist/client/assets/{TmuxPeek-eVfqPB4m.js → TmuxPeek-IaWqCgyJ.js} +1 -1
  125. package/dist/client/assets/{VoicePermissionsPanel-DpInOlVq.js → VoicePermissionsPanel-C80iZxgy.js} +1 -1
  126. package/dist/client/assets/{WorkDetailScreen-DYwgGaJs.js → WorkDetailScreen-CweZ6fEd.js} +3 -3
  127. package/dist/client/assets/WorkFilesViewer-Dy_-06iI.js +1 -0
  128. package/dist/client/assets/{activity-DTqqWiyV.js → activity-DS0u0Itf.js} +1 -1
  129. package/dist/client/assets/{addon-fit-CcaylYTX.js → addon-fit-CN888B3D.js} +1 -1
  130. package/dist/client/assets/{addon-webgl-B37iuzOG.js → addon-webgl-CoAnanQS.js} +1 -1
  131. package/dist/client/assets/{agent-essentials-DbbJm3ne.js → agent-essentials-CuK4G_zS.js} +1 -1
  132. package/dist/client/assets/agent-identity-BxCsXnDp.js +1 -0
  133. package/dist/client/assets/{agent-lane-card-model-CSugZCdy.js → agent-lane-card-model-q4cwzLX4.js} +1 -1
  134. package/dist/client/assets/{agent-lane-detail-D5EIlX7_.js → agent-lane-detail-BNNm6FNu.js} +1 -1
  135. package/dist/client/assets/{agent-lane-preview-BhplDYGf.js → agent-lane-preview-C33Dwpn7.js} +1 -1
  136. package/dist/client/assets/{agent-lanes-DlqcEf0l.css → agent-lanes-BDNktFBZ.css} +1 -1
  137. package/dist/client/assets/{agent-lanes-model-BKOs_32K.js → agent-lanes-model-VYQ5a68i.js} +2 -2
  138. package/dist/client/assets/{api-BHHEUSS3.js → api-BkjHJfgJ.js} +1 -1
  139. package/dist/client/assets/api-h5zurxmi.js +1 -0
  140. package/dist/client/assets/{arc.es-BRPqOKIx.js → arc.es-BET9ev6q.js} +1 -1
  141. package/dist/client/assets/arrow-down-DxxPnPwh.js +1 -0
  142. package/dist/client/assets/{arrow-left-B0CdJdAC.js → arrow-left-CXDkJuCg.js} +1 -1
  143. package/dist/client/assets/{arrow-up-right-CilNLf4t.js → arrow-up-right-Bj8RjSqW.js} +1 -1
  144. package/dist/client/assets/{bot-Ba3gcRVa.js → bot-BSGSicKC.js} +1 -1
  145. package/dist/client/assets/broker-display-pp33bLsu.js +2 -0
  146. package/dist/client/assets/{cache-BO2Bd_LV.js → cache-Dr0why2k.js} +1 -1
  147. package/dist/client/assets/{check-BdovFDz8.js → check-BfA0T8UD.js} +1 -1
  148. package/dist/client/assets/{chevron-down-Jh540uf3.js → chevron-down-BVg09D6U.js} +1 -1
  149. package/dist/client/assets/{chevron-right-CV7sEVBS.js → chevron-right-CaEwYkxE.js} +1 -1
  150. package/dist/client/assets/{chunk-HRAB3GC3-BYQZ1LOn.js → chunk-HRAB3GC3-HhKwnZCi.js} +1 -1
  151. package/dist/client/assets/chunk-JTPDIGGW-DX2eTIQ_.js +46 -0
  152. package/dist/client/assets/chunk-T65CQEWV-D-bOfuCH.js +1 -0
  153. package/dist/client/assets/chunk-YOZR3KYS-oS9dlQCI.js +2 -0
  154. package/dist/client/assets/{clock-DpfYdWcr.js → clock-C3TUL7D7.js} +1 -1
  155. package/dist/client/assets/{code-xml-CPzpZkhu.js → code-xml-Dbvjk9Kw.js} +1 -1
  156. package/dist/client/assets/collapsed-strip-Dz-of2SM.css +1 -0
  157. package/dist/client/assets/content-BQuEedeL.js +1 -0
  158. package/dist/client/assets/content-BUae-L_N.js +1 -0
  159. package/dist/client/assets/content-BfG98J1k.js +1 -0
  160. package/dist/client/assets/content-BkVTfkAC.js +1 -0
  161. package/dist/client/assets/content-BsNMos_d.js +1 -0
  162. package/dist/client/assets/content-C2TZOKSE.js +1 -0
  163. package/dist/client/assets/content-CCn98eSk.js +1 -0
  164. package/dist/client/assets/content-CJuH5cDP.js +1 -0
  165. package/dist/client/assets/content-CYnPp9yo.js +1 -0
  166. package/dist/client/assets/content-CcrUhm4P.js +1 -0
  167. package/dist/client/assets/content-CiOMtgQc.js +1 -0
  168. package/dist/client/assets/content-CxuVONeQ.js +1 -0
  169. package/dist/client/assets/content-Dmq9n1_L.js +1 -0
  170. package/dist/client/assets/content-DskHP2NI.js +1 -0
  171. package/dist/client/assets/content-DvvzL2HK.js +1 -0
  172. package/dist/client/assets/content-snCAUbwv.js +1 -0
  173. package/dist/client/assets/{conversation-icons-bHIIZ9z3.js → conversation-icons-DmC_Ak3z.js} +1 -1
  174. package/dist/client/assets/conversation-model-CHwHZNw-.js +1 -0
  175. package/dist/client/assets/conversation-motion-features-DPiGTO21.js +1 -0
  176. package/dist/client/assets/{copy-DQAM0eSY.js → copy-C79v_7D-.js} +1 -1
  177. package/dist/client/assets/{createLucideIcon-Da0lq809.js → createLucideIcon-DCq_3fQn.js} +1 -1
  178. package/dist/client/assets/ctx-panel-B4s49N9e.css +1 -0
  179. package/dist/client/assets/discover-IEnbrH8_.js +2 -0
  180. package/dist/client/assets/embed-entry-XUPb-AzL.js +2 -0
  181. package/dist/client/assets/{external-link-BheHazeW.js → external-link-Dd8xaveL.js} +1 -1
  182. package/dist/client/assets/{eye-B908WSFH.js → eye-DkU59kfl.js} +1 -1
  183. package/dist/client/assets/{file-text-BGVkHS4_.js → file-text-BITQqGtF.js} +1 -1
  184. package/dist/client/assets/gestures-B5rLNRpi.js +1 -0
  185. package/dist/client/assets/home-moving-signal-Bs635mVw.js +1 -0
  186. package/dist/client/assets/home-moving-signal-CAa0V91u.css +1 -0
  187. package/dist/client/assets/home-now-card-VxlLjg1A.js +1 -0
  188. package/dist/client/assets/{home-now-card-nano-iwd10r9G.js → home-now-card-nano-C06GMiwD.js} +1 -1
  189. package/dist/client/assets/hooks-BWiLxTw1.js +2 -0
  190. package/dist/client/assets/index-9as_JTUs.css +1 -0
  191. package/dist/client/assets/index-BTj2MguM.js +1 -0
  192. package/dist/client/assets/index-BZovGpDk.js +10 -0
  193. package/dist/client/assets/index-CvF09yvf.css +1 -0
  194. package/dist/client/assets/index-DiiEQwdc.js +1 -0
  195. package/dist/client/assets/index-vbaJ8sin.js +1 -0
  196. package/dist/client/assets/inspector-panel-C96HcyK5.js +2 -0
  197. package/dist/client/assets/{keyboard-nav-feLCB3Zm.js → keyboard-nav-CHo_xmjw.js} +1 -1
  198. package/dist/client/assets/{lane-observe-vfyACHi0.js → lane-observe-BA3g9aVd.js} +1 -1
  199. package/dist/client/assets/{lane-roster-store-BAmj273z.js → lane-roster-store-B6ybJlHJ.js} +1 -1
  200. package/dist/client/assets/left-Bk3XnxPD.css +1 -0
  201. package/dist/client/assets/left-BuJ0wJW1.js +2 -0
  202. package/dist/client/assets/left-C6Zj3cR4.js +1 -0
  203. package/dist/client/assets/left-CCoobxPS.css +1 -0
  204. package/dist/client/assets/left-COMAiMfB.js +2 -0
  205. package/dist/client/assets/left-Ce4WKYPK.js +1 -0
  206. package/dist/client/assets/left-DMJkmJOF.js +1 -0
  207. package/dist/client/assets/left-DrCbY6ja.js +1 -0
  208. package/dist/client/assets/left-agents-BuSyVNGE.js +1 -0
  209. package/dist/client/assets/left-default-DRHywOKX.js +1 -0
  210. package/dist/client/assets/left-l92tw5Kc.js +1 -0
  211. package/dist/client/assets/left-lanes-4-aUyyrV.js +1 -0
  212. package/dist/client/assets/left-mission-e849d_Td.js +1 -0
  213. package/dist/client/assets/left-plan-MchYwAB_.js +2 -0
  214. package/dist/client/assets/library-DygjpA6u.js +1 -0
  215. package/dist/client/assets/{loader-circle-Be0T8xv2.js → loader-circle-B-l2Wj3-.js} +1 -1
  216. package/dist/client/assets/{local-agents-Q6KQ12B9.js → local-agents-Wof5knTJ.js} +1 -1
  217. package/dist/client/assets/{mentions-KNASbAjG.js → mentions-BjXfeF7t.js} +1 -1
  218. package/dist/client/assets/{mesh-ops-C-i8OMiM.js → mesh-ops-C1gq8zKf.js} +1 -1
  219. package/dist/client/assets/{mesh-view-store-B0lqpw8M.js → mesh-view-store-B56D3f77.js} +1 -1
  220. package/dist/client/assets/{message-circle-2v9Udia0.js → message-circle-BwVx5X0q.js} +1 -1
  221. package/dist/client/assets/{message-markup-BP2nH9kQ.js → message-markup-DlVX-iuc.js} +1 -1
  222. package/dist/client/assets/{message-square-DURSOrUr.js → message-square-BnkG6tae.js} +1 -1
  223. package/dist/client/assets/mission-control-m3BTDQ9l.css +1 -0
  224. package/dist/client/assets/{mission-control-store-HeCy97KT.js → mission-control-store-CMgIVjLJ.js} +1 -1
  225. package/dist/client/assets/model-Co0zkMIc.js +1 -0
  226. package/dist/client/assets/{observe-DkAhvkfn.js → observe-DVHAcIrv.js} +1 -1
  227. package/dist/client/assets/{operator-attention-BqoWAlhp.js → operator-attention-BwSPeheT.js} +1 -1
  228. package/dist/client/assets/{page-status-CEP5pGf3.js → page-status-Bg2hd27j.js} +1 -1
  229. package/dist/client/assets/paperclip-DblaLD_N.js +1 -0
  230. package/dist/client/assets/plan-view-D56fneVF.css +1 -0
  231. package/dist/client/assets/{plus-ZReaTFF-.js → plus-BAI0t5g9.js} +1 -1
  232. package/dist/client/assets/profile-3Q4sUtvJ.js +1 -0
  233. package/dist/client/assets/projects-inbox-Da2hYEn6.js +1 -0
  234. package/dist/client/assets/{radio-BC9TO5Pl.js → radio-BGtkyCG9.js} +1 -1
  235. package/dist/client/assets/{refresh-cw-C4E58VJK.js → refresh-cw-DtF8xPqX.js} +1 -1
  236. package/dist/client/assets/resolve-panes-D4tlKNCT.js +1 -0
  237. package/dist/client/assets/resolve-sidebar-context-B27lj3Ci.js +1 -0
  238. package/dist/client/assets/right-B8qg3JdB.js +1 -0
  239. package/dist/client/assets/{right-BarpRgcv.js → right-BU_W1kSH.js} +1 -1
  240. package/dist/client/assets/right-BlR7h0US.js +1 -0
  241. package/dist/client/assets/right-BwgwTGGd.js +1 -0
  242. package/dist/client/assets/right-ByptvkVX.js +1 -0
  243. package/dist/client/assets/right-CUP-NIDG.js +1 -0
  244. package/dist/client/assets/right-Ch_jrNe2.js +1 -0
  245. package/dist/client/assets/right-Dd2DscRz.js +1 -0
  246. package/dist/client/assets/right-DmVHd8Xj.js +1 -0
  247. package/dist/client/assets/{right-CIzaNH58.js → right-c4PAdFYZ.js} +1 -1
  248. package/dist/client/assets/{rocket-BahfIwFz.js → rocket-BWh18pt_.js} +1 -1
  249. package/dist/client/assets/router-63XV_E7f.js +1 -0
  250. package/dist/client/assets/{text-B2UZi3l9.js → runtime-picker-BXKJbLot.js} +1 -1
  251. package/dist/client/assets/runtime-picker-vhm0gtLs.css +1 -0
  252. package/dist/client/assets/{scope-views-CmG2X_S0.js → scope-views-Dm2_-NPi.js} +1 -1
  253. package/dist/client/assets/scout-voice-D8Q5sZOL.js +1 -0
  254. package/dist/client/assets/{scoutbot-D4vuKzOL.js → scoutbot-BTIErYHo.js} +2 -2
  255. package/dist/client/assets/{scroll-text-uulNqrf7.js → scroll-text-DZb3mmYo.js} +1 -1
  256. package/dist/client/assets/{search-HmdKXdtR.js → search-1QMVOxF3.js} +1 -1
  257. package/dist/client/assets/secondaryNavConfig-c0cz3MkJ.js +1 -0
  258. package/dist/client/assets/{selection-bridge-n4wNTm1B.js → selection-bridge-O9C4kGfF.js} +1 -1
  259. package/dist/client/assets/{send-horizontal-DOjHkZCD.js → send-horizontal-DbyEkGql.js} +1 -1
  260. package/dist/client/assets/{server-CX-xQjJA.js → server-Bncn9S7r.js} +1 -1
  261. package/dist/client/assets/{session-catalog-b7B1Sof1.js → session-catalog-DC6BlBBC.js} +1 -1
  262. package/dist/client/assets/{session-table-Djain1Qr.js → session-table-BUPq9Viy.js} +1 -1
  263. package/dist/client/assets/{sliders-horizontal-D2O6QiDN.js → sliders-horizontal-CMe8Bay1.js} +1 -1
  264. package/dist/client/assets/{sparkles-CgTby-ap.js → sparkles-_7cTZsIH.js} +1 -1
  265. package/dist/client/assets/{sse-QSbhyq9A.js → sse-Bb0EOcU9.js} +1 -1
  266. package/dist/client/assets/system-surfaces-redesign-B7GQhfpw.css +1 -0
  267. package/dist/client/assets/{tail-display-DcliDVkW.js → tail-display-BRcJltQa.js} +1 -1
  268. package/dist/client/assets/{tail-events-B7BrDaFi.js → tail-events-C12pfUax.js} +1 -1
  269. package/dist/client/assets/{terminal-relay-C2TUIuh1.js → terminal-relay-BgfVJXIL.js} +1 -1
  270. package/dist/client/assets/{terminal-sessions-D4dHTRkt.js → terminal-sessions-AmSgHklm.js} +1 -1
  271. package/dist/client/assets/{terminal-takeover-BArLfNtd.js → terminal-takeover--05EYhJm.js} +1 -1
  272. package/dist/client/assets/{terminal-DNZTCr6a.js → terminal-xGf_F3y7.js} +1 -1
  273. package/dist/client/assets/text-DsBWV_4k.js +1 -0
  274. package/dist/client/assets/{use-conversation-list-htp0Ui63.js → use-conversation-list-DWX02INv.js} +1 -1
  275. package/dist/client/assets/{use-fleet-active-asks-BhuTn5mV.js → use-fleet-active-asks-Cnwa4hTK.js} +1 -1
  276. package/dist/client/assets/{use-mesh-ops-items-CD-qsvNX.js → use-mesh-ops-items-BRFm37oY.js} +1 -1
  277. package/dist/client/assets/use-reduced-motion-C8cWvIZ3.js +1 -0
  278. package/dist/client/assets/use-scout-dev-flags-FkMreOOb.js +1 -0
  279. package/dist/client/assets/{useAgentHoverCard-BIrm8esH.js → useAgentHoverCard-DvPZSJK3.js} +1 -1
  280. package/dist/client/assets/useContentSecondaryNav-CNlrhvvx.js +1 -0
  281. package/dist/client/assets/{usePierreRuntime-CVTMzChM.js → usePierreRuntime-C8WJ0X3F.js} +1 -1
  282. package/dist/client/assets/{wrench-DwFKomxg.js → wrench-_tHBGTop.js} +1 -1
  283. package/dist/client/assets/{x-DuzAbpk5.js → x-CrGUKNRv.js} +1 -1
  284. package/dist/client/assets/{xterm-xQGYNyB-.js → xterm-Ks-VlLTq.js} +1 -1
  285. package/dist/client/index.html +2 -2
  286. package/dist/main.mjs +38 -169
  287. package/dist/node/main.mjs +240 -272
  288. package/dist/pairing-runtime-controller.mjs +476 -394
  289. package/dist/runtime/base-daemon.mjs +121 -49
  290. package/dist/runtime/broker-daemon.mjs +60 -171
  291. package/dist/runtime/broker-process-manager.mjs +0 -6
  292. package/dist/runtime/mesh-discover.mjs +0 -6
  293. package/dist/scout-control-plane-web.mjs +477 -672
  294. package/dist/scout-web-server.mjs +477 -672
  295. package/package.json +7 -6
  296. package/dist/client/assets/ActivityScreen-DRHTQIxu.js +0 -1
  297. package/dist/client/assets/AgentAvatar-CQqJcwOQ.js +0 -1
  298. package/dist/client/assets/AgentAvatar-CUZZARWG.css +0 -1
  299. package/dist/client/assets/AgentConfigurationScreen-C3OI6JmZ.js +0 -1
  300. package/dist/client/assets/AgentDefinitionsWorkspace-D0LDEqfl.js +0 -1
  301. package/dist/client/assets/AgentFloorView-CoGh2q5f.js +0 -1
  302. package/dist/client/assets/AgentInfoScreen-5ybfIL9p.js +0 -1
  303. package/dist/client/assets/AgentLaneDetailSheet-BD8B51ka.js +0 -4
  304. package/dist/client/assets/AgentLanesEmbedScreen-FRTVASPw.js +0 -1
  305. package/dist/client/assets/AgentLanesView-Bm85ittm.js +0 -2
  306. package/dist/client/assets/AgentSessions-C_tAfGN2.js +0 -6
  307. package/dist/client/assets/AgentsConsole-DsHWsaOJ.js +0 -1
  308. package/dist/client/assets/AgentsScreen-Bod6AHlA.js +0 -1
  309. package/dist/client/assets/AgentsSubnav-CsvYzzQ-.js +0 -1
  310. package/dist/client/assets/AstronautSuit-C05Ezxl9.js +0 -1
  311. package/dist/client/assets/BackToPicker-CXsbxbHM.js +0 -1
  312. package/dist/client/assets/BriefingDetailScreen-Uvnk3t0v.js +0 -1
  313. package/dist/client/assets/BrokerScreen-LZ3T7hGG.js +0 -5
  314. package/dist/client/assets/Canvas-BO9mx5_P.js +0 -1
  315. package/dist/client/assets/ChatCollapsedStrip-CtLPTLTY.js +0 -1
  316. package/dist/client/assets/ConversationComposer-DPWu3HvK.js +0 -1
  317. package/dist/client/assets/ConversationFeedRows-MhcPfxUr.js +0 -1
  318. package/dist/client/assets/ConversationHeader-Ce7TENb9.js +0 -1
  319. package/dist/client/assets/ConversationPanels-D-b5SLO-.js +0 -6
  320. package/dist/client/assets/ConversationScreen-C5HnXd5w.css +0 -1
  321. package/dist/client/assets/ConversationScreen-D77SoLos.js +0 -1
  322. package/dist/client/assets/ConversationStatus-lIvSKRic.js +0 -1
  323. package/dist/client/assets/CrewWorkspaces-CJhBKVoZ.css +0 -1
  324. package/dist/client/assets/CrewWorkspaces-CdojnRMG.js +0 -1
  325. package/dist/client/assets/DocumentFocusViewer-CetjnYut.js +0 -1
  326. package/dist/client/assets/FlightObserveScreen-sqvt7HUO.js +0 -1
  327. package/dist/client/assets/HarnessesScreen-CGhRsqD5.js +0 -1
  328. package/dist/client/assets/HomeHero-7JwycwFY.css +0 -1
  329. package/dist/client/assets/HomeHero-DdxTQ-6a.js +0 -1
  330. package/dist/client/assets/HostAdvisorView-BAUi5ZxX.js +0 -1
  331. package/dist/client/assets/KnowledgeSearchScreen-CRei9pyl.js +0 -1
  332. package/dist/client/assets/LaneTraceDetailSheet-CFsCvKa3.js +0 -1
  333. package/dist/client/assets/MeshScreen-dxNxRtKm.js +0 -1
  334. package/dist/client/assets/MessagesScreen-CR5v-WIE.js +0 -1
  335. package/dist/client/assets/MissionControlView-BGj1qnI2.js +0 -1
  336. package/dist/client/assets/MissionFocusOverlay-hWi6y87j.js +0 -1
  337. package/dist/client/assets/MissionLeftAgentRow-BSRRiiig.js +0 -1
  338. package/dist/client/assets/MissionLogPane-bbG_pM9B.js +0 -1
  339. package/dist/client/assets/NewChatComposer-BPsg8shF.js +0 -19
  340. package/dist/client/assets/ObserveEmbedScreen-Be87Chod.js +0 -2
  341. package/dist/client/assets/ObserveTextFlow-CKYltTPJ.js +0 -2
  342. package/dist/client/assets/ObservedTopologyPanel-CfHYu-4Z.js +0 -2
  343. package/dist/client/assets/OpenScoutAppShell-DPeP1vtK.js +0 -88
  344. package/dist/client/assets/OpsAgentsView-dEtw9yt-.js +0 -1
  345. package/dist/client/assets/OpsScreen-QXRJY8Vf.js +0 -1
  346. package/dist/client/assets/OpsSubnav-BK9Fj3gU.js +0 -1
  347. package/dist/client/assets/ProjectAgentProfile-BjykZ2Xd.js +0 -1
  348. package/dist/client/assets/ProjectAgentProfileHero-Bc0g8rhW.js +0 -1
  349. package/dist/client/assets/ProjectsInbox--ZIqo-IE.js +0 -2
  350. package/dist/client/assets/ProjectsRail-CzS0qTCI.js +0 -1
  351. package/dist/client/assets/ProjectsScreen-0gx7f30h.js +0 -1
  352. package/dist/client/assets/ProjectsThreadAside-BsQRFbdy.js +0 -1
  353. package/dist/client/assets/Provider-Cd-QZltN.js +0 -1
  354. package/dist/client/assets/RailRow-B0sRaJc6.css +0 -1
  355. package/dist/client/assets/RailRow-BY6fxePa.js +0 -1
  356. package/dist/client/assets/RawSessionsTable-CbopOF34.js +0 -1
  357. package/dist/client/assets/RealtimeVoiceScreen-CU4uXz4C.js +0 -9
  358. package/dist/client/assets/RepoDiffViewer-CiTOWK_Z.js +0 -7
  359. package/dist/client/assets/RepoDiffViewerLazy-BU3V7Kwq.js +0 -2
  360. package/dist/client/assets/ScoutDeckSurface-BncYKicb.js +0 -1
  361. package/dist/client/assets/SessionRefScreen-UVNVrwAf.js +0 -1
  362. package/dist/client/assets/SessionsScreen-KeDb5gz4.js +0 -1
  363. package/dist/client/assets/SettingsDrawer-CWdj0VvN.js +0 -3
  364. package/dist/client/assets/SettingsDrawer-J-8x1eII.css +0 -1
  365. package/dist/client/assets/SettingsScreen-C7zJgZzj.js +0 -1
  366. package/dist/client/assets/Terminal-CMQFmHnn.js +0 -1
  367. package/dist/client/assets/TerminalEmbedScreen-GvpoGERN.js +0 -1
  368. package/dist/client/assets/TerminalRelay-CIHlLVf1.js +0 -46
  369. package/dist/client/assets/WorkFilesViewer-C7H5fXaZ.js +0 -1
  370. package/dist/client/assets/agent-autocomplete-cOPLtuhM.js +0 -2
  371. package/dist/client/assets/agent-identity-CIMT7oV6.js +0 -1
  372. package/dist/client/assets/agent-specialization-D3-sqwhU.js +0 -1
  373. package/dist/client/assets/api-DEHEgJ9m.js +0 -1
  374. package/dist/client/assets/archive-DPMdoW_D.js +0 -1
  375. package/dist/client/assets/arrow-right-YRBoTTyf.js +0 -1
  376. package/dist/client/assets/broker-display-Q75fupqG.js +0 -2
  377. package/dist/client/assets/collapsed-strip-raJWthAH.css +0 -1
  378. package/dist/client/assets/compass-D5Io6BIV.js +0 -1
  379. package/dist/client/assets/content-3b_jmxEx.js +0 -1
  380. package/dist/client/assets/content-B-i0XY-t.js +0 -1
  381. package/dist/client/assets/content-BD-DNFmb.js +0 -1
  382. package/dist/client/assets/content-BGeo5tgd.js +0 -1
  383. package/dist/client/assets/content-BMvXPLiQ.js +0 -1
  384. package/dist/client/assets/content-BWTbfMDg.js +0 -1
  385. package/dist/client/assets/content-BwCmeUmF.js +0 -1
  386. package/dist/client/assets/content-C1K3NcZa.js +0 -1
  387. package/dist/client/assets/content-C34J5_Af.js +0 -1
  388. package/dist/client/assets/content-CGRtIS2m.js +0 -1
  389. package/dist/client/assets/content-CIJo_-JS.js +0 -1
  390. package/dist/client/assets/content-CvqIqVAV.js +0 -1
  391. package/dist/client/assets/content-DRnwm-Vu.js +0 -1
  392. package/dist/client/assets/content-Dh39SSvP.js +0 -1
  393. package/dist/client/assets/content-DoypqDj5.js +0 -1
  394. package/dist/client/assets/content-n3mvc6NQ.js +0 -1
  395. package/dist/client/assets/conversation-model-CIzM7aXT.js +0 -1
  396. package/dist/client/assets/conversation-motion-features-CrP5K-dk.js +0 -1
  397. package/dist/client/assets/cpu-CtQc0Z9D.js +0 -1
  398. package/dist/client/assets/credentials-qwds23lv.js +0 -1
  399. package/dist/client/assets/ctx-panel-D_HJ3nhb.css +0 -1
  400. package/dist/client/assets/discover-DdkMhTAV.js +0 -2
  401. package/dist/client/assets/embed-entry-DoSM1GZB.js +0 -2
  402. package/dist/client/assets/file-code-corner-C5Pc6znt.js +0 -1
  403. package/dist/client/assets/gauge-sc_gb5Zw.js +0 -1
  404. package/dist/client/assets/gestures-AzPBSf20.js +0 -1
  405. package/dist/client/assets/git-branch-CdJU49Af.js +0 -1
  406. package/dist/client/assets/home-moving-signal-CZo2bYBi.js +0 -1
  407. package/dist/client/assets/home-moving-signal-DMguaRWR.css +0 -1
  408. package/dist/client/assets/home-now-card-DgxfZHcR.js +0 -1
  409. package/dist/client/assets/hooks-CeCCO6Yg.js +0 -2
  410. package/dist/client/assets/host-advisor-B2Fqs5Dd.css +0 -1
  411. package/dist/client/assets/index-BIiI9gfa.js +0 -1
  412. package/dist/client/assets/index-CD2foMB8.js +0 -1
  413. package/dist/client/assets/index-DReHD_4U.js +0 -1
  414. package/dist/client/assets/index-DzlEgstl.css +0 -1
  415. package/dist/client/assets/index-NRbRrZw-.js +0 -10
  416. package/dist/client/assets/index-wLwc74Pu.css +0 -1
  417. package/dist/client/assets/inspector-panel-CBf8pW7s.js +0 -2
  418. package/dist/client/assets/layers-D9fblkql.js +0 -1
  419. package/dist/client/assets/layout-grid-Vd1chalc.js +0 -1
  420. package/dist/client/assets/left-41_3QKk1.js +0 -1
  421. package/dist/client/assets/left-B3ofA1Pr.js +0 -2
  422. package/dist/client/assets/left-BWBZQhxQ.js +0 -1
  423. package/dist/client/assets/left-BhA6essi.js +0 -1
  424. package/dist/client/assets/left-BmTKCv4f.js +0 -1
  425. package/dist/client/assets/left-CCGR6tIF.js +0 -2
  426. package/dist/client/assets/left-DH44V4I_.css +0 -1
  427. package/dist/client/assets/left-Dfwzkwh_.js +0 -1
  428. package/dist/client/assets/left-R2OOE7VG.css +0 -1
  429. package/dist/client/assets/left-advisor-yrzW1Kwz.js +0 -1
  430. package/dist/client/assets/left-agents-Bgahk0FF.js +0 -1
  431. package/dist/client/assets/left-default-CtkfAquc.js +0 -1
  432. package/dist/client/assets/left-lanes-CpujaVN3.js +0 -1
  433. package/dist/client/assets/left-mission-Bbd-fW6W.js +0 -1
  434. package/dist/client/assets/library-Dx14WNGd.js +0 -1
  435. package/dist/client/assets/mission-control-CnU7dNt1.css +0 -1
  436. package/dist/client/assets/persistent-state-Bm_0TmZL.js +0 -1
  437. package/dist/client/assets/profile-Y0X7HZHc.js +0 -1
  438. package/dist/client/assets/projects-inbox-Cbfj4Hx7.js +0 -1
  439. package/dist/client/assets/provider-Bq0ScH3v.js +0 -1
  440. package/dist/client/assets/proxy-DtC2iXnT.js +0 -1
  441. package/dist/client/assets/resolve-panes-BI3WdDS-.js +0 -1
  442. package/dist/client/assets/resolve-sidebar-context-_g0pIxOr.js +0 -1
  443. package/dist/client/assets/right-BA0F8fPI.js +0 -1
  444. package/dist/client/assets/right-C4GXB45w.js +0 -1
  445. package/dist/client/assets/right-CXetlD8X.js +0 -1
  446. package/dist/client/assets/right-CnRcQS_I.js +0 -1
  447. package/dist/client/assets/right-D2_rmbAH.js +0 -1
  448. package/dist/client/assets/right-Dqp--KwX.js +0 -1
  449. package/dist/client/assets/right-HJJzRuGD.js +0 -1
  450. package/dist/client/assets/right-WCMb8YXJ.js +0 -1
  451. package/dist/client/assets/router-Bx1tiwVe.js +0 -1
  452. package/dist/client/assets/scout-voice-BT3gYDhU.js +0 -1
  453. package/dist/client/assets/scoutbot-markdown-DIhLsYxz.js +0 -6
  454. package/dist/client/assets/secondaryNavConfig-BVQiyAXu.js +0 -1
  455. package/dist/client/assets/settings-BpKRzxOD.js +0 -1
  456. package/dist/client/assets/system-surfaces-redesign-QVXNeGYw.css +0 -1
  457. package/dist/client/assets/text-rLpBg4_z.css +0 -1
  458. package/dist/client/assets/use-reduced-motion-0fAsybdo.js +0 -1
  459. package/dist/client/assets/use-scout-dev-flags-DV_I6URU.js +0 -1
  460. package/dist/client/assets/useContentSecondaryNav-4atpGgFw.js +0 -1
  461. package/dist/client/assets/usePersistentState-InmPXIN4.js +0 -1
  462. package/dist/client/assets/zap-CocRNtyr.js +0 -1
  463. package/dist/client/crew/brik-bust.webp +0 -0
  464. package/dist/client/crew/brik-chip-id.webp +0 -0
  465. package/dist/client/crew/lulu-bust.webp +0 -0
  466. package/dist/client/crew/milo-bust.webp +0 -0
  467. package/dist/client/crew/milo-chip-id.webp +0 -0
  468. package/dist/client/crew/nori-bust.webp +0 -0
  469. package/dist/client/crew/sheets/eye-plate-v1/blink-half.webp +0 -0
  470. package/dist/client/crew/sheets/eye-plate-v1/blink-shut.webp +0 -0
  471. package/dist/client/crew/sheets/eye-plate-v1/look-left.webp +0 -0
  472. package/dist/client/crew/sheets/eye-plate-v1/look-right.webp +0 -0
  473. package/dist/client/crew/sheets/eye-plate-v1/look-up.webp +0 -0
  474. package/dist/client/crew/sheets/eye-plate-v1/rest.webp +0 -0
  475. package/dist/client/crew/sheets/sprout/blink-half.webp +0 -0
  476. package/dist/client/crew/sheets/sprout/blink-shut.webp +0 -0
  477. package/dist/client/crew/sheets/sprout/look-left.webp +0 -0
  478. package/dist/client/crew/sheets/sprout/look-right.webp +0 -0
  479. package/dist/client/crew/sheets/sprout/look-up.webp +0 -0
  480. package/dist/client/crew/sprout-bust.webp +0 -0
  481. package/dist/client/crew/sprout-chip-id.webp +0 -0
  482. package/dist/client/crew/vex-bust.webp +0 -0
  483. package/dist/client/crew/vex-chip-id.webp +0 -0
  484. package/dist/client/crew/wrench-bust.webp +0 -0
  485. package/dist/client/crew/wrench-chip-id.webp +0 -0
  486. /package/dist/client/assets/{DocumentFocusViewer-BSC_JwVE.css → document-focus-viewer-BSC_JwVE.css} +0 -0
@@ -0,0 +1,87 @@
1
+ import{r as m,i as bg,N as Rd,j as f,F as Td,g as yg}from"./index-BZovGpDk.js";import{at as xg,au as wg,u as hr,k as _d,T as Eg,b as Pd,I as Sg,J as kg,L as Id,M as Cg,N as Rg,O as Tg}from"./router-63XV_E7f.js";import{a as go,u as _g,T as Pg,b as Ig,H as Ag}from"./chunk-JTPDIGGW-DX2eTIQ_.js";import{u as St,c as Og,l as Mg,H as xn,a as Ng,b as jg}from"./chunk-YOZR3KYS-oS9dlQCI.js";import{S as Ad}from"./sparkles-_7cTZsIH.js";import{L as ca}from"./loader-circle-B-l2Wj3-.js";import{V as Dg,a as zg,S as Lg}from"./ScoutbotBroadcastChip-CGZyxS5H.js";import{S as Od,a as $g}from"./runtime-picker-BXKJbLot.js";import{c as Et}from"./createLucideIcon-DCq_3fQn.js";import{P as Fg}from"./paperclip-DblaLD_N.js";import{b as Ke,a9 as ps,aa as Bg,n as dr,H as Vg,G as Md,ab as Nd,ac as la,t as jd,l as yt,k as ro,ad as Zg,j as At,p as Dd,ae as Si,af as zd,$ as st,ag as ir,ah as ki,ai as Gc,aj as Ug,ak as Ld,al as $d,am as Wg,an as Fd,s as qc,o as Hg,ao as Dr,ap as Gg,aq as qg}from"./use-reduced-motion-C8cWvIZ3.js";import{i as dn,b as Yg,r as Kg,s as Yc,p as ua,d as Jg,e as Bd,f as Xg,h as er,t as tr,j as Ci,k as Kc,l as Qg,m as ev,n as tv,o as nv,q as qa,u as Ri,v as rv,w as ov,x as Vd,y as sv,z as iv,A as av,B as cv,C as Jc,D as lv,F as Zd,g as uv,a as dv,c as fv}from"./gestures-B5rLNRpi.js";import{r as Yt}from"./index-DiiEQwdc.js";import{C as pv,Z as mv}from"./chunk-T65CQEWV-D-bOfuCH.js";import{C as hv}from"./clock-C3TUL7D7.js";import{S as Ls}from"./search-1QMVOxF3.js";import{u as Ud,i as Wd,d as gv,e as vv,c as bv,f as yv}from"./keyboard-nav-CHo_xmjw.js";import{i as ms,u as Hd}from"./use-scout-dev-flags-FkMreOOb.js";import{X as $s}from"./x-CrGUKNRv.js";import{T as Gd}from"./terminal-xGf_F3y7.js";import{M as qd,b as Yd}from"./DocumentFocusViewer-CZVVIAD5.js";import{s as xv,S as wv,d as Ev}from"./scope-views-Dm2_-NPi.js";import{a as Kd,b as Sv,u as Kt,e as Jd,m as kv,h as Cv,A as Rv,l as Tv}from"./Provider-p-xuaAoE.js";import"./index-BWHgHrtv.js";import"./AgentDetailCard-Dtc02KUO.js";/* empty css *//* empty css */import"./NewChatComposer-DKlNX1UA.js";/* empty css */import"./BackToPicker-D6WgIDb-.js";import"./AgentLiveActions-DwScaVRF.js";import"./ObservedTopologyPanel-BlmGoxCE.js";/* empty css */import{e as _v,f as wn,P as hs,g as Xd,h as Qd,s as Pv,i as Iv}from"./secondaryNavConfig-c0cz3MkJ.js";/* empty css */import"./ConversationScreen-Br0QQ3xo.js";/* empty css */import"./SessionObserve-B-SkP3tu.js";/* empty css *//* empty css *//* empty css */import{a as Av}from"./ProjectsRail-C4hiXYSb.js";import"./ProjectsInbox-DCLrDmj1.js";import"./projects-inbox-Da2hYEn6.js";/* empty css */import"./RailRow-bRkkXIpR.js";/* empty css */import"./cache-Dr0why2k.js";/* empty css *//* empty css *//* empty css *//* empty css */import"./left-COMAiMfB.js";import"./content-CJuH5cDP.js";import{u as Ov}from"./mesh-view-store-B56D3f77.js";import"./FleetSearch-Dsi_l2KW.js";import"./left-Ce4WKYPK.js";/* empty css */import"./mesh-ops-C1gq8zKf.js";import"./left-mission-e849d_Td.js";import"./mission-control-store-CMgIVjLJ.js";/* empty css *//* empty css *//* empty css *//* empty css */import"./SlidePanel-RFXJpfUa.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./TailView-6bIrgdxN.js";import"./RepoDiffViewerLazy-b6vjYxez.js";/* empty css *//* empty css *//* empty css */import"./SettingsDrawer-DATxwZrn.js";import"./left-DMJkmJOF.js";/* empty css */import{N as qr,f as Mv,g as Nv,h as Qo,i as jv,j as Dv,k as zv}from"./hooks-BWiLxTw1.js";import{a as da}from"./api-h5zurxmi.js";import{o as Lv,i as $v}from"./surface-activity-B1rgWB1i.js";import{P as Fv,S as Bv,a as Vv}from"./ScoutbotRealtimeVoiceCall-n63LdBZs.js";import{P as Zv}from"./plus-BAI0t5g9.js";import{resolveSidebarContext as Uv}from"./resolve-sidebar-context-B27lj3Ci.js";import{d as Fs,n as Wv,i as ef}from"./colors-BtO5_zlx.js";import{b as Hv}from"./mesh-buckets-CfAukILK.js";import{u as Gv}from"./sse-Bb0EOcU9.js";import{f as qv,b as Yv,d as Kv}from"./terminal-sessions-AmSgHklm.js";import{o as Xc}from"./openAgent-Dbv5wfuL.js";import{C as Cr,a as Jv,b as vo,c as Bs,d as Xv}from"./ChatCollapsedStrip-DdKyMSEM.js";import{A as Qv}from"./activity-DS0u0Itf.js";import{OpsSubnav as eb}from"./OpsSubnav-CJRD7MjM.js";import{A as Qc}from"./arrow-left-CXDkJuCg.js";import{C as tb}from"./chevron-down-BVg09D6U.js";import{C as nb}from"./chevron-right-CaEwYkxE.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./chunk-HRAB3GC3-HhKwnZCi.js";import"./arrow-down-DxxPnPwh.js";import"./ContextMenu-DnFcmfMR.js";import"./bot-BSGSicKC.js";import"./scout-voice-D8Q5sZOL.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./TextDocumentSurface-BcP9vvji.js";import"./file-text-BITQqGtF.js";import"./scoutbot-BTIErYHo.js";import"./code-xml-Dbvjk9Kw.js";import"./MessageComposerSuggestions-qbalTne_.js";import"./time-Dhsh_2EG.js";import"./HarnessMark-DrE57dUq.js";import"./conversation-model-CHwHZNw-.js";import"./NewChatOrigin-DXPvX-hh.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./terminal-takeover--05EYhJm.js";import"./openContent-C6XO6kr5.js";import"./eye-DkU59kfl.js";import"./message-square-BnkG6tae.js";import"./scroll-text-DZb3mmYo.js";import"./ConversationComposer-CjRXFkvY.js";import"./message-markup-DlVX-iuc.js";import"./mentions-BjXfeF7t.js";import"./message-visibility-kJM8XcSG.js";import"./sessionRead-CvFz2RHv.js";import"./clipboard-e3fSpeo7.js";import"./AgentAvatar-CneOa70z.js";import"./SpriteAvatar-CEYdCzem.js";import"./agent-identity-BxCsXnDp.js";import"./types-B0PlfpKc.js";import"./ConversationHeader-CRmdtuL7.js";import"./ConversationFeedRows-CgRTIpAv.js";import"./ConversationPanels-DCkcLIHk.js";import"./message-circle-BwVx5X0q.js";import"./tail-display-BRcJltQa.js";import"./lane-edit-display-C_Aujldz.js";import"./tail-events-C12pfUax.js";import"./ConversationStatus-BJ1CMbAv.js";import"./bash-format-BRV5C6Gv.js";import"./lane-tool-detail-0WhMf4Vj.js";import"./LaneToolHoverCard-BkBcDYm-.js";import"./lane-observe-BA3g9aVd.js";import"./lane-ask-display-B6iCAVcd.js";import"./ObserveTextFlow-DWNlmTVm.js";import"./SessionObserveEvidence-CF5jnH3-.js";import"./wrench-_tHBGTop.js";import"./external-link-Dd8xaveL.js";import"./AddProjectForm-DtTfn4Zk.js";import"./project-overview-helpers-BQTc_Ous.js";import"./api-BkjHJfgJ.js";import"./ui-LM8pS8qE.js";import"./SessionRefScreen-C-4jjmVG.js";import"./arrow-up-right-Bj8RjSqW.js";import"./agents-project-model-UYiamtrU.js";import"./model-IGCUEsMy.js";import"./operator-attention-BwSPeheT.js";import"./HomeHero-W445QrG1.js";import"./observe-DVHAcIrv.js";import"./agent-lanes-model-VYQ5a68i.js";import"./context-budget-DX_fwUs3.js";import"./home-moving-signal-Bs635mVw.js";import"./home-live-action-BkqGLVRY.js";import"./use-fleet-active-asks-Cnwa4hTK.js";import"./MissionLeftAgentRow-ByGrNAcs.js";import"./page-status-Bg2hd27j.js";import"./VoicePermissionsPanel-C80iZxgy.js";import"./check-BfA0T8UD.js";import"./refresh-cw-DtF8xPqX.js";import"./copy-C79v_7D-.js";import"./terminal-relay-BgfVJXIL.js";import"./session-table-BUPq9Viy.js";import"./server-Bncn9S7r.js";import"./radio-BGtkyCG9.js";import"./left-C6Zj3cR4.js";import"./left-BuJ0wJW1.js";import"./conversation-prefs-DNre-Lcx.js";import"./use-conversation-list-DWX02INv.js";import"./left-l92tw5Kc.js";import"./use-mesh-ops-items-BRFm37oY.js";import"./left-DrCbY6ja.js";import"./left-agents-BuSyVNGE.js";import"./left-default-DRHywOKX.js";import"./left-lanes-4-aUyyrV.js";import"./lane-roster-store-B6ybJlHJ.js";import"./left-plan-MchYwAB_.js";import"./MeshCanvasMinimap-vmCpU1sD.js";import"./SecondaryNav-B4IsujYh.js";var gr={panels:{statusBar:"bg-card/95 backdrop-blur-xl border-t border-[var(--hud-chrome-border-subtle)] shadow-[var(--hud-shadow-bar)] fixed bottom-0 left-0 right-0 z-[60]"},zIndex:{navigationStack:50,drawer:70},layout:{navHeight:48,statusBarHeight:28}},rb=gr.panels;const ob=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],sb=Et("bell",ob);const ib=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],ab=Et("circle-alert",ib);const cb=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],lb=Et("circle-question-mark",cb);const ub=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],db=Et("corner-down-left",ub);const fb=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],pb=Et("flag",fb);const mb=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],hb=Et("layout-grid",mb);const gb=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],vb=Et("list-todo",gb);const bb=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],yb=Et("map",bb);const xb=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],wb=Et("panel-left-close",xb);const Eb=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],Sb=Et("panel-left-open",Eb);const kb=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],Cb=Et("panel-right-close",kb);const Rb=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],Tb=Et("panel-right-open",Rb);const _b=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]],Pb=Et("pin-off",_b);const Ib=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Ab=Et("trash-2",Ib);const Ob=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Mb=Et("users",Ob);var Nb=m.createContext({});function jb(){return m.useContext(Nb)}var tf="vercel.ai.error",Db=Symbol.for(tf),el,tl,an=class nf extends(tl=Error,el=Db,tl){constructor({name:t,message:n,cause:r}){super(n),this[el]=!0,this.name=t,this.cause=r}static isInstance(t){return nf.hasMarker(t,tf)}static hasMarker(t,n){const r=Symbol.for(n);return t!=null&&typeof t=="object"&&r in t&&typeof t[r]=="boolean"&&t[r]===!0}};function rf(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var of="AI_InvalidArgumentError",sf=`vercel.ai.error.${of}`,zb=Symbol.for(sf),nl,rl,Lb=class extends(rl=an,nl=zb,rl){constructor({message:e,cause:t,argument:n}){super({name:of,message:e,cause:t}),this[nl]=!0,this.argument=n}static isInstance(e){return an.hasMarker(e,sf)}},af="AI_JSONParseError",cf=`vercel.ai.error.${af}`,$b=Symbol.for(cf),ol,sl,il=class extends(sl=an,ol=$b,sl){constructor({text:e,cause:t}){super({name:af,message:`JSON parsing failed: Text: ${e}.
2
+ Error message: ${rf(t)}`,cause:t}),this[ol]=!0,this.text=e}static isInstance(e){return an.hasMarker(e,cf)}},lf="AI_TypeValidationError",uf=`vercel.ai.error.${lf}`,Fb=Symbol.for(uf),al,cl,vr=class fa extends(cl=an,al=Fb,cl){constructor({value:t,cause:n,context:r}){let o="Type validation failed";if(r?.field&&(o+=` for ${r.field}`),r?.entityName||r?.entityId){o+=" (";const s=[];r.entityName&&s.push(r.entityName),r.entityId&&s.push(`id: "${r.entityId}"`),o+=s.join(", "),o+=")"}super({name:lf,message:`${o}: Value: ${JSON.stringify(t)}.
3
+ Error message: ${rf(n)}`,cause:n}),this[al]=!0,this.value=t,this.context=r}static isInstance(t){return an.hasMarker(t,uf)}static wrap({value:t,cause:n,context:r}){var o,s,i;return fa.isInstance(n)&&n.value===t&&((o=n.context)==null?void 0:o.field)===r?.field&&((s=n.context)==null?void 0:s.entityName)===r?.entityName&&((i=n.context)==null?void 0:i.entityId)===r?.entityId?n:new fa({value:t,cause:n,context:r})}};function j(e,t,n){function r(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,l);const c=i.prototype,u=Object.keys(c);for(let d=0;d<u.length;d++){const h=u[d];h in a||(a[h]=c[h].bind(a))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var l;const c=n?.Parent?new s:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const u of c._zod.deferred)u();return c}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class fr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class df extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const ff={};function Rn(e){return ff}function pf(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function pa(e,t){return typeof t=="bigint"?t.toString():t}function Vs(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ya(e){return e==null}function Ka(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Bb(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const l=r.match(/\d?e-(\d?)/);l?.[1]&&(o=Number.parseInt(l[1]))}const s=n>o?n:o,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}const ll=Symbol("evaluating");function Ie(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ll)return r===void 0&&(r=ll,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Hn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function In(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function ul(e){return JSON.stringify(e)}function Vb(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const mf="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function oo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Zb=Vs(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function br(e){if(oo(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(oo(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function hf(e){return br(e)?{...e}:Array.isArray(e)?[...e]:e}const Ub=new Set(["string","number","symbol"]);function yr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function An(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function ce(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Wb(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Hb={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Gb(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=In(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=n.shape[a])}return Hn(this,"shape",i),i},checks:[]});return An(e,s)}function qb(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=In(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return Hn(this,"shape",i),i},checks:[]});return An(e,s)}function Yb(e,t){if(!br(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=In(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Hn(this,"shape",s),s}});return An(e,o)}function Kb(e,t){if(!br(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=In(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Hn(this,"shape",r),r}});return An(e,n)}function Jb(e,t){const n=In(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Hn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return An(e,n)}function Xb(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=In(t._zod.def,{get shape(){const a=t._zod.def.shape,l={...a};if(n)for(const c in n){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(l[c]=e?new e({type:"optional",innerType:a[c]}):a[c])}else for(const c in a)l[c]=e?new e({type:"optional",innerType:a[c]}):a[c];return Hn(this,"shape",l),l},checks:[]});return An(t,i)}function Qb(e,t,n){const r=In(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return Hn(this,"shape",s),s}});return An(t,r)}function ar(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function cr(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function jo(e){return typeof e=="string"?e:e?.message}function Tn(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=jo(e.inst?._zod.def?.error?.(e))??jo(t?.error?.(e))??jo(n.customError?.(e))??jo(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Ja(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function so(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const gf=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,pa,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},vf=j("$ZodError",gf),bf=j("$ZodError",gf,{Parent:Error});function ey(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function ty(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>r({issues:i}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let i=n,a=0;for(;a<s.path.length;){const l=s.path[a];a===s.path.length-1?(i[l]=i[l]||{_errors:[]},i[l]._errors.push(t(s))):i[l]=i[l]||{_errors:[]},i=i[l],a++}}};return r(e),n}const Xa=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new fr;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(l=>Tn(l,s,Rn())));throw mf(a,o?.callee),a}return i.value},Qa=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(o?.Err??e)(i.issues.map(l=>Tn(l,s,Rn())));throw mf(a,o?.callee),a}return i.value},Zs=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new fr;return s.issues.length?{success:!1,error:new(e??vf)(s.issues.map(i=>Tn(i,o,Rn())))}:{success:!0,data:s.value}},ny=Zs(bf),Us=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Tn(i,o,Rn())))}:{success:!0,data:s.value}},ry=Us(bf),oy=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Xa(e)(t,n,o)},sy=e=>(t,n,r)=>Xa(e)(t,n,r),iy=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Qa(e)(t,n,o)},ay=e=>async(t,n,r)=>Qa(e)(t,n,r),cy=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Zs(e)(t,n,o)},ly=e=>(t,n,r)=>Zs(e)(t,n,r),uy=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Us(e)(t,n,o)},dy=e=>async(t,n,r)=>Us(e)(t,n,r),fy=/^[cC][^\s-]{8,}$/,py=/^[0-9a-z]+$/,my=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,hy=/^[0-9a-vA-V]{20}$/,gy=/^[A-Za-z0-9]{27}$/,vy=/^[a-zA-Z0-9_-]{21}$/,by=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,yy=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,dl=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,xy=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,wy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Ey(){return new RegExp(wy,"u")}const Sy=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ky=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Cy=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ry=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ty=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,yf=/^[A-Za-z0-9_-]*$/,_y=/^\+[1-9]\d{6,14}$/,xf="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Py=new RegExp(`^${xf}$`);function wf(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Iy(e){return new RegExp(`^${wf(e)}$`)}function Ay(e){const t=wf({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${xf}T(?:${r})$`)}const Oy=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},My=/^-?\d+$/,Ef=/^-?\d+(?:\.\d+)?$/,Ny=/^(?:true|false)$/i,jy=/^null$/i,Dy=/^[^A-Z]*$/,zy=/^[^a-z]*$/,Tt=j("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Sf={number:"number",bigint:"bigint",object:"date"},kf=j("$ZodCheckLessThan",(e,t)=>{Tt.init(e,t);const n=Sf[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Cf=j("$ZodCheckGreaterThan",(e,t)=>{Tt.init(e,t);const n=Sf[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ly=j("$ZodCheckMultipleOf",(e,t)=>{Tt.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Bb(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),$y=j("$ZodCheckNumberFormat",(e,t)=>{Tt.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=Hb[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,n&&(a.pattern=My)}),e._zod.check=i=>{const a=i.value;if(n){if(!Number.isInteger(a)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Fy=j("$ZodCheckMaxLength",(e,t)=>{var n;Tt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Ya(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const i=Ja(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),By=j("$ZodCheckMinLength",(e,t)=>{var n;Tt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Ya(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const i=Ja(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Vy=j("$ZodCheckLengthEquals",(e,t)=>{var n;Tt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Ya(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const i=Ja(o),a=s>t.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Ws=j("$ZodCheckStringFormat",(e,t)=>{var n,r;Tt.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Zy=j("$ZodCheckRegex",(e,t)=>{Ws.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Uy=j("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Dy),Ws.init(e,t)}),Wy=j("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=zy),Ws.init(e,t)}),Hy=j("$ZodCheckIncludes",(e,t)=>{Tt.init(e,t);const n=yr(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Gy=j("$ZodCheckStartsWith",(e,t)=>{Tt.init(e,t);const n=new RegExp(`^${yr(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),qy=j("$ZodCheckEndsWith",(e,t)=>{Tt.init(e,t);const n=new RegExp(`.*${yr(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Yy=j("$ZodCheckOverwrite",(e,t)=>{Tt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Ky{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
4
+ `).filter(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
5
+ `))}}const Jy={major:4,minor:3,patch:6},Ve=j("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Jy;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const s of o._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(i,a,l)=>{let c=ar(i),u;for(const d of a){if(d._zod.def.when){if(!d._zod.def.when(i))continue}else if(c)continue;const h=i.issues.length,p=d._zod.check(i);if(p instanceof Promise&&l?.async===!1)throw new fr;if(u||p instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await p,i.issues.length!==h&&(c||(c=ar(i,h)))});else{if(i.issues.length===h)continue;c||(c=ar(i,h))}}return u?u.then(()=>i):i},s=(i,a,l)=>{if(ar(i))return i.aborted=!0,i;const c=o(a,r,l);if(c instanceof Promise){if(l.async===!1)throw new fr;return c.then(u=>e._zod.parse(u,l))}return e._zod.parse(c,l)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const c=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return c instanceof Promise?c.then(u=>s(u,i,a)):s(c,i,a)}const l=e._zod.parse(i,a);if(l instanceof Promise){if(a.async===!1)throw new fr;return l.then(c=>o(c,r,a))}return o(l,r,a)}}Ie(e,"~standard",()=>({validate:o=>{try{const s=ny(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return ry(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),ec=j("$ZodString",(e,t)=>{Ve.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Oy(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Ue=j("$ZodStringFormat",(e,t)=>{Ws.init(e,t),ec.init(e,t)}),Xy=j("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=yy),Ue.init(e,t)}),Qy=j("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=dl(r))}else t.pattern??(t.pattern=dl());Ue.init(e,t)}),ex=j("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=xy),Ue.init(e,t)}),tx=j("$ZodURL",(e,t)=>{Ue.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),nx=j("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ey()),Ue.init(e,t)}),rx=j("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=vy),Ue.init(e,t)}),ox=j("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=fy),Ue.init(e,t)}),sx=j("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=py),Ue.init(e,t)}),ix=j("$ZodULID",(e,t)=>{t.pattern??(t.pattern=my),Ue.init(e,t)}),ax=j("$ZodXID",(e,t)=>{t.pattern??(t.pattern=hy),Ue.init(e,t)}),cx=j("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=gy),Ue.init(e,t)}),lx=j("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ay(t)),Ue.init(e,t)}),ux=j("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Py),Ue.init(e,t)}),dx=j("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Iy(t)),Ue.init(e,t)}),fx=j("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=by),Ue.init(e,t)}),px=j("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Sy),Ue.init(e,t),e._zod.bag.format="ipv4"}),mx=j("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ky),Ue.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),hx=j("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Cy),Ue.init(e,t)}),gx=j("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ry),Ue.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,s]=r;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Rf(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const vx=j("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ty),Ue.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Rf(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function bx(e){if(!yf.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Rf(n)}const yx=j("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=yf),Ue.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{bx(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),xx=j("$ZodE164",(e,t)=>{t.pattern??(t.pattern=_y),Ue.init(e,t)});function wx(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const Ex=j("$ZodJWT",(e,t)=>{Ue.init(e,t),e._zod.check=n=>{wx(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Tf=j("$ZodNumber",(e,t)=>{Ve.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ef,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),Sx=j("$ZodNumberFormat",(e,t)=>{$y.init(e,t),Tf.init(e,t)}),kx=j("$ZodBoolean",(e,t)=>{Ve.init(e,t),e._zod.pattern=Ny,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),Cx=j("$ZodNull",(e,t)=>{Ve.init(e,t),e._zod.pattern=jy,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Rx=j("$ZodUnknown",(e,t)=>{Ve.init(e,t),e._zod.parse=n=>n}),Tx=j("$ZodNever",(e,t)=>{Ve.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function fl(e,t,n){e.issues.length&&t.issues.push(...cr(n,e.issues)),t.value[n]=e.value}const _x=j("$ZodArray",(e,t)=>{Ve.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const a=o[i],l=t.element._zod.run({value:a,issues:[]},r);l instanceof Promise?s.push(l.then(c=>fl(c,n,i))):fl(l,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function gs(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...cr(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function _f(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=Wb(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Pf(e,t,n,r,o,s){const i=[],a=o.keySet,l=o.catchall._zod,c=l.def.type,u=l.optout==="optional";for(const d in t){if(a.has(d))continue;if(c==="never"){i.push(d);continue}const h=l.run({value:t[d],issues:[]},r);h instanceof Promise?e.push(h.then(p=>gs(p,n,d,t,u))):gs(h,n,d,t,u)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const Px=j("$ZodObject",(e,t)=>{if(Ve.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const l={...a};return Object.defineProperty(t,"shape",{value:l}),l}})}const r=Vs(()=>_f(t));Ie(e._zod,"propValues",()=>{const a=t.shape,l={};for(const c in a){const u=a[c]._zod;if(u.values){l[c]??(l[c]=new Set);for(const d of u.values)l[c].add(d)}}return l});const o=oo,s=t.catchall;let i;e._zod.parse=(a,l)=>{i??(i=r.value);const c=a.value;if(!o(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),a;a.value={};const u=[],d=i.shape;for(const h of i.keys){const p=d[h],b=p._zod.optout==="optional",x=p._zod.run({value:c[h],issues:[]},l);x instanceof Promise?u.push(x.then(E=>gs(E,a,h,c,b))):gs(x,a,h,c,b)}return s?Pf(u,c,a,l,r.value,e):u.length?Promise.all(u).then(()=>a):a}}),Ix=j("$ZodObjectJIT",(e,t)=>{Px.init(e,t);const n=e._zod.parse,r=Vs(()=>_f(t)),o=h=>{const p=new Ky(["shape","payload","ctx"]),b=r.value,x=v=>{const w=ul(v);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};p.write("const input = payload.value;");const E=Object.create(null);let y=0;for(const v of b.keys)E[v]=`key_${y++}`;p.write("const newResult = {};");for(const v of b.keys){const w=E[v],S=ul(v),R=h[v]?._zod?.optout==="optional";p.write(`const ${w} = ${x(v)};`),R?p.write(`
6
+ if (${w}.issues.length) {
7
+ if (${S} in input) {
8
+ payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
9
+ ...iss,
10
+ path: iss.path ? [${S}, ...iss.path] : [${S}]
11
+ })));
12
+ }
13
+ }
14
+
15
+ if (${w}.value === undefined) {
16
+ if (${S} in input) {
17
+ newResult[${S}] = undefined;
18
+ }
19
+ } else {
20
+ newResult[${S}] = ${w}.value;
21
+ }
22
+
23
+ `):p.write(`
24
+ if (${w}.issues.length) {
25
+ payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
26
+ ...iss,
27
+ path: iss.path ? [${S}, ...iss.path] : [${S}]
28
+ })));
29
+ }
30
+
31
+ if (${w}.value === undefined) {
32
+ if (${S} in input) {
33
+ newResult[${S}] = undefined;
34
+ }
35
+ } else {
36
+ newResult[${S}] = ${w}.value;
37
+ }
38
+
39
+ `)}p.write("payload.value = newResult;"),p.write("return payload;");const g=p.compile();return(v,w)=>g(h,v,w)};let s;const i=oo,a=!ff.jitless,c=a&&Zb.value,u=t.catchall;let d;e._zod.parse=(h,p)=>{d??(d=r.value);const b=h.value;return i(b)?a&&c&&p?.async===!1&&p.jitless!==!0?(s||(s=o(t.shape)),h=s(h,p),u?Pf([],b,h,p,d,e):h):n(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),h)}});function pl(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!ar(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>Tn(i,r,Rn())))}),t)}const If=j("$ZodUnion",(e,t)=>{Ve.init(e,t),Ie(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Ie(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Ie(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Ie(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Ka(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(n)return r(o,s);let i=!1;const a=[];for(const l of t.options){const c=l._zod.run({value:o.value,issues:[]},s);if(c instanceof Promise)a.push(c),i=!0;else{if(c.issues.length===0)return c;a.push(c)}}return i?Promise.all(a).then(l=>pl(l,o,e,s)):pl(a,o,e,s)}}),Ax=j("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,If.init(e,t);const n=e._zod.parse;Ie(e._zod,"propValues",()=>{const o={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[a,l]of Object.entries(i)){o[a]||(o[a]=new Set);for(const c of l)o[a].add(c)}}return o});const r=Vs(()=>{const o=t.options,s=new Map;for(const i of o){const a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const l of a){if(s.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);s.set(l,i)}}return s});e._zod.parse=(o,s)=>{const i=o.value;if(!oo(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const a=r.value.get(i?.[t.discriminator]);return a?a._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),o)}}),Ox=j("$ZodIntersection",(e,t)=>{Ve.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([l,c])=>ml(n,l,c)):ml(n,s,i)}});function ma(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(br(e)&&br(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const i=ma(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],i=ma(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ml(e,t,n){const r=new Map;let o;for(const a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else e.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else e.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&e.issues.push({...o,keys:s}),ar(e))return e;const i=ma(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Mx=j("$ZodRecord",(e,t)=>{Ve.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!br(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const a=new Set;for(const c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){a.add(typeof c=="number"?c.toString():c);const u=t.valueType._zod.run({value:o[c],issues:[]},r);u instanceof Promise?s.push(u.then(d=>{d.issues.length&&n.issues.push(...cr(c,d.issues)),n.value[c]=d.value})):(u.issues.length&&n.issues.push(...cr(c,u.issues)),n.value[c]=u.value)}let l;for(const c in o)a.has(c)||(l=l??[],l.push(c));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l})}else{n.value={};for(const a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let l=t.keyType._zod.run({value:a,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Ef.test(a)&&l.issues.length){const d=t.keyType._zod.run({value:Number(a),issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(l=d)}if(l.issues.length){t.mode==="loose"?n.value[a]=o[a]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(d=>Tn(d,r,Rn())),input:a,path:[a],inst:e});continue}const u=t.valueType._zod.run({value:o[a],issues:[]},r);u instanceof Promise?s.push(u.then(d=>{d.issues.length&&n.issues.push(...cr(a,d.issues)),n.value[l.value]=d.value})):(u.issues.length&&n.issues.push(...cr(a,u.issues)),n.value[l.value]=u.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Nx=j("$ZodEnum",(e,t)=>{Ve.init(e,t);const n=pf(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Ub.has(typeof o)).map(o=>typeof o=="string"?yr(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:n,input:i,inst:e}),o}}),jx=j("$ZodLiteral",(e,t)=>{if(Ve.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?yr(r):r?yr(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),Dx=j("$ZodTransform",(e,t)=>{Ve.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new df(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n));if(o instanceof Promise)throw new fr;return n.value=o,n}});function hl(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Af=j("$ZodOptional",(e,t)=>{Ve.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ie(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ie(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ka(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>hl(s,n.value)):hl(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),zx=j("$ZodExactOptional",(e,t)=>{Af.init(e,t),Ie(e._zod,"values",()=>t.innerType._zod.values),Ie(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Lx=j("$ZodNullable",(e,t)=>{Ve.init(e,t),Ie(e._zod,"optin",()=>t.innerType._zod.optin),Ie(e._zod,"optout",()=>t.innerType._zod.optout),Ie(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ka(n.source)}|null)$`):void 0}),Ie(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),$x=j("$ZodDefault",(e,t)=>{Ve.init(e,t),e._zod.optin="optional",Ie(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>gl(s,t)):gl(o,t)}});function gl(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Fx=j("$ZodPrefault",(e,t)=>{Ve.init(e,t),e._zod.optin="optional",Ie(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Bx=j("$ZodNonOptional",(e,t)=>{Ve.init(e,t),Ie(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>vl(s,e)):vl(o,e)}});function vl(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Vx=j("$ZodCatch",(e,t)=>{Ve.init(e,t),Ie(e._zod,"optin",()=>t.innerType._zod.optin),Ie(e._zod,"optout",()=>t.innerType._zod.optout),Ie(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>Tn(i,r,Rn()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>Tn(s,r,Rn()))},input:n.value}),n.issues=[]),n)}}),Zx=j("$ZodPipe",(e,t)=>{Ve.init(e,t),Ie(e._zod,"values",()=>t.in._zod.values),Ie(e._zod,"optin",()=>t.in._zod.optin),Ie(e._zod,"optout",()=>t.out._zod.optout),Ie(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(i=>Do(i,t.in,r)):Do(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>Do(s,t.out,r)):Do(o,t.out,r)}});function Do(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Ux=j("$ZodReadonly",(e,t)=>{Ve.init(e,t),Ie(e._zod,"propValues",()=>t.innerType._zod.propValues),Ie(e._zod,"values",()=>t.innerType._zod.values),Ie(e._zod,"optin",()=>t.innerType?._zod?.optin),Ie(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(bl):bl(o)}});function bl(e){return e.value=Object.freeze(e.value),e}const Wx=j("$ZodLazy",(e,t)=>{Ve.init(e,t),Ie(e._zod,"innerType",()=>t.getter()),Ie(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Ie(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Ie(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Ie(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),Hx=j("$ZodCustom",(e,t)=>{Tt.init(e,t),Ve.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>yl(s,n,r,e));yl(o,n,r,e)}});function yl(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(so(o))}}var xl;class Gx{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function qx(){return new Gx}(xl=globalThis).__zod_globalRegistry??(xl.__zod_globalRegistry=qx());const Br=globalThis.__zod_globalRegistry;function Yx(e,t){return new e({type:"string",...ce(t)})}function Kx(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ce(t)})}function wl(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ce(t)})}function Jx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ce(t)})}function Xx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ce(t)})}function Qx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ce(t)})}function e0(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ce(t)})}function t0(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ce(t)})}function n0(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ce(t)})}function r0(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ce(t)})}function o0(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ce(t)})}function s0(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ce(t)})}function i0(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ce(t)})}function a0(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ce(t)})}function c0(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ce(t)})}function l0(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ce(t)})}function u0(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ce(t)})}function d0(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ce(t)})}function f0(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ce(t)})}function p0(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ce(t)})}function m0(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ce(t)})}function h0(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ce(t)})}function g0(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ce(t)})}function v0(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ce(t)})}function b0(e,t){return new e({type:"string",format:"date",check:"string_format",...ce(t)})}function y0(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ce(t)})}function x0(e,t){return new e({type:"string",format:"duration",check:"string_format",...ce(t)})}function w0(e,t){return new e({type:"number",checks:[],...ce(t)})}function E0(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ce(t)})}function S0(e,t){return new e({type:"boolean",...ce(t)})}function k0(e,t){return new e({type:"null",...ce(t)})}function C0(e){return new e({type:"unknown"})}function R0(e,t){return new e({type:"never",...ce(t)})}function El(e,t){return new kf({check:"less_than",...ce(t),value:e,inclusive:!1})}function Ti(e,t){return new kf({check:"less_than",...ce(t),value:e,inclusive:!0})}function Sl(e,t){return new Cf({check:"greater_than",...ce(t),value:e,inclusive:!1})}function _i(e,t){return new Cf({check:"greater_than",...ce(t),value:e,inclusive:!0})}function kl(e,t){return new Ly({check:"multiple_of",...ce(t),value:e})}function Of(e,t){return new Fy({check:"max_length",...ce(t),maximum:e})}function vs(e,t){return new By({check:"min_length",...ce(t),minimum:e})}function Mf(e,t){return new Vy({check:"length_equals",...ce(t),length:e})}function T0(e,t){return new Zy({check:"string_format",format:"regex",...ce(t),pattern:e})}function _0(e){return new Uy({check:"string_format",format:"lowercase",...ce(e)})}function P0(e){return new Wy({check:"string_format",format:"uppercase",...ce(e)})}function I0(e,t){return new Hy({check:"string_format",format:"includes",...ce(t),includes:e})}function A0(e,t){return new Gy({check:"string_format",format:"starts_with",...ce(t),prefix:e})}function O0(e,t){return new qy({check:"string_format",format:"ends_with",...ce(t),suffix:e})}function Rr(e){return new Yy({check:"overwrite",tx:e})}function M0(e){return Rr(t=>t.normalize(e))}function N0(){return Rr(e=>e.trim())}function j0(){return Rr(e=>e.toLowerCase())}function D0(){return Rr(e=>e.toUpperCase())}function z0(){return Rr(e=>Vb(e))}function L0(e,t,n){return new e({type:"array",element:t,...ce(n)})}function $0(e,t,n){const r=ce(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function F0(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ce(n)})}function B0(e){const t=V0(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(so(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(so(o))}},e(n.value,n)));return t}function V0(e,t){const n=new Tt({check:"custom",...ce(t)});return n._zod.check=e,n}function bs(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Br,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function $e(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{const u={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,u);else{const h=i.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,h,u)}const d=e._zod.parent;d&&(i.ref||(i.ref=d),$e(d,t,u),t.seen.get(d).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(i.schema,l),t.io==="input"&&ht(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function ys(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const i of e.seen.entries()){const a=e.metadataRegistry.get(i[0])?.id;if(a){const l=r.get(a);if(l&&l!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,i[0])}}const o=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const d=e.external.registry.get(i[0])?.id,h=e.external.uri??(b=>b);if(d)return{ref:h(d)};const p=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=p,{defId:p,ref:`${h("__shared")}#/${a}/${p}`}}if(i[1]===n)return{ref:"#"};const c=`#/${a}/`,u=i[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:c+u}},s=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:l,defId:c}=o(i);a.def={...a.schema},c&&(a.defId=c);const u=a.schema;for(const d in u)delete u[d];u.$ref=l};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
40
+
41
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=i[1];if(t===i[0]){s(i);continue}if(e.external){const c=e.external.registry.get(i[0])?.id;if(t!==i[0]&&c){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function xs(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=i=>{const a=e.seen.get(i);if(a.ref===null)return;const l=a.def??a.schema,c={...l},u=a.ref;if(a.ref=null,u){r(u);const h=e.seen.get(u),p=h.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(p)):Object.assign(l,p),Object.assign(l,c),i._zod.parent===u)for(const x in l)x==="$ref"||x==="allOf"||x in c||delete l[x];if(p.$ref&&h.def)for(const x in l)x==="$ref"||x==="allOf"||x in h.def&&JSON.stringify(l[x])===JSON.stringify(h.def[x])&&delete l[x]}const d=i._zod.parent;if(d&&d!==u){r(d);const h=e.seen.get(d);if(h?.schema.$ref&&(l.$ref=h.schema.$ref,h.def))for(const p in l)p==="$ref"||p==="allOf"||p in h.def&&JSON.stringify(l[p])===JSON.stringify(h.def[p])&&delete l[p]}e.override({zodSchema:i,jsonSchema:l,path:a.path??[]})};for(const i of[...e.seen.entries()].reverse())r(i[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const i=e.external.registry.get(t)?.id;if(!i)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(i)}Object.assign(o,n.def??n.schema);const s=e.external?.defs??{};for(const i of e.seen.entries()){const a=i[1];a.def&&a.defId&&(s[a.defId]=a.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const i=JSON.parse(JSON.stringify(o));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:ws(t,"input",e.processors),output:ws(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function ht(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return ht(r.element,n);if(r.type==="set")return ht(r.valueType,n);if(r.type==="lazy")return ht(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return ht(r.innerType,n);if(r.type==="intersection")return ht(r.left,n)||ht(r.right,n);if(r.type==="record"||r.type==="map")return ht(r.keyType,n)||ht(r.valueType,n);if(r.type==="pipe")return ht(r.in,n)||ht(r.out,n);if(r.type==="object"){for(const o in r.shape)if(ht(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(ht(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(ht(o,n))return!0;return!!(r.rest&&ht(r.rest,n))}return!1}const Z0=(e,t={})=>n=>{const r=bs({...n,processors:t});return $e(e,r),ys(r,e),xs(r,e)},ws=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=bs({...o??{},target:s,io:t,processors:n});return $e(e,i),ys(i,e),xs(i,e)},U0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Nf=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:a,patterns:l,contentEncoding:c}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=U0[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),c&&(o.contentEncoding=c),l&&l.size>0){const u=[...l];u.length===1?o.pattern=u[0].source:u.length>1&&(o.allOf=[...u.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},jf=(e,t,n,r)=>{const o=n,{minimum:s,maximum:i,format:a,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:u}=e._zod.bag;typeof a=="string"&&a.includes("int")?o.type="integer":o.type="number",typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u),typeof s=="number"&&(o.minimum=s,typeof u=="number"&&t.target!=="draft-04"&&(u>=s?delete o.minimum:delete o.exclusiveMinimum)),typeof c=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c),typeof i=="number"&&(o.maximum=i,typeof c=="number"&&t.target!=="draft-04"&&(c<=i?delete o.maximum:delete o.exclusiveMaximum)),typeof l=="number"&&(o.multipleOf=l)},Df=(e,t,n,r)=>{n.type="boolean"},W0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},H0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},zf=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},G0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},q0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Lf=(e,t,n,r)=>{n.not={}},Y0=(e,t,n,r)=>{},$f=(e,t,n,r)=>{},K0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Ff=(e,t,n,r)=>{const o=e._zod.def,s=pf(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},Bf=(e,t,n,r)=>{const o=e._zod.def,s=[];for(const i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),s.every(i=>typeof i=="boolean")&&(n.type="boolean"),s.every(i=>i===null)&&(n.type="null"),n.enum=s},J0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},X0=(e,t,n,r)=>{const o=n,s=e._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=s.source},Q0=(e,t,n,r)=>{const o=n,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:l}=e._zod.bag;i!==void 0&&(s.minLength=i),a!==void 0&&(s.maxLength=a),l?l.length===1?(s.contentMediaType=l[0],Object.assign(o,s)):(Object.assign(o,s),o.anyOf=l.map(c=>({contentMediaType:c}))):Object.assign(o,s)},ew=(e,t,n,r)=>{n.type="boolean"},Vf=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},tw=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Zf=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},nw=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},rw=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Uf=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=$e(s.element,t,{...r,path:[...r.path,"items"]})},Wf=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object",o.properties={};const i=s.shape;for(const c in i)o.properties[c]=$e(i[c],t,{...r,path:[...r.path,"properties",c]});const a=new Set(Object.keys(i)),l=new Set([...a].filter(c=>{const u=s.shape[c]._zod;return t.io==="input"?u.optin===void 0:u.optout===void 0}));l.size>0&&(o.required=Array.from(l)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=$e(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Hf=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,l)=>$e(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?n.oneOf=i:n.anyOf=i},Gf=(e,t,n,r)=>{const o=e._zod.def,s=$e(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=$e(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,l=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=l},ow=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="array";const i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=s.items.map((h,p)=>$e(h,t,{...r,path:[...r.path,i,p]})),c=s.rest?$e(s.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=l,c&&(o.items=c)):t.target==="openapi-3.0"?(o.items={anyOf:l},c&&o.items.anyOf.push(c),o.minItems=l.length,c||(o.maxItems=l.length)):(o.items=l,c&&(o.additionalItems=c));const{minimum:u,maximum:d}=e._zod.bag;typeof u=="number"&&(o.minItems=u),typeof d=="number"&&(o.maxItems=d)},qf=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const i=s.keyType,l=i._zod.bag?.patterns;if(s.mode==="loose"&&l&&l.size>0){const u=$e(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const d of l)o.patternProperties[d.source]=u}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=$e(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=$e(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const c=i._zod.values;if(c){const u=[...c].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(o.required=u)}},Yf=(e,t,n,r)=>{const o=e._zod.def,s=$e(o.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},Kf=(e,t,n,r)=>{const o=e._zod.def;$e(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Jf=(e,t,n,r)=>{const o=e._zod.def;$e(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Xf=(e,t,n,r)=>{const o=e._zod.def;$e(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Qf=(e,t,n,r)=>{const o=e._zod.def;$e(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},ep=(e,t,n,r)=>{const o=e._zod.def,s=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;$e(s,t,r);const i=t.seen.get(e);i.ref=s},tp=(e,t,n,r)=>{const o=e._zod.def;$e(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},sw=(e,t,n,r)=>{const o=e._zod.def;$e(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},tc=(e,t,n,r)=>{const o=e._zod.def;$e(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},np=(e,t,n,r)=>{const o=e._zod.innerType;$e(o,t,r);const s=t.seen.get(e);s.ref=o},Cl={string:Nf,number:jf,boolean:Df,bigint:W0,symbol:H0,null:zf,undefined:G0,void:q0,never:Lf,any:Y0,unknown:$f,date:K0,enum:Ff,literal:Bf,nan:J0,template_literal:X0,file:Q0,success:ew,custom:Vf,function:tw,transform:Zf,map:nw,set:rw,array:Uf,object:Wf,union:Hf,intersection:Gf,tuple:ow,record:qf,nullable:Yf,nonoptional:Kf,default:Jf,prefault:Xf,catch:Qf,pipe:ep,readonly:tp,promise:sw,optional:tc,lazy:np};function iw(e,t){if("_idmap"in e){const r=e,o=bs({...t,processors:Cl}),s={};for(const l of r._idmap.entries()){const[c,u]=l;$e(u,o)}const i={},a={registry:r,uri:t?.uri,defs:s};o.external=a;for(const l of r._idmap.entries()){const[c,u]=l;ys(o,u),i[c]=xs(o,u)}if(Object.keys(s).length>0){const l=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[l]:s}}return{schemas:i}}const n=bs({...t,processors:Cl});return $e(e,n),ys(n,e),xs(n,e)}const aw=j("ZodISODateTime",(e,t)=>{lx.init(e,t),We.init(e,t)});function cw(e){return v0(aw,e)}const lw=j("ZodISODate",(e,t)=>{ux.init(e,t),We.init(e,t)});function uw(e){return b0(lw,e)}const dw=j("ZodISOTime",(e,t)=>{dx.init(e,t),We.init(e,t)});function fw(e){return y0(dw,e)}const pw=j("ZodISODuration",(e,t)=>{fx.init(e,t),We.init(e,t)});function mw(e){return x0(pw,e)}const hw=(e,t)=>{vf.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>ty(e,n)},flatten:{value:n=>ey(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,pa,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,pa,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ft=j("ZodError",hw,{Parent:Error}),gw=Xa(Ft),vw=Qa(Ft),bw=Zs(Ft),rp=Us(Ft),yw=oy(Ft),xw=sy(Ft),ww=iy(Ft),Ew=ay(Ft),Sw=cy(Ft),kw=ly(Ft),Cw=uy(Ft),Rw=dy(Ft),Ze=j("ZodType",(e,t)=>(Ve.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ws(e,"input"),output:ws(e,"output")}}),e.toJSONSchema=Z0(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(In(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>An(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>gw(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>bw(e,n,r),e.parseAsync=async(n,r)=>vw(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>rp(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>yw(e,n,r),e.decode=(n,r)=>xw(e,n,r),e.encodeAsync=async(n,r)=>ww(e,n,r),e.decodeAsync=async(n,r)=>Ew(e,n,r),e.safeEncode=(n,r)=>Sw(e,n,r),e.safeDecode=(n,r)=>kw(e,n,r),e.safeEncodeAsync=async(n,r)=>Cw(e,n,r),e.safeDecodeAsync=async(n,r)=>Rw(e,n,r),e.refine=(n,r)=>e.check(EE(n,r)),e.superRefine=n=>e.check(SE(n)),e.overwrite=n=>e.check(Rr(n)),e.optional=()=>_l(e),e.exactOptional=()=>cE(e),e.nullable=()=>Pl(e),e.nullish=()=>_l(Pl(e)),e.nonoptional=n=>mE(e,n),e.array=()=>Tr(e),e.or=n=>wt([e,n]),e.and=n=>nE(e,n),e.transform=n=>Il(e,iE(n)),e.default=n=>dE(e,n),e.prefault=n=>pE(e,n),e.catch=n=>gE(e,n),e.pipe=n=>Il(e,n),e.readonly=()=>yE(e),e.describe=n=>{const r=e.clone();return Br.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return Br.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Br.get(e);const r=e.clone();return Br.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),op=j("_ZodString",(e,t)=>{ec.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Nf(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(T0(...r)),e.includes=(...r)=>e.check(I0(...r)),e.startsWith=(...r)=>e.check(A0(...r)),e.endsWith=(...r)=>e.check(O0(...r)),e.min=(...r)=>e.check(vs(...r)),e.max=(...r)=>e.check(Of(...r)),e.length=(...r)=>e.check(Mf(...r)),e.nonempty=(...r)=>e.check(vs(1,...r)),e.lowercase=r=>e.check(_0(r)),e.uppercase=r=>e.check(P0(r)),e.trim=()=>e.check(N0()),e.normalize=(...r)=>e.check(M0(...r)),e.toLowerCase=()=>e.check(j0()),e.toUpperCase=()=>e.check(D0()),e.slugify=()=>e.check(z0())}),Tw=j("ZodString",(e,t)=>{ec.init(e,t),op.init(e,t),e.email=n=>e.check(Kx(_w,n)),e.url=n=>e.check(t0(Pw,n)),e.jwt=n=>e.check(g0(Uw,n)),e.emoji=n=>e.check(n0(Iw,n)),e.guid=n=>e.check(wl(Rl,n)),e.uuid=n=>e.check(Jx(zo,n)),e.uuidv4=n=>e.check(Xx(zo,n)),e.uuidv6=n=>e.check(Qx(zo,n)),e.uuidv7=n=>e.check(e0(zo,n)),e.nanoid=n=>e.check(r0(Aw,n)),e.guid=n=>e.check(wl(Rl,n)),e.cuid=n=>e.check(o0(Ow,n)),e.cuid2=n=>e.check(s0(Mw,n)),e.ulid=n=>e.check(i0(Nw,n)),e.base64=n=>e.check(p0(Bw,n)),e.base64url=n=>e.check(m0(Vw,n)),e.xid=n=>e.check(a0(jw,n)),e.ksuid=n=>e.check(c0(Dw,n)),e.ipv4=n=>e.check(l0(zw,n)),e.ipv6=n=>e.check(u0(Lw,n)),e.cidrv4=n=>e.check(d0($w,n)),e.cidrv6=n=>e.check(f0(Fw,n)),e.e164=n=>e.check(h0(Zw,n)),e.datetime=n=>e.check(cw(n)),e.date=n=>e.check(uw(n)),e.time=n=>e.check(fw(n)),e.duration=n=>e.check(mw(n))});function G(e){return Yx(Tw,e)}const We=j("ZodStringFormat",(e,t)=>{Ue.init(e,t),op.init(e,t)}),_w=j("ZodEmail",(e,t)=>{ex.init(e,t),We.init(e,t)}),Rl=j("ZodGUID",(e,t)=>{Xy.init(e,t),We.init(e,t)}),zo=j("ZodUUID",(e,t)=>{Qy.init(e,t),We.init(e,t)}),Pw=j("ZodURL",(e,t)=>{tx.init(e,t),We.init(e,t)}),Iw=j("ZodEmoji",(e,t)=>{nx.init(e,t),We.init(e,t)}),Aw=j("ZodNanoID",(e,t)=>{rx.init(e,t),We.init(e,t)}),Ow=j("ZodCUID",(e,t)=>{ox.init(e,t),We.init(e,t)}),Mw=j("ZodCUID2",(e,t)=>{sx.init(e,t),We.init(e,t)}),Nw=j("ZodULID",(e,t)=>{ix.init(e,t),We.init(e,t)}),jw=j("ZodXID",(e,t)=>{ax.init(e,t),We.init(e,t)}),Dw=j("ZodKSUID",(e,t)=>{cx.init(e,t),We.init(e,t)}),zw=j("ZodIPv4",(e,t)=>{px.init(e,t),We.init(e,t)}),Lw=j("ZodIPv6",(e,t)=>{mx.init(e,t),We.init(e,t)}),$w=j("ZodCIDRv4",(e,t)=>{hx.init(e,t),We.init(e,t)}),Fw=j("ZodCIDRv6",(e,t)=>{gx.init(e,t),We.init(e,t)}),Bw=j("ZodBase64",(e,t)=>{vx.init(e,t),We.init(e,t)}),Vw=j("ZodBase64URL",(e,t)=>{yx.init(e,t),We.init(e,t)}),Zw=j("ZodE164",(e,t)=>{xx.init(e,t),We.init(e,t)}),Uw=j("ZodJWT",(e,t)=>{Ex.init(e,t),We.init(e,t)}),sp=j("ZodNumber",(e,t)=>{Tf.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,s)=>jf(e,r,o),e.gt=(r,o)=>e.check(Sl(r,o)),e.gte=(r,o)=>e.check(_i(r,o)),e.min=(r,o)=>e.check(_i(r,o)),e.lt=(r,o)=>e.check(El(r,o)),e.lte=(r,o)=>e.check(Ti(r,o)),e.max=(r,o)=>e.check(Ti(r,o)),e.int=r=>e.check(Tl(r)),e.safe=r=>e.check(Tl(r)),e.positive=r=>e.check(Sl(0,r)),e.nonnegative=r=>e.check(_i(0,r)),e.negative=r=>e.check(El(0,r)),e.nonpositive=r=>e.check(Ti(0,r)),e.multipleOf=(r,o)=>e.check(kl(r,o)),e.step=(r,o)=>e.check(kl(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Ww(e){return w0(sp,e)}const Hw=j("ZodNumberFormat",(e,t)=>{Sx.init(e,t),sp.init(e,t)});function Tl(e){return E0(Hw,e)}const Gw=j("ZodBoolean",(e,t)=>{kx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Df(e,n,r)});function gt(e){return S0(Gw,e)}const qw=j("ZodNull",(e,t)=>{Cx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zf(e,n,r)});function Yw(e){return k0(qw,e)}const Kw=j("ZodUnknown",(e,t)=>{Rx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$f()});function tn(){return C0(Kw)}const Jw=j("ZodNever",(e,t)=>{Tx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lf(e,n,r)});function ip(e){return R0(Jw,e)}const Xw=j("ZodArray",(e,t)=>{_x.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uf(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(vs(n,r)),e.nonempty=n=>e.check(vs(1,n)),e.max=(n,r)=>e.check(Of(n,r)),e.length=(n,r)=>e.check(Mf(n,r)),e.unwrap=()=>e.element});function Tr(e,t){return L0(Xw,e,t)}const ap=j("ZodObject",(e,t)=>{Ix.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wf(e,n,r,o),Ie(e,"shape",()=>t.shape),e.keyof=()=>lp(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:tn()}),e.loose=()=>e.clone({...e._zod.def,catchall:tn()}),e.strict=()=>e.clone({...e._zod.def,catchall:ip()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Yb(e,n),e.safeExtend=n=>Kb(e,n),e.merge=n=>Jb(e,n),e.pick=n=>Gb(e,n),e.omit=n=>qb(e,n),e.partial=(...n)=>Xb(up,e,n[0]),e.required=(...n)=>Qb(dp,e,n[0])});function Le(e,t){const n={type:"object",shape:e??{},...ce(t)};return new ap(n)}function Fe(e,t){return new ap({type:"object",shape:e,catchall:ip(),...ce(t)})}const cp=j("ZodUnion",(e,t)=>{If.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hf(e,n,r,o),e.options=t.options});function wt(e,t){return new cp({type:"union",options:e,...ce(t)})}const Qw=j("ZodDiscriminatedUnion",(e,t)=>{cp.init(e,t),Ax.init(e,t)});function eE(e,t,n){return new Qw({type:"union",options:t,discriminator:e,...ce(n)})}const tE=j("ZodIntersection",(e,t)=>{Ox.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gf(e,n,r,o)});function nE(e,t){return new tE({type:"intersection",left:e,right:t})}const rE=j("ZodRecord",(e,t)=>{Mx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qf(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function io(e,t,n){return new rE({type:"record",keyType:e,valueType:t,...ce(n)})}const ha=j("ZodEnum",(e,t)=>{Nx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Ff(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new ha({...t,checks:[],...ce(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new ha({...t,checks:[],...ce(o),entries:s})}});function lp(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ha({type:"enum",entries:n,...ce(t)})}const oE=j("ZodLiteral",(e,t)=>{jx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bf(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function me(e,t){return new oE({type:"literal",values:Array.isArray(e)?e:[e],...ce(t)})}const sE=j("ZodTransform",(e,t)=>{Dx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zf(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new df(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(so(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(so(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function iE(e){return new sE({type:"transform",transform:e})}const up=j("ZodOptional",(e,t)=>{Af.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function _l(e){return new up({type:"optional",innerType:e})}const aE=j("ZodExactOptional",(e,t)=>{zx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function cE(e){return new aE({type:"optional",innerType:e})}const lE=j("ZodNullable",(e,t)=>{Lx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Pl(e){return new lE({type:"nullable",innerType:e})}const uE=j("ZodDefault",(e,t)=>{$x.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function dE(e,t){return new uE({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():hf(t)}})}const fE=j("ZodPrefault",(e,t)=>{Fx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function pE(e,t){return new fE({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():hf(t)}})}const dp=j("ZodNonOptional",(e,t)=>{Bx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Kf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function mE(e,t){return new dp({type:"nonoptional",innerType:e,...ce(t)})}const hE=j("ZodCatch",(e,t)=>{Vx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function gE(e,t){return new hE({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const vE=j("ZodPipe",(e,t)=>{Zx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ep(e,n,r,o),e.in=t.in,e.out=t.out});function Il(e,t){return new vE({type:"pipe",in:e,out:t})}const bE=j("ZodReadonly",(e,t)=>{Ux.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function yE(e){return new bE({type:"readonly",innerType:e})}const xE=j("ZodLazy",(e,t)=>{Wx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>np(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function wE(e){return new xE({type:"lazy",getter:e})}const nc=j("ZodCustom",(e,t)=>{Hx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vf(e,n)});function fp(e,t){return $0(nc,e??(()=>!0),t)}function EE(e,t={}){return F0(nc,e,t)}function SE(e){return B0(e)}function Es(e,t={}){const n=new nc({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...ce(t)});return n._zod.bag.Class=e,n._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}var ao;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const s={};for(const i of o)s[i]=i;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(const a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const s=[];for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},e.find=(o,s)=>{for(const i of o)if(s(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(ao||(ao={}));var Al;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Al||(Al={}));ao.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);ao.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ss extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(i))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof Ss))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ao.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n=Object.create(null),r=[];for(const o of this.issues)if(o.path.length>0){const s=o.path[0];n[s]=n[s]||[],n[s].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ss.create=e=>new Ss(e);var Ol;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Ol||(Ol={}));var xe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(xe||(xe={}));class Ml extends Error{constructor(t,n){super(t),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}const Nl=10,kE=13,Ln=32;function Pi(e){}function CE(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:t=Pi,onError:n=Pi,onRetry:r=Pi,onComment:o}=e;let s="",i=!0,a,l="",c=0,u;function d(g){if(i){i=!1,h(g);return}const v=s===""?g:s+g;s=p(v)}function h(g){g.charCodeAt(0)===239&&g.charCodeAt(1)===187&&g.charCodeAt(2)===191&&(g=g.slice(3));const v=s===""?g:s+g;s=p(v)}function p(g){let v=0;if(g.indexOf("\r")===-1){let w=g.indexOf(`
42
+ `,v);for(;w!==-1;){if(v===w){c>0&&t({id:a,event:u,data:l}),a=void 0,l="",c=0,u=void 0,v=w+1,w=g.indexOf(`
43
+ `,v);continue}const S=g.charCodeAt(v);if(jl(g,v,S)){const k=g.charCodeAt(v+5)===Ln?v+6:v+5,R=g.slice(k,w);if(c===0&&g.charCodeAt(w+1)===Nl){t({id:a,event:u,data:R}),a=void 0,l="",u=void 0,v=w+2,w=g.indexOf(`
44
+ `,v);continue}l=c===0?R:`${l}
45
+ ${R}`,c++}else Dl(g,v,S)?u=g.slice(g.charCodeAt(v+6)===Ln?v+7:v+6,w)||void 0:b(g,v,w);v=w+1,w=g.indexOf(`
46
+ `,v)}return g.slice(v)}for(;v<g.length;){const w=g.indexOf("\r",v),S=g.indexOf(`
47
+ `,v);let k=-1;if(w!==-1&&S!==-1?k=w<S?w:S:w!==-1?w===g.length-1?k=-1:k=w:S!==-1&&(k=S),k===-1)break;b(g,v,k),v=k+1,g.charCodeAt(v-1)===kE&&g.charCodeAt(v)===Nl&&v++}return g.slice(v)}function b(g,v,w){if(v===w){E();return}const S=g.charCodeAt(v);if(jl(g,v,S)){const M=g.charCodeAt(v+5)===Ln?v+6:v+5,N=g.slice(M,w);l=c===0?N:`${l}
48
+ ${N}`,c++;return}if(Dl(g,v,S)){u=g.slice(g.charCodeAt(v+6)===Ln?v+7:v+6,w)||void 0;return}if(S===105&&g.charCodeAt(v+1)===100&&g.charCodeAt(v+2)===58){const M=g.slice(g.charCodeAt(v+3)===Ln?v+4:v+3,w);a=M.includes("\0")?void 0:M;return}if(S===58){if(o){const M=g.slice(v,w);o(M.slice(g.charCodeAt(v+1)===Ln?2:1))}return}const k=g.slice(v,w),R=k.indexOf(":");if(R===-1){x(k,"",k);return}const C=k.slice(0,R),_=k.charCodeAt(R+1)===Ln?2:1,I=k.slice(R+_);x(C,I,k)}function x(g,v,w){switch(g){case"event":u=v||void 0;break;case"data":l=c===0?v:`${l}
49
+ ${v}`,c++;break;case"id":a=v.includes("\0")?void 0:v;break;case"retry":/^\d+$/.test(v)?r(parseInt(v,10)):n(new Ml(`Invalid \`retry\` value: "${v}"`,{type:"invalid-retry",value:v,line:w}));break;default:n(new Ml(`Unknown field "${g.length>20?`${g.slice(0,20)}…`:g}"`,{type:"unknown-field",field:g,value:v,line:w}));break}}function E(){c>0&&t({id:a,event:u,data:l}),a=void 0,l="",c=0,u=void 0}function y(g={}){s&&g.consume&&b(s,0,s.length),i=!0,a=void 0,l="",c=0,u=void 0,s=""}return{feed:d,reset:y}}function jl(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function Dl(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class RE extends TransformStream{constructor({onError:t,onRetry:n,onComment:r}={}){let o;super({start(s){o=CE({onEvent:i=>{s.enqueue(i)},onError(i){t==="terminate"?s.error(i):typeof t=="function"&&t(i)},onRetry:n,onComment:r})},transform(s){o.feed(s)}})}}var bo=({prefix:e,size:t=16,alphabet:n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const o=()=>{const s=n.length,i=new Array(t);for(let a=0;a<t;a++)i[a]=n[Math.random()*s|0];return i.join("")};if(e==null)return o;if(n.includes(r))throw new Lb({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${o()}`},TE=bo();function nr(e){if(e==null)return{};const t={};if(e instanceof Headers)e.forEach((n,r)=>{t[r.toLowerCase()]=n});else{Array.isArray(e)||(e=Object.entries(e));for(const[n,r]of e)r!=null&&(t[n.toLowerCase()]=r)}return t}var _E=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,PE=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function zl(e){const t=JSON.parse(e);return t===null||typeof t!="object"||_E.test(e)===!1&&PE.test(e)===!1?t:IE(t)}function IE(e){let t=[e];for(;t.length;){const n=t;t=[];for(const r of n){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&r.constructor!==null&&typeof r.constructor=="object"&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const o in r){const s=r[o];s&&typeof s=="object"&&t.push(s)}}}return e}function AE(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return zl(e)}try{return zl(e)}finally{Error.stackTraceLimit=t}}function rc(e){if(e.type==="object"||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;const{properties:n}=e;if(n!=null)for(const r of Object.keys(n))n[r]=$n(n[r])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map($n):$n(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map($n)),e.allOf!=null&&(e.allOf=e.allOf.map($n)),e.oneOf!=null&&(e.oneOf=e.oneOf.map($n));const{definitions:t}=e;if(t!=null)for(const n of Object.keys(t))t[n]=$n(t[n]);return e}function $n(e){return typeof e=="boolean"?e:rc(e)}var OE=Symbol("Let zodToJsonSchema decide on which parser to use"),Ll={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},ME=e=>typeof e=="string"?{...Ll,name:e}:{...Ll,...e};function Nt(){return{}}function NE(e,t){var n,r,o;const s={type:"array"};return(n=e.type)!=null&&n._def&&((o=(r=e.type)==null?void 0:r._def)==null?void 0:o.typeName)!==xe.ZodAny&&(s.items=je(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(s.minItems=e.minLength.value),e.maxLength&&(s.maxItems=e.maxLength.value),e.exactLength&&(s.minItems=e.exactLength.value,s.maxItems=e.exactLength.value),s}function jE(e){const t={type:"integer",format:"int64"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value;break}return t}function DE(){return{type:"boolean"}}function pp(e,t){return je(e.type._def,t)}var zE=(e,t)=>je(e.innerType._def,t);function mp(e,t,n){const r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((o,s)=>mp(e,t,o))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return LE(e)}}var LE=e=>{const t={type:"integer",format:"unix-time"};for(const n of e.checks)switch(n.kind){case"min":t.minimum=n.value;break;case"max":t.maximum=n.value;break}return t};function $E(e,t){return{...je(e.innerType._def,t),default:e.defaultValue()}}function FE(e,t){return t.effectStrategy==="input"?je(e.schema._def,t):Nt()}function BE(e){return{type:"string",enum:Array.from(e.values)}}var VE=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function ZE(e,t){const n=[je(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),je(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(o=>!!o),r=[];return n.forEach(o=>{if(VE(o))r.push(...o.allOf);else{let s=o;if("additionalProperties"in o&&o.additionalProperties===!1){const{additionalProperties:i,...a}=o;s=a}r.push(s)}}),r.length?{allOf:r}:void 0}function UE(e){const t=typeof e.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(e.value)?"array":"object"}:{type:t==="bigint"?"integer":t,const:e.value}}var Ii=void 0,Wt={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Ii===void 0&&(Ii=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ii),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function hp(e,t){const n={type:"string"};if(e.checks)for(const r of e.checks)switch(r.kind){case"min":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value;break;case"max":n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"email":switch(t.emailStrategy){case"format:email":Ht(n,"email",r.message,t);break;case"format:idn-email":Ht(n,"idn-email",r.message,t);break;case"pattern:zod":mt(n,Wt.email,r.message,t);break}break;case"url":Ht(n,"uri",r.message,t);break;case"uuid":Ht(n,"uuid",r.message,t);break;case"regex":mt(n,r.regex,r.message,t);break;case"cuid":mt(n,Wt.cuid,r.message,t);break;case"cuid2":mt(n,Wt.cuid2,r.message,t);break;case"startsWith":mt(n,RegExp(`^${Ai(r.value,t)}`),r.message,t);break;case"endsWith":mt(n,RegExp(`${Ai(r.value,t)}$`),r.message,t);break;case"datetime":Ht(n,"date-time",r.message,t);break;case"date":Ht(n,"date",r.message,t);break;case"time":Ht(n,"time",r.message,t);break;case"duration":Ht(n,"duration",r.message,t);break;case"length":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"includes":{mt(n,RegExp(Ai(r.value,t)),r.message,t);break}case"ip":{r.version!=="v6"&&Ht(n,"ipv4",r.message,t),r.version!=="v4"&&Ht(n,"ipv6",r.message,t);break}case"base64url":mt(n,Wt.base64url,r.message,t);break;case"jwt":mt(n,Wt.jwt,r.message,t);break;case"cidr":{r.version!=="v6"&&mt(n,Wt.ipv4Cidr,r.message,t),r.version!=="v4"&&mt(n,Wt.ipv6Cidr,r.message,t);break}case"emoji":mt(n,Wt.emoji(),r.message,t);break;case"ulid":{mt(n,Wt.ulid,r.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Ht(n,"binary",r.message,t);break}case"contentEncoding:base64":{n.contentEncoding="base64";break}case"pattern:zod":{mt(n,Wt.base64,r.message,t);break}}break}case"nanoid":mt(n,Wt.nanoid,r.message,t)}return n}function Ai(e,t){return t.patternStrategy==="escape"?HE(e):e}var WE=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function HE(e){let t="";for(let n=0;n<e.length;n++)WE.has(e[n])||(t+="\\"),t+=e[n];return t}function Ht(e,t,n,r){var o;e.format||(o=e.anyOf)!=null&&o.some(s=>s.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):e.format=t}function mt(e,t,n,r){var o;e.pattern||(o=e.allOf)!=null&&o.some(s=>s.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:$l(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=$l(t,r)}function $l(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},o=r.i?e.source.toLowerCase():e.source;let s="",i=!1,a=!1,l=!1;for(let c=0;c<o.length;c++){if(i){s+=o[c],i=!1;continue}if(r.i){if(a){if(o[c].match(/[a-z]/)){l?(s+=o[c],s+=`${o[c-2]}-${o[c]}`.toUpperCase(),l=!1):o[c+1]==="-"&&((n=o[c+2])!=null&&n.match(/[a-z]/))?(s+=o[c],l=!0):s+=`${o[c]}${o[c].toUpperCase()}`;continue}}else if(o[c].match(/[a-z]/)){s+=`[${o[c]}${o[c].toUpperCase()}]`;continue}}if(r.m){if(o[c]==="^"){s+=`(^|(?<=[\r
50
+ ]))`;continue}else if(o[c]==="$"){s+=`($|(?=[\r
51
+ ]))`;continue}}if(r.s&&o[c]==="."){s+=a?`${o[c]}\r
52
+ `:`[${o[c]}\r
53
+ ]`;continue}s+=o[c],o[c]==="\\"?i=!0:a&&o[c]==="]"?a=!1:!a&&o[c]==="["&&(a=!0)}try{new RegExp(s)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return s}function gp(e,t){var n,r,o,s,i,a;const l={type:"object",additionalProperties:(n=je(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?n:t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)===xe.ZodString&&((o=e.keyType._def.checks)!=null&&o.length)){const{type:c,...u}=hp(e.keyType._def,t);return{...l,propertyNames:u}}else{if(((s=e.keyType)==null?void 0:s._def.typeName)===xe.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===xe.ZodBranded&&e.keyType._def.type._def.typeName===xe.ZodString&&((a=e.keyType._def.type._def.checks)!=null&&a.length)){const{type:c,...u}=pp(e.keyType._def,t);return{...l,propertyNames:u}}}return l}function GE(e,t){if(t.mapStrategy==="record")return gp(e,t);const n=je(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Nt(),r=je(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Nt();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function qE(e){const t=e.values,r=Object.keys(e.values).filter(s=>typeof t[t[s]]!="number").map(s=>t[s]),o=Array.from(new Set(r.map(s=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:r}}function YE(){return{not:Nt()}}function KE(){return{type:"null"}}var ga={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function JE(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in ga&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((o,s)=>{const i=ga[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((o,s)=>{const i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];default:return o}},[]);if(r.length===n.length){const o=r.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:n.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,o)=>[...r,...o._def.values.filter(s=>!r.includes(s))],[])};return XE(e,t)}var XE=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,o)=>je(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter(r=>!!r&&(!t.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function QE(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[ga[e.innerType._def.typeName],"null"]};const n=je(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function eS(e){const t={type:"number"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"int":t.type="integer";break;case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value;break}return t}function tS(e,t){const n={type:"object",properties:{}},r=[],o=e.shape();for(const i in o){let a=o[i];if(a===void 0||a._def===void 0)continue;const l=rS(a),c=je(a._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});c!==void 0&&(n.properties[i]=c,l||r.push(i))}r.length&&(n.required=r);const s=nS(e,t);return s!==void 0&&(n.additionalProperties=s),n}function nS(e,t){if(e.catchall._def.typeName!=="ZodNever")return je(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function rS(e){try{return e.isOptional()}catch{return!0}}var oS=(e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return je(e.innerType._def,t);const r=je(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Nt()},r]}:Nt()},sS=(e,t)=>{if(t.pipeStrategy==="input")return je(e.in._def,t);if(t.pipeStrategy==="output")return je(e.out._def,t);const n=je(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=je(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(o=>o!==void 0)}};function iS(e,t){return je(e.type._def,t)}function aS(e,t){const r={type:"array",uniqueItems:!0,items:je(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}function cS(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>je(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:je(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>je(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function lS(){return{not:Nt()}}function uS(){return Nt()}var dS=(e,t)=>je(e.innerType._def,t),fS=(e,t,n)=>{switch(t){case xe.ZodString:return hp(e,n);case xe.ZodNumber:return eS(e);case xe.ZodObject:return tS(e,n);case xe.ZodBigInt:return jE(e);case xe.ZodBoolean:return DE();case xe.ZodDate:return mp(e,n);case xe.ZodUndefined:return lS();case xe.ZodNull:return KE();case xe.ZodArray:return NE(e,n);case xe.ZodUnion:case xe.ZodDiscriminatedUnion:return JE(e,n);case xe.ZodIntersection:return ZE(e,n);case xe.ZodTuple:return cS(e,n);case xe.ZodRecord:return gp(e,n);case xe.ZodLiteral:return UE(e);case xe.ZodEnum:return BE(e);case xe.ZodNativeEnum:return qE(e);case xe.ZodNullable:return QE(e,n);case xe.ZodOptional:return oS(e,n);case xe.ZodMap:return GE(e,n);case xe.ZodSet:return aS(e,n);case xe.ZodLazy:return()=>e.getter()._def;case xe.ZodPromise:return iS(e,n);case xe.ZodNaN:case xe.ZodNever:return YE();case xe.ZodEffects:return FE(e,n);case xe.ZodAny:return Nt();case xe.ZodUnknown:return uS();case xe.ZodDefault:return $E(e,n);case xe.ZodBranded:return pp(e,n);case xe.ZodReadonly:return dS(e,n);case xe.ZodCatch:return zE(e,n);case xe.ZodPipeline:return sS(e,n);case xe.ZodFunction:case xe.ZodVoid:case xe.ZodSymbol:return;default:return(r=>{})()}},pS=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};function je(e,t,n=!1){var r;const o=t.seen.get(e);if(t.override){const l=(r=t.override)==null?void 0:r.call(t,e,t,o,n);if(l!==OE)return l}if(o&&!n){const l=mS(o,t);if(l!==void 0)return l}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=fS(e,e.typeName,t),a=typeof i=="function"?je(i(),t):i;if(a&&hS(e,t,a),t.postProcess){const l=t.postProcess(a,e,t);return s.jsonSchema=a,l}return s.jsonSchema=a,a}var mS=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:pS(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,r)=>t.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Nt()):t.$refStrategy==="seen"?Nt():void 0}},hS=(e,t,n)=>(e.description&&(n.description=e.description),n),gS=e=>{const t=ME(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}},vS=(e,t)=>{var n;const r=gS(t);let o=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[u,d])=>{var h;return{...c,[u]:(h=je(d._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0))!=null?h:Nt()}},{}):void 0;const s=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(n=je(e._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1))!=null?n:Nt(),a=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;a!==void 0&&(i.title=a);const l=s===void 0?o?{...i,[r.definitionPath]:o}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...o,[s]:i}};return l.$schema="http://json-schema.org/draft-07/schema#",l},va=Symbol.for("vercel.ai.schema");function bS(e){let t;return()=>(t==null&&(t=e()),t)}function Hs(e,{validate:t}={}){return{[va]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function yS(e){return typeof e=="object"&&e!==null&&va in e&&e[va]===!0&&"jsonSchema"in e&&"validate"in e}function oc(e){return e==null?Hs({properties:{},additionalProperties:!1}):yS(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?vp(e):xS(e):e()}function xS(e){return Hs(()=>rc(e["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async t=>{const n=await e["~standard"].validate(t);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new vr({value:t,cause:n.issues})}}})}function wS(e,t){var n;const r=(n=void 0)!=null?n:!1;return Hs(()=>vS(e,{$refStrategy:r?"root":"none"}),{validate:async o=>{const s=await e.safeParseAsync(o);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function ES(e,t){var n;const r=(n=void 0)!=null?n:!1;return Hs(()=>rc(iw(e,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async o=>{const s=await rp(e,o);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function SS(e){return"_zod"in e}function vp(e,t){return SS(e)?ES(e):wS(e)}async function Fl({value:e,schema:t,context:n}){const r=await co({value:e,schema:t,context:n});if(!r.success)throw vr.wrap({value:e,cause:r.error,context:n});return r.value}async function co({value:e,schema:t,context:n}){const r=oc(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};const o=await r.validate(e);return o.success?{success:!0,value:o.value,rawValue:e}:{success:!1,error:vr.wrap({value:e,cause:o.error,context:n}),rawValue:e}}catch(o){return{success:!1,error:vr.wrap({value:e,cause:o,context:n}),rawValue:e}}}async function Un({text:e,schema:t}){try{const n=AE(e);return t==null?{success:!0,value:n,rawValue:n}:await co({value:n,schema:t})}catch(n){return{success:!1,error:il.isInstance(n)?n:new il({text:e,cause:n}),rawValue:void 0}}}function kS({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new RE).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await Un({text:n,schema:t}))}}))}async function bn(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var CS=Object.defineProperty,RS=(e,t)=>{for(var n in t)CS(e,n,{get:t[n],enumerable:!0})},bp="AI_NoObjectGeneratedError",yp=`vercel.ai.error.${bp}`,TS=Symbol.for(yp),xp,En=class extends an{constructor({message:e="No object generated.",cause:t,text:n,response:r,usage:o,finishReason:s}){super({name:bp,message:e,cause:t}),this[xp]=!0,this.text=n,this.response=r,this.usage=o,this.finishReason=s}static isInstance(e){return an.hasMarker(e,yp)}};xp=TS;var wp="AI_UIMessageStreamError",Ep=`vercel.ai.error.${wp}`,_S=Symbol.for(Ep),Sp,rr=class extends an{constructor({chunkType:e,chunkId:t,message:n}){super({name:wp,message:n}),this[Sp]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return an.hasMarker(e,Ep)}};Sp=_S;var kp=wt([G(),Es(Uint8Array),Es(ArrayBuffer),fp(e=>{var t,n;return(n=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?n:!1},{message:"Must be a Buffer"})]),lo=wE(()=>wt([Yw(),G(),Ww(),gt(),io(G(),lo.optional()),Tr(lo)])),_e=io(G(),io(G(),lo.optional())),Cp=Le({type:me("text"),text:G(),providerOptions:_e.optional()}),PS=Le({type:me("image"),image:wt([kp,Es(URL)]),mediaType:G().optional(),providerOptions:_e.optional()}),Rp=Le({type:me("file"),data:wt([kp,Es(URL)]),filename:G().optional(),mediaType:G(),providerOptions:_e.optional()}),IS=Le({type:me("reasoning"),text:G(),providerOptions:_e.optional()}),AS=Le({type:me("tool-call"),toolCallId:G(),toolName:G(),input:tn(),providerOptions:_e.optional(),providerExecuted:gt().optional()}),OS=eE("type",[Le({type:me("text"),value:G(),providerOptions:_e.optional()}),Le({type:me("json"),value:lo,providerOptions:_e.optional()}),Le({type:me("execution-denied"),reason:G().optional(),providerOptions:_e.optional()}),Le({type:me("error-text"),value:G(),providerOptions:_e.optional()}),Le({type:me("error-json"),value:lo,providerOptions:_e.optional()}),Le({type:me("content"),value:Tr(wt([Le({type:me("text"),text:G(),providerOptions:_e.optional()}),Le({type:me("media"),data:G(),mediaType:G()}),Le({type:me("file-data"),data:G(),mediaType:G(),filename:G().optional(),providerOptions:_e.optional()}),Le({type:me("file-url"),url:G(),providerOptions:_e.optional()}),Le({type:me("file-id"),fileId:wt([G(),io(G(),G())]),providerOptions:_e.optional()}),Le({type:me("image-data"),data:G(),mediaType:G(),providerOptions:_e.optional()}),Le({type:me("image-url"),url:G(),providerOptions:_e.optional()}),Le({type:me("image-file-id"),fileId:wt([G(),io(G(),G())]),providerOptions:_e.optional()}),Le({type:me("custom"),providerOptions:_e.optional()})]))})]),Tp=Le({type:me("tool-result"),toolCallId:G(),toolName:G(),output:OS,providerOptions:_e.optional()}),MS=Le({type:me("tool-approval-request"),approvalId:G(),toolCallId:G()}),NS=Le({type:me("tool-approval-response"),approvalId:G(),approved:gt(),reason:G().optional()}),jS=Le({role:me("system"),content:G(),providerOptions:_e.optional()}),DS=Le({role:me("user"),content:wt([G(),Tr(wt([Cp,PS,Rp]))]),providerOptions:_e.optional()}),zS=Le({role:me("assistant"),content:wt([G(),Tr(wt([Cp,Rp,IS,AS,Tp,MS]))]),providerOptions:_e.optional()}),LS=Le({role:me("tool"),content:Tr(wt([Tp,NS])),providerOptions:_e.optional()});wt([jS,DS,zS,LS]);function _p(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;const n={...e};for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const o=t[r];if(o===void 0)continue;const s=r in e?e[r]:void 0,i=o!==null&&typeof o=="object"&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp),a=s!=null&&typeof s=="object"&&!Array.isArray(s)&&!(s instanceof Date)&&!(s instanceof RegExp);i&&a?n[r]=_p(s,o):n[r]=o}return n}var $S={};RS($S,{array:()=>ZS,choice:()=>US,json:()=>WS,object:()=>VS,text:()=>BS});function FS(e){const t=["ROOT"];let n=-1,r=null;function o(l,c,u){switch(l){case'"':{n=c,t.pop(),t.push(u),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=c,r=c,t.pop(),t.push(u),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(u),t.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=c,t.pop(),t.push(u),t.push("INSIDE_NUMBER");break}case"{":{n=c,t.pop(),t.push(u),t.push("INSIDE_OBJECT_START");break}case"[":{n=c,t.pop(),t.push(u),t.push("INSIDE_ARRAY_START");break}}}function s(l,c){switch(l){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=c,t.pop();break}}}function i(l,c){switch(l){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=c,t.pop();break}}}for(let l=0;l<e.length;l++){const c=e[l];switch(t[t.length-1]){case"ROOT":o(c,l,"FINISH");break;case"INSIDE_OBJECT_START":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{n=l,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{c==='"'&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{c==='"'&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{c===":"&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{o(c,l,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{s(c,l);break}case"INSIDE_STRING":{switch(c){case'"':{t.pop(),n=l;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:n=l}break}case"INSIDE_ARRAY_START":{c==="]"?(n=l,t.pop()):(n=l,o(c,l,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(c){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=l,t.pop();break}default:{n=l;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{o(c,l,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),n=l;break}case"INSIDE_NUMBER":{switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=l;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,l),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&s(c,l);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&s(c,l);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,l);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const d=e.substring(r,l+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?s(c,l):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,l)):n=l;break}}}let a=e.slice(0,n+1);for(let l=t.length-1;l>=0;l--)switch(t[l]){case"INSIDE_STRING":{a+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{a+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{a+="]";break}case"INSIDE_LITERAL":{const u=e.substring(r,e.length);"true".startsWith(u)?a+="true".slice(u.length):"false".startsWith(u)?a+="false".slice(u.length):"null".startsWith(u)&&(a+="null".slice(u.length))}}return a}async function yo(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await Un({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await Un({text:FS(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var BS=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),VS=({schema:e,name:t,description:n})=>{const r=oc(e);return{name:"object",responseFormat:bn(r.jsonSchema).then(o=>({type:"json",schema:o,...t!=null&&{name:t},...n!=null&&{description:n}})),async parseCompleteOutput({text:o},s){const i=await Un({text:o});if(!i.success)throw new En({message:"No object generated: could not parse the response.",cause:i.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});const a=await co({value:i.value,schema:r});if(!a.success)throw new En({message:"No object generated: response did not match schema.",cause:a.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});return a.value},async parsePartialOutput({text:o}){const s=await yo(o);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:s.value}}},createElementStreamTransform(){}}},ZS=({element:e,name:t,description:n})=>{const r=oc(e);return{name:"array",responseFormat:bn(r.jsonSchema).then(o=>{const{$schema:s,...i}=o;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:i}},required:["elements"],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}}),async parseCompleteOutput({text:o},s){const i=await Un({text:o});if(!i.success)throw new En({message:"No object generated: could not parse the response.",cause:i.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});const a=i.value;if(a==null||typeof a!="object"||!("elements"in a)||!Array.isArray(a.elements))throw new En({message:"No object generated: response did not match schema.",cause:new vr({value:a,cause:"response must be an object with an elements array"}),text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});for(const l of a.elements){const c=await co({value:l,schema:r});if(!c.success)throw new En({message:"No object generated: response did not match schema.",cause:c.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason})}return a.elements},async parsePartialOutput({text:o}){const s=await yo(o);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const i=s.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))return;const a=s.state==="repaired-parse"&&i.elements.length>0?i.elements.slice(0,-1):i.elements,l=[];for(const c of a){const u=await co({value:c,schema:r});u.success&&l.push(u.value)}return{partial:l}}}},createElementStreamTransform(){let o=0;return new TransformStream({transform({partialOutput:s},i){if(s!=null)for(;o<s.length;o++)i.enqueue(s[o])}})}}},US=({options:e,name:t,description:n})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}),async parseCompleteOutput({text:r},o){const s=await Un({text:r});if(!s.success)throw new En({message:"No object generated: could not parse the response.",cause:s.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});const i=s.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string"||!e.includes(i.result))throw new En({message:"No object generated: response did not match schema.",cause:new vr({value:i,cause:"response must be an object that contains a choice value."}),text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});return i.result},async parsePartialOutput({text:r}){const o=await yo(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const s=o.value;if(s==null||typeof s!="object"||!("result"in s)||typeof s.result!="string")return;const i=e.filter(a=>a.startsWith(s.result));return o.state==="successful-parse"?i.includes(s.result)?{partial:s.result}:void 0:i.length===1?{partial:i[0]}:void 0}}},createElementStreamTransform(){}}),WS=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:n},r){const o=await Un({text:n});if(!o.success)throw new En({message:"No object generated: could not parse the response.",cause:o.error,text:n,response:r.response,usage:r.usage,finishReason:r.finishReason});return o.value},async parsePartialOutput({text:n}){const r=await yo(n);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return r.value===void 0?void 0:{partial:r.value}}},createElementStreamTransform(){}});bo({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
54
+
55
+ `)},flush(e){e.enqueue(`data: [DONE]
56
+
57
+ `)}})}});var HS=bS(()=>vp(wt([Fe({type:me("text-start"),id:G(),providerMetadata:_e.optional()}),Fe({type:me("text-delta"),id:G(),delta:G(),providerMetadata:_e.optional()}),Fe({type:me("text-end"),id:G(),providerMetadata:_e.optional()}),Fe({type:me("error"),errorText:G()}),Fe({type:me("tool-input-start"),toolCallId:G(),toolName:G(),providerExecuted:gt().optional(),providerMetadata:_e.optional(),dynamic:gt().optional(),title:G().optional()}),Fe({type:me("tool-input-delta"),toolCallId:G(),inputTextDelta:G()}),Fe({type:me("tool-input-available"),toolCallId:G(),toolName:G(),input:tn(),providerExecuted:gt().optional(),providerMetadata:_e.optional(),dynamic:gt().optional(),title:G().optional()}),Fe({type:me("tool-input-error"),toolCallId:G(),toolName:G(),input:tn(),providerExecuted:gt().optional(),providerMetadata:_e.optional(),dynamic:gt().optional(),errorText:G(),title:G().optional()}),Fe({type:me("tool-approval-request"),approvalId:G(),toolCallId:G()}),Fe({type:me("tool-output-available"),toolCallId:G(),output:tn(),providerExecuted:gt().optional(),providerMetadata:_e.optional(),dynamic:gt().optional(),preliminary:gt().optional()}),Fe({type:me("tool-output-error"),toolCallId:G(),errorText:G(),providerExecuted:gt().optional(),providerMetadata:_e.optional(),dynamic:gt().optional()}),Fe({type:me("tool-output-denied"),toolCallId:G()}),Fe({type:me("reasoning-start"),id:G(),providerMetadata:_e.optional()}),Fe({type:me("reasoning-delta"),id:G(),delta:G(),providerMetadata:_e.optional()}),Fe({type:me("reasoning-end"),id:G(),providerMetadata:_e.optional()}),Fe({type:me("source-url"),sourceId:G(),url:G(),title:G().optional(),providerMetadata:_e.optional()}),Fe({type:me("source-document"),sourceId:G(),mediaType:G(),title:G(),filename:G().optional(),providerMetadata:_e.optional()}),Fe({type:me("file"),url:G(),mediaType:G(),providerMetadata:_e.optional()}),Fe({type:fp(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:G().optional(),data:tn(),transient:gt().optional()}),Fe({type:me("start-step")}),Fe({type:me("finish-step")}),Fe({type:me("start"),messageId:G().optional(),messageMetadata:tn().optional()}),Fe({type:me("finish"),finishReason:lp(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:tn().optional()}),Fe({type:me("abort"),reason:G().optional()}),Fe({type:me("message-metadata"),messageMetadata:tn()})])));function GS(e){return e.type.startsWith("data-")}function ba(e){return e.type.startsWith("tool-")}function Pp(e){return e.type==="dynamic-tool"}function uo(e){return ba(e)||Pp(e)}function ya(e){return e.type.split("-").slice(1).join("-")}function qS(e){return Pp(e)?e.toolName:ya(e)}function YS({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function KS({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:r,onError:o,onToolCall:s,onData:i}){return e.pipeThrough(new TransformStream({async transform(a,l){await r(async({state:c,write:u})=>{var d,h,p,b;function x(v){const S=c.message.parts.filter(uo).find(k=>k.toolCallId===v);if(S==null)throw new rr({chunkType:"tool-invocation",chunkId:v,message:`No tool invocation found for tool call ID "${v}".`});return S}function E(v){var w;const S=c.message.parts.find(C=>ba(C)&&C.toolCallId===v.toolCallId),k=v,R=S;if(S!=null){S.state=v.state,R.input=k.input,R.output=k.output,R.errorText=k.errorText,R.rawInput=k.rawInput,R.preliminary=k.preliminary,v.title!==void 0&&(R.title=v.title),R.providerExecuted=(w=k.providerExecuted)!=null?w:S.providerExecuted;const C=k.providerMetadata;if(C!=null)if(v.state==="output-available"||v.state==="output-error"){const _=S;_.resultProviderMetadata=C}else S.callProviderMetadata=C}else c.message.parts.push({type:`tool-${v.toolName}`,toolCallId:v.toolCallId,state:v.state,title:v.title,input:k.input,output:k.output,rawInput:k.rawInput,errorText:k.errorText,providerExecuted:k.providerExecuted,preliminary:k.preliminary,...k.providerMetadata!=null&&(v.state==="output-available"||v.state==="output-error")?{resultProviderMetadata:k.providerMetadata}:{},...k.providerMetadata!=null&&!(v.state==="output-available"||v.state==="output-error")?{callProviderMetadata:k.providerMetadata}:{}})}function y(v){var w,S;const k=c.message.parts.find(_=>_.type==="dynamic-tool"&&_.toolCallId===v.toolCallId),R=v,C=k;if(k!=null){k.state=v.state,C.toolName=v.toolName,C.input=R.input,C.output=R.output,C.errorText=R.errorText,C.rawInput=(w=R.rawInput)!=null?w:C.rawInput,C.preliminary=R.preliminary,v.title!==void 0&&(C.title=v.title),C.providerExecuted=(S=R.providerExecuted)!=null?S:k.providerExecuted;const _=R.providerMetadata;if(_!=null)if(v.state==="output-available"||v.state==="output-error"){const I=k;I.resultProviderMetadata=_}else k.callProviderMetadata=_}else c.message.parts.push({type:"dynamic-tool",toolName:v.toolName,toolCallId:v.toolCallId,state:v.state,input:R.input,output:R.output,errorText:R.errorText,preliminary:R.preliminary,providerExecuted:R.providerExecuted,title:v.title,...R.providerMetadata!=null&&(v.state==="output-available"||v.state==="output-error")?{resultProviderMetadata:R.providerMetadata}:{},...R.providerMetadata!=null&&!(v.state==="output-available"||v.state==="output-error")?{callProviderMetadata:R.providerMetadata}:{}})}async function g(v){if(v!=null){const w=c.message.metadata!=null?_p(c.message.metadata,v):v;t!=null&&await Fl({value:w,schema:t,context:{field:"message.metadata",entityId:c.message.id}}),c.message.metadata=w}}switch(a.type){case"text-start":{const v={type:"text",text:"",providerMetadata:a.providerMetadata,state:"streaming"};c.activeTextParts[a.id]=v,c.message.parts.push(v),u();break}case"text-delta":{const v=c.activeTextParts[a.id];if(v==null)throw new rr({chunkType:"text-delta",chunkId:a.id,message:`Received text-delta for missing text part with ID "${a.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});v.text+=a.delta,v.providerMetadata=(d=a.providerMetadata)!=null?d:v.providerMetadata,u();break}case"text-end":{const v=c.activeTextParts[a.id];if(v==null)throw new rr({chunkType:"text-end",chunkId:a.id,message:`Received text-end for missing text part with ID "${a.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});v.state="done",v.providerMetadata=(h=a.providerMetadata)!=null?h:v.providerMetadata,delete c.activeTextParts[a.id],u();break}case"reasoning-start":{const v={type:"reasoning",text:"",providerMetadata:a.providerMetadata,state:"streaming"};c.activeReasoningParts[a.id]=v,c.message.parts.push(v),u();break}case"reasoning-delta":{const v=c.activeReasoningParts[a.id];if(v==null)throw new rr({chunkType:"reasoning-delta",chunkId:a.id,message:`Received reasoning-delta for missing reasoning part with ID "${a.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});v.text+=a.delta,v.providerMetadata=(p=a.providerMetadata)!=null?p:v.providerMetadata,u();break}case"reasoning-end":{const v=c.activeReasoningParts[a.id];if(v==null)throw new rr({chunkType:"reasoning-end",chunkId:a.id,message:`Received reasoning-end for missing reasoning part with ID "${a.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});v.providerMetadata=(b=a.providerMetadata)!=null?b:v.providerMetadata,v.state="done",delete c.activeReasoningParts[a.id],u();break}case"file":{c.message.parts.push({type:"file",mediaType:a.mediaType,url:a.url,...a.providerMetadata!=null?{providerMetadata:a.providerMetadata}:{}}),u();break}case"source-url":{c.message.parts.push({type:"source-url",sourceId:a.sourceId,url:a.url,title:a.title,providerMetadata:a.providerMetadata}),u();break}case"source-document":{c.message.parts.push({type:"source-document",sourceId:a.sourceId,mediaType:a.mediaType,title:a.title,filename:a.filename,providerMetadata:a.providerMetadata}),u();break}case"tool-input-start":{const v=c.message.parts.filter(ba);c.partialToolCalls[a.toolCallId]={text:"",toolName:a.toolName,index:v.length,dynamic:a.dynamic,title:a.title},a.dynamic?y({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-streaming",input:void 0,providerExecuted:a.providerExecuted,title:a.title,providerMetadata:a.providerMetadata}):E({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-streaming",input:void 0,providerExecuted:a.providerExecuted,title:a.title,providerMetadata:a.providerMetadata}),u();break}case"tool-input-delta":{const v=c.partialToolCalls[a.toolCallId];if(v==null)throw new rr({chunkType:"tool-input-delta",chunkId:a.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${a.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});v.text+=a.inputTextDelta;const{value:w}=await yo(v.text);v.dynamic?y({toolCallId:a.toolCallId,toolName:v.toolName,state:"input-streaming",input:w,title:v.title}):E({toolCallId:a.toolCallId,toolName:v.toolName,state:"input-streaming",input:w,title:v.title}),u();break}case"tool-input-available":{a.dynamic?y({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-available",input:a.input,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:a.title}):E({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-available",input:a.input,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:a.title}),u(),s&&!a.providerExecuted&&await s({toolCall:a});break}case"tool-input-error":{const v=c.message.parts.filter(uo).find(S=>S.toolCallId===a.toolCallId);(v!=null?v.type==="dynamic-tool":!!a.dynamic)?y({toolCallId:a.toolCallId,toolName:a.toolName,state:"output-error",input:a.input,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata}):E({toolCallId:a.toolCallId,toolName:a.toolName,state:"output-error",input:void 0,rawInput:a.input,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata}),u();break}case"tool-approval-request":{const v=x(a.toolCallId);v.state="approval-requested",v.approval={id:a.approvalId},u();break}case"tool-output-denied":{const v=x(a.toolCallId);v.state="output-denied",u();break}case"tool-output-available":{const v=x(a.toolCallId);v.type==="dynamic-tool"?y({toolCallId:a.toolCallId,toolName:v.toolName,state:"output-available",input:v.input,output:a.output,preliminary:a.preliminary,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:v.title}):E({toolCallId:a.toolCallId,toolName:ya(v),state:"output-available",input:v.input,output:a.output,providerExecuted:a.providerExecuted,preliminary:a.preliminary,providerMetadata:a.providerMetadata,title:v.title}),u();break}case"tool-output-error":{const v=x(a.toolCallId);v.type==="dynamic-tool"?y({toolCallId:a.toolCallId,toolName:v.toolName,state:"output-error",input:v.input,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:v.title}):E({toolCallId:a.toolCallId,toolName:ya(v),state:"output-error",input:v.input,rawInput:v.rawInput,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:v.title}),u();break}case"start-step":{c.message.parts.push({type:"step-start"});break}case"finish-step":{c.activeTextParts={},c.activeReasoningParts={};break}case"start":{a.messageId!=null&&(c.message.id=a.messageId),await g(a.messageMetadata),(a.messageId!=null||a.messageMetadata!=null)&&u();break}case"finish":{a.finishReason!=null&&(c.finishReason=a.finishReason),await g(a.messageMetadata),a.messageMetadata!=null&&u();break}case"message-metadata":{await g(a.messageMetadata),a.messageMetadata!=null&&u();break}case"error":{o?.(new Error(a.errorText));break}default:if(GS(a)){if(n?.[a.type]!=null){const S=c.message.parts.findIndex(R=>"id"in R&&"data"in R&&R.id===a.id&&R.type===a.type),k=S>=0?S:c.message.parts.length;await Fl({value:a.data,schema:n[a.type],context:{field:`message.parts[${k}].data`,entityName:a.type,entityId:a.id}})}const v=a;if(v.transient){i?.(v);break}const w=v.id!=null?c.message.parts.find(S=>v.type===S.type&&v.id===S.id):void 0;w!=null?w.data=v.data:c.message.parts.push(v),i?.(v),u()}}l.enqueue(a)})}}))}async function JS({stream:e,onError:t}){const n=e.getReader();try{for(;;){const{done:r}=await n.read();if(r)break}}catch(r){t?.(r)}finally{n.releaseLock()}}bo({prefix:"aitxt",size:24});bo({prefix:"aiobj",size:24});var XS=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,n)=>{this.queue.push(async()=>{try{await e(),t()}catch(r){n(r)}}),this.processQueue()})}};bo({prefix:"aiobj",size:24});async function QS(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map(async t=>{const{name:n,type:r}=t,o=await new Promise((s,i)=>{const a=new FileReader;a.onload=l=>{var c;s((c=l.target)==null?void 0:c.result)},a.onerror=l=>i(l),a.readAsDataURL(t)});return{type:"file",mediaType:r,filename:n,url:o}}))}var ek=class{constructor({api:e="/api/chat",credentials:t,headers:n,body:r,fetch:o,prepareSendMessagesRequest:s,prepareReconnectToStreamRequest:i}){this.api=e,this.credentials=t,this.headers=n,this.body=r,this.fetch=o,this.prepareSendMessagesRequest=s,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:e,...t}){var n,r,o,s,i;const a=await bn(this.body),l=await bn(this.headers),c=await bn(this.credentials),u={...nr(l),...nr(t.headers)},d=await((n=this.prepareSendMessagesRequest)==null?void 0:n.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...a,...t.body},headers:u,credentials:c,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),h=(r=d?.api)!=null?r:this.api,p=d?.headers!==void 0?nr(d.headers):u,b=d?.body!==void 0?d.body:{...a,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},x=(o=d?.credentials)!=null?o:c,y=await((s=this.fetch)!=null?s:globalThis.fetch)(h,{method:"POST",headers:{"Content-Type":"application/json",...p},body:JSON.stringify(b),credentials:x,signal:e});if(!y.ok)throw new Error((i=await y.text())!=null?i:"Failed to fetch the chat response.");if(!y.body)throw new Error("The response body is empty.");return this.processResponseStream(y.body)}async reconnectToStream(e){var t,n,r,o,s;const i=await bn(this.body),a=await bn(this.headers),l=await bn(this.credentials),c={...nr(a),...nr(e.headers)},u=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...i,...e.body},headers:c,credentials:l,requestMetadata:e.metadata})),d=(n=u?.api)!=null?n:`${this.api}/${e.chatId}/stream`,h=u?.headers!==void 0?nr(u.headers):c,p=(r=u?.credentials)!=null?r:l,x=await((o=this.fetch)!=null?o:globalThis.fetch)(d,{method:"GET",headers:h,credentials:p});if(x.status===204)return null;if(!x.ok)throw new Error((s=await x.text())!=null?s:"Failed to fetch the chat response.");if(!x.body)throw new Error("The response body is empty.");return this.processResponseStream(x.body)}},Ip=class extends ek{constructor(e={}){super(e)}processResponseStream(e){return kS({stream:e,schema:HS}).pipeThrough(new TransformStream({async transform(t,n){if(!t.success)throw t.error;n.enqueue(t.value)}}))}},tk=class{constructor({generateId:e=TE,id:t=e(),transport:n=new Ip,messageMetadataSchema:r,dataPartSchemas:o,state:s,onError:i,onToolCall:a,onFinish:l,onData:c,sendAutomaticallyWhen:u}){this.activeResponse=void 0,this.jobExecutor=new XS,this.sendMessage=async(d,h)=>{var p,b,x,E;if(d==null){await this.makeRequest({trigger:"submit-message",messageId:(p=this.lastMessage)==null?void 0:p.id,...h});return}let y;if("text"in d||"files"in d?y={parts:[...Array.isArray(d.files)?d.files:await QS(d.files),..."text"in d&&d.text!=null?[{type:"text",text:d.text}]:[]]}:y=d,d.messageId!=null){const g=this.state.messages.findIndex(v=>v.id===d.messageId);if(g===-1)throw new Error(`message with id ${d.messageId} not found`);if(this.state.messages[g].role!=="user")throw new Error(`message with id ${d.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,g+1),this.state.replaceMessage(g,{...y,id:d.messageId,role:(b=y.role)!=null?b:"user",metadata:d.metadata})}else this.state.pushMessage({...y,id:(x=y.id)!=null?x:this.generateId(),role:(E=y.role)!=null?E:"user",metadata:d.metadata});await this.makeRequest({trigger:"submit-message",messageId:d.messageId,...h})},this.regenerate=async({messageId:d,...h}={})=>{const p=d==null?this.state.messages.length-1:this.state.messages.findIndex(b=>b.id===d);if(p===-1)throw new Error(`message ${d} not found`);this.state.messages=this.state.messages.slice(0,this.messages[p].role==="assistant"?p:p+1),await this.makeRequest({trigger:"regenerate-message",messageId:d,...h})},this.resumeStream=async(d={})=>{await this.makeRequest({trigger:"resume-stream",...d})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:d,approved:h,reason:p,options:b})=>this.jobExecutor.run(async()=>{const x=this.state.messages,E=x[x.length-1],y=g=>uo(g)&&g.state==="approval-requested"&&g.approval.id===d?{...g,state:"approval-responded",approval:{id:d,approved:h,reason:p}}:g;this.state.replaceMessage(x.length-1,{...E,parts:E.parts.map(y)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(y)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(g=>{var v;g&&this.makeRequest({trigger:"submit-message",messageId:(v=this.lastMessage)==null?void 0:v.id,...b})})}),this.addToolOutput=async({state:d="output-available",toolCallId:h,output:p,errorText:b,options:x})=>this.jobExecutor.run(async()=>{const E=this.state.messages,y=E[E.length-1],g=v=>uo(v)&&v.toolCallId===h?{...v,state:d,output:p,errorText:b}:v;this.state.replaceMessage(E.length-1,{...y,parts:y.parts.map(g)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(g)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(v=>{var w;v&&this.makeRequest({trigger:"submit-message",messageId:(w=this.lastMessage)==null?void 0:w.id,...x})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var d;this.status!=="streaming"&&this.status!=="submitted"||(d=this.activeResponse)!=null&&d.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=r,this.dataPartSchemas=o,this.state=s,this.onError=i,this.onToolCall=a,this.onFinish=l,this.onData=c,this.sendAutomaticallyWhen=u}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;const e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e=="object"&&"then"in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:n,body:r,messageId:o}){var s,i,a;let l;if(e==="resume-stream")try{const p=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:n,body:r});if(p==null)return;l=p}catch(p){this.onError&&p instanceof Error&&this.onError(p),this.setStatus({status:"error",error:p});return}this.setStatus({status:"submitted",error:void 0});const c=this.lastMessage;let u=!1,d=!1,h=!1;try{const p={state:YS({lastMessage:this.state.snapshot(c),messageId:this.generateId()}),abortController:new AbortController};p.abortController.signal.addEventListener("abort",()=>{u=!0}),this.activeResponse=p;let b;e==="resume-stream"?b=l:b=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:p.abortController.signal,metadata:t,headers:n,body:r,trigger:e,messageId:o});const x=E=>this.jobExecutor.run(()=>E({state:p.state,write:()=>{var y;this.setStatus({status:"streaming"}),p.state.message.id===((y=this.lastMessage)==null?void 0:y.id)?this.state.replaceMessage(this.state.messages.length-1,p.state.message):this.state.pushMessage(p.state.message)}}));await JS({stream:KS({stream:b,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:x,onError:E=>{throw E}}),onError:E=>{throw E}}),this.setStatus({status:"ready"})}catch(p){if(u||p.name==="AbortError")return u=!0,this.setStatus({status:"ready"}),null;h=!0,p instanceof TypeError&&(p.message.toLowerCase().includes("fetch")||p.message.toLowerCase().includes("network"))&&(d=!0),this.onError&&p instanceof Error&&this.onError(p),this.setStatus({status:"error",error:p})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:u,isDisconnect:d,isError:h,finishReason:(s=this.activeResponse)==null?void 0:s.state.finishReason})}catch(p){console.error(p)}this.activeResponse=void 0}!h&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(a=this.lastMessage)==null?void 0:a.id,metadata:t,headers:n,body:r})}},Oi,Bl;function nk(){if(Bl)return Oi;Bl=1;function e(t,n){if(typeof t!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof t}\`.`);let r,o=0;return function(...i){clearTimeout(r);const a=Date.now(),l=a-o,c=n-l;c<=0?(o=a,t.apply(this,i)):r=setTimeout(()=>{o=Date.now(),t.apply(this,i)},c)}}return Oi=e,Oi}var rk=nk();const ok=bg(rk);var Mi={exports:{}},Ni={};var Vl;function sk(){if(Vl)return Ni;Vl=1;var e=Rd();function t(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(d,h){var p=h(),b=r({inst:{value:p,getSnapshot:h}}),x=b[0].inst,E=b[1];return s(function(){x.value=p,x.getSnapshot=h,l(x)&&E({inst:x})},[d,p,h]),o(function(){return l(x)&&E({inst:x}),d(function(){l(x)&&E({inst:x})})},[d]),i(p),p}function l(d){var h=d.getSnapshot;d=d.value;try{var p=h();return!n(d,p)}catch{return!0}}function c(d,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return Ni.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Ni}var Zl;function Ap(){return Zl||(Zl=1,Mi.exports=sk()),Mi.exports}var ik=Ap(),Op=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Be=(e,t,n)=>(Op(e,t,"read from private field"),n?n.call(e):t.get(e)),Qt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},vn=(e,t,n,r)=>(Op(e,t,"write to private field"),t.set(e,n),n);function ak(e,t){return t!=null?ok(e,t):e}var Lt,es,ts,Vr,Zr,Ur,or,xa,wa,ck=class{constructor(e=[]){Qt(this,Lt,void 0),Qt(this,es,"ready"),Qt(this,ts,void 0),Qt(this,Vr,new Set),Qt(this,Zr,new Set),Qt(this,Ur,new Set),this.pushMessage=t=>{vn(this,Lt,Be(this,Lt).concat(t)),Be(this,or).call(this)},this.popMessage=()=>{vn(this,Lt,Be(this,Lt).slice(0,-1)),Be(this,or).call(this)},this.replaceMessage=(t,n)=>{vn(this,Lt,[...Be(this,Lt).slice(0,t),this.snapshot(n),...Be(this,Lt).slice(t+1)]),Be(this,or).call(this)},this.snapshot=t=>structuredClone(t),this["~registerMessagesCallback"]=(t,n)=>{const r=n?ak(t,n):t;return Be(this,Vr).add(r),()=>{Be(this,Vr).delete(r)}},this["~registerStatusCallback"]=t=>(Be(this,Zr).add(t),()=>{Be(this,Zr).delete(t)}),this["~registerErrorCallback"]=t=>(Be(this,Ur).add(t),()=>{Be(this,Ur).delete(t)}),Qt(this,or,()=>{Be(this,Vr).forEach(t=>t())}),Qt(this,xa,()=>{Be(this,Zr).forEach(t=>t())}),Qt(this,wa,()=>{Be(this,Ur).forEach(t=>t())}),vn(this,Lt,e)}get status(){return Be(this,es)}set status(e){vn(this,es,e),Be(this,xa).call(this)}get error(){return Be(this,ts)}set error(e){vn(this,ts,e),Be(this,wa).call(this)}get messages(){return Be(this,Lt)}set messages(e){vn(this,Lt,[...e]),Be(this,or).call(this)}};Lt=new WeakMap;es=new WeakMap;ts=new WeakMap;Vr=new WeakMap;Zr=new WeakMap;Ur=new WeakMap;or=new WeakMap;xa=new WeakMap;wa=new WeakMap;var sr,Ul=class extends tk{constructor({messages:e,...t}){const n=new ck(e);super({...t,state:n}),Qt(this,sr,void 0),this["~registerMessagesCallback"]=(r,o)=>Be(this,sr)["~registerMessagesCallback"](r,o),this["~registerStatusCallback"]=r=>Be(this,sr)["~registerStatusCallback"](r),this["~registerErrorCallback"]=r=>Be(this,sr)["~registerErrorCallback"](r),vn(this,sr,n)}};sr=new WeakMap;function lk({experimental_throttle:e,resume:t=!1,...n}={}){const r=m.useRef("chat"in n?{}:{onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});"chat"in n||(r.current={onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});const o={...n,onToolCall:h=>{var p,b;return(b=(p=r.current).onToolCall)==null?void 0:b.call(p,h)},onData:h=>{var p,b;return(b=(p=r.current).onData)==null?void 0:b.call(p,h)},onFinish:h=>{var p,b;return(b=(p=r.current).onFinish)==null?void 0:b.call(p,h)},onError:h=>{var p,b;return(b=(p=r.current).onError)==null?void 0:b.call(p,h)},sendAutomaticallyWhen:h=>{var p,b,x;return(x=(b=(p=r.current).sendAutomaticallyWhen)==null?void 0:b.call(p,h))!=null?x:!1}},s=m.useRef("chat"in n?n.chat:new Ul(o));("chat"in n&&n.chat!==s.current||"id"in n&&s.current.id!==n.id)&&(s.current="chat"in n?n.chat:new Ul(o));const a=m.useCallback(h=>s.current["~registerMessagesCallback"](h,e),[e,s.current.id]),l=m.useSyncExternalStore(a,()=>s.current.messages,()=>s.current.messages),c=m.useSyncExternalStore(s.current["~registerStatusCallback"],()=>s.current.status,()=>s.current.status),u=m.useSyncExternalStore(s.current["~registerErrorCallback"],()=>s.current.error,()=>s.current.error),d=m.useCallback(h=>{typeof h=="function"&&(h=h(s.current.messages)),s.current.messages=h},[s]);return m.useEffect(()=>{t&&s.current.resumeStream()},[t,s]),{id:s.current.id,messages:l,setMessages:d,sendMessage:s.current.sendMessage,regenerate:s.current.regenerate,clearError:s.current.clearError,stop:s.current.stop,error:u,resumeStream:s.current.resumeStream,status:c,addToolResult:s.current.addToolOutput,addToolOutput:s.current.addToolOutput,addToolApprovalResponse:s.current.addToolApprovalResponse}}var uk="about:blank";function dk(e){const t={};for(const n of e.attachmentsRef.current??[])if(e.activeAttachmentsRef.current.has(n.label)){const r=n.content();r!==null&&(t[n.label.toLowerCase()]=r)}return{toolset:e.toolsetRef.current,context:{...e.contextRef.current,...t},mode:e.modeRef.current,provider:e.providerRef.current,model:e.modelRef.current}}function fk(e,t){e.current?.(t)}function ji(e,t){e.current?.(t)}function Yr(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function vt(e){return typeof e=="string"&&e.trim()?e:void 0}function pk(e,t){if(!(!t||!Yr(e)||!Array.isArray(e.commands)))return e.commands.find(n=>Yr(n)&&n.id===t)}function mk(e){if(!Yr(e))return{};const t=Yr(e.scope)?e.scope:void 0,n=Yr(e.workspace)?e.workspace:void 0;return{workspaceId:vt(t?.workspaceId)??vt(n?.id),workspaceName:vt(t?.workspaceName)??vt(n?.name)}}function hk(e){const t=e?.parentTraceId;return vt(typeof t=="function"?t():t)}function Di(e){const t=pk(e.context,vt(e.args.commandId)),n=mk(e.context),r=e.trace?.appId??vt(e.args.appId)??vt(e.args.targetAppId)??vt(t?.appId),o=e.trace?.appName??vt(e.args.appName)??vt(e.args.targetAppName)??vt(t?.appName),s=e.trace?.workspaceId??vt(e.args.workspaceId)??n.workspaceId,i=e.trace?.workspaceName??n.workspaceName;Mg({source:e.trace?.source??"useHudsonAI",status:e.status,toolset:e.toolset,chatId:e.chatId,action:e.toolName,commandId:vt(e.args.commandId),appId:r,appName:o,workspaceId:s,workspaceName:i,traceId:e.traceId,parentTraceId:hk(e.trace),args:e.args,error:e.error})}function gk({api:e,toolset:t,chatId:n,initialMessages:r,context:o,onToolCall:s,mode:i,attachments:a,provider:l,model:c,onFinish:u,onError:d,agentTrace:h}){const p=jb(),b=e??p.aiChat,x=m.useRef(s),E=m.useRef(u),y=m.useRef(d),g=m.useRef(h),[v,w]=m.useState(new Set),S=m.useCallback(B=>{w(U=>{const q=new Set(U);return q.has(B)?q.delete(B):q.add(B),q})},[]),[k]=St("hudson.settings",{}),R=i??k.aiMode??"api",C=m.useRef(v),_=m.useRef(a),I=m.useRef(o),M=m.useRef(t),N=m.useRef(R),T=m.useRef(l),F=m.useRef(c);m.useEffect(()=>{x.current=s},[s]),m.useEffect(()=>{E.current=u},[u]),m.useEffect(()=>{y.current=d},[d]),m.useEffect(()=>{g.current=h},[h]),m.useEffect(()=>{C.current=v},[v]),m.useEffect(()=>{_.current=a},[a]),m.useEffect(()=>{I.current=o},[o]),m.useEffect(()=>{M.current=t},[t]),m.useEffect(()=>{N.current=R},[R]),m.useEffect(()=>{T.current=l},[l]),m.useEffect(()=>{F.current=c},[c]);const O=m.useMemo(()=>new Ip({api:b??uk,body:()=>dk({activeAttachmentsRef:C,attachmentsRef:_,contextRef:I,toolsetRef:M,modeRef:N,providerRef:T,modelRef:F})}),[b]),D=m.useCallback(async({toolCall:B})=>{if(!x.current)return;const U=B.input&&typeof B.input=="object"&&!Array.isArray(B.input)?B.input:{},q=Og("tr");try{Di({toolset:M.current,chatId:n,toolName:B.toolName,args:U,context:I.current,trace:g.current,status:"started",traceId:q}),await x.current(B.toolName,U),Di({toolset:M.current,chatId:n,toolName:B.toolName,args:U,context:I.current,trace:g.current,status:"completed",traceId:q})}catch(he){const ee=he instanceof Error?he:new Error(String(he));throw Di({toolset:M.current,chatId:n,toolName:B.toolName,args:U,context:I.current,trace:g.current,status:"failed",traceId:q,error:ee}),ji(y,ee),ee}},[n]),z=lk({id:n,messages:r,transport:O,onToolCall:D,onFinish:B=>fk(E,B),onError:B=>ji(y,B)}),A=m.useCallback(()=>{z.setMessages([])},[z]),Z=m.useCallback((...B)=>{if(b)return z.sendMessage(...B);const U=new Error("Hudson AI is not configured for this host. Provide useHudsonAI({ api }) or WorkspaceShell environment.routes.aiChat.");return ji(y,U),Promise.reject(U)},[z,b]),{messages:P}=z;return{messages:P,sendMessage:Z,stop:z.stop,status:z.status,setMessages:z.setMessages,clearChat:A,error:z.error,mode:R,attachments:a??[],activeAttachments:v,toggleAttachment:S}}function vk({app:e,commands:t,state:n,provider:r,model:o,onFinish:s}){const i=m.useMemo(()=>(e.intents??[]).map(c=>({commandId:c.commandId,title:c.title,description:c.description,category:c.category,keywords:c.keywords,shortcut:c.shortcut,dangerous:c.dangerous,params:c.params?.map(u=>({name:u.name,description:u.description,type:u.type,optional:u.optional,enum:u.enum}))})),[e.intents]),a=m.useMemo(()=>({appId:e.id,appName:e.name,appDescription:e.description,intents:i,state:n}),[e.id,e.name,e.description,i,n]),l=m.useCallback(c=>{const u=t.find(d=>d.id===c);if(!u){console.warn(`[useAssistant] no command for id "${c}"`);return}u.action()},[t]);return gk({toolset:"intents",context:a,provider:r,model:o,onFinish:s,onToolCall:(c,u)=>{if(c!=="dispatch")return;const d=u.commandId;typeof d=="string"&&l(d)}})}function bk({chat:e,placeholder:t="Ask AI",inputExtras:n,inputStatus:r,inputValue:o,onInputChange:s}){const{messages:i,sendMessage:a,stop:l,status:c,clearChat:u,error:d,attachments:h,activeAttachments:p,toggleAttachment:b}=e,[x,E]=m.useState(""),y=o!==void 0,g=y?o:x,v=I=>{y?s?.(I):E(I)},w=m.useRef(null),S=m.useRef(null),k=c==="streaming"||c==="submitted",R=h.length>0;m.useEffect(()=>{const I=w.current;I&&(I.scrollTop=I.scrollHeight)},[i]),m.useEffect(()=>{S.current?.focus()},[]);const C=I=>{I.preventDefault();const M=g.trim();!M||k||(v(""),a({text:M}))},_=I=>{I.stopPropagation(),I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),C(I))};return f.jsxs("div",{className:"flex flex-col h-full font-mono text-[12px]",children:[f.jsxs("div",{ref:w,className:"flex-1 overflow-y-auto frame-scrollbar p-3 space-y-3",children:[i.length===0&&f.jsx("div",{className:"text-muted-foreground/80 text-center py-8 select-none",children:t}),i.map(I=>f.jsx("div",{className:`flex ${I.role==="user"?"justify-end":"justify-start"}`,children:f.jsx("div",{className:`max-w-[85%] rounded-lg px-3 py-2 whitespace-pre-wrap break-words leading-relaxed ${I.role==="user"?"bg-accent/10 text-foreground border border-accent/20":"bg-muted/50 text-foreground border border-border/50"}`,children:(I.parts??[]).map((M,N)=>{if(!M)return null;if(M.type==="text")return f.jsx("span",{children:M.text},N);if(uo(M)){const T=qS(M),F=Object.entries(M.input??{}).map(([O,D])=>`${O}: ${JSON.stringify(D)}`).join(", ");return f.jsxs("div",{className:"text-[11px] text-info/80 mt-1 font-mono",children:[f.jsx("span",{className:"text-muted-foreground/80",children:"↳ "}),T,"(",F,")"]},N)}return null})})},I.id)),k&&i[i.length-1]?.role!=="assistant"&&f.jsx("div",{className:"flex justify-start",children:f.jsx("div",{className:"bg-muted/50 border border-border/50 rounded-lg px-3 py-2 text-muted-foreground",children:f.jsx("span",{className:"animate-pulse",children:"Thinking"})})})]}),d&&f.jsxs("div",{className:"px-3 py-2 bg-destructive/10 border-t border-destructive/30 text-destructive text-[11px] flex items-center gap-2",children:[f.jsx(ab,{size:12}),f.jsx("span",{className:"truncate",children:d.message||"An error occurred"})]}),f.jsxs("div",{className:"px-3 py-2.5 border-t border-border/50 bg-background/60",children:[r&&f.jsx("div",{className:"mb-2",children:r}),R&&f.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[f.jsx(Fg,{size:11,className:"text-muted-foreground/80 shrink-0"}),h.map(I=>{const M=p.has(I.label);return f.jsx("button",{type:"button",onClick:()=>b(I.label),className:`text-[10px] px-2 py-0.5 rounded-full border transition-colors ${M?"bg-info/10 text-info border-info/30":"text-muted-foreground/80 border-border hover:text-foreground hover:border-foreground/30"}`,children:I.label},I.label)}),p.size>0&&f.jsx("span",{className:"text-[10px] text-muted-foreground/60 ml-1",children:"attached"})]}),f.jsxs("form",{onSubmit:C,className:"flex items-center gap-2 rounded-lg border border-border bg-muted/60 px-3 py-2 focus-within:border-accent/40 transition-colors",children:[n,i.length>0&&f.jsx("button",{type:"button",onClick:()=>u(),className:"p-1 rounded text-muted-foreground/80 hover:text-foreground hover:bg-muted transition-colors",title:"Clear",children:f.jsx(Ab,{size:12})}),f.jsx("input",{ref:S,type:"text",value:g,onChange:I=>v(I.target.value),onKeyDown:_,placeholder:t,className:"flex-1 bg-transparent outline-none text-foreground placeholder:text-muted-foreground/80 caret-accent",disabled:k}),k?f.jsx("button",{type:"button",onClick:()=>l(),className:"p-1.5 rounded text-warning hover:bg-warning/10 transition-colors",title:"Stop",children:f.jsx(Od,{size:12})}):f.jsx("button",{type:"submit",disabled:!g.trim(),className:"text-[11px] px-2 py-1 rounded bg-accent/10 text-accent border border-accent/30 hover:bg-accent/20 disabled:opacity-30 disabled:cursor-default transition-colors",children:"Send"})]})]})]})}function yk({app:e,commands:t,state:n,relayUrl:r="ws://localhost:3600",cwd:o,agent:s="claude",provider:i,model:a,backend:l="pty",tmuxSession:c,workspaceFiles:u,onOpenSettings:d,onStartService:h,voiceKit:p}){const[b,x]=St(`assistant.${e.id}.mode`,"relay"),[E,y]=m.useState(""),[g,v]=St(`assistant.${e.id}.voice.speakReplies`,p?.settings.speakReplies??!1),{serviceApiUrl:w}=go(),S=m.useMemo(()=>wk(e),[e]),k=_g({url:r,systemPrompt:S,cwd:o,workspaceFiles:u,sessionKey:`assistant-${e.id}`,backend:l,tmuxSession:c,agent:s,provider:s==="pi"?i:void 0,model:s==="pi"?a:void 0}),R=m.useCallback(async()=>{if(h)return h();try{return(await(await fetch(`${w}/api/services/execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serviceId:"relay",action:"start",triggeredBy:"assistant"})})).json()).success===!0}catch{return!1}},[h,w]),C=m.useMemo(()=>{const A=[{label:"Relay",value:r},{label:"Agent",value:s}];return o&&A.push({label:"CWD",value:o}),s==="pi"&&a&&A.push({label:"Model",value:a}),A},[r,s,o,a]),[_,I]=m.useState("text"),M=vk({app:e,commands:t,state:n,provider:i,model:a,onFinish:({message:A,isAbort:Z,isDisconnect:P,isError:B})=>{!p||!g||Z||P||B||A.role==="assistant"&&p.speakReply(A,{surface:"hudson-assistant",appId:e.id,source:_})}}),N=m.useCallback(A=>{if(!p)return;const Z=[E.trim(),A].filter(Boolean).join(" ");p.settings.autoSend&&M.status!=="streaming"&&M.status!=="submitted"?(y(""),I("voice"),M.sendMessage({text:Z})):y(Z)},[p,E,M]),T=m.useCallback(()=>{p&&(p.input.status==="recording"?p.input.stop():p.input.start(N))},[p,N]),F=e.intents?.length??0,O=!!p,D=p?.input.status==="transcribing",z=p?.input.status==="recording";return f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-b border-border/50 bg-background/60",children:[f.jsx(Ad,{size:11,className:"text-cyan-400/60"}),f.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-muted-foreground/80",children:"Assistant"}),f.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground/60",children:["· ",e.name]}),f.jsx("div",{className:"flex-1"}),O&&b==="chat"&&f.jsx("button",{type:"button",onClick:()=>{g&&p?.output.stop(),v(!g)},className:`p-1 rounded transition-colors ${g?"text-cyan-300 hover:text-cyan-200":"text-muted-foreground/80 hover:text-foreground"}`,title:g?"Speaker on (click to mute)":"Speaker off (click to enable)",children:p?.output.isPlaying?f.jsx(ca,{size:12,className:"animate-spin"}):g?f.jsx(Dg,{size:12}):f.jsx(zg,{size:12})}),f.jsxs("div",{className:"flex items-center gap-1 rounded-full border border-border p-0.5",children:[f.jsx(Hl,{active:b==="relay",onClick:()=>x("relay"),children:"Relay"}),f.jsx(Hl,{active:b==="chat",onClick:()=>x("chat"),children:"Chat"})]}),b==="relay"&&k.status==="connected"&&f.jsx("button",{type:"button",onClick:()=>k.restart(),className:"text-[10px] px-2 py-0.5 rounded-full border text-cyan-400 border-cyan-500/30 hover:bg-cyan-500/10 transition-colors",title:"Kill session and start fresh",children:"Restart"}),b==="relay"&&k.status==="connected"&&f.jsx("button",{type:"button",onClick:()=>k.disconnect(),className:"text-[10px] px-2 py-0.5 rounded-full border text-red-400 border-red-500/30 hover:bg-red-500/10 transition-colors",children:"Disconnect"}),b==="relay"&&k.status!=="connected"&&k.status!=="connecting"&&f.jsx("button",{type:"button",onClick:()=>k.connect(),className:"text-[10px] px-2 py-0.5 rounded-full border text-accent border-accent/30 hover:bg-accent/10 transition-colors",children:"Connect"})]}),f.jsx("div",{className:"flex-1 min-h-0",children:b==="relay"?f.jsx(Pg,{relay:k,configItems:C,onOpenSettings:d,onStartService:R}):f.jsx(bk,{chat:M,placeholder:F===0?`Ask about ${e.name} — no intents declared, conversation only.`:`Ask ${e.name} to do something… (${F} intent${F===1?"":"s"})`,inputValue:E,onInputChange:A=>{_==="voice"&&A.length===0&&I("text"),y(A)},inputExtras:O&&p?.input.isSupported?f.jsx("button",{type:"button",onClick:T,disabled:D,className:`p-1 rounded transition-colors disabled:opacity-30 ${z?"bg-red-500/15 text-red-300 hover:bg-red-500/20":"text-muted-foreground/80 hover:text-cyan-400"}`,title:z?"Stop recording":"Record voice prompt",children:D?f.jsx(ca,{size:12,className:"animate-spin"}):z?f.jsx(Od,{size:11}):f.jsx($g,{size:12})}):void 0,inputStatus:O&&p?f.jsx(xk,{inputStatus:p.input.status,inputError:p.input.error,outputStatus:p.output.status,outputError:p.output.error}):void 0})})]})}function xk({inputStatus:e,inputError:t,outputStatus:n,outputError:r}){const o=Wl(e)??Wl(n),s=t??r;return!o&&!s?null:f.jsxs("div",{className:"flex items-center gap-2",children:[o&&f.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full border font-mono ${o.className}`,children:o.label}),s&&f.jsx("span",{className:"text-[10px] text-muted-foreground/80 truncate flex-1",title:s,children:s})]})}function Wl(e){switch(e){case"recording":return{label:"listening",className:"border-red-500/20 bg-red-500/10 text-red-300"};case"transcribing":return{label:"transcribing",className:"border-amber-500/20 bg-amber-500/10 text-amber-300"};case"ready":return{label:"draft ready",className:"border-cyan-500/20 bg-cyan-500/10 text-cyan-300"};case"synthesizing":return{label:"voicing",className:"border-cyan-500/20 bg-cyan-500/10 text-cyan-300"};case"speaking":return{label:"speaking",className:"border-accent/20 bg-accent/10 text-accent"};case"unavailable":return{label:"voice offline",className:"border-amber-500/20 bg-amber-500/10 text-amber-300"};case"error":return{label:"voice error",className:"border-red-500/20 bg-red-500/10 text-red-300"};default:return null}}function Hl({active:e,onClick:t,children:n}){return f.jsx("button",{type:"button",onClick:t,className:`text-[10px] px-2 py-0.5 rounded-full transition-colors ${e?"bg-cyan-500/15 text-cyan-300":"text-muted-foreground/80 hover:text-foreground"}`,children:n})}function wk(e){const t=[`You are working alongside the user inside the **${e.name}** Hudson app.`];e.description&&t.push(e.description);const n=e.intents??[];if(n.length>0){t.push("","## What this app can do (for context)");for(const r of n)t.push(`- ${r.title} — ${r.description}`);t.push("","These actions live inside the running app. You can describe them to the user, but you do not invoke them yourself — the user can trigger any of them via the command palette (Cmd+K).")}return t.push("","## How to behave","- Be terse. The user is in a terminal; respect their attention.","- Use your own tools (file ops, shell, etc.) freely if it helps.","- When asked to change something inside the app itself, prefer guiding the user to the matching command rather than hacking around it."),t.join(`
58
+ `)}const Ek={...Td};let Gl=0;function Sk(e,t="mui"){const[n,r]=m.useState(e),o=e||n;return m.useEffect(()=>{n==null&&(Gl+=1,r(`${t}-${Gl}`))},[n,t]),o}const ql=Ek.useId;function On(e,t){if(ql!==void 0){const n=ql();return e??(t?`${t}-${n}`:n)}return Sk(e,t)}function Bt(e,...t){const n=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(r=>n.searchParams.append("args[]",r)),`Base UI error #${e}; visit ${n} for the full message.`}const Mp=m.createContext(void 0);function Gs(e=!0){const t=m.useContext(Mp);if(t===void 0&&!e)throw new Error(Bt(25));return t}const Np=m.createContext(void 0);function jp(e){const t=m.useContext(Np);if(t===void 0&&!e)throw new Error(Bt(33));return t}const sc=m.createContext(void 0);function _r(e){const t=m.useContext(sc);if(t===void 0&&!e)throw new Error(Bt(36));return t}const Yl={};function jt(e,t){const n=m.useRef(Yl);return n.current===Yl&&(n.current=e(t)),n}function fo(e,t,n,r){const o=jt(Dp).current;return Ck(o,e,t,n,r)&&zp(o,[e,t,n,r]),o.callback}function kk(e){const t=jt(Dp).current;return Rk(t,e)&&zp(t,e),t.callback}function Dp(){return{callback:null,cleanup:null,refs:[]}}function Ck(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function Rk(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function zp(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const i=s(n);typeof i=="function"&&(r[o]=i);break}case"object":{s.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const i=r[o];typeof i=="function"?i():s(null);break}case"object":{s.current=null;break}}}}}}}const Tk=parseInt(m.version,10);function ic(e){return Tk>=e}function Kl(e){if(!m.isValidElement(e))return null;const t=e,n=t.props;return(ic(19)?n?.ref:t.ref)??null}function Ea(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function _k(e,t){const n={};for(const r in e){const o=e[r];if(t?.hasOwnProperty(r)){const s=t[r](o);s!=null&&Object.assign(n,s);continue}o===!0?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}function Pk(e,t){return typeof e=="function"?e(t):e}function Ik(e,t){return typeof e=="function"?e(t):e}const Kr={};function Gn(e,t,n,r,o){let s={...Sa(e,Kr)};return t&&(s=ns(s,t)),n&&(s=ns(s,n)),r&&(s=ns(s,r)),s}function Ak(e){if(e.length===0)return Kr;if(e.length===1)return Sa(e[0],Kr);let t={...Sa(e[0],Kr)};for(let n=1;n<e.length;n+=1)t=ns(t,e[n]);return t}function ns(e,t){return Lp(t)?t(e):Ok(e,t)}function Ok(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=Ea(e.style,r);break}case"className":{e[n]=$p(e.className,r);break}default:Mk(n,r)?e[n]=Nk(e[n],r):e[n]=r}}return e}function Mk(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return n===111&&r===110&&o>=65&&o<=90&&(typeof t=="function"||typeof t>"u")}function Lp(e){return typeof e=="function"}function Sa(e,t){return Lp(e)?e(t):e??Kr}function Nk(e,t){return t?e?n=>{if(jk(n)){const o=n;ka(o);const s=t(o);return o.baseUIHandlerPrevented||e?.(o),s}const r=t(n);return e?.(n),r}:t:e}function ka(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function $p(e,t){return t?e?t+" "+e:t:e}function jk(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Fp(){}const Bp=Object.freeze([]),bt=Object.freeze({}),Dk=500,zk={style:{transition:"none"}},Lk="data-base-ui-click-trigger",$k={fallbackAxisSide:"none"},Fk={fallbackAxisSide:"end"},Bk={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function Vt(e,t,n={}){const r=t.render,o=Vk(t,n);if(n.enabled===!1)return null;const s=n.state??bt;return Zk(e,r,o,s)}function Vk(e,t={}){const{className:n,style:r,render:o}=e,{state:s=bt,ref:i,props:a,stateAttributesMapping:l,enabled:c=!0}=t,u=c?Pk(n,s):void 0,d=c?Ik(r,s):void 0,h=c?_k(s,l):bt,p=c?Ea(h,Array.isArray(a)?Ak(a):a)??bt:bt;return typeof document<"u"&&(c?Array.isArray(i)?p.ref=kk([p.ref,Kl(o),...i]):p.ref=fo(p.ref,Kl(o),i):fo(null,null)),c?(u!==void 0&&(p.className=$p(p.className,u)),d!==void 0&&(p.style=Ea(p.style,d)),p):bt}function Zk(e,t,n,r){if(t){if(typeof t=="function")return t(n,r);const o=Gn(n,t.props);return o.ref=n.ref,m.cloneElement(t,o)}if(e&&typeof e=="string")return Uk(e,n);throw new Error(Bt(8))}function Uk(e,t){return e==="button"?m.createElement("button",{type:"button",...t,key:t.key}):e==="img"?m.createElement("img",{alt:"",...t,key:t.key}):m.createElement(e,t)}let ks=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const Wk={[ks.startingStyle]:""},Hk={[ks.endingStyle]:""},Vp={transitionStatus(e){return e==="starting"?Wk:e==="ending"?Hk:null}};let ac=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=ks.startingStyle]="startingStyle",e[e.endingStyle=ks.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),Ca=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const Gk={[Ca.popupOpen]:""},qk={[Ca.popupOpen]:"",[Ca.pressed]:""},Yk={[ac.open]:""},Kk={[ac.closed]:""},Jk={[ac.anchorHidden]:""},Xk={open(e){return e?Gk:null}},Qk={open(e){return e?qk:null}},qs={open(e){return e?Yk:Kk},anchorHidden(e){return e?Jk:null}},cc="none",xr="trigger-press",kt="trigger-hover",po="trigger-focus",lc="outside-press",Zp="item-press",Ys="focus-out",Ks="escape-key",rs="list-navigation",eC="cancel-open",Wr="sibling-open",tC="disabled",Up="imperative-action",zi=Td[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],nC=zi&&zi!==m.useLayoutEffect?zi:e=>e();function de(e){const t=jt(rC).current;return t.next=e,nC(t.effect),t.trampoline}function rC(){const e={next:void 0,callback:oC,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function oC(){}function Js(){return typeof window<"u"}function Mn(e){return uc(e)?(e.nodeName||"").toLowerCase():"#document"}function Qe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ln(e){var t;return(t=(uc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function uc(e){return Js()?e instanceof Node||e instanceof Qe(e).Node:!1}function Ne(e){return Js()?e instanceof Element||e instanceof Qe(e).Element:!1}function Ge(e){return Js()?e instanceof HTMLElement||e instanceof Qe(e).HTMLElement:!1}function Ra(e){return!Js()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qe(e).ShadowRoot}function qn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Rt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function sC(e){return/^(table|td|th)$/.test(Mn(e))}function Xs(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const iC=/transform|translate|scale|rotate|perspective|filter/,aC=/paint|layout|strict|content/,Fn=e=>!!e&&e!=="none";let Li;function dc(e){const t=Ne(e)?Rt(e):e;return Fn(t.transform)||Fn(t.translate)||Fn(t.scale)||Fn(t.rotate)||Fn(t.perspective)||!Qs()&&(Fn(t.backdropFilter)||Fn(t.filter))||iC.test(t.willChange||"")||aC.test(t.contain||"")}function cC(e){let t=cn(e);for(;Ge(t)&&!on(t);){if(dc(t))return t;if(Xs(t))return null;t=cn(t)}return null}function Qs(){return Li==null&&(Li=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Li}function on(e){return/^(html|body|#document)$/.test(Mn(e))}function Rt(e){return Qe(e).getComputedStyle(e)}function ei(e){return Ne(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function cn(e){if(Mn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ra(e)&&e.host||ln(e);return Ra(t)?t.host:t}function Wp(e){const t=cn(e);return on(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ge(t)&&qn(t)?t:Wp(t)}function Sn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Wp(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Qe(o);if(s){const a=Ta(i);return t.concat(i,i.visualViewport||[],qn(o)?o:[],a&&n?Sn(a):[])}else return t.concat(o,Sn(o,[],n))}function Ta(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const lC=()=>{},ue=typeof document<"u"?m.useLayoutEffect:lC,uC=m.createContext(void 0);function dC(e=!1){const t=m.useContext(uC);if(t===void 0&&!e)throw new Error(Bt(16));return t}function fC(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:s}=e,i=r&&t!==!1,a=r&&t===!1;return{props:m.useMemo(()=>{const c={onKeyDown(u){n&&t&&u.key!=="Tab"&&u.preventDefault()}};return r||(c.tabIndex=o,!s&&n&&(c.tabIndex=t?o:-1)),(s&&(t||i)||!s&&n)&&(c["aria-disabled"]=n),s&&(!t||a)&&(c.disabled=n),c},[r,n,t,i,a,s,o])}}function pC(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0}=e,s=m.useRef(null),i=dC(!0)!==void 0,a=de(()=>{const h=s.current;return!!(h?.tagName==="A"&&h?.href)}),{props:l}=fC({focusableWhenDisabled:n,disabled:t,composite:i,tabIndex:r,isNativeButton:o}),c=m.useCallback(()=>{const h=s.current;mC(h)&&i&&t&&l.disabled===void 0&&h.disabled&&(h.disabled=!1)},[t,l.disabled,i]);ue(c,[c]);const u=m.useCallback((h={})=>{const{onClick:p,onMouseDown:b,onKeyUp:x,onKeyDown:E,onPointerDown:y,...g}=h;return Gn({type:o?"button":void 0,onClick(w){if(t){w.preventDefault();return}p?.(w)},onMouseDown(w){t||b?.(w)},onKeyDown(w){if(t||(ka(w),E?.(w)),w.baseUIHandlerPrevented)return;const S=w.target===w.currentTarget&&!o&&!a()&&!t,k=w.key==="Enter",R=w.key===" ";S&&((R||k)&&w.preventDefault(),k&&p?.(w))},onKeyUp(w){t||(ka(w),x?.(w)),!w.baseUIHandlerPrevented&&w.target===w.currentTarget&&!o&&!t&&w.key===" "&&p?.(w)},onPointerDown(w){if(t){w.preventDefault();return}y?.(w)}},o?void 0:{role:"button"},l,g)},[t,l,o,a]),d=de(h=>{s.current=h,c()});return{getButtonProps:u,buttonRef:d}}function mC(e){return Ge(e)&&e.tagName==="BUTTON"}const hC={type:"regular-item"};function gC(e){const{closeOnClick:t,disabled:n=!1,highlighted:r,id:o,store:s,nativeButton:i,itemMetadata:a,nodeId:l}=e,c=m.useRef(null),u=Gs(!0),d=u!==void 0,{events:h}=s.useState("floatingTreeRoot"),{getButtonProps:p,buttonRef:b}=pC({disabled:n,focusableWhenDisabled:!0,native:i}),x=m.useCallback(y=>Gn({id:o,role:"menuitem",tabIndex:r?0:-1,onMouseMove(g){l&&h.emit("itemhover",{nodeId:l,target:g.currentTarget})},onMouseEnter(){a.type==="submenu-trigger"&&a.setActive()},onKeyUp(g){g.key===" "&&s.context.typingRef.current&&g.preventBaseUIHandler()},onClick(g){t&&h.emit("close",{domEvent:g,reason:Zp})},onMouseUp(g){if(u){const v=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,d&&v&&Math.abs(g.clientX-v.x)<=1&&Math.abs(g.clientY-v.y)<=1)return}c.current&&s.context.allowMouseUpTriggerRef.current&&(!d||g.button===2)&&a.type==="regular-item"&&c.current.click()}},y,p),[o,r,p,t,h,s,d,u,a,l]),E=fo(c,b);return m.useMemo(()=>({getItemProps:x,itemRef:E}),[x,E])}const Hp=m.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function vC(){return m.useContext(Hp)}let bC=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function yC(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:i,unregister:a,subscribeMapChange:l,elementsRef:c,labelsRef:u,nextIndexRef:d}=vC(),h=m.useRef(-1),[p,b]=m.useState(s??(o===bC.GuessFromOrder?()=>{if(h.current===-1){const y=d.current;d.current+=1,h.current=y}return h.current}:-1)),x=m.useRef(null),E=m.useCallback(y=>{if(x.current=y,p!==-1&&y!==null&&(c.current[p]=y,u)){const g=t!==void 0;u.current[p]=g?t:r?.current?.textContent??y.textContent}},[p,c,u,t,r]);return ue(()=>{if(s!=null)return;const y=x.current;if(y)return i(y,n),()=>{a(y)}},[s,i,a,n]),ue(()=>{if(s==null)return l(y=>{const g=x.current?y.get(x.current)?.index:null;g!=null&&b(g)})},[s,l,b]),m.useMemo(()=>({ref:E,index:p}),[p,E])}function fc(e){return On(e,"base-ui")}function Me(e,t,n,r){let o=!1,s=!1;const i=bt;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){s=!0},get isCanceled(){return o},get isPropagationAllowed(){return s},trigger:n,...i}}const xC=[];function Gp(e){m.useEffect(e,xC)}const Lo=null;class wC{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let o=0;o<n.length;o+=1)n[o]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const $o=new wC;class nn{static create(){return new nn}static request(t){return $o.request(t)}static cancel(t){return $o.cancel(t)}currentId=Lo;request(t){this.cancel(),this.currentId=$o.request(()=>{this.currentId=Lo,t()})}cancel=()=>{this.currentId!==Lo&&($o.cancel(this.currentId),this.currentId=Lo)};disposeEffect=()=>this.cancel}function ti(){const e=jt(nn.create).current;return Gp(e.disposeEffect),e}function EC(e,t=!1,n=!1){const[r,o]=m.useState(e&&t?"idle":void 0),[s,i]=m.useState(e);return e&&!s&&(i(!0),o("starting")),!e&&s&&r!=="ending"&&!n&&o("ending"),!e&&!s&&r==="ending"&&o(void 0),ue(()=>{if(!e&&s&&r!=="ending"&&n){const a=nn.request(()=>{o("ending")});return()=>{nn.cancel(a)}}},[e,s,r,n]),ue(()=>{if(!e||t)return;const a=nn.request(()=>{Yt.flushSync(()=>{o(void 0)})});return()=>{nn.cancel(a)}},[t,e]),ue(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&o("starting");const a=nn.request(()=>{o("idle")});return()=>{nn.cancel(a)}},[t,e,s,o,r]),m.useMemo(()=>({mounted:s,setMounted:i,transitionStatus:r}),[s,r])}function at(e){const t=jt(SC,e).current;return t.next=e,ue(t.effect),t}function SC(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function Vn(e){return e==null?e:"current"in e?e.current:e}function qp(e,t=!1,n=!0){const r=ti();return de((o,s=null)=>{r.cancel();const i=Vn(e);i!=null&&(typeof i.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?o():r.request(()=>{function a(){i&&Promise.all(i.getAnimations().map(l=>l.finished)).then(()=>{s!=null&&s.aborted||Yt.flushSync(o)}).catch(()=>{if(n){if(s!=null&&s.aborted)return;Yt.flushSync(o)}else i.getAnimations().length>0&&i.getAnimations().some(l=>l.pending||l.playState!=="finished")&&a()})}t?r.request(a):a()}))})}function pc(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,s=at(n),i=de(o),a=qp(r,n);m.useEffect(()=>{t&&a(()=>{n===s.current&&i()})},[t,n,i,a,s])}const Yp=m.createContext(void 0);function kC(){const e=m.useContext(Yp);if(e===void 0)throw new Error(Bt(31));return e}const CC=m.forwardRef(function(t,n){const{render:r,className:o,...s}=t,[i,a]=m.useState(void 0),l=m.useMemo(()=>({setLabelId:a}),[a]),c=Vt("div",t,{ref:n,props:{role:"group","aria-labelledby":i,...s}});return f.jsx(Yp.Provider,{value:l,children:c})}),RC=m.forwardRef(function(t,n){const{className:r,render:o,id:s,...i}=t,a=fc(s),{setLabelId:l}=kC();return ue(()=>(l(a),()=>{l(void 0)}),[l,a]),Vt("div",t,{ref:n,props:{id:a,role:"presentation",...i}})}),TC=m.forwardRef(function(t,n){const{render:r,className:o,id:s,label:i,nativeButton:a=!1,disabled:l=!1,closeOnClick:c=!0,...u}=t,d=yC({label:i}),h=jp(!0),p=fc(s),{store:b}=_r(),x=b.useState("isActive",d.index),E=b.useState("itemProps"),{getItemProps:y,itemRef:g}=gC({closeOnClick:c,disabled:l,highlighted:x,id:p,store:b,nativeButton:a,nodeId:h?.nodeId,itemMetadata:hC}),v=m.useMemo(()=>({disabled:l,highlighted:x}),[l,x]);return Vt("div",t,{state:v,props:[E,u,y],ref:[g,n,d.ref]})}),zr=0;class _n{static create(){return new _n}currentId=zr;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=zr,n()},t)}isStarted(){return this.currentId!==zr}clear=()=>{this.currentId!==zr&&(clearTimeout(this.currentId),this.currentId=zr)};disposeEffect=()=>this.clear}function Dt(){const e=jt(_n.create).current;return Gp(e.disposeEffect),e}const Pr=typeof navigator<"u",$i=AC(),Kp=MC(),Jp=OC(),_C=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),PC=$i.platform==="MacIntel"&&$i.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test($i.platform),Xp=Pr&&/apple/i.test(navigator.vendor),_a=Pr&&/android/i.test(Kp)||/android/i.test(Jp),IC=Pr&&Kp.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,Qp=Jp.includes("jsdom/");function AC(){if(!Pr)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function OC(){if(!Pr)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function MC(){if(!Pr)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}const Pa="data-base-ui-focusable",em="active",tm="selected",nm="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",kn="ArrowLeft",Cn="ArrowRight",mc="ArrowUp",xo="ArrowDown";function rn(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Pe(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&Ra(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function ct(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Gt(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function NC(e){return e.matches("html,body")}function Xe(e){return e?.ownerDocument||document}function rm(e){return Ge(e)&&e.matches(nm)}function Ia(e){return e?e.getAttribute("role")==="combobox"&&rm(e):!1}function jC(e){if(!e||Qp)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Cs(e){return e?e.hasAttribute(Pa)?e:e.querySelector(`[${Pa}]`)||e:null}function Zn(e,t,n=!0){return e.filter(o=>o.parentId===t&&(!n||o.context?.open)).flatMap(o=>[o,...Zn(e,o.id,n)])}function Jl(e,t){let n=[],r=e.find(o=>o.id===t)?.parentId;for(;r;){const o=e.find(s=>s.id===r);r=o?.parentId,o&&(n=n.concat(o))}return n}function it(e){e.preventDefault(),e.stopPropagation()}function DC(e){return"nativeEvent"in e}function om(e){return e.mozInputSource===0&&e.isTrusted?!0:_a&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function sm(e){return Qp?!1:!_a&&e.width===0&&e.height===0||_a&&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 mo(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}function zC(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const LC=["top","right","bottom","left"],wr=Math.min,Ot=Math.max,Er=Math.round,lr=Math.floor,sn=e=>({x:e,y:e}),$C={left:"right",right:"left",bottom:"top",top:"bottom"};function Aa(e,t,n){return Ot(e,wr(t,n))}function pn(e,t){return typeof e=="function"?e(t):e}function Ct(e){return e.split("-")[0]}function Nn(e){return e.split("-")[1]}function hc(e){return e==="x"?"y":"x"}function gc(e){return e==="y"?"height":"width"}function $t(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function vc(e){return hc($t(e))}function FC(e,t,n){n===void 0&&(n=!1);const r=Nn(e),o=vc(e),s=gc(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Rs(i)),[i,Rs(i)]}function BC(e){const t=Rs(e);return[Oa(e),t,Oa(t)]}function Oa(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Xl=["left","right"],Ql=["right","left"],VC=["top","bottom"],ZC=["bottom","top"];function UC(e,t,n){switch(e){case"top":case"bottom":return n?t?Ql:Xl:t?Xl:Ql;case"left":case"right":return t?VC:ZC;default:return[]}}function WC(e,t,n,r){const o=Nn(e);let s=UC(Ct(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Oa)))),s}function Rs(e){const t=Ct(e);return $C[t]+e.slice(t.length)}function HC(e){return{top:0,right:0,bottom:0,left:0,...e}}function im(e){return typeof e!="number"?HC(e):{top:e,right:e,bottom:e,left:e}}function Ts(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Fo(e,t,n){return Math.floor(e/t)!==n}function Jr(e,t){return t<0||t>=e.current.length}function Fi(e,t){return ut(e,{disabledIndices:t})}function eu(e,t){return ut(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function ut(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:o=1}={}){let s=t;do s+=n?-o:o;while(s>=0&&s<=e.current.length-1&&Xr(e,s,r));return s}function GC(e,{event:t,orientation:n,loopFocus:r,rtl:o,cols:s,disabledIndices:i,minIndex:a,maxIndex:l,prevIndex:c,stopEvent:u=!1}){let d=c;const h=[],p={};let b=!1;{let y=null,g=-1;e.current.forEach((v,w)=>{if(v==null)return;const S=v.closest('[role="row"]');S&&(b=!0),(S!==y||g===-1)&&(y=S,g+=1,h[g]=[]),h[g].push(w),p[w]=g})}const x=b&&h.length>0&&h.some(y=>y.length!==s);function E(y){if(!x||c===-1)return;const g=p[c];if(g==null)return;const v=h[g].indexOf(c);let w=y==="up"?g-1:g+1;r&&(w<0?w=h.length-1:w>=h.length&&(w=0));const S=new Set;for(;w>=0&&w<h.length&&!S.has(w);){S.add(w);const k=h[w];if(k.length===0){w=y==="up"?w-1:w+1;continue}const R=Math.min(v,k.length-1);for(let C=R;C>=0;C-=1){const _=k[C];if(!Xr(e,_,i))return _}w=y==="up"?w-1:w+1,r&&(w<0?w=h.length-1:w>=h.length&&(w=0))}}if(t.key===mc){const y=E("up");if(y!==void 0)u&&it(t),d=y;else{if(u&&it(t),c===-1)d=l;else if(d=ut(e,{startingIndex:d,amount:s,decrement:!0,disabledIndices:i}),r&&(c-s<a||d<0)){const g=c%s,v=l%s,w=l-(v-g);v===g?d=l:d=v>g?w:w-s}Jr(e,d)&&(d=c)}}if(t.key===xo){const y=E("down");y!==void 0?(u&&it(t),d=y):(u&&it(t),c===-1?d=a:(d=ut(e,{startingIndex:c,amount:s,disabledIndices:i}),r&&c+s>l&&(d=ut(e,{startingIndex:c%s-s,amount:s,disabledIndices:i}))),Jr(e,d)&&(d=c))}if(n==="both"){const y=lr(c/s);t.key===(o?kn:Cn)&&(u&&it(t),c%s!==s-1?(d=ut(e,{startingIndex:c,disabledIndices:i}),r&&Fo(d,s,y)&&(d=ut(e,{startingIndex:c-c%s-1,disabledIndices:i}))):r&&(d=ut(e,{startingIndex:c-c%s-1,disabledIndices:i})),Fo(d,s,y)&&(d=c)),t.key===(o?Cn:kn)&&(u&&it(t),c%s!==0?(d=ut(e,{startingIndex:c,decrement:!0,disabledIndices:i}),r&&Fo(d,s,y)&&(d=ut(e,{startingIndex:c+(s-c%s),decrement:!0,disabledIndices:i}))):r&&(d=ut(e,{startingIndex:c+(s-c%s),decrement:!0,disabledIndices:i})),Fo(d,s,y)&&(d=c));const g=lr(l/s)===y;Jr(e,d)&&(r&&g?d=t.key===(o?Cn:kn)?l:ut(e,{startingIndex:c-c%s-1,disabledIndices:i}):d=c)}return d}function qC(e,t,n){const r=[];let o=0;return e.forEach(({width:s,height:i},a)=>{let l=!1;for(n&&(o=0);!l;){const c=[];for(let u=0;u<s;u+=1)for(let d=0;d<i;d+=1)c.push(o+u+d*t);o%t+s<=t&&c.every(u=>r[u]==null)?(c.forEach(u=>{r[u]=a}),l=!0):o+=1}}),[...r]}function YC(e,t,n,r,o){if(e===-1)return-1;const s=n.indexOf(e),i=t[e];switch(o){case"tl":return s;case"tr":return i?s+i.width-1:s;case"bl":return i?s+(i.height-1)*r:s;case"br":return n.lastIndexOf(e);default:return-1}}function KC(e,t){return t.flatMap((n,r)=>e.includes(n)?[r]:[])}function Xr(e,t,n){if(typeof n=="function")return n(t);if(n)return n.includes(t);const r=e.current[t];return r?r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true":!1}var JC=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],_s=JC.join(","),am=typeof Element>"u",Sr=am?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ps=!am&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},Is=function(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):Is(t.parentNode));return i},XC=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},cm=function(t,n,r){if(Is(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(_s));return n&&Sr.call(t,_s)&&o.unshift(t),o=o.filter(r),o},As=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Is(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),l=a.length?a:i.children,c=As(l,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:i,candidates:c})}else{var u=Sr.call(i,_s);u&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var d=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),h=!Is(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(d&&h){var p=As(d===!0?i.children:d.children,!0,r);r.flatten?o.push.apply(o,p):o.push({scopeParent:i,candidates:p})}else s.unshift.apply(s,i.children)}}return o},lm=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},um=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||XC(t))&&!lm(t)?0:t.tabIndex},QC=function(t,n){var r=um(t);return r<0&&n&&!lm(t)?0:r},eR=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},dm=function(t){return t.tagName==="INPUT"},tR=function(t){return dm(t)&&t.type==="hidden"},nR=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},rR=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},oR=function(t){if(!t.name)return!0;var n=t.form||Ps(t),r=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=rR(o,t.form);return!s||s===t},sR=function(t){return dm(t)&&t.type==="radio"},iR=function(t){return sR(t)&&!oR(t)},aR=function(t){var n,r=t&&Ps(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,a,l;for(s=!!((i=o)!==null&&i!==void 0&&(a=i.ownerDocument)!==null&&a!==void 0&&a.contains(o)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!s&&o;){var c,u,d;r=Ps(o),o=(c=r)===null||c===void 0?void 0:c.host,s=!!((u=o)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return s},tu=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},cR=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var i=Sr.call(t,"details>summary:first-of-type"),a=i?t.parentElement:t;if(Sr.call(a,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var l=t;t;){var c=t.parentElement,u=Ps(t);if(c&&!c.shadowRoot&&o(c)===!0)return tu(t);t.assignedSlot?t=t.assignedSlot:!c&&u!==t.ownerDocument?t=u.host:t=c}t=l}if(aR(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return tu(t);return!1},lR=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Sr.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},Ma=function(t,n){return!(n.disabled||tR(n)||cR(n,t)||nR(n)||lR(n))},Na=function(t,n){return!(iR(n)||um(n)<0||!Ma(t,n))},uR=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},fm=function(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,a=i?o.scopeParent:o,l=QC(a,i),c=i?fm(o.candidates):a;l===0?i?n.push.apply(n,c):n.push(a):r.push({documentOrder:s,tabIndex:l,item:o,isScope:i,content:c})}),r.sort(eR).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},ni=function(t,n){n=n||{};var r;return n.getShadowRoot?r=As([t],n.includeContainer,{filter:Na.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:uR}):r=cm(t,n.includeContainer,Na.bind(null,n)),fm(r)},dR=function(t,n){n=n||{};var r;return n.getShadowRoot?r=As([t],n.includeContainer,{filter:Ma.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=cm(t,n.includeContainer,Ma.bind(null,n)),r},pm=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Sr.call(t,_s)===!1?!1:Na(n,t)};const wo=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function mm(e,t){const n=ni(e,wo()),r=n.length;if(r===0)return;const o=rn(Xe(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function hm(e){return mm(Xe(e).body,1)||e}function gm(e){return mm(Xe(e).body,-1)||e}function Qr(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Pe(n,r)}function fR(e){ni(e,wo()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function nu(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function vm(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(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)}}}class bm{nodesRef={current:[]};events=vm();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const ym=m.createContext(null),xm=m.createContext(null),jn=()=>m.useContext(ym)?.id||null,Yn=e=>{const t=m.useContext(xm);return e??t};function pR(e){const t=On(),n=Yn(e),r=jn();return ue(()=>{if(!t)return;const o={id:t,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,r]),t}function mR(e){const{children:t,id:n}=e,r=jn();return f.jsx(ym.Provider,{value:m.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function hR(e){const{children:t,externalTree:n}=e,r=jt(()=>n??new bm).current;return f.jsx(xm.Provider,{value:r,children:t})}function kr(e){return`data-base-ui-${e}`}function os(e,t,n){if(n&&!mo(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r?.[t]}return e?.[t]}const wm=m.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new _n,currentIdRef:{current:null},currentContextRef:{current:null}});function gR(e){const{children:t,delay:n,timeoutMs:r=0}=e,o=m.useRef(n),s=m.useRef(n),i=m.useRef(null),a=m.useRef(null),l=Dt();return f.jsx(wm.Provider,{value:m.useMemo(()=>({hasProvider:!0,delayRef:o,initialDelayRef:s,currentIdRef:i,timeoutMs:r,currentContextRef:a,timeout:l}),[r,l]),children:t})}function vR(e,t={open:!1}){const n="rootStore"in e?e.rootStore:e,r=n.useState("floatingId"),{enabled:o=!0,open:s}=t,i=m.useContext(wm),{currentIdRef:a,delayRef:l,timeoutMs:c,initialDelayRef:u,currentContextRef:d,hasProvider:h,timeout:p}=i,[b,x]=m.useState(!1);return ue(()=>{function E(){x(!1),d.current?.setIsInstantPhase(!1),a.current=null,d.current=null,l.current=u.current}if(o&&a.current&&!s&&a.current===r){if(x(!1),c)return p.start(c,E),()=>{p.clear()};E()}},[o,s,r,a,l,c,u,d,p]),ue(()=>{if(!o||!s)return;const E=d.current,y=a.current;d.current={onOpenChange:n.setOpen,setIsInstantPhase:x},a.current=r,l.current={open:0,close:os(u.current,"close")},y!==null&&y!==r?(p.clear(),x(!0),E?.setIsInstantPhase(!0),E?.onOpenChange(!1,Me(cc))):(x(!1),E?.setIsInstantPhase(!1))},[o,s,r,n,a,l,c,u,d,p]),ue(()=>()=>{d.current=null},[d]),m.useMemo(()=>({hasProvider:h,delayRef:l,isInstantPhase:b}),[h,l,b])}const Em={clip:"rect(0 0 0 0)",overflow:"hidden",whiteSpace:"nowrap",position:"fixed",top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1};function Pn(e){return e?.ownerDocument||document}const Os=m.forwardRef(function(t,n){const[r,o]=m.useState();ue(()=>{Xp&&o("button")},[]);const s={tabIndex:0,role:r};return f.jsx("span",{...t,ref:n,style:Em,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});let ru=0;function ss(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(ru);const s=()=>e?.focus({preventScroll:n});o?s():ru=requestAnimationFrame(s)}const pr={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function ou(e){return e==="inert"?pr.inert:e==="aria-hidden"?pr["aria-hidden"]:pr.none}let Bo=new WeakSet,Vo={},Bi=0;const Sm=e=>e&&(e.host||Sm(e.parentNode)),bR=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=Sm(n);return e.contains(r)?r:null}).filter(n=>n!=null);function yR(e,t,n,r){const o="data-base-ui-inert",s=r?"inert":n?"aria-hidden":null,i=bR(t,e),a=new Set,l=new Set(i),c=[];Vo[o]||(Vo[o]=new WeakMap);const u=Vo[o];i.forEach(d),h(t),a.clear();function d(p){!p||a.has(p)||(a.add(p),p.parentNode&&d(p.parentNode))}function h(p){!p||l.has(p)||[].forEach.call(p.children,b=>{if(Mn(b)!=="script")if(a.has(b))h(b);else{const x=s?b.getAttribute(s):null,E=x!==null&&x!=="false",y=ou(s),g=(y.get(b)||0)+1,v=(u.get(b)||0)+1;y.set(b,g),u.set(b,v),c.push(b),g===1&&E&&Bo.add(b),v===1&&b.setAttribute(o,""),!E&&s&&b.setAttribute(s,s==="inert"?"":"true")}})}return Bi+=1,()=>{c.forEach(p=>{const b=ou(s),E=(b.get(p)||0)-1,y=(u.get(p)||0)-1;b.set(p,E),u.set(p,y),E||(!Bo.has(p)&&s&&p.removeAttribute(s),Bo.delete(p)),y||p.removeAttribute(o)}),Bi-=1,Bi||(pr.inert=new WeakMap,pr["aria-hidden"]=new WeakMap,pr.none=new WeakMap,Bo=new WeakSet,Vo={})}}function xR(e,t=!1,n=!1){const r=Xe(e[0]).body;return yR(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const km=m.createContext(null),Cm=()=>m.useContext(km),wR=kr("portal");function Rm(e={}){const{ref:t,container:n,componentProps:r=bt,elementProps:o,elementState:s}=e,i=On(),l=Cm()?.portalNode,[c,u]=m.useState(null),[d,h]=m.useState(null),p=m.useRef(null);ue(()=>{if(n===null){p.current&&(p.current=null,h(null),u(null));return}if(i==null)return;const E=(n&&(uc(n)?n:n.current))??l??document.body;if(E==null){p.current&&(p.current=null,h(null),u(null));return}p.current!==E&&(p.current=E,h(null),u(E))},[n,l,i]);const b=Vt("div",r,{ref:[t,h],state:s,props:[{id:i,[wR]:""},o]});return{portalNode:d,portalSubtree:c&&b?Yt.createPortal(b,c):null}}const ER=m.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,renderGuards:a,...l}=t,{portalNode:c,portalSubtree:u}=Rm({container:o,ref:n,componentProps:t,elementProps:l}),d=m.useRef(null),h=m.useRef(null),p=m.useRef(null),b=m.useRef(null),[x,E]=m.useState(null),y=x?.modal,g=x?.open,v=typeof a=="boolean"?a:!!x&&!x.modal&&x.open&&!!c;m.useEffect(()=>{if(!c||y)return;function S(k){c&&Qr(k)&&(k.type==="focusin"?nu:fR)(c)}return c.addEventListener("focusin",S,!0),c.addEventListener("focusout",S,!0),()=>{c.removeEventListener("focusin",S,!0),c.removeEventListener("focusout",S,!0)}},[c,y]),m.useEffect(()=>{!c||g||nu(c)},[g,c]);const w=m.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:h,beforeInsideRef:p,afterInsideRef:b,portalNode:c,setFocusManagerState:E}),[c]);return f.jsxs(m.Fragment,{children:[u,f.jsxs(km.Provider,{value:w,children:[v&&c&&f.jsx(Os,{"data-type":"outside",ref:d,onFocus:S=>{if(Qr(S,c))p.current?.focus();else{const k=x?x.domReference:null;gm(k)?.focus()}}}),v&&c&&f.jsx("span",{"aria-owns":c.id,style:Bk}),c&&Yt.createPortal(r,c),v&&c&&f.jsx(Os,{"data-type":"outside",ref:h,onFocus:S=>{if(Qr(S,c))b.current?.focus();else{const k=x?x.domReference:null;hm(k)?.focus(),x?.closeOnFocusOut&&x?.onOpenChange(!1,Me(Ys,S.nativeEvent))}}})]})]})});function SR(e,t){const n=Qe(e.target);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"):""}const su=20;let yn=[];function bc(){yn=yn.filter(e=>e.isConnected)}function kR(e){bc(),e&&Mn(e)!=="body"&&(yn.push(e),yn.length>su&&(yn=yn.slice(-su)))}function Vi(){return bc(),yn[yn.length-1]}function CR(e){if(!e)return null;const t=wo();return pm(e,t)?e:ni(e,t)[0]||e}function RR(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():Rt(e).display!=="none"}function iu(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=wo(),o=dR(e,n).filter(i=>{const a=i.getAttribute("data-tabindex")||"";return pm(i,n)||i.hasAttribute("data-tabindex")&&!a.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||o.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function TR(e){const{context:t,children:n,disabled:r=!1,order:o=["content"],initialFocus:s=!0,returnFocus:i=!0,restoreFocus:a=!1,modal:l=!0,closeOnFocusOut:c=!0,openInteractionType:u="",getInsideElements:d=()=>[],nextFocusableElement:h,previousFocusableElement:p,beforeContentFocusGuardRef:b,externalTree:x}=e,E="rootStore"in t?t.rootStore:t,y=E.useState("open"),g=E.useState("domReferenceElement"),v=E.useState("floatingElement"),{events:w,dataRef:S}=E.context,k=de(()=>S.current.floatingContext?.nodeId),R=de(d),C=s===!1,_=Ia(g)&&C,I=at(o),M=at(s),N=at(i),T=at(u),F=Yn(x),O=Cm(),D=m.useRef(null),z=m.useRef(null),A=m.useRef(!1),Z=m.useRef(!1),P=m.useRef(!1),B=m.useRef(-1),U=m.useRef(""),q=m.useRef(""),he=Dt(),ee=Dt(),Y=ti(),ie=O!=null,K=Cs(v),J=de((X=K)=>X?ni(X,wo()):[]),fe=de(X=>{const oe=J(X);return I.current.map(()=>oe).filter(Boolean).flat()});m.useEffect(()=>{if(r||!l)return;function X(ke){ke.key==="Tab"&&Pe(K,rn(Xe(K)))&&J().length===0&&!_&&it(ke)}const oe=Xe(K);return oe.addEventListener("keydown",X),()=>{oe.removeEventListener("keydown",X)}},[r,g,K,l,I,_,J,fe]),m.useEffect(()=>{if(r||!v)return;function X(oe){const ke=ct(oe),Re=J().indexOf(ke);Re!==-1&&(B.current=Re)}return v.addEventListener("focusin",X),()=>{v.removeEventListener("focusin",X)}},[r,v,J]),m.useEffect(()=>{if(r||!y)return;const X=Xe(K);function oe(){P.current=!1}function ke(Re){const H=ct(Re),ge=Pe(v,H)||Pe(g,H)||Pe(O?.portalNode,H);P.current=!ge,q.current=Re.pointerType||"keyboard"}function we(){q.current="keyboard"}return X.addEventListener("pointerdown",ke,!0),X.addEventListener("pointerup",oe,!0),X.addEventListener("pointercancel",oe,!0),X.addEventListener("keydown",we,!0),()=>{X.removeEventListener("pointerdown",ke,!0),X.removeEventListener("pointerup",oe,!0),X.removeEventListener("pointercancel",oe,!0),X.removeEventListener("keydown",we,!0)}},[r,v,g,K,y,O]),m.useEffect(()=>{if(r||!c)return;function X(){Z.current=!0,ee.start(0,()=>{Z.current=!1})}function oe(H){const ge=H.relatedTarget,Q=H.currentTarget,le=ct(H);queueMicrotask(()=>{const $=k(),be=E.context.triggerElements,Ae=!(Pe(g,ge)||Pe(v,ge)||Pe(ge,v)||Pe(O?.portalNode,ge)||ge!=null&&be.hasElement(ge)||be.hasMatchingElement(Te=>Pe(Te,ge))||ge?.hasAttribute(kr("focus-guard"))||F&&(Zn(F.nodesRef.current,$).find(Te=>Pe(Te.context?.elements.floating,ge)||Pe(Te.context?.elements.domReference,ge))||Jl(F.nodesRef.current,$).find(Te=>[Te.context?.elements.floating,Cs(Te.context?.elements.floating)].includes(ge)||Te.context?.elements.domReference===ge)));if(Q===g&&K&&iu(K,I),a&&Q!==g&&!RR(le)&&rn(Xe(K))===Xe(K).body){if(Ge(K)&&(K.focus(),a==="popup")){Y.request(()=>{K.focus()});return}const Te=B.current,et=J(),rt=et[Te]||et[et.length-1]||K;Ge(rt)&&rt.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(_||!l)&&ge&&Ae&&!Z.current&&(_||ge!==Vi())&&(A.current=!0,E.setOpen(!1,Me(Ys,H)))})}function ke(){P.current||(S.current.insideReactTree=!0,he.start(0,()=>{S.current.insideReactTree=!1}))}const we=Ge(g)?g:null,Re=[];if(!(!v&&!we))return we&&(we.addEventListener("focusout",oe),we.addEventListener("pointerdown",X),Re.push(()=>{we.removeEventListener("focusout",oe),we.removeEventListener("pointerdown",X)})),v&&(v.addEventListener("focusout",oe),O&&(v.addEventListener("focusout",ke,!0),Re.push(()=>{v.removeEventListener("focusout",ke,!0)})),Re.push(()=>{v.removeEventListener("focusout",oe)})),()=>{Re.forEach(H=>{H()})}},[r,g,v,K,l,F,O,E,c,a,J,_,k,I,S,he,ee,Y]);const L=m.useRef(null),ae=m.useRef(null),te=fo(L,b,O?.beforeInsideRef),ye=fo(ae,O?.afterInsideRef);m.useEffect(()=>{if(r||!v||!y)return;const X=Array.from(O?.portalNode?.querySelectorAll(`[${kr("portal")}]`)||[]),ke=(F?Jl(F.nodesRef.current,k()):[]).find(H=>Ia(H.context?.elements.domReference||null))?.context?.elements.domReference,we=[v,ke,...X,...R(),D.current,z.current,L.current,ae.current,O?.beforeOutsideRef.current,O?.afterOutsideRef.current,Vn(p),Vn(h),_?g:null].filter(H=>H!=null),Re=xR(we,l||_);return()=>{Re()}},[y,r,g,v,l,I,O,_,F,k,R,h,p]),ue(()=>{if(!y||r||!Ge(K))return;const X=Xe(K),oe=rn(X);queueMicrotask(()=>{const ke=fe(K),we=M.current,Re=typeof we=="function"?we(T.current||""):we;if(Re===void 0||Re===!1)return;let H;Re===!0||Re===null?H=ke[0]||K:H=Vn(Re),H=H||ke[0]||K,!Pe(K,oe)&&ss(H,{preventScroll:H===K})})},[r,y,K,C,fe,M,T]),ue(()=>{if(r||!K)return;const X=Xe(K),oe=rn(X);kR(oe);function ke(H){if(H.open||(U.current=SR(H.nativeEvent,q.current)),H.reason===kt&&H.nativeEvent.type==="mouseleave"&&(A.current=!0),H.reason===lc)if(H.nested)A.current=!1;else if(om(H.nativeEvent)||sm(H.nativeEvent))A.current=!1;else{let ge=!1;document.createElement("div").focus({get preventScroll(){return ge=!0,!1}}),ge?A.current=!1:A.current=!0}}w.on("openchange",ke);const we=X.createElement("span");we.setAttribute("tabindex","-1"),we.setAttribute("aria-hidden","true"),Object.assign(we.style,Em),ie&&g&&g.insertAdjacentElement("afterend",we);function Re(){const H=N.current;let ge=typeof H=="function"?H(U.current):H;if(ge===void 0||ge===!1)return null;if(ge===null&&(ge=!0),typeof ge=="boolean"){const le=g||Vi();return le&&le.isConnected?le:we}const Q=g||Vi()||we;return Vn(ge)||Q}return()=>{w.off("openchange",ke);const H=rn(X),ge=Pe(v,H)||F&&Zn(F.nodesRef.current,k(),!1).some(le=>Pe(le.context?.elements.floating,H)),Q=Re();queueMicrotask(()=>{const le=CR(Q),$=typeof N.current!="boolean";N.current&&!A.current&&Ge(le)&&(!(!$&&le!==H&&H!==X.body)||ge)&&le.focus({preventScroll:!0}),we.remove()})}},[r,v,K,N,S,w,F,ie,g,k]),m.useEffect(()=>{queueMicrotask(()=>{A.current=!1})},[r]),m.useEffect(()=>{if(r||!y)return;function X(ke){ct(ke)?.closest(`[${Lk}]`)&&(Z.current=!0)}const oe=Xe(K);return oe.addEventListener("pointerdown",X,!0),()=>{oe.removeEventListener("pointerdown",X,!0)}},[r,y,K]),ue(()=>{if(!r&&O)return O.setFocusManagerState({modal:l,closeOnFocusOut:c,open:y,onOpenChange:E.setOpen,domReference:g}),()=>{O.setFocusManagerState(null)}},[r,O,l,y,E,c,g]),ue(()=>{if(!(r||!K))return iu(K,I),()=>{queueMicrotask(bc)}},[r,K,I]);const pe=!r&&(l?!_:!0)&&(ie||l);return f.jsxs(m.Fragment,{children:[pe&&f.jsx(Os,{"data-type":"inside",ref:te,onFocus:X=>{if(l){const oe=fe();ss(oe[oe.length-1])}else O?.portalNode&&(A.current=!1,Qr(X,O.portalNode)?hm(g)?.focus():Vn(p??O.beforeOutsideRef)?.focus())}}),n,pe&&f.jsx(Os,{"data-type":"inside",ref:ye,onFocus:X=>{l?ss(fe()[0]):O?.portalNode&&(c&&(A.current=!0),Qr(X,O.portalNode)?gm(g)?.focus():Vn(h??O.afterOutsideRef)?.focus())}})]})}function _R(e,t){let n=null,r=null,o=!1;return{contextElement:e||void 0,getBoundingClientRect(){const s=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},i=t.axis==="x"||t.axis==="both",a=t.axis==="y"||t.axis==="both",l=["mouseenter","mousemove"].includes(t.dataRef.current.openEvent?.type||"")&&t.pointerType!=="touch";let c=s.width,u=s.height,d=s.x,h=s.y;return n==null&&t.x&&i&&(n=s.x-t.x),r==null&&t.y&&a&&(r=s.y-t.y),d-=n||0,h-=r||0,c=0,u=0,!o||l?(c=t.axis==="y"?s.width:0,u=t.axis==="x"?s.height:0,d=i&&t.x!=null?t.x:d,h=a&&t.y!=null?t.y:h):o&&!l&&(u=t.axis==="x"?s.height:u,c=t.axis==="y"?s.width:c),o=!0,{width:c,height:u,x:d,y:h,top:h,right:d+c,bottom:h+u,left:d}}}}function au(e){return e!=null&&e.clientX!=null}function PR(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{enabled:a=!0,axis:l="both",x:c=null,y:u=null}=t,d=m.useRef(!1),h=m.useRef(null),[p,b]=m.useState(),[x,E]=m.useState([]),y=de((k,R)=>{d.current||i.current.openEvent&&!au(i.current.openEvent)||n.set("positionReference",_R(s,{x:k,y:R,axis:l,dataRef:i,pointerType:p}))}),g=de(k=>{c!=null||u!=null||(r?h.current||E([]):y(k.clientX,k.clientY))}),v=mo(p)?o:r,w=m.useCallback(()=>{if(!v||!a||c!=null||u!=null)return;const k=Qe(o);function R(C){const _=ct(C);Pe(o,_)?(k.removeEventListener("mousemove",R),h.current=null):y(C.clientX,C.clientY)}if(!i.current.openEvent||au(i.current.openEvent)){k.addEventListener("mousemove",R);const C=()=>{k.removeEventListener("mousemove",R),h.current=null};return h.current=C,C}n.set("positionReference",s)},[v,a,c,u,o,i,s,n,y]);m.useEffect(()=>w(),[w,x]),m.useEffect(()=>{a&&!o&&(d.current=!1)},[a,o]),m.useEffect(()=>{!a&&r&&(d.current=!0)},[a,r]),ue(()=>{a&&(c!=null||u!=null)&&(d.current=!1,y(c,u))},[a,c,u,y]);const S=m.useMemo(()=>{function k(R){b(R.pointerType)}return{onPointerDown:k,onPointerEnter:k,onMouseMove:g,onMouseEnter:g}},[g]);return m.useMemo(()=>a?{reference:S}:{},[a,S])}function cu(e,t,n){let{reference:r,floating:o}=e;const s=$t(t),i=vc(t),a=gc(i),l=Ct(t),c=s==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-o.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-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Nn(t)){case"start":p[i]-=h*(n&&c?-1:1);break;case"end":p[i]+=h*(n&&c?-1:1);break}return p}async function IR(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=pn(t,e),b=im(p),E=a[h?d==="floating"?"reference":"floating":d],y=Ts(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(E)))==null||n?E:E.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),g=d==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),w=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},S=Ts(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:v,strategy:l}):g);return{top:(y.top-S.top+b.top)/w.y,bottom:(S.bottom-y.bottom+b.bottom)/w.y,left:(y.left-S.left+b.left)/w.x,right:(S.right-y.right+b.right)/w.x}}const AR=50,OR=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:IR},l=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=cu(c,r,l),h=r,p=0;const b={};for(let x=0;x<s.length;x++){const E=s[x];if(!E)continue;const{name:y,fn:g}=E,{x:v,y:w,data:S,reset:k}=await g({x:u,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:b,rects:c,platform:a,elements:{reference:e,floating:t}});u=v??u,d=w??d,b[y]={...b[y],...S},k&&p<AR&&(p++,typeof k=="object"&&(k.placement&&(h=k.placement),k.rects&&(c=k.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):k.rects),{x:u,y:d}=cu(c,h,l)),x=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:b}},MR=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:x=!0,...E}=pn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=Ct(o),g=$t(a),v=Ct(a)===a,w=await(l.isRTL==null?void 0:l.isRTL(c.floating)),S=h||(v||!x?[Rs(a)]:BC(a)),k=b!=="none";!h&&k&&S.push(...WC(a,x,b,w));const R=[a,...S],C=await l.detectOverflow(t,E),_=[];let I=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&_.push(C[y]),d){const F=FC(o,i,w);_.push(C[F[0]],C[F[1]])}if(I=[...I,{placement:o,overflows:_}],!_.every(F=>F<=0)){var M,N;const F=(((M=s.flip)==null?void 0:M.index)||0)+1,O=R[F];if(O&&(!(d==="alignment"?g!==$t(O):!1)||I.every(A=>$t(A.placement)===g?A.overflows[0]>0:!0)))return{data:{index:F,overflows:I},reset:{placement:O}};let D=(N=I.filter(z=>z.overflows[0]<=0).sort((z,A)=>z.overflows[1]-A.overflows[1])[0])==null?void 0:N.placement;if(!D)switch(p){case"bestFit":{var T;const z=(T=I.filter(A=>{if(k){const Z=$t(A.placement);return Z===g||Z==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(Z=>Z>0).reduce((Z,P)=>Z+P,0)]).sort((A,Z)=>A[1]-Z[1])[0])==null?void 0:T[0];z&&(D=z);break}case"initialPlacement":D=a;break}if(o!==D)return{reset:{placement:D}}}return{}}}};function lu(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function uu(e){return LC.some(t=>e[t]>=0)}const NR=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=pn(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=lu(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:uu(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),a=lu(i,n.floating);return{data:{escapedOffsets:a,escaped:uu(a)}}}default:return{}}}}},Tm=new Set(["left","top"]);async function jR(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Ct(n),a=Nn(n),l=$t(n)==="y",c=Tm.has(i)?-1:1,u=s&&l?-1:1,d=pn(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:b}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof b=="number"&&(p=a==="end"?b*-1:b),l?{x:p*u,y:h*c}:{x:h*c,y:p*u}}const DR=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,l=await jR(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:i}}}}},zR=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:g,y:v}=y;return{x:g,y:v}}},...c}=pn(e,t),u={x:n,y:r},d=await s.detectOverflow(t,c),h=$t(Ct(o)),p=hc(h);let b=u[p],x=u[h];if(i){const y=p==="y"?"top":"left",g=p==="y"?"bottom":"right",v=b+d[y],w=b-d[g];b=Aa(v,b,w)}if(a){const y=h==="y"?"top":"left",g=h==="y"?"bottom":"right",v=x+d[y],w=x-d[g];x=Aa(v,x,w)}const E=l.fn({...t,[p]:b,[h]:x});return{...E,data:{x:E.x-n,y:E.y-r,enabled:{[p]:i,[h]:a}}}}}},LR=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=pn(e,t),u={x:n,y:r},d=$t(o),h=hc(d);let p=u[h],b=u[d];const x=pn(a,t),E=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(l){const v=h==="y"?"height":"width",w=s.reference[h]-s.floating[v]+E.mainAxis,S=s.reference[h]+s.reference[v]-E.mainAxis;p<w?p=w:p>S&&(p=S)}if(c){var y,g;const v=h==="y"?"width":"height",w=Tm.has(Ct(o)),S=s.reference[d]-s.floating[v]+(w&&((y=i.offset)==null?void 0:y[d])||0)+(w?0:E.crossAxis),k=s.reference[d]+s.reference[v]+(w?0:((g=i.offset)==null?void 0:g[d])||0)-(w?E.crossAxis:0);b<S?b=S:b>k&&(b=k)}return{[h]:p,[d]:b}}}},$R=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:l=()=>{},...c}=pn(e,t),u=await i.detectOverflow(t,c),d=Ct(o),h=Nn(o),p=$t(o)==="y",{width:b,height:x}=s.floating;let E,y;d==="top"||d==="bottom"?(E=d,y=h===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,E=h==="end"?"top":"bottom");const g=x-u.top-u.bottom,v=b-u.left-u.right,w=wr(x-u[E],g),S=wr(b-u[y],v),k=!t.middlewareData.shift;let R=w,C=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(C=v),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=g),k&&!h){const I=Ot(u.left,0),M=Ot(u.right,0),N=Ot(u.top,0),T=Ot(u.bottom,0);p?C=b-2*(I!==0||M!==0?I+M:Ot(u.left,u.right)):R=x-2*(N!==0||T!==0?N+T:Ot(u.top,u.bottom))}await l({...t,availableWidth:C,availableHeight:R});const _=await i.getDimensions(a.floating);return b!==_.width||x!==_.height?{reset:{rects:!0}}:{}}}};function _m(e){const t=Rt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ge(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Er(n)!==s||Er(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function yc(e){return Ne(e)?e:e.contextElement}function mr(e){const t=yc(e);if(!Ge(t))return sn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=_m(t);let i=(s?Er(n.width):n.width)/r,a=(s?Er(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const FR=sn(0);function Pm(e){const t=Qe(e);return!Qs()||!t.visualViewport?FR:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function BR(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Qe(e)?!1:t}function Wn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=yc(e);let i=sn(1);t&&(r?Ne(r)&&(i=mr(r)):i=mr(e));const a=BR(s,n,r)?Pm(s):sn(0);let l=(o.left+a.x)/i.x,c=(o.top+a.y)/i.y,u=o.width/i.x,d=o.height/i.y;if(s){const h=Qe(s),p=r&&Ne(r)?Qe(r):r;let b=h,x=Ta(b);for(;x&&r&&p!==b;){const E=mr(x),y=x.getBoundingClientRect(),g=Rt(x),v=y.left+(x.clientLeft+parseFloat(g.paddingLeft))*E.x,w=y.top+(x.clientTop+parseFloat(g.paddingTop))*E.y;l*=E.x,c*=E.y,u*=E.x,d*=E.y,l+=v,c+=w,b=Qe(x),x=Ta(b)}}return Ts({width:u,height:d,x:l,y:c})}function ri(e,t){const n=ei(e).scrollLeft;return t?t.left+n:Wn(ln(e)).left+n}function Im(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ri(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function VR(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=ln(r),a=t?Xs(t.floating):!1;if(r===i||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=sn(1);const u=sn(0),d=Ge(r);if((d||!d&&!s)&&((Mn(r)!=="body"||qn(i))&&(l=ei(r)),d)){const p=Wn(r);c=mr(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const h=i&&!d&&!s?Im(i,l):sn(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function ZR(e){return Array.from(e.getClientRects())}function UR(e){const t=ln(e),n=ei(e),r=e.ownerDocument.body,o=Ot(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ot(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+ri(e);const a=-n.scrollTop;return Rt(r).direction==="rtl"&&(i+=Ot(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const du=25;function WR(e,t){const n=Qe(e),r=ln(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,l=0;if(o){s=o.width,i=o.height;const u=Qs();(!u||u&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const c=ri(r);if(c<=0){const u=r.ownerDocument,d=u.body,h=getComputedStyle(d),p=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,b=Math.abs(r.clientWidth-d.clientWidth-p);b<=du&&(s-=b)}else c<=du&&(s+=c);return{width:s,height:i,x:a,y:l}}function HR(e,t){const n=Wn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Ge(e)?mr(e):sn(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,l=o*s.x,c=r*s.y;return{width:i,height:a,x:l,y:c}}function fu(e,t,n){let r;if(t==="viewport")r=WR(e,n);else if(t==="document")r=UR(ln(e));else if(Ne(t))r=HR(t,n);else{const o=Pm(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ts(r)}function Am(e,t){const n=cn(e);return n===t||!Ne(n)||on(n)?!1:Rt(n).position==="fixed"||Am(n,t)}function GR(e,t){const n=t.get(e);if(n)return n;let r=Sn(e,[],!1).filter(a=>Ne(a)&&Mn(a)!=="body"),o=null;const s=Rt(e).position==="fixed";let i=s?cn(e):e;for(;Ne(i)&&!on(i);){const a=Rt(i),l=dc(i);!l&&a.position==="fixed"&&(o=null),(s?!l&&!o:!l&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||qn(i)&&!l&&Am(e,i))?r=r.filter(u=>u!==i):o=a,i=cn(i)}return t.set(e,r),r}function qR(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Xs(t)?[]:GR(t,this._c):[].concat(n),r],a=fu(t,i[0],o);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let h=1;h<i.length;h++){const p=fu(t,i[h],o);l=Ot(p.top,l),c=wr(p.right,c),u=wr(p.bottom,u),d=Ot(p.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function YR(e){const{width:t,height:n}=_m(e);return{width:t,height:n}}function KR(e,t,n){const r=Ge(t),o=ln(t),s=n==="fixed",i=Wn(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=sn(0);function c(){l.x=ri(o)}if(r||!r&&!s)if((Mn(t)!=="body"||qn(o))&&(a=ei(t)),r){const p=Wn(t,!0,s,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else o&&c();s&&!r&&o&&c();const u=o&&!r&&!s?Im(o,a):sn(0),d=i.left+a.scrollLeft-l.x-u.x,h=i.top+a.scrollTop-l.y-u.y;return{x:d,y:h,width:i.width,height:i.height}}function Zi(e){return Rt(e).position==="static"}function pu(e,t){if(!Ge(e)||Rt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ln(e)===n&&(n=n.ownerDocument.body),n}function Om(e,t){const n=Qe(e);if(Xs(e))return n;if(!Ge(e)){let o=cn(e);for(;o&&!on(o);){if(Ne(o)&&!Zi(o))return o;o=cn(o)}return n}let r=pu(e,t);for(;r&&sC(r)&&Zi(r);)r=pu(r,t);return r&&on(r)&&Zi(r)&&!dc(r)?n:r||cC(e)||n}const JR=async function(e){const t=this.getOffsetParent||Om,n=this.getDimensions,r=await n(e.floating);return{reference:KR(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function XR(e){return Rt(e).direction==="rtl"}const QR={convertOffsetParentRelativeRectToViewportRelativeRect:VR,getDocumentElement:ln,getClippingRect:qR,getOffsetParent:Om,getElementRects:JR,getClientRects:ZR,getDimensions:YR,getScale:mr,isElement:Ne,isRTL:XR};function Mm(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function eT(e,t){let n=null,r;const o=ln(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=e.getBoundingClientRect(),{left:u,top:d,width:h,height:p}=c;if(a||t(),!h||!p)return;const b=lr(d),x=lr(o.clientWidth-(u+h)),E=lr(o.clientHeight-(d+p)),y=lr(u),v={rootMargin:-b+"px "+-x+"px "+-E+"px "+-y+"px",threshold:Ot(0,wr(1,l))||1};let w=!0;function S(k){const R=k[0].intersectionRatio;if(R!==l){if(!w)return i();R?i(!1,R):r=setTimeout(()=>{i(!1,1e-7)},1e3)}R===1&&!Mm(c,e.getBoundingClientRect())&&i(),w=!1}try{n=new IntersectionObserver(S,{...v,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,v)}n.observe(e)}return i(!0),s}function mu(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=yc(e),u=o||s?[...c?Sn(c):[],...t?Sn(t):[]]:[];u.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const d=c&&a?eT(c,n):null;let h=-1,p=null;i&&(p=new ResizeObserver(y=>{let[g]=y;g&&g.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var v;(v=p)==null||v.observe(t)})),n()}),c&&!l&&p.observe(c),t&&p.observe(t));let b,x=l?Wn(e):null;l&&E();function E(){const y=Wn(e);x&&!Mm(x,y)&&n(),x=y,b=requestAnimationFrame(E)}return n(),()=>{var y;u.forEach(g=>{o&&g.removeEventListener("scroll",n),s&&g.removeEventListener("resize",n)}),d?.(),(y=p)==null||y.disconnect(),p=null,l&&cancelAnimationFrame(b)}}const tT=DR,nT=zR,rT=MR,oT=$R,sT=NR,iT=LR,aT=(e,t,n)=>{const r=new Map,o={platform:QR,...n},s={...o.platform,_c:r};return OR(e,t,{...o,platform:s})};var cT=typeof document<"u",lT=function(){},is=cT?m.useLayoutEffect:lT;function Ms(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,o;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(!Ms(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Ms(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Nm(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function hu(e,t){const n=Nm(e);return Math.round(t*n)/n}function Ui(e){const t=m.useRef(e);return is(()=>{t.current=e}),t}function uT(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=m.useState(r);Ms(h,r)||p(r);const[b,x]=m.useState(null),[E,y]=m.useState(null),g=m.useCallback(A=>{A!==k.current&&(k.current=A,x(A))},[]),v=m.useCallback(A=>{A!==R.current&&(R.current=A,y(A))},[]),w=s||b,S=i||E,k=m.useRef(null),R=m.useRef(null),C=m.useRef(u),_=l!=null,I=Ui(l),M=Ui(o),N=Ui(c),T=m.useCallback(()=>{if(!k.current||!R.current)return;const A={placement:t,strategy:n,middleware:h};M.current&&(A.platform=M.current),aT(k.current,R.current,A).then(Z=>{const P={...Z,isPositioned:N.current!==!1};F.current&&!Ms(C.current,P)&&(C.current=P,Yt.flushSync(()=>{d(P)}))})},[h,t,n,M,N]);is(()=>{c===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,d(A=>({...A,isPositioned:!1})))},[c]);const F=m.useRef(!1);is(()=>(F.current=!0,()=>{F.current=!1}),[]),is(()=>{if(w&&(k.current=w),S&&(R.current=S),w&&S){if(I.current)return I.current(w,S,T);T()}},[w,S,T,I,_]);const O=m.useMemo(()=>({reference:k,floating:R,setReference:g,setFloating:v}),[g,v]),D=m.useMemo(()=>({reference:w,floating:S}),[w,S]),z=m.useMemo(()=>{const A={position:n,left:0,top:0};if(!D.floating)return A;const Z=hu(D.floating,u.x),P=hu(D.floating,u.y);return a?{...A,transform:"translate("+Z+"px, "+P+"px)",...Nm(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Z,top:P}},[n,a,D.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:T,refs:O,elements:D,floatingStyles:z}),[u,T,O,D,z])}const dT=(e,t)=>{const n=tT(e);return{name:n.name,fn:n.fn,options:[e,t]}},fT=(e,t)=>{const n=nT(e);return{name:n.name,fn:n.fn,options:[e,t]}},pT=(e,t)=>({fn:iT(e).fn,options:[e,t]}),mT=(e,t)=>{const n=rT(e);return{name:n.name,fn:n.fn,options:[e,t]}},hT=(e,t)=>{const n=oT(e);return{name:n.name,fn:n.fn,options:[e,t]}},gT=(e,t)=>{const n=sT(e);return{name:n.name,fn:n.fn,options:[e,t]}},vT={intentional:"onClick",sloppy:"onPointerDown"};function bT(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function jm(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("referenceElement"),i=n.useState("domReferenceElement"),{onOpenChange:a,dataRef:l}=n.context,{enabled:c=!0,escapeKey:u=!0,outsidePress:d=!0,outsidePressEvent:h="sloppy",referencePress:p=!1,referencePressEvent:b="sloppy",ancestorScroll:x=!1,bubbles:E,externalTree:y}=t,g=Yn(y),v=de(typeof d=="function"?d:()=>!1),w=typeof d=="function"?v:d,S=m.useRef(!1),{escapeKey:k,outsidePress:R}=bT(E),C=m.useRef(null),_=Dt(),I=Dt(),M=de(()=>{I.clear(),l.current.insideReactTree=!1}),N=m.useRef(!1),T=m.useRef(""),F=de(L=>{T.current=L.pointerType}),O=de(()=>{const L=T.current,ae=L==="pen"||!L?"mouse":L,te=typeof h=="function"?h():h;return typeof te=="string"?te:te[ae]}),D=de(L=>{if(!r||!c||!u||L.key!=="Escape"||N.current)return;const ae=l.current.floatingContext?.nodeId,te=g?Zn(g.nodesRef.current,ae):[];if(!k&&te.length>0){let X=!0;if(te.forEach(oe=>{oe.context?.open&&!oe.context.dataRef.current.__escapeKeyBubbles&&(X=!1)}),!X)return}const ye=DC(L)?L.nativeEvent:L,pe=Me(Ks,ye);n.setOpen(!1,pe),!k&&!pe.isPropagationAllowed&&L.stopPropagation()}),z=de(L=>{const ae=O();return ae==="intentional"&&L.type!=="click"||ae==="sloppy"&&L.type==="click"}),A=de(()=>{l.current.insideReactTree=!0,I.start(0,M)}),Z=de((L,ae=!1)=>{if(z(L)){M();return}if(l.current.insideReactTree){M();return}if(O()==="intentional"&&ae||typeof w=="function"&&!w(L))return;const te=ct(L),ye=`[${kr("inert")}]`,pe=Xe(n.select("floatingElement")).querySelectorAll(ye),X=n.context.triggerElements;if(te&&(X.hasElement(te)||X.hasMatchingElement(H=>Pe(H,te))))return;let oe=Ne(te)?te:null;for(;oe&&!on(oe);){const H=cn(oe);if(on(H)||!Ne(H))break;oe=H}if(pe.length&&Ne(te)&&!NC(te)&&!Pe(te,n.select("floatingElement"))&&Array.from(pe).every(H=>!Pe(oe,H)))return;if(Ge(te)&&!("touches"in L)){const H=on(te),ge=Rt(te),Q=/auto|scroll/,le=H||Q.test(ge.overflowX),$=H||Q.test(ge.overflowY),be=le&&te.clientWidth>0&&te.scrollWidth>te.clientWidth,Ae=$&&te.clientHeight>0&&te.scrollHeight>te.clientHeight,Te=ge.direction==="rtl",et=Ae&&(Te?L.offsetX<=te.offsetWidth-te.clientWidth:L.offsetX>te.clientWidth),rt=be&&L.offsetY>te.clientHeight;if(et||rt)return}const ke=l.current.floatingContext?.nodeId,we=g&&Zn(g.nodesRef.current,ke).some(H=>Gt(L,H.context?.elements.floating));if(Gt(L,n.select("floatingElement"))||Gt(L,n.select("domReferenceElement"))||we)return;const Re=g?Zn(g.nodesRef.current,ke):[];if(Re.length>0){let H=!0;if(Re.forEach(ge=>{ge.context?.open&&!ge.context.dataRef.current.__outsidePressBubbles&&(H=!1)}),!H)return}n.setOpen(!1,Me(lc,L)),M()}),P=de(L=>{O()!=="sloppy"||L.pointerType==="touch"||!n.select("open")||!c||Gt(L,n.select("floatingElement"))||Gt(L,n.select("domReferenceElement"))||Z(L)}),B=de(L=>{if(O()!=="sloppy"||!n.select("open")||!c||Gt(L,n.select("floatingElement"))||Gt(L,n.select("domReferenceElement")))return;const ae=L.touches[0];ae&&(C.current={startTime:Date.now(),startX:ae.clientX,startY:ae.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},_.start(1e3,()=>{C.current&&(C.current.dismissOnTouchEnd=!1,C.current.dismissOnMouseDown=!1)}))}),U=de(L=>{const ae=ct(L);function te(){B(L),ae?.removeEventListener(L.type,te)}ae?.addEventListener(L.type,te)}),q=de(L=>{const ae=S.current;if(S.current=!1,_.clear(),L.type==="mousedown"&&C.current&&!C.current.dismissOnMouseDown)return;const te=ct(L);function ye(){L.type==="pointerdown"?P(L):Z(L,ae),te?.removeEventListener(L.type,ye)}te?.addEventListener(L.type,ye)}),he=de(L=>{if(O()!=="sloppy"||!C.current||Gt(L,n.select("floatingElement"))||Gt(L,n.select("domReferenceElement")))return;const ae=L.touches[0];if(!ae)return;const te=Math.abs(ae.clientX-C.current.startX),ye=Math.abs(ae.clientY-C.current.startY),pe=Math.sqrt(te*te+ye*ye);pe>5&&(C.current.dismissOnTouchEnd=!0),pe>10&&(Z(L),_.clear(),C.current=null)}),ee=de(L=>{const ae=ct(L);function te(){he(L),ae?.removeEventListener(L.type,te)}ae?.addEventListener(L.type,te)}),Y=de(L=>{O()!=="sloppy"||!C.current||Gt(L,n.select("floatingElement"))||Gt(L,n.select("domReferenceElement"))||(C.current.dismissOnTouchEnd&&Z(L),_.clear(),C.current=null)}),ie=de(L=>{const ae=ct(L);function te(){Y(L),ae?.removeEventListener(L.type,te)}ae?.addEventListener(L.type,te)});m.useEffect(()=>{if(!r||!c)return;l.current.__escapeKeyBubbles=k,l.current.__outsidePressBubbles=R;const L=new _n;function ae(oe){n.setOpen(!1,Me(cc,oe))}function te(){L.clear(),N.current=!0}function ye(){L.start(Qs()?5:0,()=>{N.current=!1})}const pe=Xe(o);pe.addEventListener("pointerdown",F,!0),u&&(pe.addEventListener("keydown",D),pe.addEventListener("compositionstart",te),pe.addEventListener("compositionend",ye)),w&&(pe.addEventListener("click",q,!0),pe.addEventListener("pointerdown",q,!0),pe.addEventListener("touchstart",U,!0),pe.addEventListener("touchmove",ee,!0),pe.addEventListener("touchend",ie,!0),pe.addEventListener("mousedown",q,!0));let X=[];return x&&(Ne(i)&&(X=Sn(i)),Ne(o)&&(X=X.concat(Sn(o))),!Ne(s)&&s&&s.contextElement&&(X=X.concat(Sn(s.contextElement)))),X=X.filter(oe=>oe!==pe.defaultView?.visualViewport),X.forEach(oe=>{oe.addEventListener("scroll",ae,{passive:!0})}),()=>{pe.removeEventListener("pointerdown",F,!0),u&&(pe.removeEventListener("keydown",D),pe.removeEventListener("compositionstart",te),pe.removeEventListener("compositionend",ye)),w&&(pe.removeEventListener("click",q,!0),pe.removeEventListener("pointerdown",q,!0),pe.removeEventListener("touchstart",U,!0),pe.removeEventListener("touchmove",ee,!0),pe.removeEventListener("touchend",ie,!0),pe.removeEventListener("mousedown",q,!0)),X.forEach(oe=>{oe.removeEventListener("scroll",ae)}),L.clear()}},[l,o,s,i,u,w,r,a,x,c,k,R,D,Z,q,P,U,ee,ie,F,n]),m.useEffect(M,[w,M]);const K=m.useMemo(()=>({onKeyDown:D,...p&&{[vT[b]]:L=>{n.setOpen(!1,Me(xr,L.nativeEvent))},...b!=="intentional"&&{onClick(L){n.setOpen(!1,Me(xr,L.nativeEvent))}}}}),[D,n,p,b]),J=de(L=>{const ae=ct(L.nativeEvent);!Pe(n.select("floatingElement"),ae)||L.button!==0||(S.current=!0)}),fe=m.useMemo(()=>({onKeyDown:D,onPointerDown:J,onMouseDown:J,onMouseUp:J,onClickCapture:A,onMouseDownCapture:A,onPointerDownCapture:A,onMouseUpCapture:A,onTouchEndCapture:A,onTouchMoveCapture:A}),[D,J,A]);return m.useMemo(()=>c?{reference:K,floating:fe,trigger:K}:{},[c,K,fe])}var Ns=Symbol("NOT_FOUND");function yT(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function xT(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function wT(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var gu=e=>Array.isArray(e)?e:[e];function ET(e){const t=Array.isArray(e[0])?e[0]:e;return wT(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function ST(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}function kT(e){let t;return{get(n){return t&&e(t.key,n)?t.value:Ns},put(n,r){t={key:n,value:r}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function CT(e,t){let n=[];function r(a){const l=n.findIndex(c=>t(a,c.key));if(l>-1){const c=n[l];return l>0&&(n.splice(l,1),n.unshift(c)),c.value}return Ns}function o(a,l){r(a)===Ns&&(n.unshift({key:a,value:l}),n.length>e&&n.pop())}function s(){return n}function i(){n=[]}return{get:r,put:o,getEntries:s,clear:i}}var RT=(e,t)=>e===t;function TT(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;const{length:o}=n;for(let s=0;s<o;s++)if(!e(n[s],r[s]))return!1;return!0}}function _T(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:r=RT,maxSize:o=1,resultEqualityCheck:s}=n,i=TT(r);let a=0;const l=o<=1?kT(i):CT(o,i);function c(){let u=l.get(arguments);if(u===Ns){if(u=e.apply(null,arguments),a++,s){const h=l.getEntries().find(p=>s(p.value,u));h&&(u=h.value,a!==0&&a--)}l.put(arguments,u)}return u}return c.clearCache=()=>{l.clear(),c.resetResultsCount()},c.resultsCount=()=>a,c.resetResultsCount=()=>{a=0},c}var PT=class{constructor(e){this.value=e}deref(){return this.value}},IT=typeof WeakRef<"u"?WeakRef:PT,AT=0,vu=1;function Zo(){return{s:AT,v:void 0,o:null,p:null}}function Dm(e,t={}){let n=Zo();const{resultEqualityCheck:r}=t;let o,s=0;function i(){let a=n;const{length:l}=arguments;for(let d=0,h=l;d<h;d++){const p=arguments[d];if(typeof p=="function"||typeof p=="object"&&p!==null){let b=a.o;b===null&&(a.o=b=new WeakMap);const x=b.get(p);x===void 0?(a=Zo(),b.set(p,a)):a=x}else{let b=a.p;b===null&&(a.p=b=new Map);const x=b.get(p);x===void 0?(a=Zo(),b.set(p,a)):a=x}}const c=a;let u;if(a.s===vu)u=a.v;else if(u=e.apply(null,arguments),s++,r){const d=o?.deref?.()??o;d!=null&&r(d,u)&&(u=d,s!==0&&s--),o=typeof u=="object"&&u!==null||typeof u=="function"?new IT(u):u}return c.s=vu,c.v=u,u}return i.clearCache=()=>{n=Zo(),i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function zm(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...o)=>{let s=0,i=0,a,l={},c=o.pop();typeof c=="object"&&(l=c,c=o.pop()),yT(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const u={...n,...l},{memoize:d,memoizeOptions:h=[],argsMemoize:p=Dm,argsMemoizeOptions:b=[]}=u,x=gu(h),E=gu(b),y=ET(o),g=d(function(){return s++,c.apply(null,arguments)},...x),v=p(function(){i++;const S=ST(y,arguments);return a=g.apply(null,S),a},...E);return Object.assign(v,{resultFunc:c,memoizedResultFunc:g,dependencies:y,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:d,argsMemoize:p})};return Object.assign(r,{withTypes:()=>r}),r}var OT=zm(Dm),MT=Object.assign((e,t=OT)=>{xT(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(s=>e[s]);return t(r,(...s)=>s.reduce((i,a,l)=>(i[n[l]]=a,i),{}))},{withTypes:()=>MT});zm({memoize:_T,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const ve=(e,t,n,r,o,s,...i)=>{if(i.length>0)throw new Error(Bt(1));let a;if(e)a=e;else throw new Error("Missing arguments");return a};var Wi={exports:{}},Hi={};var bu;function NT(){if(bu)return Hi;bu=1;var e=Rd(),t=Ap();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,l=e.useDebugValue;return Hi.useSyncExternalStoreWithSelector=function(c,u,d,h,p){var b=s(null);if(b.current===null){var x={hasValue:!1,value:null};b.current=x}else x=b.current;b=a(function(){function y(k){if(!g){if(g=!0,v=k,k=h(k),p!==void 0&&x.hasValue){var R=x.value;if(p(R,k))return w=R}return w=k}if(R=w,r(v,k))return R;var C=h(k);return p!==void 0&&p(R,C)?(v=k,R):(v=k,w=C)}var g=!1,v,w,S=d===void 0?null:d;return[function(){return y(u())},S===null?void 0:function(){return y(S())}]},[u,d,h,p]);var E=o(c,b[0],b[1]);return i(function(){x.hasValue=!0,x.value=E},[E]),l(E),E},Hi}var yu;function jT(){return yu||(yu=1,Wi.exports=NT()),Wi.exports}var DT=jT();const zT=ic(19),LT=zT?FT:BT;function $T(e,t,n,r,o){return LT(e,t,n,r,o)}function FT(e,t,n,r,o){const s=m.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return ik.useSyncExternalStore(e.subscribe,s,s)}function BT(e,t,n,r,o){return DT.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class eo{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){eo.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||eo.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){const t={...this.state};eo.prototype.setState.call(this,t)}}class xc extends eo{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}controlledValues=new Map;useSyncedValue(t,n){m.useDebugValue(t),ue(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){ue(()=>(this.state[t]!==n&&this.set(t,n),()=>{this.set(t,void 0)}),[t,n])}useSyncedValues(t){const n=Object.values(t);ue(()=>{this.update(t)},n)}useControlledProp(t,n,r){m.useDebugValue(t);const o=n!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,o),!o&&!Object.is(this.state[t],r)&&super.setState({...this.state,[t]:r})),ue(()=>{o&&!Object.is(this.state[t],n)&&super.setState({...this.state,[t]:n})},[t,n,r,o])}set(t,n){this.controlledValues.get(t)!==!0&&super.set(t,n)}update(t){const n={...t};for(const r in n)if(Object.hasOwn(n,r)&&this.controlledValues.get(r)===!0){delete n[r];continue}super.update(n)}setState(t){const n={...t};for(const r in n)if(Object.hasOwn(n,r)&&this.controlledValues.get(r)===!0){delete n[r];continue}super.setState({...this.state,...n})}select=(t,n,r,o)=>{const s=this.selectors[t];return s(this.state,n,r,o)};useState=(t,n,r,o)=>{m.useDebugValue(t);const s=this.selectors[t];return $T(this,s,n,r,o)};useContextCallback(t,n){m.useDebugValue(t);const r=de(n??Fp);this.context[t]=r}useStateSetter(t){const n=m.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return n(o,o,this),this.subscribe(s=>{const i=r(s);if(!Object.is(o,i)){const a=o;o=i,n(i,a,this)}})}}const VT={open:ve(e=>e.open),domReferenceElement:ve(e=>e.domReferenceElement),referenceElement:ve(e=>e.positionReference??e.referenceElement),floatingElement:ve(e=>e.floatingElement),floatingId:ve(e=>e.floatingId)};class wc extends xc{constructor(t){const{nested:n,noEmit:r,onOpenChange:o,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:vm(),nested:n,noEmit:r,triggerElements:s},VT)}setOpen=(t,n)=>{if((!t||!this.state.open||zC(n.event))&&(this.context.dataRef.current.openEvent=t?n.event:void 0),!this.context.noEmit){const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)}this.context.onOpenChange?.(t,n)}}function ZT(e,t){const n=m.useRef(null);return m.useCallback(r=>{if(e!==void 0&&(n.current!==null&&(t.context.triggerElements.delete(n.current),n.current=null),r!==null))return n.current=e,t.context.triggerElements.add(e,r),()=>{n.current!==null&&(t.context.triggerElements.delete(n.current),n.current=null)}},[t,e])}function UT(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=ZT(e,n),i=de(a=>{const l=s(a);return a!==null&&n.select("open")&&n.select("activeTriggerId")==null&&n.update({activeTriggerId:e,activeTriggerElement:a,...r}),l});return ue(()=>{o&&n.update({activeTriggerElement:t.current,...r})},[o,n,t,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:o}}function Lm(e){const t=e.useState("open");ue(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[r,o]=n.value;e.update({activeTriggerId:r,activeTriggerElement:o})}}},[t,e])}function $m(e,t,n){const{mounted:r,setMounted:o,transitionStatus:s}=EC(e);t.useSyncedValues({mounted:r,transitionStatus:s});const i=de(()=>{o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),a=t.useState("preventUnmountingOnClose");return pc({enabled:!a,open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:s}}class oi{constructor(){this.elements=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);r!==n&&(r!==void 0&&this.elements.delete(r),this.elements.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elements.delete(n),this.idMap.delete(t))}hasElement(t){return this.elements.has(t)}hasMatchingElement(t){for(const n of this.elements)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function WT(){return new wc({open:!1,floatingElement:null,referenceElement:null,triggerElements:new oi,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function Fm(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:WT(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:bt,inactiveTriggerProps:bt,popupProps:bt}}const Bm={open:ve(e=>e.open),mounted:ve(e=>e.mounted),transitionStatus:ve(e=>e.transitionStatus),floatingRootContext:ve(e=>e.floatingRootContext),preventUnmountingOnClose:ve(e=>e.preventUnmountingOnClose),payload:ve(e=>e.payload),activeTriggerId:ve(e=>e.activeTriggerId),activeTriggerElement:ve(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:ve((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:ve((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:ve((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:ve((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:ve(e=>e.popupProps),popupElement:ve(e=>e.popupElement),positionerElement:ve(e=>e.positionerElement)};function HT(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=On(),s=jn()!=null,i=jt(()=>new wc({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new oi,floatingId:o,nested:s,noEmit:e.noEmit||!1})).current;return ue(()=>{const a={open:t,floatingId:o};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=Ne(r.reference)?r.reference:null),r.floating!==void 0&&(a.floatingElement=r.floating),i.update(a)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=e.noEmit||!1,i}function GT(e={}){const{nodeId:t,externalTree:n}=e,r=HT(e),o=e.rootContext||r,s={reference:o.useState("referenceElement"),floating:o.useState("floatingElement"),domReference:o.useState("domReferenceElement")},[i,a]=m.useState(null),l=m.useRef(null),c=Yn(n);ue(()=>{s.domReference&&(l.current=s.domReference)},[s.domReference]);const u=uT({...e,elements:{...s,...i&&{reference:i}}}),d=m.useCallback(R=>{const C=Ne(R)?{getBoundingClientRect:()=>R.getBoundingClientRect(),getClientRects:()=>R.getClientRects(),contextElement:R}:R;a(C),u.refs.setReference(C)},[u.refs]),[h,p]=m.useState(null),[b,x]=m.useState(null);o.useSyncedValue("referenceElement",h),o.useSyncedValue("domReferenceElement",Ne(h)?h:null),o.useSyncedValue("floatingElement",b);const E=m.useCallback(R=>{(Ne(R)||R===null)&&(l.current=R,p(R)),(Ne(u.refs.reference.current)||u.refs.reference.current===null||R!==null&&!Ne(R))&&u.refs.setReference(R)},[u.refs,p]),y=m.useCallback(R=>{x(R),u.refs.setFloating(R)},[u.refs]),g=m.useMemo(()=>({...u.refs,setReference:E,setFloating:y,setPositionReference:d,domReference:l}),[u.refs,E,y,d]),v=m.useMemo(()=>({...u.elements,domReference:s.domReference}),[u.elements,s.domReference]),w=o.useState("open"),S=o.useState("floatingId"),k=m.useMemo(()=>({...u,dataRef:o.context.dataRef,open:w,onOpenChange:o.setOpen,events:o.context.events,floatingId:S,refs:g,elements:v,nodeId:t,rootStore:o}),[u,g,v,t,o,w,S]);return ue(()=>{o.context.dataRef.current.floatingContext=k;const R=c?.nodesRef.current.find(C=>C.id===t);R&&(R.context=k)}),m.useMemo(()=>({...u,context:k,refs:g,elements:v,rootStore:o}),[u,g,v,k,o])}function Vm(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:o}=e,s=On(),i=jn()!=null,a=t.useState("open"),l=t.useState("activeTriggerElement"),c=t.useState(r?"popupElement":"positionerElement"),u=t.context.triggerElements,d=jt(()=>new wc({open:a,referenceElement:l,floatingElement:c,triggerElements:u,onOpenChange:o,floatingId:s,nested:i,noEmit:n})).current;return ue(()=>{const h={open:a,floatingId:s,referenceElement:l,floatingElement:c};Ne(l)&&(h.domReferenceElement=l),d.update(h)},[a,s,l,c,d]),d.context.onOpenChange=o,d.context.nested=i,d.context.noEmit=n,d}const Gi=IC&&Xp;function qT(e,t={}){const n="rootStore"in e?e.rootStore:e,{events:r,dataRef:o}=n.context,{enabled:s=!0,visibleOnly:i=!0}=t,a=m.useRef(!1),l=Dt(),c=m.useRef(!0);m.useEffect(()=>{const d=n.select("domReferenceElement");if(!s)return;const h=Qe(d);function p(){!n.select("open")&&Ge(d)&&d===rn(Xe(d))&&(a.current=!0)}function b(){c.current=!0}function x(){c.current=!1}return h.addEventListener("blur",p),Gi&&(h.addEventListener("keydown",b,!0),h.addEventListener("pointerdown",x,!0)),()=>{h.removeEventListener("blur",p),Gi&&(h.removeEventListener("keydown",b,!0),h.removeEventListener("pointerdown",x,!0))}},[n,s]),m.useEffect(()=>{if(!s)return;function d(h){(h.reason===xr||h.reason===Ks)&&(a.current=!0)}return r.on("openchange",d),()=>{r.off("openchange",d)}},[r,s]);const u=m.useMemo(()=>({onMouseLeave(){a.current=!1},onFocus(d){if(a.current)return;const h=ct(d.nativeEvent);if(i&&Ne(h)){if(Gi&&!d.relatedTarget){if(!c.current&&!rm(h))return}else if(!jC(h))return}n.setOpen(!0,Me(po,d.nativeEvent,d.currentTarget))},onBlur(d){a.current=!1;const h=d.relatedTarget,p=d.nativeEvent,b=Ne(h)&&h.hasAttribute(kr("focus-guard"))&&h.getAttribute("data-type")==="outside";l.start(0,()=>{const x=n.select("domReferenceElement"),E=rn(x?x.ownerDocument:document);!h&&E===x||Pe(o.current.floatingContext?.refs.floating.current,E)||Pe(x,E)||b||n.context.triggerElements.hasElement(d.relatedTarget)||n.setOpen(!1,Me(po,p))})}}),[o,n,i,l]);return m.useMemo(()=>s?{reference:u,trigger:u}:{},[s,u])}const ja=kr("safe-polygon"),YT=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${nm}`;function KT(e){return e?!!e.closest(YT):!1}function Zm(e){const t=m.useRef(void 0),n=m.useRef(!1),r=m.useRef(void 0),o=m.useRef(!0),s=m.useRef(!1),i=m.useRef(()=>{}),a=m.useRef(!1),l=Dt(),c=Dt(),u=m.useRef(void 0);return m.useMemo(()=>{const d=e.context.dataRef.current;return d.hoverInteractionState||(d.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:n,handlerRef:r,blockMouseMoveRef:o,performedPointerEventsMutationRef:s,unbindMouseMoveRef:i,restTimeoutPendingRef:a,openChangeTimeout:l,restTimeout:c,handleCloseOptionsRef:u}),d.hoverInteractionState},[e,t,n,r,o,s,i,a,l,c,u])}const JT=new Set(["click","mousedown"]);function Um(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:a=!0,closeDelay:l=0,externalTree:c}=t,{pointerTypeRef:u,interactedInsideRef:d,handlerRef:h,performedPointerEventsMutationRef:p,unbindMouseMoveRef:b,restTimeoutPendingRef:x,openChangeTimeout:E,handleCloseOptionsRef:y}=Zm(n),g=Yn(c),v=jn(),w=de(()=>d.current?!0:i.current.openEvent?JT.has(i.current.openEvent.type):!1),S=de(()=>{const I=i.current.openEvent?.type;return I?.includes("mouse")&&I!=="mousedown"}),k=m.useCallback((I,M=!0)=>{const N=XT(l,u.current);N&&!h.current?E.start(N,()=>n.setOpen(!1,Me(kt,I))):M&&(E.clear(),n.setOpen(!1,Me(kt,I)))},[l,h,n,u,E]),R=de(()=>{b.current(),h.current=void 0}),C=de(()=>{if(p.current){const I=Xe(o).body;I.style.pointerEvents="",I.removeAttribute(ja),p.current=!1}}),_=de(I=>{const M=ct(I);if(!KT(M)){d.current=!1;return}d.current=!0});ue(()=>{r||(u.current=void 0,x.current=!1,d.current=!1,R(),C())},[r,u,x,d,R,C]),m.useEffect(()=>()=>{R()},[R]),m.useEffect(()=>C,[C]),ue(()=>{if(a&&r&&y.current?.blockPointerEvents&&S()&&Ne(s)&&o){p.current=!0;const I=Xe(o).body;I.setAttribute(ja,"");const M=s,N=o,T=g?.nodesRef.current.find(F=>F.id===v)?.context?.elements.floating;return T&&(T.style.pointerEvents=""),I.style.pointerEvents="none",M.style.pointerEvents="auto",N.style.pointerEvents="auto",()=>{I.style.pointerEvents="",M.style.pointerEvents="",N.style.pointerEvents=""}}},[a,r,s,o,y,S,g,v,p]),m.useEffect(()=>{if(!a)return;function I(F){if(w()||!i.current.floatingContext)return;const O=n.context.triggerElements;F.relatedTarget&&O.hasElement(F.relatedTarget)||(C(),R(),w()||k(F))}function M(F){E.clear(),C(),h.current?.(F),R()}function N(F){w()||k(F,!1)}const T=o;return T&&(T.addEventListener("mouseleave",I),T.addEventListener("mouseenter",M),T.addEventListener("mouseleave",N),T.addEventListener("pointerdown",_,!0)),()=>{T&&(T.removeEventListener("mouseleave",I),T.removeEventListener("mouseenter",M),T.removeEventListener("mouseleave",N),T.removeEventListener("pointerdown",_,!0))}})}function XT(e,t){return t&&!mo(t)?0:typeof e=="function"?e():e}function qi(e){return typeof e=="function"?e():e}const QT={current:null};function e_(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:r,events:o}=n.context,{enabled:s=!0,delay:i=0,handleClose:a=null,mouseOnly:l=!1,restMs:c=0,move:u=!0,triggerElementRef:d=QT,externalTree:h,isActiveTrigger:p=!0}=t,b=Yn(h),{pointerTypeRef:x,interactedInsideRef:E,handlerRef:y,blockMouseMoveRef:g,performedPointerEventsMutationRef:v,unbindMouseMoveRef:w,restTimeoutPendingRef:S,openChangeTimeout:k,restTimeout:R,handleCloseOptionsRef:C}=Zm(n),_=at(a),I=at(i),M=at(c);p&&(C.current=_.current?.__options);const N=de(()=>E.current?!0:r.current.openEvent?["click","mousedown"].includes(r.current.openEvent.type):!1),T=m.useCallback((z,A=!0)=>{const Z=os(I.current,"close",x.current);Z&&!y.current?k.start(Z,()=>n.setOpen(!1,Me(kt,z))):A&&(k.clear(),n.setOpen(!1,Me(kt,z)))},[I,y,n,x,k]),F=de(()=>{w.current(),y.current=void 0}),O=de(()=>{if(v.current){const z=Xe(n.select("domReferenceElement")).body;z.style.pointerEvents="",z.removeAttribute(ja),v.current=!1}});m.useEffect(()=>{if(!s)return;function z(A){A.open||(k.clear(),R.clear(),g.current=!0,S.current=!1)}return o.on("openchange",z),()=>{o.off("openchange",z)}},[s,o,k,R,g,S]);const D=de(z=>{if(N()||!r.current.floatingContext)return;const A=n.context.triggerElements;z.relatedTarget&&A.hasElement(z.relatedTarget)||_.current?.({...r.current.floatingContext,tree:b,x:z.clientX,y:z.clientY,onClose(){O(),F(),N()||T(z)}})(z)});return m.useEffect(()=>{if(!s)return;const z=d.current??(p?n.select("domReferenceElement"):null);if(!Ne(z))return;function A(B){if(k.clear(),g.current=!1,l&&!mo(x.current)||qi(M.current)>0&&!os(I.current,"open"))return;const U=os(I.current,"open",x.current),q=n.select("domReferenceElement"),he=n.context.triggerElements,ee=(he.hasElement(B.target)||he.hasMatchingElement(ie=>Pe(ie,B.target)))&&(!q||!Pe(q,B.target)),Y=B.currentTarget??null;U?k.start(U,()=>{n.select("open")||n.setOpen(!0,Me(kt,B,Y))}):(!n.select("open")||ee)&&n.setOpen(!0,Me(kt,B,Y))}function Z(B){if(N()){O();return}w.current();const U=n.select("domReferenceElement"),q=Xe(U);R.clear(),S.current=!1;const he=n.context.triggerElements;if(B.relatedTarget&&he.hasElement(B.relatedTarget))return;if(_.current&&r.current.floatingContext){n.select("open")||k.clear(),y.current=_.current({...r.current.floatingContext,tree:b,x:B.clientX,y:B.clientY,onClose(){O(),F(),N()||T(B,!0)}});const Y=y.current;Y(B),q.addEventListener("mousemove",Y),w.current=()=>{q.removeEventListener("mousemove",Y)};return}(x.current!=="touch"||!Pe(n.select("floatingElement"),B.relatedTarget))&&T(B)}function P(B){D(B)}return n.select("open")&&z.addEventListener("mouseleave",P),u&&z.addEventListener("mousemove",A,{once:!0}),z.addEventListener("mouseenter",A),z.addEventListener("mouseleave",Z),()=>{z.removeEventListener("mouseleave",P),u&&z.removeEventListener("mousemove",A),z.removeEventListener("mouseenter",A),z.removeEventListener("mouseleave",Z)}},[F,O,g,r,I,T,n,s,_,D,p,N,l,u,x,M,R,S,k,d,b,w,y]),m.useMemo(()=>{function z(A){x.current=A.pointerType}return{onPointerDown:z,onPointerEnter:z,onMouseMove(A){const{nativeEvent:Z}=A,P=A.currentTarget,B=n.select("domReferenceElement"),U=n.context.triggerElements,q=n.select("open"),he=(U.hasElement(A.target)||U.hasMatchingElement(Y=>Pe(Y,A.target)))&&(!B||!Pe(B,A.target));if(l&&!mo(x.current)||q&&!he||qi(M.current)===0||!he&&S.current&&A.movementX**2+A.movementY**2<2)return;R.clear();function ee(){!g.current&&(!q||he)&&n.setOpen(!0,Me(kt,Z,P))}x.current==="touch"?Yt.flushSync(()=>{ee()}):he&&q?ee():(S.current=!0,R.start(qi(M.current),ee))}}},[g,l,n,x,M,R,S])}function Wm(e=[]){const t=e.map(c=>c?.reference),n=e.map(c=>c?.floating),r=e.map(c=>c?.item),o=e.map(c=>c?.trigger),s=m.useCallback(c=>Uo(c,e,"reference"),t),i=m.useCallback(c=>Uo(c,e,"floating"),n),a=m.useCallback(c=>Uo(c,e,"item"),r),l=m.useCallback(c=>Uo(c,e,"trigger"),o);return m.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:a,getTriggerProps:l}),[s,i,a,l])}function Uo(e,t,n){const r=new Map,o=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[Pa]="");for(const i in e)o&&e&&(i===em||i===tm)||(s[i]=e[i]);for(let i=0;i<t.length;i+=1){let a;const l=t[i]?.[n];typeof l=="function"?a=e?l(e):null:a=l,a&&xu(s,a,o,r)}return xu(s,e,o,r),s}function xu(e,t,n,r){for(const o in t){const s=t[o];n&&(o===em||o===tm)||(o.startsWith("on")?(r.has(o)||r.set(o,[]),typeof s=="function"&&(r.get(o)?.push(s),e[o]=(...i)=>r.get(o)?.map(a=>a(...i)).find(a=>a!==void 0))):e[o]=s)}}const t_="Escape";function si(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Wo(e,t){return si(t,e===mc||e===xo,e===kn||e===Cn)}function Yi(e,t,n){return si(t,e===xo,n?e===kn:e===Cn)||e==="Enter"||e===" "||e===""}function n_(e,t,n){return si(t,n?e===kn:e===Cn,e===xo)}function r_(e,t,n,r){const o=n?e===Cn:e===kn,s=e===mc;return t==="both"||t==="horizontal"&&r&&r>1?e===t_:si(t,o,s)}function o_(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{listRef:a,activeIndex:l,onNavigate:c=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:h=!1,loopFocus:p=!1,nested:b=!1,rtl:x=!1,virtual:E=!1,focusItemOnOpen:y="auto",focusItemOnHover:g=!0,openOnArrowKeyDown:v=!0,disabledIndices:w=void 0,orientation:S="vertical",parentOrientation:k,cols:R=1,scrollItemIntoView:C=!0,itemSizes:_,dense:I=!1,id:M,resetOnPointerLeave:N=!0,externalTree:T}=t,F=Cs(o),O=at(F),D=jn(),z=Yn(T);ue(()=>{i.current.orientation=S},[i,S]);const A=Ia(s),Z=m.useRef(y),P=m.useRef(d??-1),B=m.useRef(null),U=m.useRef(!0),q=de(Q=>{c(P.current===-1?null:P.current,Q)}),he=m.useRef(q),ee=m.useRef(!!o),Y=m.useRef(r),ie=m.useRef(!1),K=m.useRef(!1),J=at(w),fe=at(r),L=at(C),ae=at(d),te=at(N),ye=de(()=>{function Q(Ae){E?z?.events.emit("virtualfocus",Ae):ss(Ae,{sync:ie.current,preventScroll:!0})}const le=a.current[P.current],$=K.current;le&&Q(le),(ie.current?Ae=>Ae():requestAnimationFrame)(()=>{const Ae=a.current[P.current]||le;if(!Ae)return;le||Q(Ae);const Te=L.current;Te&&X&&($||!U.current)&&Ae.scrollIntoView?.(typeof Te=="boolean"?{block:"nearest",inline:"nearest"}:Te)})});ue(()=>{u&&(r&&o?(P.current=d??-1,Z.current&&d!=null&&(K.current=!0,q())):ee.current&&(P.current=-1,he.current()))},[u,r,o,d,q]),ue(()=>{if(u){if(!r){ie.current=!1;return}if(o)if(l==null){if(ie.current=!1,ae.current!=null)return;if(ee.current&&(P.current=-1,ye()),(!Y.current||!ee.current)&&Z.current&&(B.current!=null||Z.current===!0&&B.current==null)){let Q=0;const le=()=>{a.current[0]==null?(Q<2&&(Q?requestAnimationFrame:queueMicrotask)(le),Q+=1):(P.current=B.current==null||Yi(B.current,S,x)||b?Fi(a):eu(a),B.current=null,q())};le()}}else Jr(a,l)||(P.current=l,ye(),K.current=!1)}},[u,r,o,l,ae,b,a,S,x,q,ye,J]),ue(()=>{if(!u||o||!z||E||!ee.current)return;const Q=z.nodesRef.current,le=Q.find(Ae=>Ae.id===D)?.context?.elements.floating,$=rn(Xe(o)),be=Q.some(Ae=>Ae.context&&Pe(Ae.context.elements.floating,$));le&&!be&&U.current&&le.focus({preventScroll:!0})},[u,o,z,D,E]),ue(()=>{he.current=q,Y.current=r,ee.current=!!o}),ue(()=>{r||(B.current=null,Z.current=y)},[r,y]);const pe=l!=null,X=m.useMemo(()=>{function Q($){if(!fe.current)return;const be=a.current.indexOf($.currentTarget);be!==-1&&P.current!==be&&(P.current=be,q($))}return{onFocus($){ie.current=!0,Q($)},onClick:({currentTarget:$})=>$.focus({preventScroll:!0}),onMouseMove($){ie.current=!0,K.current=!1,g&&Q($)},onPointerLeave($){if(!fe.current||!U.current||$.pointerType==="touch")return;ie.current=!0;const be=$.relatedTarget;!g||a.current.includes(be)||te.current&&(P.current=-1,q($),E||O.current?.focus({preventScroll:!0}))}}},[fe,O,g,a,q,te,E]),oe=m.useCallback(()=>k??z?.nodesRef.current.find(Q=>Q.id===D)?.context?.dataRef?.current.orientation,[D,z,k]),ke=de(Q=>{if(U.current=!1,ie.current=!0,Q.which===229||!fe.current&&Q.currentTarget===O.current)return;if(b&&r_(Q.key,S,x,R)){Wo(Q.key,oe())||it(Q),n.setOpen(!1,Me(rs,Q.nativeEvent)),Ge(s)&&(E?z?.events.emit("virtualfocus",s):s.focus());return}const le=P.current,$=Fi(a,w),be=eu(a,w);if(A||(Q.key==="Home"&&(it(Q),P.current=$,q(Q)),Q.key==="End"&&(it(Q),P.current=be,q(Q))),R>1){const Ae=_||Array.from({length:a.current.length},()=>({width:1,height:1})),Te=qC(Ae,R,I),et=Te.findIndex(ot=>ot!=null&&!Xr(a,ot,w)),rt=Te.reduce((ot,_t,Ee)=>_t!=null&&!Xr(a,_t,w)?Ee:ot,-1),nt=Te[GC({current:Te.map(ot=>ot!=null?a.current[ot]:null)},{event:Q,orientation:S,loopFocus:p,rtl:x,cols:R,disabledIndices:KC([...(typeof w!="function"?w:null)||a.current.map((ot,_t)=>Xr(a,_t,w)?_t:void 0),void 0],Te),minIndex:et,maxIndex:rt,prevIndex:YC(P.current>be?$:P.current,Ae,Te,R,Q.key===xo?"bl":Q.key===(x?kn:Cn)?"tr":"tl"),stopEvent:!0})];if(nt!=null&&(P.current=nt,q(Q)),S==="both")return}if(Wo(Q.key,S)){if(it(Q),r&&!E&&rn(Q.currentTarget.ownerDocument)===Q.currentTarget){P.current=Yi(Q.key,S,x)?$:be,q(Q);return}Yi(Q.key,S,x)?p?le>=be?h&&le!==a.current.length?P.current=-1:(ie.current=!1,P.current=$):P.current=ut(a,{startingIndex:le,disabledIndices:w}):P.current=Math.min(be,ut(a,{startingIndex:le,disabledIndices:w})):p?le<=$?h&&le!==-1?P.current=a.current.length:(ie.current=!1,P.current=be):P.current=ut(a,{startingIndex:le,decrement:!0,disabledIndices:w}):P.current=Math.max($,ut(a,{startingIndex:le,decrement:!0,disabledIndices:w})),Jr(a,P.current)&&(P.current=-1),q(Q)}}),we=m.useMemo(()=>E&&r&&pe&&{"aria-activedescendant":`${M}-${l}`},[E,r,pe,M,l]),Re=m.useMemo(()=>({"aria-orientation":S==="both"?void 0:S,...A?{}:we,onKeyDown(Q){if(Q.key==="Tab"&&Q.shiftKey&&r&&!E){const le=ct(Q.nativeEvent);if(le&&!Pe(O.current,le))return;it(Q),n.setOpen(!1,Me(Ys,Q.nativeEvent)),Ge(s)&&s.focus();return}ke(Q)},onPointerMove(){U.current=!0}}),[we,ke,O,S,A,n,r,E,s]),H=m.useMemo(()=>{function Q($){y==="auto"&&om($.nativeEvent)&&(Z.current=!E)}function le($){Z.current=y,y==="auto"&&sm($.nativeEvent)&&(Z.current=!0)}return{onKeyDown($){const be=n.select("open");U.current=!1;const Ae=$.key.startsWith("Arrow"),Te=n_($.key,oe(),x),et=Wo($.key,S),rt=(b?Te:et)||$.key==="Enter"||$.key.trim()==="";if(E&&be)return ke($);if(!(!be&&!v&&Ae)){if(rt){const nt=Wo($.key,oe());B.current=b&&nt?null:$.key}if(b){Te&&(it($),be?(P.current=Fi(a,J.current),q($)):n.setOpen(!0,Me(rs,$.nativeEvent,$.currentTarget)));return}et&&(ae.current!=null&&(P.current=ae.current),it($),!be&&v?n.setOpen(!0,Me(rs,$.nativeEvent,$.currentTarget)):ke($),be&&q($))}},onFocus($){n.select("open")&&!E&&(P.current=-1,q($))},onPointerDown:le,onPointerEnter:le,onMouseDown:Q,onClick:Q}},[ke,J,y,a,b,q,n,v,S,oe,x,ae,E]),ge=m.useMemo(()=>({...we,...H}),[we,H]);return m.useMemo(()=>u?{reference:ge,floating:Re,item:X,trigger:H}:{},[u,ge,Re,H,X])}const s_=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function i_(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingId"),s=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{enabled:a=!0,role:l="dialog"}=t,c=On(),u=s?.id||c,d=m.useMemo(()=>Cs(i)?.id||o,[i,o]),h=s_.get(l)??l,b=jn()!=null,x=m.useMemo(()=>h==="tooltip"||l==="label"?bt:{"aria-haspopup":h==="alertdialog"?"dialog":h,"aria-expanded":"false",...h==="listbox"&&{role:"combobox"},...h==="menu"&&b&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[h,b,l]),E=m.useMemo(()=>h==="tooltip"||l==="label"?{[`aria-${l==="label"?"labelledby":"describedby"}`]:r?d:void 0}:{...x,"aria-expanded":r?"true":"false","aria-controls":r?d:void 0,...h==="menu"&&{id:u}},[h,d,r,u,l,x]),y=m.useMemo(()=>{const v={id:d,...h&&{role:h}};return h==="tooltip"||l==="label"?v:{...v,...h==="menu"&&{"aria-labelledby":u}}},[h,d,u,l]),g=m.useCallback(({active:v,selected:w})=>{const S={role:"option",...v&&{id:`${d}-fui-option`}};switch(l){case"select":case"combobox":return{...S,"aria-selected":w}}return{}},[d,l]);return m.useMemo(()=>a?{reference:E,floating:y,item:g,trigger:x}:{},[a,E,y,x,g])}function a_(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.context.dataRef,{listRef:s,activeIndex:i,onMatch:a,onTypingChange:l,enabled:c=!0,findMatch:u=null,resetMs:d=750,ignoreKeys:h=Bp,selectedIndex:p=null}=t,b=Dt(),x=m.useRef(""),E=m.useRef(p??i??-1),y=m.useRef(null);ue(()=>{r&&(b.clear(),y.current=null,x.current="")},[r,b]),ue(()=>{r&&x.current===""&&(E.current=p??i??-1)},[r,p,i]);const g=de(k=>{k?o.current.typing||(o.current.typing=k,l?.(k)):o.current.typing&&(o.current.typing=k,l?.(k))}),v=de(k=>{function R(N,T,F){const O=u?u(T,F):T.find(D=>D?.toLocaleLowerCase().indexOf(F.toLocaleLowerCase())===0);return O?N.indexOf(O):-1}const C=s.current;if(x.current.length>0&&x.current[0]!==" "&&(R(C,C,x.current)===-1?g(!1):k.key===" "&&it(k)),C==null||h.includes(k.key)||k.key.length!==1||k.ctrlKey||k.metaKey||k.altKey)return;r&&k.key!==" "&&(it(k),g(!0)),C.every(N=>N?N[0]?.toLocaleLowerCase()!==N[1]?.toLocaleLowerCase():!0)&&x.current===k.key&&(x.current="",E.current=y.current),x.current+=k.key,b.start(d,()=>{x.current="",E.current=y.current,g(!1)});const I=E.current,M=R(C,[...C.slice((I||0)+1),...C.slice(0,(I||0)+1)],x.current);M!==-1?(a?.(M),y.current=M):k.key!==" "&&(x.current="",g(!1))}),w=m.useMemo(()=>({onKeyDown:v}),[v]),S=m.useMemo(()=>({onKeyDown:v,onKeyUp(k){k.key===" "&&g(!1)}}),[v,g]);return m.useMemo(()=>c?{reference:w,floating:S}:{},[c,w,S])}function wu(e,t){const[n,r]=e;let o=!1;const s=t.length;for(let i=0,a=s-1;i<s;a=i++){const[l,c]=t[i]||[0,0],[u,d]=t[a]||[0,0];c>=r!=d>=r&&n<=(u-l)*(r-c)/(d-c)+l&&(o=!o)}return o}function c_(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function l_(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,o=new _n;let s=!1,i=null,a=null,l=typeof performance<"u"?performance.now():0;function c(d,h){const p=performance.now(),b=p-l;if(i===null||a===null||b===0)return i=d,a=h,l=p,null;const x=d-i,E=h-a,g=Math.sqrt(x*x+E*E)/b;return i=d,a=h,l=p,g}const u=({x:d,y:h,placement:p,elements:b,onClose:x,nodeId:E,tree:y})=>function(v){function w(){o.clear(),x()}if(o.clear(),!b.domReference||!b.floating||p==null||d==null||h==null)return;const{clientX:S,clientY:k}=v,R=[S,k],C=ct(v),_=v.type==="mouseleave",I=Pe(b.floating,C),M=Pe(b.domReference,C),N=b.domReference.getBoundingClientRect(),T=b.floating.getBoundingClientRect(),F=p.split("-")[0],O=d>T.right-T.width/2,D=h>T.bottom-T.height/2,z=c_(R,N),A=T.width>N.width,Z=T.height>N.height,P=(A?N:T).left,B=(A?N:T).right,U=(Z?N:T).top,q=(Z?N:T).bottom;if(I&&(s=!0,!_))return;if(M&&(s=!1),M&&!_){s=!0;return}if(_&&Ne(v.relatedTarget)&&Pe(b.floating,v.relatedTarget)||y&&Zn(y.nodesRef.current,E).some(({context:Y})=>Y?.open))return;if(F==="top"&&h>=N.bottom-1||F==="bottom"&&h<=N.top+1||F==="left"&&d>=N.right-1||F==="right"&&d<=N.left+1)return w();let he=[];switch(F){case"top":he=[[P,N.top+1],[P,T.bottom-1],[B,T.bottom-1],[B,N.top+1]];break;case"bottom":he=[[P,T.top+1],[P,N.bottom-1],[B,N.bottom-1],[B,T.top+1]];break;case"left":he=[[T.right-1,q],[T.right-1,U],[N.left+1,U],[N.left+1,q]];break;case"right":he=[[N.right-1,q],[N.right-1,U],[T.left+1,U],[T.left+1,q]];break}function ee([Y,ie]){switch(F){case"top":{const K=[A?Y+t/2:O?Y+t*4:Y-t*4,ie+t+1],J=[A?Y-t/2:O?Y+t*4:Y-t*4,ie+t+1],fe=[[T.left,O||A?T.bottom-t:T.top],[T.right,O?A?T.bottom-t:T.top:T.bottom-t]];return[K,J,...fe]}case"bottom":{const K=[A?Y+t/2:O?Y+t*4:Y-t*4,ie-t],J=[A?Y-t/2:O?Y+t*4:Y-t*4,ie-t],fe=[[T.left,O||A?T.top+t:T.bottom],[T.right,O?A?T.top+t:T.bottom:T.top+t]];return[K,J,...fe]}case"left":{const K=[Y+t+1,Z?ie+t/2:D?ie+t*4:ie-t*4],J=[Y+t+1,Z?ie-t/2:D?ie+t*4:ie-t*4];return[...[[D||Z?T.right-t:T.left,T.top],[D?Z?T.right-t:T.left:T.right-t,T.bottom]],K,J]}case"right":{const K=[Y-t,Z?ie+t/2:D?ie+t*4:ie-t*4],J=[Y-t,Z?ie-t/2:D?ie+t*4:ie-t*4],fe=[[D||Z?T.left+t:T.right,T.top],[D?Z?T.left+t:T.right:T.left+t,T.bottom]];return[K,J,...fe]}default:return[]}}if(!wu([S,k],he)){if(s&&!z)return w();if(!_&&r){const Y=c(v.clientX,v.clientY);if(Y!==null&&Y<.1)return w()}wu([S,k],ee([d,h]))?!s&&r&&o.start(40,w):w()}};return u.__options={blockPointerEvents:n},u}const u_=m.createContext(void 0);function d_(e){return m.useContext(u_)}const Hm="ArrowUp",Gm="ArrowDown",qm="ArrowLeft",Ym="ArrowRight",Km="Home",Jm="End",f_=new Set([qm,Ym]),p_=new Set([Hm,Gm]),m_=new Set([...f_,...p_]);[...m_];const h_=new Set([Hm,Gm,qm,Ym,Km,Jm]);function Ec(e){return e==="starting"?zk:bt}const g_={...qs,...Vp},v_=m.forwardRef(function(t,n){const{render:r,className:o,finalFocus:s,...i}=t,{store:a}=_r(),{side:l,align:c}=jp(),u=d_()!=null,d=a.useState("open"),h=a.useState("transitionStatus"),p=a.useState("popupProps"),b=a.useState("mounted"),x=a.useState("instantType"),E=a.useState("activeTriggerElement"),y=a.useState("parent"),g=a.useState("lastOpenChangeReason"),v=a.useState("rootId"),w=a.useState("floatingRootContext"),S=a.useState("floatingTreeRoot"),k=a.useState("closeDelay"),R=a.useState("activeTriggerElement");pc({open:d,ref:a.context.popupRef,onComplete(){d&&a.context.onOpenChangeComplete?.(!0)}}),m.useEffect(()=>{function T(F){a.setOpen(!1,Me(F.reason,F.domEvent))}return S.events.on("close",T),()=>{S.events.off("close",T)}},[S.events,a]);const C=a.useState("hoverEnabled"),_=a.useState("disabled");Um(w,{enabled:C&&!_&&y.type!=="context-menu"&&y.type!=="menubar",closeDelay:k});const I=m.useMemo(()=>({transitionStatus:h,side:l,align:c,open:d,nested:y.type==="menu",instant:x}),[h,l,c,d,y.type,x]),M=Vt("div",t,{state:I,ref:[n,a.context.popupRef],stateAttributesMapping:g_,props:[p,{onKeyDown(T){u&&h_.has(T.key)&&T.stopPropagation()}},Ec(h),i,{"data-rootownerid":v}]});let N=y.type===void 0||y.type==="context-menu";return(E||y.type==="menubar"&&g!==lc)&&(N=!0),f.jsx(TR,{context:w,modal:!1,disabled:!b,returnFocus:s===void 0?N:s,initialFocus:y.type!=="menu",restoreFocus:!0,externalTree:y.type!=="menubar"?S:void 0,previousFocusableElement:R,nextFocusableElement:y.type===void 0?a.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:y.type===void 0?a.context.beforeContentFocusGuardRef:void 0,children:M})}),Xm=m.createContext(void 0);function b_(){const e=m.useContext(Xm);if(e===void 0)throw new Error(Bt(32));return e}const y_=m.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=_r();return s.useState("mounted")||r?f.jsx(Xm.Provider,{value:r,children:f.jsx(ER,{ref:n,...o})}):null});function x_(e){return ic(19)?e:e?"true":void 0}const w_=m.createContext(void 0);function Sc(){return m.useContext(w_)?.direction??"ltr"}const E_=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:l}=t,{element:c,padding:u=0,offsetParent:d="real"}=pn(e,t)||{};if(c==null)return{};const h=im(u),p={x:n,y:r},b=vc(o),x=gc(b),E=await i.getDimensions(c),y=b==="y",g=y?"top":"left",v=y?"bottom":"right",w=y?"clientHeight":"clientWidth",S=s.reference[x]+s.reference[b]-p[b]-s.floating[x],k=p[b]-s.reference[b],R=d==="real"?await i.getOffsetParent?.(c):a.floating;let C=a.floating[w]||s.floating[x];(!C||!await i.isElement?.(R))&&(C=a.floating[w]||s.floating[x]);const _=S/2-k/2,I=C/2-E[x]/2-1,M=Math.min(h[g],I),N=Math.min(h[v],I),T=M,F=C-E[x]-N,O=C/2-E[x]/2+_,D=Aa(T,O,F),z=!l.arrow&&Nn(o)!=null&&O!==D&&s.reference[x]/2-(O<T?M:N)-E[x]/2<0,A=z?O<T?O-T:O-F:0;return{[b]:p[b]+A,data:{[b]:D,centerOffset:O-D-A,...z&&{alignmentOffset:A}},reset:z}}}),S_=(e,t)=>({...E_(e),options:[e,t]}),k_={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await gT().fn(e)).data?.referenceHidden||s}}}},as={sideX:"left",sideY:"top"},C_={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:a}=e,l=Qe(o),c=l.getComputedStyle(o);if(!(c.transitionDuration!=="0s"&&c.transitionDuration!==""))return{x:t,y:n,data:as};const d=await s.getOffsetParent?.(o);let h={width:0,height:0};if(i==="fixed"&&l?.visualViewport)h={width:l.visualViewport.width,height:l.visualViewport.height};else if(d===l){const g=Pn(o);h={width:g.documentElement.clientWidth,height:g.documentElement.clientHeight}}else await s.isElement?.(d)&&(h=await s.getDimensions(d));const p=Ct(a);let b=t,x=n;p==="left"&&(b=h.width-(t+r.width)),p==="top"&&(x=h.height-(n+r.height));const E=p==="left"?"right":as.sideX,y=p==="top"?"bottom":as.sideY;return{x:b,y:x,data:{sideX:E,sideY:y}}}};function Qm(e,t,n){const 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 Eu(e,t,n){const{rects:r,placement:o}=e;return{side:Qm(t,Ct(o),n),align:Nn(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function eh(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:a,collisionPadding:l=5,sticky:c=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:h=!1,floatingRootContext:p,mounted:b,collisionAvoidance:x,shiftCrossAxis:E=!1,nodeId:y,adaptiveOrigin:g,lazyFlip:v=!1,externalTree:w}=e,[S,k]=m.useState(null);!b&&S!==null&&k(null);const R=x.side||"flip",C=x.align||"flip",_=x.fallbackAxisSide||"end",I=typeof t=="function"?t:void 0,M=de(I),N=I?M:t,T=at(t),O=Sc()==="rtl",D=S||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":O?"left":"right","inline-start":O?"right":"left"}[r],z=s==="center"?D:`${D}-${s}`;let A=l;const Z=1,P=r==="bottom"?Z:0,B=r==="top"?Z:0,U=r==="right"?Z:0,q=r==="left"?Z:0;typeof A=="number"?A={top:A+P,right:A+q,bottom:A+B,left:A+U}:A&&(A={top:(A.top||0)+P,right:(A.right||0)+q,bottom:(A.bottom||0)+B,left:(A.left||0)+U});const he={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:A},ee=m.useRef(null),Y=at(o),ie=at(i),fe=[dT(Oe=>{const ze=Eu(Oe,r,O),dt=typeof Y.current=="function"?Y.current(ze):Y.current,ft=typeof ie.current=="function"?ie.current(ze):ie.current;return{mainAxis:dt,crossAxis:ft,alignmentAxis:ft}},[typeof o!="function"?o:0,typeof i!="function"?i:0,O,r])],L=C==="none"&&R!=="shift",ae=!L&&(c||E||R==="shift"),te=R==="none"?null:mT({...he,padding:{top:A.top+Z,right:A.right+Z,bottom:A.bottom+Z,left:A.left+Z},mainAxis:!E&&R==="flip",crossAxis:C==="flip"?"alignment":!1,fallbackAxisSideDirection:_}),ye=L?null:fT(Oe=>{const ze=Pn(Oe.elements.floating).documentElement;return{...he,rootBoundary:E?{x:0,y:0,width:ze.clientWidth,height:ze.clientHeight}:void 0,mainAxis:C!=="none",crossAxis:ae,limiter:c||E?void 0:pT(dt=>{if(!ee.current)return{};const{width:ft,height:zt}=ee.current.getBoundingClientRect(),Je=$t(Ct(dt.placement)),un=Je==="y"?ft:zt,Ir=Je==="y"?A.left+A.right:A.top+A.bottom;return{offset:un/2+Ir/2}})}},[he,c,E,A,C]);R==="shift"||C==="shift"||s==="center"?fe.push(ye,te):fe.push(te,ye),fe.push(hT({...he,apply({elements:{floating:Oe},rects:{reference:ze},availableWidth:dt,availableHeight:ft}){Object.entries({"--available-width":`${dt}px`,"--available-height":`${ft}px`,"--anchor-width":`${ze.width}px`,"--anchor-height":`${ze.height}px`}).forEach(([zt,Je])=>{Oe.style.setProperty(zt,Je)})}}),S_(()=>({element:ee.current||document.createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn(Oe){const{elements:ze,middlewareData:dt,placement:ft,rects:zt,y:Je}=Oe,un=Ct(ft),Ir=$t(un),Eo=ee.current,ci=dt.arrow?.x||0,li=dt.arrow?.y||0,ui=Eo?.clientWidth||0,Jn=Eo?.clientHeight||0,Jt=ci+ui/2,So=li+Jn/2,di=Math.abs(dt.shift?.y||0),fi=zt.reference.height/2,zn=typeof o=="function"?o(Eu(Oe,r,O)):o,ko=di>zn,Ar={top:`${Jt}px calc(100% + ${zn}px)`,bottom:`${Jt}px ${-zn}px`,left:`calc(100% + ${zn}px) ${So}px`,right:`${-zn}px ${So}px`}[un],Co=`${Jt}px ${zt.reference.y+fi-Je}px`;return ze.floating.style.setProperty("--transform-origin",ae&&Ir==="y"&&ko?Co:Ar),{}}},k_,g),ue(()=>{!b&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[b,p]);const pe=m.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<"u",layoutShift:!d&&typeof IntersectionObserver<"u"}),[d]),{refs:X,elements:oe,x:ke,y:we,middlewareData:Re,update:H,placement:ge,context:Q,isPositioned:le,floatingStyles:$}=GT({rootContext:p,placement:z,middleware:fe,strategy:n,whileElementsMounted:h?void 0:(...Oe)=>mu(...Oe,pe),nodeId:y,externalTree:w}),{sideX:be,sideY:Ae}=Re.adaptiveOrigin||as,Te=le?n:"fixed",et=m.useMemo(()=>g?{position:Te,[be]:ke,[Ae]:we}:{position:Te,...$},[g,Te,be,ke,Ae,we,$]),rt=m.useRef(null);ue(()=>{if(!b)return;const Oe=T.current,ze=typeof Oe=="function"?Oe():Oe,ft=(Su(ze)?ze.current:ze)||null||null;ft!==rt.current&&(X.setPositionReference(ft),rt.current=ft)},[b,X,N,T]),m.useEffect(()=>{if(!b)return;const Oe=T.current;typeof Oe!="function"&&Su(Oe)&&Oe.current!==rt.current&&(X.setPositionReference(Oe.current),rt.current=Oe.current)},[b,X,N,T]),m.useEffect(()=>{if(h&&b&&oe.domReference&&oe.floating)return mu(oe.domReference,oe.floating,H,pe)},[h,b,oe,H,pe]);const nt=Ct(ge),ot=Qm(r,nt,O),_t=Nn(ge)||"center",Ee=!!Re.hide?.referenceHidden;ue(()=>{v&&b&&le&&k(nt)},[v,b,le,nt]);const De=m.useMemo(()=>({position:"absolute",top:Re.arrow?.y,left:Re.arrow?.x}),[Re.arrow]),Ye=Re.arrow?.centerOffset!==0;return m.useMemo(()=>({positionerStyles:et,arrowStyles:De,arrowRef:ee,arrowUncentered:Ye,side:ot,align:_t,physicalSide:nt,anchorHidden:Ee,refs:X,context:Q,isPositioned:le,update:H}),[et,De,ee,Ye,ot,_t,nt,Ee,X,Q,le,H])}function Su(e){return e!=null&&"current"in e}function R_(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=de(o),i=m.useRef(0),a=jt(__).current,l=jt(T_).current,[c,u]=m.useState(0),d=m.useRef(c),h=de((y,g)=>{l.set(y,g??null),d.current+=1,u(d.current)}),p=de(y=>{l.delete(y),d.current+=1,u(d.current)}),b=m.useMemo(()=>{const y=new Map;return Array.from(l.keys()).filter(v=>v.isConnected).sort(P_).forEach((v,w)=>{const S=l.get(v)??{};y.set(v,{...S,index:w})}),y},[l,c]);ue(()=>{if(typeof MutationObserver!="function"||b.size===0)return;const y=new MutationObserver(g=>{const v=new Set,w=S=>v.has(S)?v.delete(S):v.add(S);g.forEach(S=>{S.removedNodes.forEach(w),S.addedNodes.forEach(w)}),v.size===0&&(d.current+=1,u(d.current))});return b.forEach((g,v)=>{v.parentElement&&y.observe(v.parentElement,{childList:!0})}),()=>{y.disconnect()}},[b]),ue(()=>{d.current===c&&(n.current.length!==b.size&&(n.current.length=b.size),r&&r.current.length!==b.size&&(r.current.length=b.size),i.current=b.size),s(b)},[s,b,n,r,c]),ue(()=>()=>{n.current=[]},[n]),ue(()=>()=>{r&&(r.current=[])},[r]);const x=de(y=>(a.add(y),()=>{a.delete(y)}));ue(()=>{a.forEach(y=>y(b))},[a,b]);const E=m.useMemo(()=>({register:h,unregister:p,subscribeMapChange:x,elementsRef:n,labelsRef:r,nextIndexRef:i}),[h,p,x,n,r,i]);return f.jsx(Hp.Provider,{value:E,children:t})}function T_(){return new Map}function __(){return new Set}function P_(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const I_=m.forwardRef(function(t,n){const{cutout:r,...o}=t;let s;if(r){const i=r?.getBoundingClientRect();s=`polygon(
59
+ 0% 0%,
60
+ 100% 0%,
61
+ 100% 100%,
62
+ 0% 100%,
63
+ 0% 0%,
64
+ ${i.left}px ${i.top}px,
65
+ ${i.left}px ${i.bottom}px,
66
+ ${i.right}px ${i.bottom}px,
67
+ ${i.right}px ${i.top}px,
68
+ ${i.left}px ${i.top}px
69
+ )`}return f.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),A_=m.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:a,align:l,sideOffset:c=0,alignOffset:u=0,collisionBoundary:d="clipping-ancestors",collisionPadding:h=5,arrowPadding:p=5,sticky:b=!1,disableAnchorTracking:x=!1,collisionAvoidance:E=$k,...y}=t,{store:g}=_r(),v=b_(),w=Gs(!0),S=g.useState("parent"),k=g.useState("floatingRootContext"),R=g.useState("floatingTreeRoot"),C=g.useState("mounted"),_=g.useState("open"),I=g.useState("modal"),M=g.useState("activeTriggerElement"),N=g.useState("lastOpenChangeReason"),T=g.useState("floatingNodeId"),F=g.useState("floatingParentNodeId");let O=r,D=c,z=u,A=l;S.type==="context-menu"&&(O=r??S.context?.anchor,A=A??"start",!a&&A!=="center"&&(z=t.alignOffset??2,D=t.sideOffset??-5));let Z=a,P=A;S.type==="menu"?(Z=Z??"inline-end",P=P??"start"):S.type==="menubar"&&(Z=Z??"bottom",P=P??"start");const B=S.type==="context-menu",U=eh({anchor:O,floatingRootContext:k,positionMethod:w?"fixed":o,mounted:C,side:Z,sideOffset:D,align:P,alignOffset:z,arrowPadding:B?0:p,collisionBoundary:d,collisionPadding:h,sticky:b,nodeId:T,keepMounted:v,disableAnchorTracking:x,collisionAvoidance:E,shiftCrossAxis:B,externalTree:R}),q=m.useMemo(()=>{const J={};return _||(J.pointerEvents="none"),{role:"presentation",hidden:!C,style:{...U.positionerStyles,...J}}},[_,C,U.positionerStyles]);m.useEffect(()=>{function J(fe){fe.open?(fe.parentNodeId===T&&g.set("hoverEnabled",!1),fe.nodeId!==T&&fe.parentNodeId===g.select("floatingParentNodeId")&&g.setOpen(!1,Me(Wr))):fe.parentNodeId===T&&fe.reason!==Wr&&g.set("hoverEnabled",!0)}return R.events.on("menuopenchange",J),()=>{R.events.off("menuopenchange",J)}},[g,R.events,T]),m.useEffect(()=>{if(g.select("floatingParentNodeId")==null)return;function J(fe){if(fe.open||fe.nodeId!==g.select("floatingParentNodeId"))return;const L=fe.reason??Wr;g.setOpen(!1,Me(L))}return R.events.on("menuopenchange",J),()=>{R.events.off("menuopenchange",J)}},[R.events,g]),m.useEffect(()=>{function J(fe){!_||fe.nodeId!==g.select("floatingParentNodeId")||fe.target&&M&&M!==fe.target&&g.setOpen(!1,Me(Wr))}return R.events.on("itemhover",J),()=>{R.events.off("itemhover",J)}},[R.events,_,M,g]),m.useEffect(()=>{const J={open:_,nodeId:T,parentNodeId:F,reason:g.select("lastOpenChangeReason")};R.events.emit("menuopenchange",J)},[R.events,_,g,T,F]);const he=m.useMemo(()=>({open:_,side:U.side,align:U.align,anchorHidden:U.anchorHidden,nested:S.type==="menu"}),[_,U.side,U.align,U.anchorHidden,S.type]),ee=m.useMemo(()=>({side:U.side,align:U.align,arrowRef:U.arrowRef,arrowUncentered:U.arrowUncentered,arrowStyles:U.arrowStyles,nodeId:U.context.nodeId}),[U.side,U.align,U.arrowRef,U.arrowUncentered,U.arrowStyles,U.context.nodeId]),Y=Vt("div",t,{state:he,stateAttributesMapping:qs,ref:[n,g.useStateSetter("positionerElement")],props:[q,y]}),ie=C&&S.type!=="menu"&&(S.type!=="menubar"&&I&&N!==kt||S.type==="menubar"&&S.context.modal);let K=null;return S.type==="menubar"?K=S.context.contentElement:S.type===void 0&&(K=M),f.jsxs(Np.Provider,{value:ee,children:[ie&&f.jsx(I_,{ref:S.type==="context-menu"||S.type==="nested-context-menu"?S.context.internalBackdropRef:null,inert:x_(!_),cutout:K}),f.jsx(mR,{id:T,children:f.jsx(R_,{elementsRef:g.context.itemDomElements,labelsRef:g.context.itemLabels,children:Y})})]})});let ku={},Cu={},Ru="";function O_(e){if(typeof document>"u")return!1;const t=Pn(e);return Qe(t).innerWidth-t.documentElement.clientWidth>0}function M_(e){const t=Pn(e),n=t.documentElement,r=t.body,o=qn(n)?n:r,s=o.style.overflow;return o.style.overflow="hidden",()=>{o.style.overflow=s}}function N_(e){const t=Pn(e),n=t.documentElement,r=t.body,o=Qe(n);let s=0,i=0;const a=nn.create(),l=typeof CSS<"u"&&CSS.supports?.("scrollbar-gutter","stable");if(_C&&(o.visualViewport?.scale??1)!==1)return()=>{};function c(){const h=o.getComputedStyle(n),p=o.getComputedStyle(r),E=(h.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,ku={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Ru=n.style.scrollBehavior,Cu={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};const y=n.scrollHeight>n.clientHeight,g=n.scrollWidth>n.clientWidth,v=h.overflowY==="scroll"||p.overflowY==="scroll",w=h.overflowX==="scroll"||p.overflowX==="scroll",S=Math.max(0,o.innerWidth-n.clientWidth),k=Math.max(0,o.innerHeight-n.clientHeight),R=parseFloat(p.marginTop)+parseFloat(p.marginBottom),C=parseFloat(p.marginLeft)+parseFloat(p.marginRight),_=qn(n)?n:r;if(l){n.style.scrollbarGutter=E,_.style.overflowY="hidden",_.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:E,overflowY:"hidden",overflowX:"hidden"}),(y||v)&&(n.style.overflowY="scroll"),(g||w)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:R||k?`calc(100dvh - ${R+k}px)`:"100dvh",width:C||S?`calc(100vw - ${C+S}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=s,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function u(){Object.assign(n.style,ku),Object.assign(r.style,Cu),l||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Ru)}function d(){u(),a.request(c)}return c(),o.addEventListener("resize",d),()=>{a.cancel(),u(),typeof o.removeEventListener=="function"&&o.removeEventListener("resize",d)}}class j_{lockCount=0;restore=null;timeoutLock=_n.create();timeoutUnlock=_n.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const r=Pn(t).documentElement,o=Qe(r).getComputedStyle(r).overflowY;if(o==="hidden"||o==="clip"){this.restore=Fp;return}const s=PC||!O_(t);this.restore=s?M_(t):N_(t)}}const D_=new j_;function z_(e=!0,t=null){ue(()=>{if(e)return D_.acquire(t)},[e,t])}const L_=m.createContext(null);function $_(e){return m.useContext(L_)}function F_(e){const t=m.useRef(""),n=m.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:m.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o&&e(o,o.pointerType),e(o,t.current),t.current=""},[e]),onPointerDown:n}}function B_(e){const[t,n]=m.useState(null),r=de((a,l)=>{e||n(l)}),o=m.useCallback(()=>{n(null)},[]),{onClick:s,onPointerDown:i}=F_(r);return m.useMemo(()=>({openMethod:t,reset:o,triggerProps:{onClick:s,onPointerDown:i}}),[t,o,s,i])}const V_={...Bm,disabled:ve(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:ve(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:ve(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:ve(e=>e.stickIfOpen),parent:ve(e=>e.parent),rootId:ve(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:ve(e=>e.activeIndex),isActive:ve((e,t)=>e.activeIndex===t),hoverEnabled:ve(e=>e.hoverEnabled),instantType:ve(e=>e.instantType),lastOpenChangeReason:ve(e=>e.openChangeReason),floatingTreeRoot:ve(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:ve(e=>e.floatingNodeId),floatingParentNodeId:ve(e=>e.floatingParentNodeId),itemProps:ve(e=>e.itemProps),closeDelay:ve(e=>e.closeDelay),keyboardEventRelay:ve(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class kc extends xc{constructor(t){super({...Z_(),...t},{positionerRef:m.createRef(),popupRef:m.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:m.createRef(),beforeContentFocusGuardRef:m.createRef(),onOpenChangeComplete:void 0,triggerElements:new oi},V_),this.observe(ve(n=>n.allowMouseEnter),(n,r)=>{this.state.parent.type==="menu"&&n!==r&&this.state.parent.store.set("allowMouseEnter",n)}),this.unsubscribeParentListener=this.observe("parent",n=>{if(this.unsubscribeParentListener?.(),n.type==="menu"){this.unsubscribeParentListener=n.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=n.store.context.allowMouseUpTriggerRef;return}n.type!==void 0&&(this.context.allowMouseUpTriggerRef=n.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:n})}static useStore(t,n){return jt(()=>t??new kc(n)).current}unsubscribeParentListener=null}function Z_(){return{...Fm(),disabled:!1,modal:!0,allowMouseEnter:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new bm,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:bt,keyboardEventRelay:void 0,closeDelay:0}}const U_=m.createContext(void 0);function W_(){return m.useContext(U_)}function H_(e){const{children:t,open:n,onOpenChange:r,onOpenChangeComplete:o,defaultOpen:s=!1,disabled:i=!1,modal:a,loopFocus:l=!0,orientation:c="vertical",actionsRef:u,closeParentOnEsc:d=!0,handle:h,triggerId:p,defaultTriggerId:b=null,highlightItemOnHover:x=!0}=e,E=Gs(!0),y=_r(!0),g=$_(),v=W_(),w=m.useMemo(()=>v&&y?{type:"menu",store:y.store}:g?{type:"menubar",context:g}:E&&!y?{type:"context-menu",context:E}:{type:void 0},[E,y,g,v]),S=kc.useStore(h?.store,{parent:w}),k=S.useState("floatingTreeRoot"),R=pR(k),C=jn();ue(()=>{E&&!y?S.update({parent:{type:"context-menu",context:E},floatingNodeId:R,floatingParentNodeId:C}):y&&S.update({floatingNodeId:R,floatingParentNodeId:C})},[E,y,R,C,S]),S.useControlledProp("open",n,s),S.useControlledProp("activeTriggerId",p,b),S.useContextCallback("onOpenChangeComplete",o);const _=S.useState("open"),I=S.useState("activeTriggerElement"),M=S.useState("positionerElement"),N=S.useState("hoverEnabled"),T=S.useState("modal"),F=S.useState("disabled"),O=S.useState("lastOpenChangeReason"),D=S.useState("parent"),z=S.useState("activeIndex"),A=S.useState("payload"),Z=S.useState("floatingParentNodeId"),P=m.useRef(null),B=Z!=null;let U;S.useSyncedValues({disabled:i,modal:D.type===void 0?a:void 0,rootId:On()});const{openMethod:q,triggerProps:he,reset:ee}=B_(_);Lm(S);const{forceUnmount:Y}=$m(_,S,()=>{S.update({allowMouseEnter:!1,stickIfOpen:!0}),ee()}),ie=m.useRef(D.type!=="context-menu"),K=Dt();m.useEffect(()=>{if(_||(P.current=null),D.type==="context-menu"){if(!_){K.clear(),ie.current=!1;return}K.start(500,()=>{ie.current=!0})}},[K,_,D.type]),z_(_&&T&&O!==kt&&q!=="touch",M),ue(()=>{!_&&!N&&S.set("hoverEnabled",!0)},[_,N,S]);const J=m.useRef(!0),fe=Dt(),L=de((Ee,De)=>{const Ye=De.reason;if(_===Ee&&De.trigger===I||(De.preventUnmountOnClose=()=>{S.set("preventUnmountingOnClose",!0)},!Ee&&De.trigger==null&&(De.trigger=I??void 0),r?.(Ee,De),De.isCanceled))return;const Oe={open:Ee,nativeEvent:De.event,reason:De.reason,nested:B};U?.emit("openchange",Oe);const ze=De.event;if(Ee===!1&&ze?.type==="click"&&ze.pointerType==="touch"&&!J.current)return;if(!Ee&&z!==null){const Je=S.context.itemDomElements.current[z];queueMicrotask(()=>{Je?.setAttribute("tabindex","-1")})}Ee&&Ye===po?(J.current=!1,fe.start(300,()=>{J.current=!0})):(J.current=!0,fe.clear());const dt=(Ye===xr||Ye===Zp)&&ze.detail===0&&ze?.isTrusted,ft=!Ee&&(Ye===Ks||Ye==null);function zt(){const Je={open:Ee,openChangeReason:Ye};P.current=De.event??null;const un=De.trigger?.id??null;(un||Ee)&&(Je.activeTriggerId=un,Je.activeTriggerElement=De.trigger??null),S.update(Je)}Ye===kt?Yt.flushSync(zt):zt(),D.type==="menubar"&&(Ye===po||Ye===Ys||Ye===kt||Ye===rs||Ye===Wr)?S.set("instantType","group"):dt||ft?S.set("instantType",dt?"click":"dismiss"):S.set("instantType",void 0)}),ae=m.useCallback(Ee=>{const De=Me(Ee);return De.preventUnmountOnClose=()=>{S.set("preventUnmountingOnClose",!0)},De},[S]),te=m.useCallback(()=>{S.setOpen(!1,ae(Up))},[S,ae]);m.useImperativeHandle(u,()=>({unmount:Y,close:te}),[Y,te]);let ye;D.type==="context-menu"&&(ye=D.context),m.useImperativeHandle(ye?.positionerRef,()=>M,[M]),m.useImperativeHandle(ye?.actionsRef,()=>({setOpen:L}),[L]);const pe=Vm({popupStore:S,onOpenChange:L});U=pe.context.events,m.useEffect(()=>{const Ee=({open:De,eventDetails:Ye})=>L(De,Ye);return U.on("setOpen",Ee),()=>{U?.off("setOpen",Ee)}},[U,L]);const X=jm(pe,{enabled:!F,bubbles:d&&D.type==="menu",outsidePress(){return D.type!=="context-menu"||P.current?.type==="contextmenu"?!0:ie.current},externalTree:B?k:void 0}),oe=i_(pe,{role:"menu"}),ke=Sc(),we=m.useCallback(Ee=>{S.select("activeIndex")!==Ee&&S.set("activeIndex",Ee)},[S]),Re=o_(pe,{enabled:!F,listRef:S.context.itemDomElements,activeIndex:z,nested:D.type!==void 0,loopFocus:l,orientation:c,parentOrientation:D.type==="menubar"?D.context.orientation:void 0,rtl:ke==="rtl",disabledIndices:Bp,onNavigate:we,openOnArrowKeyDown:D.type!=="context-menu",externalTree:B?k:void 0,focusItemOnHover:x}),H=m.useCallback(Ee=>{S.context.typingRef.current=Ee},[S]),ge=a_(pe,{listRef:S.context.itemLabels,activeIndex:z,resetMs:Dk,onMatch:Ee=>{_&&Ee!==z&&S.set("activeIndex",Ee)},onTypingChange:H}),{getReferenceProps:Q,getFloatingProps:le,getItemProps:$,getTriggerProps:be}=Wm([X,oe,Re,ge]),Ae=m.useMemo(()=>{const Ee=Gn(Q(),{onMouseEnter(){S.set("hoverEnabled",!0)},onMouseMove(){S.set("allowMouseEnter",!0)}},he);return delete Ee.role,Ee},[Q,S,he]),Te=m.useMemo(()=>{const Ee=be();if(!Ee)return Ee;const{role:De,["aria-controls"]:Ye,...Oe}=Ee;return Oe},[be]),et=ti(),rt=m.useMemo(()=>le({onMouseEnter(){D.type==="menu"&&et.request(()=>S.set("hoverEnabled",!1))},onMouseMove(){S.set("allowMouseEnter",!0)},onClick(){S.select("hoverEnabled")&&S.set("hoverEnabled",!1)},onKeyDown(Ee){const De=S.select("keyboardEventRelay");De&&!Ee.isPropagationStopped()&&De(Ee)}}),[le,D.type,et,S]),nt=m.useMemo(()=>$(),[$]);S.useSyncedValues({floatingRootContext:pe,activeTriggerProps:Ae,inactiveTriggerProps:Te,popupProps:rt,itemProps:nt});const ot=m.useMemo(()=>({store:S,parent:w}),[S,w]),_t=f.jsx(sc.Provider,{value:ot,children:typeof t=="function"?t({payload:A}):t});return D.type===void 0||D.type==="context-menu"?f.jsx(hR,{externalTree:k,children:_t}):_t}function th(e){if(Ge(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!on(e))return th(cn(e))}const G_=m.forwardRef(function(t,n){const{className:r,render:o,orientation:s="horizontal",...i}=t,a=m.useMemo(()=>({orientation:s}),[s]);return Vt("div",t,{state:a,ref:n,props:[{role:"separator","aria-orientation":s},i]})});function q_(e){const[t,n]=m.useState({getBoundingClientRect(){return DOMRect.fromRect({width:0,height:0,x:0,y:0})}}),r=m.useRef(null),o=m.useRef(null),s=m.useRef(null),i=m.useRef(null),a=m.useRef(!0),l=m.useRef(null),c=On(),u=m.useMemo(()=>({anchor:t,setAnchor:n,actionsRef:s,backdropRef:r,internalBackdropRef:o,positionerRef:i,allowMouseUpTriggerRef:a,initialCursorPointRef:l,rootId:c}),[t,c]);return f.jsx(Mp.Provider,{value:u,children:f.jsx(sc.Provider,{value:void 0,children:f.jsx(H_,{...e})})})}const Tu=500,Y_=m.forwardRef(function(t,n){const{render:r,className:o,...s}=t,{setAnchor:i,actionsRef:a,internalBackdropRef:l,backdropRef:c,positionerRef:u,allowMouseUpTriggerRef:d,initialCursorPointRef:h,rootId:p}=Gs(!1),{store:b}=_r(!1),x=b.useState("open"),E=m.useRef(null),y=m.useRef(null),g=Dt(),v=Dt(),w=m.useRef(!1);function S(N,T,F){const O=F.type.startsWith("touch");h.current={x:N,y:T},i({getBoundingClientRect(){return DOMRect.fromRect({width:O?10:0,height:O?10:0,x:N,y:T})}}),w.current=!1,a.current?.setOpen(!0,Me(xr,F)),v.start(Tu,()=>{w.current=!0})}function k(N){d.current=!0,it(N),S(N.clientX,N.clientY,N.nativeEvent),Pn(E.current).addEventListener("mouseup",F=>{if(d.current=!1,!w.current)return;v.clear(),w.current=!1;const O=ct(F);Pe(u.current,O)||p&&O&&th(O)===p||a.current?.setOpen(!1,Me(eC,F))},{once:!0})}function R(N){if(d.current=!1,N.touches.length===1){N.stopPropagation();const T=N.touches[0];y.current={x:T.clientX,y:T.clientY},g.start(Tu,()=>{y.current&&S(y.current.x,y.current.y,N.nativeEvent)})}}function C(N){if(g.isStarted()&&y.current&&N.touches.length===1){const T=N.touches[0],F=10,O=Math.abs(T.clientX-y.current.x),D=Math.abs(T.clientY-y.current.y);(O>F||D>F)&&g.clear()}}function _(){g.clear(),y.current=null}m.useEffect(()=>{function N(F){const D=ct(F);(Pe(E.current,D)||Pe(l.current,D)||Pe(c.current,D))&&F.preventDefault()}const T=Pn(E.current);return T.addEventListener("contextmenu",N),()=>{T.removeEventListener("contextmenu",N)}},[c,l]);const I=m.useMemo(()=>({open:x}),[x]);return Vt("div",t,{state:I,ref:[E,n],props:[{onContextMenu:k,onTouchStart:R,onTouchMove:C,onTouchEnd:_,onTouchCancel:_,style:{WebkitTouchCallout:"none"}},s],stateAttributesMapping:Qk})});function K_(e){return e==="x"||e==="y"?dn[e]?null:(dn[e]=!0,()=>{dn[e]=!1}):dn.x||dn.y?null:(dn.x=dn.y=!0,()=>{dn.x=dn.y=!1})}function Cc(e){return Yg(e)&&"ownerSVGElement"in e}const cs=new WeakMap;let ls;const nh=(e,t,n)=>(r,o)=>o&&o[0]?o[0][e+"Size"]:Cc(r)&&"getBBox"in r?r.getBBox()[t]:r[n],J_=nh("inline","width","offsetWidth"),X_=nh("block","height","offsetHeight");function Q_({target:e,borderBoxSize:t}){cs.get(e)?.forEach(n=>{n(e,{get width(){return J_(e,t)},get height(){return X_(e,t)}})})}function eP(e){e.forEach(Q_)}function tP(){typeof ResizeObserver>"u"||(ls=new ResizeObserver(eP))}function nP(e,t){ls||tP();const n=Kg(e);return n.forEach(r=>{let o=cs.get(r);o||(o=new Set,cs.set(r,o)),o.add(t),ls?.observe(r)}),()=>{n.forEach(r=>{const o=cs.get(r);o?.delete(t),o?.size||ls?.unobserve(r)})}}const us=new Set;let ur;function rP(){ur=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};us.forEach(t=>t(e))},window.addEventListener("resize",ur)}function oP(e){return us.add(e),ur||rP(),()=>{us.delete(e),!us.size&&typeof ur=="function"&&(window.removeEventListener("resize",ur),ur=void 0)}}function _u(e,t){return typeof e=="function"?oP(e):nP(e,t)}function sP(e){return Cc(e)&&e.tagName==="svg"}function Da(e,t){e.min=t.min,e.max=t.max}function qt(e,t){Da(e.x,t.x),Da(e.y,t.y)}function Pu(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const rh=1e-4,iP=1-rh,aP=1+rh,oh=.01,cP=0-oh,lP=0+oh;function xt(e){return e.max-e.min}function uP(e,t,n){return Math.abs(e-t)<=n}function Iu(e,t,n,r=.5){e.origin=r,e.originPoint=Ke(t.min,t.max,e.origin),e.scale=xt(n)/xt(t),e.translate=Ke(n.min,n.max,e.origin)-e.originPoint,(e.scale>=iP&&e.scale<=aP||isNaN(e.scale))&&(e.scale=1),(e.translate>=cP&&e.translate<=lP||isNaN(e.translate))&&(e.translate=0)}function to(e,t,n,r){Iu(e.x,t.x,n.x,r?r.originX:void 0),Iu(e.y,t.y,n.y,r?r.originY:void 0)}function Au(e,t,n,r=0){const o=r?Ke(n.min,n.max,r):n.min;e.min=o+t.min,e.max=e.min+xt(t)}function dP(e,t,n,r){Au(e.x,t.x,n.x,r?.x),Au(e.y,t.y,n.y,r?.y)}function Ou(e,t,n,r=0){const o=r?Ke(n.min,n.max,r):n.min;e.min=t.min-o,e.max=e.min+xt(t)}function js(e,t,n,r){Ou(e.x,t.x,n.x,r?.x),Ou(e.y,t.y,n.y,r?.y)}function Mu(e,t,n,r,o){return e-=t,e=Yc(e,1/n,r),o!==void 0&&(e=Yc(e,1/o,r)),e}function fP(e,t=0,n=1,r=.5,o,s=e,i=e){if(ps.test(t)&&(t=parseFloat(t),t=Ke(i.min,i.max,t/100)-i.min),typeof t!="number")return;let a=Ke(s.min,s.max,r);e===s&&(a-=t),e.min=Mu(e.min,t,n,a,o),e.max=Mu(e.max,t,n,a,o)}function Nu(e,t,[n,r,o],s,i){fP(e,t[n],t[r],t[o],t.scale,s,i)}const pP=["x","scaleX","originX"],mP=["y","scaleY","originY"];function ju(e,t,n,r){Nu(e.x,t,pP,n?n.x:void 0,r?r.x:void 0),Nu(e.y,t,mP,n?n.y:void 0,r?r.y:void 0)}function Du(e){return e.translate===0&&e.scale===1}function sh(e){return Du(e.x)&&Du(e.y)}function zu(e,t){return e.min===t.min&&e.max===t.max}function hP(e,t){return zu(e.x,t.x)&&zu(e.y,t.y)}function Lu(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function ih(e,t){return Lu(e.x,t.x)&&Lu(e.y,t.y)}function $u(e){return xt(e.x)/xt(e.y)}function Fu(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function en(e){return[e("x"),e("y")]}function gP(e,t,n){let r="";const o=e.x.translate/t.x,s=e.y.translate/t.y,i=n?.z||0;if((o||s||i)&&(r=`translate3d(${o}px, ${s}px, ${i}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:c,rotate:u,pathRotation:d,rotateX:h,rotateY:p,skewX:b,skewY:x}=n;c&&(r=`perspective(${c}px) ${r}`),u&&(r+=`rotate(${u}deg) `),d&&(r+=`rotate(${d}deg) `),h&&(r+=`rotateX(${h}deg) `),p&&(r+=`rotateY(${p}deg) `),b&&(r+=`skewX(${b}deg) `),x&&(r+=`skewY(${x}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const ah=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],vP=ah.length,Bu=e=>typeof e=="string"?parseFloat(e):e,Vu=e=>typeof e=="number"||Bg.test(e);function bP(e,t,n,r,o,s){o?(e.opacity=Ke(0,n.opacity??1,yP(r)),e.opacityExit=Ke(t.opacity??1,0,xP(r))):s&&(e.opacity=Ke(t.opacity??1,n.opacity??1,r));for(let i=0;i<vP;i++){const a=ah[i];let l=Zu(t,a),c=Zu(n,a);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||Vu(l)===Vu(c)?(e[a]=Math.max(Ke(Bu(l),Bu(c),r),0),(ps.test(c)||ps.test(l))&&(e[a]+="%")):e[a]=c}(t.rotate||n.rotate)&&(e.rotate=Ke(t.rotate||0,n.rotate||0,r))}function Zu(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const yP=ch(0,.5,Jg),xP=ch(.5,.95,dr);function ch(e,t,n){return r=>r<e?0:r>t?1:n(ua(e,t,r))}function wP(e,t,n){const r=Vg(e)?e:Md(e);return r.start(Bd("",r,t,n)),r.animation}const EP=(e,t)=>e.depth-t.depth;class SP{constructor(){this.children=[],this.isDirty=!1}add(t){Nd(this.children,t),this.isDirty=!0}remove(t){la(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(EP),this.isDirty=!1,this.children.forEach(t)}}function kP(e,t){const n=jd.now(),r=({timestamp:o})=>{const s=o-n;s>=t&&(ro(r),e(s-t))};return yt.setup(r,!0),()=>ro(r)}class CP{constructor(){this.members=[]}add(t){Nd(this.members,t);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===t||r===this.lead||r===this.prevLead)continue;const o=r.instance;(!o||o.isConnected===!1)&&!r.snapshot&&(la(this.members,r),r.unmount())}t.scheduleRender()}remove(t){if(la(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){for(let n=this.members.indexOf(t)-1;n>=0;n--){const r=this.members[n];if(r.isPresent!==!1&&r.instance?.isConnected!==!1)return this.promote(r),!0}return!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.updateSnapshot(),t.scheduleRender();const{layoutDependency:o}=r.options,{layoutDependency:s}=t.options;(o===void 0||o!==s)&&(t.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root?.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{t.options.onExitComplete?.(),t.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const ds={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Ki=["","X","Y","Z"],RP=1e3;let TP=0;function Ji(e,t,n,r){const{latestValues:o}=t;o[e]&&(n[e]=o[e],t.setStaticValue(e,0),r&&(r[e]=0))}function lh(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=nv(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",yt,!(o||s))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&lh(r)}function uh({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(i={},a=t?.()){this.id=TP++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(IP),this.nodes.forEach(DP),this.nodes.forEach(zP),this.nodes.forEach(AP)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new SP)}addEventListener(i,a){return this.eventHandlers.has(i)||this.eventHandlers.set(i,new Zg),this.eventHandlers.get(i).add(a)}notifyListeners(i,...a){const l=this.eventHandlers.get(i);l&&l.notify(...a)}hasListeners(i){return this.eventHandlers.has(i)}mount(i){if(this.instance)return;this.isSVG=Cc(i)&&!sP(i),this.instance=i;const{layoutId:a,layout:l,visualElement:c}=this.options;if(c&&!c.current&&c.mount(i),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||a)&&(this.isLayoutDirty=!0),e){let u,d=0;const h=()=>this.root.updateBlockedByResize=!1;yt.read(()=>{d=window.innerWidth}),e(i,()=>{const p=window.innerWidth;p!==d&&(d=p,this.root.updateBlockedByResize=!0,u&&u(),u=kP(h,250),ds.hasAnimatedSinceResize&&(ds.hasAnimatedSinceResize=!1,this.nodes.forEach(Hu)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&c&&(a||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d,hasRelativeLayoutChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||c.getDefaultTransition()||VP,{onLayoutAnimationStart:x,onLayoutAnimationComplete:E}=c.getProps(),y=!this.targetLayout||!ih(this.targetLayout,p),g=!d&&h;if(this.options.layoutRoot||this.resumeFrom||g||d&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const v={...Xg(b,"layout"),onPlay:x,onComplete:E};(c.shouldReduceMotion||this.options.layoutRoot)&&(v.delay=0,v.type=!1),this.startAnimation(v),this.setAnimationOrigin(u,g,v.path)}else d||Hu(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ro(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(LP),this.animationId++)}getTransformTemplate(){const{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&lh(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const d=this.path[u];d.shouldResetTransform=!0,(typeof d.latestValues.x=="string"||typeof d.latestValues.y=="string")&&(d.isLayoutDirty=!0),d.updateScroll("snapshot"),d.options.layoutRoot&&d.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),i&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const l=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),l&&this.nodes.forEach(MP),this.nodes.forEach(Uu);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Wu);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(NP),this.nodes.forEach(jP),this.nodes.forEach(_P),this.nodes.forEach(PP)):this.nodes.forEach(Wu),this.clearAllSnapshots();const a=jd.now();At.delta=Dd(0,1e3/60,a-At.timestamp),At.timestamp=a,At.isProcessing=!0,Si.update.process(At),Si.preRender.process(At),Si.render.process(At),At.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,zd.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(OP),this.sharedNodes.forEach($P)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,yt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){yt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!xt(this.snapshot.measuredBox.x)&&!xt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const i=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=st()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,i?i.layoutBox:void 0)}updateScroll(i="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===i&&(a=!1),a&&this.instance){const l=r(this.instance);this.scroll={animationId:this.root.animationId,phase:i,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!o)return;const i=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!sh(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;i&&this.instance&&(a||er(this.latestValues)||u)&&(o(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(i=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return i&&(l=this.removeTransform(l)),ZP(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:i}=this.options;if(!i)return st();const a=i.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(UP))){const{scroll:c}=this.root;c&&(tr(a.x,c.offset.x),tr(a.y,c.offset.y))}return a}removeElementScroll(i){const a=st();if(qt(a,i),this.scroll?.wasRoot)return a;for(let l=0;l<this.path.length;l++){const c=this.path[l],{scroll:u,options:d}=c;c!==this.root&&u&&d.layoutScroll&&(u.wasRoot&&qt(a,i),tr(a.x,u.offset.x),tr(a.y,u.offset.y))}return a}applyTransform(i,a=!1,l){const c=l||st();qt(c,i);for(let u=0;u<this.path.length;u++){const d=this.path[u];!a&&d.options.layoutScroll&&d.scroll&&d!==d.root&&(tr(c.x,-d.scroll.offset.x),tr(c.y,-d.scroll.offset.y)),er(d.latestValues)&&Ci(c,d.latestValues,d.layout?.layoutBox)}return er(this.latestValues)&&Ci(c,this.latestValues,this.layout?.layoutBox),c}removeTransform(i){const a=st();qt(a,i);for(let l=0;l<this.path.length;l++){const c=this.path[l];if(!er(c.latestValues))continue;let u;c.instance&&(Kc(c.latestValues)&&c.updateSnapshot(),u=st(),qt(u,c.measurePageBox())),ju(a,c.latestValues,c.snapshot?.layoutBox,u)}return er(this.latestValues)&&ju(a,this.latestValues),a}setTargetDelta(i){this.targetDelta=i,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(i){this.options={...this.options,...i,crossfade:i.crossfade!==void 0?i.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==At.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(i=!1){const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==a;if(!(i||l&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:d}=this.options;if(!this.layout||!(u||d))return;this.resolvedRelativeTargetAt=At.timestamp;const h=this.getClosestProjectingParent();h&&this.linkedParentVersion!==h.layoutVersion&&!h.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&h&&h.layout?this.createRelativeTarget(h,this.layout.layoutBox,h.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=st(),this.targetWithTransforms=st()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),dP(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):qt(this.target,this.layout.layoutBox),Qg(this.target,this.targetDelta)):qt(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&h&&!!h.resumingFrom==!!this.resumingFrom&&!h.options.layoutScroll&&h.target&&this.animationProgress!==1?this.createRelativeTarget(h,this.target,h.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Kc(this.parent.latestValues)||ev(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(i,a,l){this.relativeParent=i,this.linkedParentVersion=i.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=st(),this.relativeTargetOrigin=st(),js(this.relativeTargetOrigin,a,l,this.options.layoutAnchor||void 0),qt(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const i=this.getLead(),a=!!this.resumingFrom||this!==i;let l=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(l=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===At.timestamp&&(l=!1),l)return;const{layout:c,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||u))return;qt(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,h=this.treeScale.y;tv(this.layoutCorrected,this.treeScale,this.path,a),i.layout&&!i.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(i.target=i.layout.layoutBox,i.targetWithTransforms=st());const{target:p}=i;if(!p){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Pu(this.prevProjectionDelta.x,this.projectionDelta.x),Pu(this.prevProjectionDelta.y,this.projectionDelta.y)),to(this.projectionDelta,this.layoutCorrected,p,this.latestValues),(this.treeScale.x!==d||this.treeScale.y!==h||!Fu(this.projectionDelta.x,this.prevProjectionDelta.x)||!Fu(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(i=!0){if(this.options.visualElement?.scheduleRender(),i){const a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ir(),this.projectionDelta=ir(),this.projectionDeltaWithTransform=ir()}setAnimationOrigin(i,a=!1,l){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},h=ir();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const p=st(),b=c?c.source:void 0,x=this.layout?this.layout.source:void 0,E=b!==x,y=this.getStack(),g=!y||y.members.length<=1,v=!!(E&&!g&&this.options.crossfade===!0&&!this.path.some(BP));this.animationProgress=0;let w;const S=l?.interpolateProjection(i);this.mixTargetDelta=k=>{const R=k/1e3,C=S?.(R);C?(h.x.translate=C.x,h.x.scale=Ke(i.x.scale,1,R),h.x.origin=i.x.origin,h.x.originPoint=i.x.originPoint,h.y.translate=C.y,h.y.scale=Ke(i.y.scale,1,R),h.y.origin=i.y.origin,h.y.originPoint=i.y.originPoint):(Gu(h.x,i.x,R),Gu(h.y,i.y,R)),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(js(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),FP(this.relativeTarget,this.relativeTargetOrigin,p,R),w&&hP(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=st()),qt(w,this.relativeTarget)),E&&(this.animationValues=d,bP(d,u,this.latestValues,R,v,g)),C&&C.rotate!==void 0&&(this.animationValues||(this.animationValues=d),this.animationValues.pathRotation=C.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(ro(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=yt.update(()=>{ds.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Md(0)),this.motionValue.jump(0,!1),this.currentAnimation=wP(this.motionValue,[0,1e3],{...i,velocity:0,isSync:!0,onUpdate:a=>{this.mixTargetDelta(a),i.onUpdate&&i.onUpdate(a)},onStop:()=>{},onComplete:()=>{i.onComplete&&i.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(RP),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const i=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:u}=i;if(!(!a||!l||!c)){if(this!==i&&this.layout&&c&&dh(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||st();const d=xt(this.layout.layoutBox.x);l.x.min=i.target.x.min,l.x.max=l.x.min+d;const h=xt(this.layout.layoutBox.y);l.y.min=i.target.y.min,l.y.max=l.y.min+h}qt(a,l),Ci(a,u),to(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(i,a){this.sharedNodes.has(i)||this.sharedNodes.set(i,new CP),this.sharedNodes.get(i).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const i=this.getStack();return i?i.lead===this:!0}getLead(){const{layoutId:i}=this.options;return i?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:i}=this.options;return i?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),i&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const i=this.getStack();return i?i.relegate(this):!1}resetSkewAndRotation(){const{visualElement:i}=this.options;if(!i)return;let a=!1;const{latestValues:l}=i;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&Ji("z",i,c,this.animationValues);for(let u=0;u<Ki.length;u++)Ji(`rotate${Ki[u]}`,i,c,this.animationValues),Ji(`skew${Ki[u]}`,i,c,this.animationValues);i.render();for(const u in c)i.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);i.scheduleRender()}applyProjectionStyles(i,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){i.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,i.visibility="",i.opacity="",i.pointerEvents=ki(a?.pointerEvents)||"",i.transform=l?l(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(i.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,i.pointerEvents=ki(a?.pointerEvents)||""),this.hasProjected&&!er(this.latestValues)&&(i.transform=l?l({},""):"none",this.hasProjected=!1);return}i.visibility="";const u=c.animationValues||c.latestValues;this.applyTransformsToTarget();let d=gP(this.projectionDeltaWithTransform,this.treeScale,u);l&&(d=l(u,d)),i.transform=d;const{x:h,y:p}=this.projectionDelta;i.transformOrigin=`${h.origin*100}% ${p.origin*100}% 0`,c.animationValues?i.opacity=c===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:i.opacity=c===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const b in Gc){if(u[b]===void 0)continue;const{correct:x,applyTo:E,isCSSVariable:y}=Gc[b],g=d==="none"?u[b]:x(u[b],c);if(E){const v=E.length;for(let w=0;w<v;w++)i[E[w]]=g}else y?this.options.visualElement.renderState.vars[b]=g:i[b]=g}this.options.layoutId&&(i.pointerEvents=c===this?ki(a?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(i=>i.currentAnimation?.stop()),this.root.nodes.forEach(Uu),this.root.sharedNodes.clear()}}}function _P(e){e.updateLayout()}function PP(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=e.layout,{animationType:o}=e.options,s=t.source!==e.layout.source;if(o==="size")en(u=>{const d=s?t.measuredBox[u]:t.layoutBox[u],h=xt(d);d.min=n[u].min,d.max=d.min+h});else if(o==="x"||o==="y"){const u=o==="x"?"y":"x";Da(s?t.measuredBox[u]:t.layoutBox[u],n[u])}else dh(o,t.layoutBox,n)&&en(u=>{const d=s?t.measuredBox[u]:t.layoutBox[u],h=xt(n[u]);d.max=d.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[u].max=e.relativeTarget[u].min+h)});const i=ir();to(i,n,t.layoutBox);const a=ir();s?to(a,e.applyTransform(r,!0),t.measuredBox):to(a,n,t.layoutBox);const l=!sh(i);let c=!1;if(!e.resumeFrom){const u=e.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:d,layout:h}=u;if(d&&h){const p=e.options.layoutAnchor||void 0,b=st();js(b,t.layoutBox,d.layoutBox,p);const x=st();js(x,n,h.layoutBox,p),ih(b,x)||(c=!0),u.options.layoutRoot&&(e.relativeTarget=x,e.relativeTargetOrigin=b,e.relativeParent=u)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:a,layoutDelta:i,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function IP(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function AP(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function OP(e){e.clearSnapshot()}function Uu(e){e.clearMeasurements()}function MP(e){e.isLayoutDirty=!0,e.updateLayout()}function Wu(e){e.isLayoutDirty=!1}function NP(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function jP(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Hu(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function DP(e){e.resolveTargetDelta()}function zP(e){e.calcProjection()}function LP(e){e.resetSkewAndRotation()}function $P(e){e.removeLeadSnapshot()}function Gu(e,t,n){e.translate=Ke(t.translate,0,n),e.scale=Ke(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function qu(e,t,n,r){e.min=Ke(t.min,n.min,r),e.max=Ke(t.max,n.max,r)}function FP(e,t,n,r){qu(e.x,t.x,n.x,r),qu(e.y,t.y,n.y,r)}function BP(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const VP={duration:.45,ease:[.4,0,.1,1]},Yu=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Ku=Yu("applewebkit/")&&!Yu("chrome/")?Math.round:dr;function Ju(e){e.min=Ku(e.min),e.max=Ku(e.max)}function ZP(e){Ju(e.x),Ju(e.y)}function dh(e,t,n){return e==="position"||e==="preserve-aspect"&&!uP($u(t),$u(n),.2)}function UP(e){return e!==e.root&&e.scroll?.wasRoot}const WP=uh({attachResizeListener:(e,t)=>qa(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Xi={current:void 0},fh=uh({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Xi.current){const e=new WP({});e.mount(window),e.setOptions({layoutScroll:!0}),Xi.current=e}return Xi.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"});function Xu(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function HP(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Xu(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Xu(e[o],null)}}}}function GP(...e){return m.useCallback(HP(...e),e)}class qP extends m.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(Ri(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,o=Ri(r)&&r.offsetWidth||0,s=Ri(r)&&r.offsetHeight||0,i=getComputedStyle(n),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=n.offsetTop,a.left=n.offsetLeft,a.right=o-a.width-a.left,a.bottom=s-a.height-a.top,a.direction=i.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function YP({children:e,isPresent:t,anchorX:n,anchorY:r,root:o,pop:s}){const i=m.useId(),a=m.useRef(null),l=m.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:c}=m.useContext(Ug),u=e.props?.ref??e?.ref,d=GP(a,u);return m.useInsertionEffect(()=>{const{width:h,height:p,top:b,left:x,right:E,bottom:y,direction:g}=l.current;if(t||s===!1||!a.current||!h||!p)return;const v=g==="rtl",w=n==="left"?v?`right: ${E}`:`left: ${x}`:v?`left: ${x}`:`right: ${E}`,S=r==="bottom"?`bottom: ${y}`:`top: ${b}`;a.current.dataset.motionPopId=i;const k=document.createElement("style");c&&(k.nonce=c);const R=o??document.head;return R.appendChild(k),k.sheet&&k.sheet.insertRule(`
70
+ [data-motion-pop-id="${i}"] {
71
+ position: absolute !important;
72
+ width: ${h}px !important;
73
+ height: ${p}px !important;
74
+ ${w}px !important;
75
+ ${S}px !important;
76
+ }
77
+ `),()=>{a.current?.removeAttribute("data-motion-pop-id"),R.contains(k)&&R.removeChild(k)}},[t]),f.jsx(qP,{isPresent:t,childRef:a,sizeRef:l,pop:s,children:s===!1?e:m.cloneElement(e,{ref:d})})}const KP=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:o,presenceAffectsLayout:s,mode:i,anchorX:a,anchorY:l,root:c})=>{const u=Ld(JP),d=m.useId();let h=!0,p=m.useMemo(()=>(h=!1,{id:d,initial:t,isPresent:n,custom:o,onExitComplete:b=>{u.set(b,!0);for(const x of u.values())if(!x)return;r&&r()},register:b=>(u.set(b,!1),()=>u.delete(b))}),[n,u,r]);return s&&h&&(p={...p}),m.useMemo(()=>{u.forEach((b,x)=>u.set(x,!1))},[n]),m.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=f.jsx(YP,{pop:i==="popLayout",isPresent:n,anchorX:a,anchorY:l,root:c,children:e}),f.jsx($d.Provider,{value:p,children:e})};function JP(){return new Map}function ph(e=!0){const t=m.useContext($d);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=t,s=m.useId();m.useEffect(()=>{if(e)return o(s)},[e]);const i=m.useCallback(()=>e&&r&&r(s),[s,r,e]);return!n&&r?[!1,i]:[!0]}const Ho=e=>e.key||"";function Qu(e){const t=[];return m.Children.forEach(e,n=>{m.isValidElement(n)&&t.push(n)}),t}const XP=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:o=!0,mode:s="sync",propagate:i=!1,anchorX:a="left",anchorY:l="top",root:c})=>{const[u,d]=ph(i),h=m.useMemo(()=>Qu(e),[e]),p=i&&!u?[]:h.map(Ho),b=m.useRef(!0),x=m.useRef(h),E=Ld(()=>new Map),y=m.useRef(new Set),[g,v]=m.useState(h),[w,S]=m.useState(h);Wg(()=>{b.current=!1,x.current=h;for(let C=0;C<w.length;C++){const _=Ho(w[C]);p.includes(_)?(E.delete(_),y.current.delete(_)):E.get(_)!==!0&&E.set(_,!1)}},[w,p.length,p.join("-")]);const k=[];if(h!==g){let C=[...h];for(let _=0;_<w.length;_++){const I=w[_],M=Ho(I);p.includes(M)||(C.splice(_,0,I),k.push(I))}return s==="wait"&&k.length&&(C=k),S(Qu(C)),v(h),null}const{forceRender:R}=m.useContext(Fd);return f.jsx(f.Fragment,{children:w.map(C=>{const _=Ho(C),I=i&&!u?!1:h===w||p.includes(_),M=()=>{if(y.current.has(_))return;if(E.has(_))y.current.add(_),E.set(_,!0);else return;let N=!0;E.forEach(T=>{T||(N=!1)}),N&&(R?.(),S(x.current),i&&d?.(),r&&r())};return f.jsx(KP,{isPresent:I,initial:!b.current||n?void 0:!1,custom:t,presenceAffectsLayout:o,mode:s,root:c,onExitComplete:I?void 0:M,anchorX:a,anchorY:l,children:C},_)})})};function no(e,t,n,r){return qa(e,t,rv(n),r)}const mh=({current:e})=>e?e.ownerDocument.defaultView:null,ed=(e,t)=>Math.abs(e-t);function QP(e,t){const n=ed(e.x,t.x),r=ed(e.y,t.y);return Math.sqrt(n**2+r**2)}const td=new Set(["auto","scroll"]);class hh{constructor(t,n,{transformPagePoint:r,contextWindow:o=window,dragSnapToOrigin:s=!1,distanceThreshold:i=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=p=>{this.handleScroll(p.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Go(this.lastRawMoveEventInfo,this.transformPagePoint));const p=Qi(this.lastMoveEventInfo,this.history),b=this.startEvent!==null,x=QP(p.offset,{x:0,y:0})>=this.distanceThreshold;if(!b&&!x)return;const{point:E}=p,{timestamp:y}=At;this.history.push({...E,timestamp:y});const{onStart:g,onMove:v}=this.handlers;b||(g&&g(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,p)},this.handlePointerMove=(p,b)=>{this.lastMoveEvent=p,this.lastRawMoveEventInfo=b,this.lastMoveEventInfo=Go(b,this.transformPagePoint),yt.update(this.updatePoint,!0)},this.handlePointerUp=(p,b)=>{this.end();const{onEnd:x,onSessionEnd:E,resumeAnimation:y}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=Qi(p.type==="pointercancel"?this.lastMoveEventInfo:Go(b,this.transformPagePoint),this.history);this.startEvent&&x&&x(p,g),E&&E(p,g)},!ov(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=i,this.contextWindow=o||window;const l=Vd(t),c=Go(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=At;this.history=[{...u,timestamp:d}];const{onSessionStart:h}=n;h&&h(t,Qi(c,this.history)),this.removeListeners=sv(no(this.contextWindow,"pointermove",this.handlePointerMove),no(this.contextWindow,"pointerup",this.handlePointerUp),no(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(td.has(r.overflowX)||td.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,o=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},s={x:o.x-n.x,y:o.y-n.y};s.x===0&&s.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(t,o),yt.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),ro(this.updatePoint)}}function Go(e,t){return t?{point:t(e.point)}:e}function nd(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Qi({point:e},t){return{point:e,delta:nd(e,gh(t)),offset:nd(e,e1(t)),velocity:t1(t,.1)}}function e1(e){return e[0]}function gh(e){return e[e.length-1]}function t1(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=gh(e);for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>qc(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&o.timestamp-r.timestamp>qc(t)*2&&(r=e[1]);const s=Hg(o.timestamp-r.timestamp);if(s===0)return{x:0,y:0};const i={x:(o.x-r.x)/s,y:(o.y-r.y)/s};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function n1(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Ke(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Ke(n,e,r.max):Math.min(e,n)),e}function rd(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function r1(e,{top:t,left:n,bottom:r,right:o}){return{x:rd(e.x,n,o),y:rd(e.y,t,r)}}function od(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function o1(e,t){return{x:od(e.x,t.x),y:od(e.y,t.y)}}function s1(e,t){let n=.5;const r=xt(e),o=xt(t);return o>r?n=ua(t.min,t.max-r,e.min):r>o&&(n=ua(e.min,e.max-o,t.min)),Dd(0,1,n)}function i1(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const za=.35;function a1(e=za){return e===!1?e=0:e===!0&&(e=za),{x:sd(e,"left","right"),y:sd(e,"top","bottom")}}function sd(e,t,n){return{min:id(e,t),max:id(e,n)}}function id(e,t){return typeof e=="number"?e:e[t]||0}const c1=new WeakMap;class l1{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=st(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const s=d=>{n&&this.snapToCursor(Vd(d).point),this.stopAnimation()},i=(d,h)=>{const{drag:p,dragPropagation:b,onDragStart:x}=this.getProps();if(p&&!b&&(this.openDragLock&&this.openDragLock(),this.openDragLock=K_(p),!this.openDragLock))return;this.latestPointerEvent=d,this.latestPanInfo=h,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),en(y=>{let g=this.getAxisMotionValue(y).get()||0;if(ps.test(g)){const{projection:v}=this.visualElement;if(v&&v.layout){const w=v.layout.layoutBox[y];w&&(g=xt(w)*(parseFloat(g)/100))}}this.originPoint[y]=g}),x&&yt.update(()=>x(d,h),!1,!0),Jc(this.visualElement,"transform");const{animationState:E}=this.visualElement;E&&E.setActive("whileDrag",!0)},a=(d,h)=>{this.latestPointerEvent=d,this.latestPanInfo=h;const{dragPropagation:p,dragDirectionLock:b,onDirectionLock:x,onDrag:E}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:y}=h;if(b&&this.currentDirection===null){this.currentDirection=d1(y),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",h.point,y),this.updateAxis("y",h.point,y),this.visualElement.render(),E&&yt.update(()=>E(d,h),!1,!0)},l=(d,h)=>{this.latestPointerEvent=d,this.latestPanInfo=h,this.stop(d,h),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{const{dragSnapToOrigin:d}=this.getProps();(d||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:u}=this.getProps();this.panSession=new hh(t,{onSessionStart:s,onStart:i,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:r,contextWindow:mh(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,o=n||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!o||!r)return;const{velocity:i}=o;this.startAnimation(i);const{onDragEnd:a}=this.getProps();a&&yt.postRender(()=>a(r,o))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:o}=this.getProps();if(!r||!qo(t,o,this.currentDirection))return;const s=this.getAxisMotionValue(t);let i=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(i=n1(i,this.constraints[t],this.elastic[t])),s.set(i)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,o=this.constraints;t&&Dr(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=r1(r.layoutBox,t):this.constraints=!1,this.elastic=a1(n),o!==this.constraints&&!Dr(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&en(s=>{this.constraints!==!1&&this.getAxisMotionValue(s)&&(this.constraints[s]=i1(r.layoutBox[s],this.constraints[s]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Dr(t))return!1;const r=t.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;o.root&&(o.root.scroll=void 0,o.root.updateScroll());const s=iv(r,o.root,this.visualElement.getTransformPagePoint());let i=o1(o.layout.layoutBox,s);if(n){const a=n(av(i));this.hasMutatedConstraints=!!a,a&&(i=cv(a))}return i}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:o,dragTransition:s,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=en(u=>{if(!qo(u,n,this.currentDirection))return;let d=l&&l[u]||{};(i===!0||i===u)&&(d={min:0,max:0});const h=o?200:1e6,p=o?40:1e7,b={type:"inertia",velocity:r?t[u]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...s,...d};return this.startAxisValueAnimation(u,b)});return Promise.all(c).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Jc(this.visualElement,t),r.start(Bd(t,r,0,n,this.visualElement,!1))}stopAnimation(){en(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,o=this.visualElement.getProps()[n];return o||this.visualElement.getValue(t,this.visualElement.latestValues[t]??0)}snapToCursor(t){en(n=>{const{drag:r}=this.getProps();if(!qo(n,r,this.currentDirection))return;const{projection:o}=this.visualElement,s=this.getAxisMotionValue(n);if(o&&o.layout){const{min:i,max:a}=o.layout.layoutBox[n],l=s.get()||0;s.set(t[n]-Ke(i,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Dr(n)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};en(i=>{const a=this.getAxisMotionValue(i);if(a&&this.constraints!==!1){const l=a.get();o[i]=s1({min:l,max:l},this.constraints[i])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),en(i=>{if(!qo(i,t,null))return;const a=this.getAxisMotionValue(i),{min:l,max:c}=this.constraints[i];a.set(Ke(l,c,o[i]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;c1.set(this.visualElement,this);const t=this.visualElement.current,n=no(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps(),h=c.target,p=h!==t&&lv(h);u&&d&&!p&&this.start(c)});let r;const o=()=>{const{dragConstraints:c}=this.getProps();Dr(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),r||(r=u1(t,c.current,()=>this.scalePositionWithinConstraints())))},{projection:s}=this.visualElement,i=s.addEventListener("measure",o);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),yt.read(o);const a=qa(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",(({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(en(d=>{const h=this.getAxisMotionValue(d);h&&(this.originPoint[d]+=c[d].translate,h.set(h.get()+c[d].translate))}),this.visualElement.render())}));return()=>{a(),n(),i(),l&&l(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:s=!1,dragElastic:i=za,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:o,dragConstraints:s,dragElastic:i,dragMomentum:a}}}function ad(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function u1(e,t,n){const r=_u(e,ad(n)),o=_u(t,ad(n));return()=>{r(),o()}}function qo(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function d1(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class f1 extends Zd{constructor(t){super(t),this.removeGroupControls=dr,this.removeListeners=dr,this.controls=new l1(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||dr}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const ea=e=>(t,n)=>{e&&yt.update(()=>e(t,n),!1,!0)};class p1 extends Zd{constructor(){super(...arguments),this.removePointerDownListener=dr}onPointerDown(t){this.session=new hh(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:mh(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:ea(t),onStart:ea(n),onMove:ea(r),onEnd:(s,i)=>{delete this.session,o&&yt.postRender(()=>o(s,i))}}}mount(){this.removePointerDownListener=no(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let ta=!1;class m1 extends m.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:o}=this.props,{projection:s}=t;s&&(n.group&&n.group.add(s),r&&r.register&&o&&r.register(s),ta&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),ds.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:o,isPresent:s}=this.props,{projection:i}=r;return i&&(i.isPresent=s,t.layoutDependency!==n&&i.setOptions({...i.options,layoutDependency:n}),ta=!0,o||t.layoutDependency!==n||n===void 0||t.isPresent!==s?i.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?i.promote():i.relegate()||yt.postRender(()=>{const a=i.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:n}=this.props,{projection:r}=t;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),zd.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:o}=t;ta=!0,o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function vh(e){const[t,n]=ph(),r=m.useContext(Fd);return f.jsx(m1,{...e,layoutGroup:r,switchLayoutGroup:m.useContext(Gg),isPresent:t,safeToRemove:n})}const h1={pan:{Feature:p1},drag:{Feature:f1,ProjectionNode:fh,MeasureLayout:vh}},g1={layout:{ProjectionNode:fh,MeasureLayout:vh}},v1={...dv,...uv,...h1,...g1},b1=qg(v1,fv);function y1(e){return"type"in e&&e.type==="separator"}function x1(e){return"type"in e&&e.type==="group"}var w1={borderColor:"var(--hud-chrome-border, oklch(var(--border)))"},E1={backgroundColor:"var(--hud-chrome-border, oklch(var(--border)))"};function cd({item:e}){return f.jsxs(TC,{disabled:e.disabled,onClick:e.action,label:e.label,className:"flex items-center gap-3 px-3 py-1.5 text-[12px] font-mono text-popover-foreground outline-none select-none data-[highlighted]:bg-accent/10 data-[highlighted]:text-accent data-[disabled]:opacity-40 data-[disabled]:pointer-events-none cursor-default",children:[e.icon&&f.jsx("span",{className:"w-4 h-4 flex items-center justify-center text-muted-foreground",children:e.icon}),f.jsx("span",{className:"flex-1",children:e.label}),e.shortcut&&f.jsx("span",{className:"text-muted-foreground text-[10px] ml-4 tracking-wider",children:e.shortcut})]})}var bh=yg.forwardRef(({items:e},t)=>f.jsx(b1.div,{ref:t,initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.1,ease:"easeOut"},children:f.jsx(v_,{className:"bg-popover/95 backdrop-blur-xl border rounded-lg shadow-2xl py-1 min-w-[180px] z-[200] outline-none",style:w1,"aria-label":"Context menu",children:e.map((n,r)=>y1(n)?f.jsx(G_,{className:"h-px my-1",style:E1},`sep-${r}`):x1(n)?f.jsxs(CC,{children:[f.jsx(RC,{className:"px-3 py-1 text-[10px] font-mono uppercase tracking-widest text-muted-foreground",children:n.label}),n.items.map(o=>f.jsx(cd,{item:o},o.id))]},`grp-${r}`):f.jsx(cd,{item:n},n.id))})}));bh.displayName="PopupContent";function S1(e,t){switch(t){case"alt":return e.altKey;case"meta":return e.metaKey;case"ctrl":return e.ctrlKey;default:return e.shiftKey}}function k1({items:e,children:t,nativeMenuModifier:n="alt",activationMode:r="default"}){const o=m.useRef(!1);return e.length===0?f.jsx(f.Fragment,{children:t}):f.jsxs(q_,{children:[f.jsx(Y_,{render:f.jsx("div",{style:{display:"contents"},"aria-haspopup":"menu",onKeyDownCapture:s=>{if(s.defaultPrevented||!(s.key==="ContextMenu"||s.shiftKey&&s.key==="F10"))return;s.preventDefault(),s.stopPropagation();const l=(s.target instanceof HTMLElement?s.target:s.currentTarget).getBoundingClientRect(),c=l.left+Math.min(24,Math.max(0,l.width/2)),u=l.top+Math.min(24,Math.max(0,l.height/2));o.current=!0;try{s.currentTarget.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,view:window,clientX:c,clientY:u,button:2}))}finally{o.current=!1}},onContextMenuCapture:s=>{if(o.current)return;const i=S1(s,n);(r==="modifier"?!i:i)&&s.stopPropagation()}}),children:t}),f.jsx(y_,{children:f.jsx(A_,{className:"z-[200]",sideOffset:4,children:f.jsx(XP,{children:f.jsx(bh,{items:e})})})})]})}function Rc(){const{titleBarInset:e}=go();return m.useMemo(()=>{const t=gr.layout.navHeight+e;return{navTotalHeight:t,panelTopOffset:t}},[e])}var ld=()=>{},C1={x:0,y:0},R1=({children:e,hud:t,mode:n="canvas",panOffset:r=C1,scale:o=1,onPan:s=ld,onZoom:i=ld,onPanStart:a,onPanEnd:l,isTransitioning:c=!1,onViewportChange:u,onCanvasClick:d,canvasProps:h,zoomSensitivity:p,zoomControlsRightOffset:b,zoomControlsBottomOffset:x,showZoomControls:E=!0,viewportShiftX:y=0,canvasContextMenuItems:g,canvasContextMenuActivationMode:v})=>{const w=m.useRef(null),S=m.useRef(o);S.current=o;const k=m.useRef(i);k.current=i;const R=m.useRef(s);R.current=s;const C=m.useRef(a);C.current=a;const _=m.useRef(l);_.current=l;const I=m.useRef(p);I.current=p;const[M,N]=m.useState(!1),T=m.useRef(!1),[F,O]=m.useState(!1),D=m.useRef(!1),z=m.useRef({x:0,y:0}),A=m.useRef(P=>{const B=P.target||document.activeElement;if(!B)return!1;const U=B.tagName;return!!(U==="INPUT"||U==="TEXTAREA"||B.isContentEditable||B.closest?.(".xterm"))});m.useEffect(()=>{if(n!=="canvas")return;const P=q=>{q.key!==" "||q.repeat||A.current(q)||c||(q.preventDefault(),T.current=!0,N(!0))},B=q=>{q.key===" "&&T.current&&(T.current=!1,N(!1),D.current&&(D.current=!1,O(!1),_.current?.()))},U=()=>{T.current&&(T.current=!1,N(!1),D.current&&(D.current=!1,O(!1),_.current?.()))};return window.addEventListener("keydown",P),window.addEventListener("keyup",B),window.addEventListener("blur",U),()=>{window.removeEventListener("keydown",P),window.removeEventListener("keyup",B),window.removeEventListener("blur",U)}},[n,c]);const Z=m.useCallback(P=>{P.button===0&&(P.preventDefault(),D.current=!0,O(!0),z.current={x:P.clientX,y:P.clientY},C.current?.())},[]);return m.useEffect(()=>{if(!M)return;const P=U=>{if(!D.current)return;const q=(U.clientX-z.current.x)/S.current,he=(U.clientY-z.current.y)/S.current;z.current={x:U.clientX,y:U.clientY},R.current({x:q,y:he})},B=()=>{D.current&&(D.current=!1,O(!1),_.current?.())};return window.addEventListener("mousemove",P),window.addEventListener("mouseup",B),()=>{window.removeEventListener("mousemove",P),window.removeEventListener("mouseup",B)}},[M]),m.useEffect(()=>{if(n!=="canvas")return;const P=B=>{if(B.ctrlKey||B.metaKey){B.preventDefault();const U=S.current,q=-B.deltaY*.001*(I.current??1),he=Math.min(Math.max(.2,U+q),3);S.current=he,k.current(he)}};return window.addEventListener("wheel",P,{passive:!1}),()=>window.removeEventListener("wheel",P)},[n]),m.useEffect(()=>{if(!u)return;let P=null;const B=()=>{P&&cancelAnimationFrame(P),P=requestAnimationFrame(()=>{u({width:window.innerWidth,height:window.innerHeight})})};return B(),window.addEventListener("resize",B),()=>{window.removeEventListener("resize",B),P&&cancelAnimationFrame(P)}},[u]),n==="panel"?f.jsxs("div",{ref:w,className:"fixed inset-0 bg-background text-foreground overflow-hidden font-sans select-none z-0",children:[f.jsx("div",{className:"absolute inset-0 z-10 overflow-auto frame-scrollbar",children:e}),f.jsx("div",{className:"fixed inset-0 pointer-events-none overflow-hidden",style:{zIndex:gr.zIndex.navigationStack},children:t})]}):f.jsxs("div",{ref:w,className:"fixed inset-0 bg-background text-foreground overflow-hidden font-sans select-none z-0",children:[f.jsx(k1,{items:g??[],activationMode:v,children:f.jsx(pv,{panOffset:r,scale:o,onPan:s,onPanStart:a,onPanEnd:l,isPanLocked:c,onClick:d,showGuides:h?.showGuides,onGuidesChange:h?.onGuidesChange,gridOpacity:h?.gridOpacity})}),f.jsx("div",{className:"absolute z-10 pointer-events-none",style:{left:"50%",top:"50%",zoom:o,transform:y?`translateX(${y}px)`:void 0,transition:"transform 240ms cubic-bezier(0.34, 1.7, 0.64, 1)"},children:f.jsx("div",{style:{position:"absolute",left:r.x,top:r.y},children:e})}),M&&f.jsx("div",{className:`fixed inset-0 z-20 ${F?"cursor-grabbing":"cursor-grab"}`,onMouseDown:Z}),E&&f.jsx("div",{className:"absolute z-30 transition-[bottom,right] duration-200",style:{bottom:`calc(${44+(x??0)}px + var(--hud-player-panel-offset, 0px))`,right:16+(b??0)},children:f.jsx(mv,{scale:o,onZoom:P=>i(P)})}),f.jsx("div",{className:"fixed inset-0 pointer-events-none overflow-hidden",style:{zIndex:gr.zIndex.navigationStack},children:t})]})},T1=R1,_1=({side:e,title:t,icon:n,isCollapsed:r=!1,onToggleCollapse:o,headerActions:s,footer:i,style:a,width:l,onResizeStart:c,floating:u=!1,children:d})=>{const h="var(--hud-chrome-border, oklch(var(--border) / 0.8))",{panelTopOffset:p}=Rc();if(r){const w=e==="left"?Sb:Tb;return f.jsx("button",{onClick:o,className:`fixed top-1/2 -translate-y-1/2 z-40 ${e==="left"?"left-3":"right-3"} p-2.5 rounded bg-card/95 border hover:border-accent/60 shadow-[var(--hud-shadow-panel)] hover:shadow-[var(--hud-shadow-panel-hover,var(--hud-shadow-panel))] transition-all duration-200 group pointer-events-auto focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background focus-visible:outline-none`,style:{borderColor:"var(--hud-chrome-border, oklch(var(--border) / 0.8))"},title:`Expand ${t||"panel"}`,children:f.jsx(w,{size:14,className:"text-muted-foreground group-hover:text-accent transition-colors",strokeWidth:1.5})})}const b=e==="left"?wb:Cb,y=`bg-card/95 border shadow-[var(--hud-shadow-panel)] fixed z-40 rounded-none border-t-0 overflow-hidden ${e==="left"?"border-l-0 border-r-0":"border-r-0 border-l-0"}`,g=u?{boxShadow:`var(--hud-shadow-panel-float, 0 0 0 1px ${h}, ${e==="left"?"18px":"-18px"} 0 48px -12px rgba(0, 0, 0, 0.55))`,backdropFilter:"blur(24px) saturate(140%)",WebkitBackdropFilter:"blur(24px) saturate(140%)"}:{},v={position:"fixed",top:p,bottom:28,left:e==="left"?0:void 0,right:e==="right"?0:void 0,width:`${l||280}px`,borderColor:h,...g,...a};return f.jsxs("div",{"data-frame-panel":e==="left"?"manifest":"inspector","data-floating":u?"true":void 0,className:`${y} pointer-events-none select-none font-mono text-[11px] flex flex-col`,style:v,children:[c&&f.jsxs("div",{className:`absolute top-0 ${e==="left"?"right-0":"left-0"} bottom-0 w-[7px] cursor-ew-resize z-50 pointer-events-auto group flex items-center justify-center`,onMouseDown:c,children:[f.jsx("div",{className:`absolute top-0 bottom-0 ${e==="left"?"right-0":"left-0"} w-px transition-colors group-hover:bg-accent/30`,style:{backgroundColor:h}}),f.jsxs("div",{className:"flex flex-col gap-[3px] opacity-0 group-hover:opacity-100 transition-opacity",children:[f.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground/70 group-hover:bg-accent/70"}),f.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground/70 group-hover:bg-accent/70"}),f.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground/70 group-hover:bg-accent/70"})]})]}),!c&&f.jsx("div",{className:`absolute top-0 ${e==="left"?"right-0":"left-0"} bottom-0 w-px`,style:{backgroundColor:h}}),f.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-foreground/4 to-transparent z-10"}),f.jsxs("div",{className:"pointer-events-auto flex-1 flex flex-col overflow-hidden",children:[t&&f.jsx("div",{className:"shrink-0 p-4",style:{borderBottom:`1px dashed ${h}`},children:f.jsxs("div",{className:"flex items-center justify-between text-foreground text-[10px]",children:[f.jsxs("div",{className:"flex items-center gap-1.5",children:[n&&f.jsx("span",{className:"text-muted-foreground",children:n}),f.jsx("span",{className:"tracking-[0.18em] font-normal uppercase text-muted-foreground",children:t})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[s,o&&f.jsx("button",{onClick:o,className:"p-1 hover:bg-accent/10 rounded transition-colors text-muted-foreground hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",title:"Collapse panel",children:f.jsx(b,{size:12})})]})]})}),f.jsx("div",{className:"flex-1 overflow-y-auto frame-scrollbar",children:d}),i&&f.jsx("div",{className:"shrink-0",children:i})]})]})},La=_1,P1={emerald:{dot:"bg-success",ping:"bg-success",text:"text-success"},amber:{dot:"bg-warning",ping:"bg-warning",text:"text-warning"},red:{dot:"bg-destructive",ping:"bg-destructive",text:"text-destructive"},neutral:{dot:"bg-muted-foreground",ping:"bg-muted-foreground",text:"text-muted-foreground"}},I1={borderColor:"var(--hud-chrome-border, oklch(var(--border)))"},A1=({left:e,viewport:t,right:n,isMinimapCollapsed:r=!1,onExpandMinimap:o,status:s={label:"READY",color:"emerald"},onStatusClick:i,onToggleTerminal:a,isTerminalOpen:l=!1})=>{const[c,u]=m.useState(new Date),[d,h]=m.useState(!1),[p,b]=m.useState(!1);m.useEffect(()=>{b(!0);const w=setInterval(()=>u(new Date),1e3);return()=>clearInterval(w)},[]);const x=P1[s.color],E=s.title??s.label,y=`shrink-0 flex items-center gap-2 ${x.text}`,g=f.jsxs(f.Fragment,{children:[f.jsx("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${x.dot}`}),f.jsx("span",{className:"font-light tracking-[0.18em] uppercase text-[9px]",children:s.label})]}),v=async()=>{if(!t)return;const w=`PAN: ${t.pan.x.toFixed(0)},${t.pan.y.toFixed(0)} | SIZE: ${t.canvasSize?.w??1024}x${t.canvasSize?.h??1024} | ZOOM: ${(t.zoom*100).toFixed(0)}%`;try{await navigator.clipboard.writeText(w),h(!0),setTimeout(()=>h(!1),1500)}catch{}};return f.jsxs("div",{"data-frame-panel":"status-bar",className:`${rb.statusBar} h-7 flex items-center justify-between gap-3 px-3 select-none font-mono text-[9px] md:text-[10px] text-foreground pointer-events-auto overflow-hidden`,style:I1,children:[f.jsxs("div",{className:"min-w-0 flex items-center gap-3 md:gap-4 overflow-hidden",children:[r&&o&&f.jsxs(f.Fragment,{children:[f.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none rounded",title:"Expand minimap",children:[f.jsx(yb,{size:10}),f.jsx("span",{className:"text-[9px] font-light tracking-[0.18em] uppercase",children:"Map"})]}),f.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/40 select-none",children:"·"})]}),i?f.jsx("button",{type:"button",onClick:i,className:`${y} rounded transition-opacity hover:opacity-85 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,title:E,"aria-label":E,children:g}):f.jsx("div",{className:y,title:s.title,children:g}),e&&f.jsxs(f.Fragment,{children:[f.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/40 select-none",children:"·"}),e]})]}),t&&f.jsx("div",{className:"hidden lg:flex absolute -translate-x-1/2 items-center gap-3 opacity-70 hover:opacity-100 transition-[left,opacity] duration-200",style:{left:"calc(50% - var(--hud-player-status-inline-offset, 0px))"},children:f.jsxs("button",{onClick:v,className:"flex items-center gap-3 hover:text-foreground transition-colors cursor-pointer focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none rounded",title:"Copy viewport data",children:[f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"text-muted-foreground tracking-[0.18em] text-[9px] uppercase",children:"Pan"}),f.jsxs("span",{className:`tabular-nums ${d?"text-accent":""}`,children:[t.pan.x.toFixed(0),",",t.pan.y.toFixed(0)]})]}),f.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/40 select-none",children:"·"}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"text-muted-foreground tracking-[0.18em] text-[9px] uppercase",children:"Size"}),f.jsxs("span",{className:`tabular-nums ${d?"text-accent":""}`,children:[t.canvasSize?.w??1024,"x",t.canvasSize?.h??1024]})]}),f.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/40 select-none",children:"·"}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"text-muted-foreground tracking-[0.18em] text-[9px] uppercase",children:"Zoom"}),f.jsxs("span",{className:`tabular-nums ${d?"text-accent":""}`,children:[(t.zoom*100).toFixed(0),"%"]})]})]})}),f.jsxs("div",{className:"shrink-0 flex items-center gap-3 md:gap-4",children:[a&&f.jsxs(f.Fragment,{children:[f.jsxs("button",{onClick:a,className:`flex items-center gap-1.5 transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none rounded ${l?"text-accent":"text-muted-foreground hover:text-foreground"}`,title:"Toggle Console (Ctrl+`)",children:[f.jsxs("span",{className:"text-[10px]",children:[">","_"]}),f.jsx("span",{className:"uppercase text-[9px] font-light tracking-[0.18em]",children:"Console"})]}),f.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/40 select-none",children:"·"})]}),n,n&&f.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/40 select-none",children:"·"}),f.jsxs("div",{className:"flex items-center gap-1.5 text-foreground min-w-[60px] justify-end",children:[f.jsx(hv,{size:11,className:"text-muted-foreground"}),f.jsx("span",{children:p?c.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"--:--"})]})]})]})},O1=A1,M1=({onOpenCommandPalette:e,extraControls:t})=>f.jsx("div",{className:"select-none font-mono text-[11px]",style:{borderTop:"1px dashed var(--hud-chrome-border, oklch(var(--border) / 0.6))"},children:f.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[f.jsxs("button",{onClick:e,className:"flex items-center gap-1.5 text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none rounded",children:[f.jsx(Ls,{size:10}),f.jsx("span",{className:"tracking-[0.18em] font-normal uppercase text-[10px]",children:"Command Palette"})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[t,f.jsx("kbd",{className:"text-[10px] text-muted-foreground font-mono",children:"⌘K"})]})]})}),N1=M1;const ud={"light-prod":"Lean launch","max-pro":"Max pro","scope-instrument":"Scope"};function j1(e){const t=wg(e);return t===!0?"on":t===!1?"off":"default"}function D1(e,t){const n=new Set([t]);for(const r of e)r.requiredTier&&n.add(String(r.requiredTier));return[...n]}function z1({isOpen:e,onClose:t,audienceOptions:n}){const r=xg(),{ref:o,onKeyDown:s}=Ud(e),i=ms(),{activeBundle:a,applyBundle:l,resetBundle:c}=Hd(),u=m.useMemo(()=>r?.all()??[],[r]);if(m.useEffect(()=>{if(!e)return;const b=x=>{x.key==="Escape"&&(x.preventDefault(),t())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[e,t]),!e||!r)return null;const d=r.audience(),h=r.layers.local?.audience??"",p=n??D1(u,d.tier);return f.jsx("div",{className:"scout-flag-backdrop",onClick:t,children:f.jsxs("div",{...o,className:"scout-flag-panel",role:"dialog","aria-modal":"true","aria-labelledby":"scout-flag-title",onKeyDown:s,onClick:b=>b.stopPropagation(),children:[f.jsxs("header",{className:"scout-flag-head",children:[f.jsxs("div",{className:"scout-flag-head-copy",children:[f.jsx("h2",{id:"scout-flag-title",className:"scout-flag-title",children:"Feature flags"}),f.jsxs("p",{className:"scout-flag-subtitle",children:["Audience ",f.jsx("strong",{children:d.tier})," · local overrides apply instantly"]})]}),f.jsx("button",{type:"button",className:"btn btn--ghost btn--sm btn--icon","aria-label":"Close feature flags",onClick:t,children:f.jsx($s,{size:14,strokeWidth:1.8})})]}),f.jsxs("div",{className:"scout-flag-toolbar",children:[f.jsx("label",{className:"scout-flag-toolbar-label",htmlFor:"scout-flag-audience",children:"Local audience"}),f.jsxs("select",{id:"scout-flag-audience",className:"scout-flag-select",value:h,onChange:b=>r.setLocalAudienceOverride(b.target.value||null),children:[f.jsxs("option",{value:"",children:["Default (",d.tier,")"]}),p.map(b=>f.jsx("option",{value:b,children:b},b))]}),i&&f.jsx("div",{className:"scout-flag-bundles",children:Object.keys(ud).map(b=>f.jsx("button",{type:"button",className:`chip chip--mono chip--caps chip--sm${a===b?" chip--working":" chip--ghost"}`,onClick:()=>l(b),children:ud[b]},b))})]}),f.jsx("div",{className:"scout-flag-list",children:u.map(b=>{const x=r.layers.local?.flags?.[b.key];return f.jsxs("div",{className:"scout-flag-row",children:[f.jsxs("div",{className:"scout-flag-key",children:[f.jsx("div",{className:"scout-flag-key-name",children:b.key}),f.jsx("div",{className:"scout-flag-key-desc",children:b.definition?.description??b.definition?.label??b.reason})]}),f.jsx("span",{className:`chip chip--mono chip--caps chip--sm ${b.enabled?"chip--success":"chip--neutral"}`,children:b.enabled?"on":"off"}),f.jsx("span",{className:"scout-flag-meta",title:`${b.layer} · ${b.reason}`,children:b.layer}),f.jsxs("select",{className:"scout-flag-select","aria-label":`Override ${b.key}`,value:j1(x),onChange:E=>{const y=E.target.value;r.setLocalOverride(b.key,y==="default"?null:y==="on")},children:[f.jsx("option",{value:"default",children:"default"}),f.jsx("option",{value:"on",children:"on"}),f.jsx("option",{value:"off",children:"off"})]})]},b.key)})}),f.jsxs("footer",{className:"scout-flag-foot",children:[f.jsxs("span",{className:"scout-flag-count",children:[u.length," flags"]}),f.jsx("button",{type:"button",className:"btn btn--ghost btn--sm btn--mono",onClick:c,children:"Reset flags"})]})]})})}const L1={"light-prod":"lean","max-pro":"max","scope-instrument":"scope"};function $1({onOpenPanel:e}){const{activeBundle:t,toggleBundle:n}=Hd();return ms()?f.jsxs("div",{className:"scout-dev-flag",children:[f.jsx("button",{type:"button",className:"chip chip--mono chip--caps chip--sm chip--warning",title:`Experience bundle: ${t}. Click to flip lean/max.`,onClick:n,children:L1[t]}),f.jsx("button",{type:"button",className:"btn btn--ghost btn--sm btn--icon",title:"Open feature flags","aria-label":"Open feature flags",onClick:e,children:f.jsx(pb,{size:11,strokeWidth:1.8})})]}):null}var{statusBarHeight:Yo}=gr.layout,dd=120,fd={borderColor:"var(--hud-chrome-border, oklch(var(--border)))"},F1={backgroundColor:"var(--hud-chrome-border, oklch(var(--border)))"},B1=({isOpen:e,onClose:t,onToggleMaximize:n,isMaximized:r=!1,height:o=320,onHeightChange:s,title:i,headerActions:a,contentOverlay:l,children:c})=>{const u=m.useRef(!1),d=m.useRef(null),h=m.useCallback(b=>{if(!s)return;b.preventDefault(),u.current=!0;const x=b.clientY,E=o;d.current&&(d.current.style.transition="none");const y=v=>{const w=x-v.clientY,S=window.innerHeight-Yo,k=Math.max(dd,Math.min(S,E+w));d.current&&(d.current.style.height=`${k}px`)},g=v=>{u.current=!1,document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",g),d.current&&(d.current.style.transition="");const w=x-v.clientY,S=window.innerHeight-Yo;s(Math.max(dd,Math.min(S,E+w)))};document.addEventListener("mousemove",y),document.addEventListener("mouseup",g)},[o,s]),p=r?`calc(100vh - ${Yo}px)`:`${o}px`;return f.jsxs("div",{ref:d,"data-hudson-template":"hudson",className:`
78
+ fixed left-0 right-0 shadow-[0_-2px_12px_rgba(0,0,0,0.16)] flex flex-col border-t text-card-foreground
79
+ bg-card
80
+ ${e?"translate-y-0 opacity-100 pointer-events-auto":"translate-y-full opacity-0 pointer-events-none"}
81
+ transition-all duration-300 ease-in-out
82
+ `,style:{bottom:Yo,height:p,zIndex:gr.zIndex.drawer,...fd},children:[f.jsxs("div",{className:"h-9 bg-card/80 border-b flex items-center justify-between px-3 shrink-0 select-none backdrop-blur-sm",style:fd,children:[f.jsxs("div",{className:"flex items-center gap-3",children:[i||f.jsxs("div",{className:"flex items-center gap-2 text-accent",children:[f.jsx(Gd,{size:14}),f.jsx("span",{className:"text-[10px] font-light tracking-[0.18em] font-mono uppercase",children:"TERMINAL"})]}),a]}),f.jsx("div",{className:"flex-1 flex items-center justify-center h-full cursor-ns-resize text-muted-foreground hover:text-foreground transition-colors group",title:"Drag to Resize",onMouseDown:h,children:f.jsx("div",{className:"w-16 h-1 rounded-full group-hover:bg-muted-foreground transition-colors",style:F1})}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("button",{onClick:n,className:"p-1.5 rounded hover:bg-accent/10 text-muted-foreground hover:text-foreground transition-colors",title:r?"Restore":"Maximize",children:r?f.jsx(qd,{size:14}):f.jsx(Yd,{size:14})}),f.jsx("button",{onClick:t,className:"p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors",title:"Close console","aria-label":"Close console",children:f.jsx($s,{size:14})})]})]}),f.jsx(Ig.Provider,{value:Ag,children:f.jsxs("div",{"data-hudson-terminal-drawer-content":"true",className:"flex-1 relative overflow-hidden flex flex-col bg-transparent",children:[c,l&&f.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-3 z-30 flex justify-center px-4",children:f.jsx("div",{className:"pointer-events-auto",children:l})})]})})]})},V1=B1,Lr={borderColor:"var(--hud-chrome-border, oklch(var(--border)))"},Z1={"--tw-ring-color":"color-mix(in srgb, var(--hud-accent, currentColor) 34%, transparent)"},U1=({isOpen:e,onClose:t,commands:n})=>{const[r,o]=m.useState(""),[s,i]=m.useState(0),a=m.useId(),l=`${a}-listbox`,c=m.useRef(null),u=m.useRef(null),d=m.useRef(null),h=n.filter(y=>y.label.toLowerCase().includes(r.toLowerCase()));m.useEffect(()=>{e&&(xn.logger.info("hudson.command_palette.open",{category:"command",data:{commandCount:n.length}}),c.current?.focus({preventScroll:!0}),o(""),i(0))},[n.length,e]),m.useEffect(()=>{i(0)},[r]),m.useEffect(()=>{d.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},[s]);const p=(y,g)=>{const v=xn.trace.start("hudson.command.execute",{category:"command",data:{commandId:y.id,surface:"command_palette",source:g,queryLength:r.length,resultCount:h.length}});try{y.action(),v.end(),t()}catch(w){throw v.error(w),w}},b=y=>{if((y.key==="ArrowDown"||y.key==="ArrowUp")&&h.length===0){y.preventDefault();return}y.key==="ArrowDown"?(y.preventDefault(),i(g=>(g+1)%h.length)):y.key==="ArrowUp"?(y.preventDefault(),i(g=>(g-1+h.length)%h.length)):y.key==="Enter"?(y.preventDefault(),h[s]&&p(h[s],"keyboard")):y.key==="Escape"&&t()},x=y=>{if(y.key!=="Tab")return;const g=u.current;if(!g)return;const v=Array.from(g.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(R=>!R.hasAttribute("disabled")&&R.getAttribute("aria-hidden")!=="true");if(v.length===0){y.preventDefault();return}const w=v[0],S=v[v.length-1],k=document.activeElement;y.shiftKey?(k===w||!g.contains(k))&&(y.preventDefault(),S.focus()):k===S&&(y.preventDefault(),w.focus())},E=h[s]?`${a}-option-${s}`:void 0;return e?f.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[15vh] bg-background/45 backdrop-blur-[2px] pointer-events-auto",onClick:t,children:f.jsxs("div",{ref:u,role:"dialog","aria-modal":"true","aria-label":"Command palette",className:"w-[640px] max-w-[90vw] bg-popover border shadow-2xl rounded-lg overflow-hidden flex flex-col animate-in fade-in zoom-in-95 duration-100",style:Lr,onClick:y=>y.stopPropagation(),onKeyDown:x,children:[f.jsxs("div",{className:"flex items-center px-4 py-3 border-b gap-3 focus-within:ring-2 focus-within:outline-none",style:{...Lr,...Z1},children:[f.jsx(Ls,{className:"text-muted-foreground",size:16,strokeWidth:1.5,"aria-hidden":"true"}),f.jsx("input",{ref:c,className:"flex-1 bg-transparent border-none outline-none text-popover-foreground placeholder:text-muted-foreground font-mono text-[12px] font-normal",style:{boxShadow:"none"},placeholder:"Type a command or search",value:r,onChange:y=>o(y.target.value),onKeyDown:b,role:"combobox","aria-expanded":"true","aria-haspopup":"listbox","aria-controls":l,"aria-activedescendant":E,"aria-autocomplete":"list"}),f.jsx("div",{className:"px-1.5 py-0.5 rounded bg-muted border text-[10px] text-muted-foreground font-mono tracking-[0.12em]",style:Lr,"aria-hidden":"true",children:"ESC"})]}),f.jsxs("div",{className:"max-h-[300px] overflow-y-auto py-2 relative",children:[f.jsx("div",{id:l,role:"listbox","aria-label":"Command results",className:"pb-2",children:h.length===0?f.jsx("div",{className:"px-4 py-8 text-center text-muted-foreground text-[11px] font-mono",role:"status",children:"No matching commands"}):h.map((y,g)=>f.jsxs("div",{id:`${a}-option-${g}`,ref:g===s?d:null,role:"option","aria-selected":g===s,className:`px-4 py-2.5 flex items-center gap-3 cursor-pointer transition-colors ${g===s?"bg-accent/10 border-l-2 border-accent":"border-l-2 border-transparent hover:bg-muted/70"}`,onClick:()=>p(y,"pointer"),onMouseEnter:()=>i(g),children:[y.icon&&f.jsx("div",{className:`${g===s?"text-accent":"text-muted-foreground"}`,children:y.icon}),f.jsx("div",{className:"flex-1",children:f.jsx("div",{className:`text-[12px] ${g===s?"text-accent font-medium":"text-foreground/80 font-normal"}`,children:y.label})}),y.shortcut&&f.jsx("div",{className:"text-[10px] font-mono text-muted-foreground bg-muted px-1.5 py-0.5 rounded border tracking-[0.04em]",style:Lr,children:y.shortcut}),g===s&&f.jsx(db,{size:14,className:"text-accent ml-2","aria-hidden":"true"})]},y.id))}),h.length>6&&f.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-8 bg-gradient-to-t from-popover to-transparent pointer-events-none"})]}),f.jsxs("div",{className:"px-4 py-1.5 bg-card/90 backdrop-blur-sm border-t flex justify-between items-center text-[10px] text-muted-foreground font-mono relative z-10 tracking-[0.18em] uppercase",style:Lr,children:[f.jsx("span",{children:"Command Palette"}),f.jsxs("span",{className:"tracking-[0.04em] normal-case",children:[h.length," matches"]})]})]})}):null},W1=U1;const yh=m.createContext(null),H1=m.createContext(null);function G1({children:e}){const[t,n]=m.useState(null);return f.jsx(yh.Provider,{value:t,children:f.jsx(H1.Provider,{value:n,children:e})})}function q1(){return m.useContext(yh)}const xh=_v();function Y1(e){const t=e.toLowerCase();return xh.find(n=>n.key===t)??null}const se=(...e)=>e,K1=[{title:"App shell",bindings:[{chords:[Mv,Nv],label:qr},{chords:[se("⌘","K")],label:"Command palette"},{chords:[se("⌘","["),se("⌘","B")],label:"Toggle sidebar / left panel"},{chords:[se("⌘","]")],label:"Toggle right panel"},{chords:[se("⌘","⇧","]")],label:"Toggle inspector overlay"},{chords:[se("Ctrl","`")],label:"Toggle terminal drawer"},{chords:[se("⌘","J")],label:"Toggle assistant drawer"}]},{title:"Navigation",bindings:xh.map(e=>({chords:[se("g",e.key)],label:e.label}))},{title:"Global",bindings:[{chords:[se("?")],label:"Toggle this help"},{chords:[se("Esc")],label:"Close dialog / clear search"},{chords:[se("Tab"),se("⇧","Tab")],label:"Move focus"},{chords:[se("[")],label:"Focus previous pane"},{chords:[se("]")],label:"Focus next pane"}]},{title:"Lists",bindings:[{chords:[se("↓"),se("j")],label:"Next item"},{chords:[se("↑"),se("k")],label:"Previous item"},{chords:[se("g"),se("Home")],label:"First item"},{chords:[se("G"),se("End")],label:"Last item"},{chords:[se("Enter")],label:"Open / activate"}]},{title:"Search",bindings:[{chords:[se("/")],label:"Focus filter input"},{chords:[se("↓")],label:"From filter → first match"},{chords:[se("Esc")],label:"Clear filter (while focused)"}]},{title:"Composers",bindings:[{chords:[se("Enter"),se("⇧","Enter")],label:"Insert line break"},{chords:[se("⌘","Enter"),se("Ctrl","Enter")],label:"Send message"}]},{title:"Capture routing",bindings:[{chords:[se("Drop")],label:"Drop screenshot/video anywhere"},{chords:[se("⌘","V")],label:"Paste image into route composer"},{chords:[se("Existing chat"),se("New session")],label:"Choose delivery in composer"}]},{title:"Dispatch",bindings:[{chords:[se("↓"),se("j")],label:"Next ledger row"},{chords:[se("↑"),se("k")],label:"Previous ledger row"},{chords:[se("Enter")],label:"Inspect row / open dialogue thread"},{chords:[se("←"),se("→")],label:"Switch dispatch tabs"},{chords:[se("Esc")],label:"Clear inspector selection"}]},{title:"Agent lanes",bindings:[{chords:[se("↓"),se("j")],label:"Next lane"},{chords:[se("↑"),se("k")],label:"Previous lane"},{chords:[se("Enter"),se("i")],label:"Inspect lane"},{chords:[se("1","…","4")],label:"Switch trace window (5m → 24h)"},{chords:[se("o")],label:"Open session (detail sheet)"},{chords:[se("t")],label:"Open traces (detail sheet)"},{chords:[se("p")],label:"Agent profile (detail sheet)"},{chords:[se("Esc")],label:"Close detail sheet"}]},{title:"Tail · Atop",bindings:[{chords:[se("/")],label:"Open filter (Tail)"},{chords:[se("G")],label:"Jump to live (Tail)"},{chords:[se("j"),se("k")],label:"Walk rows (Atop)"}]},{title:"Session scrubber",bindings:[{chords:[se("←"),se("→")],label:"Seek ±1%"},{chords:[se("⇧","←"),se("⇧","→")],label:"Seek ±5%"},{chords:[se("Home"),se("End")],label:"Jump to start / end"}]}];function J1({open:e,onClose:t}){const{ref:n,onKeyDown:r}=Ud(e);return e?f.jsx("div",{className:"kb-help-backdrop",onClick:t,role:"presentation",children:f.jsxs("div",{ref:n,className:"kb-help-panel",role:"dialog","aria-modal":"true","aria-labelledby":"kb-help-title",onClick:o=>o.stopPropagation(),onKeyDown:r,tabIndex:-1,children:[f.jsxs("header",{className:"kb-help-head",children:[f.jsx("h2",{id:"kb-help-title",className:"kb-help-title",children:"Keyboard shortcuts"}),f.jsx("button",{type:"button",className:"kb-help-close",onClick:t,"aria-label":"Close (Esc)",children:"✕"})]}),f.jsx("div",{className:"kb-help-grid",children:K1.map(o=>f.jsxs("section",{className:"kb-help-group",children:[f.jsx("h3",{className:"kb-help-group-title",children:o.title}),f.jsx("dl",{className:"kb-help-list",children:o.bindings.map((s,i)=>f.jsxs("div",{className:"kb-help-row",children:[f.jsx("dt",{className:"kb-help-keys",children:s.chords.map((a,l)=>f.jsxs("span",{className:"kb-help-chord-wrap",children:[l>0&&f.jsx("span",{className:"kb-help-or",children:"or"}),f.jsx("span",{className:"kb-help-chord",children:a.map((c,u)=>f.jsx("kbd",{className:"kb-help-kbd",children:c},`${c}-${u}`))})]},`${l}-${a.join("+")}`))}),f.jsx("dd",{className:"kb-help-label",children:s.label})]},`${o.title}-${i}`))})]},o.title))}),f.jsxs("footer",{className:"kb-help-foot",children:["Press ",f.jsx("kbd",{className:"kb-help-kbd",children:"?"})," to toggle · ",f.jsx("kbd",{className:"kb-help-kbd",children:"Esc"})," to close"]})]})}):null}function X1(){const[e,t]=m.useState(!1);return m.useEffect(()=>{const n=r=>{if(r.key==="Escape"&&e){r.preventDefault(),t(!1);return}r.key==="?"&&(Wd(r.target)||(r.preventDefault(),t(o=>!o)))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e]),{open:e,setOpen:t}}const Q1=15e3,eI=3e4;function tI(){const[e,t]=m.useState([]),[n,r]=m.useState(null),[o,s]=m.useState(null),i=m.useRef(!0),a=m.useRef(null),l=m.useCallback(async()=>{try{const p=await da("/api/notifications?type=pairing_request");if(!i.current)return!0;const b=p.notifications.map(x=>x.data?.request).filter(x=>x?.status==="pending");return t(b),!0}catch{return!1}},[]);m.useEffect(()=>{i.current=!0;let p=!1;const b=()=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null)},x=g=>{b(),a.current=window.setTimeout(()=>{E()},g)},E=async()=>{if(b(),!$v())return;const g=await l();p||!i.current||x(g?Q1:eI)};E();const y=Lv(()=>{E()});return()=>{p=!0,i.current=!1,b(),y()}},[l]);const c=m.useCallback(async(p,b)=>{r(p),s(null);try{await da(`/api/pairing/requests/${encodeURIComponent(p)}/decide`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({decision:b})}),t(x=>x.filter(E=>E.token!==p)),l()}catch(x){s(x instanceof Error?x.message:String(x))}finally{r(null)}},[l]);if(e.length===0)return null;const u=e[0],d=u.requesterLabel?.trim()||"A device",h=n===u.token;return f.jsx("div",{className:"scout-pair-prompt",role:"alertdialog","aria-label":"Pairing request",children:f.jsxs("div",{className:"scout-pair-prompt-card",children:[f.jsx("div",{className:"scout-pair-prompt-eyebrow",children:"Pairing request"}),f.jsxs("div",{className:"scout-pair-prompt-title",children:[d," wants to pair"]}),f.jsxs("div",{className:"scout-pair-prompt-detail",children:["On your network",u.requesterIp?` · ${u.requesterIp}`:"",". Allowing trusts this device and starts pair mode."]}),o?f.jsx("div",{className:"scout-pair-prompt-error",children:o}):null,f.jsxs("div",{className:"scout-pair-prompt-actions",children:[f.jsx("button",{type:"button",className:"scout-pair-prompt-btn scout-pair-prompt-deny",disabled:h,onClick:()=>{c(u.token,"deny")},children:"Deny"}),f.jsx("button",{type:"button",className:"scout-pair-prompt-btn scout-pair-prompt-allow",disabled:h,onClick:()=>{c(u.token,"approve")},children:h?"Allowing…":"Allow"})]}),e.length>1?f.jsxs("div",{className:"scout-pair-prompt-more",children:["+",e.length-1," more waiting"]}):null]})})}const wh=200;function nI({onOpen:e}){return f.jsx("button",{type:"button",onClick:e,className:"flex min-w-0 items-center rounded px-1 py-0.5 transition-colors hover:bg-muted/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",title:"Open activity log","aria-label":"Open activity log",children:f.jsx(jg,{maxEvents:wh,showCounts:!0})})}function rI({open:e,onClose:t}){return m.useEffect(()=>{if(!e)return;const n=r=>{r.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e]),e?f.jsx("div",{className:"fixed inset-0 z-[70] flex bg-background/88 p-3 text-foreground backdrop-blur-md md:p-5",role:"dialog","aria-modal":"true","aria-label":"Activity log",children:f.jsxs("div",{className:"flex min-h-0 w-full flex-col",children:[f.jsxs("div",{className:"flex h-10 shrink-0 items-center justify-between border border-border border-b-0 bg-card/95 px-3 shadow-[var(--hud-shadow-nav)]",children:[f.jsx("div",{className:"min-w-0 font-mono text-sm font-semibold uppercase tracking-[0.18em] text-foreground",children:"Activity Log"}),f.jsx("button",{type:"button",onClick:t,className:"rounded p-1 text-muted-foreground transition-colors hover:bg-muted/70 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",title:"Close activity log","aria-label":"Close activity log",children:f.jsx($s,{size:14})})]}),f.jsx(Ng,{observability:xn,maxEvents:wh,title:"activity",className:"min-h-0 flex-1 rounded-t-none",emptyMessage:"No activity yet. Connection and status events will appear here."})]})}):null}function oI({dictationActive:e}){const t=hr(Kd,!1),{open:n,setOpen:r,state:o}=Sv(),{navigate:s}=Kt(),i=m.useRef(null),[a,l]=m.useState({left:12,bottom:36});if(m.useEffect(()=>()=>r(!1),[r]),m.useEffect(()=>{if(!n)return;const h=p=>{p.key==="Escape"&&(p.preventDefault(),r(!1),i.current?.focus())};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[n,r]),m.useLayoutEffect(()=>{if(!n)return;const h=()=>{const p=i.current;if(!p)return;const b=p.getBoundingClientRect(),x=Math.min(384,window.innerWidth-16);l({left:Math.max(8,Math.min(b.left,window.innerWidth-x-8)),bottom:Math.max(36,window.innerHeight-b.top+8)})};return h(),window.addEventListener("resize",h),window.addEventListener("scroll",h,!0),()=>{window.removeEventListener("resize",h),window.removeEventListener("scroll",h,!0)}},[n]),!t)return null;const u=o==="connecting"||o==="live"?o==="connecting"?"Scoutbot voice is connecting":"Scoutbot voice is live":n?"Hide Scoutbot voice":"Open Scoutbot voice controls",d=typeof document>"u"?null:document.querySelector("[data-scout-theme]")??document.body;return f.jsxs("div",{className:"flex items-center",children:[f.jsxs("button",{ref:i,type:"button",onClick:()=>r(h=>!h),title:u,"aria-label":u,"aria-expanded":n,"aria-controls":"scoutbot-realtime-voice-menu",className:`flex h-[18px] items-center gap-1.5 rounded border px-1.5 font-mono text-2xs uppercase tracking-[0.1em] transition-colors ${o==="live"?"border-lime-300/35 bg-lime-300/[0.08] text-lime-100":o==="connecting"?"border-amber-300/30 bg-amber-300/[0.07] text-amber-100/90":o==="error"?"border-red-400/30 bg-red-400/[0.07] text-red-100":n?"border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-hover)] text-[var(--scout-chrome-ink)]":"border-transparent text-[var(--scout-chrome-ink-faint)] hover:text-[var(--scout-chrome-ink)]"}`,children:[o==="connecting"?f.jsx(ca,{size:10,className:"animate-spin","aria-hidden":"true"}):o==="live"?f.jsxs("span",{className:"relative flex size-1.5 shrink-0","aria-hidden":"true",children:[f.jsx("span",{className:"absolute inline-flex size-full animate-ping rounded-full bg-lime-300/30"}),f.jsx("span",{className:"relative inline-flex size-1.5 rounded-full bg-lime-300/90"})]}):f.jsx(Fv,{size:10,fill:"currentColor","aria-hidden":"true"}),f.jsx("span",{children:o==="live"?"Voice live":o==="connecting"?"Voice connecting":"Voice"})]}),n&&d&&Yt.createPortal(f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"fixed inset-0 z-[80]","aria-hidden":"true",onMouseDown:()=>r(!1)}),f.jsxs("div",{id:"scoutbot-realtime-voice-menu",className:"fixed z-[81] flex h-[min(31rem,calc(100vh-3rem))] min-h-80 w-[min(24rem,calc(100vw-1rem))] min-w-80 resize flex-col overflow-hidden rounded-xl border border-[color-mix(in_srgb,var(--hud-ink)_13%,transparent)] bg-[color-mix(in_srgb,var(--scout-chrome-bg)_96%,black)] shadow-[0_18px_44px_rgba(0,0,0,0.46)] backdrop-blur-md",style:{left:a.left,bottom:a.bottom},role:"dialog","aria-label":"Scoutbot live voice",onMouseDown:h=>h.stopPropagation(),children:[f.jsx(Bv,{state:o,onExpand:()=>{r(!1),s({view:"voice"})}}),f.jsx(Vv,{dictationActive:e})]})]}),d)]})}let pd=!1;function sI(){pd||(pd=!0,xn.setEnabled(!0),xn.logger.info("Scout web shell booted",{category:"shell"}))}function iI(e,t){const n=m.useRef(null),r=m.useRef(null),o=m.useRef(null);m.useEffect(()=>{if(sI(),t.status==="offline"||t.status==="degraded"){const s=t.message?.trim()||"Scout web API unreachable";s!==n.current&&(n.current=s,xn.logger.log(t.status==="offline"?"error":"warn",s,{category:"connection"}))}else n.current=null;if(e.status.color==="red"){const s=e.status.label.trim();s&&s!==r.current&&(r.current=s,xn.logger.error(s,{category:"status"}))}else r.current=null;if(e.mesh.color==="amber"||e.mesh.color==="red"){const s=`${e.mesh.label}: ${e.mesh.value}`;if(s!==o.current){o.current=s;const i=e.mesh.color==="red"?"error":"warn";xn.logger.log(i,s,{category:"mesh"})}}else o.current=null},[t.message,t.status,e.mesh,e.status])}function Tc(e){return Vt(e.defaultTagName??"div",e,e)}function Eh(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Eh(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Sh(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Eh(e))&&(r&&(r+=" "),r+=t);return r}const md=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,hd=Sh,aI=(e,t)=>n=>{var r;if(t?.variants==null)return hd(e,n?.class,n?.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(c=>{const u=n?.[c],d=s?.[c];if(u===null)return null;const h=md(u)||md(d);return o[c][h]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,h]=u;return h===void 0||(c[d]=h),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:h,...p}=u;return Object.entries(p).every(b=>{let[x,E]=b;return Array.isArray(E)?E.includes({...s,...a}[x]):{...s,...a}[x]===E})?[...c,d,h]:c},[]);return hd(e,i,l,n?.class,n?.className)},cI=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},lI=(e,t)=>({classGroupId:e,validator:t}),kh=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Ds="-",gd=[],uI="arbitrary..",dI=e=>{const t=pI(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return fI(i);const a=i.split(Ds),l=a[0]===""&&a.length>1?1:0;return Ch(a,l,t)},getConflictingClassGroupIds:(i,a)=>{if(a){const l=r[i],c=n[i];return l?c?cI(c,l):l:c||gd}return n[i]||gd}}},Ch=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const c=Ch(e,t+1,s);if(c)return c}const i=n.validators;if(i===null)return;const a=t===0?e.join(Ds):e.slice(t).join(Ds),l=i.length;for(let c=0;c<l;c++){const u=i[c];if(u.validator(a))return u.classGroupId}},fI=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?uI+r:void 0})(),pI=e=>{const{theme:t,classGroups:n}=e;return mI(n,t)},mI=(e,t)=>{const n=kh();for(const r in e){const o=e[r];_c(o,n,r,t)}return n},_c=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const i=e[s];hI(i,t,n,r)}},hI=(e,t,n,r)=>{if(typeof e=="string"){gI(e,t,n);return}if(typeof e=="function"){vI(e,t,n,r);return}bI(e,t,n,r)},gI=(e,t,n)=>{const r=e===""?t:Rh(t,e);r.classGroupId=n},vI=(e,t,n,r)=>{if(yI(e)){_c(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(lI(n,e))},bI=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let i=0;i<s;i++){const[a,l]=o[i];_c(l,Rh(t,a),n,r)}},Rh=(e,t)=>{let n=e;const r=t.split(Ds),o=r.length;for(let s=0;s<o;s++){const i=r[s];let a=n.nextPart.get(i);a||(a=kh(),n.nextPart.set(i,a)),n=a}return n},yI=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,xI=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(s,i)=>{n[s]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let i=n[s];if(i!==void 0)return i;if((i=r[s])!==void 0)return o(s,i),i},set(s,i){s in n?n[s]=i:o(s,i)}}},$a="!",vd=":",wI=[],bd=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),EI=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,a=0,l=0,c;const u=o.length;for(let x=0;x<u;x++){const E=o[x];if(i===0&&a===0){if(E===vd){s.push(o.slice(l,x)),l=x+1;continue}if(E==="/"){c=x;continue}}E==="["?i++:E==="]"?i--:E==="("?a++:E===")"&&a--}const d=s.length===0?o:o.slice(l);let h=d,p=!1;d.endsWith($a)?(h=d.slice(0,-1),p=!0):d.startsWith($a)&&(h=d.slice(1),p=!0);const b=c&&c>l?c-l:void 0;return bd(s,p,h,b)};if(t){const o=t+vd,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):bd(wI,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},SI=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const i=n[s],a=i[0]==="[",l=t.has(i);a||l?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(i)):o.push(i)}return o.length>0&&(o.sort(),r.push(...o)),r}},kI=e=>({cache:xI(e.cacheSize),parseClassName:EI(e),sortModifiers:SI(e),postfixLookupClassGroupIds:CI(e),...dI(e)}),CI=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},RI=/\s+/,TI=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s,postfixLookupClassGroupIds:i}=t,a=[],l=e.trim().split(RI);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:h,modifiers:p,hasImportantModifier:b,baseClassName:x,maybePostfixModifierPosition:E}=n(d);if(h){c=d+(c.length>0?" "+c:c);continue}let y=!!E,g;if(y){const R=x.substring(0,E);g=r(R);const C=g&&i[g]?r(x):void 0;C&&C!==g&&(g=C,y=!1)}else g=r(x);if(!g){if(!y){c=d+(c.length>0?" "+c:c);continue}if(g=r(x),!g){c=d+(c.length>0?" "+c:c);continue}y=!1}const v=p.length===0?"":p.length===1?p[0]:s(p).join(":"),w=b?v+$a:v,S=w+g;if(a.indexOf(S)>-1)continue;a.push(S);const k=o(g,y);for(let R=0;R<k.length;++R){const C=k[R];a.push(w+C)}c=d+(c.length>0?" "+c:c)}return c},_I=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=Th(n))&&(o&&(o+=" "),o+=r);return o},Th=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Th(e[r]))&&(n&&(n+=" "),n+=t);return n},PI=(e,...t)=>{let n,r,o,s;const i=l=>{const c=t.reduce((u,d)=>d(u),e());return n=kI(c),r=n.cache.get,o=n.cache.set,s=a,a(l)},a=l=>{const c=r(l);if(c)return c;const u=TI(l,n);return o(l,u),u};return s=i,(...l)=>s(_I(...l))},II=[],tt=e=>{const t=n=>n[e]||II;return t.isThemeGetter=!0,t},_h=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ph=/^\((?:(\w[\w-]*):)?(.+)\)$/i,AI=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,OI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,MI=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,NI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,jI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,DI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,gn=e=>AI.test(e),Ce=e=>!!e&&!Number.isNaN(Number(e)),Xt=e=>!!e&&Number.isInteger(Number(e)),na=e=>e.endsWith("%")&&Ce(e.slice(0,-1)),fn=e=>OI.test(e),Ih=()=>!0,zI=e=>MI.test(e)&&!NI.test(e),Pc=()=>!1,LI=e=>jI.test(e),$I=e=>DI.test(e),FI=e=>!ne(e)&&!re(e),BI=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),VI=e=>Dn(e,Mh,Pc),ne=e=>_h.test(e),Bn=e=>Dn(e,Nh,zI),yd=e=>Dn(e,KI,Ce),ZI=e=>Dn(e,Dh,Ih),UI=e=>Dn(e,jh,Pc),xd=e=>Dn(e,Ah,Pc),WI=e=>Dn(e,Oh,$I),Ko=e=>Dn(e,zh,LI),re=e=>Ph.test(e),$r=e=>Kn(e,Nh),HI=e=>Kn(e,jh),wd=e=>Kn(e,Ah),GI=e=>Kn(e,Mh),qI=e=>Kn(e,Oh),Jo=e=>Kn(e,zh,!0),YI=e=>Kn(e,Dh,!0),Dn=(e,t,n)=>{const r=_h.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Kn=(e,t,n=!1)=>{const r=Ph.exec(e);return r?r[1]?t(r[1]):n:!1},Ah=e=>e==="position"||e==="percentage",Oh=e=>e==="image"||e==="url",Mh=e=>e==="length"||e==="size"||e==="bg-size",Nh=e=>e==="length",KI=e=>e==="number",jh=e=>e==="family-name",Dh=e=>e==="number"||e==="weight",zh=e=>e==="shadow",JI=()=>{const e=tt("color"),t=tt("font"),n=tt("text"),r=tt("font-weight"),o=tt("tracking"),s=tt("leading"),i=tt("breakpoint"),a=tt("container"),l=tt("spacing"),c=tt("radius"),u=tt("shadow"),d=tt("inset-shadow"),h=tt("text-shadow"),p=tt("drop-shadow"),b=tt("blur"),x=tt("perspective"),E=tt("aspect"),y=tt("ease"),g=tt("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...w(),re,ne],k=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],C=()=>[re,ne,l],_=()=>[gn,"full","auto",...C()],I=()=>[Xt,"none","subgrid",re,ne],M=()=>["auto",{span:["full",Xt,re,ne]},Xt,re,ne],N=()=>[Xt,"auto",re,ne],T=()=>["auto","min","max","fr",re,ne],F=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],O=()=>["start","end","center","stretch","center-safe","end-safe"],D=()=>["auto",...C()],z=()=>[gn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...C()],A=()=>[gn,"screen","full","dvw","lvw","svw","min","max","fit",...C()],Z=()=>[gn,"screen","full","lh","dvh","lvh","svh","min","max","fit",...C()],P=()=>[e,re,ne],B=()=>[...w(),wd,xd,{position:[re,ne]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],q=()=>["auto","cover","contain",GI,VI,{size:[re,ne]}],he=()=>[na,$r,Bn],ee=()=>["","none","full",c,re,ne],Y=()=>["",Ce,$r,Bn],ie=()=>["solid","dashed","dotted","double"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[Ce,na,wd,xd],fe=()=>["","none",b,re,ne],L=()=>["none",Ce,re,ne],ae=()=>["none",Ce,re,ne],te=()=>[Ce,re,ne],ye=()=>[gn,"full",...C()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fn],breakpoint:[fn],color:[Ih],container:[fn],"drop-shadow":[fn],ease:["in","out","in-out"],font:[FI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fn],shadow:[fn],spacing:["px",Ce],text:[fn],"text-shadow":[fn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",gn,ne,re,E]}],container:["container"],"container-type":[{"@container":["","normal","size",re,ne]}],"container-named":[BI],columns:[{columns:[Ce,ne,re,a]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{"inset-s":_(),start:_()}],end:[{"inset-e":_(),end:_()}],"inset-bs":[{"inset-bs":_()}],"inset-be":[{"inset-be":_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[Xt,"auto",re,ne]}],basis:[{basis:[gn,"full","auto",a,...C()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ce,gn,"auto","initial","none",ne]}],grow:[{grow:["",Ce,re,ne]}],shrink:[{shrink:["",Ce,re,ne]}],order:[{order:[Xt,"first","last","none",re,ne]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":T()}],"auto-rows":[{"auto-rows":T()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...F(),"normal"]}],"justify-items":[{"justify-items":[...O(),"normal"]}],"justify-self":[{"justify-self":["auto",...O()]}],"align-content":[{content:["normal",...F()]}],"align-items":[{items:[...O(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...O(),{baseline:["","last"]}]}],"place-content":[{"place-content":F()}],"place-items":[{"place-items":[...O(),"baseline"]}],"place-self":[{"place-self":["auto",...O()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pbs:[{pbs:C()}],pbe:[{pbe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mbs:[{mbs:D()}],mbe:[{mbe:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":C()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":C()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],"inline-size":[{inline:["auto",...A()]}],"min-inline-size":[{"min-inline":["auto",...A()]}],"max-inline-size":[{"max-inline":["none",...A()]}],"block-size":[{block:["auto",...Z()]}],"min-block-size":[{"min-block":["auto",...Z()]}],"max-block-size":[{"max-block":["none",...Z()]}],w:[{w:[a,"screen",...z()]}],"min-w":[{"min-w":[a,"screen","none",...z()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...z()]}],h:[{h:["screen","lh",...z()]}],"min-h":[{"min-h":["screen","lh","none",...z()]}],"max-h":[{"max-h":["screen","lh",...z()]}],"font-size":[{text:["base",n,$r,Bn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,YI,ZI]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",na,ne]}],"font-family":[{font:[HI,UI,t]}],"font-features":[{"font-features":[ne]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,re,ne]}],"line-clamp":[{"line-clamp":[Ce,"none",re,yd]}],leading:[{leading:[s,...C()]}],"list-image":[{"list-image":["none",re,ne]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",re,ne]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ce,"from-font","auto",re,Bn]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[Ce,"auto",re,ne]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"tab-size":[{tab:[Xt,re,ne]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",re,ne]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",re,ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:B()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:q()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Xt,re,ne],radial:["",re,ne],conic:[Xt,re,ne]},qI,WI]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:he()}],"gradient-via-pos":[{via:he()}],"gradient-to-pos":[{to:he()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:ee()}],"rounded-s":[{"rounded-s":ee()}],"rounded-e":[{"rounded-e":ee()}],"rounded-t":[{"rounded-t":ee()}],"rounded-r":[{"rounded-r":ee()}],"rounded-b":[{"rounded-b":ee()}],"rounded-l":[{"rounded-l":ee()}],"rounded-ss":[{"rounded-ss":ee()}],"rounded-se":[{"rounded-se":ee()}],"rounded-ee":[{"rounded-ee":ee()}],"rounded-es":[{"rounded-es":ee()}],"rounded-tl":[{"rounded-tl":ee()}],"rounded-tr":[{"rounded-tr":ee()}],"rounded-br":[{"rounded-br":ee()}],"rounded-bl":[{"rounded-bl":ee()}],"border-w":[{border:Y()}],"border-w-x":[{"border-x":Y()}],"border-w-y":[{"border-y":Y()}],"border-w-s":[{"border-s":Y()}],"border-w-e":[{"border-e":Y()}],"border-w-bs":[{"border-bs":Y()}],"border-w-be":[{"border-be":Y()}],"border-w-t":[{"border-t":Y()}],"border-w-r":[{"border-r":Y()}],"border-w-b":[{"border-b":Y()}],"border-w-l":[{"border-l":Y()}],"divide-x":[{"divide-x":Y()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Y()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ie(),"hidden","none"]}],"divide-style":[{divide:[...ie(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ce,re,ne]}],"outline-w":[{outline:["",Ce,$r,Bn]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",u,Jo,Ko]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",d,Jo,Ko]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[Ce,Bn]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":Y()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",h,Jo,Ko]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[Ce,re,ne]}],"mix-blend":[{"mix-blend":[...K(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":K()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ce]}],"mask-image-linear-from-pos":[{"mask-linear-from":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[re,ne]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[Ce]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:B()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",re,ne]}],filter:[{filter:["","none",re,ne]}],blur:[{blur:fe()}],brightness:[{brightness:[Ce,re,ne]}],contrast:[{contrast:[Ce,re,ne]}],"drop-shadow":[{"drop-shadow":["","none",p,Jo,Ko]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",Ce,re,ne]}],"hue-rotate":[{"hue-rotate":[Ce,re,ne]}],invert:[{invert:["",Ce,re,ne]}],saturate:[{saturate:[Ce,re,ne]}],sepia:[{sepia:["",Ce,re,ne]}],"backdrop-filter":[{"backdrop-filter":["","none",re,ne]}],"backdrop-blur":[{"backdrop-blur":fe()}],"backdrop-brightness":[{"backdrop-brightness":[Ce,re,ne]}],"backdrop-contrast":[{"backdrop-contrast":[Ce,re,ne]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ce,re,ne]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ce,re,ne]}],"backdrop-invert":[{"backdrop-invert":["",Ce,re,ne]}],"backdrop-opacity":[{"backdrop-opacity":[Ce,re,ne]}],"backdrop-saturate":[{"backdrop-saturate":[Ce,re,ne]}],"backdrop-sepia":[{"backdrop-sepia":["",Ce,re,ne]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",re,ne]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ce,"initial",re,ne]}],ease:[{ease:["linear","initial",y,re,ne]}],delay:[{delay:[Ce,re,ne]}],animate:[{animate:["none",g,re,ne]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,re,ne]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:L()}],"rotate-x":[{"rotate-x":L()}],"rotate-y":[{"rotate-y":L()}],"rotate-z":[{"rotate-z":L()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":["scale-3d"],skew:[{skew:te()}],"skew-x":[{"skew-x":te()}],"skew-y":[{"skew-y":te()}],transform:[{transform:[re,ne,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ye()}],"translate-x":[{"translate-x":ye()}],"translate-y":[{"translate-y":ye()}],"translate-z":[{"translate-z":ye()}],"translate-none":["translate-none"],zoom:[{zoom:[Xt,re,ne]}],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",re,ne]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":P()}],"scrollbar-track-color":[{"scrollbar-track":P()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mbs":[{"scroll-mbs":C()}],"scroll-mbe":[{"scroll-mbe":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pbs":[{"scroll-pbs":C()}],"scroll-pbe":[{"scroll-pbe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",re,ne]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[Ce,$r,Bn,yd]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},XI=PI(JI);function qe(...e){return XI(Sh(e))}const Lh=m.createContext(void 0);function ii(e){const t=m.useContext(Lh);if(t===void 0&&!e)throw new Error(Bt(72));return t}const QI={...Bm,disabled:ve(e=>e.disabled),instantType:ve(e=>e.instantType),isInstantPhase:ve(e=>e.isInstantPhase),trackCursorAxis:ve(e=>e.trackCursorAxis),disableHoverablePopup:ve(e=>e.disableHoverablePopup),lastOpenChangeReason:ve(e=>e.openChangeReason),closeDelay:ve(e=>e.closeDelay)};class Ic extends xc{constructor(t){super({...eA(),...t},{popupRef:m.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new oi},QI)}setOpen=(t,n)=>{const r=n.reason,o=r===kt,s=t&&r===po,i=!t&&(r===xr||r===Ks);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;const a=()=>{const l={open:t,openChangeReason:r};s?l.instantType="focus":i?l.instantType="dismiss":r===kt&&(l.instantType=void 0);const c=n.trigger?.id??null;(c||t)&&(l.activeTriggerId=c,l.activeTriggerElement=n.trigger??null),this.update(l)};o?Yt.flushSync(a):a()};static useStore(t,n){const r=jt(()=>t??new Ic(n)).current,o=Vm({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=o,r}}function eA(){return{...Fm(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeDelay:0}}function tA(e){const{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:o=!1,trackCursorAxis:s="none",actionsRef:i,onOpenChange:a,onOpenChangeComplete:l,handle:c,triggerId:u,defaultTriggerId:d=null,children:h}=e,p=Ic.useStore(c?.store,{open:r??n,activeTriggerId:u!==void 0?u:d});p.useControlledProp("open",r,n),p.useControlledProp("activeTriggerId",u,d),p.useContextCallback("onOpenChange",a),p.useContextCallback("onOpenChangeComplete",l);const b=p.useState("open"),x=p.useState("activeTriggerId"),E=p.useState("payload");p.useSyncedValues({trackCursorAxis:s,disableHoverablePopup:o});const y=!t&&b;ue(()=>{b&&t&&p.setOpen(!1,Me(tC))},[b,t,p]),p.useSyncedValue("disabled",t),Lm(p);const{forceUnmount:g,transitionStatus:v}=$m(y,p),w=p.useState("isInstantPhase"),S=p.useState("instantType"),k=p.useState("lastOpenChangeReason"),R=m.useRef(null);ue(()=>{v==="ending"&&k===cc||v!=="ending"&&w?(S!=="delay"&&(R.current=S),p.set("instantType","delay")):R.current!==null&&(p.set("instantType",R.current),R.current=null)},[v,w,k,S,p]),ue(()=>{y&&x==null&&p.set("payload",void 0)},[p,x,y]);const C=m.useCallback(()=>{p.setOpen(!1,nA(p,Up))},[p]);m.useImperativeHandle(i,()=>({unmount:g,close:C}),[g,C]);const _=p.useState("floatingRootContext"),I=qT(_,{enabled:!t}),M=jm(_,{enabled:!t,referencePress:!0}),N=PR(_,{enabled:!t&&s!=="none",axis:s==="none"?void 0:s}),{getReferenceProps:T,getFloatingProps:F,getTriggerProps:O}=Wm([I,M,N]),D=m.useMemo(()=>T(),[T]),z=m.useMemo(()=>O(),[O]),A=m.useMemo(()=>F(),[F]);return p.useSyncedValues({floatingRootContext:_,activeTriggerProps:D,inactiveTriggerProps:z,popupProps:A}),f.jsx(Lh.Provider,{value:p,children:typeof h=="function"?h({payload:E}):h})}function nA(e,t){const n=Me(t);return n.preventUnmountOnClose=()=>{e.set("preventUnmountingOnClose",!0)},n}const $h=m.createContext(void 0);function rA(){return m.useContext($h)}const oA=600,sA=m.forwardRef(function(t,n){const{className:r,render:o,handle:s,payload:i,disabled:a,delay:l,closeDelay:c,id:u,...d}=t,h=ii(!0),p=s?.store??h;if(!p)throw new Error(Bt(82));const b=fc(u),x=p.useState("isTriggerActive",b),E=p.useState("floatingRootContext"),y=p.useState("isOpenedByTrigger",b),g=m.useRef(null),v=l??oA,w=c??0,{registerTrigger:S,isMountedByThisTrigger:k}=UT(b,g,p,{payload:i,closeDelay:w}),R=rA(),{delayRef:C,isInstantPhase:_,hasProvider:I}=vR(E,{open:y});p.useSyncedValue("isInstantPhase",_);const M=p.useState("disabled"),N=a??M,T=p.useState("trackCursorAxis"),F=p.useState("disableHoverablePopup"),O=e_(E,{enabled:!N,mouseOnly:!0,move:!1,handleClose:!F&&T!=="both"?l_():null,restMs(){const Z=R?.delay,P=typeof C.current=="object"?C.current.open:void 0;let B=v;return I&&(P!==0?B=l??Z??v:B=0),B},delay(){const Z=typeof C.current=="object"?C.current.close:void 0;let P=w;return c==null&&I&&(P=Z),{close:P}},triggerElementRef:g,isActiveTrigger:x}),D=m.useMemo(()=>({open:y}),[y]),z=p.useState("triggerProps",k);return Vt("button",t,{state:D,ref:[n,S,g],props:[O,z,{id:b},d],stateAttributesMapping:Xk})}),Fh=m.createContext(void 0);function iA(){const e=m.useContext(Fh);if(e===void 0)throw new Error(Bt(70));return e}const aA=m.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,...a}=t,{portalNode:l,portalSubtree:c}=Rm({container:o,ref:n,componentProps:t,elementProps:a});return!c&&!l?null:f.jsxs(m.Fragment,{children:[c,l&&Yt.createPortal(r,l)]})}),cA=m.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t;return ii().useState("mounted")||r?f.jsx(Fh.Provider,{value:r,children:f.jsx(aA,{ref:n,...o})}):null}),Bh=m.createContext(void 0);function lA(){const e=m.useContext(Bh);if(e===void 0)throw new Error(Bt(71));return e}const uA=m.forwardRef(function(t,n){const{render:r,className:o,anchor:s,positionMethod:i="absolute",side:a="top",align:l="center",sideOffset:c=0,alignOffset:u=0,collisionBoundary:d="clipping-ancestors",collisionPadding:h=5,arrowPadding:p=5,sticky:b=!1,disableAnchorTracking:x=!1,collisionAvoidance:E=Fk,...y}=t,g=ii(),v=iA(),w=g.useState("open"),S=g.useState("mounted"),k=g.useState("trackCursorAxis"),R=g.useState("disableHoverablePopup"),C=g.useState("floatingRootContext"),_=g.useState("instantType"),I=g.useState("transitionStatus"),M=eh({anchor:s,positionMethod:i,floatingRootContext:C,mounted:S,side:a,sideOffset:c,align:l,alignOffset:u,collisionBoundary:d,collisionPadding:h,sticky:b,arrowPadding:p,disableAnchorTracking:x,keepMounted:v,collisionAvoidance:E,adaptiveOrigin:C_}),N=m.useMemo(()=>{const D={};return(!w||k==="both"||R)&&(D.pointerEvents="none"),{role:"presentation",hidden:!S,style:{...M.positionerStyles,...D}}},[w,k,R,S,M.positionerStyles]),T=m.useMemo(()=>({open:w,side:M.side,align:M.align,anchorHidden:M.anchorHidden,instant:k!=="none"?"tracking-cursor":_}),[w,M.side,M.align,M.anchorHidden,k,_]),F=m.useMemo(()=>({...T,arrowRef:M.arrowRef,arrowStyles:M.arrowStyles,arrowUncentered:M.arrowUncentered}),[T,M.arrowRef,M.arrowStyles,M.arrowUncentered]),O=Vt("div",t,{state:T,props:[N,Ec(I),y],ref:[n,g.useStateSetter("positionerElement")],stateAttributesMapping:qs});return f.jsx(Bh.Provider,{value:F,children:O})});function Ed(e){const t=Rt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ge(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r;return(Er(n)!==s||Er(r)!==i)&&(n=s,r=i),{width:n,height:r}}const dA=typeof ResizeObserver<"u",fA=()=>!0;function pA(e){const{popupElement:t,positionerElement:n,content:r,mounted:o,enabled:s=fA,onMeasureLayout:i,onMeasureLayoutComplete:a,side:l,direction:c}=e,u=m.useRef(!0),d=qp(t,!0,!1),h=ti(),p=m.useRef(null),b=de(i),x=de(a),E=m.useMemo(()=>{let y=l==="top",g=l==="left";return c==="rtl"?(y=y||l==="inline-end",g=g||l==="inline-end"):(y=y||l==="inline-start",g=g||l==="inline-start"),y?{position:"absolute",[l==="top"?"bottom":"top"]:"0",[g?"right":"left"]:"0"}:bt},[l,c]);ue(()=>{if(!o||!s()||!dA){u.current=!0,p.current=null;return}if(!t||!n)return;Object.entries(E).forEach(([_,I])=>{t.style.setProperty(_,I)});const y=new ResizeObserver(_=>{const I=_[0];I&&(p.current===null?p.current={width:Math.ceil(I.borderBoxSize[0].inlineSize),height:Math.ceil(I.borderBoxSize[0].blockSize)}:(p.current.width=Math.ceil(I.borderBoxSize[0].inlineSize),p.current.height=Math.ceil(I.borderBoxSize[0].blockSize)))});y.observe(t),t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto");const g=Fr(t,"position","static"),v=Fr(t,"transform","none"),w=Fr(t,"scale","1"),S=Fr(n,"--available-width","max-content"),k=Fr(n,"--available-height","max-content");if(b?.(),u.current||p.current===null){n.style.setProperty("--positioner-width","max-content"),n.style.setProperty("--positioner-height","max-content");const _=Ed(t);return n.style.setProperty("--positioner-width",`${_.width}px`),n.style.setProperty("--positioner-height",`${_.height}px`),g(),v(),w(),S(),k(),x?.(null,_),u.current=!1,()=>{y.disconnect()}}t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto"),n.style.setProperty("--positioner-width","max-content"),n.style.setProperty("--positioner-height","max-content");const R=Ed(t);t.style.setProperty("--popup-width",`${p.current.width}px`),t.style.setProperty("--popup-height",`${p.current.height}px`),g(),v(),S(),k(),x?.(p.current,R),n.style.setProperty("--positioner-width",`${R.width}px`),n.style.setProperty("--positioner-height",`${R.height}px`);const C=new AbortController;return h.request(()=>{t.style.setProperty("--popup-width",`${R.width}px`),t.style.setProperty("--popup-height",`${R.height}px`),d(()=>{t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto")},C.signal)}),()=>{y.disconnect(),C.abort(),h.cancel()}},[r,t,n,d,h,s,o,b,x,E])}function Fr(e,t,n){const r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}const mA={...qs,...Vp},hA=m.forwardRef(function(t,n){const{className:r,render:o,...s}=t,i=ii(),{side:a,align:l}=lA(),c=i.useState("open"),u=i.useState("mounted"),d=i.useState("instantType"),h=i.useState("transitionStatus"),p=i.useState("popupProps"),b=i.useState("payload"),x=i.useState("popupElement"),E=i.useState("positionerElement"),y=i.useState("floatingRootContext"),g=Sc();pc({open:c,ref:i.context.popupRef,onComplete(){c&&i.context.onOpenChangeComplete?.(!0)}});function v(){y.context.events.emit("measure-layout")}function w(I,M){y.context.events.emit("measure-layout-complete",{previousDimensions:I,nextDimensions:M})}pA({popupElement:x,positionerElement:E,mounted:u,content:b,enabled:()=>i.context.triggerElements.size>1,onMeasureLayout:v,onMeasureLayoutComplete:w,side:a,direction:g});const k=i.useState("disabled"),R=i.useState("closeDelay");Um(y,{enabled:!k,closeDelay:R});const C=m.useMemo(()=>({open:c,side:a,align:l,instant:d,transitionStatus:h}),[c,a,l,d,h]);return Vt("div",t,{state:C,ref:[n,i.context.popupRef,i.useStateSetter("popupElement")],props:[p,Ec(h),s],stateAttributesMapping:mA})}),gA=function(t){const{delay:n,closeDelay:r,timeout:o=400}=t,s=m.useMemo(()=>({delay:n,closeDelay:r}),[n,r]),i=m.useMemo(()=>({open:n,close:r}),[n,r]);return f.jsx($h.Provider,{value:s,children:f.jsx(gR,{delay:i,timeoutMs:o,children:t.children})})};function vA({delay:e=500,...t}){return f.jsx(gA,{delay:e,...t})}function bA({...e}){return f.jsx(tA,{"data-slot":"tooltip",...e})}function yA({...e}){return f.jsx(sA,{"data-slot":"tooltip-trigger",...e})}function xA({className:e,side:t="top",sideOffset:n=8,align:r="center",alignOffset:o=0,children:s,hidden:i,...a}){return i?null:f.jsx(cA,{children:f.jsx(uA,{align:r,alignOffset:o,side:t,sideOffset:n,className:"isolate z-[80]",children:f.jsx(hA,{"data-slot":"tooltip-content",className:qe("z-[80] w-fit max-w-xs rounded-md border border-[var(--hud-border)] bg-[var(--hud-surface)] px-2.5 py-1.5 text-sm font-medium text-sidebar-foreground shadow-md",e),...a,children:s})})})}const wA="260px",EA="48px",Vh=m.createContext(null);function Ac(){const e=m.useContext(Vh);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function SA({defaultOpen:e=!1,open:t,onOpenChange:n,className:r,style:o,children:s,...i}){const[a,l]=m.useState(e),c=t??a,u=m.useCallback(b=>{const x=typeof b=="function"?b(c):b;n?n(x):l(x)},[n,c]),d=m.useCallback(()=>{u(b=>!b)},[u]),h=c?"expanded":"collapsed",p=m.useMemo(()=>({state:h,open:c,setOpen:u,toggleSidebar:d}),[h,c,u,d]);return f.jsx(Vh.Provider,{value:p,children:f.jsx(vA,{delay:200,children:f.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":wA,"--sidebar-width-icon":EA,...o},className:qe("group/sidebar-wrapper contents",r),...i,children:s})})})}function kA({side:e="left",variant:t="sidebar",collapsible:n="icon",className:r,children:o,...s}){const{state:i}=Ac();return n==="none"?f.jsx("div",{"data-slot":"sidebar","data-sidebar":"primary",className:qe("pointer-events-auto flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",r),...s,children:o}):f.jsx("div",{className:"group peer text-sidebar-foreground","data-state":i,"data-collapsible":i==="collapsed"?n:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:f.jsx("div",{"data-slot":"sidebar-container","data-sidebar":"primary","data-side":e,className:qe("pointer-events-auto fixed z-40 flex w-(--sidebar-width) flex-col transition-[left,right,width] duration-200 ease-linear","top-[var(--scout-sidebar-top,0px)] bottom-[28px]","data-[side=left]:left-0 data-[side=right]:right-0",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l border-sidebar-border",r),...s,children:f.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full min-h-0 flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:o})})})}function CA({className:e,...t}){return f.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:qe("flex flex-col gap-2 p-2",e),...t})}function RA({className:e,...t}){return f.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:qe("flex flex-col gap-2 p-2",e),...t})}function TA({className:e,...t}){return f.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:qe("flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function ra({className:e,...t}){return f.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:qe("relative flex w-full min-w-0 flex-col p-2",e),...t})}function oa({className:e,render:t,...n}){return Tc({defaultTagName:"div",props:Gn({className:qe("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",e)},n),render:t,state:{slot:"sidebar-group-label",sidebar:"group-label"}})}function sa({className:e,...t}){return f.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:qe("w-full text-sm",e),...t})}function fs({className:e,...t}){return f.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:qe("flex w-full min-w-0 flex-col gap-0",e),...t})}function Hr({className:e,...t}){return f.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:qe("group/menu-item relative",e),...t})}const _A=aI("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Gr({render:e,isActive:t=!1,variant:n="default",size:r="default",tooltip:o,className:s,...i}){const{state:a}=Ac(),[l,c]=m.useState(!1);m.useEffect(()=>{c(!1)},[a]);const u=Tc({defaultTagName:"button",props:Gn({className:qe(_A({variant:n,size:r}),s)},i),render:o?f.jsx(yA,{render:e}):e,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:r,active:t}});return o?(typeof o=="string"&&(o={children:o}),f.jsxs(bA,{open:a==="collapsed"&&l,onOpenChange:d=>c(a==="collapsed"&&d),children:[u,f.jsx(xA,{side:"right",align:"center",...o})]})):u}function PA({className:e,...t}){return f.jsx("div",{"data-slot":"sidebar-menu-badge","data-sidebar":"menu-badge",className:qe("pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground",e),...t})}function IA({className:e,...t}){return f.jsx("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:qe("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden",e),...t})}function AA({className:e,...t}){return f.jsx("li",{"data-slot":"sidebar-menu-sub-item","data-sidebar":"menu-sub-item",className:qe("group/menu-sub-item relative",e),...t})}function OA({render:e,size:t="md",isActive:n=!1,className:r,...o}){return Tc({defaultTagName:"a",props:Gn({className:qe("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",r)},o),render:e,state:{slot:"sidebar-menu-sub-button",sidebar:"menu-sub-button",size:t,active:n}})}function Zh(e){const{pathname:t}=_d(),n=hr("nav.sidebar",!1),r=Eg(t);return m.useMemo(()=>{if(r){const i=xv(e);return{kind:"scope",items:wv.map(a=>({id:a.key,label:a.label,route:a.route,active:a.key===i})),activeId:i,sidebarChromeEnabled:n,scopePresentation:!0}}const o=wn(e);return{kind:"scout",items:hs.map(i=>({id:i.id,label:i.label,route:Xd(i.id),active:i.id===o})),activeId:o,sidebarChromeEnabled:n,scopePresentation:!1}},[e,r,n])}function MA({className:e=""}){return f.jsxs("svg",{viewBox:"3.35 3.35 13.3 13.3","aria-hidden":"true",className:e,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[f.jsx("polygon",{points:"10,4.3 14.8,7.1 14.8,12.9 10,15.7 5.2,12.9 5.2,7.1",strokeWidth:"1.9",fill:"currentColor",fillOpacity:"0.12"}),f.jsx("polygon",{points:"10,7 12.4,8.4 12.4,10.6 10,12 7.6,10.6 7.6,8.4",strokeWidth:"0.9",fill:"currentColor",fillOpacity:"0.9"})]})}const Fa="data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-active:shadow-[inset_2px_0_0_0_var(--sidebar-primary,var(--hud-accent,oklch(0.86_0.17_125)))]";function Sd({areas:e,activeAreaId:t,onNavigateArea:n,route:r,navigate:o,opsControlEnabled:s,presentation:i}){const{state:a}=Ac(),l=a==="expanded",c=Pv(r,{opsControlEnabled:s});return f.jsx(fs,{children:e.map(u=>{const d=i==="slack"&&u.id==="home",h=i==="slack"&&u.id==="chat",p=d?"chat":h?"home":u.id,b=h?sb:u.icon,x=h?"Activity":u.label,E=p===t,y=l&&E&&c&&c.areaId===p?c.items:null;return f.jsxs(Hr,{children:[f.jsxs(Gr,{type:"button",isActive:E,tooltip:x,"aria-label":x,"aria-current":E?"page":void 0,"data-area":u.id,className:qe("font-mono text-sm font-medium tracking-[0.02em]",Fa),onClick:()=>n(u.id),children:[f.jsx(b,{size:16,strokeWidth:1.6,"aria-hidden":!0}),f.jsx("span",{children:x})]}),y&&y.length>0?f.jsx(IA,{children:y.map(g=>{const v=g.active(r);return f.jsx(AA,{children:f.jsx(OA,{render:f.jsx("button",{type:"button"}),isActive:v,"aria-current":v?"page":void 0,"data-subnav":g.id,className:"font-mono text-xs",onClick:()=>o(g.route),children:f.jsx("span",{children:g.label})})},g.id)})}):null]},u.id)})})}function NA({brandLabel:e="Scout",presentation:t="scout"}){const{route:n,navigate:r,openSettings:o,openContextCapture:s}=Kt(),{titleBarInset:i,dragRegionProps:a,onInteractiveMouseDown:l}=go(),c=hr("ops.control",!0),u=Zh(n),d=wn(n),h=hs.filter(w=>w.section==="navigate"),p=hs.filter(w=>w.section==="system"&&w.id!=="settings"),b=Qd("settings"),x=b.icon,E=d==="settings",y=()=>r(t==="slack"?{view:"messages"}:{view:"inbox"}),g=()=>s(),v=w=>{if(t==="slack"&&w==="home"){if(d==="chat")return;r({view:"messages"});return}if(t==="slack"&&w==="chat"){if(d==="home")return;r({view:"activity"});return}wn(n)!==w&&r(Xd(w,{opsControlEnabled:c}))};return f.jsxs(kA,{side:"left",variant:"sidebar",collapsible:"icon","aria-label":u.kind==="scope"?"Scope navigation":"Primary navigation","data-sidebar-kind":u.kind,"data-presentation":t,children:[f.jsx(CA,{className:"border-b border-sidebar-border",style:{paddingTop:i||0,...a?.style??{}},...Object.fromEntries(Object.entries(a??{}).filter(([w])=>w!=="style")),"data-sidebar-drag-region":"",children:f.jsx("div",{className:"flex items-center gap-0.5","data-sidebar":"brand-row",children:f.jsx(fs,{className:"min-w-0 flex-1",children:f.jsx(Hr,{children:f.jsxs(Gr,{type:"button",size:"lg",tooltip:"Home",onClick:y,onMouseDown:l,"aria-label":"Scout Home",title:"Home",className:qe("data-[slot=sidebar-menu-button]:!p-2",t==="slack"?"font-sans":"font-mono"),children:[f.jsx(MA,{className:"size-[20px] shrink-0"}),f.jsx("span",{className:qe("truncate text-sm font-bold",t==="slack"?"tracking-[-0.01em]":"tracking-[0.08em] uppercase"),children:e})]})})})})}),f.jsx(TA,{className:"gap-0",children:u.kind==="scope"?f.jsxs(ra,{children:[f.jsx(oa,{"data-sidebar-head":"",className:"font-mono uppercase",children:"Surfaces"}),f.jsx(sa,{children:f.jsx(fs,{children:u.items.map(w=>f.jsx(Hr,{children:f.jsxs(Gr,{type:"button",isActive:w.active,tooltip:w.label,"aria-current":w.active?"page":void 0,"data-area":w.id,"aria-label":w.label,title:w.label,className:qe("font-mono text-sm font-medium",Fa),onClick:()=>r(w.route),children:[f.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center text-sm font-bold uppercase","aria-hidden":!0,children:w.label.slice(0,1)}),f.jsx("span",{children:w.label})]})},w.id))})})]}):f.jsxs(f.Fragment,{children:[f.jsxs(ra,{children:[f.jsx(oa,{"data-sidebar-head":"",className:"font-mono uppercase",children:"Navigate"}),f.jsx(sa,{children:f.jsx(Sd,{areas:h,activeAreaId:d,onNavigateArea:v,route:n,navigate:r,opsControlEnabled:c,presentation:t})})]}),f.jsxs(ra,{children:[f.jsx(oa,{className:"font-mono text-2xs tracking-[0.12em] uppercase",children:"System"}),f.jsx(sa,{children:f.jsx(Sd,{areas:p,activeAreaId:d,onNavigateArea:v,route:n,navigate:r,opsControlEnabled:c,presentation:t})})]})]})}),f.jsx(RA,{className:"border-t border-sidebar-border",children:f.jsxs(fs,{className:"gap-1",children:[f.jsxs(Hr,{children:[f.jsxs(Gr,{type:"button",tooltip:`${qr} (${Qo})`,"aria-label":qr,"aria-keyshortcuts":Qo,"data-action":"new-task",className:"font-mono text-sm font-semibold tracking-[0.02em] [&_svg]:text-[var(--hud-accent)]",onClick:g,children:[f.jsx(Zv,{size:16,strokeWidth:1.8,"aria-hidden":!0}),f.jsx("span",{children:qr})]}),f.jsx(PA,{className:"font-mono text-2xs text-sidebar-foreground/55",children:Qo})]}),f.jsx(Hr,{children:f.jsxs(Gr,{type:"button",isActive:E,tooltip:b.label,"aria-label":b.label,"aria-current":E?"page":void 0,"data-area":"settings",className:qe("font-mono text-sm font-medium tracking-[0.02em]",Fa),onClick:()=>o(),children:[f.jsx(x,{size:16,strokeWidth:1.6,"aria-hidden":!0}),f.jsx("span",{children:b.label})]})})]})})]})}function jA(e,t){return e==="left"?t?"›":"‹":t?"‹":"›"}function DA(e,t){const n=t?.trim()||"panel";return e?`Expand ${n}`:`Collapse ${n}`}function zs({side:e,collapsed:t,label:n,onToggle:r,className:o="",style:s,onMouseDown:i}){const a=DA(t,n),c=jA(e,t)==="›"?"right":"left";return f.jsx("button",{type:"button","data-scout-rail-toggle":"","data-side":e,"data-direction":c,"data-collapsed":t?"true":"false","aria-expanded":!t,"aria-label":a,title:a,className:`scout-rail-toggle${o?` ${o}`:""}`,style:s,onClick:r,onMouseDown:i,children:f.jsx("svg",{"aria-hidden":"true",className:"scout-rail-toggle-glyph",viewBox:"0 0 16 16",fill:"none",children:f.jsx("path",{d:c==="right"?"M6 4.5 9.5 8 6 11.5":"M10 4.5 6.5 8l3.5 3.5",stroke:"currentColor",strokeWidth:"1.65",strokeLinecap:"round",strokeLinejoin:"round"})})})}const Mt=48,zA=56,Ba=44,LA=32,Uh=Math.round((Ba-LA)/2),$A=Mt,ho=260,Va=200,Za=360,FA=880,Ua=260,Wa=240,Ha=400;function ia(e){return Number.isFinite(e)?Math.max(Wa,Math.min(Ha,Math.round(e))):Ua}const Wh=40,BA=24;function Hh(e,{min:t,max:n,startedCollapsed:r,collapsedWidth:o=Mt}){if(!Number.isFinite(e))return r?o:t;const s=Math.max(o,Math.min(n,Math.round(e)));if(r)return s;const i=t-Wh;return s<i?Mt:s}function Gh({startedCollapsed:e,rawWidth:t},{min:n,max:r,collapsedWidth:o=Mt}){const s=Number.isFinite(t)?Math.round(t):n;if(e)return s>=o+BA?{kind:"expand"}:{kind:"none"};const i=n-Wh;return s<i?{kind:"collapse"}:{kind:"resize",width:Math.max(n,Math.min(r,s))}}function qh(e){return e.autoCollapsed?!e.forceExpanded:e.manualCollapsed}function Ga(e){return Number.isFinite(e)?Math.max(Va,Math.min(Za,Math.round(e))):ho}function VA(e,t=ho,n=Mt){return e?n:Ga(t)}function Yh(e,t){return e.autoCollapsed?{manualCollapsed:e.manualCollapsed,forceExpanded:!t}:{manualCollapsed:t,forceExpanded:e.forceExpanded}}function ZA(e){const t=qh(e);return Yh(e,!t)}function Kh({side:e,title:t,onToggle:n,edgeOffset:r=0,top:o=0,width:s=Mt,glyph:i,body:a,style:l,className:c=""}){return f.jsxs("aside",{"data-scout-collapsed-rail":"","data-side":e,"data-pane":e==="left"?"side-rail-collapsed":"inspector-collapsed",className:`scout-collapsed-rail${c?` ${c}`:""}${a?" scout-collapsed-rail--rich":""}`,style:{position:"fixed",top:o,bottom:28,width:s,zIndex:40,...e==="left"?{left:r}:{right:r},...l},"aria-label":`${t} (collapsed)`,children:[f.jsx(zs,{side:e,collapsed:!0,label:t,onToggle:n,className:"scout-collapsed-rail-toggle",style:{position:"absolute",top:Uh,zIndex:46,...e==="left"?{right:0,transform:"translateX(50%)"}:{left:0,transform:"translateX(-50%)"}}}),a?f.jsx("div",{className:"scout-collapsed-rail-body",children:a}):i?f.jsx("div",{className:"scout-collapsed-rail-glyph","aria-hidden":"true",style:{marginTop:40},children:i}):null]})}const ai=10;function UA({route:e}){switch(e.view){case"messages":case"conversation":return f.jsx(Jv,{});case"inbox":case"activity":case"briefings":return f.jsx(WA,{});case"agents-v2":case"agent-info":return f.jsx(HA,{});case"terminal":return f.jsx(GA,{});case"ops":return f.jsx(qA,{});case"mesh":return f.jsx(YA,{});default:return f.jsx(Cr,{label:"Context",emptyMark:"·",children:null})}}function WA(){const{agents:e,navigate:t,route:n}=Kt(),[r,o]=m.useState(null),s=Pd(n),i=m.useMemo(()=>Jd(e,s),[e,s]),a=m.useMemo(()=>kv(e,s),[e,s]),l=m.useMemo(()=>Cv(r,a),[r,a]),c=m.useCallback(async()=>{o(await da("/api/fleet").catch(()=>null))},[]);m.useEffect(()=>{c()},[c]),Gv(p=>{(p.kind==="message.posted"||p.kind==="flight.updated"||p.kind==="presence.updated")&&c()});const u=m.useMemo(()=>{const p=new Set;for(const b of l?.needsAttention??[])b.agentId&&p.add(b.agentId);return p},[l]),d=m.useMemo(()=>i.filter(p=>u.has(p.id)).slice(0,4),[i,u]),h=m.useMemo(()=>{const p=new Set(d.map(b=>b.id));return[...i].filter(b=>!p.has(b.id)).sort((b,x)=>(x.updatedAt??x.createdAt??0)-(b.updatedAt??b.createdAt??0)).slice(0,ai-d.length)},[i,d]);return f.jsxs(Cr,{label:"Home",emptyMark:"H",labelTone:d.length>0?"attention":"default",labelCount:d.length>0?d.length:void 0,children:[d.map(p=>f.jsx(kd,{agent:p,attention:!0,onClick:()=>Xc(t,p,{returnTo:n})},`att-${p.id}`)),d.length>0&&h.length>0?f.jsx(Xv,{}):null,h.map(p=>f.jsx(kd,{agent:p,onClick:()=>Xc(t,p,{returnTo:n})},p.id))]})}function HA(){const{agents:e,navigate:t,route:n}=Kt(),r=Pd(n),o=m.useMemo(()=>Jd(e,r),[e,r]),s=m.useMemo(()=>{const a=new Map;for(const l of o){const c=(l.project??KA(l.workspaceRoot)??l.name??"project").trim(),u=c.toLowerCase(),d=a.get(u)??{name:c,needs:0,working:0,latest:0},h=Wv(l.state);(h==="needs_attention"||h==="blocked")&&(d.needs+=1),(h==="in_turn"||h==="in_flight"||ef(l.state))&&(d.working+=1),d.latest=Math.max(d.latest,l.updatedAt??l.createdAt??0),a.set(u,d)}return[...a.values()].sort((l,c)=>c.needs>0!=l.needs>0?c.needs>0?1:-1:c.latest-l.latest).slice(0,ai)},[o]),i=s.reduce((a,l)=>a+l.needs,0);return f.jsx(Cr,{label:"Projects",emptyMark:"P",labelTone:i>0?"attention":"default",labelCount:i>0?i:s.length||void 0,children:s.map(a=>f.jsx(vo,{title:`${a.name}${a.needs?` · ${a.needs} need you`:""}`,tone:a.needs>0?"attention":"default",ava:Bs(a.name),avaColor:Fs(a.name),dot:a.needs>0?"attention":a.working>0?"live":null,onClick:()=>t({view:"agents-v2",...r?{machineId:r}:{}})},a.name))})}function GA(){const{route:e,navigate:t}=Kt(),[n,r]=m.useState([]);m.useEffect(()=>{qv({includeDiscovered:!0}).then(r).catch(()=>{})},[]);const o=m.useMemo(()=>Yv(n).slice(0,ai),[n]),s=e.view==="terminal"?e.terminalSurfaceKey??null:null;return f.jsx(Cr,{label:"Term",emptyMark:"T",labelTone:o.length>0?"live":"default",labelCount:o.length||void 0,children:o.map(i=>f.jsx(vo,{title:i.title,active:Kv(i.key,s),tone:"neutral",ava:Bs(i.title),avaColor:Fs(i.title),onClick:()=>t({view:"terminal",terminalSurfaceKey:i.key,terminalSessionId:i.session.id})},i.key))})}function qA(){const{route:e,navigate:t}=Kt(),n=e.view==="ops"?e.mode:void 0,r=[{id:"mission",title:"Mission",glyph:f.jsx(vb,{size:13,strokeWidth:1.7,"aria-hidden":!0})},{id:"agents",title:"Agents",glyph:f.jsx(Mb,{size:13,strokeWidth:1.7,"aria-hidden":!0})},{id:"lanes",title:"Agent Lanes",glyph:f.jsx(hb,{size:13,strokeWidth:1.7,"aria-hidden":!0})},{id:"plan",title:"Plan",glyph:f.jsx(Qv,{size:13,strokeWidth:1.7,"aria-hidden":!0})}];return f.jsx(Cr,{label:"Operations",emptyMark:"O",labelTone:"default",children:r.map(o=>f.jsx(vo,{title:o.title,active:n===o.id||!n&&o.id==="mission",tone:"neutral",glyph:o.glyph,onClick:()=>t({view:"ops",mode:o.id})},o.id))})}function YA(){const{agents:e,navigate:t}=Kt(),{meshSnapshot:n}=Ov(),r=m.useMemo(()=>n?Hv(e,n):[],[e,n]),o=m.useMemo(()=>[...r].sort((i,a)=>a.agents.length-i.agents.length).slice(0,ai),[r]),s=o.filter(i=>i.online).length;return f.jsx(Cr,{label:"Network",emptyMark:"M",labelTone:s>0?"live":"default",labelCount:o.length||void 0,children:o.map(i=>f.jsx(vo,{title:`${i.machineLabel} · ${i.agents.length}`,tone:i.online?"default":"neutral",ava:Bs(i.machineLabel),avaColor:Fs(i.machineLabel),dot:i.online?"live":null,onClick:()=>t({view:"mesh"})},i.machineId))})}function kd({agent:e,attention:t,onClick:n}){const r=e.name??e.id,o=ef(e.state);return f.jsx(vo,{title:t?`${r} · needs you`:r,tone:t?"attention":"default",ava:Bs(r),avaColor:Fs(r),dot:t?"attention":o?"live":null,onClick:n})}function KA(e){if(!e)return null;const t=e.replace(/\/+$/,"").split("/");return t[t.length-1]||null}function JA(e,t){if(t)return!1;switch(e.view){case"inbox":case"activity":case"briefings":case"agents-v2":case"agent-info":case"terminal":case"messages":case"conversation":case"ops":case"mesh":case"mesh-ops":return!0;default:return!1}}function XA({presentation:e="scout",navRailWidth:t,isCollapsed:n,onToggleCollapse:r,width:o,style:s,hideWhenEmpty:i=!0}){const{route:a,navigate:l}=Kt(),c=Zh(a),u=c.kind==="scope"?{body:null,footer:null}:Uv(a,l),d=!u.body&&!u.footer;if(i&&d)return null;const h=wn(a),p=hs.find(y=>y.id===h),b=c.kind==="scope"?"Scope":e==="slack"&&h==="chat"?"Scout":e==="slack"&&h==="home"?"Activity":p?.label??"Context",x=typeof s?.top=="number"?s.top:typeof s?.top=="string"&&Number.parseFloat(s.top)||0,E=t+o;return f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"scout-side-rail-expanded-host","data-presentation":e,"data-collapsed":n?"true":"false",hidden:n,"aria-hidden":n,style:n?{display:"none"}:void 0,children:[f.jsx(La,{side:"left",title:b,isCollapsed:!1,width:o,style:{left:t,...s},footer:u.footer?u.footer:void 0,children:f.jsx("div",{"data-pane":"side-rail","data-scout-side-rail":"",style:{display:"contents"},children:u.body})}),f.jsx(zs,{side:"left",collapsed:!1,label:b,onToggle:r,className:"scout-rail-toggle--panel scout-rail-toggle--side-rail",style:{position:"fixed",left:E,top:x+6,zIndex:45,transform:"translateX(-50%)"}})]}),f.jsx("div",{className:"scout-side-rail-collapsed-host","data-presentation":e,"data-collapsed":n?"true":"false",hidden:!n,"aria-hidden":!n,style:n?void 0:{display:"none"},children:f.jsx(Kh,{side:"left",title:b,onToggle:r,edgeOffset:t,top:x,style:s,body:f.jsx(UA,{route:a})})})]})}function QA(e){return wn(e)==="ops"?"ops":null}function eO({items:e,route:t,navigate:n,className:r=""}){return e.length===0?null:f.jsx("nav",{className:`scout-area-subnav${r?` ${r}`:""}`,"aria-label":"Area sub-navigation","data-scout-area-subnav":"",children:e.map(o=>{const s=o.active(t);return f.jsx("button",{type:"button","aria-current":s?"page":void 0,className:`scout-area-subnav-item${s?" scout-area-subnav-item--active":""}`,onClick:()=>n(o.route),children:o.label},o.id)})})}function tO({rightUtility:e,variant:t,presentation:n="scout",onOpenSearch:r,onInteractiveMouseDown:o}={}){const{route:s,navigate:i,navigateBack:a,canNavigateBack:l}=Kt(),c=jv(s),u=Iv(s),d=QA(s),h=t==="top-row",p=!!u||d!==null;if(!h&&!c&&!u&&!d&&!e)return null;const b=p?f.jsxs(f.Fragment,{children:[u?f.jsx(eO,{items:u.items,route:s,navigate:i}):null,d==="ops"?f.jsx("div",{className:"scout-center-pane-secondary","data-scout-secondary-nav":"ops",children:f.jsx(eb,{activeRoute:s,navigate:i})}):null]}):null;if(h){const x=Qd(wn(s)).label;if(n==="slack"){const E=wn(s)==="chat"?"Home":wn(s)==="home"?"Activity":x;return f.jsxs("div",{className:"scout-center-pane-header scout-center-pane-header--top-row scout-slack-topbar","data-scout-center-pane-header":"","data-scout-top-row":"","data-presentation":"slack",children:[f.jsxs("div",{className:"scout-slack-topbar-history",onMouseDown:o,children:[f.jsx("button",{type:"button","aria-label":"Go back",title:"Go back",onClick:()=>window.history.back(),children:f.jsx(Qc,{size:16,strokeWidth:1.8,"aria-hidden":!0})}),f.jsx("button",{type:"button","aria-label":"Go forward",title:"Go forward",onClick:()=>window.history.forward(),children:f.jsx(Rv,{size:16,strokeWidth:1.8,"aria-hidden":!0})}),f.jsx("span",{children:E})]}),f.jsxs("button",{type:"button",className:"scout-slack-topbar-search","aria-label":"Search Scout",onMouseDown:o,onClick:r,children:[f.jsx(Ls,{size:15,strokeWidth:1.8,"aria-hidden":!0}),f.jsx("span",{children:"Search Scout"}),f.jsx("kbd",{children:"⌘K"})]}),e?f.jsx("div",{className:"scout-center-pane-header-utility scout-slack-topbar-utility","data-scout-header-utility":"",onMouseDown:o,children:e}):f.jsx("span",{})]})}return f.jsxs("div",{className:"scout-center-pane-header scout-center-pane-header--top-row","data-scout-center-pane-header":"","data-scout-top-row":"","data-scout-has-secondary-row":p?"":void 0,children:[f.jsxs("div",{className:"scout-center-pane-header-main",onMouseDown:o,children:[f.jsx("button",{type:"button",className:"scout-top-row-back","aria-label":"Back","aria-keyshortcuts":"Meta+[",title:"Back (⌘[)",disabled:!l,onClick:a,children:f.jsx(Qc,{size:16,strokeWidth:1.9,"aria-hidden":"true"})}),f.jsx("div",{className:"scout-center-pane-breadcrumb","data-scout-breadcrumb":"",children:f.jsx("span",{className:"scout-nav-crumb",children:x})}),p?f.jsx("span",{className:"scout-top-row-sep","aria-hidden":"true",children:"/"}):null,b]}),e?f.jsx("div",{className:"scout-center-pane-header-utility","data-scout-header-utility":"",onMouseDown:o,children:e}):null]})}return f.jsxs("div",{className:"scout-center-pane-header","data-scout-center-pane-header":"",children:[f.jsxs("div",{className:"scout-center-pane-header-main",onMouseDown:o,children:[c?f.jsx("div",{className:"scout-center-pane-breadcrumb","data-scout-breadcrumb":"",children:f.jsx("span",{className:"scout-nav-crumb",children:c})}):null,b]}),e?f.jsx("div",{className:"scout-center-pane-header-utility","data-scout-header-utility":"",onMouseDown:o,children:e}):null]})}const nO="https://openscout.app/docs";function rO({presentation:e="scout"}){const{onboarding:t,refreshOnboarding:n}=Kt(),r=t?.operatorName?.trim()||t?.operatorNameSuggestion?.trim()||null,o=m.useRef(!1);return m.useEffect(()=>{r||!t||o.current||(o.current=!0,n())},[t,r,n]),f.jsxs("div",{className:"scout-top-row-identity","data-presentation":e,children:[f.jsx("a",{className:"scout-top-row-docs",href:nO,target:"_blank",rel:"noreferrer",title:"OpenScout documentation",children:e==="slack"?f.jsx(lb,{size:16,strokeWidth:1.8,"aria-hidden":!0}):"docs"}),r?f.jsx("span",{className:"scout-top-row-operator",title:r,"aria-label":`Operator ${r}`,children:e==="slack"?r.slice(0,1).toUpperCase():`@${r.toLowerCase()}`}):null]})}function oO(e,t,n=Mt){const r=`appshell.${e}.sidebar.manualCollapsed`,o=`appshell.${e}.sidebar.width`,[s,i]=St(r,!0),[a,l]=St(o,ho),c=t<=FA,[u,d]=m.useState(!1),[h,p]=m.useState(null),[b,x]=m.useState(!1),[E,y]=m.useState(!1);m.useEffect(()=>{c||d(!1)},[c]);const v=qh({manualCollapsed:s,autoCollapsed:c,forceExpanded:u}),w=Ga(a),S=h!=null?Hh(h,{min:Va,max:Za,startedCollapsed:b,collapsedWidth:n}):null,k=VA(v,w,n),R=m.useCallback(()=>{const O=ZA({manualCollapsed:s,autoCollapsed:c,forceExpanded:u});if(c){d(O.forceExpanded);return}i(O.manualCollapsed)},[c,u,s,i]),C=m.useCallback(O=>{const D=Yh({manualCollapsed:s,autoCollapsed:c,forceExpanded:u},O);if(c){d(z=>z===D.forceExpanded?z:D.forceExpanded);return}i(z=>z===D.manualCollapsed?z:D.manualCollapsed)},[c,u,s,i]),_=m.useCallback(O=>{l(Ga(O))},[l]),I=m.useCallback(()=>{l(ho),p(null)},[l]),M=m.useCallback((O,D=!1)=>{y(!0),x(D),p(O)},[]),N=m.useCallback(O=>{p(O)},[]),T=m.useCallback(()=>{p(null),y(!1)},[]),F=m.useCallback((O,D)=>{const z=Gh({startedCollapsed:D,rawWidth:O},{min:Va,max:Za,collapsedWidth:n});return z.kind==="collapse"?C(!0):z.kind==="expand"?C(!1):z.kind==="resize"&&l(z.width),p(null),y(!1),z},[n,C,l]);return{manualCollapsed:s,autoCollapsed:c,forceExpanded:u,effectiveCollapsed:v,width:k,expandedWidth:w,dragGhostWidth:S,dragStartedCollapsed:b,isSidebarResizing:E,toggleCollapsed:R,setCollapsed:C,setManualCollapsed:i,setExpandedWidth:_,resetExpandedWidth:I,beginResize:M,updateResize:N,clearDrag:T,commitDrag:F}}function sO(e){return e.view==="ops"&&e.mode==="lanes"}function iO(e,t){return!sO(e)||!t||t.loading?!1:t.messageCount===0}function aO(e){return e.empty?!e.forceOpen:e.baseCollapsed}function cO(e){return(e.empty?!e.forceOpen:e.rightCollapsed)?{forceOpen:!0,rightCollapsed:e.empty?e.rightCollapsed:!1}:{forceOpen:!1,rightCollapsed:e.empty?e.rightCollapsed:!0}}function lO(e,t){switch(e.view){case"agents-v2":return!!(e.agentId||e.selectedAgentId||e.sessionId);case"agent-info":case"conversation":case"mesh":case"mesh-ops":case"repos":case"terminal":case"work":return!0;case"ops":return e.mode!=="lanes";case"sessions":return!e.flightId;case"messages":return!!e.conversationId;case"search":return!!(e.hitId&&t.hasKnowledgeHit);case"broker":return!!(e.attemptId&&t.hasBrokerAttempt);case"activity":case"briefings":case"code":case"follow":case"harnesses":case"inbox":case"repo-diff":case"settings":case"voice":return!1}}const Xo=240,uO=900,dO=.45,fO=500,pO=420,mO=480,hO=520,aa=560,gO=1500,vO=40;function Cd(e){return Math.min(uO,Math.max(fO,Math.floor(e*dO)))}function bO({className:e=""}){return f.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:e,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[f.jsx("polygon",{points:"10,4.3 14.8,7.1 14.8,12.9 10,15.7 5.2,12.9 5.2,7.1",strokeWidth:"1.9",fill:"currentColor",fillOpacity:"0.12"}),f.jsx("polygon",{points:"10,7 12.4,8.4 12.4,10.6 10,12 7.6,10.6 7.6,8.4",strokeWidth:"0.9",fill:"currentColor",fillOpacity:"0.9"})]})}function yO({title:e,center:t,actions:n,search:r}){const{dragRegionProps:o,onInteractiveMouseDown:s}=go(),{navTotalHeight:i}=Rc(),a=!!r?.value,l=m.useRef(null),c=m.useRef(null),u=m.useRef(null),d=m.useRef(null);return m.useEffect(()=>{const h=l.current;if(!h)return;const p=()=>{const E=(c.current?.offsetWidth??0)+16,y=(u.current?.offsetWidth??0)+16,g=d.current?.firstElementChild?.clientWidth??0;h.style.setProperty("--scout-nav-left-w",`${E}px`),h.style.setProperty("--scout-nav-right-w",`${y}px`),h.style.setProperty("--scout-nav-strip-w",`${g}px`)};p();const b=new ResizeObserver(p),x=d.current?.firstElementChild;for(const E of[c.current,u.current,x])E&&b.observe(E);return window.addEventListener("resize",p),()=>{b.disconnect(),window.removeEventListener("resize",p)}},[]),f.jsx("div",{ref:l,"data-frame-panel":"navigation",className:"fixed top-0 left-0 right-0 z-50 pointer-events-auto",...o,children:f.jsxs("div",{className:"bg-background/95 border-b shadow-[var(--hud-shadow-nav)] flex items-end px-4",style:{height:i,borderColor:"var(--hud-chrome-border, oklch(var(--border) / 0.8))"},children:[f.jsx("div",{ref:c,className:"absolute left-4 bottom-0 h-12 z-10 flex items-center gap-2.5 select-none",onMouseDown:s,children:f.jsxs("div",{"aria-label":e,className:"flex items-center gap-2 rounded-sm px-0.5 -mx-0.5 leading-none text-foreground/90",children:[f.jsx(bO,{className:"h-5 w-5 text-[#f8f3e8] drop-shadow-[0_0_6px_rgba(255,247,234,0.3)]"}),f.jsx("span",{className:"font-mono text-sm font-medium tracking-[0.06em] leading-none",children:e})]})}),t&&f.jsx("div",{ref:d,className:"flex-1 flex justify-center h-12 items-center",onMouseDown:s,children:t}),f.jsxs("div",{ref:u,className:"absolute right-4 bottom-0 h-12 z-10 flex items-center gap-3",onMouseDown:s,children:[n,r&&f.jsxs("div",{className:"hidden sm:block relative w-[220px] max-w-[34vw] bg-card border border-input rounded px-2.5 shadow-[inset_0_1px_0_oklch(var(--foreground)/0.02)] hover:border-ring/60 focus-within:border-ring focus-within:bg-card transition-colors duration-200",children:[f.jsx(Ls,{size:11,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),f.jsx("input",{type:"text",value:r.value,onChange:h=>r.onChange(h.target.value),placeholder:r.placeholder??"Search",className:`
83
+ w-full h-7 pl-5 pr-6 bg-transparent text-sm font-mono font-normal tracking-[0.02em]
84
+ placeholder:text-muted-foreground/80 placeholder:font-light text-foreground
85
+ focus:outline-none transition-all duration-200
86
+ ${a?"text-accent":""}
87
+ `}),a&&f.jsx("button",{type:"button",onClick:()=>r.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none rounded-sm",children:f.jsx($s,{size:12})})]})]})]})})}function Xj({app:e,assistant:t=!0}){return f.jsx(Sg,{registry:Rg,audience:Cg,audienceOrder:Id,storageKey:kg,initialLayers:Tg(),children:f.jsx(e.Provider,{children:f.jsx(G1,{children:f.jsx(EO,{app:e,assistantEnabled:t})})})})}function xO({statusBar:e,dictationActive:t}){const n=hr("surface.scoutbot",!0),r=hr(Kd,!1),o=e.mesh.color==="amber"?"text-amber-400":e.mesh.color==="red"?"text-red-400":"text-foreground";return f.jsxs("div",{className:"flex items-center gap-3 font-mono leading-none",children:[f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx("span",{className:"text-2xs font-normal uppercase tracking-[0.16em] text-muted-foreground",children:e.activeAgents.label}),f.jsx("span",{className:"text-xs tabular-nums text-foreground",children:e.activeAgents.count})]}),f.jsx("span",{"aria-hidden":"true",className:"select-none text-muted-foreground/40 text-xs",children:"·"}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx("span",{className:"text-2xs font-normal uppercase tracking-[0.16em] text-muted-foreground",children:e.mesh.label}),f.jsx("span",{className:`text-xs ${o}`,children:e.mesh.value})]}),(n||r)&&f.jsxs(f.Fragment,{children:[f.jsx("span",{"aria-hidden":"true",className:"select-none text-muted-foreground/40 text-xs",children:"·"}),f.jsxs("div",{className:"flex items-center gap-1",children:[n&&f.jsx(Lg,{}),r&&f.jsx(oI,{dictationActive:t})]})]})]})}function wO({statusBar:e,onOpenFlagPanel:t,onOpenActivityLog:n}){return f.jsxs("div",{className:"flex max-w-[42vw] items-center gap-3",children:[f.jsx(nI,{onOpen:n}),f.jsx("span",{"aria-hidden":"true",className:"select-none text-muted-foreground/40 text-xs",children:"·"}),f.jsx($1,{onOpenPanel:t}),f.jsx("div",{className:"truncate font-mono text-xs leading-none text-muted-foreground",title:e.build.title,children:e.build.label})]})}function EO({app:e,assistantEnabled:t}){const{navTotalHeight:n}=Rc(),{titleBarInset:r,dragRegionProps:o,onInteractiveMouseDown:s}=go(),i=X1();gv();const{route:a,openContextCapture:l,apiConnection:c,navigate:u,navigateBack:d,selectedBrokerAttempt:h,selectedKnowledgeHit:p,appearanceDetails:b}=Kt(),x=_d(),E=b.shell==="slack",y=hr("nav.sidebar",!1),g=E||y,v=g?r:n,w=g,S=w?vO:0,k=v+S,R=k+Uh,C=Tv(),_=e.hooks.useCommands(),I=e.hooks.useSearch?.()??null,M=e.hooks.useNavCenter?.()??null,N=e.hooks.useNavActions?.()??null,T=e.hooks.useLayoutMode?.()??e.mode,F=T==="focus"?"panel":T,O=e.hooks.useActiveToolHint?.()??null,D=e.hooks.useTakeover?.()??null,z=D?.active===!0,A=z&&D?.dismissible===!0,Z=D?.onDismiss,P=e.slots.Takeover,B=Dv();iI(B,c);const U=q1(),[q,he]=m.useState(!1),[ee,Y]=St(`appshell.${e.id}.left`,!1),[ie,K]=St(`appshell.${e.id}.right`,!1),[J,fe]=St(`appshell.${e.id}.rightOverlay`,!1),[L,ae]=St(`appshell.${e.id}.leftW`,260),[te,ye]=St(`appshell.${e.id}.rightW`,280),[pe,X]=St("openscout.ops.minimap.collapsed",!1),[oe,ke]=St(`appshell.${e.id}.terminalFocus`,!1),[we,Re]=m.useState(()=>typeof window<"u"?window.innerWidth:1280),[H,ge]=m.useState(()=>Cd(typeof window<"u"?window.innerWidth:1280)),Q=a.view==="search"||x.pathname==="/search",le=E?zA:$A,$=oO(e.id,we,le),be=g&&a.view==="terminal"&&oe,[Ae,Te]=m.useState(null),[et,rt]=m.useState(!1),nt=m.useRef(null),ot=m.useRef(null),_t=Ae!=null,Ee=Ae!=null?Hh(Ae,{min:Wa,max:Ha,startedCollapsed:et}):null,[De,Ye]=m.useState(null),Oe=m.useRef(null);m.useEffect(()=>{const V=()=>{Re(window.innerWidth),ge(Cd(window.innerWidth))};return V(),window.addEventListener("resize",V),()=>window.removeEventListener("resize",V)},[]);const{active:ze,brandLabel:dt}=Ev({route:a});m.useEffect(()=>(document.documentElement.style.setProperty("--scout-rail-collapsed-width",`${Mt}px`),g?(document.documentElement.setAttribute("data-scout-sidebar-chrome",""),document.documentElement.style.setProperty("--scout-nav-rail-width",`${$.width}px`),$.isSidebarResizing?document.documentElement.setAttribute("data-scout-sidebar-resizing",""):document.documentElement.removeAttribute("data-scout-sidebar-resizing")):(document.documentElement.removeAttribute("data-scout-sidebar-chrome"),document.documentElement.removeAttribute("data-scout-sidebar-resizing"),document.documentElement.style.removeProperty("--scout-nav-rail-width")),()=>{document.documentElement.removeAttribute("data-scout-sidebar-chrome"),document.documentElement.removeAttribute("data-scout-sidebar-resizing"),document.documentElement.style.removeProperty("--scout-nav-rail-width")}),[g,$.width,$.isSidebarResizing]),m.useEffect(()=>{ae(g?V=>ia(V):V=>Math.min(H,Math.max(Xo,V))),ye(V=>Math.min(H,Math.max(Xo,V)))},[g,H,ae,ye]),m.useEffect(()=>{!Q||ie||J||ye(V=>Math.max(V,Math.min(H,pO)))},[Q,ie,J,ye,H]);const zt=a.view==="agents-v2"&&!a.agentId&&!a.sessionId&&!!a.selectedAgentId||a.view==="agents-v2"&&!!a.agentId;m.useEffect(()=>{!zt||ie||J||ye(V=>Math.max(V,Math.min(H,mO)))},[zt,ie,J,ye,H]);const Je=a.view==="broker"&&!!a.attemptId;m.useEffect(()=>{Je&&(K(!1),ye(V=>Math.max(V,Math.min(H,hO))))},[Je,K,ye,H]);const[un,Ir]=m.useState({x:0,y:0}),[Eo,ci]=m.useState(1),li=m.useCallback(V=>{Ir(W=>({x:W.x+V.x,y:W.y+V.y}))},[]),ui=m.useCallback(V=>{ci(V)},[]),[Jn,Jt]=m.useState(!1),[So,di]=m.useState(!1),[fi,zn]=St(`appshell.${e.id}.termH`,320),ko=!!e.slots.Terminal,Ar=m.useMemo(()=>{const V=[];return ko&&V.push("terminal"),t&&V.push("assistant"),V},[ko,t]),Co=Ar[0]??"terminal",[Ro,Or]=St(`appshell.${e.id}.drawerTab`,Co),Mr=Ar.includes(Ro)?Ro:Co,[Jh,To]=m.useState(!1),[Xh,Xn]=m.useState(!1),[Qh,eg]=m.useState(new Set),pi=m.useRef(!1),Qn=m.useRef(null),mn=m.useCallback(()=>{pi.current=!1,Qn.current!==null&&(window.clearTimeout(Qn.current),Qn.current=null)},[]),Oc=m.useCallback(()=>{pi.current=!0,Qn.current!==null&&window.clearTimeout(Qn.current),Qn.current=window.setTimeout(mn,gO)},[mn]);m.useEffect(()=>mn,[mn]);const tg=m.useCallback(V=>{eg(W=>{const Se=new Set(W);return Se.has(V)?Se.delete(V):Se.add(V),Se})},[]),Mc=m.useCallback(V=>W=>{W.preventDefault();const Se=W.clientX,Pt=V==="left"?L:te,pt=V==="left"?ae:ye,He=V==="left"?1:-1,hn=It=>{const lt=(It.clientX-Se)*He;pt(Math.max(Xo,Math.min(H,Pt+lt)))},Zt=()=>{document.removeEventListener("mousemove",hn),document.removeEventListener("mouseup",Ut),window.removeEventListener("blur",Zt)},Ut=()=>Zt();document.addEventListener("mousemove",hn),document.addEventListener("mouseup",Ut),window.addEventListener("blur",Zt)},[L,te,ae,ye,H]),[_o,ng]=m.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);m.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const V=window.matchMedia("(prefers-reduced-motion: reduce)"),W=()=>ng(V.matches);return W(),V.addEventListener?.("change",W),()=>V.removeEventListener?.("change",W)},[]);const Po=m.useCallback(V=>{_o||(Ye(V),Oe.current!==null&&window.clearTimeout(Oe.current),Oe.current=window.setTimeout(()=>{Ye(null),Oe.current=null},150))},[_o]);m.useEffect(()=>()=>{Oe.current!==null&&window.clearTimeout(Oe.current)},[]);const rg=m.useCallback(V=>{V.preventDefault(),V.stopPropagation();const W=$.effectiveCollapsed,Se=V.clientX,Pt=W?le:$.expandedWidth;ot.current=Pt,$.beginResize(Pt,W);const pt=()=>{document.removeEventListener("pointermove",He),document.removeEventListener("pointerup",hn),document.removeEventListener("pointercancel",Zt),window.removeEventListener("blur",Zt)},He=Ut=>{const It=Pt+(Ut.clientX-Se);ot.current=It,$.updateResize(It)},hn=()=>{const Ut=ot.current??Pt,It=$.commitDrag(Ut,W),lt=It.kind==="collapse"?le:It.kind==="expand"?$.expandedWidth:It.kind==="resize"?It.width:null;lt!=null&&Po(lt),pt()},Zt=()=>{$.clearDrag(),pt()};document.addEventListener("pointermove",He),document.addEventListener("pointerup",hn),document.addEventListener("pointercancel",Zt),window.addEventListener("blur",Zt)},[$,le,Po]),og=m.useCallback((V,W)=>Se=>{Se.preventDefault(),Se.stopPropagation();const Pt=Se.clientX,pt=W?Mt:ia(L);nt.current=pt,Te(pt),rt(W);const He=()=>{document.removeEventListener("pointermove",hn),document.removeEventListener("pointerup",Zt),document.removeEventListener("pointercancel",Ut),window.removeEventListener("blur",Ut)},hn=It=>{const lt=pt+(It.clientX-Pt);nt.current=lt,Te(lt)},Zt=()=>{const It=nt.current??pt,lt=Gh({startedCollapsed:W,rawWidth:It},{min:Wa,max:Ha});lt.kind==="collapse"?Y(!0):lt.kind==="expand"?Y(!1):lt.kind==="resize"&&ae(lt.width),Te(null),nt.current=null;const Hc=lt.kind==="collapse"?V+Mt:lt.kind==="expand"?V+ia(L):lt.kind==="resize"?V+lt.width:null;Hc!=null&&Po(Hc),He()},Ut=()=>{Te(null),nt.current=null,He()};document.addEventListener("pointermove",hn),document.addEventListener("pointerup",Zt),document.addEventListener("pointercancel",Ut),window.addEventListener("blur",Ut)},[L,Y,ae,Po]),Nc=m.useMemo(()=>{const W=[{id:"nav:back",label:"Back",shortcut:"Cmd+[",action:d},{id:"shell:toggle-sidebar-b",label:"Toggle Sidebar",shortcut:"Cmd+B",action:()=>{g?$.toggleCollapsed():Y(Se=>!Se)}},{id:"shell:toggle-right",label:"Toggle Right Panel",shortcut:"Cmd+]",action:()=>K(Se=>!Se)},{id:"shell:toggle-right-overlay",label:"Toggle Inspector Overlay",shortcut:"Cmd+Shift+]",action:()=>fe(Se=>!Se)},{id:"shell:new-session",label:qr,shortcut:Qo,action:()=>l()},{id:"shell:toggle-terminal",label:"Toggle Terminal",shortcut:"Ctrl+`",action:()=>Jt(Se=>!Se)},...g&&a.view==="terminal"?[{id:"shell:terminal-focus",label:oe?"Exit Terminal Focus":"Focus Terminal",shortcut:"Cmd+Shift+B",action:()=>ke(Se=>!Se)}]:[],{id:"shell:feature-flags",label:"Feature Flags",shortcut:ms()?"Cmd+Shift+F":void 0,action:()=>Xn(!0)}];return t&&W.push({id:"shell:toggle-assistant",label:"Toggle Assistant",shortcut:"Cmd+J",action:()=>{Or("assistant"),Jt(Se=>!Se||Ro!=="assistant")}}),W},[t,Ro,l,d,a,Or,Y,K,fe,Xn,ke,g,$,oe]),sg=m.useMemo(()=>[..._,...Nc],[_,Nc]);m.useEffect(()=>{const V=W=>{if(vv(W)&&!z&&!i.open&&!bv()&&g&&a.view==="terminal"){W.preventDefault(),W.stopPropagation(),ke(He=>!He);return}if(yv(W.target)||z||i.open)return;const Se=W.key.toLowerCase(),Pt=W.metaKey||W.ctrlKey||W.altKey,pt=Wd(W.target);if(pi.current)if(W.key==="Escape"||Pt||pt)mn();else{const He=Y1(Se);if(He){W.preventDefault(),W.stopPropagation(),mn(),u(He.route);return}else mn()}if(!Pt&&!W.shiftKey&&Se==="g"&&!pt){W.preventDefault(),W.stopPropagation(),Oc();return}if((W.metaKey||W.ctrlKey)&&W.key==="k"&&(W.preventDefault(),To(!0)),zv(W)&&(W.preventDefault(),l()),(W.metaKey||W.ctrlKey)&&W.key==="["&&(W.preventDefault(),d()),(W.metaKey||W.ctrlKey)&&W.key.toLowerCase()==="b"){if(pt)return;W.preventDefault(),g?$.toggleCollapsed():Y(He=>!He)}(W.metaKey||W.ctrlKey)&&W.key==="]"&&(W.preventDefault(),W.shiftKey?fe(He=>!He):K(He=>!He)),W.ctrlKey&&W.key==="`"&&(W.preventDefault(),Jt(He=>!He)),t&&(W.metaKey||W.ctrlKey)&&W.key==="j"&&(W.preventDefault(),Or("assistant"),Jt(He=>!(He&&Mr==="assistant"))),ms()&&(W.metaKey||W.ctrlKey)&&W.shiftKey&&!W.altKey&&W.code==="KeyF"&&(W.preventDefault(),W.stopPropagation(),Xn(!0))};return window.addEventListener("keydown",V,!0),()=>window.removeEventListener("keydown",V,!0)},[t,mn,i.open,d,u,l,Mr,a,Or,Y,K,fe,Xn,ke,g,$,Oc,z]),m.useEffect(()=>{const V=W=>{const Se=W.detail,Pt=typeof Se?.width=="number"?Se.width:420;K(!1),ye(pt=>Math.max(pt,Math.min(H,Math.max(Xo,Pt))))};return window.addEventListener("scout:set-inspector-width",V),()=>window.removeEventListener("scout:set-inspector-width",V)},[K,ye,H]);const mi=e.slots.Inspector,jc=e.slots.RightPanel,ig=e.tools&&e.tools.length>0,ag=f.jsxs(f.Fragment,{children:[mi&&f.jsx(mi,{}),!mi&&jc&&f.jsx(jc,{}),ig&&f.jsx("div",{className:"border-t border-neutral-700/50",children:e.tools.map(V=>{const W=Qh.has(V.id);return f.jsxs("div",{children:[f.jsxs("button",{onClick:()=>tg(V.id),className:`w-full flex items-center gap-2 px-4 py-2.5 text-sm font-mono tracking-wider uppercase transition-colors hover:bg-white/5 ${O===V.id?"text-emerald-400":"text-neutral-300"}`,children:[W?f.jsx(tb,{size:10}):f.jsx(nb,{size:10}),f.jsx("span",{className:"text-neutral-400",children:V.icon}),f.jsx("span",{className:"font-bold",children:V.name})]}),W&&f.jsx("div",{className:"px-4 pb-3",children:f.jsx(V.Component,{})})]},V.id)})})]}),cg=f.jsx(N1,{onOpenCommandPalette:()=>To(!0)}),Dc=m.useMemo(()=>({isCollapsed:pe,onToggleCollapse:()=>X(V=>!V)}),[pe,X]),lg=U?f.jsx("div",{className:`scout-canvas-minimap-shell${pe?" scout-canvas-minimap-shell--collapsed":""}`,children:U.render(Dc)}):null,ug=U?f.jsx("div",{className:`scout-canvas-minimap-shell scout-canvas-minimap-shell--floating${pe?" scout-canvas-minimap-shell--collapsed":""}`,children:U.render(Dc)}):null,zc=m.useRef(null),Lc=m.useRef(null);m.useEffect(()=>{const V=zc.current;V&&(z?V.setAttribute("inert",""):V.removeAttribute("inert"))},[z]),m.useEffect(()=>{if(!z)return;const V=Lc.current;if(V&&(V.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])")??V).focus(),!A)return;const W=Se=>{Se.key==="Escape"&&(Se.preventDefault(),Z?.())};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[z,A,Z]);const $c=a.view==="agents-v2",dg=lO(a,{hasBrokerAttempt:!!h,hasKnowledgeHit:!!p}),hi=a.view==="ops"&&a.mode==="lanes",[Fc,gi]=m.useState(!1),fg=C.state.conversation,Io=iO(a,fg);m.useEffect(()=>{hi||gi(!1)},[hi]),m.useEffect(()=>{Io||gi(!1)},[Io]);const Ao=aO({empty:Io,forceOpen:Fc,baseCollapsed:ie||ze}),Bc=!be&&!ze&&dg,Oo=ze&&!g,pg=ze,Nr=!be&&g&&JA(a,ze),vi=Nr?ee?Mt:L:0,Vc=Nr&&$.effectiveCollapsed&&ee;m.useEffect(()=>(Vc?document.documentElement.setAttribute("data-scout-double-rail",""):document.documentElement.removeAttribute("data-scout-double-rail"),()=>document.documentElement.removeAttribute("data-scout-double-rail")),[Vc]);const jr=be?0:g?$.width+vi:ee||Oo?0:L,Mo=be||!Bc||J||Je||pg?0:Ao?g?Mt:0:te,mg=we-jr-Mo,Zc=T==="panel"&&mg<aa&&(jr>0||Mo>0),bi=Zc&&Mo>0,yi=Zc&&(g?vi>0&&we-$.width-vi<aa:jr>0&&we-jr<aa),No=Je||J||bi,xi=yi?g?$.width:0:jr,wi=No?0:Mo,hg=T==="panel"?{position:"absolute",top:k,bottom:28,left:xi,right:wi,overflow:"auto"}:{},Uc=g?{top:k}:{},gg=g?{top:k}:{},vg={display:"contents","--scout-shell-left-inset":`${T==="panel"?xi:0}px`,"--scout-shell-right-inset":`${T==="panel"?wi:0}px`,...g?{"--scout-nav-rail-width":`${$.width}px`}:{}},Wc=J?"Pin inspector (push content)":bi?"Keep inspector floating when there is room":"Float inspector (overlay content)",Ei=m.useCallback((V,W=!1)=>({backgroundColor:"rgba(13, 14, 16, 0.72)",backdropFilter:"blur(24px) saturate(140%)",WebkitBackdropFilter:"blur(24px) saturate(140%)",boxShadow:V==="left"?"18px 0 48px -12px rgba(0,0,0,0.7), inset -1px 0 0 0 rgba(255,255,255,0.06)":"-18px 0 48px -12px rgba(0,0,0,0.7), inset 1px 0 0 0 rgba(255,255,255,0.06)",...W?{right:12,bottom:40,borderWidth:1,borderStyle:"solid",borderColor:"rgba(255,255,255,0.09)",borderRadius:12,boxShadow:"-24px 18px 72px -18px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.025)"}:{}}),[]);return f.jsxs(f.Fragment,{children:[f.jsx("div",{ref:zc,"aria-hidden":z?!0:void 0,style:vg,children:f.jsx(T1,{mode:F,panOffset:un,scale:Eo,onPan:li,onZoom:ui,hud:f.jsxs(f.Fragment,{children:[g?null:f.jsx(yO,{title:ze?dt:e.name,search:ze?void 0:I??void 0,center:M,actions:N}),g?be?null:f.jsxs(f.Fragment,{children:[f.jsx(SA,{open:!$.effectiveCollapsed,onOpenChange:V=>$.setCollapsed(!V),style:{"--sidebar-width":`${$.expandedWidth}px`,"--sidebar-width-icon":`${le}px`,"--scout-sidebar-top":"0px"},"data-sidebar-resizing":$.isSidebarResizing?"":void 0,children:f.jsx(NA,{brandLabel:e.name,presentation:E?"slack":"scout"})}),f.jsx(zs,{side:"left",collapsed:$.effectiveCollapsed,label:"Sidebar",onToggle:$.toggleCollapsed,onMouseDown:V=>V.stopPropagation(),className:"scout-rail-toggle--sidebar-edge",style:{position:"fixed",left:$.width,top:R,zIndex:46,transform:"translateX(-50%)"}}),f.jsx("div",{"data-scout-sidebar-resize-handle":"",role:"separator","aria-orientation":"vertical","aria-label":$.effectiveCollapsed?"Expand sidebar (drag out)":"Resize or collapse sidebar",title:$.effectiveCollapsed?"Drag out to expand · double-click to expand":"Drag to resize · drag in to collapse · double-click to reset",onPointerDown:rg,onDoubleClick:V=>{V.preventDefault(),$.effectiveCollapsed?($.setExpandedWidth(ho),$.setCollapsed(!1)):$.resetExpandedWidth()},onMouseDown:V=>{V.stopPropagation()},style:{position:"fixed",left:Math.max(0,$.width-3),top:k+Ba,bottom:28,width:6,zIndex:50,cursor:"ew-resize",pointerEvents:"auto",touchAction:"none"}}),!_o&&$.isSidebarResizing&&$.dragGhostWidth!=null?f.jsx("div",{"data-scout-sidebar-resize-ghost":"","aria-hidden":"true",className:"scout-sidebar-resize-ghost",style:{position:"fixed",left:$.dragGhostWidth,top:k,bottom:28,width:2,transform:"translateX(-50%)",zIndex:55,pointerEvents:"none"}}):null,Nr?f.jsx(XA,{presentation:E?"slack":"scout",navRailWidth:$.width,isCollapsed:ee,onToggleCollapse:()=>Y(!ee),width:L,style:{...gg,...yi?Ei("left"):{}}}):null,Nr?f.jsx("div",{"data-scout-sidebar-resize-handle":"","data-scout-side-rail-resize-handle":"",role:"separator","aria-orientation":"vertical","aria-label":ee?"Expand context rail (drag out)":"Resize or collapse context rail",title:ee?"Drag out to expand · double-click to expand":"Drag to resize · drag in to collapse · double-click to reset",onPointerDown:og($.width,ee),onDoubleClick:V=>{V.preventDefault(),ee?(ae(Ua),Y(!1)):ae(Ua)},onMouseDown:V=>{V.stopPropagation()},style:{position:"fixed",left:Math.max(0,$.width+(ee?Mt:L)-3),top:k+Ba,bottom:28,width:6,zIndex:50,cursor:"ew-resize",pointerEvents:"auto",touchAction:"none"}}):null,!_o&&Nr&&_t&&Ee!=null?f.jsx("div",{"data-scout-side-rail-resize-ghost":"","aria-hidden":"true",className:"scout-sidebar-resize-ghost",style:{position:"fixed",left:$.width+Ee,top:k,bottom:28,width:2,transform:"translateX(-50%)",zIndex:55,pointerEvents:"none"}}):null,De!=null?f.jsx("div",{"data-scout-rail-settle-ghost":"","aria-hidden":"true",className:"scout-sidebar-resize-ghost scout-sidebar-resize-ghost--settle",style:{position:"fixed",left:De,top:k,bottom:28,width:2,transform:"translateX(-50%)",zIndex:55,pointerEvents:"none"}}):null]}):f.jsxs(f.Fragment,{children:[f.jsx(La,{side:"left",title:$c?"Browse":a.view==="agent-info"?"Projects":e.leftPanel?.title??"Navigation",icon:e.leftPanel?.icon,isCollapsed:ee||Oo,onToggleCollapse:()=>Y(!ee),width:L,onResizeStart:Mc("left"),style:yi?Ei("left"):void 0,footer:!ee&&!Oo?lg:void 0,headerActions:e.leftPanel?.headerActions&&f.jsx(e.leftPanel.headerActions,{}),children:f.jsx("div",{"data-pane":"left",style:{display:"contents"},children:e.slots.LeftPanel&&f.jsx(e.slots.LeftPanel,{})})}),ee||Oo?ug:null]}),w?f.jsx("div",{"data-scout-top-row-frame":"",className:"scout-top-row-frame",style:{position:"fixed",top:v,left:be?0:$.width,right:0,height:S,zIndex:30,...o?.style??{}},...Object.fromEntries(Object.entries(o??{}).filter(([V])=>V!=="style")),children:f.jsx(tO,{variant:"top-row",presentation:E?"slack":"scout",onOpenSearch:()=>To(!0),rightUtility:f.jsxs(f.Fragment,{children:[a.view==="terminal"?f.jsx("button",{type:"button","data-scout-terminal-focus-toggle":"","aria-label":be?"Exit terminal focus":"Focus terminal","aria-pressed":be,"aria-keyshortcuts":"Meta+Shift+B Control+Shift+B",title:be?"Exit focus (⌘⇧B)":"Focus terminal (⌘⇧B)",className:`scout-terminal-focus-toggle${be?" scout-terminal-focus-toggle--active":""}`,onClick:()=>ke(V=>!V),children:be?f.jsx(qd,{size:13,strokeWidth:1.8,"aria-hidden":"true"}):f.jsx(Yd,{size:13,strokeWidth:1.8,"aria-hidden":"true"})}):null,f.jsx(rO,{presentation:E?"slack":"scout"})]}),onInteractiveMouseDown:s})}):null,Bc&&(()=>{const V=Je?"Dispatch detail":$c?"Detail":e.rightPanel?.title??"Inspector",W=()=>{if(hi){const Se=cO({empty:Io,forceOpen:Fc,rightCollapsed:ie});gi(Se.forceOpen),Se.rightCollapsed!==ie&&K(Se.rightCollapsed);return}K(!ie)};return g&&Ao?f.jsx(Kh,{side:"right",title:V,onToggle:W,edgeOffset:0,top:k,style:Uc}):f.jsxs(f.Fragment,{children:[f.jsx(La,{side:"right",title:V,icon:e.rightPanel?.icon,isCollapsed:g?!1:Ao,onToggleCollapse:g?void 0:W,width:te,onResizeStart:Mc("right"),floating:No,style:{...Uc,...No?Ei("right",Je):{}},footer:cg,headerActions:f.jsxs(f.Fragment,{children:[!Je&&f.jsx("button",{type:"button",onClick:()=>fe(Se=>bi&&!Se?!0:!Se),title:Wc,"aria-label":Wc,className:"p-1 hover:bg-accent/10 rounded transition-colors text-muted-foreground hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",children:No?f.jsx(Pb,{size:12}):f.jsx(Av,{size:12})}),e.rightPanel?.headerActions&&f.jsx(e.rightPanel.headerActions,{})]}),children:f.jsx("div",{"data-pane":"right",style:{display:"contents"},children:ag})}),g&&!Ao?f.jsx(zs,{side:"right",collapsed:!1,label:V,onToggle:W,className:"scout-rail-toggle--panel scout-rail-toggle--inspector",style:{position:"fixed",right:te,top:R,zIndex:45,transform:"translateX(50%)"}}):null]})})(),f.jsx(O1,{status:B.status,left:f.jsx(xO,{statusBar:B,dictationActive:C.state.activity==="listening"}),right:f.jsx(wO,{statusBar:B,onOpenFlagPanel:()=>Xn(!0),onOpenActivityLog:()=>he(!0)}),onToggleTerminal:()=>Jt(V=>!V),isTerminalOpen:Jn}),f.jsx(rI,{open:q,onClose:()=>he(!1)}),f.jsx("div",{className:"pointer-events-none",style:{position:"fixed",left:xi,right:wi,bottom:0,top:0,zIndex:45,transform:"translateZ(0)"},children:f.jsxs(V1,{isOpen:Jn,onClose:()=>Jt(!1),onToggleMaximize:()=>di(V=>!V),isMaximized:So,height:Math.min(fi,window.innerHeight*.8),onHeightChange:V=>zn(Math.min(V,window.innerHeight*.8)),title:f.jsx(SO,{tabs:Ar,active:Mr,onSelect:Or}),children:[Jn&&Mr==="terminal"&&(e.slots.Terminal?f.jsx(e.slots.Terminal,{}):f.jsx("div",{className:"p-4 font-mono text-md text-neutral-400",children:"No terminal content"})),Jn&&Mr==="assistant"&&f.jsx(yk,{app:e,commands:_})]})}),f.jsx(W1,{isOpen:Jh,onClose:()=>To(!1),commands:sg})]}),children:f.jsx("div",{style:hg,className:"frame-scrollbar","data-pane":"center",children:f.jsx(e.slots.Content,{})})})}),z&&P?f.jsxs("div",{ref:Lc,tabIndex:-1,role:"dialog","aria-modal":"true",style:{position:"fixed",inset:0,zIndex:80,outline:"none"},children:[f.jsx("div",{"data-scout-takeover-drag-region":"","aria-hidden":"true",style:{position:"absolute",top:0,left:0,right:0,height:Math.max(28,r||28),zIndex:1,...o?.style??{}},...Object.fromEntries(Object.entries(o??{}).filter(([V])=>V!=="style"))}),f.jsx(P,{})]}):null,f.jsx(J1,{open:i.open,onClose:()=>i.setOpen(!1)}),f.jsx(z1,{isOpen:Xh,onClose:()=>Xn(!1),audienceOptions:Id}),f.jsx(tI,{})]})}function SO({tabs:e,active:t,onSelect:n}){return e.length===0?null:f.jsx("div",{className:"flex items-center gap-0.5",children:e.map(r=>{const o=r===t,s=r==="terminal"?Gd:Ad,i=r==="terminal"?"TERMINAL":"ASSISTANT",a=r==="terminal"?"text-emerald-400":"text-cyan-400";return f.jsxs("button",{type:"button",onClick:()=>n(r),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-bold tracking-widest font-mono transition-colors ${o?`${a} bg-white/[0.04]`:"text-neutral-500 hover:text-neutral-300"}`,children:[f.jsx(s,{size:13}),f.jsx("span",{children:i})]},r)})})}export{Xj as OpenScoutAppShell};