dorkos 0.111.0 → 0.114.1

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 (199) hide show
  1. package/core-extensions/hello-world/index.ts +2 -2
  2. package/dist/bin/cli.js +14236 -1898
  3. package/dist/browser/native/package-manifest.json +1 -1
  4. package/dist/browser/source-manifest.json +1 -1
  5. package/dist/client/assets/{AboutPage-BKzqcz_A.js → AboutPage-BRHiWrvg.js} +1 -1
  6. package/dist/client/assets/{ActivityErrorState-BXOZg9ve.js → ActivityErrorState-DGwKpdjB.js} +1 -1
  7. package/dist/client/assets/{ActivityPage-CFN2MEAV.js → ActivityPage-C-lpXfva.js} +1 -1
  8. package/dist/client/assets/{ActivityRow-CujXx04u.js → ActivityRow-TjAMUrcU.js} +1 -1
  9. package/dist/client/assets/AdapterIcon-B-NJfk_R.js +1 -0
  10. package/dist/client/assets/{AdapterSetupWizard-3Bt9HEWF.js → AdapterSetupWizard-CrdiWINL.js} +2 -2
  11. package/dist/client/assets/{AgentRequestCard-CAaBGC0L.js → AgentRequestCard-BRINjair.js} +3 -3
  12. package/dist/client/assets/{AppearancePage-BEe-Gssu.js → AppearancePage-COdpfn1g.js} +1 -1
  13. package/dist/client/assets/{AttentionSignalRow-Cp0AJs73.js → AttentionSignalRow-Dc8laCri.js} +1 -1
  14. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-CN1iW2cB.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-C-BpNthi.js} +3 -3
  15. package/dist/client/assets/{BlintzCanvas-B7qs2dxW.js → BlintzCanvas-DCU4iOtF.js} +1 -1
  16. package/dist/client/assets/{CanvasCsvContent-DiB5zXOC.js → CanvasCsvContent-oayJjsGq.js} +2 -2
  17. package/dist/client/assets/CanvasFileContent-C-aDKKws.js +2 -0
  18. package/dist/client/assets/CanvasModel3dContent-Dnx6oUx2.js +2 -0
  19. package/dist/client/assets/{CodeMirrorDiff-BJhflpbC.js → CodeMirrorDiff-j0jAFw_i.js} +1 -1
  20. package/dist/client/assets/{CodeMirrorEditor-SkdXRKSN.js → CodeMirrorEditor-DWgnGEHZ.js} +1 -1
  21. package/dist/client/assets/{CommitmentList-DsEn6iK1.js → CommitmentList-CCsDbGY2.js} +1 -1
  22. package/dist/client/assets/{CommitmentsPage-W5h0GjRr.js → CommitmentsPage-_vCusfuJ.js} +1 -1
  23. package/dist/client/assets/{ConnectionAccessLists-DVFqelmV.js → ConnectionAccessLists-umV6IbYS.js} +1 -1
  24. package/dist/client/assets/{ConnectionsPage-CZhSh2mO.js → ConnectionsPage-2iGwApEi.js} +2 -2
  25. package/dist/client/assets/{ConventionPage-DcDBP-vR.js → ConventionPage-Bucu3-TK.js} +3 -3
  26. package/dist/client/assets/{ExtensionPageRoute-mKN8Jqyx.js → ExtensionPageRoute-XXcMwrQY.js} +2 -2
  27. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-CGXG-x9g.js → FloatingTanStackRouterDevtools-CqogiFob-C8yf1gK7.js} +1 -1
  28. package/dist/client/assets/HandlePage-BotSAp8X.js +1 -0
  29. package/dist/client/assets/{HeartbeatPage-DFf7Udem.js → HeartbeatPage-CVAZeDqg.js} +1 -1
  30. package/dist/client/assets/{LexicalField-vJ284m2H.js → LexicalField-Dr5vnDVn.js} +2 -2
  31. package/dist/client/assets/{ManagesPage-mDuaA2JT.js → ManagesPage-Dj_UOeFQ.js} +1 -1
  32. package/dist/client/assets/{Marketplace-BoiupH2Z.js → Marketplace-RwZrKU4O.js} +4 -4
  33. package/dist/client/assets/{MarketplaceSourcesView-krw9hUyu.js → MarketplaceSourcesView-xSimTjA0.js} +1 -1
  34. package/dist/client/assets/{McpAppFrame-DmHduNgp.js → McpAppFrame-Er6EX82b.js} +2 -2
  35. package/dist/client/assets/{McpSigninBody-DoY09n4J.js → McpSigninBody-DMK94EGx.js} +1 -1
  36. package/dist/client/assets/{Model3dViewer-BZEdR7-9.js → Model3dViewer-D5xu-FCi.js} +1 -1
  37. package/dist/client/assets/NamePage-NZ40HlPR.js +1 -0
  38. package/dist/client/assets/NewDirectMessageMenu-DiI_GTiE.js +1 -0
  39. package/dist/client/assets/{NotificationsPage-CybW1eIb.js → NotificationsPage-B_XMIlHt.js} +1 -1
  40. package/dist/client/assets/{OpenMeshSwitch-DrmjsCDY.js → OpenMeshSwitch-BjiejioP.js} +2 -2
  41. package/dist/client/assets/{OperatorIdentityForm-byU2FeSU.js → OperatorIdentityForm-H7l8r2VC.js} +1 -1
  42. package/dist/client/assets/{PermissionsPage-CP3kbqyJ.js → PermissionsPage-DVV9vtoW.js} +1 -1
  43. package/dist/client/assets/{PersonalityPopover-BLsjgaum.js → PersonalityPopover-BT-aQ65s.js} +1 -1
  44. package/dist/client/assets/PhotoPage-DKgOQCBH.js +1 -0
  45. package/dist/client/assets/{PreviewRefusedNotice-fTN8MJ1h.js → PreviewRefusedNotice-DJyQxUFv.js} +1 -1
  46. package/dist/client/assets/{PromptSuggestionChips-BZOaY5Tx.js → PromptSuggestionChips-Dw7RA2P1.js} +1 -1
  47. package/dist/client/assets/{ReportsToPopover-B6JvfRt3.js → ReportsToPopover-fxu1r9iw.js} +1 -1
  48. package/dist/client/assets/{RoomSurface-BM0QO_av.js → RoomSurface-D4Etqadg.js} +8 -8
  49. package/dist/client/assets/{RoomsPage-B-NOCLXC.js → RoomsPage-D0795GTq.js} +1 -1
  50. package/dist/client/assets/{RunsOnPopover-D1jQQatj.js → RunsOnPopover-Cp8EMGHD.js} +1 -1
  51. package/dist/client/assets/RuntimeSetupDialog-Cxtz9b_r.js +1 -0
  52. package/dist/client/assets/SessionsPage-DbIKrtbg.js +1 -0
  53. package/dist/client/assets/{SkillsPage-CPTFjEUe.js → SkillsPage-DYSIGciZ.js} +1 -1
  54. package/dist/client/assets/{TasksPage-BRUqs3v5.js → TasksPage-DoEP7ZsZ.js} +1 -1
  55. package/dist/client/assets/{ToolsPage-C25kL822.js → ToolsPage-gUYaNA1-.js} +2 -2
  56. package/dist/client/assets/{TopologyGraph-of6Cp5Kj.js → TopologyGraph-KPxRfshp.js} +1 -1
  57. package/dist/client/assets/{TourHost-zwSilkjm.js → TourHost-BIozl4IA.js} +1 -1
  58. package/dist/client/assets/{UnlinkDialog-BgwHAqdW.js → UnlinkDialog-RuuQUyOF.js} +1 -1
  59. package/dist/client/assets/{WidgetErrorCard-BQwrR6PJ.js → WidgetErrorCard-BojvLOeP.js} +24 -29
  60. package/dist/client/assets/_shell-BMQyJ7r4.js +88 -0
  61. package/dist/client/assets/{_shell._home-BkP0NafS.js → _shell._home-C-OJaDmg.js} +1 -1
  62. package/dist/client/assets/{_shell._home.activity-BO_2ciGK.js → _shell._home.activity-Bvsxue6y.js} +1 -1
  63. package/dist/client/assets/_shell._home.index-DXnd_q3h.js +3 -0
  64. package/dist/client/assets/_shell._home.tasks-Mz-iO--x.js +1 -0
  65. package/dist/client/assets/_shell._home.workspaces-ChuVp2dK.js +1 -0
  66. package/dist/client/assets/_shell.channels-Cpde6Iix.js +10 -0
  67. package/dist/client/assets/_shell.connections-CxgvSPjQ.js +1 -0
  68. package/dist/client/assets/{_shell.feedback-requests-B71l48KB.js → _shell.feedback-requests-BBEuotuF.js} +2 -2
  69. package/dist/client/assets/_shell.marketplace-Hk6n4nNt.js +1 -0
  70. package/dist/client/assets/_shell.marketplace_.sources-B8f38K6K.js +1 -0
  71. package/dist/client/assets/_shell.session-DsF1tXPP.js +66 -0
  72. package/dist/client/assets/_shell.team-4bF5Nn4_.js +28 -0
  73. package/dist/client/assets/_shell.x._extensionId-B6J6mDaT.js +1 -0
  74. package/dist/client/assets/_shell.x._extensionId_._-B6J6mDaT.js +1 -0
  75. package/dist/client/assets/{agent-browser-Cs8abkZs.js → agent-browser-BIsnzdje.js} +1 -1
  76. package/dist/client/assets/{banner-CU2Nh3Kv.js → banner-Dll8KWyW.js} +2 -2
  77. package/dist/client/assets/{card-BTgwskmX.js → card-5POMzMJ6.js} +1 -1
  78. package/dist/client/assets/{file-DlQX-hKl.js → file-CY9v6yos.js} +1 -1
  79. package/dist/client/assets/{file-exclamation-point-Dg2iCyPM.js → file-exclamation-point-DNS4eVZR.js} +1 -1
  80. package/dist/client/assets/file-text-BQ5NBk6w.js +6 -0
  81. package/dist/client/assets/{find-latest-widget-fence-BGiexm6r.js → find-latest-widget-fence-BC8zM39x.js} +1 -1
  82. package/dist/client/assets/{git-branch-Dq_w3Iyx.js → git-branch-34CUrn_R.js} +1 -1
  83. package/dist/client/assets/{heart-Bp14wOx6.js → heart-B5oPCBeT.js} +1 -1
  84. package/dist/client/assets/{highlighted-body-KPVGNVTW-kD1HK_wk.js → highlighted-body-KPVGNVTW-DeDxlHr7.js} +1 -1
  85. package/dist/client/assets/{index-BeBmUxo_.js → index-BCJdsNmC.js} +1 -1
  86. package/dist/client/assets/{index-CcV9S7cO.js → index-BM9_nnxH.js} +1 -1
  87. package/dist/client/assets/{index-B0OZehWe.js → index-BTkflOTk.js} +1 -1
  88. package/dist/client/assets/{index-gu2JYnOq.js → index-BWj2VXUd.js} +1 -1
  89. package/dist/client/assets/{index-B6_ikFYj.js → index-BZYcFunZ.js} +1 -1
  90. package/dist/client/assets/{index-C_uYJzKi.js → index-B_LR9e6q.js} +3 -3
  91. package/dist/client/assets/{index-DNglWRBB.js → index-BeH3ljiU.js} +1 -1
  92. package/dist/client/assets/{index-DHUToGjI.js → index-BfY2tknC.js} +1 -1
  93. package/dist/client/assets/{index-knGXyHhh.js → index-BfoRyh9U.js} +1 -1
  94. package/dist/client/assets/index-BqtFX8p5.js +1 -0
  95. package/dist/client/assets/{index-DKlxz3u7.js → index-Bvr-_HFb.js} +1 -1
  96. package/dist/client/assets/{index-DSPs6GF4.js → index-C-DMBd4V.js} +1 -1
  97. package/dist/client/assets/{index-BHsZlKfx.js → index-C4ZJEVQG.js} +1 -1
  98. package/dist/client/assets/{index-PxSRtDpP.js → index-C6XffNP5.js} +1 -1
  99. package/dist/client/assets/{index-BxrZwUJp.js → index-C9NjdeaX.js} +3 -3
  100. package/dist/client/assets/{index-CKCMjqcu.js → index-CFakjglG.js} +1 -1
  101. package/dist/client/assets/{index--3UwFg2s.js → index-C_nYZwKl.js} +1 -1
  102. package/dist/client/assets/{index-LszRbEbX.js → index-CbUkmP4v.js} +1 -1
  103. package/dist/client/assets/index-Cdi4wcy2.js +23 -0
  104. package/dist/client/assets/{index-DW6zqLoM.js → index-CfPs0N2z.js} +1 -1
  105. package/dist/client/assets/{index-DO6a5Hey.js → index-CiOdQLWf.js} +1 -1
  106. package/dist/client/assets/{index-CAhJGlSW.js → index-CkfVcaGE.js} +1 -1
  107. package/dist/client/assets/{index-B8R78Nnj.js → index-Cw1lCYXU.js} +2 -2
  108. package/dist/client/assets/index-D1AN47IZ.js +17 -0
  109. package/dist/client/assets/{index-CDWsIVX7.js → index-D6QoZ_JK.js} +1 -1
  110. package/dist/client/assets/index-DFEF2MFy.css +1 -0
  111. package/dist/client/assets/{index-Cc280M3V.js → index-DipT3Tl7.js} +1 -1
  112. package/dist/client/assets/{index-DnmtTIUB.js → index-DjQZM7xU.js} +1 -1
  113. package/dist/client/assets/{index-C99173Ze.js → index-Dl3NBIFK.js} +1 -1
  114. package/dist/client/assets/{index-Dm53S0up.js → index-DvSjlchr.js} +1 -1
  115. package/dist/client/assets/{index-BA-nPsLw.js → index-HmNnK1_1.js} +1 -1
  116. package/dist/client/assets/{index-5OyUurJr.js → index-Svn7q7Oq.js} +1 -1
  117. package/dist/client/assets/index-d-DK54t2.js +1099 -0
  118. package/dist/client/assets/{index-aDNEGBTK.js → index-hw9zI0x5.js} +1 -1
  119. package/dist/client/assets/{index-C-DN0Vg_.js → index-juObjGCH.js} +1 -1
  120. package/dist/client/assets/index-obtMBZBo.js +1 -0
  121. package/dist/client/assets/{index-DKQDBIWq.js → index-sLuAyJv-.js} +1 -1
  122. package/dist/client/assets/index-tdK5EJaB.js +1 -0
  123. package/dist/client/assets/index-wx8w6kby.js +1 -0
  124. package/dist/client/assets/{index-DS-thlE8.js → index-yDaSJS2Z.js} +1 -1
  125. package/dist/client/assets/kickoff-BwvlCy0n.js +3 -0
  126. package/dist/client/assets/{layers-B0oCOfxz.js → layers-5nJbTYJI.js} +1 -1
  127. package/dist/client/assets/{lightbulb-D80IzMqz.js → lightbulb-CTbrj6Bh.js} +1 -1
  128. package/dist/client/assets/{markdown-content-aNzh-54y.js → markdown-content-BWVUF3Ll.js} +1 -1
  129. package/dist/client/assets/{mention-pill-BxMK0xuY.js → mention-pill-DlZf_ikY.js} +1 -1
  130. package/dist/client/assets/{message-square-off-D-CJXmTq.js → message-square-off-DwAOErT_.js} +1 -1
  131. package/dist/client/assets/{owner-notice-BkrTEMDm.js → owner-notice-De98Vj3z.js} +1 -1
  132. package/dist/client/assets/{package-CoTlAnXZ.js → package-B1hSUoIL.js} +1 -1
  133. package/dist/client/assets/{page-container-CPxW5T9E.js → page-container-DTyW7UJt.js} +1 -1
  134. package/dist/client/assets/{paperclip-Cj1P85mz.js → paperclip-CoxP50ae.js} +1 -1
  135. package/dist/client/assets/{radio-DICkTr_p.js → radio-WZhvBdvS.js} +1 -1
  136. package/dist/client/assets/{room-files-source-BywWQPBN.js → room-files-source-B2H-CIeN.js} +2 -2
  137. package/dist/client/assets/{rotate-ccw-clock-cx5RyP4l.js → rotate-ccw-clock-DFGhE-_C.js} +1 -1
  138. package/dist/client/assets/{rotate-cw-DrGRGSwy.js → rotate-cw-DiWMKflx.js} +1 -1
  139. package/dist/client/assets/{scroll-area-XlDz8u4m.js → scroll-area-BJrXoUrS.js} +1 -1
  140. package/dist/client/assets/{search-x-LIKnWE64.js → search-x-CPf5yiSS.js} +2 -2
  141. package/dist/client/assets/{shield-x-DioB6qH_.js → shield-x-D-yr2n7H.js} +1 -1
  142. package/dist/client/assets/{soul-file-C7YgkNET.js → soul-file-D0y7QIBL.js} +1 -1
  143. package/dist/client/assets/{table-P4N5xQn2.js → table-B3kRSRyK.js} +1 -1
  144. package/dist/client/assets/{use-connector-management-pgVHbXoO.js → use-connector-management-2rrubqr1.js} +1 -1
  145. package/dist/client/assets/{use-delete-binding-DxEiOjjh.js → use-delete-binding-BKhK3a7C.js} +1 -1
  146. package/dist/client/assets/{use-dev-links-BImQrE6g.js → use-dev-links-BIxj0Pjl.js} +1 -1
  147. package/dist/client/assets/{use-external-adapter-catalog-D8KHMSZU.js → use-external-adapter-catalog-XS0vyTlS.js} +1 -1
  148. package/dist/client/assets/use-full-activity-feed-CwqKSvpf.js +1 -0
  149. package/dist/client/assets/use-is-below-desktop-Dzs5i_TM.js +1 -0
  150. package/dist/client/assets/{use-jump-back-in-D9tBJ4v5.js → use-jump-back-in-CD5wYoFA.js} +3 -3
  151. package/dist/client/assets/use-mesh-topology-3LbL6yfa.js +1 -0
  152. package/dist/client/assets/use-panel-tab-placements-CTNXdvC6.js +1 -0
  153. package/dist/client/assets/use-pending-read-sDmA-i7r.js +1 -0
  154. package/dist/client/assets/{use-personality-commit-Gfoi__sT.js → use-personality-commit-B13DSXxo.js} +1 -1
  155. package/dist/client/assets/{use-promo-activation-Bv1gnqKq.js → use-promo-activation-DCy9ROgP.js} +3 -3
  156. package/dist/client/assets/{use-pulse-freshness-SFRdnugS.js → use-pulse-freshness-CRHnQO_-.js} +1 -1
  157. package/dist/client/assets/{use-room-follow-claim-Cf20JiJ_.js → use-room-follow-claim-FWatOD5-.js} +1 -1
  158. package/dist/client/assets/{use-roving-tab-list-3Pb7ps4E.js → use-roving-tab-list-C56ygMxj.js} +1 -1
  159. package/dist/client/assets/{use-session-canvas-BaXuEhw8.js → use-session-canvas-Dsmt92or.js} +4 -4
  160. package/dist/client/assets/{use-session-diagnostics-7xxJ6zQQ.js → use-session-diagnostics-ypmmhIlN.js} +4 -4
  161. package/dist/client/assets/{use-unclaimed-chats-D4k-EK_f.js → use-unclaimed-chats-C_bsrJFb.js} +1 -1
  162. package/dist/client/index.html +2 -2
  163. package/dist/server/index.js +80743 -74474
  164. package/dist/server/index.js.map +2 -2
  165. package/package.json +6 -7
  166. package/dist/client/assets/AdapterIcon-BdM7K69W.js +0 -1
  167. package/dist/client/assets/CanvasFileContent-CDNfnWMW.js +0 -2
  168. package/dist/client/assets/CanvasModel3dContent-C7EINmuq.js +0 -2
  169. package/dist/client/assets/HandlePage-Bun58ePo.js +0 -1
  170. package/dist/client/assets/NamePage-CXyClUPJ.js +0 -1
  171. package/dist/client/assets/NewDirectMessageMenu-BjqYwnXW.js +0 -1
  172. package/dist/client/assets/PhotoPage-hn5b42qN.js +0 -1
  173. package/dist/client/assets/RuntimeSetupDialog-ufwCvCJB.js +0 -1
  174. package/dist/client/assets/SessionsPage-CBE1KHYg.js +0 -1
  175. package/dist/client/assets/_shell-bcx2y7VT.js +0 -88
  176. package/dist/client/assets/_shell._home.index-B-OFwU9u.js +0 -3
  177. package/dist/client/assets/_shell._home.tasks-jAQczH7j.js +0 -1
  178. package/dist/client/assets/_shell._home.workspaces-B34Uk1SP.js +0 -1
  179. package/dist/client/assets/_shell.channels-CGzsxvXD.js +0 -10
  180. package/dist/client/assets/_shell.connections-BNbeBrxQ.js +0 -1
  181. package/dist/client/assets/_shell.marketplace-3YAsNaRk.js +0 -1
  182. package/dist/client/assets/_shell.marketplace_.sources-cI3nNBXr.js +0 -1
  183. package/dist/client/assets/_shell.session-ybAc0bwn.js +0 -66
  184. package/dist/client/assets/_shell.team-BE_60YS4.js +0 -28
  185. package/dist/client/assets/_shell.x._extensionId-jiyP599c.js +0 -1
  186. package/dist/client/assets/_shell.x._extensionId_._-jiyP599c.js +0 -1
  187. package/dist/client/assets/index-B2JJZXsq.js +0 -1
  188. package/dist/client/assets/index-BAjUSKoJ.js +0 -1
  189. package/dist/client/assets/index-BpDY3eoD.js +0 -1
  190. package/dist/client/assets/index-BxUoa3yn.js +0 -17
  191. package/dist/client/assets/index-Dr-0P6rd.js +0 -1094
  192. package/dist/client/assets/index-ExcAk4pE.css +0 -1
  193. package/dist/client/assets/index-F7Lcwnfm.js +0 -1
  194. package/dist/client/assets/index-kHXlTLUx.js +0 -23
  195. package/dist/client/assets/kickoff-Btbza7bw.js +0 -3
  196. package/dist/client/assets/use-full-activity-feed-2o7GNAMe.js +0 -1
  197. package/dist/client/assets/use-is-below-desktop-DBet5zg_.js +0 -1
  198. package/dist/client/assets/use-mesh-topology-DBeqzUoy.js +0 -1
  199. package/dist/client/assets/use-pending-read-DmrlNHS0.js +0 -1
@@ -1,28 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TopologyGraph-of6Cp5Kj.js","assets/index-Dr-0P6rd.js","assets/index-ExcAk4pE.css","assets/heart-Bp14wOx6.js","assets/AdapterIcon-BdM7K69W.js","assets/session-strategy-labels-C7Wduch3.js","assets/use-mesh-topology-DBeqzUoy.js","assets/use-delete-binding-DxEiOjjh.js","assets/use-pending-read-DmrlNHS0.js","assets/search-x-LIKnWE64.js","assets/scroll-area-XlDz8u4m.js","assets/OpenMeshSwitch-DrmjsCDY.js","assets/table-P4N5xQn2.js","assets/page-container-CPxW5T9E.js","assets/CommitmentList-DsEn6iK1.js","assets/TopologyGraph-C7eadB24.css"])))=>i.map(i=>d[i]);
2
- import{a4 as Rt,r as w,dJ as Ue,j as r,Z as k,a3 as $,c0 as yt,B as E,g7 as G,iz as Ke,b1 as ce,aa as I,a7 as jt,iA as _t,iB as Nt,db as Ye,iC as Ft,iD as Mt,at as Xe,bV as Qe,ae as Pt,iE as Se,iF as $t,V as We,iG as te,dp as It,aj as At,hE as Vt,iH as Ze,iI as K,bC as Je,iJ as Et,iK as Dt,iL as zt,e as V,ds as H,iM as _e,iN as kt,iO as Tt,iP as bt,iQ as Lt,F as J,A as et,e5 as Ht,eQ as Ne,iR as Gt,df as Ot,C as Bt,iS as tt,b3 as qt,eX as Ut,e3 as Fe,dY as Me,dZ as Pe,d_ as $e,d$ as Ie,e0 as Ae,f as Kt,iT as ne,bv as Yt,X as Ce,t as nt,fj as Xt,g as st,iU as Qt,iV as Wt,dc as Zt,iW as Jt,dt as en,bl as ge,iX as tn,iY as nn,I as sn,iZ as on,bU as rn,d as an,a6 as ot,bT as ln,dv as un,ci as dn,g4 as cn,gf as gn,i_ as fn,l as Y,i$ as mn,j0 as pn,aQ as hn}from"./index-Dr-0P6rd.js";import{u as it}from"./use-pending-read-DmrlNHS0.js";import{u as rt}from"./use-mesh-topology-DBeqzUoy.js";import{S as xn,u as vn}from"./search-x-LIKnWE64.js";import{S as Sn}from"./scroll-area-XlDz8u4m.js";import{u as Cn,a as wn,O as Ve,b as Rn}from"./OpenMeshSwitch-DrmjsCDY.js";import{T as yn,d as jn,b as X,e as Ee,a as _n,c as De}from"./table-P4N5xQn2.js";import{P as Nn}from"./page-container-CPxW5T9E.js";import{r as Fn,C as Mn}from"./CommitmentList-DsEn6iK1.js";/**
3
- * @license lucide-react v1.48.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const at={name:"scan-search",size:24,node:[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]]};at.node;const Pn=Rt(at);/**
8
- * table-core
9
- *
10
- * Copyright (c) TanStack
11
- *
12
- * This source code is licensed under the MIT license found in the
13
- * LICENSE.md file in the root directory of this source tree.
14
- *
15
- * @license MIT
16
- */function T(e,s){return typeof e=="function"?e(s):e}function P(e,s){return t=>{s.setState(n=>({...n,[e]:T(t,n[e])}))}}function ee(e){return e instanceof Function}function $n(e){return Array.isArray(e)&&e.every(s=>typeof s=="number")}function In(e,s){const t=[],n=o=>{o.forEach(i=>{t.push(i);const a=s(i);a!=null&&a.length&&n(a)})};return n(e),t}function S(e,s,t){let n=[],o;return i=>{let a;t.key&&t.debug&&(a=Date.now());const l=e(i);if(!(l.length!==n.length||l.some((g,h)=>n[h]!==g)))return o;n=l;let d;if(t.key&&t.debug&&(d=Date.now()),o=s(...l),t==null||t.onChange==null||t.onChange(o),t.key&&t.debug&&t!=null&&t.debug()){const g=Math.round((Date.now()-a)*100)/100,h=Math.round((Date.now()-d)*100)/100,f=h/16,c=(p,m)=>{for(p=String(p);p.length<m;)p=" "+p;return p};console.info(`%c⏱ ${c(h,5)} /${c(g,5)} ms`,`
17
- font-size: .6rem;
18
- font-weight: bold;
19
- color: hsl(${Math.max(0,Math.min(120-120*f,120))}deg 100% 31%);`,t==null?void 0:t.key)}return o}}function C(e,s,t,n){return{debug:()=>{var o;return(o=e==null?void 0:e.debugAll)!=null?o:e[s]},key:!1,onChange:n}}function An(e,s,t,n){const o=()=>{var a;return(a=i.getValue())!=null?a:e.options.renderFallbackValue},i={id:`${s.id}_${t.id}`,row:s,column:t,getValue:()=>s.getValue(n),renderValue:o,getContext:S(()=>[e,t,s,i],(a,l,u,d)=>({table:a,column:l,row:u,cell:d,getValue:d.getValue,renderValue:d.renderValue}),C(e.options,"debugCells"))};return e._features.forEach(a=>{a.createCell==null||a.createCell(i,t,s,e)},{}),i}function Vn(e,s,t,n){var o,i;const l={...e._getDefaultColumnDef(),...s},u=l.accessorKey;let d=(o=(i=l.id)!=null?i:u?typeof String.prototype.replaceAll=="function"?u.replaceAll(".","_"):u.replace(/\./g,"_"):void 0)!=null?o:typeof l.header=="string"?l.header:void 0,g;if(l.accessorFn?g=l.accessorFn:u&&(u.includes(".")?g=f=>{let c=f;for(const m of u.split(".")){var p;c=(p=c)==null?void 0:p[m]}return c}:g=f=>f[l.accessorKey]),!d)throw new Error;let h={id:`${String(d)}`,accessorFn:g,parent:n,depth:t,columnDef:l,columns:[],getFlatColumns:S(()=>[!0],()=>{var f;return[h,...(f=h.columns)==null?void 0:f.flatMap(c=>c.getFlatColumns())]},C(e.options,"debugColumns")),getLeafColumns:S(()=>[e._getOrderColumnsFn()],f=>{var c;if((c=h.columns)!=null&&c.length){let p=h.columns.flatMap(m=>m.getLeafColumns());return f(p)}return[h]},C(e.options,"debugColumns"))};for(const f of e._features)f.createColumn==null||f.createColumn(h,e);return h}const M="debugHeaders";function ze(e,s,t){var n;let i={id:(n=t.id)!=null?n:s.id,column:s,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const a=[],l=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(l),a.push(u)};return l(i),a},getContext:()=>({table:e,header:i,column:s})};return e._features.forEach(a=>{a.createHeader==null||a.createHeader(i,e)}),i}const En={createTable:e=>{e.getHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(s,t,n,o)=>{var i,a;const l=(i=n==null?void 0:n.map(h=>t.find(f=>f.id===h)).filter(Boolean))!=null?i:[],u=(a=o==null?void 0:o.map(h=>t.find(f=>f.id===h)).filter(Boolean))!=null?a:[],d=t.filter(h=>!(n!=null&&n.includes(h.id))&&!(o!=null&&o.includes(h.id)));return Q(s,[...l,...d,...u],e)},C(e.options,M)),e.getCenterHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(s,t,n,o)=>(t=t.filter(i=>!(n!=null&&n.includes(i.id))&&!(o!=null&&o.includes(i.id))),Q(s,t,e,"center")),C(e.options,M)),e.getLeftHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(s,t,n)=>{var o;const i=(o=n==null?void 0:n.map(a=>t.find(l=>l.id===a)).filter(Boolean))!=null?o:[];return Q(s,i,e,"left")},C(e.options,M)),e.getRightHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(s,t,n)=>{var o;const i=(o=n==null?void 0:n.map(a=>t.find(l=>l.id===a)).filter(Boolean))!=null?o:[];return Q(s,i,e,"right")},C(e.options,M)),e.getFooterGroups=S(()=>[e.getHeaderGroups()],s=>[...s].reverse(),C(e.options,M)),e.getLeftFooterGroups=S(()=>[e.getLeftHeaderGroups()],s=>[...s].reverse(),C(e.options,M)),e.getCenterFooterGroups=S(()=>[e.getCenterHeaderGroups()],s=>[...s].reverse(),C(e.options,M)),e.getRightFooterGroups=S(()=>[e.getRightHeaderGroups()],s=>[...s].reverse(),C(e.options,M)),e.getFlatHeaders=S(()=>[e.getHeaderGroups()],s=>s.map(t=>t.headers).flat(),C(e.options,M)),e.getLeftFlatHeaders=S(()=>[e.getLeftHeaderGroups()],s=>s.map(t=>t.headers).flat(),C(e.options,M)),e.getCenterFlatHeaders=S(()=>[e.getCenterHeaderGroups()],s=>s.map(t=>t.headers).flat(),C(e.options,M)),e.getRightFlatHeaders=S(()=>[e.getRightHeaderGroups()],s=>s.map(t=>t.headers).flat(),C(e.options,M)),e.getCenterLeafHeaders=S(()=>[e.getCenterFlatHeaders()],s=>s.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,M)),e.getLeftLeafHeaders=S(()=>[e.getLeftFlatHeaders()],s=>s.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,M)),e.getRightLeafHeaders=S(()=>[e.getRightFlatHeaders()],s=>s.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,M)),e.getLeafHeaders=S(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(s,t,n)=>{var o,i,a,l,u,d;return[...(o=(i=s[0])==null?void 0:i.headers)!=null?o:[],...(a=(l=t[0])==null?void 0:l.headers)!=null?a:[],...(u=(d=n[0])==null?void 0:d.headers)!=null?u:[]].map(g=>g.getLeafHeaders()).flat()},C(e.options,M))}};function Q(e,s,t,n){var o,i;let a=0;const l=function(f,c){c===void 0&&(c=1),a=Math.max(a,c),f.filter(p=>p.getIsVisible()).forEach(p=>{var m;(m=p.columns)!=null&&m.length&&l(p.columns,c+1)},0)};l(e);let u=[];const d=(f,c)=>{const p={depth:c,id:[n,`${c}`].filter(Boolean).join("_"),headers:[]},m=[];f.forEach(v=>{const x=[...m].reverse()[0],R=v.column.depth===p.depth;let j,y=!1;if(R&&v.column.parent?j=v.column.parent:(j=v.column,y=!0),x&&(x==null?void 0:x.column)===j)x.subHeaders.push(v);else{const _=ze(t,j,{id:[n,c,j.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:y,placeholderId:y?`${m.filter(A=>A.column===j).length}`:void 0,depth:c,index:m.length});_.subHeaders.push(v),m.push(_)}p.headers.push(v),v.headerGroup=p}),u.push(p),c>0&&d(m,c-1)},g=s.map((f,c)=>ze(t,f,{depth:a,index:c}));d(g,a-1),u.reverse();const h=f=>f.filter(p=>p.column.getIsVisible()).map(p=>{let m=0,v=0,x=[0];p.subHeaders&&p.subHeaders.length?(x=[],h(p.subHeaders).forEach(j=>{let{colSpan:y,rowSpan:_}=j;m+=y,x.push(_)})):m=1;const R=Math.min(...x);return v=v+R,p.colSpan=m,p.rowSpan=v,{colSpan:m,rowSpan:v}});return h((o=(i=u[0])==null?void 0:i.headers)!=null?o:[]),u}const Dn=(e,s,t,n,o,i,a)=>{let l={id:s,index:n,original:t,depth:o,parentId:a,_valuesCache:{},_uniqueValuesCache:{},getValue:u=>{if(l._valuesCache.hasOwnProperty(u))return l._valuesCache[u];const d=e.getColumn(u);if(d!=null&&d.accessorFn)return l._valuesCache[u]=d.accessorFn(l.original,n),l._valuesCache[u]},getUniqueValues:u=>{if(l._uniqueValuesCache.hasOwnProperty(u))return l._uniqueValuesCache[u];const d=e.getColumn(u);if(d!=null&&d.accessorFn)return d.columnDef.getUniqueValues?(l._uniqueValuesCache[u]=d.columnDef.getUniqueValues(l.original,n),l._uniqueValuesCache[u]):(l._uniqueValuesCache[u]=[l.getValue(u)],l._uniqueValuesCache[u])},renderValue:u=>{var d;return(d=l.getValue(u))!=null?d:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>In(l.subRows,u=>u.subRows),getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let u=[],d=l;for(;;){const g=d.getParentRow();if(!g)break;u.push(g),d=g}return u.reverse()},getAllCells:S(()=>[e.getAllLeafColumns()],u=>u.map(d=>An(e,l,d,d.id)),C(e.options,"debugRows")),_getAllCellsByColumnId:S(()=>[l.getAllCells()],u=>u.reduce((d,g)=>(d[g.column.id]=g,d),{}),C(e.options,"debugRows"))};for(let u=0;u<e._features.length;u++){const d=e._features[u];d==null||d.createRow==null||d.createRow(l,e)}return l},zn={createColumn:(e,s)=>{e._getFacetedRowModel=s.options.getFacetedRowModel&&s.options.getFacetedRowModel(s,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():s.getPreFilteredRowModel(),e._getFacetedUniqueValues=s.options.getFacetedUniqueValues&&s.options.getFacetedUniqueValues(s,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=s.options.getFacetedMinMaxValues&&s.options.getFacetedMinMaxValues(s,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},lt=(e,s,t)=>{var n,o;const i=t==null||(n=t.toString())==null?void 0:n.toLowerCase();return!!(!((o=e.getValue(s))==null||(o=o.toString())==null||(o=o.toLowerCase())==null)&&o.includes(i))};lt.autoRemove=e=>D(e);const ut=(e,s,t)=>{var n;return!!(!((n=e.getValue(s))==null||(n=n.toString())==null)&&n.includes(t))};ut.autoRemove=e=>D(e);const dt=(e,s,t)=>{var n;return((n=e.getValue(s))==null||(n=n.toString())==null?void 0:n.toLowerCase())===(t==null?void 0:t.toLowerCase())};dt.autoRemove=e=>D(e);const ct=(e,s,t)=>{var n;return(n=e.getValue(s))==null?void 0:n.includes(t)};ct.autoRemove=e=>D(e);const gt=(e,s,t)=>!t.some(n=>{var o;return!((o=e.getValue(s))!=null&&o.includes(n))});gt.autoRemove=e=>D(e)||!(e!=null&&e.length);const ft=(e,s,t)=>t.some(n=>{var o;return(o=e.getValue(s))==null?void 0:o.includes(n)});ft.autoRemove=e=>D(e)||!(e!=null&&e.length);const mt=(e,s,t)=>e.getValue(s)===t;mt.autoRemove=e=>D(e);const pt=(e,s,t)=>e.getValue(s)==t;pt.autoRemove=e=>D(e);const we=(e,s,t)=>{let[n,o]=t;const i=e.getValue(s);return i>=n&&i<=o};we.resolveFilterValue=e=>{let[s,t]=e,n=typeof s!="number"?parseFloat(s):s,o=typeof t!="number"?parseFloat(t):t,i=s===null||Number.isNaN(n)?-1/0:n,a=t===null||Number.isNaN(o)?1/0:o;if(i>a){const l=i;i=a,a=l}return[i,a]};we.autoRemove=e=>D(e)||D(e[0])&&D(e[1]);const z={includesString:lt,includesStringSensitive:ut,equalsString:dt,arrIncludes:ct,arrIncludesAll:gt,arrIncludesSome:ft,equals:mt,weakEquals:pt,inNumberRange:we};function D(e){return e==null||e===""}const kn={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:P("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,s)=>{e.getAutoFilterFn=()=>{const t=s.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);return typeof n=="string"?z.includesString:typeof n=="number"?z.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?z.equals:Array.isArray(n)?z.arrIncludes:z.weakEquals},e.getFilterFn=()=>{var t,n;return ee(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(n=s.options.filterFns)==null?void 0:n[e.columnDef.filterFn])!=null?t:z[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,n,o;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((n=s.options.enableColumnFilters)!=null?n:!0)&&((o=s.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=s.getState().columnFilters)==null||(t=t.find(n=>n.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,n;return(t=(n=s.getState().columnFilters)==null?void 0:n.findIndex(o=>o.id===e.id))!=null?t:-1},e.setFilterValue=t=>{s.setColumnFilters(n=>{const o=e.getFilterFn(),i=n==null?void 0:n.find(g=>g.id===e.id),a=T(t,i?i.value:void 0);if(ke(o,a,e)){var l;return(l=n==null?void 0:n.filter(g=>g.id!==e.id))!=null?l:[]}const u={id:e.id,value:a};if(i){var d;return(d=n==null?void 0:n.map(g=>g.id===e.id?u:g))!=null?d:[]}return n!=null&&n.length?[...n,u]:[u]})}},createRow:(e,s)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=s=>{const t=e.getAllLeafColumns(),n=o=>{var i;return(i=T(s,o))==null?void 0:i.filter(a=>{const l=t.find(u=>u.id===a.id);if(l){const u=l.getFilterFn();if(ke(u,a.value,l))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(n)},e.resetColumnFilters=s=>{var t,n;e.setColumnFilters(s?[]:(t=(n=e.initialState)==null?void 0:n.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function ke(e,s,t){return(e&&e.autoRemove?e.autoRemove(s,t):!1)||typeof s>"u"||typeof s=="string"&&!s}const Tn=(e,s,t)=>t.reduce((n,o)=>{const i=o.getValue(e);return n+(typeof i=="number"?i:0)},0),bn=(e,s,t)=>{let n;return t.forEach(o=>{const i=o.getValue(e);i!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}),n},Ln=(e,s,t)=>{let n;return t.forEach(o=>{const i=o.getValue(e);i!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}),n},Hn=(e,s,t)=>{let n,o;return t.forEach(i=>{const a=i.getValue(e);a!=null&&(n===void 0?a>=a&&(n=o=a):(n>a&&(n=a),o<a&&(o=a)))}),[n,o]},Gn=(e,s)=>{let t=0,n=0;if(s.forEach(o=>{let i=o.getValue(e);i!=null&&(i=+i)>=i&&(++t,n+=i)}),t)return n/t},On=(e,s)=>{if(!s.length)return;const t=s.map(i=>i.getValue(e));if(!$n(t))return;if(t.length===1)return t[0];const n=Math.floor(t.length/2),o=t.sort((i,a)=>i-a);return t.length%2!==0?o[n]:(o[n-1]+o[n])/2},Bn=(e,s)=>Array.from(new Set(s.map(t=>t.getValue(e))).values()),qn=(e,s)=>new Set(s.map(t=>t.getValue(e))).size,Un=(e,s)=>s.length,se={sum:Tn,min:bn,max:Ln,extent:Hn,mean:Gn,median:On,unique:Bn,uniqueCount:qn,count:Un},Kn={getDefaultColumnDef:()=>({aggregatedCell:e=>{var s,t;return(s=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?s:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:P("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,s)=>{e.toggleGrouping=()=>{s.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(n=>n!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,n;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((n=s.options.enableGrouping)!=null?n:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=s.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=s.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=s.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);if(typeof n=="number")return se.sum;if(Object.prototype.toString.call(n)==="[object Date]")return se.extent},e.getAggregationFn=()=>{var t,n;if(!e)throw new Error;return ee(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(n=s.options.aggregationFns)==null?void 0:n[e.columnDef.aggregationFn])!=null?t:se[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=s=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(s),e.resetGrouping=s=>{var t,n;e.setGrouping(s?[]:(t=(n=e.initialState)==null?void 0:n.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,s)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const n=s.getColumn(t);return n!=null&&n.columnDef.getGroupingValue?(e._groupingValuesCache[t]=n.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,s,t,n)=>{e.getIsGrouped=()=>s.getIsGrouped()&&s.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&s.getIsGrouped(),e.getIsAggregated=()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=t.subRows)!=null&&o.length)}}};function Yn(e,s,t){if(!(s!=null&&s.length)||!t)return e;const n=e.filter(i=>!s.includes(i.id));return t==="remove"?n:[...s.map(i=>e.find(a=>a.id===i)).filter(Boolean),...n]}const Xn={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:P("columnOrder",e)}),createColumn:(e,s)=>{e.getIndex=S(t=>[U(s,t)],t=>t.findIndex(n=>n.id===e.id),C(s.options,"debugColumns")),e.getIsFirstColumn=t=>{var n;return((n=U(s,t)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=t=>{var n;const o=U(s,t);return((n=o[o.length-1])==null?void 0:n.id)===e.id}},createTable:e=>{e.setColumnOrder=s=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(s),e.resetColumnOrder=s=>{var t;e.setColumnOrder(s?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=S(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(s,t,n)=>o=>{let i=[];if(!(s!=null&&s.length))i=o;else{const a=[...s],l=[...o];for(;l.length&&a.length;){const u=a.shift(),d=l.findIndex(g=>g.id===u);d>-1&&i.push(l.splice(d,1)[0])}i=[...i,...l]}return Yn(i,t,n)},C(e.options,"debugTable"))}},oe=()=>({left:[],right:[]}),Qn={getInitialState:e=>({columnPinning:oe(),...e}),getDefaultOptions:e=>({onColumnPinningChange:P("columnPinning",e)}),createColumn:(e,s)=>{e.pin=t=>{const n=e.getLeafColumns().map(o=>o.id).filter(Boolean);s.setColumnPinning(o=>{var i,a;if(t==="right"){var l,u;return{left:((l=o==null?void 0:o.left)!=null?l:[]).filter(h=>!(n!=null&&n.includes(h))),right:[...((u=o==null?void 0:o.right)!=null?u:[]).filter(h=>!(n!=null&&n.includes(h))),...n]}}if(t==="left"){var d,g;return{left:[...((d=o==null?void 0:o.left)!=null?d:[]).filter(h=>!(n!=null&&n.includes(h))),...n],right:((g=o==null?void 0:o.right)!=null?g:[]).filter(h=>!(n!=null&&n.includes(h)))}}return{left:((i=o==null?void 0:o.left)!=null?i:[]).filter(h=>!(n!=null&&n.includes(h))),right:((a=o==null?void 0:o.right)!=null?a:[]).filter(h=>!(n!=null&&n.includes(h)))}})},e.getCanPin=()=>e.getLeafColumns().some(n=>{var o,i,a;return((o=n.columnDef.enablePinning)!=null?o:!0)&&((i=(a=s.options.enableColumnPinning)!=null?a:s.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(l=>l.id),{left:n,right:o}=s.getState().columnPinning,i=t.some(l=>n==null?void 0:n.includes(l)),a=t.some(l=>o==null?void 0:o.includes(l));return i?"left":a?"right":!1},e.getPinnedIndex=()=>{var t,n;const o=e.getIsPinned();return o?(t=(n=s.getState().columnPinning)==null||(n=n[o])==null?void 0:n.indexOf(e.id))!=null?t:-1:0}},createRow:(e,s)=>{e.getCenterVisibleCells=S(()=>[e._getAllVisibleCells(),s.getState().columnPinning.left,s.getState().columnPinning.right],(t,n,o)=>{const i=[...n??[],...o??[]];return t.filter(a=>!i.includes(a.column.id))},C(s.options,"debugRows")),e.getLeftVisibleCells=S(()=>[e._getAllVisibleCells(),s.getState().columnPinning.left],(t,n)=>(n??[]).map(i=>t.find(a=>a.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),C(s.options,"debugRows")),e.getRightVisibleCells=S(()=>[e._getAllVisibleCells(),s.getState().columnPinning.right],(t,n)=>(n??[]).map(i=>t.find(a=>a.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),C(s.options,"debugRows"))},createTable:e=>{e.setColumnPinning=s=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(s),e.resetColumnPinning=s=>{var t,n;return e.setColumnPinning(s?oe():(t=(n=e.initialState)==null?void 0:n.columnPinning)!=null?t:oe())},e.getIsSomeColumnsPinned=s=>{var t;const n=e.getState().columnPinning;if(!s){var o,i;return!!((o=n.left)!=null&&o.length||(i=n.right)!=null&&i.length)}return!!((t=n[s])!=null&&t.length)},e.getLeftLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(s,t)=>(t??[]).map(n=>s.find(o=>o.id===n)).filter(Boolean),C(e.options,"debugColumns")),e.getRightLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(s,t)=>(t??[]).map(n=>s.find(o=>o.id===n)).filter(Boolean),C(e.options,"debugColumns")),e.getCenterLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(s,t,n)=>{const o=[...t??[],...n??[]];return s.filter(i=>!o.includes(i.id))},C(e.options,"debugColumns"))}};function Wn(e){return e||(typeof document<"u"?document:null)}const W={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},ie=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Zn={getDefaultColumnDef:()=>W,getInitialState:e=>({columnSizing:{},columnSizingInfo:ie(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:P("columnSizing",e),onColumnSizingInfoChange:P("columnSizingInfo",e)}),createColumn:(e,s)=>{e.getSize=()=>{var t,n,o;const i=s.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:W.minSize,(n=i??e.columnDef.size)!=null?n:W.size),(o=e.columnDef.maxSize)!=null?o:W.maxSize)},e.getStart=S(t=>[t,U(s,t),s.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((o,i)=>o+i.getSize(),0),C(s.options,"debugColumns")),e.getAfter=S(t=>[t,U(s,t),s.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((o,i)=>o+i.getSize(),0),C(s.options,"debugColumns")),e.resetSize=()=>{s.setColumnSizing(t=>{let{[e.id]:n,...o}=t;return o})},e.getCanResize=()=>{var t,n;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((n=s.options.enableColumnResizing)!=null?n:!0)},e.getIsResizing=()=>s.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,s)=>{e.getSize=()=>{let t=0;const n=o=>{if(o.subHeaders.length)o.subHeaders.forEach(n);else{var i;t+=(i=o.column.getSize())!=null?i:0}};return n(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const n=s.getColumn(e.column.id),o=n==null?void 0:n.getCanResize();return i=>{if(!n||!o||(i.persist==null||i.persist(),re(i)&&i.touches&&i.touches.length>1))return;const a=e.getSize(),l=e?e.getLeafHeaders().map(x=>[x.column.id,x.column.getSize()]):[[n.id,n.getSize()]],u=re(i)?Math.round(i.touches[0].clientX):i.clientX,d={},g=(x,R)=>{typeof R=="number"&&(s.setColumnSizingInfo(j=>{var y,_;const A=s.options.columnResizeDirection==="rtl"?-1:1,O=(R-((y=j==null?void 0:j.startOffset)!=null?y:0))*A,N=Math.max(O/((_=j==null?void 0:j.startSize)!=null?_:0),-.999999);return j.columnSizingStart.forEach(F=>{let[L,je]=F;d[L]=Math.round(Math.max(je+je*N,0)*100)/100}),{...j,deltaOffset:O,deltaPercentage:N}}),(s.options.columnResizeMode==="onChange"||x==="end")&&s.setColumnSizing(j=>({...j,...d})))},h=x=>g("move",x),f=x=>{g("end",x),s.setColumnSizingInfo(R=>({...R,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},c=Wn(t),p={moveHandler:x=>h(x.clientX),upHandler:x=>{c==null||c.removeEventListener("mousemove",p.moveHandler),c==null||c.removeEventListener("mouseup",p.upHandler),f(x.clientX)}},m={moveHandler:x=>(x.cancelable&&(x.preventDefault(),x.stopPropagation()),h(x.touches[0].clientX),!1),upHandler:x=>{var R;c==null||c.removeEventListener("touchmove",m.moveHandler),c==null||c.removeEventListener("touchend",m.upHandler),x.cancelable&&(x.preventDefault(),x.stopPropagation()),f((R=x.touches[0])==null?void 0:R.clientX)}},v=Jn()?{passive:!1}:!1;re(i)?(c==null||c.addEventListener("touchmove",m.moveHandler,v),c==null||c.addEventListener("touchend",m.upHandler,v)):(c==null||c.addEventListener("mousemove",p.moveHandler,v),c==null||c.addEventListener("mouseup",p.upHandler,v)),s.setColumnSizingInfo(x=>({...x,startOffset:u,startSize:a,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:n.id}))}}},createTable:e=>{e.setColumnSizing=s=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(s),e.setColumnSizingInfo=s=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(s),e.resetColumnSizing=s=>{var t;e.setColumnSizing(s?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=s=>{var t;e.setColumnSizingInfo(s?ie():(t=e.initialState.columnSizingInfo)!=null?t:ie())},e.getTotalSize=()=>{var s,t;return(s=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((n,o)=>n+o.getSize(),0))!=null?s:0},e.getLeftTotalSize=()=>{var s,t;return(s=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((n,o)=>n+o.getSize(),0))!=null?s:0},e.getCenterTotalSize=()=>{var s,t;return(s=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((n,o)=>n+o.getSize(),0))!=null?s:0},e.getRightTotalSize=()=>{var s,t;return(s=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((n,o)=>n+o.getSize(),0))!=null?s:0}}};let Z=null;function Jn(){if(typeof Z=="boolean")return Z;let e=!1;try{const s={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,s),window.removeEventListener("test",t)}catch{e=!1}return Z=e,Z}function re(e){return e.type==="touchstart"}const es={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:P("columnVisibility",e)}),createColumn:(e,s)=>{e.toggleVisibility=t=>{e.getCanHide()&&s.setColumnVisibility(n=>({...n,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,n;const o=e.columns;return(t=o.length?o.some(i=>i.getIsVisible()):(n=s.getState().columnVisibility)==null?void 0:n[e.id])!=null?t:!0},e.getCanHide=()=>{var t,n;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((n=s.options.enableHiding)!=null?n:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,s)=>{e._getAllVisibleCells=S(()=>[e.getAllCells(),s.getState().columnVisibility],t=>t.filter(n=>n.column.getIsVisible()),C(s.options,"debugRows")),e.getVisibleCells=S(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,n,o)=>[...t,...n,...o],C(s.options,"debugRows"))},createTable:e=>{const s=(t,n)=>S(()=>[n(),n().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),C(e.options,"debugColumns"));e.getVisibleFlatColumns=s("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=s("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=s("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=s("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=s("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:(n=e.initialState.columnVisibility)!=null?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=(n=t)!=null?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,i)=>({...o,[i.id]:t||!(i.getCanHide!=null&&i.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible((n=t.target)==null?void 0:n.checked)}}};function U(e,s){return s?s==="center"?e.getCenterVisibleLeafColumns():s==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const ts={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},ns={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:P("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:s=>{var t;const n=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[s.id])==null?void 0:t.getValue();return typeof n=="string"||typeof n=="number"}}),createColumn:(e,s)=>{e.getCanGlobalFilter=()=>{var t,n,o,i;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((n=s.options.enableGlobalFilter)!=null?n:!0)&&((o=s.options.enableFilters)!=null?o:!0)&&((i=s.options.getColumnCanGlobalFilter==null?void 0:s.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>z.includesString,e.getGlobalFilterFn=()=>{var s,t;const{globalFilterFn:n}=e.options;return ee(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(s=(t=e.options.filterFns)==null?void 0:t[n])!=null?s:z[n]},e.setGlobalFilter=s=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(s)},e.resetGlobalFilter=s=>{e.setGlobalFilter(s?void 0:e.initialState.globalFilter)}}},ss={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:P("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let s=!1,t=!1;e._autoResetExpanded=()=>{var n,o;if(!s){e._queue(()=>{s=!0});return}if((n=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?n:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=n=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(n),e.toggleAllRowsExpanded=n=>{n??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=n=>{var o,i;e.setExpanded(n?{}:(o=(i=e.initialState)==null?void 0:i.expanded)!=null?o:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(n=>n.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>n=>{n.persist==null||n.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const n=e.getState().expanded;return n===!0||Object.values(n).some(Boolean)},e.getIsAllRowsExpanded=()=>{const n=e.getState().expanded;return typeof n=="boolean"?n===!0:!(!Object.keys(n).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},e.getExpandedDepth=()=>{let n=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{const a=i.split(".");n=Math.max(n,a.length)}),n},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,s)=>{e.toggleExpanded=t=>{s.setExpanded(n=>{var o;const i=n===!0?!0:!!(n!=null&&n[e.id]);let a={};if(n===!0?Object.keys(s.getRowModel().rowsById).forEach(l=>{a[l]=!0}):a=n,t=(o=t)!=null?o:!i,!i&&t)return{...a,[e.id]:!0};if(i&&!t){const{[e.id]:l,...u}=a;return u}return n})},e.getIsExpanded=()=>{var t;const n=s.getState().expanded;return!!((t=s.options.getIsRowExpanded==null?void 0:s.options.getIsRowExpanded(e))!=null?t:n===!0||n!=null&&n[e.id])},e.getCanExpand=()=>{var t,n,o;return(t=s.options.getRowCanExpand==null?void 0:s.options.getRowCanExpand(e))!=null?t:((n=s.options.enableExpanding)!=null?n:!0)&&!!((o=e.subRows)!=null&&o.length)},e.getIsAllParentsExpanded=()=>{let t=!0,n=e;for(;t&&n.parentId;)n=s.getRow(n.parentId,!0),t=n.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},fe=0,me=10,ae=()=>({pageIndex:fe,pageSize:me}),os={getInitialState:e=>({...e,pagination:{...ae(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:P("pagination",e)}),createTable:e=>{let s=!1,t=!1;e._autoResetPageIndex=()=>{var n,o;if(!s){e._queue(()=>{s=!0});return}if((n=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?n:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=n=>{const o=i=>T(n,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},e.resetPagination=n=>{var o;e.setPagination(n?ae():(o=e.initialState.pagination)!=null?o:ae())},e.setPageIndex=n=>{e.setPagination(o=>{let i=T(n,o.pageIndex);const a=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,a)),{...o,pageIndex:i}})},e.resetPageIndex=n=>{var o,i;e.setPageIndex(n?fe:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?o:fe)},e.resetPageSize=n=>{var o,i;e.setPageSize(n?me:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?o:me)},e.setPageSize=n=>{e.setPagination(o=>{const i=Math.max(1,T(n,o.pageSize)),a=o.pageSize*o.pageIndex,l=Math.floor(a/i);return{...o,pageIndex:l,pageSize:i}})},e.setPageCount=n=>e.setPagination(o=>{var i;let a=T(n,(i=e.options.pageCount)!=null?i:-1);return typeof a=="number"&&(a=Math.max(-1,a)),{...o,pageCount:a}}),e.getPageOptions=S(()=>[e.getPageCount()],n=>{let o=[];return n&&n>0&&(o=[...new Array(n)].fill(null).map((i,a)=>a)),o},C(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:n}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:n<o-1},e.previousPage=()=>e.setPageIndex(n=>n-1),e.nextPage=()=>e.setPageIndex(n=>n+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var n;return(n=e.options.pageCount)!=null?n:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var n;return(n=e.options.rowCount)!=null?n:e.getPrePaginationRowModel().rows.length}}},le=()=>({top:[],bottom:[]}),is={getInitialState:e=>({rowPinning:le(),...e}),getDefaultOptions:e=>({onRowPinningChange:P("rowPinning",e)}),createRow:(e,s)=>{e.pin=(t,n,o)=>{const i=n?e.getLeafRows().map(u=>{let{id:d}=u;return d}):[],a=o?e.getParentRows().map(u=>{let{id:d}=u;return d}):[],l=new Set([...a,e.id,...i]);s.setRowPinning(u=>{var d,g;if(t==="bottom"){var h,f;return{top:((h=u==null?void 0:u.top)!=null?h:[]).filter(m=>!(l!=null&&l.has(m))),bottom:[...((f=u==null?void 0:u.bottom)!=null?f:[]).filter(m=>!(l!=null&&l.has(m))),...Array.from(l)]}}if(t==="top"){var c,p;return{top:[...((c=u==null?void 0:u.top)!=null?c:[]).filter(m=>!(l!=null&&l.has(m))),...Array.from(l)],bottom:((p=u==null?void 0:u.bottom)!=null?p:[]).filter(m=>!(l!=null&&l.has(m)))}}return{top:((d=u==null?void 0:u.top)!=null?d:[]).filter(m=>!(l!=null&&l.has(m))),bottom:((g=u==null?void 0:u.bottom)!=null?g:[]).filter(m=>!(l!=null&&l.has(m)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:n,enablePinning:o}=s.options;return typeof n=="function"?n(e):(t=n??o)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:n,bottom:o}=s.getState().rowPinning,i=t.some(l=>n==null?void 0:n.includes(l)),a=t.some(l=>o==null?void 0:o.includes(l));return i?"top":a?"bottom":!1},e.getPinnedIndex=()=>{var t,n;const o=e.getIsPinned();if(!o)return-1;const i=(t=o==="top"?s.getTopRows():s.getBottomRows())==null?void 0:t.map(a=>{let{id:l}=a;return l});return(n=i==null?void 0:i.indexOf(e.id))!=null?n:-1}},createTable:e=>{e.setRowPinning=s=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(s),e.resetRowPinning=s=>{var t,n;return e.setRowPinning(s?le():(t=(n=e.initialState)==null?void 0:n.rowPinning)!=null?t:le())},e.getIsSomeRowsPinned=s=>{var t;const n=e.getState().rowPinning;if(!s){var o,i;return!!((o=n.top)!=null&&o.length||(i=n.bottom)!=null&&i.length)}return!!((t=n[s])!=null&&t.length)},e._getPinnedRows=(s,t,n)=>{var o;return((o=e.options.keepPinnedRows)==null||o?(t??[]).map(a=>{const l=e.getRow(a,!0);return l.getIsAllParentsExpanded()?l:null}):(t??[]).map(a=>s.find(l=>l.id===a))).filter(Boolean).map(a=>({...a,position:n}))},e.getTopRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(s,t)=>e._getPinnedRows(s,t,"top"),C(e.options,"debugRows")),e.getBottomRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(s,t)=>e._getPinnedRows(s,t,"bottom"),C(e.options,"debugRows")),e.getCenterRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(s,t,n)=>{const o=new Set([...t??[],...n??[]]);return s.filter(i=>!o.has(i.id))},C(e.options,"debugRows"))}},rs={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:P("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=s=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(s),e.resetRowSelection=s=>{var t;return e.setRowSelection(s?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=s=>{e.setRowSelection(t=>{s=typeof s<"u"?s:!e.getIsAllRowsSelected();const n={...t},o=e.getPreGroupedRowModel().flatRows;return s?o.forEach(i=>{i.getCanSelect()&&(n[i.id]=!0)}):o.forEach(i=>{delete n[i.id]}),n})},e.toggleAllPageRowsSelected=s=>e.setRowSelection(t=>{const n=typeof s<"u"?s:!e.getIsAllPageRowsSelected(),o={...t};return e.getRowModel().rows.forEach(i=>{pe(o,i.id,n,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=S(()=>[e.getState().rowSelection,e.getCoreRowModel()],(s,t)=>Object.keys(s).length?ue(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable")),e.getFilteredSelectedRowModel=S(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(s,t)=>Object.keys(s).length?ue(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable")),e.getGroupedSelectedRowModel=S(()=>[e.getState().rowSelection,e.getSortedRowModel()],(s,t)=>Object.keys(s).length?ue(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const s=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let n=!!(s.length&&Object.keys(t).length);return n&&s.some(o=>o.getCanSelect()&&!t[o.id])&&(n=!1),n},e.getIsAllPageRowsSelected=()=>{const s=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:t}=e.getState();let n=!!s.length;return n&&s.some(o=>!t[o.id])&&(n=!1),n},e.getIsSomeRowsSelected=()=>{var s;const t=Object.keys((s=e.getState().rowSelection)!=null?s:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const s=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:s.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>s=>{e.toggleAllRowsSelected(s.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>s=>{e.toggleAllPageRowsSelected(s.target.checked)}},createRow:(e,s)=>{e.toggleSelected=(t,n)=>{const o=e.getIsSelected();s.setRowSelection(i=>{var a;if(t=typeof t<"u"?t:!o,e.getCanSelect()&&o===t)return i;const l={...i};return pe(l,e.id,t,(a=n==null?void 0:n.selectChildren)!=null?a:!0,s),l})},e.getIsSelected=()=>{const{rowSelection:t}=s.getState();return Re(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=s.getState();return he(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=s.getState();return he(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof s.options.enableRowSelection=="function"?s.options.enableRowSelection(e):(t=s.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof s.options.enableSubRowSelection=="function"?s.options.enableSubRowSelection(e):(t=s.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof s.options.enableMultiRowSelection=="function"?s.options.enableMultiRowSelection(e):(t=s.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var o;t&&e.toggleSelected((o=n.target)==null?void 0:o.checked)}}}},pe=(e,s,t,n,o)=>{var i;const a=o.getRow(s,!0);t?(a.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),a.getCanSelect()&&(e[s]=!0)):delete e[s],n&&(i=a.subRows)!=null&&i.length&&a.getCanSelectSubRows()&&a.subRows.forEach(l=>pe(e,l.id,t,n,o))};function ue(e,s){const t=e.getState().rowSelection,n=[],o={},i=function(a,l){return a.map(u=>{var d;const g=Re(u,t);if(g&&(n.push(u),o[u.id]=u),(d=u.subRows)!=null&&d.length&&(u={...u,subRows:i(u.subRows)}),g)return u}).filter(Boolean)};return{rows:i(s.rows),flatRows:n,rowsById:o}}function Re(e,s){var t;return(t=s[e.id])!=null?t:!1}function he(e,s,t){var n;if(!((n=e.subRows)!=null&&n.length))return!1;let o=!0,i=!1;return e.subRows.forEach(a=>{if(!(i&&!o)&&(a.getCanSelect()&&(Re(a,s)?i=!0:o=!1),a.subRows&&a.subRows.length)){const l=he(a,s);l==="all"?i=!0:(l==="some"&&(i=!0),o=!1)}}),o?"all":i?"some":!1}const xe=/([0-9]+)/gm,as=(e,s,t)=>ht(b(e.getValue(t)).toLowerCase(),b(s.getValue(t)).toLowerCase()),ls=(e,s,t)=>ht(b(e.getValue(t)),b(s.getValue(t))),us=(e,s,t)=>ye(b(e.getValue(t)).toLowerCase(),b(s.getValue(t)).toLowerCase()),ds=(e,s,t)=>ye(b(e.getValue(t)),b(s.getValue(t))),cs=(e,s,t)=>{const n=e.getValue(t),o=s.getValue(t);return n>o?1:n<o?-1:0},gs=(e,s,t)=>ye(e.getValue(t),s.getValue(t));function ye(e,s){return e===s?0:e>s?1:-1}function b(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function ht(e,s){const t=e.split(xe).filter(Boolean),n=s.split(xe).filter(Boolean);for(;t.length&&n.length;){const o=t.shift(),i=n.shift(),a=parseInt(o,10),l=parseInt(i,10),u=[a,l].sort();if(isNaN(u[0])){if(o>i)return 1;if(i>o)return-1;continue}if(isNaN(u[1]))return isNaN(a)?-1:1;if(a>l)return 1;if(l>a)return-1}return t.length-n.length}const B={alphanumeric:as,alphanumericCaseSensitive:ls,text:us,textCaseSensitive:ds,datetime:cs,basic:gs},fs={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:P("sorting",e),isMultiSortEvent:s=>s.shiftKey}),createColumn:(e,s)=>{e.getAutoSortingFn=()=>{const t=s.getFilteredRowModel().flatRows.slice(10);let n=!1;for(const o of t){const i=o==null?void 0:o.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return B.datetime;if(typeof i=="string"&&(n=!0,i.split(xe).length>1))return B.alphanumeric}return n?B.text:B.basic},e.getAutoSortDir=()=>{const t=s.getFilteredRowModel().flatRows[0];return typeof(t==null?void 0:t.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,n;if(!e)throw new Error;return ee(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(n=s.options.sortingFns)==null?void 0:n[e.columnDef.sortingFn])!=null?t:B[e.columnDef.sortingFn]},e.toggleSorting=(t,n)=>{const o=e.getNextSortingOrder(),i=typeof t<"u"&&t!==null;s.setSorting(a=>{const l=a==null?void 0:a.find(c=>c.id===e.id),u=a==null?void 0:a.findIndex(c=>c.id===e.id);let d=[],g,h=i?t:o==="desc";if(a!=null&&a.length&&e.getCanMultiSort()&&n?l?g="toggle":g="add":a!=null&&a.length&&u!==a.length-1?g="replace":l?g="toggle":g="replace",g==="toggle"&&(i||o||(g="remove")),g==="add"){var f;d=[...a,{id:e.id,desc:h}],d.splice(0,d.length-((f=s.options.maxMultiSortColCount)!=null?f:Number.MAX_SAFE_INTEGER))}else g==="toggle"?d=a.map(c=>c.id===e.id?{...c,desc:h}:c):g==="remove"?d=a.filter(c=>c.id!==e.id):d=[{id:e.id,desc:h}];return d})},e.getFirstSortDir=()=>{var t,n;return((t=(n=e.columnDef.sortDescFirst)!=null?n:s.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var n,o;const i=e.getFirstSortDir(),a=e.getIsSorted();return a?a!==i&&((n=s.options.enableSortingRemoval)==null||n)&&(!(t&&(o=s.options.enableMultiRemove)!=null)||o)?!1:a==="desc"?"asc":"desc":i},e.getCanSort=()=>{var t,n;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((n=s.options.enableSorting)!=null?n:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,n;return(t=(n=e.columnDef.enableMultiSort)!=null?n:s.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const n=(t=s.getState().sorting)==null?void 0:t.find(o=>o.id===e.id);return n?n.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,n;return(t=(n=s.getState().sorting)==null?void 0:n.findIndex(o=>o.id===e.id))!=null?t:-1},e.clearSorting=()=>{s.setSorting(t=>t!=null&&t.length?t.filter(n=>n.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return n=>{t&&(n.persist==null||n.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?s.options.isMultiSortEvent==null?void 0:s.options.isMultiSortEvent(n):!1))}}},createTable:e=>{e.setSorting=s=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(s),e.resetSorting=s=>{var t,n;e.setSorting(s?[]:(t=(n=e.initialState)==null?void 0:n.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},ms=[En,es,Xn,Qn,zn,kn,ts,ns,fs,Kn,ss,os,is,rs,Zn];function ps(e){var s,t;const n=[...ms,...(s=e._features)!=null?s:[]];let o={_features:n};const i=o._features.reduce((f,c)=>Object.assign(f,c.getDefaultOptions==null?void 0:c.getDefaultOptions(o)),{}),a=f=>o.options.mergeOptions?o.options.mergeOptions(i,f):{...i,...f};let u={...{},...(t=e.initialState)!=null?t:{}};o._features.forEach(f=>{var c;u=(c=f.getInitialState==null?void 0:f.getInitialState(u))!=null?c:u});const d=[];let g=!1;const h={_features:n,options:{...i,...e},initialState:u,_queue:f=>{d.push(f),g||(g=!0,Promise.resolve().then(()=>{for(;d.length;)d.shift()();g=!1}).catch(c=>setTimeout(()=>{throw c})))},reset:()=>{o.setState(o.initialState)},setOptions:f=>{const c=T(f,o.options);o.options=a(c)},getState:()=>o.options.state,setState:f=>{o.options.onStateChange==null||o.options.onStateChange(f)},_getRowId:(f,c,p)=>{var m;return(m=o.options.getRowId==null?void 0:o.options.getRowId(f,c,p))!=null?m:`${p?[p.id,c].join("."):c}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(f,c)=>{let p=(c?o.getPrePaginationRowModel():o.getRowModel()).rowsById[f];if(!p&&(p=o.getCoreRowModel().rowsById[f],!p))throw new Error;return p},_getDefaultColumnDef:S(()=>[o.options.defaultColumn],f=>{var c;return f=(c=f)!=null?c:{},{header:p=>{const m=p.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:p=>{var m,v;return(m=(v=p.renderValue())==null||v.toString==null?void 0:v.toString())!=null?m:null},...o._features.reduce((p,m)=>Object.assign(p,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...f}},C(e,"debugColumns")),_getColumnDefs:()=>o.options.columns,getAllColumns:S(()=>[o._getColumnDefs()],f=>{const c=function(p,m,v){return v===void 0&&(v=0),p.map(x=>{const R=Vn(o,x,v,m),j=x;return R.columns=j.columns?c(j.columns,R,v+1):[],R})};return c(f)},C(e,"debugColumns")),getAllFlatColumns:S(()=>[o.getAllColumns()],f=>f.flatMap(c=>c.getFlatColumns()),C(e,"debugColumns")),_getAllFlatColumnsById:S(()=>[o.getAllFlatColumns()],f=>f.reduce((c,p)=>(c[p.id]=p,c),{}),C(e,"debugColumns")),getAllLeafColumns:S(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(f,c)=>{let p=f.flatMap(m=>m.getLeafColumns());return c(p)},C(e,"debugColumns")),getColumn:f=>o._getAllFlatColumnsById()[f]};Object.assign(o,h);for(let f=0;f<o._features.length;f++){const c=o._features[f];c==null||c.createTable==null||c.createTable(o)}return o}function hs(){return e=>S(()=>[e.options.data],s=>{const t={rows:[],flatRows:[],rowsById:{}},n=function(o,i,a){i===void 0&&(i=0);const l=[];for(let d=0;d<o.length;d++){const g=Dn(e,e._getRowId(o[d],d,a),o[d],d,i,void 0,a==null?void 0:a.id);if(t.flatRows.push(g),t.rowsById[g.id]=g,l.push(g),e.options.getSubRows){var u;g.originalSubRows=e.options.getSubRows(o[d],d),(u=g.originalSubRows)!=null&&u.length&&(g.subRows=n(g.originalSubRows,i+1,g))}}return l};return t.rows=n(s),t},C(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}/**
20
- * react-table
21
- *
22
- * Copyright (c) TanStack
23
- *
24
- * This source code is licensed under the MIT license found in the
25
- * LICENSE.md file in the root directory of this source tree.
26
- *
27
- * @license MIT
28
- */function Te(e,s){return e?xs(e)?w.createElement(e,s):e:null}function xs(e){return vs(e)||typeof e=="function"||Ss(e)}function vs(e){return typeof e=="function"&&(()=>{const s=Object.getPrototypeOf(e);return s.prototype&&s.prototype.isReactComponent})()}function Ss(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Cs(e){const s={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=w.useState(()=>({current:ps(s)})),[n,o]=w.useState(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...e,state:{...n,...e.state},onStateChange:a=>{o(a),e.onStateChange==null||e.onStateChange(a)}})),t.current}function ws(e){if("id"in e&&e.id)return e.id;if("accessorKey"in e&&typeof e.accessorKey=="string")return e.accessorKey}function Rs({columns:e,data:s,emptyMessage:t="No results.",tableOptions:n,groupBy:o,className:i,tableClassName:a}){var p;const l=Ue(),u=w.useMemo(()=>{var v;if(!l)return{};const m={};for(const x of e){const R=ws(x);R&&((v=x.meta)!=null&&v.hideOnMobile)&&(m[R]=!1)}return m},[e,l]),d=w.useMemo(()=>{var m;return{...u,...((m=n==null?void 0:n.state)==null?void 0:m.columnVisibility)??{}}},[u,(p=n==null?void 0:n.state)==null?void 0:p.columnVisibility]),g=Cs({data:s,columns:e,getCoreRowModel:hs(),...n,state:{...n==null?void 0:n.state,columnVisibility:d}}),h=g.getRowModel().rows,f=g.getVisibleLeafColumns().length,c=w.useMemo(()=>{if(!o)return new Map;const m=new Map;for(const v of h){const x=o.key(v.original);m.set(x,(m.get(x)??0)+1)}return m},[o,h]);return r.jsx("div",{"data-slot":"data-table",className:k("rounded-md border",i),children:r.jsxs(yn,{className:a,children:[r.jsx(jn,{children:g.getHeaderGroups().map(m=>r.jsx(X,{children:m.headers.map(v=>{var x;return r.jsx(Ee,{className:(x=v.column.columnDef.meta)==null?void 0:x.headClassName,children:v.isPlaceholder?null:Te(v.column.columnDef.header,v.getContext())},v.id)})},m.id))}),r.jsx(_n,{children:h.length?h.map((m,v)=>{const x=o==null?void 0:o.key(m.original),R=v>0?o==null?void 0:o.key(h[v-1].original):void 0,j=x!==void 0&&x!==R;return r.jsxs(w.Fragment,{children:[j&&r.jsx(X,{"data-slot":"data-table-group-header",className:"bg-muted/40 hover:bg-muted/40",children:r.jsx(Ee,{colSpan:f,className:"h-8",children:o==null?void 0:o.header(x,c.get(x)??0)})}),r.jsx(X,{"data-state":m.getIsSelected()?"selected":void 0,children:m.getVisibleCells().map(y=>{var _;return r.jsx(De,{className:(_=y.column.columnDef.meta)==null?void 0:_.cellClassName,children:Te(y.column.columnDef.cell,y.getContext())},y.id)})})]},m.id)}):r.jsx(X,{children:r.jsx(De,{colSpan:f,className:"h-24 text-center",children:t})})})]})})}function ys({onClearFilters:e,filterDescription:s}){return r.jsxs($.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},className:"flex flex-col items-center justify-center gap-3 py-12 text-center",children:[r.jsx(xn,{className:"text-muted-foreground/50 size-10"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:s?`No agents match ${s}`:"No agents match your filters"}),r.jsx(E,{variant:"outline",size:"sm",onClick:e,children:"Clear filters"})]})}function js({peopleOnly:e}){return r.jsxs($.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},className:"flex flex-col items-center justify-center gap-2 py-12 text-center","data-slot":"agent-roster-filter-empty",children:[r.jsx(yt,{className:"text-muted-foreground/50 size-10"}),r.jsx("p",{className:"text-muted-foreground max-w-xs text-sm",children:e?"This table lists agents. Switch to Cards to see people.":"No agents match this filter. Change it in Cards."})]})}const be=["needs-you","working","quiet"],_s=1440*60*1e3;function Ns(e,s=Date.now()){const t=Date.parse(e);return Number.isNaN(t)?!0:s-t>=_s}const Fs=30,Ms=25,Ps=20,$s=20,Is=10,As=0;function ve(e){const{healthStatus:s,taskCount:t,chatState:n}=e;return s==="unreachable"?{group:"needs-you",severity:Fs}:n==="needs-attention"?{group:"needs-you",severity:Ms}:s==="stale"&&t>0&&e.isPastOnboardingGrace?{group:"needs-you",severity:Ps}:n==="active"?{group:"working",severity:$s}:s==="active"?{group:"working",severity:Is}:{group:"quiet",severity:As}}function Le(e){if(!e)return Number.NEGATIVE_INFINITY;const s=Date.parse(e);return Number.isNaN(s)?Number.NEGATIVE_INFINITY:s}function Vs(e,s){const t=ve(e),n=ve(s),o=be.indexOf(t.group)-be.indexOf(n.group);if(o!==0)return o;const i=n.severity-t.severity;if(i!==0)return i;const a=Le(s.lastSeenAt)-Le(e.lastSeenAt);return a!==0?a:G(e).localeCompare(G(s))}function Es(e,s="asc"){const t=s==="desc"?-1:1;return[...e].sort((n,o)=>t*Vs(n,o))}const Ds={"needs-you":{label:"Needs you",toneClass:"text-destructive"},working:{label:"Working",toneClass:"text-foreground"},quiet:{label:"Quiet",toneClass:"text-muted-foreground"}};function zs(e,s,t){if(!t)return e;if(t.kind==="people")return[];if(!(t.owner!==void 0||(t.q??"").trim()!==""))return e;const o=s.filter(a=>a.kind==="agent");if(o.length===0)return e;const i=new Set(Ke(o,t).map(a=>a.id));return e.filter(a=>i.has(a.id))}const He=32,ks=5,xt="Checked in",Ts={heartbeat:"Checked in",message_sent:"Got a message",response_complete:"Finished a reply"};function bs(e,s){return s===null&&e==="stale"}function Ge(e){return e.length<2||e.length>ks?!1:e===e.toUpperCase()&&new RegExp("\\p{Lu}","u").test(e)}function Ls(e){const s=Ts[e.trim().toLowerCase()];if(s)return s;const t=e.replace(/[^\p{L}\p{N}]+/gu," ").trim().split(" ").filter(Boolean).map(a=>Ge(a)?a:a.toLowerCase());if(t.length===0)return xt;const n=t[0];t[0]=Ge(n)?n:n.replace(/^./u,a=>a.toUpperCase());const o=t.join(" "),i=Array.from(o);return i.length<=He?o:`${i.slice(0,He-1).join("").trimEnd()}…`}function Oe(e){const s=e.filter(t=>!!t);return s.length>0?s.join(" · "):null}function Hs(e){const{healthStatus:s,lastSeenAt:t,lastSeenEvent:n,chatState:o}=e,i=t?ce(t):null,a=n?Ls(n):null;return s==="unreachable"?{primary:"Can’t be reached",secondary:Oe([a,i??"never seen"]),toneClass:"text-destructive"}:o==="needs-attention"?{primary:"A chat needs you",secondary:Oe([a,i]),toneClass:"text-destructive"}:bs(s,t)?o==="active"?{primary:"Active in a chat",secondary:null,toneClass:"text-foreground"}:{primary:"Not used yet",secondary:null,toneClass:"text-muted-foreground"}:{primary:a??xt,secondary:i,toneClass:s==="active"?"text-foreground":"text-muted-foreground"}}function Gs(e){if(!e)return null;const s=e.split("/").filter(Boolean);return s.length<=2?e:s.slice(-2).join("/")}function Os({row:e,onOpen:s}){const{color:t,emoji:n}=Nt(e),o=Gs(e.projectPath),i=Ye(e.runtime).label;return r.jsxs("button",{type:"button",className:"flex w-full min-w-0 items-center gap-2 text-left",onClick:s,children:[r.jsx(Ft,{color:t,emoji:n,size:"xs"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm font-medium hover:underline",children:G(e)}),r.jsxs("span",{className:"text-muted-foreground block truncate text-xs",children:[o??i,o&&r.jsxs("span",{className:"hidden md:inline",children:[" · ",i]})]})]}),e.isDefault&&r.jsxs(I,{size:"xs",variant:"outline",className:"shrink-0 max-md:border-0 max-md:px-0 max-md:py-0",children:[r.jsx(Mt,{className:"size-2.5 fill-current md:mr-0.5"}),r.jsx("span",{className:"sr-only md:not-sr-only",children:"Default"})]})]})}function Bs({row:e}){const{primary:s,secondary:t,toneClass:n}=Hs(e);return r.jsxs("span",{className:"block min-w-0",children:[r.jsx("span",{className:k("block truncate text-sm",n),children:s}),t&&r.jsx("span",{className:"text-muted-foreground block truncate text-xs tabular-nums",children:t})]})}function qs(e){return[{accessorKey:"name",header:"Agent",meta:{headClassName:"w-[42%] md:w-[38%]",cellClassName:"overflow-hidden"},cell:({row:s})=>r.jsx(Os,{row:s.original,onOpen:()=>e.onNavigate(s.original.projectPath??"")})},{accessorKey:"lastSeenEvent",header:"Activity",meta:{headClassName:"truncate",cellClassName:"truncate"},cell:({row:s})=>r.jsx(Bs,{row:s.original})},{id:"managedBy",header:"Managed by",meta:{hideOnMobile:!0,headClassName:"w-[140px]",cellClassName:"overflow-hidden"},cell:({row:s})=>{const t=s.original.managedBy;return r.jsx("span",{"data-slot":"agent-managed-by",className:"text-muted-foreground block truncate text-xs",children:t??"—"})}},{accessorKey:"taskCount",header:"Scheduled",meta:{hideOnMobile:!0,headClassName:"w-[110px]"},cell:({row:s})=>{const t=s.original.taskCount;return t===0?r.jsx("span",{className:"text-muted-foreground text-xs",children:"—"}):r.jsxs(I,{variant:"outline",className:"whitespace-nowrap",children:[t," ",t===1?"schedule":"schedules"]})}},{id:"actions",header:"",meta:{headClassName:"w-[88px]"},cell:({row:s})=>{const t=s.original;return r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(E,{variant:"ghost",size:"sm",className:"size-8 p-0",onClick:n=>{n.stopPropagation(),e.onNavigate(t.projectPath??"")},"aria-label":`Open chat with ${G(t)}`,children:r.jsx(jt,{className:"size-4"})}),r.jsx(E,{variant:"ghost",size:"sm",className:"size-8 p-0",onClick:n=>{n.stopPropagation(),e.onViewProfile(t.projectPath??"")},"aria-label":`Open ${G(t)}’s profile`,children:r.jsx(_t,{className:"size-4"})})]})}}]}function Us({group:e,count:s}){const{label:t,toneClass:n}=Ds[e];return r.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold tracking-wide uppercase",children:[e==="needs-you"&&r.jsx(Xe,{className:k("size-3.5",n)}),r.jsx("span",{className:n,children:t}),r.jsx("span",{className:"text-muted-foreground font-normal tabular-nums",children:s})]})}function Ks({rows:e,grouped:s,callbacks:t}){const n=w.useMemo(()=>qs(t),[t]),o=w.useMemo(()=>s?{key:i=>ve(i).group,header:(i,a)=>r.jsx(Us,{group:i,count:a})}:void 0,[s]);return r.jsx(Rs,{columns:n,data:e,groupBy:o,emptyMessage:"No agents registered.",className:"border-0",tableClassName:"table-fixed"})}function Ys({agents:e,isLoading:s,rosterFilters:t}){var O;const n=Qe(),o=Pt(),{open:i}=Se(),a=$t(),l=vn(te,{debounce:{search:200}}),{data:u}=We(),d=w.useMemo(()=>(u==null?void 0:u.members)??[],[u]),g=w.useMemo(()=>zs(e,d,t),[e,d,t]),h=w.useMemo(()=>[...new Set(g.map(N=>N.namespace).filter(N=>!!N))],[g]),f=!l.sortField||l.sortField===_e,c=w.useMemo(()=>f?te.applyFilters(g,l.values):It(g,te,l.values,Tt,{field:l.sortField,direction:l.sortDirection}),[g,f,l.values,l.sortField,l.sortDirection]),p=w.useMemo(()=>e.map(N=>N.projectPath).filter(N=>!!N),[e]),m=Cn(p),{data:v}=At({queryKey:Vt.current(),queryFn:()=>o.getConfig(),staleTime:3e4}),x=w.useMemo(()=>{const N=new Map;for(const F of d){if(F.kind!=="agent")continue;const L=Ze(F,d);L&&N.set(F.id,K(L))}return N},[d]),R=w.useMemo(()=>{const N=c.map(F=>{var L;return{...F,chatState:(F.projectPath?m[F.projectPath]:void 0)??"fresh",isPastOnboardingGrace:Ns(F.registeredAt),isDefault:((L=v==null?void 0:v.agents)==null?void 0:L.defaultAgent)===F.name,managedBy:x.get(F.id)??null}});return f?Es(N,l.sortDirection):N},[c,m,(O=v==null?void 0:v.agents)==null?void 0:O.defaultAgent,x,f,l.sortDirection]),j=w.useCallback(N=>{const F=a.get(N);if(F===void 0){Je.getState().openProfileDocked(N);return}i(F)},[a,i]),y=w.useCallback(N=>{Et(o,N).then(F=>n(F)).catch(F=>{Dt(o,F),zt(N)})},[n,o]),_=w.useMemo(()=>({onNavigate:y,onViewProfile:j}),[y,j]);function A(){return g.length===0&&e.length>0?r.jsx(js,{peopleOnly:(t==null?void 0:t.kind)==="people"}):c.length===0&&g.length>0?r.jsx(ys,{onClearFilters:l.clearAll,filterDescription:l.describeActive()}):r.jsx(Ks,{rows:R,grouped:f,callbacks:_})}return s?r.jsx("div",{className:"space-y-3 p-4 sm:px-6",children:Array.from({length:3}).map((N,F)=>r.jsx(V,{className:"h-14 w-full rounded-xl"},F))}):r.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[r.jsxs(H,{state:l,className:"sm:px-6",children:[r.jsx(H.Search,{placeholder:"Filter agents…"}),r.jsx(H.Primary,{name:"status"}),r.jsx(H.AddFilter,{dynamicOptions:{namespace:h}}),r.jsx(H.Sort,{options:kt,defaultField:_e}),r.jsx(H.ResultCount,{count:c.length,total:g.length,noun:"agent"}),r.jsx(H.ActiveFilters,{})]}),r.jsx(Sn,{className:"min-h-0 flex-1",children:r.jsx("div",{className:"px-4 pb-4 sm:px-6",children:A()})})]})}const Xs={animate:{transition:{staggerChildren:.1}}},Qs={initial:{opacity:0},animate:{opacity:.2,transition:{duration:.3}}};function de(){return r.jsxs($.div,{variants:Qs,className:"rounded-xl border border-dashed px-4 py-3",children:[r.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[r.jsx(V,{className:"size-3 rounded-full"}),r.jsx(V,{className:"h-3 w-32"}),r.jsx(V,{className:"h-3 w-16"}),r.jsx(V,{className:"ml-auto h-3 w-10"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(V,{className:"h-2.5 w-48"}),r.jsx(V,{className:"h-2.5 w-20"})]})]})}function vt(){const e=bt(s=>s.open);return r.jsxs("div",{className:"relative w-full max-w-2xl px-4",children:[r.jsxs($.div,{variants:Xs,initial:"initial",animate:"animate",className:"space-y-3",children:[r.jsx(de,{}),r.jsx(de,{}),r.jsx(de,{})]}),r.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-4",children:[r.jsx("p",{className:"text-lg font-semibold",children:"Bring in existing projects"}),r.jsxs(E,{size:"sm",className:"gap-1.5",onClick:e,children:[r.jsx(Pn,{className:"size-3.5"}),"Search for projects"]})]})]})}function Ws(){const{data:e,isLoading:s}=Lt(),t=(e==null?void 0:e.denied)??[];return s?r.jsx("div",{className:"flex items-center justify-center p-8",children:r.jsx(J,{size:"md",className:"text-muted-foreground",label:"Loading blocked paths"})}):t.length===0?r.jsx(et,{icon:Ht,headline:"No blocked paths",description:"Folders you block from scans show up here."}):r.jsx("div",{className:"space-y-2 p-4",children:t.map(n=>r.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-xl border px-4 py-3",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate font-mono text-sm",title:n.path,children:n.path}),n.reason&&r.jsx("p",{className:"text-muted-foreground truncate text-xs",title:n.reason,children:n.reason})]}),r.jsx(I,{variant:"outline",className:"shrink-0",children:n.deniedBy})]},n.path))})}function Zs({namespace:e,agentCount:s,agents:t}){const[n,o]=w.useState(!1);return r.jsxs("div",{className:"rounded-xl border",children:[r.jsxs("button",{type:"button",onClick:()=>o(!n),className:"hover:bg-muted/50 flex w-full items-center gap-2 px-4 py-3 text-left transition-colors duration-150",children:[n?r.jsx(Ot,{className:"size-4"}):r.jsx(Bt,{className:"size-4"}),r.jsx("span",{className:"text-sm font-medium",children:e}),r.jsxs(I,{variant:"secondary",className:"ml-auto",children:[s," agent",s!==1?"s":""]})]}),n&&r.jsx("div",{className:"space-y-2 border-t px-4 py-2",children:t.map(i=>r.jsx("div",{className:"flex items-center justify-between py-1",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm",children:G(i)}),r.jsx(I,{variant:"outline",children:tt(i.runtime)})]})},i.id))})]})}function Js({sourceNamespace:e,targetNamespace:s,action:t,origin:n,onRemove:o}){const i=n==="default";return r.jsxs("div",{className:"flex items-center justify-between rounded-lg border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"font-mono",children:e}),r.jsx("span",{className:"text-muted-foreground",children:"→"}),r.jsx("span",{className:"font-mono",children:s}),r.jsx(I,{variant:t==="allow"?"default":"destructive",children:t}),i&&r.jsx(I,{tone:"neutral",variant:"outline",children:"built-in"})]}),i?r.jsx("span",{className:"text-muted-foreground flex size-8 items-center justify-center",title:"Built-in rule, always enforced. Not removable",children:r.jsx(qt,{className:"size-4","aria-hidden":"true"})}):r.jsx(E,{type:"button",variant:"ghost",size:"icon-sm",onClick:o,className:"text-muted-foreground hover:bg-destructive/10 hover:text-destructive","aria-label":`Remove access from ${e} to ${s}`,children:r.jsx(Ut,{})})]})}const St="acl-open-mesh-explanation";function eo({namespaces:e,onAdd:s,isPending:t,inert:n}){const[o,i]=w.useState(""),[a,l]=w.useState("");function u(g){g.preventDefault(),!n&&o&&a&&o!==a&&(s(o,a),i(""),l(""))}const d=n?{"aria-disabled":!0,"aria-describedby":St}:{};return r.jsxs("form",{onSubmit:u,className:"flex items-end gap-2",children:[r.jsxs("div",{className:"flex-1 space-y-1",children:[r.jsx(Fe,{htmlFor:"acl-source",className:"text-muted-foreground text-xs font-medium",children:"Source"}),r.jsxs(Me,{value:o,onValueChange:n?()=>{}:i,children:[r.jsx(Pe,{id:"acl-source",className:"w-full aria-disabled:pointer-events-none aria-disabled:opacity-50",...d,children:r.jsx($e,{placeholder:"Pick a project"})}),r.jsx(Ie,{children:e.map(g=>r.jsx(Ae,{value:g,children:g},g))})]})]}),r.jsxs("div",{className:"flex-1 space-y-1",children:[r.jsx(Fe,{htmlFor:"acl-target",className:"text-muted-foreground text-xs font-medium",children:"Target"}),r.jsxs(Me,{value:a,onValueChange:n?()=>{}:l,children:[r.jsx(Pe,{id:"acl-target",className:"w-full aria-disabled:pointer-events-none aria-disabled:opacity-50",...d,children:r.jsx($e,{placeholder:"Pick a project"})}),r.jsx(Ie,{children:e.map(g=>r.jsx(Ae,{value:g,children:g},g))})]})]}),r.jsxs(E,{type:"submit",className:"aria-disabled:pointer-events-none aria-disabled:opacity-50",disabled:!n&&(t||!o||!a||o===a),...d,children:[t?r.jsx(J,{}):r.jsx(Kt,{}),"Allow access"]})]})}function to({onGoToDiscovery:e}={}){const{data:s,isLoading:t}=rt(),{mutate:n,isPending:o}=wn();if(t)return r.jsx("div",{className:"flex items-center justify-center p-8",children:r.jsx(J,{size:"md",className:"text-muted-foreground"})});const i=(s==null?void 0:s.namespaces)??[],a=(s==null?void 0:s.openMesh)??!1,l=((s==null?void 0:s.accessRules)??[]).filter(d=>!(d.origin==="explicit"&&d.sourceNamespace===Ne&&d.targetNamespace===Ne)),u=i.map(d=>d.namespace);return i.length===0?r.jsxs("div",{className:"space-y-6 p-4",children:[r.jsx(Ve,{}),r.jsx(et,{icon:Gt,headline:"You need agents in more than one project",description:"Add agents from a second folder to let two projects talk.",action:e?{label:"Go to Discovery",onClick:e}:void 0})]}):r.jsxs("div",{className:"space-y-6 p-4",children:[r.jsx(Ve,{}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-muted-foreground text-sm font-medium",children:"Projects"}),i.map(d=>r.jsx(Zs,{namespace:d.namespace,agentCount:d.agentCount,agents:d.agents},d.namespace))]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-muted-foreground text-sm font-medium",children:"Cross-project access rules"}),l.length===0?r.jsx("p",{className:"text-muted-foreground text-xs",children:"No rules yet. Agents only talk within their own project."}):r.jsx("div",{className:"space-y-1",children:l.map(d=>r.jsx(Js,{sourceNamespace:d.sourceNamespace,targetNamespace:d.targetNamespace,action:d.action,origin:d.origin,onRemove:()=>n({sourceNamespace:d.sourceNamespace,targetNamespace:d.targetNamespace,action:"deny"})},`${d.sourceNamespace}-${d.targetNamespace}-${d.action}-${d.origin}`))})]}),u.length>=2&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-muted-foreground text-sm font-medium",children:"Allow cross-project access"}),a&&r.jsx("p",{id:St,className:"text-muted-foreground text-xs",children:"Already allowed by the switch above. Turn it off to pick pairs."}),r.jsx(eo,{namespaces:u,isPending:o,inert:a,onAdd:(d,g)=>n({sourceNamespace:d,targetNamespace:g,action:"allow"})})]})]})}const Ct={active:{label:"Active",dot:ne.working},inactive:{label:"Inactive",dot:ne["needs-you"]},stale:{label:"Stale",dot:"bg-muted-foreground/50"},unreachable:{label:"Unreachable",dot:ne.error}};function no(e){return e in Ct}function Be({onClick:e}){return r.jsx("button",{type:"button",onClick:e,"aria-label":"Close detail panel",className:"text-muted-foreground hover:text-foreground",children:r.jsx(Ce,{className:"size-(--size-icon-sm)"})})}function qe({agentId:e,onClose:s}){const{data:t,isLoading:n}=Rn(e),{open:o}=Se();if(n)return r.jsx("div",{className:"flex w-64 items-center justify-center border-l p-4",children:r.jsx("span",{className:"text-muted-foreground text-sm",children:"Loading…"})});if(!t)return r.jsxs("div",{className:"w-64 border-l p-4",children:[r.jsx("div",{className:"flex justify-end",children:r.jsx(Be,{onClick:s})}),r.jsx("p",{className:"text-muted-foreground mt-2 text-sm",children:"Agent not found"})]});const i=no(t.status)?t.status:"stale",a=Ct[i];return r.jsxs("div",{className:"w-64 overflow-y-auto border-l p-4",children:[r.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[r.jsx("h3",{className:"truncate text-sm font-semibold",children:t.name}),r.jsx(Be,{onClick:s})]}),r.jsxs("div",{className:"space-y-3 text-xs",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:k("h-2.5 w-2.5 rounded-full",a.dot),"aria-hidden":"true"}),r.jsx("span",{children:a.label})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Last seen: "}),r.jsx("span",{children:t.lastSeenAt?ce(t.lastSeenAt):"Never"})]}),t.lastSeenEvent&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Last event: "}),r.jsx("span",{children:t.lastSeenEvent})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Runs on: "}),r.jsx(I,{size:"xs",variant:"secondary",children:tt(t.runtime)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Registered: "}),r.jsx("span",{children:t.registeredAt?ce(t.registeredAt):"Unknown"})]}),Array.isArray(t.capabilities)&&t.capabilities.length>0&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground mb-1 block",children:"Capabilities:"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:t.capabilities.map(l=>r.jsx(I,{size:"xs",variant:"outline",children:l},l))})]})]}),r.jsx("div",{className:"mt-4 space-y-2 border-t pt-3",children:r.jsxs("button",{type:"button",onClick:()=>o(e),className:"hover:bg-muted inline-flex w-full items-center justify-center gap-2 rounded-md border px-3 py-1.5 text-xs font-medium transition-colors duration-150",children:[r.jsx(Yt,{className:"size-3.5"}),"View profile"]})})]})}function so(){return r.jsx(to,{})}function oo(e){var s;if(e.agent){const t=Ye(e.agent.runtime).label;return e.agent.model?`${t} · ${e.agent.model}`:t}return(s=e.person)!=null&&s.role?e.person.role:e.origin==="local"?"On this machine":`On ${Wt(e.origin.platform)}`}const io={layout:"position",initial:{opacity:0,scale:.97},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.97,transition:{duration:.15}},transition:{layout:{type:"spring",stiffness:280,damping:32},duration:.2,ease:[0,0,.2,1]}};function ro({member:e,owner:s,onSelectOwner:t,onOpenProfile:n,onSetLinkedToMe:o,linkPending:i=!1,linkError:a,ownedAgentCount:l,layoutAnimated:u=!1,ref:d,className:g}){var p,m,v;const h=nt(e),f=Xt(e),c=(p=e.person)==null?void 0:p.linkedToYou;return r.jsxs($.article,{ref:d,...u?io:{},"data-slot":"team-member-card","data-member-id":e.id,"data-layout-animated":String(u),style:{"--identity-color":h.color},className:k("bg-card shadow-soft relative flex items-start gap-3 rounded-lg border p-4","border-[color-mix(in_oklch,var(--identity-color)_var(--identity-border-strength),hsl(var(--border)))]","[--identity-border-strength:0%]",n&&["transition-[box-shadow,border-color,translate,scale] duration-(--identity-settle) ease-(--identity-ease-standard)","hover:shadow-elevated hover:-translate-y-px","hover:[--identity-border-strength:var(--identity-border-mix)]","has-[[data-slot=team-member-open]:focus-visible]:shadow-elevated has-[[data-slot=team-member-open]:focus-visible]:-translate-y-px","has-[[data-slot=team-member-open]:focus-visible]:[--identity-border-strength:var(--identity-border-mix)]","active:translate-y-0 active:scale-[0.99] active:duration-(--identity-press)",Qt,"has-[[data-card-aside]:hover]:shadow-soft has-[[data-card-aside]:hover]:translate-y-0 has-[[data-card-aside]:hover]:[--identity-border-strength:0%]","has-[[data-card-aside]:focus-visible]:shadow-soft has-[[data-card-aside]:focus-visible]:translate-y-0 has-[[data-card-aside]:focus-visible]:[--identity-border-strength:0%]","[&:has([data-card-aside]:hover)_[data-slot=identity-badge]]:scale-100 [&:has([data-card-aside]:hover)_[data-slot=identity-badge]]:rotate-0","[&:has([data-card-aside]:focus-visible)_[data-slot=identity-badge]]:scale-100 [&:has([data-card-aside]:focus-visible)_[data-slot=identity-badge]]:rotate-0","has-[[data-card-aside]:active]:scale-100"],g),children:[r.jsx(st,{size:"md",kind:h.kind,color:h.color,emoji:h.emoji,imageUrl:h.imageUrl,fallback:h.fallback,origin:h.origin}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-1",children:[r.jsx("h3",{className:"min-w-0 truncate text-sm font-medium",children:n?r.jsx("button",{type:"button","data-slot":"team-member-open",onClick:()=>n(e.id),"aria-label":`Open ${e.displayName}’s profile`,className:"focus-ring max-w-full truncate rounded text-left after:absolute after:inset-0 after:rounded-lg after:content-['']",children:e.displayName}):e.displayName}),e.isSelf&&r.jsx(I,{size:"xs",variant:"secondary",children:"you"}),((m=e.agent)==null?void 0:m.isDefault)&&r.jsx(I,{size:"xs",variant:"outline",children:"default"}),c&&r.jsx(I,{size:"xs",variant:"secondary",children:"also you"})]}),e.handle!==null&&r.jsxs("p",{"data-slot":"team-member-handle",className:"text-muted-foreground truncate text-xs",children:["@",e.handle]}),f&&r.jsx("p",{"data-slot":"team-member-name-source",className:"text-muted-foreground truncate text-xs",children:f}),r.jsx("p",{className:"text-muted-foreground mt-1.5 truncate text-xs",children:oo(e)}),((v=e.agent)==null?void 0:v.recentlyActive)&&r.jsx("p",{className:"text-muted-foreground mt-0.5 text-xs",children:"Active in the last hour"}),c!==void 0&&o&&r.jsx("button",{type:"button","data-slot":"team-member-link-to-me","data-card-aside":"",disabled:i,onClick:()=>o(e.id,!c),"aria-label":c?`Stop treating ${e.displayName} as you`:`Tell DorkOS that ${e.displayName} is you`,className:"text-muted-foreground hover:text-foreground focus-visible:text-foreground focus-ring relative mt-1.5 block w-fit max-w-full truncate rounded text-xs underline-offset-2 transition-[color] duration-(--identity-answer) ease-(--identity-ease-standard) hover:underline focus-visible:underline disabled:pointer-events-none disabled:opacity-60",children:c?"Not me":"This is me"}),a&&r.jsx("p",{role:"alert","data-slot":"team-member-link-error",className:"text-destructive relative mt-1 text-xs",children:a}),s&&t&&r.jsxs("div",{className:"relative mt-1.5 flex w-fit max-w-full items-baseline",children:[r.jsxs("button",{type:"button","data-slot":"team-member-owner","data-card-aside":"",onClick:()=>t(s.id),"aria-label":`Show only ${s.displayName} and their agents`,className:"text-muted-foreground hover:text-foreground focus-visible:text-foreground focus-ring peer/owner relative min-w-0 truncate rounded text-xs underline-offset-2 transition-[color] duration-(--identity-answer) ease-(--identity-ease-standard) hover:underline focus-visible:underline",children:["by ",K(s)]}),l!==void 0&&l>0&&r.jsxs("span",{"aria-hidden":!0,"data-slot":"team-member-owner-count",className:"text-muted-foreground pointer-events-none absolute top-0 left-full ml-1 hidden text-xs whitespace-nowrap opacity-0 transition-opacity duration-(--identity-answer) ease-(--identity-ease-standard) peer-hover/owner:opacity-100 peer-focus-visible/owner:opacity-100 [@media(hover:hover)]:block",children:["· ",l," ",l===1?"agent":"agents"]})]})]})]})}const ao=120;function lo({memberCount:e,reducedMotion:s}){return!s&&e<=ao}const wt="grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3";function uo({owner:e,onSelectOwner:s,ref:t}){const n=nt(e),o="col-span-full mt-3 flex min-w-0 items-center first:mt-0",i=r.jsxs(r.Fragment,{children:[r.jsx(st,{size:"xs",kind:n.kind,color:n.color,emoji:n.emoji,imageUrl:n.imageUrl,fallback:n.fallback,origin:n.origin}),r.jsx("span",{className:"truncate text-sm font-medium",children:e.displayName}),r.jsx("span",{className:"text-muted-foreground truncate text-xs",children:K(e)})]});return s?r.jsx("h2",{ref:t,className:o,children:r.jsx("button",{type:"button",onClick:()=>s(e.id),className:"focus-ring flex min-w-0 items-center gap-2 rounded",children:i})}):r.jsx("h2",{ref:t,className:k(o,"gap-2"),children:i})}function co({members:e,roster:s,grouped:t,onSelectOwner:n,onOpenProfile:o,onSetLinkedToMe:i,identityLinkState:a,className:l}){const u=Zt(),d=lo({memberCount:e.length,reducedMotion:u===!0}),g=(f,c)=>{const p=c?Ze(f,s):void 0;return r.jsx(ro,{member:f,owner:p,ownedAgentCount:p?tn(p.id,s):void 0,onSelectOwner:c?n:void 0,onOpenProfile:o,onSetLinkedToMe:i,linkPending:(a==null?void 0:a.pendingId)===f.id,...(a==null?void 0:a.errorId)===f.id&&a.errorMessage?{linkError:a.errorMessage}:{},layoutAnimated:d},f.id)},h=t?Jt(e,s).flatMap(f=>[f.owner?r.jsx(uo,{owner:f.owner,onSelectOwner:n},`cluster:${f.owner.id}`):r.jsx("h2",{className:"text-muted-foreground col-span-full mt-3 text-sm font-medium first:mt-0",children:"No owner"},"cluster:__unowned"),...f.members.map(c=>g(c,!1))]):e.map(f=>g(f,!0));return r.jsx("div",{"data-slot":t?"team-roster-groups":"team-roster-grid","data-testid":en.teamRoster,"data-layout-animated":String(d),className:k(wt,l),children:r.jsx(ge,{mode:"popLayout",initial:!1,children:h})})}const go=6;function fo({count:e=go}={}){return r.jsx("div",{className:wt,"aria-busy":"true","aria-label":"Loading the team",children:Array.from({length:e}).map((s,t)=>r.jsxs("div",{className:"bg-card shadow-soft flex items-start gap-3 rounded-lg border p-4",children:[r.jsx(V,{className:"size-9 shrink-0 rounded-full"}),r.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[r.jsx(V,{className:"h-4 w-24"}),r.jsx(V,{className:"h-3 w-16"}),r.jsx(V,{className:"h-3 w-32"})]})]},t))})}const mo=[{value:"all",label:"All"},{value:"people",label:"People"},{value:"agents",label:"Agents"}];function po({filters:e,onFiltersChange:s,people:t,className:n}){const o=e.owner?t.find(i=>i.id===e.owner):void 0;return r.jsxs("div",{className:k("space-y-3",n),children:[r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 overflow-x-auto pb-0.5",children:[r.jsx("div",{role:"group","aria-label":"Filter by kind",className:"flex items-center gap-1.5",children:mo.map(i=>r.jsx(E,{type:"button",size:"xs",variant:e.kind===i.value?"default":"outline","aria-pressed":e.kind===i.value,onClick:()=>s({kind:i.value}),className:"shrink-0",children:i.label},i.value))}),t.length>1&&r.jsx("div",{role:"group","aria-label":"Filter by person",className:"flex items-center gap-1.5",children:t.map(i=>r.jsx(E,{type:"button",size:"xs",variant:e.owner===i.id?"default":"outline","aria-pressed":e.owner===i.id,"aria-label":`Show only ${i.displayName} and their agents`,onClick:()=>s({owner:e.owner===i.id?void 0:i.id}),className:"max-w-40 shrink-0 truncate",children:K(i)},i.id))})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx(E,{type:"button",size:"xs",variant:e.group==="manager"?"default":"outline","aria-pressed":e.group==="manager",onClick:()=>s({group:e.group==="manager"?"none":"manager"}),className:"shrink-0",children:"Group by owner"}),r.jsxs("div",{className:"relative flex-1 sm:w-56 sm:flex-none",children:[r.jsx(nn,{"aria-hidden":!0,className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2"}),r.jsx(sn,{type:"search","aria-label":"Search the team",placeholder:"Search",value:e.q??"",onChange:i=>s({q:i.target.value===""?void 0:i.target.value}),className:"h-8 pl-8 text-xs"})]})]})]}),o&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("p",{className:"text-muted-foreground text-xs",children:["Showing ",K(o)," and their agents"]}),r.jsxs(E,{type:"button",size:"xs",variant:"ghost",onClick:()=>s({owner:void 0}),children:[r.jsx(Ce,{"aria-hidden":!0,className:"size-3"}),"Clear"]})]})]})}const ho={agents:"Couldn’t read all your agents. Showing the rest.",authors:"Couldn’t read everyone on this install. Showing the rest.",account:"Couldn’t read your account, so your own name may be missing.",claims:"Couldn’t tell which of your agents are working right now.",rooms:"Couldn’t read your rooms, so where agents work may be missing.",sessions:"Couldn’t read recent chats, so “last active” may be missing."};function xo(e){return ho[e]??"Some of your team couldn’t be loaded."}function vo({warnings:e,className:s}){const[t,n]=w.useState(!1);return!e||e.length===0||t?null:r.jsxs("div",{role:"status","data-slot":"team-roster-warnings",className:k("border-status-warning/40 bg-status-warning/10 flex items-start gap-2 rounded-lg border px-3 py-2",s),children:[r.jsx(Xe,{"aria-hidden":!0,className:"text-status-warning mt-0.5 size-4 shrink-0"}),r.jsx("ul",{className:"min-w-0 flex-1 space-y-0.5 text-xs",children:e.map(o=>r.jsx("li",{children:xo(o.source)},o.source))}),r.jsx(E,{type:"button",size:"xs",variant:"ghost","aria-label":"Dismiss",onClick:()=>n(!0),className:"-my-0.5 shrink-0",children:r.jsx(Ce,{"aria-hidden":!0,className:"size-3"})})]})}function So({filters:e,onFiltersChange:s}){const[t,n]=w.useState(on),o=e??t,i=y=>{e!==void 0?s(y):n(_=>({..._,...y}))},{open:a}=Se(),l=rn(),{data:u,isLoading:d,isError:g,refetch:h}=We(),f=it(d),c=w.useMemo(()=>(u==null?void 0:u.members)??[],[u]),p=w.useMemo(()=>Ke(c,o),[c,o]),m=w.useMemo(()=>c.filter(y=>y.kind==="human"),[c]),v=c.some(y=>y.kind==="agent"),x=w.useMemo(()=>Fn(c),[c]),R=w.useMemo(()=>{const y=new Set(c.filter(_=>{const A=an(_,c);return A==="managed"||A==="system"}).flatMap(_=>{var A;return(A=_.agent)!=null&&A.manifestId?[_.agent.manifestId]:[]}));return _=>y.has(_.agentId)},[c]),j=o.kind!=="all"||o.owner!==void 0||(o.q??"")!=="";return g?r.jsx(ot,{className:"h-full",title:"Couldn’t load your team",description:"The DorkOS server didn’t answer. Check that it’s running.",onRetry:()=>void h()}):r.jsxs(Nn,{width:"full",className:"flex flex-col gap-4",children:[r.jsx(vo,{warnings:u==null?void 0:u.warnings}),r.jsx(po,{filters:o,onFiltersChange:i,people:m}),f?r.jsx(fo,{}):p.length>0?r.jsx(co,{members:p,roster:c,grouped:o.group==="manager",onSelectOwner:y=>i({owner:y}),onOpenProfile:a,onSetLinkedToMe:(y,_)=>l.mutate({memberId:y,linked:_}),identityLinkState:{...l.isPending&&l.variables?{pendingId:l.variables.memberId}:{},...l.isError&&l.variables?{errorId:l.variables.memberId,errorMessage:ln(l.error,l.variables.linked)}:{}}}):r.jsx("p",{className:"text-muted-foreground py-8 text-center text-sm",children:j?"Nobody here matches that.":"Nobody to show yet."}),!f&&c.length>0&&!v&&r.jsx("div",{className:"flex justify-center py-6",children:r.jsx(vt,{})}),!f&&v&&r.jsxs("section",{"aria-labelledby":"team-commitments",className:"flex flex-col gap-2 pt-2",children:[r.jsx("h2",{id:"team-commitments",className:"text-sm font-medium",children:"Commitments"}),r.jsx(Mn,{nameOf:x,canChange:R})]})]})}const Co=w.lazy(()=>hn(()=>import("./TopologyGraph-of6Cp5Kj.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])).then(e=>({default:e.TopologyGraph}))),wo=.15,q={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:wo}};function Ro(){return r.jsxs(r.Fragment,{children:[r.jsx(un,{children:"Team"}),r.jsx(yo,{})]})}function yo(){const e=dn({from:"/_shell/team"}),s=Qe(),t=Ue(),n=cn(),[,o]=gn(),{data:i,isLoading:a,isError:l,refetch:u}=rt(),d=it(a),g=fn(e.view),h=e.agent,f=w.useMemo(()=>({kind:e.kind,owner:e.owner,group:e.group,q:e.q}),[e.kind,e.owner,e.group,e.q]);function c(x){s({...Y.team(),search:R=>({...R,...x})})}function p(){s({...Y.team(),search:x=>({...x,agent:void 0})})}const m=w.useMemo(()=>(i==null?void 0:i.namespaces.flatMap(x=>x.agents))??[],[i]),v=m.length===0&&!d&&!l&&(g==="table"||g==="topology");return l&&g!=="cards"?r.jsx(ot,{className:"h-full",title:"Couldn’t load agents",description:"The DorkOS server didn’t answer. Check that it’s running.",onRetry:()=>void u()}):v?r.jsx("div",{className:"flex h-full flex-col items-center justify-center",children:r.jsx(vt,{})}):r.jsx("div",{className:"flex h-full flex-col",children:r.jsxs(ge,{mode:"wait",initial:!1,children:[g==="cards"&&r.jsx($.div,{...q,className:"flex h-full flex-col",children:r.jsx(So,{filters:f,onFiltersChange:c})},"view-cards"),g==="table"&&r.jsx($.div,{...q,className:"flex h-full flex-col",children:r.jsx(Ys,{agents:m,isLoading:d,rosterFilters:f})},"view-table"),g==="topology"&&r.jsx($.div,{...q,className:"relative flex-1 overflow-hidden",children:r.jsxs("div",{className:"flex h-full",children:[r.jsx($.div,{layout:!0,className:"min-w-0 flex-1",transition:{type:"spring",stiffness:300,damping:30},children:r.jsx("div",{className:"absolute inset-0",children:r.jsx(w.Suspense,{fallback:r.jsxs("div",{className:"text-muted-foreground flex h-full items-center justify-center text-sm",children:[r.jsx(J,{className:"mr-2"}),"Loading topology…"]}),children:r.jsx(Co,{onSelectAgent:x=>void s({...Y.team(),search:R=>({...R,agent:x})}),onViewProfile:(x,R)=>{Je.getState().openProfileDocked(R)},onOpenChat:x=>o(x),onOpenAdapterCatalog:()=>n(),onGoToDiscovery:()=>void s({...Y.team(),search:x=>({...x,view:"table"})})})})})}),t?r.jsx(mn,{open:!!h,onOpenChange:x=>!x&&p(),children:r.jsx(pn,{children:h&&r.jsx(qe,{agentId:h,onClose:p})})}):r.jsx(ge,{children:h&&r.jsx($.div,{initial:{width:0,opacity:0},animate:{width:256,opacity:1},exit:{width:0,opacity:0},transition:{type:"spring",stiffness:300,damping:30},className:"bg-background overflow-y-auto border-l",children:r.jsx(qe,{agentId:h,onClose:p})})})]})},"view-topology"),g==="denied"&&r.jsx($.div,{...q,children:r.jsx(Ws,{})},"view-denied"),g==="access"&&r.jsx($.div,{...q,children:r.jsx(so,{})},"view-access")]})})}const jo=Ro,Eo=Object.freeze(Object.defineProperty({__proto__:null,component:jo},Symbol.toStringTag,{value:"Module"}));export{Ct as H,Eo as _};
@@ -1 +0,0 @@
1
- import{E as o}from"./ExtensionPageRoute-mKN8Jqyx.js";import"./index-Dr-0P6rd.js";import"./page-container-CPxW5T9E.js";import"./use-dev-links-BImQrE6g.js";import"./UnlinkDialog-BgwHAqdW.js";const r=o;export{r as component};
@@ -1 +0,0 @@
1
- import{E as o}from"./ExtensionPageRoute-mKN8Jqyx.js";import"./index-Dr-0P6rd.js";import"./page-container-CPxW5T9E.js";import"./use-dev-links-BImQrE6g.js";import"./UnlinkDialog-BgwHAqdW.js";const r=o;export{r as component};
@@ -1 +0,0 @@
1
- import{au as c,r as u,av as l,j as e,e as a,aw as i,ax as m}from"./index-Dr-0P6rd.js";import{ay as R,az as N,aA as g,aB as h,aC as j,aD as w}from"./index-Dr-0P6rd.js";import{C as P,N as I,O as y,o as D,a as S}from"./NewDirectMessageMenu-BjqYwnXW.js";function f(){const s=c(),o=s.status==="ready"?s.roomId:null,t=u.useRef(null);return u.useEffect(()=>{const n=t.current;if(t.current=o,n===null||n===o)return;const r=l.getState().request;r!==null&&r.roomId!==o&&l.getState().consume()},[o]),s.status==="loading"?e.jsxs("div",{className:"space-y-4 p-4","aria-busy":!0,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(a,{className:"size-9 rounded-full"}),e.jsx(a,{className:"h-4 w-32"})]}),e.jsx(a,{className:"h-3 w-48"}),e.jsx(a,{className:"h-24 w-full"})]}):s.status==="none"?e.jsx(i,{title:"No room open",body:"Open a channel or direct message to see who’s in it."}):e.jsx(m,{roomId:s.roomId},s.roomId)}export{R as AgentChipPicker,N as AgentRosterPicker,P as ChannelCreateDialog,I as NewDirectMessageMenu,y as ONE_DOOR_HINT,g as ROOM_PANEL_ID,f as RoomPanel,m as RoomPanelBody,h as facesOfRoster,D as oneDoorSubmitLabel,j as openRoomPanel,S as opensAgentSession,w as useRoomFaces,l as useRoomPanelFocusStore};
@@ -1 +0,0 @@
1
- import{r as B,e9 as O,ea as V,eb as A,j as e,at as Y,b6 as q,ec as F,ed as H,ee as U,ef as X,eg as G,eh as K,df as Q,Z as R,e5 as Z,ei as D,ej as J,ek as W,B as $,aa as _,ad as ee,el as se,em as te,cP as z,en as ne,eo as ae,ep as re,eq as ie,er as I,dd as oe,cQ as N,es as de,et as P}from"./index-Dr-0P6rd.js";import{eu as Se,ev as Ee,ew as we,ex as ke,ey as Ce,ez as _e}from"./index-Dr-0P6rd.js";import{C as le}from"./card-BTgwskmX.js";const ce=["server_crashed","server_out_of_memory","server_unresponsive","isolation_unavailable","server_start_failed","server_start_timeout"],ue={server_crashed:s=>`${s} stopped unexpectedly 3 times. Reload it to try again.`,server_out_of_memory:s=>`${s} ran out of memory and stopped. Reload it to try again.`,server_unresponsive:s=>`${s} stopped responding, so DorkOS stopped it.`,isolation_unavailable:s=>`${s} can’t run with its limits on this computer.`,server_start_failed:s=>`${s} couldn’t start. Reload it to try again.`,server_start_timeout:s=>`${s} took too long to start. Reload it to try again.`};function T(s){return ce.includes(s)}function me(s,l){return T(s)?ue[s](l):null}function xe(s){return`Restarting ${s}…`}const he=new Set(["disabled","discovered","incompatible","invalid"]),pe="/marketplace?view=installed";function ge({extension:s,onToggle:l,isToggling:h,onSetRunApproval:r,isSettingApproval:c,onReload:f,isReloading:v}){const{manifest:n,status:x,scope:E,error:p,serverError:i,origin:b,approvedToRun:y}=s,[g,t]=B.useState(!1),o=!he.has(x),m=x==="incompatible",a=x==="invalid",d=x==="compile_error"||x==="activate_error",u=!m&&!a,S=!(b==="core"&&n.canDisable===!1),w=s.hasServerEntry||s.hasDataProxy,j=O(s),M=V(s.id,A(j)),k=d?"Not working":m?"Incompatible":a?"Can’t load":null;return e.jsx(le,{"data-slot":"extension-card","data-testid":`extension-card-${s.id}`,radius:"lg",gap:"none",className:R(d&&"border-amber-500/50",(m||a)&&"opacity-70"),children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d&&e.jsx(Y,{className:"text-status-warning-dot size-4 shrink-0","aria-hidden":"true"}),(m||a)&&!d&&e.jsx(q,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),!d&&!m&&!a&&e.jsx(F,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"font-medium",children:n.name}),e.jsxs("span",{className:"text-muted-foreground text-sm",children:["v",n.version]}),s.devLink&&e.jsx(H,{})]}),s.devLink&&e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1","data-testid":`extension-dev-link-${s.id}`,children:[e.jsx(U,{path:s.devLink.path,className:"min-w-0"}),e.jsx("button",{type:"button",onClick:()=>void X(pe),className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm text-xs underline underline-offset-2",children:"Unlink or switch"})]}),n.description&&e.jsx("p",{className:"text-muted-foreground text-sm",children:n.description}),e.jsx(G,{gifts:K(s),"data-testid":`extension-agent-gifts-${s.id}`}),m&&n.minHostVersion&&e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Needs DorkOS ",n.minHostVersion," or newer"]}),d&&p&&e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"text-status-warning-fg text-sm",children:[x==="compile_error"?"Couldn’t build: ":"Couldn’t start: ",p.message]}),p.details&&e.jsxs("button",{type:"button",onClick:()=>t(C=>!C),className:"text-muted-foreground hover:text-foreground flex items-center gap-1 text-xs transition-colors","aria-expanded":g,children:[e.jsx(Q,{className:R("size-3 transition-transform",g&&"rotate-180")}),g?"Hide details":"Show details"]}),g&&p.details&&e.jsx("pre",{className:"bg-muted mt-1 max-h-32 overflow-auto rounded-md p-2 text-xs",children:p.details})]}),i&&T(i.code)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1","data-testid":`extension-server-status-${s.id}`,children:[e.jsx("p",{className:"text-status-warning-fg text-sm",children:i.message||me(i.code,n.name)}),e.jsx("button",{type:"button",onClick:f,disabled:v,className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm text-xs underline underline-offset-2 disabled:opacity-50",children:"Reload"})]}),s.restartingAt&&!i&&e.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:xe(n.name)}),i&&!T(i.code)&&e.jsxs("p",{className:"text-status-warning-fg text-sm",children:["Couldn’t rebuild its server part: ",i.message,". The last version still runs."]}),b==="user"&&(y?e.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-2 text-xs","data-testid":`extension-run-allowed-${s.id}`,children:[e.jsx(Z,{className:"size-3.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{children:"You allowed this to run."}),s.originProblem==="changed"&&e.jsx("span",{children:"You approved its changed files. Any further change asks again."}),e.jsx("button",{type:"button",onClick:()=>r(s.id,!1),disabled:c,className:"hover:text-foreground underline underline-offset-2 disabled:opacity-50",children:"Stop it"}),e.jsx(D,{permissions:j,className:"basis-full","data-testid":`extension-permissions-${s.id}`})]}):e.jsxs("div",{className:"space-y-2 rounded-lg border border-amber-500/40 bg-amber-500/5 p-3","data-testid":`extension-needs-approval-${s.id}`,children:[e.jsx("p",{className:"text-sm font-medium",children:"This extension is waiting for you"}),s.originProblem&&e.jsx("p",{className:"text-status-warning-fg text-sm","data-testid":`extension-origin-problem-${s.id}`,children:s.originProblem==="changed"?"Its files changed after install, so DorkOS can’t vouch for it. Look it over first.":s.originProblem==="dev-link"?"It runs from your folder, so DorkOS can’t vouch for its source.":"Its plugin links to files elsewhere, so DorkOS can’t vouch for its source."}),e.jsx(D,{permissions:j,added:M,"data-testid":`extension-permissions-${s.id}`}),e.jsx("p",{className:"text-muted-foreground text-sm",children:J(w,(j==null?void 0:j.runtime)==="subprocess")}),e.jsx("p",{className:"text-muted-foreground text-sm",children:W}),e.jsx($,{size:"sm",onClick:()=>r(s.id,!0),disabled:c,"data-testid":`extension-approve-run-${s.id}`,children:"Turn it on"})]})),e.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-2 text-xs",children:[e.jsx(_,{variant:"outline",children:E}),k&&e.jsx(_,{variant:k==="Not working"?"destructive":"secondary","data-testid":`extension-health-${s.id}`,children:k}),n.author&&e.jsx("span",{children:n.author})]})]}),e.jsx("div",{className:"flex shrink-0 items-center pt-0.5",children:S?e.jsx(ee,{checked:o,onCheckedChange:C=>l(s.id,C),disabled:!u||h,"aria-label":`${o?"Disable":"Enable"} ${n.name}`}):e.jsx(_,{variant:"secondary",title:"This extension is always on","data-testid":`extension-required-${s.id}`,children:"Required"})})]})})}function L(s){const l=new Date(s);return Number.isNaN(l.getTime())?"":l.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function fe(){const{data:s=[]}=se(),{stop:l,pendingSource:h}=te();return s.length===0?null:e.jsxs("section",{className:"space-y-3","data-testid":"trusted-sources-section",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Trusted sources"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Extensions from these sources turn on without asking."}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Stop trusting one, and extensions already on keep running."}),e.jsx(z,{className:"text-muted-foreground text-sm",label:"If you stop trusting one",openLabel:"If you stop trusting one",children:e.jsx("p",{children:"Newer versions and new extensions from it wait for your yes."})})]}),e.jsx("ul",{className:"divide-y rounded-xl border",children:s.map(({source:r,trustedAt:c})=>e.jsxs("li",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate font-mono text-sm",children:r}),L(c)&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Trusted ",L(c)]})]}),e.jsx($,{type:"button",variant:"outline",size:"sm",disabled:h===r,onClick:()=>l(r),children:"Stop trusting"})]},r))})]})}function Ne(){const{data:s=[],isLoading:l}=ne(),h=ae(),r=re(),c=ie(),f=I(!0),v=I(!1),n=new Set([...h.variables?[h.variables]:[],...r.variables?[r.variables]:[]]),x=new Set([...f.isPending&&f.variables?[f.variables.id]:[],...v.isPending&&v.variables?[v.variables.id]:[]]);function E(t,o){const m=o?f:v,a=s.find(u=>u.id===t);if(!a)return;const d=o?A(O(a)):void 0;m.mutate({id:t,version:a.manifest.version,plugin:a.sourcePlugin??null,...d?{permissions:d}:{}},{onSuccess:u=>{o&&P.getState().forget(t);const S=u.extension.manifest.name,w=u.extension.isolation?"":" inside DorkOS";N.success(o?`${S} can now run${w}`:`${S} stopped running`)},onError:u=>{if(u instanceof de&&u.stale){d&&P.getState().remember(t,d),N.error(`${a.manifest.name} changed since you saw it. Check it again.`);return}N.error(o?"Couldn’t let it run.":"Couldn’t stop it running.",{description:u.message})}})}async function p(t,o){(o?h:r).mutate(t,{onError:a=>{N.error(o?"Couldn’t turn that on.":"Couldn’t turn that off.",{description:a.message})}})}function i(){c.mutate(void 0,{onSuccess:t=>{N.success(`Reloaded ${t.length} extension${t.length===1?"":"s"}`)},onError:t=>{N.error("Couldn’t reload your extensions.",{description:t.message})}})}if(l)return e.jsx("div",{className:"text-muted-foreground py-8 text-center text-sm",children:"Loading extensions…"});const b=s.filter(t=>t.origin==="core"),y=s.filter(t=>t.origin==="user"),g=t=>e.jsx(ge,{extension:t,onToggle:p,isToggling:n.has(t.id),onSetRunApproval:E,isSettingApproval:x.has(t.id),onReload:i,isReloading:c.isPending},t.id);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-muted-foreground space-y-1 text-sm",children:[e.jsx("p",{children:"Extensions add new screens and tools to DorkOS."}),e.jsxs(z,{children:[e.jsx("p",{children:"Core extensions come with DorkOS."}),e.jsxs("p",{children:["Installed ones live in"," ",e.jsx("code",{className:"bg-muted rounded px-1",children:"~/.dork/extensions/"})," or your project’s"," ",e.jsx("code",{className:"bg-muted rounded px-1",children:".dork/extensions/"}),"."]})]})]}),s.length===0?e.jsx("div",{className:"text-muted-foreground py-8 text-center text-sm","data-testid":"no-extensions",children:e.jsx("p",{children:"No extensions installed."})}):e.jsxs(e.Fragment,{children:[b.length>0&&e.jsxs("section",{className:"space-y-3","data-testid":"core-extensions-section",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Core extensions"}),e.jsx("div",{className:"space-y-3",children:b.map(g)})]}),e.jsxs("section",{className:"space-y-3","data-testid":"installed-extensions-section",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Installed extensions"}),y.length>0?e.jsx("div",{className:"space-y-3",children:y.map(g)}):e.jsxs("div",{className:"text-muted-foreground rounded-xl border border-dashed p-4 text-sm","data-testid":"no-installed-extensions",children:["No extensions installed yet. Browse"," ",e.jsx("span",{className:"text-foreground font-medium",children:"Marketplace"})," to add some."]})]})]}),e.jsx(fe,{}),e.jsx("div",{className:"flex justify-end",children:e.jsxs($,{variant:"outline",size:"sm",onClick:i,disabled:c.isPending,"data-testid":"reload-extensions-button",children:[e.jsx(oe,{className:R("mr-2 size-4",c.isPending&&"animate-spin")}),"Reload extensions"]})})]})}export{Se as ExtensionEventBridge,Ee as ExtensionLoader,we as ExtensionProvider,Ne as ExtensionsSettingsTab,ke as createExtensionAPI,Ce as createExtensionEventBridge,_e as useExtensions};
@@ -1 +0,0 @@
1
- import{I as M,M as S}from"./Marketplace-BoiupH2Z.js";import{M as u,P as x,m as P,u as d,a as g}from"./index-Dr-0P6rd.js";import{M as h}from"./MarketplaceSourcesView-krw9hUyu.js";import{U as I}from"./UnlinkDialog-BgwHAqdW.js";import"./PreviewRefusedNotice-fTN8MJ1h.js";import"./shield-x-DioB6qH_.js";import"./card-BTgwskmX.js";import"./markdown-content-aNzh-54y.js";import"./use-unclaimed-chats-D4k-EK_f.js";import"./use-dev-links-BImQrE6g.js";import"./file-DlQX-hKl.js";import"./file-exclamation-point-Dg2iCyPM.js";import"./rotate-ccw-clock-cx5RyP4l.js";import"./use-pending-read-DmrlNHS0.js";export{M as InstalledPackagesView,S as Marketplace,u as MarketplaceSidebar,h as MarketplaceSourcesView,x as PackageCard,I as UnlinkDialog,P as marketplaceSearchSchema,d as useMarketplaceParams,g as useMarketplaceStore};
@@ -1,17 +0,0 @@
1
- import{a4 as Se,gh as Me,ae as ne,r as s,i6 as Ie,i7 as Q,i8 as G,i9 as H,ga as ie,ia as Ce,cQ as J,ib as ee,dK as it,i3 as lt,af as oe,ic as ct,id as dt,ie as ut,ig as ft,aN as Te,ih as ht,j as e,F as Fe,df as pt,C as Ke,ii as mt,e1 as be,ij as xt,hg as gt,Z as Pe,ik as yt,il as vt,im as Ct,io as Z,ip as ue,fR as fe,fS as he,fT as pe,fU as me,fV as xe,fW as ge,fX as ye,fY as ve,B as W,b1 as bt,e8 as _e,hk as kt,iq as jt,aj as ce,ir as He,dd as wt,is as Et,it as Dt,iu as Nt,iv as Rt,eJ as De,iw as Ue,ag as St,g8 as Tt,at as Ft,cP as Pt,ix as Ot,dC as Mt,ho as _t,iy as At,cV as Lt,cW as zt,cX as $t,cY as It,cZ as Kt,da as Ht,I as Ut,c_ as qt}from"./index-Dr-0P6rd.js";import{t as ae,g as Qt,C as Bt,n as qe,r as Qe,a as Yt,p as Wt,F as Gt,w as Vt,c as Be,b as Xt}from"./room-files-source-BywWQPBN.js";import{N as ts,R as ns}from"./room-files-source-BywWQPBN.js";import{r as Zt,c as Jt}from"./composer-insert-BpyATrmR.js";import{u as en}from"./index-CcV9S7cO.js";import{r as Ye,h as We,F as tn}from"./file-drag-GDx2qhdk.js";import{R as Ge}from"./rotate-cw-DrGRGSwy.js";import{F as Ve}from"./file-DlQX-hKl.js";import{G as Xe}from"./git-branch-Dq_w3Iyx.js";import"./markdown-content-aNzh-54y.js";import"./file-exclamation-point-Dg2iCyPM.js";/**
2
- * @license lucide-react v1.48.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Ze={name:"corner-left-up",size:24,node:[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]]};Ze.node;const nn=Se(Ze);/**
7
- * @license lucide-react v1.48.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Je={name:"file-plus",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]};Je.node;const et=Se(Je);/**
12
- * @license lucide-react v1.48.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const tt={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};tt.node;const sn=Se(tt);function le(t,n,a){return["file-explorer","tree",t.scopeKey,n,t.filtersHidden?a:null]}function je(t,n,a,x){return{queryKey:le(t,n,a),queryFn:()=>t.list(n,{showHidden:a}),staleTime:Me.FILE_TREE_STALE_TIME_MS,gcTime:Me.FILE_TREE_GC_TIME_MS,placeholderData:p=>p??x.getQueryData(le(t,n,!a))}}const an=[".git",".dork",".claude",".agents","node_modules"];function rn(t){return t.startsWith(".")||an.includes(t)}const Ne=["ROOM.md","README.md"];function Re(t){return Ne.some(n=>n.toLowerCase()===t.toLowerCase())}function nt(t){return t.filter(n=>!rn(n.name))}function on(t){if(t.reduce((p,c)=>c.type==="file"&&Re(c.name)?p+1:p,0)===0)return t;const a=[],x=[];for(const p of t)p.type==="file"&&Re(p.name)?a.push(p):x.push(p);return a.sort((p,c)=>Ne.findIndex(o=>o.toLowerCase()===p.name.toLowerCase())-Ne.findIndex(o=>o.toLowerCase()===c.name.toLowerCase())),[...a,...x]}const ln=/ copy(?: \d+)?$/;function Oe({name:t,isDir:n,taken:a}){const x=new Set(a);if(!x.has(t))return t;const p=n?-1:t.lastIndexOf("."),c=p>0,o=c?t.slice(p):"",m=(c?t.slice(0,p):t).replace(ln,"");for(let r=1;;r+=1){const i=r===1?`${m} copy${o}`:`${m} copy ${r}${o}`;if(!x.has(i))return i}}function Ae(t,n,a){return{name:n,path:t,type:a,size:0,mtime:Date.now(),isSymlink:!1}}function cn(t){const n=ne(),{source:a,showHidden:x,queryClient:p,inFlightRef:c}=t,o=a.cwd??"",[m,r]=s.useState(null),i=s.useCallback(async h=>{c.current+=1;try{return await h()}finally{c.current-=1}},[c]),u=s.useMemo(()=>{const h=g=>le(a,g,x);return{getChildren:g=>{var w;return((w=p.getQueryData(h(g)))==null?void 0:w.entries)??[]},isLoaded:g=>p.getQueryData(h(g))!==void 0,takenNames:async g=>(await n.readFileTree(o,{path:g===Q?void 0:g,showHidden:!0})).entries.map(b=>b.name),snapshot:g=>p.getQueryData(h(g)),setChildren:(g,w)=>{p.setQueryData(h(g),b=>({entries:Ie(w((b==null?void 0:b.entries)??[]))}))},restore:(g,w)=>{p.setQueryData(h(g),w)},invalidate:g=>{p.invalidateQueries({queryKey:h(g),exact:!0})}}},[p,n,o,a,x]),N=s.useCallback((h,g,w)=>i(async()=>{const b=ee(h,g),S=!u.getChildren(h).some(A=>A.path===b),K=u.snapshot(h);S&&u.setChildren(h,A=>[...A,Ae(b,g,w)]);try{return await n.createEntry(o,b,w),!0}catch(A){return S&&u.restore(h,K),ae(A,`Couldn’t create ${w==="dir"?"folder":"file"}`),!1}finally{u.invalidate(h)}}),[n,o,u,i]),F=s.useCallback((h,g)=>i(async()=>{if(g===h.name||g.length===0)return!0;const w=G(h.path),b=ee(w,g),S=u.getChildren(w).some(_=>_.path===b),K=u.snapshot(w),A={...h,name:g,path:b};S||u.setChildren(w,_=>_.map($=>$.path===h.path?A:$));try{return await n.renameEntry(o,h.path,b),H.getState().remapExpandedPaths(h.path,b),!0}catch(_){return S||u.restore(w,K),ae(_,"Couldn’t rename"),!1}finally{u.invalidate(w)}}),[n,o,u,i]),D=s.useCallback(h=>i(async()=>{const g=G(h.path),w=u.snapshot(g);u.setChildren(g,b=>b.filter(S=>S.path!==h.path));try{await n.deleteEntry(o,h.path,{recursive:!0}),H.getState().dropExpandedPaths(h.path)}catch(b){u.restore(g,w),ae(b,"Couldn’t delete")}finally{u.invalidate(g)}}),[n,o,u,i]),L=s.useCallback(h=>i(async()=>{const g=G(h.path);if(h.type==="file"){const w=u.snapshot(g);u.setChildren(g,b=>b.filter(S=>S.path!==h.path));try{await n.deleteEntry(o,h.path),H.getState().dropExpandedPaths(h.path)}catch(b){u.restore(g,w),ae(b,"Couldn’t delete")}finally{u.invalidate(g)}return}try{await n.deleteEntry(o,h.path),u.setChildren(g,w=>w.filter(b=>b.path!==h.path)),H.getState().dropExpandedPaths(h.path),u.invalidate(g)}catch(w){if(Qt(w)==="DIR_NOT_EMPTY"){r(h);return}ae(w,"Couldn’t delete")}}),[n,o,u,i]),C=s.useCallback(async()=>{const h=m;r(null),h&&await D(h)},[m,D]),U=s.useCallback(()=>r(null),[]),I=s.useCallback((h,g)=>i(async()=>{const w=G(h),b=ie(h),S=ee(g,b);if(g===w||S===h||Ce(g,h))return;const K=u.getChildren(w).find(v=>v.path===h);if(!K)return;const A=u.isLoaded(g),_=A&&u.getChildren(g).some(v=>v.path===S),$={...K,name:b,path:S},Y=u.snapshot(w),P=A?u.snapshot(g):void 0;u.setChildren(w,v=>v.filter(z=>z.path!==h)),A&&!_&&u.setChildren(g,v=>[...v,$]);try{await n.renameEntry(o,h,S),H.getState().remapExpandedPaths(h,S)}catch(v){u.restore(w,Y),A&&!_&&u.restore(g,P),ae(v,"Couldn’t move")}finally{u.invalidate(w),A&&u.invalidate(g)}}),[n,o,u,i]),j=s.useCallback((h,g)=>i(async()=>{if(h.isDir&&Ce(g,h.path)){J.error(Bt);return}let w;try{w=await u.takenNames(g)}catch(_){ae(_,"Couldn’t copy");return}const b=Oe({name:ie(h.path),isDir:h.isDir,taken:w}),S=ee(g,b),K=u.isLoaded(g),A=K?u.snapshot(g):void 0;if(K){const _=u.getChildren(G(h.path)).find(Y=>Y.path===h.path),$=_?{..._,name:b,path:S}:Ae(S,b,h.isDir?"dir":"file");u.setChildren(g,Y=>[...Y,$])}try{await n.copyEntry(o,h.path,S)}catch(_){K&&u.restore(g,A),ae(_,"Couldn’t copy")}finally{u.invalidate(g)}}),[n,o,u,i]);return{createEntry:N,renameEntry:F,removeEntry:L,moveEntry:I,copyEntry:j,pendingRecursiveDelete:m,confirmRecursiveDelete:C,cancelRecursiveDelete:U}}function dn(t){return t!=null&&t.startsWith("darwin")?"Reveal in Finder":t!=null&&t.startsWith("win32")?"Reveal in File Explorer":"Show in file manager"}function un(t,n){const a=t.includes("\\")&&!t.includes("/"),x=t.replace(/[\\/]+$/,""),p=a?n.split("/").join("\\"):n;return`${x}${a?"\\":"/"}${p}`}function fn(t){const n=ne(),{data:a}=it(),x=s.useMemo(()=>n.supportsReveal?dn(a==null?void 0:a.platform):null,[n.supportsReveal,a==null?void 0:a.platform]),p=s.useCallback(async i=>{if(t)try{await n.revealEntry(t,i.path)}catch(u){ae(u,"Couldn’t open the file manager")}},[n,t]),{copy:c}=lt(),o=s.useCallback(async(i,u)=>{const N=u==="absolute"&&t?un(t,i.path):i.path;await c(N)||J.error("Couldn’t copy to the clipboard")},[t,c]),m=s.useCallback(i=>{Zt(Jt(i.path))||J.error("Open a chat to add this file")},[]),r=s.useCallback(i=>{H.getState().setClipboard({path:i.path,isDir:i.type==="dir"});try{navigator.clipboard.writeText(i.path).catch(()=>{})}catch{}},[]);return{revealLabel:x,reveal:p,copyPath:o,addToChat:m,copyToClipboard:r}}const hn=1e3;function pn(t){const{source:n,showHidden:a,queryClient:x,inFlightRef:p}=t,c=n.changes,[o,m]=s.useState(null),[r,i]=s.useState(null),[u,N]=s.useState(null),[F,D]=s.useState(0),L=s.useCallback(async d=>{p.current+=1,D(f=>f+1);try{return await d()}finally{p.current-=1,D(f=>f-1)}},[p]),C=s.useMemo(()=>{const d=f=>le(n,f,a);return{listing:f=>x.getQueryData(d(f)),isLoaded:f=>x.getQueryData(d(f))!==void 0,entries:f=>{var T;return((T=x.getQueryData(d(f)))==null?void 0:T.entries)??[]},setEntries:(f,T)=>x.setQueryData(d(f),y=>({...y,entries:Ie(T((y==null?void 0:y.entries)??[]))})),restore:(f,T)=>x.setQueryData(d(f),T),fetch:f=>n.list(f,{showHidden:!0}),refreshAll:()=>{x.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),x.invalidateQueries({queryKey:["file-explorer","preview",n.scopeKey]})}}},[x,n,a]),U=s.useCallback(async d=>{const f=C.listing(d);return(f==null?void 0:f.commit)!==void 0?f.commit:(await C.fetch(d)).commit??null},[C]),I=s.useCallback((d,f,T,y)=>{switch(d.status){case"changed":return!0;case"conflict":return N({kind:f,path:d.path,lastCommit:d.lastCommit,retry:()=>T(d.commit)}),!1;case"exists":return J.error(y===void 0?d.reason:qe(y)),!1;case"refused":return J.error(d.reason),!1}},[]),j=s.useCallback((d,f)=>{J.error(Qe(d)??f)},[]),h=s.useCallback((d,f,T)=>{const y=O=>L(async()=>{if(c===void 0)return!1;const E=G(d.path),R=G(f),k=ie(f),q=C.isLoaded(R),te=q&&C.entries(R).some(X=>X.path===f),V=C.listing(E),de=R===E?void 0:C.listing(R),l={...d,name:k,path:f};te||(R===E?C.setEntries(E,X=>X.map(se=>se.path===d.path?l:se)):(C.setEntries(E,X=>X.filter(se=>se.path!==d.path)),q&&C.setEntries(R,X=>[...X,l])));const M=()=>{C.restore(E,V),R!==E&&q&&C.restore(R,de)};try{const X=O??await U(E);if(X===null)return M(),J.error("This room has no files to change yet."),!1;const se=await c.move({from:d.path,to:f,baseCommit:X}),we=I(se,T,async re=>{await y(re)},k);return we?H.getState().remapExpandedPaths(d.path,f):M(),we}catch(X){return M(),j(X,T==="rename"?"Couldn’t rename":"Couldn’t move"),!1}finally{C.refreshAll()}});return y(null)},[c,C,L,U,I,j]),g=s.useCallback(async(d,f)=>f===d.name||f.length===0?!0:h(d,ee(G(d.path),f),"rename"),[h]),w=s.useCallback(async(d,f)=>{const T=G(d),y=ee(f,ie(d));if(f===T||y===d||Ce(f,d))return;const O=C.entries(T).find(E=>E.path===d);O&&await h(O,y,"move")},[C,h]),b=s.useCallback(async d=>{let f=0;const T=[d];for(;T.length>0;){const y=T.shift(),O=await C.fetch(y);for(const E of O.entries)if(E.type==="dir"?T.push(E.path):f+=1,f>=hn)return{count:f,moreThan:!0}}return{count:f,moreThan:!1}},[C]),S=s.useCallback(d=>{if(d.type!=="dir"){m({entry:d,fileCount:1,moreThan:!1});return}m({entry:d,fileCount:null,moreThan:!1}),b(d.path).then(({count:f,moreThan:T})=>m(y=>(y==null?void 0:y.entry.path)===d.path?{entry:d,fileCount:f,moreThan:T}:y),()=>{})},[b]),K=s.useCallback(d=>{const f=T=>L(async()=>{if(c===void 0)return;const y=G(d.path),O=C.listing(y);C.setEntries(y,E=>E.filter(R=>R.path!==d.path));try{const E=T??await U(y);if(E===null){C.restore(y,O);return}const R=await c.remove({path:d.path,baseCommit:E});I(R,"delete",q=>f(q))?H.getState().dropExpandedPaths(d.path):C.restore(y,O)}catch(E){C.restore(y,O),j(E,"Couldn’t delete")}finally{C.refreshAll()}});return f(null)},[c,C,L,U,I,j]),A=s.useCallback(async()=>{const d=o;m(null),d&&await K(d.entry)},[o,K]),_=s.useCallback(()=>m(null),[]),$=s.useCallback((d,f,T,y)=>{const O=E=>L(async()=>{if(c===void 0)return;const R=C.isLoaded(d),k=R?C.listing(d):void 0;if(R){const q=new Set(C.entries(d).map(V=>V.name)),te=f.filter(V=>!q.has(V.name)).map(V=>({name:V.name,path:ee(d,V.name),type:"file",size:V.size}));te.length>0&&C.setEntries(d,V=>[...V,...te])}try{const q=await c.upload({dir:d,baseCommit:E,replace:T,files:f});!I(q,"upload",V=>O(V))&&R&&C.restore(d,k)}catch(q){R&&C.restore(d,k),j(q,"Couldn’t upload")}finally{C.refreshAll()}});return O(y)},[c,C,L,I,j]),Y=s.useCallback(async(d,f)=>{if(c===void 0||f.length===0)return;if(f.length>c.maxUploadFiles){J.error(`Nothing was uploaded. One upload takes up to ${c.maxUploadFiles} files.`);return}let T;try{T=await C.fetch(d)}catch(k){j(k,"Couldn’t upload");return}const y=T.entries.map(k=>k.name),O=new Set(y),E=f.map(k=>k.name).filter(k=>O.has(k)),R=T.commit??null;if(E.length===0){await $(d,f,[],R);return}i({dir:d,files:f,names:E,taken:y,baseCommit:R})},[c,C,j,$]),P=s.useCallback(async d=>{const f=r;if(i(null),f===null)return;if(d==="replace"){await $(f.dir,f.files,f.names,f.baseCommit);return}const T=new Set([...f.taken,...f.files.map(E=>E.name)]),y=new Set(f.names),O=f.files.map(E=>{if(!y.has(E.name))return E;const R=Oe({name:E.name,isDir:!1,taken:T});return T.add(R),new File([E],R,{type:E.type,lastModified:E.lastModified})});await $(f.dir,O,[],f.baseCommit)},[r,$]),v=s.useCallback(()=>i(null),[]),z=s.useCallback(()=>N(null),[]),B=s.useMemo(()=>r===null?null:{dir:r.dir,names:r.names},[r]);return{renameEntry:g,moveEntry:w,requestDelete:S,pendingDelete:o,confirmDelete:A,cancelDelete:_,upload:Y,pendingClash:B,resolveClash:P,cancelClash:v,conflict:u,dismissConflict:z,busy:F>0}}const Le={scopeKey:"",cwd:null,writable:!1,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list:()=>Promise.resolve({entries:[]})};function mn(t){var d,f,T;const n=ne(),a=oe(),{setTheme:x}=ct(),p=H(y=>y.showHidden),c=H(y=>y.expanded),o=H(y=>y.loadExplorerForCwd),m=H(y=>y.pruneMissing),r=(t==null?void 0:t.scopeKey)??null,i=(t==null?void 0:t.cwd)??null;s.useEffect(()=>{o(r)},[r,o]);const u=s.useMemo(()=>[Q,...dt(c)],[c]),N=ut({queries:t?u.map(y=>je(t,y,p,a)):[]}),F=(t==null?void 0:t.filtersHidden)??!0,D=s.useMemo(()=>{const y={};return u.forEach((O,E)=>{var q;const R=N[E];let k=((q=R==null?void 0:R.data)==null?void 0:q.entries)??[];!p&&!F&&(k=nt(k)),O===Q&&(k=on(k)),y[O]={entries:k,loading:(R==null?void 0:R.isLoading)??!1,error:(R==null?void 0:R.isError)??!1}}),y},[u,N,p,F]),L=s.useRef(0),C=s.useRef({});s.useEffect(()=>{L.current>0||u.forEach((y,O)=>{var R,k,q;const E=(k=(R=N[O])==null?void 0:R.data)==null?void 0:k.entries;!E||(q=N[O])!=null&&q.isError||C.current[y]!==E&&(C.current[y]=E,m(y,E.map(te=>te.name)))})},[u,N,m]);const U=s.useMemo(()=>ft(c,D),[c,D]),I=!!t&&!!((d=D[Q])!=null&&d.loading),j=!!t&&!!((f=D[Q])!=null&&f.error),h=(T=N[0])==null?void 0:T.error,g=j&&h?Yt(h):void 0,w=(g==null?void 0:g.message)??null,b=(g==null?void 0:g.command)??null,S=s.useMemo(()=>{var O;const y=new Set;for(const E of u)E!==Q&&((O=D[E])!=null&&O.error)&&y.add(E);return y},[u,D]),K=s.useCallback(y=>{if(y.type!=="dir")return;const O=H.getState();O.setDirExpanded(y.path,!O.expanded[y.path])},[]),A=s.useCallback(y=>{if(y===Q)return;const O=H.getState();O.expanded[y]||O.setDirExpanded(y,!0)},[]),_=(t==null?void 0:t.preview)==="canvas",$=s.useCallback(y=>{if(y.type!=="file"||!_)return;const O={getStore:Te.getState,setTheme:x,supportsTerminal:n.supportsTerminal};ht(O,{action:"open_file",sourcePath:y.path},"user")},[_,x,n]),Y=s.useCallback(()=>{r!==null&&a.invalidateQueries({queryKey:["file-explorer","tree",r]})},[a,r]),P=s.useCallback(y=>{t!==null&&a.invalidateQueries({queryKey:le(t,y,p),exact:!0})},[a,t,p]);s.useEffect(()=>{if(t!=null&&t.events)return t.events(Y)},[t,Y]);const v=cn({source:t??Le,showHidden:p,queryClient:a,inFlightRef:L}),z=pn({source:t??Le,showHidden:p,queryClient:a,inFlightRef:L}),B=fn(i);return{rows:U,rootLoading:I,rootError:j,rootErrorMessage:w,rootErrorCommand:b,errorPaths:S,toggleExpand:K,ensureExpanded:A,openFile:$,reload:Y,retryDir:P,changes:t!=null&&t.changes?z:null,...v,...B}}function xn(t){const{transport:n,cwd:a}=t;return{scopeKey:a,cwd:a,writable:!0,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list(x,p){return n.readFileTree(a,{path:x===""?void 0:x,showHidden:p.showHidden})}}}function ke(t){return Array.from(t).includes("Files")}function st(t){const n=Array.from(t.items??[]);if(!(n.length>0&&n.every(c=>"webkitGetAsEntry"in c)))return{files:Array.from(t.files??[]),folders:0};const x=[];let p=0;for(const c of n){if(c.kind!=="file")continue;const o=c.webkitGetAsEntry();if(o!=null&&o.isDirectory){p+=1;continue}const m=c.getAsFile();m&&x.push(m)}return{files:x,folders:p}}const gn=12;function yn({row:t,selected:n,renaming:a,error:x,onSelect:p,onActivate:c,onRetry:o,onSubmitRename:m,onCancelRename:r,onNewFile:i,onNewFolder:u,onStartRename:N,onDelete:F,onMove:D,onCopyInto:L,onCopy:C,onPaste:U,onDuplicate:I,canPasteInto:j,revealLabel:h,onReveal:g,onAddToChat:w,onCopyPath:b,readOnly:S=!1,provenance:K=!1,copyable:A=!0,onDisk:_=!0,onUpload:$,onPickUpload:Y}){const{entry:P,depth:v,expanded:z,loading:B}=t,d=P.type==="dir",f=d?P.path:G(P.path),[T,y]=s.useState(!1),O=!d&&v===0&&Re(P.name),E=Wt(P.lastCommit),R=e.jsxs("div",{role:"treeitem","aria-label":P.name,"aria-expanded":d?z:void 0,"aria-selected":n,tabIndex:-1,onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),p(P),c(P))},draggable:!a&&!S,onDragStart:k=>{S||(k.dataTransfer.setData("text/plain",P.path),k.dataTransfer.setData(tn,P.path),k.dataTransfer.effectAllowed="copyMove")},onDragOver:k=>{if(k.stopPropagation(),!S&&$&&ke(k.dataTransfer.types)){k.preventDefault(),k.dataTransfer.dropEffect="copy",y(!0);return}S||!d||!We(k.dataTransfer.types)||(k.preventDefault(),k.dataTransfer.dropEffect=k.altKey&&A?"copy":"move",y(!0))},onDragLeave:()=>y(!1),onDrop:k=>{if(k.stopPropagation(),S)return;if(y(!1),$&&ke(k.dataTransfer.types)){k.preventDefault();const{files:te}=st(k.dataTransfer);$(f,te);return}if(!d)return;const q=Ye(k.dataTransfer);q!==null&&(k.preventDefault(),k.altKey&&A?L(q,P.path):D(q,P.path))},onClick:()=>{p(P),c(P)},className:Pe("flex w-full cursor-pointer items-center gap-1 py-1 pr-2 text-sm transition-colors",n?"bg-accent text-foreground":"hover:bg-accent/50",T&&"ring-ring/60 bg-accent ring-1"),style:{paddingLeft:v*gn+8},children:[e.jsx("span",{className:"flex size-4 flex-shrink-0 items-center justify-center",children:d&&(B?e.jsx(Fe,{size:"xs",className:"text-muted-foreground"}):x?e.jsx("button",{type:"button","aria-label":"Retry loading",title:"Couldn’t load. Retry",onClick:k=>{k.stopPropagation(),o()},className:"flex items-center justify-center",children:e.jsx(Ge,{className:"text-destructive size-3.5"})}):z?e.jsx(pt,{className:"text-muted-foreground size-3.5"}):e.jsx(Ke,{className:"text-muted-foreground size-3.5"}))}),d?z?e.jsx(mt,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):P.isSymlink===!0?e.jsx(xt,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}):e.jsx(Ve,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),a?e.jsx(vn,{initialName:P.name,onSubmit:k=>m(P,k),onCancel:r}):e.jsx("span",{className:"min-w-0 flex-1 truncate",children:P.name}),O&&!a&&e.jsx(gt,{"aria-label":"Pinned to the top",className:"text-muted-foreground/60 size-3 flex-shrink-0"}),K&&!a&&e.jsx("span",{className:"text-muted-foreground/70 text-2xs max-w-[45%] flex-shrink-0 truncate tabular-nums",title:E.title??void 0,children:E.label})]});return S?R:e.jsxs(yt,{children:[e.jsx(vt,{asChild:!0,children:R}),e.jsxs(Ct,{className:"w-52",children:[e.jsx(Z,{movesFocus:!0,onClick:()=>i(f),children:"New file"}),e.jsx(Z,{movesFocus:!0,onClick:()=>u(f),children:"New folder"}),Y&&e.jsx(Z,{onClick:()=>Y(f),children:"Upload files…"}),_&&e.jsxs(e.Fragment,{children:[e.jsx(ue,{}),h&&e.jsx(Z,{onClick:()=>g(P),children:h}),e.jsx(Z,{movesFocus:!0,onClick:()=>w(P),children:"Add to chat"})]}),A&&e.jsxs(e.Fragment,{children:[e.jsx(ue,{}),e.jsx(Z,{onClick:()=>C(P),children:"Copy"}),e.jsx(Z,{disabled:!j(f),onClick:()=>U(f),children:"Paste"}),e.jsx(Z,{onClick:()=>I(P),children:"Duplicate"})]}),e.jsx(ue,{}),_?e.jsxs(e.Fragment,{children:[e.jsx(Z,{onClick:()=>b(P,"absolute"),children:"Copy path"}),e.jsx(Z,{onClick:()=>b(P,"relative"),children:"Copy relative path"})]}):e.jsx(Z,{onClick:()=>b(P,"relative"),children:"Copy path"}),e.jsx(ue,{}),e.jsx(Z,{movesFocus:!0,onClick:()=>N(P),children:"Rename"}),e.jsx(Z,{variant:"destructive",onClick:()=>F(P),children:"Delete"})]})]})}function vn({initialName:t,onSubmit:n,onCancel:a}){const x=s.useRef(null),[p,c]=s.useState(t);s.useEffect(()=>{const m=x.current;if(!m)return;m.focus();const r=t.lastIndexOf(".");m.setSelectionRange(0,r>0?r:t.length)},[t]);const o=()=>{const m=p.trim();m&&m!==t?n(m):a()};return e.jsx("input",{ref:x,type:"text",value:p,"aria-label":"New name",onChange:m=>c(m.target.value),onClick:m=>m.stopPropagation(),onBlur:o,onKeyDown:m=>{m.stopPropagation(),m.key==="Enter"?o():m.key==="Escape"&&a()},className:"border-border bg-background min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})}const Cn=100,bn=28,kn=250;function jn(t){const{rows:n,selectedPath:a,renamingPath:x,errorPaths:p,onSelectPath:c,onRetryDir:o}=t,m=s.useRef(null),r=H(v=>v.setScrollTop),i=H(v=>v.scopeKey),u=s.useCallback(v=>v.type==="dir"?t.onToggle(v):t.onOpen(v),[t]),N=En(t,u),F=n.length>Cn,D=en({count:n.length,getScrollElement:()=>m.current,estimateSize:()=>bn,overscan:12,enabled:F}),L=s.useRef({scope:void 0,done:!1}),C=s.useRef(null);s.useLayoutEffect(()=>{const v=L.current;if(v.scope!==i&&(v.scope=i,v.done=!1),v.done||n.length===0)return;const z=m.current;if(!z)return;const B=H.getState().scrollTop;if(B<=0){v.done=!0;return}F?D.scrollToOffset(B):z.scrollTop=B,C.current=z.scrollTop,z.scrollTop>=B&&(v.done=!0)},[n.length,i,F,D]);const U=s.useRef(null),I=s.useRef(null),j=s.useCallback(()=>{const v=m.current;v&&v.scrollTop!==C.current&&(L.current.done=!0,U.current=v.scrollTop,I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{I.current=null,U.current!==null&&r(U.current)},kn))},[r]);s.useEffect(()=>()=>{I.current&&clearTimeout(I.current),U.current!==null&&r(U.current)},[r]);const h=s.useRef(void 0);s.useEffect(()=>{var d,f;const v=h.current;if(h.current=a,v===void 0||a===v||a===null)return;const z=n.findIndex(T=>T.entry.path===a);if(z<0)return;const B=m.current;B&&(F?D.scrollToIndex(z,{align:"auto"}):(f=(d=B.querySelector(`[data-row-index="${z}"]`))==null?void 0:d.scrollIntoView)==null||f.call(d,{block:"nearest"}),C.current=B.scrollTop)},[a,n,F,D]);const[g,w]=s.useState(!1),{onCopyInto:b,onMove:S}=t,K=t.readOnly===!0,A=t.copyable!==!1,_=s.useCallback(v=>{K||!We(v.dataTransfer.types)||(v.preventDefault(),v.dataTransfer.dropEffect=v.altKey&&A?"copy":"move",w(!0))},[K,A]),$=s.useCallback((v,z)=>{const B=n.find(d=>d.entry.path===v);B&&b({path:v,isDir:B.entry.type==="dir"},z)},[n,b]),Y=s.useCallback(v=>{if(w(!1),K)return;const z=Ye(v.dataTransfer);z!==null&&(v.preventDefault(),v.altKey&&A?$(z,Q):S(z,Q))},[$,S,K,A]),P=v=>e.jsx(yn,{row:v,selected:v.entry.path===a,renaming:v.entry.path===x,error:v.entry.type==="dir"&&v.expanded&&p.has(v.entry.path),onSelect:z=>c(z.path),onActivate:u,onRetry:()=>o(v.entry.path),onSubmitRename:t.onSubmitRename,onCancelRename:t.onCancelRename,onStartRename:t.onStartRename,onNewFile:t.onNewFile,onNewFolder:t.onNewFolder,onDelete:t.onDelete,onMove:t.onMove,onCopyInto:$,onCopy:t.onCopy,onPaste:t.onPaste,onDuplicate:t.onDuplicate,canPasteInto:t.canPasteInto,revealLabel:t.revealLabel,onReveal:t.onReveal,onAddToChat:t.onAddToChat,onCopyPath:t.onCopyPath,readOnly:t.readOnly,provenance:t.provenance,copyable:t.copyable,onDisk:t.onDisk,onUpload:t.onUpload,onPickUpload:t.onPickUpload});return e.jsx("div",{ref:m,role:"tree","aria-label":"File explorer",tabIndex:0,onKeyDown:N,onScroll:j,onDragOver:_,onDragLeave:()=>w(!1),onDrop:Y,className:Pe("focus-visible:ring-ring h-full overflow-auto outline-none focus-visible:ring-1 focus-visible:ring-inset",g&&"ring-ring/60 bg-accent/30 ring-1 ring-inset"),children:F?e.jsx("div",{style:{height:D.getTotalSize()},className:"relative w-full",children:D.getVirtualItems().map(v=>e.jsx("div",{"data-row-index":v.index,className:"absolute top-0 left-0 w-full",style:{transform:`translateY(${v.start}px)`},children:P(n[v.index])},n[v.index].entry.path))}):n.map((v,z)=>e.jsx("div",{"data-row-index":z,children:P(v)},v.entry.path))})}function wn(t){return t?t.type==="dir"?t.path:G(t.path):Q}function En(t,n){const{rows:a,selectedPath:x,renamingPath:p,onSelectPath:c}=t;return s.useCallback(o=>{var i,u,N,F;if(p!==null)return;const m=a.findIndex(D=>D.entry.path===x),r=m>=0?a[m]:void 0;if(o.metaKey||o.ctrlKey){if(t.readOnly===!0||t.copyable===!1)return;const D=o.key.toLowerCase();if(D==="c"&&r){o.preventDefault(),t.onCopy(r.entry);return}if(D==="v"){o.preventDefault(),t.onPaste(wn(r==null?void 0:r.entry));return}return}switch(o.key){case"ArrowDown":o.preventDefault(),c(((i=a[Math.min(m+1,a.length-1)])==null?void 0:i.entry.path)??((u=a[0])==null?void 0:u.entry.path));break;case"ArrowUp":o.preventDefault(),c(((N=a[Math.max(m-1,0)])==null?void 0:N.entry.path)??((F=a[0])==null?void 0:F.entry.path));break;case"ArrowRight":(r==null?void 0:r.entry.type)==="dir"&&!r.expanded&&(o.preventDefault(),t.onToggle(r.entry));break;case"ArrowLeft":if(!r)break;if(o.preventDefault(),r.entry.type==="dir"&&r.expanded)t.onToggle(r.entry);else{const D=G(r.entry.path);D&&c(D)}break;case"Enter":r&&(o.preventDefault(),n(r.entry));break;case"F2":r&&t.readOnly!==!0&&(o.preventDefault(),t.onStartRename(r.entry));break;case"Delete":case"Backspace":r&&t.readOnly!==!0&&(o.preventDefault(),t.onDelete(r.entry));break}},[a,x,p,c,t,n])}const Dn={rename:"Rename it anyway",move:"Move it anyway",delete:"Delete it anyway",upload:"Upload mine over it"},Nn={rename:"nothing was renamed",move:"nothing was moved",delete:"nothing was deleted",upload:"nothing was uploaded"};function Rn(t){const{entry:n,fileCount:a,moreThan:x}=t;if(n.type!=="dir")return`“${n.name}” leaves the room’s files.`;const p=a===null?"everything in it":x?`the more than ${a.toLocaleString()} files in it`:a===1?"the 1 file in it":`the ${a.toLocaleString()} files in it`;return`“${n.name}” and ${p} leave the room’s files.`}const Sn="The room’s history keeps a copy. An agent can restore it.";function Tn({changes:t,onOpenTheirs:n,onReturnFocus:a}){var D;const x=L=>{L.preventDefault();const C=document.activeElement;C!==null&&C!==document.body||a()},{pendingDelete:p,pendingClash:c,conflict:o}=t,[m,r]=s.useState(p);p!==null&&p!==m&&r(p);const[i,u]=s.useState(c);c!==null&&c!==i&&u(c);const N=i===null?"":i.dir===Q?"The top folder":`“${i.dir}”`,F=(i==null?void 0:i.names.length)===1;return e.jsxs(e.Fragment,{children:[e.jsx(fe,{open:p!==null,onOpenChange:L=>!L&&t.cancelDelete(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:m===null?"":`Delete “${m.entry.name}”?`}),e.jsx(xe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{children:m===null?"":Rn(m)}),e.jsx("p",{children:Sn})]})})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.cancelDelete,children:"Cancel"}),e.jsx(ve,{onClick:()=>void t.confirmDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:(m==null?void 0:m.entry.type)==="dir"?"Delete folder":"Delete file"})]})]})}),e.jsx(fe,{open:c!==null,onOpenChange:L=>!L&&t.cancelClash(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:F?`Replace “${i==null?void 0:i.names[0]}”?`:`Replace ${(i==null?void 0:i.names.length)??0} files?`}),e.jsx(xe,{children:F?`${N} already has a file with this name. Replace it, or keep both.`:`${N} already has files named ${(i==null?void 0:i.names.join(", "))??""}. Replace them, or keep both.`})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.cancelClash,children:"Cancel"}),e.jsx(W,{variant:"outline",onClick:()=>void t.resolveClash("keep-both"),children:"Keep both"}),e.jsx(ve,{onClick:()=>void t.resolveClash("replace"),children:"Replace"})]})]})}),e.jsx(fe,{open:o!==null,onOpenChange:L=>!L&&t.dismissConflict(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:"Somebody changed this first"}),e.jsx(xe,{children:o===null?"":`${((D=o.lastCommit)==null?void 0:D.author)??"Somebody"} changed “${o.path}” after you opened it, so ${Nn[o.kind]}.`})]}),(o==null?void 0:o.lastCommit)&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:[o.lastCommit.subject," · ",bt(o.lastCommit.at)]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.dismissConflict,children:"Cancel"}),e.jsx(W,{variant:"outline",onClick:()=>{o!==null&&(t.dismissConflict(),n(o.path))},children:"Open their version"}),e.jsx(ve,{onClick:()=>{o!==null&&(t.dismissConflict(),o.retry())},className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:o===null?"":Dn[o.kind]})]})]})})]})}function ze(t,n){return n.name===t?qe(t):`“${n.name}” is already there. Some computers ignore capital letters in names. Pick another name.`}const Fn="Folders can’t be uploaded. Drop the files inside instead.";function Pn({source:t,className:n,onCommands:a}={}){var de;const x=ne(),p=Te(l=>l.selectedCwd),c=s.useMemo(()=>p?xn({transport:x,cwd:p}):null,[x,p]),o=t===void 0?c:t,m=o!==null&&!o.writable,r=mn(o),i=r.changes,u=oe(),N=H(l=>l.showHidden),{rows:F,rootLoading:D,rootError:L,rootErrorMessage:C,rootErrorCommand:U,errorPaths:I}=r,j=H(l=>l.setCommands),h=H(l=>l.selectedPath),g=H(l=>l.setSelectedPath),w=H(l=>l.clipboard),[b,S]=s.useState(null),[K,A]=s.useState(null),[_,$]=s.useState(null),Y=s.useCallback(l=>$(l===null?null:{path:l,isNew:!1}),[]),P=s.useRef(null),v=s.useRef(Q),[z,B]=s.useState(!1),d=s.useCallback((l,M)=>{if(i!==null){if(M.length===0){J.error(Fn);return}r.ensureExpanded(l),i.upload(l,M)}},[i,r]),f=s.useRef(null),T=s.useCallback(()=>{var l,M;(M=(l=f.current)==null?void 0:l.querySelector('[role="tree"]'))==null||M.focus()},[]),y=s.useCallback(l=>{var M;v.current=l,(M=P.current)==null||M.click()},[]),O=s.useCallback(l=>w!==null&&!(w.isDir&&Ce(l,w.path)),[w]),E=s.useCallback((l,M)=>{r.ensureExpanded(l),_e.flushSync(()=>{A(null),S({parent:l,type:M})})},[r]),R=s.useCallback(l=>{_e.flushSync(()=>A(l.path))},[]),k=s.useRef({startCreate:E,reload:r.reload,pickUpload:y});s.useEffect(()=>{k.current={startCreate:E,reload:r.reload,pickUpload:y}});const q=i!==null;s.useEffect(()=>{if(m||a===void 0&&q)return;const l=a??j;return l({newFile:()=>k.current.startCreate(Q,"file"),newFolder:()=>k.current.startCreate(Q,"dir"),refresh:()=>k.current.reload(),...q&&{upload:()=>k.current.pickUpload(Q)}}),()=>l(null)},[j,a,m,q]);const te=s.useCallback(async l=>{var se;if(!b||o===null)return;const M=b;if(S(null),i!==null){const re=(((se=u.getQueryData(le(o,M.parent,N)))==null?void 0:se.entries)??[]).find(ot=>ot.name.toLowerCase()===l.toLowerCase());if(M.type==="dir"){if(re!==void 0&&!(re.type==="dir"&&re.name===l)){J.error(ze(l,re));return}S({parent:ee(M.parent,l),type:"file",firstInFolder:l});return}if(re!==void 0){J.error(ze(l,re));return}const rt=ee(M.parent,l);$({path:rt,isNew:!0});return}await r.createEntry(M.parent,l,M.type)&&g(ee(M.parent,l))},[b,o,i,u,N,r,g]),V=s.useCallback(async(l,M)=>{A(null),(i?await i.renameEntry(l,M):await r.renameEntry(l,M))&&g(ee(G(l.path),M))},[i,r,g]);return o===null?t!==void 0?null:e.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-6 text-center text-sm",children:"Pick a folder to see its files."}):e.jsxs("div",{ref:f,className:Pe("flex h-full flex-col",z&&"ring-ring/60 bg-accent/30 ring-1 ring-inset",n),onDragOver:l=>{i===null||!ke(l.dataTransfer.types)||(l.preventDefault(),l.dataTransfer.dropEffect="copy",B(!0))},onDragLeave:l=>{l.currentTarget.contains(l.relatedTarget)||B(!1)},onDrop:l=>{B(!1),!(i===null||!ke(l.dataTransfer.types))&&(l.preventDefault(),d(Q,st(l.dataTransfer).files))},children:[i!==null&&e.jsx("input",{ref:P,type:"file",multiple:!0,hidden:!0,"aria-hidden":!0,tabIndex:-1,"data-testid":"room-files-upload-input",onChange:l=>{const M=Array.from(l.target.files??[]);l.target.value="",d(v.current,M)}}),e.jsxs("div",{className:"min-h-0 flex-1",children:[b&&e.jsx(On,{type:b.type,firstInFolder:b.firstInFolder,onSubmit:l=>void te(l),onCancel:()=>S(null)},`${b.parent}:${b.type}:${b.firstInFolder??""}`),D&&F.length===0?e.jsx("div",{className:"flex h-20 items-center justify-center",children:e.jsx(Fe,{size:"md",className:"text-muted-foreground",label:"Loading files"})}):L&&F.length===0?e.jsxs("div",{className:"text-muted-foreground flex min-h-20 flex-col items-center justify-center gap-2 px-4 py-3 text-center text-xs [overflow-wrap:anywhere]",children:[e.jsx("span",{children:C??"Couldn’t load files."}),U!==null&&e.jsx("code",{"aria-label":"Command that removes the settings",className:"bg-muted text-foreground block w-full rounded px-2 py-1.5 text-left font-mono select-all",children:U}),e.jsxs(W,{variant:"outline",size:"xs",onClick:r.reload,children:[e.jsx(Ge,{}),"Retry"]})]}):F.length===0&&!b?e.jsx("div",{className:"text-muted-foreground/60 flex h-20 items-center justify-center px-4 text-center text-xs",children:i!==null?"No files yet. Drop files here, or use Upload.":"Empty folder"}):e.jsx(jn,{rows:F,selectedPath:h,renamingPath:K,errorPaths:I,onSelectPath:g,onToggle:r.toggleExpand,onOpen:l=>{o.preview==="inline"?Y(l.path):r.openFile(l)},onRetryDir:r.retryDir,onSubmitRename:(l,M)=>void V(l,M),onCancelRename:()=>A(null),onStartRename:R,onNewFile:l=>E(l,"file"),onNewFolder:l=>E(l,"dir"),onDelete:l=>i?i.requestDelete(l):void r.removeEntry(l),onMove:(l,M)=>void(i?i.moveEntry(l,M):r.moveEntry(l,M)),onCopyInto:(l,M)=>void r.copyEntry(l,M),onCopy:r.copyToClipboard,onPaste:l=>{w&&r.copyEntry(w,l)},onDuplicate:l=>void r.copyEntry({path:l.path,isDir:l.type==="dir"},G(l.path)),canPasteInto:O,readOnly:m,provenance:o.provenance,copyable:i===null,onDisk:o.cwd!==null,onUpload:i?d:void 0,onPickUpload:i?y:void 0,revealLabel:r.revealLabel,onReveal:l=>void r.reveal(l),onAddToChat:r.addToChat,onCopyPath:(l,M)=>void r.copyPath(l,M)})]}),o.preview==="inline"&&e.jsx(Gt,{source:o,path:(_==null?void 0:_.path)??null,isNew:(_==null?void 0:_.isNew)??!1,onCreated:()=>{_!==null&&($({path:_.path,isNew:!1}),g(_.path))},onClose:()=>$(null)}),i!==null&&e.jsx(Tn,{changes:i,onOpenTheirs:l=>Y(l),onReturnFocus:T}),e.jsx(fe,{open:r.pendingRecursiveDelete!==null,onOpenChange:l=>!l&&r.cancelRecursiveDelete(),children:e.jsxs(he,{children:[e.jsxs(pe,{children:[e.jsxs(me,{children:["Delete “",(de=r.pendingRecursiveDelete)==null?void 0:de.name,"”?"]}),e.jsx(xe,{children:"This folder isn’t empty. Everything inside is deleted. This can’t be undone."})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:r.cancelRecursiveDelete,children:"Cancel"}),e.jsx(ve,{onClick:()=>void r.confirmRecursiveDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:"Delete folder"})]})]})})]})}function On({type:t,firstInFolder:n,onSubmit:a,onCancel:x}){const p=s.useRef(null),[c,o]=s.useState("");s.useEffect(()=>{var i;(i=p.current)==null||i.focus()},[]);const m=()=>{const i=c.trim();i?a(i):x()},r=e.jsxs("div",{className:"flex items-center gap-1",children:[t==="dir"?e.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(Ve,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("input",{ref:p,type:"text",value:c,"aria-label":n!==void 0?`First file in ${n}`:t==="dir"?"New folder name":"New file name",placeholder:t==="dir"?"folder-name":"file-name",onChange:i=>o(i.target.value),onBlur:m,onKeyDown:i=>{i.key==="Enter"?m():i.key==="Escape"&&x()},className:"border-border bg-background min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})]});return n===void 0?e.jsx("div",{className:"px-3 py-1",children:r}):e.jsxs("div",{className:"space-y-1 px-3 py-1",children:[e.jsxs("p",{className:"text-muted-foreground flex min-w-0 items-center gap-1 text-xs",children:[e.jsx(be,{className:"size-(--size-icon-xs) flex-shrink-0 text-sky-500"}),e.jsx("span",{className:"truncate",children:n})]}),r,e.jsx("p",{className:"text-muted-foreground text-2xs",children:"Name its first file. The folder appears on save."})]})}function at(){const t=H(x=>x.showHidden),n=H(x=>x.setShowHidden),a=t?"Hide hidden files":"Show hidden files";return e.jsx(W,{variant:"ghost",size:"icon-xs","aria-label":a,title:a,onClick:()=>n(!t),children:t?e.jsx(kt,{className:"text-muted-foreground"}):e.jsx(jt,{className:"text-muted-foreground"})})}function Mn({cwd:t}){const n=ne(),{data:a}=ce({queryKey:["file-explorer","workspace",t],queryFn:()=>n.resolveWorkspace(t),staleTime:6e4});return a!=null&&a.branch?e.jsxs("span",{className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",title:`Workspace ${a.key} on ${a.branch}`,children:[e.jsx(Xe,{className:"size-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:a.branch})]}):null}function Vn(){const t=Te(a=>a.selectedCwd),n=H(a=>a.commands);return t?e.jsxs(e.Fragment,{children:[e.jsx(Mn,{cwd:t}),e.jsx(W,{variant:"ghost",size:"icon-xs","aria-label":"New file",title:"New file",onClick:()=>n==null?void 0:n.newFile(),children:e.jsx(et,{className:"text-muted-foreground"})}),e.jsx(W,{variant:"ghost",size:"icon-xs","aria-label":"New folder",title:"New folder",onClick:()=>n==null?void 0:n.newFolder(),children:e.jsx(He,{className:"text-muted-foreground"})}),e.jsx(at,{}),e.jsx(W,{variant:"ghost",size:"icon-xs","aria-label":"Refresh",title:"Refresh",onClick:()=>n==null?void 0:n.refresh(),children:e.jsx(wt,{className:"text-muted-foreground"})})]}):null}function _n({roomId:t}){const n=ne(),a=oe(),x=ce(Ue(n,t));s.useEffect(()=>Vt(a,t,()=>{a.invalidateQueries({queryKey:De.repoStatus(t)})}),[a,t]);const p=s.useMemo(()=>{var r;return((r=x.data)==null?void 0:r.kind)==="ok"?Et(x.data.status):[]},[x.data]),c=Dt(p),o=Nt(p);if(!o)return null;const m=p.map((r,i)=>`${c[i]}: ${Rt(r)}`);return e.jsxs("span",{"data-slot":"pending-work-badge",title:m.join(`
17
- `),className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",children:[e.jsx(Xe,{className:"size-3 flex-shrink-0"}),e.jsxs("span",{className:"sr-only",children:["Not merged into the room yet. ",m.join(". "),"."]}),e.jsx("span",{"aria-hidden":"true",className:"truncate",children:o})]})}const An={added:"added",modified:"changed",deleted:"deleted",untracked:"new"},Ln=new Map([["OPERATOR_ONLY","Only the owner of this DorkOS can keep or discard these."],["ROOM_FILE_NOT_FOUND","One of those changes is gone, so nothing was discarded. The list is refreshed."],["MERGE_IN_FLIGHT","Something else is writing to these files. Nothing changed. Try again in a moment."],["MAIN_CHECKOUT_DIRTY","These files are on another branch. Switch them back to main yourself."],["ROOM_REPO_GIT_UNAVAILABLE","Room files need git, and git isn’t installed on this computer."],["ROOM_HAS_NO_REPO","This room no longer has its own files."],["ROOM_REPOS_DISABLED","Room files are turned off on this install."]]);function zn({roomId:t}){var U,I;const n=ne(),a=oe(),x=ce(Ue(n,t)),[p,c]=s.useState([]),[o,m]=s.useState(!1),[r,i]=s.useState(null),u=St({mutationFn:j=>n.repairRoomMain(t,j),onSuccess:()=>{c([]),m(!1),i(null),a.invalidateQueries({queryKey:De.repoStatus(t)})},onError:j=>{m(!1);const h=Ln.get(Tt(j)??"");i(h??"Couldn’t update the files. Try again in a moment."),a.invalidateQueries({queryKey:De.repoStatus(t)})}});if(((U=x.data)==null?void 0:U.kind)==="unavailable")return e.jsx("p",{role:"alert","data-slot":"room-main-warning",className:"border-border/60 text-muted-foreground rounded-lg border px-3 py-2.5 text-xs",children:"Couldn’t check this room’s files. Saves may not work. Try again soon."});const N=((I=x.data)==null?void 0:I.kind)==="ok"?x.data.status.main:void 0;if(N===void 0||!N.dirty)return null;const F=N.branch!=="main",D=p.filter(j=>N.strays.some(h=>h.path===j)),L=o&&D.length>0,C=j=>c(h=>h.includes(j)?h.filter(g=>g!==j):[...h,j]);return e.jsxs("div",{"data-slot":"room-main-warning",className:"border-border/60 bg-muted/40 space-y-3 rounded-lg border px-3 py-2.5 text-sm",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Ft,{className:"text-muted-foreground mt-0.5 size-(--size-icon-sm) flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("div",{role:"alert",className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"Somebody changed this room’s files outside DorkOS"}),F?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:`This room’s files are on ${N.branch??"no branch"}, not main.`}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until they’re back on main."})]}):e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until you keep or discard these."})]}),F&&e.jsx(Pt,{className:"text-xs",children:e.jsx("p",{children:"DorkOS won’t switch the branch for you. There may be work on it."})})]})]}),!F&&e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"space-y-1.5",children:N.strays.map(j=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(Ot,{id:`stray-${t}-${j.path}`,checked:D.includes(j.path),onCheckedChange:()=>C(j.path),disabled:u.isPending}),e.jsx("label",{htmlFor:`stray-${t}-${j.path}`,className:"min-w-0 flex-1 cursor-pointer truncate font-mono text-xs",title:j.path,children:j.path}),e.jsx("span",{className:"text-muted-foreground flex-shrink-0 text-xs",children:An[j.kind]})]},j.path))}),N.strayCount>N.strays.length&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["…and ",N.strayCount-N.strays.length," more not shown. “Keep them all” keeps these too."]}),L?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs",children:D.length===1?"Discard this change? It can’t be undone.":`Discard these ${D.length} changes? They can’t be undone.`}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(W,{type:"button",variant:"ghost",size:"sm",disabled:u.isPending,onClick:()=>m(!1),children:"Cancel"}),e.jsx(W,{type:"button",variant:"destructive",size:"sm",disabled:u.isPending,onClick:()=>u.mutate({action:"discard",paths:[...D]}),children:D.length===1?"Discard change":`Discard ${D.length} changes`})]})]}):e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(W,{type:"button",variant:"outline",size:"sm",disabled:u.isPending,onClick:()=>u.mutate({action:"commit"}),children:"Keep them all"}),e.jsx(W,{type:"button",variant:"ghost",size:"sm",disabled:u.isPending||D.length===0,onClick:()=>m(!0),children:D.length===0?"Discard…":`Discard ${D.length}`})]})]}),r!==null&&e.jsx("p",{role:"alert",className:"text-destructive text-xs",children:r})]})}const Ee="pointer-coarse:size-11";function Xn({roomId:t,canChange:n}){const a=ne(),x=oe(),p=H(F=>F.showHidden),[c,o]=s.useState(null),m=s.useMemo(()=>Be({transport:a,queryClient:x,roomId:t,canChange:n}),[a,x,t,n]),r=ce(je(m,Q,p,x)),i=r.isSuccess&&r.data.absent!==!0||r.isError,[u,N]=s.useState(null);return i&&u!==t&&N(t),!i&&u!==t?null:e.jsxs("section",{"aria-label":"Room files",className:"space-y-2",children:[e.jsxs("header",{className:"flex items-center gap-2",children:[e.jsx(Mt,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Files"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(_n,{roomId:t})}),n&&e.jsxs(e.Fragment,{children:[e.jsx(W,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"New file",title:"New file",disabled:c===null,onClick:()=>c==null?void 0:c.newFile(),children:e.jsx(et,{className:"text-muted-foreground"})}),e.jsx(W,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"New folder",title:"New folder",disabled:c===null,onClick:()=>c==null?void 0:c.newFolder(),children:e.jsx(He,{className:"text-muted-foreground"})}),e.jsx(W,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"Upload files",title:"Upload files",disabled:(c==null?void 0:c.upload)===void 0,onClick:()=>{var F;return(F=c==null?void 0:c.upload)==null?void 0:F.call(c)},children:e.jsx(sn,{className:"text-muted-foreground"})})]}),e.jsx(at,{})]}),e.jsx(zn,{roomId:t}),e.jsx("div",{"data-slot":"room-files-body",className:"border-border/60 h-72 overflow-hidden rounded-lg border",children:e.jsx(Pn,{source:m,onCommands:o})})]})}function Zn({roomId:t,attachment:n}){var i;const a=ne(),x=oe(),p=s.useMemo(()=>Be({transport:a,queryClient:x,roomId:t}),[a,x,t]),c=ce(je(p,Q,!1,x)),[o,m]=s.useState(!1),r=_t(t);return!c.isSuccess||c.data.absent===!0||((i=r.data)==null?void 0:i.archived)!==!1?null:e.jsxs(e.Fragment,{children:[e.jsx(W,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`Save ${n.name} to the room’s files`,title:"Save to room files",className:"text-muted-foreground hover:text-foreground mt-0.5 pointer-coarse:size-11",onClick:()=>m(!0),children:e.jsx(At,{})}),o&&e.jsx($n,{roomId:t,source:p,attachment:n,onClose:()=>m(!1)})]})}function $n({roomId:t,source:n,attachment:a,onClose:x}){const p=ne(),c=oe(),[o,m]=s.useState(Q),[r,i]=s.useState(a.name),[u,N]=s.useState(null),[F,D]=s.useState(!1),L=s.useId(),C=ce(je(n,o,!1,c)),U=s.useMemo(()=>{var j;return nt(((j=C.data)==null?void 0:j.entries)??[]).filter(h=>h.type==="dir")},[C.data]),I=async()=>{var h,g;const j=r.trim();if(j!==""){D(!0),N(null);try{await p.saveAttachmentToRoomFiles(t,{attachmentId:a.id,dir:o,name:j,baseCommit:((h=C.data)==null?void 0:h.commit)??null}),c.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),J.success(`Saved ${j} to the room’s files`),x()}catch(w){let b;try{b=Xt(w,c,t)}catch{b={status:"refused",reason:Qe(w)??"Couldn’t save. Try again in a moment."}}if(b.status==="exists"){const S=(((g=C.data)==null?void 0:g.entries)??[]).map(K=>K.name);N({reason:`This folder already has a file called “${j}”. Pick another name.`,suggestion:Oe({name:j,isDir:!1,taken:[...S,j]})})}else b.status==="conflict"?(N({reason:"This folder changed while you chose, so nothing was saved. Try again."}),C.refetch()):b.status==="refused"&&N({reason:b.reason})}finally{D(!1)}}};return e.jsx(Lt,{open:!0,onOpenChange:j=>!j&&x(),children:e.jsxs(zt,{className:"sm:max-w-md",children:[e.jsxs($t,{children:[e.jsx(It,{children:"Save to room files"}),e.jsx(Kt,{children:"Everyone in the room, and their agents, can find it there."})]}),e.jsxs(Ht,{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Folder"}),e.jsxs("div",{role:"group","aria-label":"Folders",className:"border-border/60 max-h-56 overflow-auto rounded-md border",children:[e.jsx("p",{className:"bg-muted/40 truncate px-3 py-1.5 font-mono text-xs",children:o===Q?"Top folder":`${o}/`}),o!==Q&&e.jsx($e,{label:"Up one folder",icon:e.jsx(nn,{className:"text-muted-foreground size-(--size-icon-sm)"}),onClick:()=>m(G(o))}),C.isPending?e.jsx("div",{className:"flex h-12 items-center justify-center",children:e.jsx(Fe,{size:"sm",className:"text-muted-foreground",label:"Loading folders"})}):U.length===0?e.jsx("p",{className:"text-muted-foreground px-3 py-2 text-xs",children:"No folders in here."}):U.map(j=>e.jsx($e,{label:j.name,icon:e.jsx(be,{className:"size-(--size-icon-sm) text-sky-500"}),chevron:!0,onClick:()=>m(ee(o,ie(j.path)))},j.path))]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:L,className:"text-muted-foreground text-xs font-medium",children:"Name"}),e.jsx(Ut,{id:L,value:r,onChange:j=>{i(j.target.value),N(null)},spellCheck:!1,autoComplete:"off"})]}),u!==null&&e.jsxs("div",{role:"alert",className:"text-destructive space-y-1 text-xs",children:[e.jsx("p",{children:u.reason}),u.suggestion!==void 0&&e.jsxs(W,{type:"button",variant:"outline",size:"xs",onClick:()=>{i(u.suggestion),N(null)},children:["Use “",u.suggestion,"”"]})]})]}),e.jsxs(qt,{className:"gap-2",children:[e.jsx(W,{type:"button",variant:"ghost",onClick:x,children:"Cancel"}),e.jsx(W,{type:"button",disabled:F||r.trim()===""||C.isPending,onClick:()=>void I(),children:F?"Saving…":o===Q?"Save to the top folder":`Save to ${ie(o)}`})]})]})})}function $e({label:t,icon:n,chevron:a=!1,onClick:x}){return e.jsxs("button",{type:"button",onClick:x,className:"hover:bg-accent/50 focus-visible:bg-accent flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm outline-none",children:[n,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),a&&e.jsx(Ke,{className:"text-muted-foreground size-3.5"})]})}export{Pn as FileExplorer,Vn as FileExplorerActions,Gt as FilePreviewDialog,an as HIDDEN_ENTRY_NAMES,at as HiddenEntriesToggle,ts as NO_PROVENANCE,Ne as PINNED_ENTRY_NAMES,ns as ROOM_FILES_REFRESH_INTERVAL_MS,Xn as RoomFilesSection,Zn as SaveToRoomFilesButton,Be as createRoomFilesSource,xn as createSessionCwdSource,le as explorerDirQueryKey,je as explorerDirQueryOptions,rn as isHiddenEntryName,Re as isPinnedEntryName,on as pinnedFirst,Wt as provenanceLine,Ue as roomRepoStatusQueryOptions,nt as withoutHidden};